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 jaxrs-1.0 tests to java #12745

Merged
merged 1 commit into from
Nov 19, 2024
Merged

Convert jaxrs-1.0 tests to java #12745

merged 1 commit into from
Nov 19, 2024

Conversation

laurit
Copy link
Contributor

@laurit laurit commented Nov 18, 2024

Part of #7195

@laurit laurit requested a review from a team as a code owner November 18, 2024 12:56
trace ->
trace.hasSpansSatisfyingExactly(
span ->
span.hasName("POST " + getContextPath() + expectedRoute)
Copy link
Member

Choose a reason for hiding this comment

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

not related to your test, but it's strange to me that the groovy test used the post method but asserted that the spans were GETs

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In groovy test the server span isn't created from the actual request but with runWithHttpServerSpan that just uses GET.

span.hasName("POST " + getContextPath() + expectedRoute)
.hasKind(SpanKind.SERVER)
.hasNoParent()
.hasAttributesSatisfying(
Copy link
Member

Choose a reason for hiding this comment

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

are we intentionally avoiding using hasAttributesSatisfyingExactly here so that we don't need to to assert all the other attributes on this span? Also the groovy tests expected an error.type that I don't see on this test's spans, is that an artifact of us switching the test dependencies from using the dropwizard testing package to using jetty directly?

Copy link
Contributor Author

@laurit laurit Nov 19, 2024

Choose a reason for hiding this comment

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

Yes, I intentionally skipped listing all attributes, but I guess they could be added for consistency with other tests. I was also confused by the error.type it is added because runWithHttpServerSpan uses

private enum HttpServerGetter implements HttpServerAttributesGetter<String, Void> {
that returns null from getHttpResponseStatusCode and interprets null as non successful request. I suspect this behavior might not conform to the spec as the spec says If the request has completed successfully, instrumentations SHOULD NOT set error.type. Does lack of status code mean that the request has failed? Imo not too important as real instrumentations always set the status code, and if they don't then there really must have been an error. cc @trask

Copy link
Member

Choose a reason for hiding this comment

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

I think it's ok to interpret null response status code as "not completed successfully", since a "successful" HTTP response would always have a response status code

@trask trask merged commit 059a4ca into open-telemetry:main Nov 19, 2024
56 checks passed
akats7 pushed a commit to akats7/opentelemetry-java-instrumentation that referenced this pull request Nov 21, 2024
akats7 pushed a commit to akats7/opentelemetry-java-instrumentation that referenced this pull request Nov 21, 2024
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.

3 participants