Skip to content

Link APM applications to DocumentDB instance endpoints (staging) - #3351

Open
nr-ahemsath wants to merge 1 commit into
newrelic:mainfrom
nr-ahemsath:docdb-instance-endpoint-stg
Open

nr-ahemsath wants to merge 1 commit into
newrelic:mainfrom
nr-ahemsath:docdb-instance-endpoint-stg

Conversation

@nr-ahemsath

Copy link
Copy Markdown
Member

Relevant information

Follow-up to #3323 and #3332. APM → DocumentDB links form when the agent reports the DocumentDB cluster endpoint, but not when it reports an instance endpoint.

What we found: we tested the .NET, Java and Python agents against the same single-instance DocumentDB cluster in staging (account 273070). In topology-discovery mode (the driver default), the Java agent (9.5.0, mongodb-driver-sync 5.5.2) and the Python agent (14.2.0, pymongo 4.19.0) report the instance endpoint, e.g.

Datastore/instance/MongoDB/dotnet-docdb-test-1.cokpc3aw6fev.us-west-2.docdb.amazonaws.com/27017

Those apps get no CALLS relationship. The same apps in direct-connection mode, and the .NET agent in both modes, report the cluster endpoint and link to the cluster entity.

Why: with a CloudWatch metric-streams AWS integration, INFRA-AWSDOCDBINSTANCE entities carry only aws.Arn, aws.Engine, account, region and AZ tags, plus displayName (the instance identifier). They have no endpoint, port, cluster-identifier or instance-identifier tags. So every AWSDOCUMENTDB tier misses for an instance endpoint. Tier 4 extracts the right instanceId (dotnet-docdb-test-1) but looks it up in tags.aws.rds.DBInstanceIdentifier / tags.aws.dbInstanceIdentifier, which aren't present.

Change (staging only): adds .stg.yml overrides of the candidate and synthesis files. The production files are untouched.

  • synthesis/APM-APPLICATION-to-AWSDOCUMENTDB.stg.yml: two new fields, instanceName and region, captured from the first and third hostname labels. They're captured only when the second label has no hyphen, so instance endpoints (<instance>.<hash>.<region>.docdb.amazonaws.com) match, and cluster (cluster-<hash>) and reader (cluster-ro-<hash>) endpoints don't.
  • candidates/AWSDOCUMENTDB.stg.yml: a new Tier 4 that matches INFRA-AWSDOCDBINSTANCE on tags.displayName = instanceName and tags.aws.awsRegion / tags.aws.region = region, with onMiss: NO_OP. It follows the displayName + region lookups in AWSMSKCLUSTER.yml and AWSSQSQUEUE.yml. The existing instance-ID tier becomes Tier 5, unchanged.

Precision: the datastore metric carries no AWS account ID, so the new tier can't match on account. Two linked AWS accounts with an instance of the same name in the same region would both be related. The existing instance-ID tier already has the same limitation.

Validation: npm --prefix validator run check passes. Staging validation: after deploy, confirm CALLS relationships from JavaDocDbTest-InVpc-Discovery and PythonDocDbTest-InVpc-Discovery to the dotnet-docdb-test-1 instance entity, and confirm that the existing cluster links are unchanged.

TBD: if this works in staging, I'll follow up with a PR that promotes the change to production and removes the .stg files.

Api Review Board (ARB)

This does not need an ARB ticket.

Checklist

  • I've read the guidelines and understand the acceptance criteria.
  • The value of the attribute marked as identifier will be unique and valid.
  • I've confirmed that my entity type wasn't already defined. If it is I'm providing an explanation above.
  • I've linked an ARB ticket & received approval from API Review Board in order to make these changes

🤖 Generated with Claude Code

Agents that report the server the MongoDB driver talked to (Java and
Python with topology discovery) report the DocumentDB instance
endpoint, e.g. <instance>.<hash>.<region>.docdb.amazonaws.com. With a
metric-streams AWS integration, instance entities carry no endpoint,
port or identifier tags, so every AWSDOCUMENTDB lookup tier misses.

Staging-only overrides:

- synthesis: capture instanceName and region from instance-endpoint
  hostnames. Cluster (cluster-*) and reader (cluster-ro-*) endpoints
  are excluded.
- candidates: new Tier 4 matching INFRA-AWSDOCDBINSTANCE on
  tags.displayName + region (as AWSMSKCLUSTER and AWSSQSQUEUE do).
  The instance-ID tier becomes Tier 5, unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant