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

feat: Added segment and transaction synthesis for http server spans #2833

Merged
merged 1 commit into from
Dec 12, 2024

Conversation

bizob2828
Copy link
Member

@bizob2828 bizob2828 commented Dec 11, 2024

Description

This creates both the transaction and segment when the otel span is a server match. I expect more work to be done once we wire up the context manager. We're forcing the transaction name whereas our instrumentation decorates the namestate and finalizes the same on transaction end. I've found that most otel instrumentation sets the http.route attribute in the web frameworks which is like us and I think that's being used to finalize the http span name on the end of the request.

I also changed what the synthesizer returns. In the case of servers and will be for #2651 we need to create the transaction. So when the instrumentation for otel is wired up we'll need to bind both the transaction and segment to the context manager and not just the segment.

Related Issues

Closes #2649

Copy link

codecov bot commented Dec 11, 2024

Codecov Report

Attention: Patch coverage is 99.51220% with 1 line in your changes missing coverage. Please review.

Project coverage is 97.30%. Comparing base (67b8b51) to head (06489e4).
Report is 1 commits behind head on next.

Files with missing lines Patch % Lines
lib/otel/segment-synthesis.js 90.00% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##             next    #2833    +/-   ##
========================================
  Coverage   97.30%   97.30%            
========================================
  Files         299      303     +4     
  Lines       47019    47146   +127     
========================================
+ Hits        45751    45877   +126     
- Misses       1268     1269     +1     
Flag Coverage Δ
integration-tests-cjs-18.x 73.33% <ø> (ø)
integration-tests-cjs-20.x 73.34% <ø> (+<0.01%) ⬆️
integration-tests-cjs-22.x 73.38% <ø> (+<0.01%) ⬆️
unit-tests-18.x 89.14% <99.51%> (+0.02%) ⬆️
unit-tests-20.x 89.14% <99.51%> (+0.02%) ⬆️
unit-tests-22.x 89.15% <99.51%> (+0.02%) ⬆️
versioned-tests-18.x 79.18% <ø> (+0.02%) ⬆️
versioned-tests-20.x 79.16% <ø> (ø)
versioned-tests-22.x 79.19% <ø> (+0.02%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

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

Copy link
Contributor

@jsumners-nr jsumners-nr left a comment

Choose a reason for hiding this comment

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

I'll dig a little deeper tomorrow. But I have a question for your consideration in the meantime.

this.segment = this.genericHttpSegment()
}
this.transaction.baseSegment = this.segment
return { segment: this.segment, transaction: this.transaction }
Copy link
Contributor

Choose a reason for hiding this comment

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

I started writing class ConsumerSegment this morning and when I got to this equivalent line, I realized that we are returning something other than the object being created with new Whatever. Clearly that doesn't matter since return overriding is a thing, but do you think we should do so?

I ended up switching to writing a module segments/consumer.js that would just contain all of the code specific to that segment type and exporting a createConsumerSegment function.

I'm not opposed to either method. It just feels a little off to me to return something different from a class syntax constructor.

Copy link
Member Author

Choose a reason for hiding this comment

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

agreed. let me think on it more. We can chat tomorrow as well

Copy link
Member Author

Choose a reason for hiding this comment

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

we agreed to address this in a separate PR

Copy link
Contributor

@jsumners-nr jsumners-nr left a comment

Choose a reason for hiding this comment

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

Looks good to me.

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.

2 participants