Commit Graph

8980 Commits

Author SHA1 Message Date
Trask Stalnaker fbdd611ab5
Update squash merge commit message (#8229) 2023-04-06 15:29:29 +00:00
Andrei Chugunov 506ca93699
webflux 5.0 groovy to java tests part 2 (#7776)
@trask @mateuszrzeszutek hello, what do you think about
SingleThreadedSpringWebfluxTest, the test contains dependencies on new
reactor netty classes in testLatestDeps case. I tried use reflection for
rewriting the test to java but it was not trivial and I not reach the
result

---------

Co-authored-by: Lauri Tulmin <ltulmin@splunk.com>
2023-04-05 19:33:23 -07:00
dependabot[bot] 273a2fe235
Bump org.testcontainers:testcontainers from 1.17.6 to 1.18.0 in /examples/extension (#8224) 2023-04-05 16:07:20 -07:00
dependabot[bot] 6a29e43b94
Bump org.testcontainers:testcontainers from 1.17.6 to 1.18.0 in /benchmark-overhead (#8226) 2023-04-05 16:06:28 -07:00
dependabot[bot] cd9d301214
Bump org.testcontainers:testcontainers from 1.17.6 to 1.18.0 in /examples/distro (#8223) 2023-04-05 16:05:53 -07:00
Trask Stalnaker 832549744b
Add comment about active request count attributes (#8221) 2023-04-05 14:40:51 -07:00
Lauri Tulmin 8aeffa5e80
Rename package.json to avoid dependabot alert (#8219)
This `package.json` contains outdated dependences, it is only used in a
test.

---------

Co-authored-by: Trask Stalnaker <trask.stalnaker@gmail.com>
2023-04-05 11:00:24 -07:00
Lauri Tulmin 856d521f0a
Update testcontainers and selenium (#8218) 2023-04-05 08:24:53 -07:00
Lauri Tulmin d87f40c9c7
Instrument akka-http bindAndHandle (#8174)
Resolves
https://github.com/open-telemetry/opentelemetry-java-instrumentation/issues/8143
Resolves
https://github.com/open-telemetry/opentelemetry-java-instrumentation/issues/6081
Resolves
https://github.com/open-telemetry/opentelemetry-java-instrumentation/issues/5137
Using the same approach as in
https://github.com/open-telemetry/opentelemetry-java-instrumentation/pull/6243
and as used by DataDog. Unlike in #6243 this pr does not attempt to
prevent leaking scopes into actors but rather instruments the actor to
reset context to get rid of the leaked scopes (DataDog does the same).
2023-04-05 17:11:05 +03:00
Lauri Tulmin 2f0819ae20
Improve compatibility with SecurityManager (#7983)
This pr gives classes defined in agent and extension class loaders all
permissions. Injected helper classes are also defined with all
permissions. Agent startup is altered so that we won't call methods that
require permission before we are able to get those permissions.
This pr does not attempt to address issues where agent code could allow
user code to circumvent security manager e.g.
https://github.com/open-telemetry/opentelemetry-java-instrumentation/blob/main/javaagent-bootstrap/src/main/java/io/opentelemetry/javaagent/bootstrap/InstrumentationHolder.java
gives access to `Instrumentation` that could be used to redefine classes
and remove security checks. Also this pr does not address failed
permission checks that could arise from user code calling agent code.
When user code, that does not have privileges, calls agent code, that
has the privileges, and agent code performs a sensitive operation then
permission check would fail because it is performed for all calling
classes, including the user classes. To fix this agent code should uses
`AccessController.doPrivileged` which basically means that, hey I have
done all the checks, run this call with my privileges and ignore the
privileges of my callers.
2023-04-05 15:41:37 +03:00
Lauri Tulmin e0ecb56e8b
Codeql detects zipslip vulnerability (#8209)
I think that the only way zipslip could happen is when name contains
`..` but codeql isn't able to cope with that. Removing the `..` check
gets rid of the code scanning alert.
2023-04-04 16:14:19 -07:00
dependabot[bot] b52bad1d8d
Bump io.quarkus.platform:quarkus-bom from 2.16.5.Final to 2.16.6.Final (#8213) 2023-04-04 16:12:43 -07:00
dependabot[bot] feb2872132
Bump io.quarkus from 2.16.5.Final to 2.16.6.Final (#8215) 2023-04-04 16:11:58 -07:00
Lauri Tulmin 8fba02e391
Skip spotless and other checks in CI test step (#8142)
Currently we run spotless and other checks for each of the parallel test
steps which seems wasteful. Here is an attempt to run only the tests in
given partition without any extra checks in the `test` step and run all
the checks in the `build` step.
2023-04-04 10:43:12 -07:00
Lauri Tulmin 34bca4ba10
Pulsar batch receive instrumentation (#8173) 2023-04-04 10:19:08 -07:00
Lauri Tulmin 4d21d45f3d
Verify that server span ends after child spans in java tests (#8208)
Currently server span end time verification is only implemented for
groovy tests.
2023-04-04 09:54:10 -07:00
Trask Stalnaker 702b9ae70f
Add breedx-splk as an approver (#8204)
Thanks @breedx-splk for all of your efforts in this repository reviewing
PRs!
2023-04-04 09:37:45 -07:00
jason plumb 32b6bd2a71
Ensure that parsed container ID is 64 chars. (#8206)
Resolves #7437.

A few caveats about this. The TL;DR on #7437 is that a non-containerized
process was reporting a `container.id` attribute. The submitter narrowed
it down and I was able to confirm with the test case in this PR.

I hunted for other means for code to determine if it's containerized
with the idea to not even do the parsing if not containerized, but I
couldn't find anything useful. In fact, most approaches of detecting
containerization at all do involve parsing cgroups. Wacky.

So I attempted to verify that container IDs should always be 64
characters. I found:
* podman - docs
[here](https://docs.podman.io/en/latest/markdown/podman-container-inspect.1.html)
"Container ID (full 64-char hash)"
* docker - UID generator source
[here](634a848b8e/pkg/stringid/stringid.go (L36))
shows 32 bytes (and even guards against fully numeric!)
* lxc [man page
](https://linuxcontainers.org/lxc/manpages/man1/lxc-info.1.html)says
"container identifier format is an alphanumeric string". If this maps
into cgroups (no idea!), it would have already been broken in some cases
because we enforce hex.

I'm a little concerned about this approach because the [otel
spec](94c9c75c4f/specification/resource/semantic_conventions/container.md)
suggests that "The UUID might be abbreviated.", but it's
unclear/non-specific about the circumstances that might cause this.

Open to hearing about why the approach presented here is a bad idea. 🙃
2023-04-04 09:37:23 -07:00
Mateusz Rzeszutek 04f2e3e9e5
Bridge agent logs into application's slf4j logger (#7339)
Related discussion #7257
Resolves #3413
Resolves #5059
Resolves #6258
Resolves #7179

Adds a logging implementation that'll collect agent logs in memory until
slf4j is detected in the instrumented application; and when that happens
will dump all the logs into the application slf4j and log directly to
the application logger from that time on.

It's still in a POC state, unfortunately: while it works fine with an
app that uses & initializes slf4j directly, Spring Boot applications
actually reconfigure the logging implementation (e.g. logback) a while
after slf4j is loaded; which causes all the startup agent logs (debug
included) to be dumped with the default logback pattern.

Future work:
* ~~Make sure all logs produces by the agent are sent to loggers named
`io.opentelemetry...`
(https://github.com/open-telemetry/opentelemetry-java-instrumentation/pull/7446)~~
DONE
* Make this work on Spring Boot
* Documentation
* Smoke test?
2023-04-04 17:29:43 +02:00
Lauri Tulmin 402635bb64
Remove aws-sdk-2.2 latest dep restriction (#8207) 2023-04-04 10:03:19 +03:00
dependabot[bot] 209d952071
Bump io.opentelemetry.contrib:opentelemetry-aws-xray-propagator from 1.23.0-alpha to 1.24.0-alpha (#8205) 2023-04-04 06:02:16 +00:00
Trask Stalnaker 3e087e8206
Add note about Optional/Stream usage to style guide (#8193)
Based on #8190 and
https://github.com/open-telemetry/opentelemetry-java-instrumentation/pull/8131#discussion_r1151528583

---------

Co-authored-by: Mateusz Rzeszutek <mrzeszutek@splunk.com>
2023-04-03 20:15:59 +00:00
Lauri Tulmin 00dfd99519
Alternative fix for flaky jfr telemetry test (#8203)
Reverts
https://github.com/open-telemetry/opentelemetry-java-instrumentation/pull/8183
Perhaps the problem is that the gc happens before reading jfr events is
started.
2023-04-03 13:09:37 -07:00
Lauri Tulmin 08236a710f
Add library instrumentation for java http client (#8138)
Resolves
https://github.com/open-telemetry/opentelemetry-java-instrumentation/issues/8069
The javaagent instrumentation also supports propagating context into
[BodyHandler](https://docs.oracle.com/en/java/javase/11/docs/api/java.net.http/java/net/http/HttpResponse.BodyHandler.html)
implemented in
https://github.com/open-telemetry/opentelemetry-java-instrumentation/blob/main/instrumentation/java-http-client/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/httpclient/BodyHandlerWrapper.java
I think the initial idea behind it was that this allowed propagating
context into callbacks. Because this didn't work for
`connectionErrorUnopenedPortWithCallback` test later we also added
wrapping completable future to take care of propagating context into
callbacks. Should I also implement context propagation for `BodyHandler`
in library instrumentation or should I just delete it? I guess it could
come handy if someone builds a custom `BodyHandler` and wants to emit
spans from there, though this doesn't feel too likely. I'd like deleting
it more.

---------

Co-authored-by: Trask Stalnaker <trask.stalnaker@gmail.com>
2023-04-03 13:08:29 -07:00
Trask Stalnaker eb83b216a7
Remove doc version auto-update (#8198)
the auto-update will be triggered from the doc repo after
https://github.com/open-telemetry/opentelemetry.io/pull/2568
2023-04-03 11:33:23 -07:00
Nitesh S f7d74f5daa
convert gwt tests from groovy to java (#8201)
Related to #7195
2023-04-03 11:30:33 -07:00
Lauri Tulmin 1393604118
Add option to capture logback key value pairs (#8074)
Resolves
https://github.com/open-telemetry/opentelemetry-java-instrumentation/issues/8059
2023-04-03 11:30:04 -07:00
Trask Stalnaker b01996e12f
Rename apache-pulsar to pulsar and apache-camel to camel (#8195)
Closes #8004
2023-04-03 11:26:23 -07:00
Nitesh S 8704510619
convert spark tests from groovy to java (#8200)
Related to #7195
2023-04-03 13:38:02 +02:00
pellmont 5db149e1fa
fix order of cxf handlers to enable symmetric tracing around jaxws handler chain (#8160)
the current implementation of Start and End around the invocation of a
Jax WS is asymmetric around the JAX-WS Handler Chain.

Current behavior:
(execution of incoming MessageHandlers) -> (TracingStartInInterceptor)
-> (WebService Invocation) -> (execution of outgoing MessageHandlers) ->
(TracingEndInInterceptor)

if I understood the code of this cxf instrumentation correctly, the
intent was to build the span close around the WebService Invocation
(without Handler Chains).

So the desired behavior would look like this:
(execution of incoming MessageHandlers) -> (TracingStartInInterceptor)
-> (WebService Invocation) -> (TracingEndInInterceptor) -> (execution of
outgoing MessageHandlers)

Unfortunately CXF is calling the Outgoing Chain inside the POST_INVOKE
Phase of Cxf (so the outgoing chain is technically a sub-chain in the
incoming chain... which is documented but quite surprising...).

So the solution in the fix at least guarantees the the outgoing chain is
invoked AFTER end of tracing. For any extra Interceptors in the
POST_INVOKE Phase there is still no guarantee of ordering, but I think
this is not a opentelemetry issue but a design-flaw of CXF...

---------

Co-authored-by: Trask Stalnaker <trask.stalnaker@gmail.com>
Co-authored-by: Lauri Tulmin <ltulmin@splunk.com>
2023-04-03 13:06:51 +03:00
Lauri Tulmin 8c7a8e1dfb
Fix flaky jfr metrics test (#8183)
https://ge.opentelemetry.io/s/svewzdm7cppaa/tests/:instrumentation:runtime-telemetry-jfr:library:testPS/io.opentelemetry.instrumentation.runtimetelemetryjfr.PsGcMemoryMetricTest/shouldHaveGcDurationMetrics()?top-execution=1
2023-04-03 11:48:46 +02:00
Trask Stalnaker 70cd8464e2
Fix possible NPE (#8199)
this is a follow-up to #7043

I tried to add a test when that PR was opened:

*
d2c6399a6e

but it doesn't really verify anything, since the NPE is throw/caught and
same behavior occurs
2023-04-03 09:24:14 +02:00
Mateusz Rzeszutek 46e5219f19
Remove some Optional usages (#8190)
I applied [this
comment](https://github.com/open-telemetry/opentelemetry-java-instrumentation/pull/8131#discussion_r1151076724)
to the whole codebase and removed some `Optional`s that were used in the
hot path
2023-04-03 09:13:59 +02:00
adamleantech d6271cccc7
Spring boot service name (#8006)
resolves #7998

---------

Co-authored-by: Mateusz Rzeszutek <mrzeszutek@splunk.com>
Co-authored-by: Lauri Tulmin <ltulmin@splunk.com>
2023-04-01 18:58:43 -07:00
dependabot[bot] 5a0e2cb765
Bump org.jetbrains.kotlin.jvm from 1.8.10 to 1.8.20 (#8180) 2023-04-01 11:41:35 -07:00
dependabot[bot] c59c37022b
Bump groovyVersion from 4.0.10 to 4.0.11 (#8192) 2023-03-31 16:14:16 -07:00
Lauri Tulmin a9905a22ca
Fix hibernate 6 latest dep test (#8189) 2023-03-31 15:39:02 +03:00
Lauri Tulmin 5a14788fc1
Use .service instead of .getService() to get testcontainersBuildService (#8188) 2023-03-31 08:32:24 +00:00
Lauri Tulmin 9e0d177d88
Add testcontainersBuildService to r2dbc tests (#8184) 2023-03-31 10:31:48 +02:00
Lauri Tulmin d007ccce82
Rename r2dbc library instrumentation package (#8185)
Library instrumentation shouldn't be in `javaagent` package
2023-03-31 10:31:25 +02:00
Lauri Tulmin a9fa5aacea
Add testcontainersBuildService to spring kafka tests that don't have it (#8186) 2023-03-31 10:26:06 +02:00
Lauri Tulmin d8b0771929
Use the same kafka docker image in all kafka tests (#8187)
currently we use `confluentinc/cp-kafka:5.4.3` and
`confluentinc/cp-kafka:6.1.9`
2023-03-31 10:25:38 +02:00
Abhinandan Seshadri b23af1bcfe
Convert spring-core tests from groovy to java (#8166)
Related to #7195.

Converts spring core instrumentation tests from groovy to java.

---------

Co-authored-by: Mateusz Rzeszutek <mrzeszutek@splunk.com>
2023-03-31 10:09:31 +02:00
dependabot[bot] 67aabce866
Bump actions/checkout from 2 to 3 (#8178) 2023-03-30 15:55:00 -07:00
dependabot[bot] 474b4c24e2
Bump org.graalvm.buildtools.native from 0.9.14 to 0.9.20 (#8179) 2023-03-30 15:51:10 -07:00
Jean Bisutti c5ef8ffd60
Add GraalVM native tests (#8163)
This PR allows:
* Executing the OTel Logback appender tests as GraalVM native
executables
* Executing the native tests once a day on Github

---------

Co-authored-by: Trask Stalnaker <trask.stalnaker@gmail.com>
2023-03-30 14:10:48 -07:00
Nitesh S 2d8ba003e3
convert Log4j mdc test from groovy to java (#8170)
Related to #7195
2023-03-30 17:31:51 +02:00
Lauri Tulmin 1adc5d3571
Instrument addition pulsar receive methods (#8171)
Resolves
https://github.com/open-telemetry/opentelemetry-java-instrumentation/issues/8162
Instrument Consumer#receiveAsync() and Consumer#receive(). Although
comments in code indicate that batch receiving was instrumented it
didn't really work as far as I can tell.
2023-03-30 16:30:12 +03:00
Trask Stalnaker b3204d9852
Better comment-driven automation (#8168) 2023-03-30 11:40:37 +02:00
Lauri Tulmin f624562705
Remove info logging from JfrTelemetry (#8158) 2023-03-29 11:41:56 -07:00