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

Http server builder #11651

Merged
merged 14 commits into from
Oct 7, 2024
Merged

Http server builder #11651

merged 14 commits into from
Oct 7, 2024

Conversation

zeitlinger
Copy link
Member

@zeitlinger zeitlinger commented Jun 21, 2024

@zeitlinger zeitlinger self-assigned this Jun 21, 2024
@zeitlinger zeitlinger force-pushed the http-server-builder branch from 7abd2c2 to 5a9814d Compare June 22, 2024 10:52
@zeitlinger zeitlinger force-pushed the http-server-builder branch from 5a9814d to a8db58f Compare July 11, 2024 10:54
@zeitlinger zeitlinger force-pushed the http-server-builder branch from c08a511 to 489ef33 Compare August 22, 2024 11:32
@zeitlinger zeitlinger marked this pull request as ready for review September 27, 2024 07:52
@zeitlinger zeitlinger requested a review from a team as a code owner September 27, 2024 07:52
@zeitlinger
Copy link
Member Author

@laurit @trask these are the remaining changes - please let me know if this is too big

@github-actions github-actions bot added the test native This label can be applied to PRs to trigger them to run native tests label Oct 2, 2024
Comment on lines -28 to +23
AkkaHttpServerAttributesGetter httpAttributesGetter = new AkkaHttpServerAttributesGetter();
InstrumenterBuilder<HttpRequest, HttpResponse> builder =
Instrumenter.<HttpRequest, HttpResponse>builder(
GlobalOpenTelemetry.get(),
AkkaHttpUtil.instrumentationName(),
HttpSpanNameExtractor.builder(httpAttributesGetter)
.setKnownMethods(AgentCommonConfig.get().getKnownHttpRequestMethods())
.build())
.setSpanStatusExtractor(HttpSpanStatusExtractor.create(httpAttributesGetter))
.addAttributesExtractor(
HttpServerAttributesExtractor.builder(httpAttributesGetter)
.setCapturedRequestHeaders(AgentCommonConfig.get().getServerRequestHeaders())
.setCapturedResponseHeaders(AgentCommonConfig.get().getServerResponseHeaders())
.setKnownMethods(AgentCommonConfig.get().getKnownHttpRequestMethods())
.build())
.addOperationMetrics(HttpServerMetrics.get())
.addContextCustomizer(
HttpServerRoute.builder(httpAttributesGetter)
.setKnownMethods(AgentCommonConfig.get().getKnownHttpRequestMethods())
.build());
if (AgentCommonConfig.get().shouldEmitExperimentalHttpServerTelemetry()) {
builder
.addAttributesExtractor(HttpExperimentalAttributesExtractor.create(httpAttributesGetter))
.addOperationMetrics(HttpServerExperimentalMetrics.get());
}
INSTRUMENTER = builder.buildServerInstrumenter(AkkaHttpServerHeaders.INSTANCE);
INSTRUMENTER =
JavaagentHttpServerInstrumenters.create(
AkkaHttpUtil.instrumentationName(),
new AkkaHttpServerAttributesGetter(),
AkkaHttpServerHeaders.INSTANCE);
Copy link
Member

Choose a reason for hiding this comment

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

wow, nice

@trask trask merged commit b9f09ca into open-telemetry:main Oct 7, 2024
56 checks passed
@zeitlinger zeitlinger deleted the http-server-builder branch October 8, 2024 06:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
test native This label can be applied to PRs to trigger them to run native tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants