-
Notifications
You must be signed in to change notification settings - Fork 876
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
Convert ratpack 1.7 tests from groovy to java #12980
base: main
Are you sure you want to change the base?
Conversation
.addSpanProcessor(SimpleSpanProcessor.create(spanExporter)) | ||
.build(); | ||
|
||
protected OpenTelemetry openTelemetry = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you consider modifying these tests to use InstrumentationExtension
so you wouldn't need to create OpenTelemetry
instance yourself and could use waitAndAssertTraces
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i had incorrectly assumed these were written this way intentionally. I will work on refactoring them to follow the same conventions used elsewhere
Context parentContext = Context.current(); | ||
Span span = tracer.spanBuilder("a-span").setParent(parentContext).startSpan(); | ||
|
||
Context otelContext = parentContext.with(span); | ||
try (Scope scope = otelContext.makeCurrent()) { | ||
Execution.current().add(Context.class, otelContext); | ||
HttpClient httpClient = event.getRegistry().get(HttpClient.class); | ||
httpClient | ||
.get(new URI(url)) | ||
.flatMap(response -> httpClient.get(new URI(url))) | ||
.then( | ||
response -> { | ||
span.end(); | ||
latch.countDown(); | ||
}); | ||
} catch (URISyntaxException e) { | ||
throw new RuntimeException(e); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this part is identical in both BarService and BarForkService is could be shared somehow.
Related to #7195