Commit Graph

2448 Commits

Author SHA1 Message Date
OpenTelemetry Bot f074b93110
Update the OpenTelemetry SDK version to 1.23.0 (#7800)
Update the OpenTelemetry SDK version to `1.23.0`.

---------

Co-authored-by: Trask Stalnaker <trask.stalnaker@gmail.com>
2023-02-13 20:22:09 +00:00
Helen c61996f5a4
Change Spring Scheduling to not capture span for one-time jobs (only repeated jobs) (#7760)
We are seeing examples where Spring Scheduling INTERNAL spans are
created inside of an existing parent span, which creates unnecessary
noise.

And these spans don't necessary make sense as these are not "background
jobs" (since they occur inside of an existing span).

(see for example
https://github.com/microsoft/ApplicationInsights-Java/issues/2870)

This PR changes Spring Scheduling instrumentation to only instrumenting
repeating jobs, not one-time scheduled jobs (which corresponds to
ScheduledExecutorService behavior where context is not propagated to
runnable)

---------

Co-authored-by: Trask Stalnaker <trask.stalnaker@gmail.com>
2023-02-13 12:05:06 -08:00
Will Li d3326db0cf
Convert kafka-clients unit test from groovy to java (#7770)
Co-authored-by: Mateusz Rzeszutek <mrzeszutek@splunk.com>
2023-02-13 10:58:55 +01:00
Lauri Tulmin 39e7ed4d6a
Second attempt at fixing serializing kafka configuration (#7789)
Hopefully resolves
https://github.com/open-telemetry/opentelemetry-java-instrumentation/issues/7597
Without reproducing the issue it is hard to tell whether this will help.
Another issue that could arise is that we add our metrics class in
`metric.reporters` property which will probably break if this
configuration is used to build consumer or producer after deserializing
as our classes don't seem to be available there. If this fails we'll
need to ask the issue reporter for instructions how to reproduce and
find a different strategy for fixing this.
2023-02-13 10:47:18 +01:00
Lauri Tulmin 54d7241c05
Fix autoconfigure for spring boot 3 (#7784)
See
https://github.com/open-telemetry/opentelemetry-java-instrumentation/issues/7312
2023-02-13 10:45:23 +01:00
Lauri Tulmin dde140c161
Fix flaky google http client async test (#7805)
https://ge.opentelemetry.io/s/gnwekqhhf3ut6/tests/:instrumentation:google-http-client-1.19:javaagent:test/io.opentelemetry.javaagent.instrumentation.googlehttpclient.GoogleHttpClientAsyncTest/highConcurrency()?page=eyJvdXRwdXQiOnsiMCI6Mn19&top-execution=1
The problem is that the google http client method we use is implemented
like
```
  public Future<HttpResponse> executeAsync() {
    return executeAsync(Executors.newSingleThreadExecutor());
  }
```
as explained in https://bugs.openjdk.org/browse/JDK-8145304 when
`newSingleThreadExecutor` is used in such a way it is possible that this
executor is shut down before it actually manages to execute anything.
2023-02-13 10:11:30 +01:00
Liudmila Molkova 7de0861266
Update Azure SDK instrumentation for new version (#7753)
Fix #7729

This PR adopts Azure SDK tracing API changes from the latest release
(azure-core 1.36.0, azure-core-tracing-opentelemetry 1.0.0-beta.32)

The API changes are not breaking (1.19 instrumentation is still
compatible), but the new instrumentation is slightly more performant and
supports new features. We are also going to break compatibility with
1.19 instrumentation at some point (in 6-12 months).

We now have 3 versions for azure-sdk. We still have about 10% of users
on versions [1.14-1.19), but it's declining and I'll be happy to remove
1.14 in the next few months if this trend continues.

---------

Co-authored-by: Trask Stalnaker <trask.stalnaker@gmail.com>
2023-02-09 13:52:40 -08:00
Lauri Tulmin c5649cc987
Document spring-rmi latest dep limit (#7774) 2023-02-09 17:07:24 +01:00
Lauri Tulmin 8b552db495
Bridge metrics batch api (#7762)
Resolves
https://github.com/open-telemetry/opentelemetry-java-instrumentation/issues/7454
2023-02-09 07:43:49 -08:00
Lauri Tulmin f887fb870d
Dubbo: don't create spans for calls inside the same jvm (#7761)
Resolves
https://github.com/open-telemetry/opentelemetry-java-instrumentation/issues/7520
Invoking a dubbo service, like in
d7e2417ae7/demo-business-provider/src/main/java/cn/zewade/business/controller/BusinessController.java (L20),
creates a client span (and a server span on the receiving end). If the
caller and service are on the jvm this call doesn't go through remoting
and will be handled with regular java calls. Now when the initially
called service calls another service, like in
https://github.com/zewade/opentelemetry-dubbo-demo/blob/main/demo-business-provider/src/main/java/cn/zewade/business/dubbo/BusinessDubboServiceImpl.java#L25,
that second call will also attempt to create a client span. This second
client span will be suppressed which will also suppress context
propagation.
2023-02-09 08:46:39 +02:00
Lauri Tulmin 5d182557a1
Ensure kafka configuration remains serializable (#7754)
Resolves
https://github.com/open-telemetry/opentelemetry-java-instrumentation/issues/7597
I wasn't able to reproduce this. Figuring out how to run beam, flink and
kafka together feels like too much effort. Without reproducing it is too
hard to tell why the configuration is serialized, but my hunch is that
it is enough to ensure that the configuration can be serialized.
2023-02-09 08:45:39 +02:00
Fran Pregernik 1d3752f21b
Allow JDBC autoinstrumentation to use a custom OpenTelemetry instance to be more DI (e.g. Spring Boot) friendly (#7697)
Related to issue
https://github.com/open-telemetry/opentelemetry-java-instrumentation/issues/7677
2023-02-08 17:46:13 +01:00
Trask Stalnaker a2d5302acc
Netty refactoring (#7738)
~Built on top of other netty PRs, will rebase after those are merged.~
2023-02-07 20:26:18 -08:00
Lauri Tulmin 26689b2c40
Fix ClassCastException with redisson batch atomically (#7743)
Resolves
https://github.com/open-telemetry/opentelemetry-java-instrumentation/issues/7702
2023-02-07 19:25:20 -08:00
Lauri Tulmin 2ec97a601c
Fix vaadin 16 test (#7758)
Test started failing due to a new version of
https://www.npmjs.com/package/@types/node Pinning that dependency to the
previous version seems to help.
2023-02-07 16:41:22 -08:00
Trask Stalnaker a26b5f6639
Support slf4j to log4j2 (#7656) 2023-02-07 14:38:04 -08:00
xiangtianyu c9a04620f1
convert jedis test from groovy to java (#7731)
related to #7195
2023-02-07 17:36:50 +01:00
Trask Stalnaker 7091719e96
Rename logback mdc library package name (#7752) 2023-02-07 07:04:35 -08:00
Trask Stalnaker 7be766a78b
Remove write context (#7735)
~(currently built on top of #7732)~
2023-02-06 17:34:12 +00:00
Trask Stalnaker b9918ab513
End netty client span before callbacks (#7737)
netty 3.8 already ends client span before callbacks:


b17f20c08e/instrumentation/netty/netty-3.8/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/netty/v3_8/client/HttpClientResponseTracingHandler.java (L33-L46)
2023-02-06 08:16:11 -08:00
Trask Stalnaker e7820f8e9e
Use super to make netty instrumentation clearer (#7736)
I think it makes it clearer that these classes are decorating the super
methods.
2023-02-06 08:15:53 -08:00
Trask Stalnaker 9979d8f620
Remove some no longer needed netty instrumentation (#7732)
Will follow-up with some related clean-up of `WRITE_CONTEXT` (wanted to
split the changes for clearer review).
2023-02-06 08:15:34 -08:00
Lauri Tulmin e638201cc4
Remove unused import (#7741) 2023-02-06 08:38:03 +00:00
Trask Stalnaker 7993ef2433
Fix intellij warnings (#7734) 2023-02-06 09:21:30 +01:00
Will Li a5143d6e7d
convert jboss-logmanager-mdc groovy test to java (#7703)
the `getMdcCopy` test is omitted as it is only available in
jboss-logmanager 1.3+ and the test depends on jboss-logmanager 1.1

---------

Co-authored-by: opentelemetrybot <107717825+opentelemetrybot@users.noreply.github.com>
2023-02-03 13:49:16 +01:00
Lauri Tulmin 0bd4af09ea
Fix flaky http url connection test (#7724)
https://ge.opentelemetry.io/s/2x656dnceehhk/tests/:instrumentation:http-url-connection:javaagent:test/io.opentelemetry.javaagent.instrumentation.httpurlconnection.HttpUrlConnectionTest/traceRequest(boolean)%5B1%5D?top-execution=1
2023-02-03 12:49:54 +01:00
Lauri Tulmin 2277092d82
Fix flaky scala executor test (#7725)
https://ge.opentelemetry.io/s/pn7rhvguj5nyq/tests/:instrumentation:executors:javaagent:test/io.opentelemetry.javaagent.instrumentation.scalaexecutors.ScalaInstrumentationTest/scalaFuturesAndCallbacks()?top-execution=1
Seems like the same issue as in
https://github.com/open-telemetry/opentelemetry-java-instrumentation/pull/5671
2023-02-03 12:49:05 +01:00
Lauri Tulmin 652c3a8bf4
Fix flaky dubbo tests (#7726)
https://ge.opentelemetry.io/scans/tests?search.buildOutcome=success&search.tags=CI&search.timeZoneId=Europe/Tallinn&tests.container=io.opentelemetry.instrumentation.apachedubbo.v2_7.DubboTraceChainTest&tests.sortField=FLAKY&tests.test=test%20that%20context%20is%20propagated%20correctly%20in%20chained%20dubbo%20calls&tests.unstableOnly=true

https://ge.opentelemetry.io/scans/tests?search.buildOutcome=success&search.tags=CI&search.timeZoneId=Europe/Tallinn&tests.container=io.opentelemetry.instrumentation.apachedubbo.v2_7.DubboTest&tests.sortField=FLAKY&tests.unstableOnly=true
Something has changed in later versions of dubbo that causes failures
when more than one test is run.
2023-02-03 12:46:29 +01:00
Lauri Tulmin 9f7ed3e2c8
Limit azure-core latest dep version (#7722)
Resolves
https://github.com/open-telemetry/opentelemetry-java-instrumentation/issues/7720
Resolves
https://github.com/open-telemetry/opentelemetry-java-instrumentation/issues/7721
2023-02-03 11:24:21 +01:00
xiangtianyu 6885c80fef
convert http url connection test from groovy to java (#7676)
related to #7195
2023-02-01 14:13:25 +01:00
Mateusz Rzeszutek a9c065930d
Return interface instead of concrete implementation in instrumentatio… (#7658)
…n-api-semconv

We're already doing that for `SpanNameExtractor`, `OperationMetrics`,
`ContextCustomizer`, etc., so I figured we should do the same for
`AttributesExtractor` implementation. Also, none of the implementations
have any additional public surface - aside from the builder/factory
method users can just simply use the interface everywhere.
2023-01-31 13:21:28 +01:00
Mateusz Rzeszutek 245a9f7cf7
Rewrite netty 3.8 tests to Java (#7666)
Part of #7195
2023-01-30 08:46:05 +01:00
Javier Salinas 99e600fff7
Ratpack services OpenTelemetry (#7477)
While using Ratpack Handlers, the context is added by the
`OpenTelemetryServerHandler`

While using Ratpack Services, we might need to add manually the OT
Context into the Ratpack Execution and try to get it from the Execution
in the Ratpack `HttpClient`
2023-01-25 10:28:44 -08:00
Trask Stalnaker b157f14666
Remove unnecessary suppression (#7648)
I accidentally added in #7538
2023-01-25 08:49:14 +01:00
Trask Stalnaker dab33810bb
Convert logging instrumentation tests to Java (#7631)
currently based on #7632
2023-01-24 15:18:39 -08:00
Trask Stalnaker adbd9664f4
Fix some instrumentation scope names (#7632) 2023-01-23 19:46:06 -08:00
jason plumb bb092bf0e5
Fix build (change param type to builder) (#7640)
Looks like there were some merge conflicts around test code in the last
couple of PRs.
I think this will fix up the build.
2023-01-23 16:06:57 -08:00
jason plumb db6b764421
More HTTP testing refactor prework (#7630)
This is another follow-up from #7616. This makes the test options class
immutable and uses `@AutoValue` and `@AutoValue.Builder`. As a result, a
bunch of the configuration/setup code for these said options now flings
around a builder instance. This isn't great, but I think it's an
incremental improvement that can be seen in the `@BeforeAll
AbstractHttpClientTest.setupOptions()` method, where the immutable
options are (finally) instantiated.
2023-01-23 09:42:32 -08:00
Mateusz Rzeszutek 7657b75ddc
Migrate reactor-netty-0.9 tests to java (#7635)
Part of #7195
2023-01-23 09:34:11 -08:00
Mateusz Rzeszutek e1895e548c
Rename all methods in all Getters to use the `get*()` naming scheme (#7619)
Resolves #6562

This PR only contains renames; the actual content is in the `*Getter`
interfaces, the rest of changes is just IntelliJ doing its job.
2023-01-23 09:28:11 +00:00
Andrei Chugunov 9f9d6fee95
webflux 5.0 groovy to java tests part 1 (#7625)
I decided splitting changes on different PRs due to there are a lot of
lines of code in tests here and it should simplify review process.

Another option is I can add additional commit to this PR with conversion
of other groovy files.
2023-01-23 08:59:19 +01:00
jason plumb c5e384fe9f
Http testing refactor prework (#7623)
As part of discussions #7616, the idea of trying to do a more piecemeal
approach came up. A reasonable ask.

This is the first step in refactoring the http client tests. It factors
out the `HttpClientResult` inner class of the `AbstractHttpClientTest`
so that this can be reused by new test framework later. It also factors
the relevant abstract methods in the abstract class to a new type
adapter, which will also be reused.

Co-authored-by: Mateusz Rzeszutek <mrzeszutek@splunk.com>
2023-01-20 18:20:42 +00:00
Mateusz Rzeszutek 0223dc3a28
Fix concurrency issue in OpenTelemetryDriver (#7628)
Fixes #7621
2023-01-20 13:28:22 +01:00
Mateusz Rzeszutek 40667ce719
Fix inconsistent handling of net.peer.port in HTTP instrumentations (#7618)
Resolves #4329
2023-01-20 09:57:46 +01:00
Alex Kats eaac709162
Update SQL span name for procedures (#7557)
This PR includes updates to the SQLSanitizer, DbClientSpanNameExtractor
and SqlStatementInfo to name spans according to procedure name for CALL
statements. The updates to the naming logic are in the SqlSanitizer and
table has been renamed to identifier as using the table variable for the
procedure name would not be idiomatic. SqlStatementInfo has been updated
so that the db.sql.table attribute is not included for procedures.
2023-01-19 11:01:36 -08:00
Mateusz Rzeszutek 268165c668
Fix NoClassDefFoundError happening when snakeyaml is used on a custom JRE (#7598)
Fixes #7580
2023-01-19 10:30:18 -08:00
Mateusz Rzeszutek b2f42ec3fa
Encode version in spring instrumentations' package names (#7608)
Part of #932

I wanted to get this done before starting the spring boot starter v3
work.
2023-01-19 10:03:17 +00:00
Andrei Chugunov e6c2254d5c
Cassandra java tests (#7390) 2023-01-18 22:05:57 +00:00
Tav Herzlich b9c10c9607
Add gRPC request metadata instrumentation (#7011)
Solves. #6991 

This PR implements the request portion of the new gRPC metadata
instrumentation spec:

https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/trace/semantic_conventions/rpc.md#grpc-request-and-response-metadata

The changes include:

- new CommonConfig entry for desired gRPC metadata values:
'otel.instrumentation.grpc.capture-metadata.request'
(Similar to http headers)
- setting the desired metadata values in GrpcTelemetry
- new property in GrpcAttributesExtractor that holds a reference to the
GrpcRpcAttributesGetter
- new property in GrpcAttributesExtractor that stores the desired values
so it can iterate them and extract each one from the request
- inject the GrpcRpcAttributesGetter to GrpcAttributesExtractor (in
GrpcTelemetryBuilder)
- logic in GrpcRpcAttributesGetter to safely extract the gRPC metadata
value
- A new test in GrpcTest that makes sure that when a certain metadata
key name is inserted, it also ends up in the span attributes

** Doesn't take care of the response because gRPC response is not
implemented in java-instrumentation yet. (This is absolutely necessary
but out of scope for this PR)
** "metadataValue" is only implemented inside GrpcRpcAttributesGetter
and not in RpcAttributesGetter to avoid providing implementations for
every RpcAttributesGetter in the repo as this PR only focuses on gRPC.

Co-authored-by: Trask Stalnaker <trask.stalnaker@gmail.com>
2023-01-17 21:18:37 -08:00
Mateusz Rzeszutek d89932098a
Disable YodaCondition check and revert some of the changes (#7596)
Let's keep close to the SDK repo config. 

I reverted some of the changes, only left those that I think make sense
anyway (e.g. comparing enums with `==`)
2023-01-17 19:44:15 -08:00