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

Convert ratpack 1.7 tests from groovy to java #12980

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

jaydeluca
Copy link
Member

Related to #7195

.addSpanProcessor(SimpleSpanProcessor.create(spanExporter))
.build();

protected OpenTelemetry openTelemetry =
Copy link
Contributor

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

Copy link
Member Author

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

Comment on lines +34 to +51
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);
}
Copy link
Contributor

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.

@jaydeluca jaydeluca marked this pull request as draft January 2, 2025 13:12
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.

2 participants