Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: Updated instrumentation for http, undici, grpc to use a new segment.captureExternalAttributes to centralize the necessary data needed to create segment and span attributes #2179

Merged
merged 2 commits into from
May 2, 2024

Conversation

bizob2828
Copy link
Member

@bizob2828 bizob2828 commented May 1, 2024

Description

This PR adds a new method to TraceSegment called captureExternalAttributes. I tried to do more with reducing the number of times we parse a url and actually swap it out for new URL but the signatures do not contain an absolute URL or even all the parts to construct it in http-outbound instrumentation. I also found when reviewing #2169 that in the streaming span events we weren't properly removing the attributes that get translated when applied from segment. This cleans that up and adds necessary assertions. Lastly, grpc instrumentation was defining the translated attributes like http.url, http.method directly on segment. Since this instrumentation was updated to use the new captureExternalAttributes it'll assign the appropriate attributes on segment and then propagate to span where applicable.

Oh yea, and I also removed captureDBInstanceAttributes from TraceSegment. It was only used in tests and duplicate logic from the DatastoreShim. My guess is the code that was removed came first and when shim was a thing it was never updated.

Related Issues

Closes #2177

… `segment.captureExternalAttributes` to centralize the necessary data needed to create segment and span attributes
@mrickard mrickard self-assigned this May 1, 2024
mrickard
mrickard previously approved these changes May 1, 2024
lib/instrumentation/undici.js Outdated Show resolved Hide resolved
lib/instrumentation/undici.js Outdated Show resolved Hide resolved
@bizob2828 bizob2828 merged commit ddb6356 into newrelic:main May 2, 2024
22 checks passed
@bizob2828 bizob2828 deleted the add-capture-external-attrs branch May 2, 2024 18:46
bizob2828 added a commit that referenced this pull request May 20, 2024
… `segment.captureExternalAttributes` to centralize the necessary data needed to create segment and span attributes (#2179)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Abstract common attributes necessary for tracking external segments/spans
3 participants