Skip to content

Conversation

@lrafeei
Copy link
Contributor

@lrafeei lrafeei commented Nov 21, 2025

This PR contains a barebones implementation for Distributed Tracing/context propagation using OTel and NR APIs

@github-actions
Copy link

github-actions bot commented Nov 21, 2025

MegaLinter analysis: Success

Descriptor Linter Files Fixed Errors Warnings Elapsed time
✅ ACTION actionlint 7 0 0 0.97s
✅ MARKDOWN markdownlint 7 0 0 0 1.37s
✅ PYTHON ruff 971 0 0 0 1.02s
✅ PYTHON ruff-format 971 0 0 0 0.36s
✅ YAML prettier 15 0 0 0 1.51s
✅ YAML v8r 15 0 0 5.72s
✅ YAML yamllint 15 0 0 0.68s

See detailed reports in MegaLinter artifacts

MegaLinter is graciously provided by OX Security

@mergify mergify bot added the tests-failing Tests failing in CI. label Nov 21, 2025
@codecov-commenter
Copy link

codecov-commenter commented Nov 21, 2025

Codecov Report

❌ Patch coverage is 59.72222% with 29 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (develop-hybrid-core-tracing@378c2c6). Learn more about missing BASE report.

Files with missing lines Patch % Lines
newrelic/hooks/hybridagent_opentelemetry.py 48.64% 17 Missing and 2 partials ⚠️
newrelic/api/opentelemetry.py 69.69% 6 Missing and 4 partials ⚠️
Additional details and impacted files
@@                      Coverage Diff                       @@
##             develop-hybrid-core-tracing    #1589   +/-   ##
==============================================================
  Coverage                               ?   79.88%           
==============================================================
  Files                                  ?      213           
  Lines                                  ?    25060           
  Branches                               ?     3980           
==============================================================
  Hits                                   ?    20020           
  Misses                                 ?     3617           
  Partials                               ?     1423           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@lrafeei lrafeei force-pushed the hybrid-agent-context-management branch from 7b8ade6 to d61ac06 Compare December 2, 2025 20:49
@lrafeei lrafeei marked this pull request as ready for review December 2, 2025 21:11
@lrafeei lrafeei requested a review from a team as a code owner December 2, 2025 21:11
@mergify mergify bot added the merge-conflicts Merge conflicts detected. label Dec 8, 2025
@lrafeei lrafeei force-pushed the hybrid-agent-context-management branch from e8ab06d to 63d7803 Compare December 10, 2025 04:48
@mergify mergify bot removed the merge-conflicts Merge conflicts detected. label Dec 10, 2025
Copy link
Contributor

@hmstepanek hmstepanek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just gonna post this anyway if there's anything that is still relevant after the changes we discussed.

@lrafeei lrafeei requested a review from hmstepanek December 15, 2025 18:17
Copy link
Contributor

@hmstepanek hmstepanek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Out of time but posting a partial review-I'll look at the rest tomorrow.

# precedence over whatever sampling algorithm is
# enabled.

if self.otel_parent:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As I understand it from Chris - we need to always return sampled=True in order to fake OTEL into thinking the span is being sampled and collect data on it. Then we use our internal sampling decision later to decide whether we are actually going to sample it (aka add it to our reservoir).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's actually a fair point. Either way, it's going to get there...

lrafeei and others added 2 commits December 16, 2025 23:17
Co-authored-by: Hannah Stepanek <hstepanek@newrelic.com>
@lrafeei lrafeei requested a review from hmstepanek December 17, 2025 07:28
# This is an HTTP request (WSGI, ASGI, or otherwise)
nr_environ = context_carrier.copy()
attributes["nr.http.headers"] = nr_environ
attributes["nr.http.headers"] = context_carrier
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just wondering why we had/got rid of the copy here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I realized I was not actually manipulating the header data anymore, so I could just pass in the contents of the carrier directly as an attribute

@lrafeei lrafeei requested a review from hmstepanek December 17, 2025 23:42
@lrafeei lrafeei merged commit 5577ffd into develop-hybrid-core-tracing Dec 17, 2025
49 of 58 checks passed
@lrafeei lrafeei deleted the hybrid-agent-context-management branch December 17, 2025 23:57
@mergify mergify bot removed the tests-failing Tests failing in CI. label Dec 17, 2025
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.

4 participants