Skip to content

Commit ddb8c69

Browse files
felixbarnySylvainJugebmorelli25
authored
OpenTelemetry bridge (#1631)
* Fist working draft * Lazily parse tracestate * Use built-in Context * Translate OTel attributes to intake API * Refine instrumentations * Mark as experimental * Add enable_experimental_instrumentations option * polishing * Extract advice to separate class * more polishing * Map OTel semantic convention attributes to data model * Mark spans non-discardable on context propagation * Remove construction of URL fields that are filled on APM Server * Add license headers * Revert "Remove construction of URL fields that are filled on APM Server" This reverts commit 56594eb. * Map destination details of external spans * Avoid calling method that's @SInCE Java 9 * Fix packaging and shading * Add docs * Add changelog * Document when OTel bridge has been added * Update to OTel 0.15.0 and test older versions too Also makes sure that only versions starting with 1.14.0 are instrumented * Implement review suggestions * Bubble up operation modes to apis.asciidoc * Log warning once if unsupported APIs are used * Be more clear about what is and what's not supported * Update and require OTel 0.16.0 * Remove smurf naming convention * Set outcome * Update to otel 1.0.0 * fix advice class names * fix url test * post-merge update * add missing ivy test dependency * test versions 1.0.x->1.5.0 * add few tests for coverage * fix doc release version * update docs * introduce ElasticContext to rule them all * bridge otel root context * code cleanup * code cleanup + update test to 1.6.0 * add missing license header * minor tweaks * fix doc update test fail msg * add span kind + wip on shared spec * add wip gherkin spec * add missing file headers * wip http + db span mapping * finalize 1st tep of bridge * minor cleanup * replace 'custom' with 'unknown' for bridge * update json spec for span type/subtype * Use AssignReturned annotations * Fix parent project version * wip main cucumber tasks * infer on otel span end + basic outcome mapping * pom cleanup * code cleanup * set outcome for otel spans * fix tests * do not infer outcome from lack of exception * fix documentation * fix/cleanup documentation * update changelog * fix sdk logger change * add latest versions for test coverage * update generated doc * compile agent sdk for java 7 * fix doc links * Apply suggestions from code review (docs links) Co-authored-by: Brandon Morelli <[email protected]> * aim for release in 1.30.0 * add missing otel attributes & kind serialization * prevent NPE when Context.root() is not called first * move to a single module for opentelemetry * move to dedicated sub-module for opentelemetry * capture OTel API version when possible * minimize changelog diff * clarify some comments/doc * properly reformat * minor fix to otel mvn dependencies * remove unused context propagator * bump version to 1.30.0 * prevent multiple root contexts * fix pebkc * set implicit active parent only at startSpan * fix docs (attempt for menu) * fix API docs menu integration * trim whitespace * fix links to public-api * fix generated doc * doc: try removing float blocks * fix API menu * fix new module version Co-authored-by: Sylvain Juge <[email protected]> Co-authored-by: SylvainJuge <[email protected]> Co-authored-by: Brandon Morelli <[email protected]>
1 parent c323326 commit ddb8c69

File tree

190 files changed

+3535
-292
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

190 files changed

+3535
-292
lines changed

.github/dependabot.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ updates:
3333
- dependency-name: "com.datastax.oss:java-driver-core"
3434
- dependency-name: "io.micrometer:*"
3535
- dependency-name: "jakarta.*:*"
36+
- dependency-name: "io.opentelemetry:opentelemetry-api"
3637
ignore:
3738
- dependency-name: "net.bytebuddy:byte-buddy-agent"
3839
# We deliberately want to keep this older version of Byte Buddy for our runtime attach test

CHANGELOG.asciidoc

Lines changed: 24 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ option. If there's a need to disable the log correlation mechanism, this can be
5050
{pull}2428[#2428]
5151
* Added automatic error event capturing for log4j1 and JBoss LogManager - {pull}2428[#2428]
5252
* Issue a warning when security manager is mis-configured - {pull}2510[#2510]
53+
* Add experimental OpenTelemetry API bridge - {pull}1631[#1631]
5354
5455
[float]
5556
===== Performance improvements
@@ -151,7 +152,7 @@ paths. The BCI warmup is on by default and may be disabled through the internal
151152
==== 1.28.1 - 2021/12/10
152153
153154
[float]
154-
===== Security
155+
===== Security
155156
* Fix for "Log4Shell" RCE 0-day exploit in log4j https://nvd.nist.gov/vuln/detail/CVE-2021-44228[CVE-2021-44228] - {pull}2332[#2332]
156157
157158
[float]
@@ -886,7 +887,7 @@ for more details) - {pull}1009[#1009]
886887
*** Rely on the existing `ELASTIC_APM_CAPTURE_BODY` agent config option (off by default).
887888
*** Send as `context.message.body`
888889
*** Limit size to 10000 characters. If longer than this size, trim to 9999 and append with ellipsis
889-
** Introduce the `ignore_message_queues` configuration to disable instrumentation (message tagging) for specific
890+
** Introduce the `ignore_message_queues` configuration to disable instrumentation (message tagging) for specific
890891
queues/topics as suggested in {pull}710[#710]
891892
** Capture predefined message headers and all properties
892893
*** Rely on the existing `ELASTIC_APM_CAPTURE_HEADERS` agent config option.
@@ -910,12 +911,12 @@ for more details) - {pull}1009[#1009]
910911
config option]
911912
* Add ability to ignore some exceptions to be reported as errors <<config-ignore-exceptions[ignore_exceptions]
912913
* Applying new logic for JMS `javax.jms.MessageConsumer#receive` so that, instead of the transaction created for the
913-
polling method itself (ie from `receive` start to end), the agent will create a transaction attempting to capture
914+
polling method itself (ie from `receive` start to end), the agent will create a transaction attempting to capture
914915
the code executed during actual message handling.
915916
This logic is suitable for environments where polling APIs are invoked within dedicated polling threads.
916-
This polling transaction creation strategy can be reversed through a configuration option (`message_polling_transaction_strategy`)
917-
that is not exposed in the properties file by default.
918-
* Send IP obtained through `javax.servlet.ServletRequest#getRemoteAddr()` in `context.request.socket.remote_address`
917+
This polling transaction creation strategy can be reversed through a configuration option (`message_polling_transaction_strategy`)
918+
that is not exposed in the properties file by default.
919+
* Send IP obtained through `javax.servlet.ServletRequest#getRemoteAddr()` in `context.request.socket.remote_address`
919920
instead of parsing from headers {pull}889[#889]
920921
* Added `ElasticApmAttacher.attach(String propertiesLocation)` to specify a custom properties location
921922
* Logs message when `transaction_max_spans` has been exceeded {pull}849[#849]
@@ -939,7 +940,7 @@ config option]
939940
* Add support for identifying target JVM to attach apm agent to using JVM property. See also the documentation of the <<setup-attach-cli-usage-options, `--include` and `--exclude` flags>>
940941
* Added <<config-capture-jmx-metrics, `capture_jmx_metrics`>> configuration option
941942
* Improve servlet error capture {pull}812[#812]
942-
Among others, now also takes Spring MVC `@ExceptionHandler`s into account
943+
Among others, now also takes Spring MVC `@ExceptionHandler`s into account
943944
* Instrument Logger#error(String, Throwable) {pull}821[#821]
944945
Automatically captures exceptions when calling `logger.error("message", exception)`
945946
* Easier log correlation with https://github.com/elastic/java-ecs-logging. See <<log-correlation, docs>>.
@@ -952,7 +953,7 @@ config option]
952953
* Error in log when setting <<config-server-urls, server_urls>>
953954
to an empty string - `co.elastic.apm.agent.configuration.ApmServerConfigurationSource - Expected previousException not to be null`
954955
* Avoid terminating the TCP connection to APM Server when polling for configuration updates {pull}823[#823]
955-
956+
956957
[[release-notes-1.9.0]]
957958
==== 1.9.0 - 2019/08/22
958959
@@ -982,15 +983,15 @@ See https://discuss.elastic.co/t/elastic-apm-agent-jdbchelper-seems-to-use-a-lot
982983
[float]
983984
==== Breaking Changes
984985
* The `apm-agent-attach.jar` is not executable anymore.
985-
Use `apm-agent-attach-standalone.jar` instead.
986+
Use `apm-agent-attach-standalone.jar` instead.
986987
987988
[[release-notes-1.8.0]]
988989
==== 1.8.0 - 2019/07/30
989990
990991
[float]
991992
===== Features
992993
* Added support for tracking https://www.elastic.co/guide/en/kibana/7.3/transactions.html[time spent by span type].
993-
Can be disabled by setting https://www.elastic.co/guide/en/apm/agent/java/current/config-core.html#config-breakdown-metrics[`breakdown_metrics`] to `false`.
994+
Can be disabled by setting https://www.elastic.co/guide/en/apm/agent/java/current/config-core.html#config-breakdown-metrics[`breakdown_metrics`] to `false`.
994995
* Added support for https://www.elastic.co/guide/en/kibana/7.3/agent-configuration.html[central configuration].
995996
Can be disabled by setting <<config-central-config, `central_config`>> to `false`.
996997
* Added support for Spring's JMS flavor - instrumenting `org.springframework.jms.listener.SessionAwareMessageListener`
@@ -1036,7 +1037,7 @@ NOTE: Using wildcards is still not the recommended approach for the `trace_metho
10361037
This requires APM Server 7.2+.
10371038
* Added basic support for JMS- distributed tracing for basic scenarios of `send`, `receive`, `receiveNoWait` and `onMessage`.
10381039
Both Queues and Topics are supported.
1039-
Async `send` APIs are not supported in this version.
1040+
Async `send` APIs are not supported in this version.
10401041
NOTE: This feature is currently marked as "experimental" and is disabled by default. In order to enable,
10411042
it is required to set the
10421043
<<config-disable-instrumentations, `disable_instrumentations`>>
@@ -1076,11 +1077,11 @@ configuration property to an empty string.
10761077
[float]
10771078
===== Related Announcements
10781079
* Java APM Agent became part of the Cloud Foundry Java Buildpack as of https://github.com/cloudfoundry/java-buildpack/releases/tag/v4.19[Release v4.19]
1079-
1080+
10801081
[float]
10811082
===== Features
10821083
* Support Apache HttpAsyncClient - span creation and cross-service trace context propagation
1083-
* Added the `jvm.thread.count` metric, indicating the number of live threads in the JVM (daemon and non-daemon)
1084+
* Added the `jvm.thread.count` metric, indicating the number of live threads in the JVM (daemon and non-daemon)
10841085
* Added support for WebLogic
10851086
* Added support for Spring `@Scheduled` and EJB `@Schedule` annotations - https://github.com/elastic/apm-agent-java/pull/569[#569]
10861087
@@ -1110,7 +1111,7 @@ This change also renames `tag` to `label` on the API level to be compliant with
11101111
The `addTag(String, String)` method is still supported but deprecated in favor of `addLabel(String, String)`.
11111112
As of version 7.x of the stack, labels will be stored under `labels` in Elasticsearch.
11121113
Previously, they were stored under `context.tags`.
1113-
* Support async queries made by Elasticsearch REST client
1114+
* Support async queries made by Elasticsearch REST client
11141115
* Added `setStartTimestamp(long epochMicros)` and `end(long epochMicros)` API methods to `Span` and `Transaction`,
11151116
allowing to set custom start and end timestamps.
11161117
* Auto-detection of the `service_name` based on the `<display-name>` element of the `web.xml` with a fallback to the servlet context path.
@@ -1148,14 +1149,14 @@ controls which `Content-Type`s should be captured.
11481149
* Introduces a new configuration option `disable_metrics` which disables the collection of metrics via a wildcard expression.
11491150
* Support for HttpUrlConnection
11501151
* Adds `subtype` and `action` to spans. This replaces former typing mechanism where type, subtype and action were all set through
1151-
the type in an hierarchical dotted-syntax. In order to support existing API usages, dotted types are parsed into subtype and action,
1152-
however `Span.createSpan` and `Span.setType` are deprecated starting this version. Instead, type-less spans can be created using the new
1152+
the type in an hierarchical dotted-syntax. In order to support existing API usages, dotted types are parsed into subtype and action,
1153+
however `Span.createSpan` and `Span.setType` are deprecated starting this version. Instead, type-less spans can be created using the new
11531154
`Span.startSpan` API and typed spans can be created using the new `Span.startSpan(String type, String subtype, String action)` API
11541155
* Support for JBoss EAP 6.4, 7.0, 7.1 and 7.2
11551156
* Improved startup times
11561157
* Support for SOAP (JAX-WS).
11571158
SOAP client create spans and propagate context.
1158-
Transactions are created for `@WebService` classes and `@WebMethod` methods.
1159+
Transactions are created for `@WebService` classes and `@WebMethod` methods.
11591160
11601161
[float]
11611162
===== Bug Fixes
@@ -1188,7 +1189,7 @@ controls which `Content-Type`s should be captured.
11881189
* Fixing a potential memory leak when there is no connection with APM server
11891190
* Fixes NoSuchMethodError CharBuffer.flip() which occurs when using the Elasticsearch RestClient and Java 7 or 8 https://github.com/elastic/apm-agent-java/pull/401[#401]
11901191
1191-
1192+
11921193
[[release-notes-1.2.0]]
11931194
==== 1.2.0 - 2018/12/19
11941195
@@ -1197,7 +1198,7 @@ controls which `Content-Type`s should be captured.
11971198
* Added `capture_headers` configuration option.
11981199
Set to `false` to disable capturing request and response headers.
11991200
This will reduce the allocation rate of the agent and can save you network bandwidth and disk space.
1200-
* Makes the API methods `addTag`, `setName`, `setType`, `setUser` and `setResult` fluent, so that calls can be chained.
1201+
* Makes the API methods `addTag`, `setName`, `setType`, `setUser` and `setResult` fluent, so that calls can be chained.
12011202
12021203
[float]
12031204
===== Bug Fixes
@@ -1217,7 +1218,7 @@ controls which `Content-Type`s should be captured.
12171218
[float]
12181219
===== Bug Fixes
12191220
* Update dsl-json which fixes a memory leak.
1220-
See https://github.com/ngs-doo/dsl-json/pull/102[ngs-doo/dsl-json#102] for details.
1221+
See https://github.com/ngs-doo/dsl-json/pull/102[ngs-doo/dsl-json#102] for details.
12211222
* Avoid `VerifyError`s by non instrumenting classes compiled for Java 4 or earlier
12221223
* Enable APM Server URL configuration with path (fixes #339)
12231224
* Reverse `system.hostname` and `system.platform` order sent to APM server
@@ -1237,7 +1238,7 @@ controls which `Content-Type`s should be captured.
12371238
* Remove intake v1 support. This version requires APM Server 6.5.0+ which supports the intake api v2.
12381239
Until the time the APM Server 6.5.0 is officially released,
12391240
you can test with docker by pulling the APM Server image via
1240-
`docker pull docker.elastic.co/apm/apm-server:6.5.0-SNAPSHOT`.
1241+
`docker pull docker.elastic.co/apm/apm-server:6.5.0-SNAPSHOT`.
12411242
12421243
[float]
12431244
===== Features
@@ -1332,7 +1333,7 @@ Transactions are named based on your resources (`ResourceClass#resourceMethod`).
13321333
* Public API
13331334
** Add `Span#captureException` and `Transaction#captureException` to public API.
13341335
`ElasticApm.captureException` is deprecated now. Use `ElasticApm.currentSpan().captureException(exception)` instead.
1335-
** Added `Transaction.getId` and `Span.getId` methods
1336+
** Added `Transaction.getId` and `Span.getId` methods
13361337
* Added support for async servlet requests
13371338
* Added support for Payara/Glassfish
13381339
* Incubating support for Apache HttpClient
@@ -1342,7 +1343,7 @@ Transactions are named based on your resources (`ResourceClass#resourceMethod`).
13421343
As that could contain path parameters, like `/user/$userId` however,
13431344
You can set the `url_groups` option to define a wildcard pattern, like `/user/*`,
13441345
to group those paths together.
1345-
This is especially helpful when using an unsupported Servlet API-based framework.
1346+
This is especially helpful when using an unsupported Servlet API-based framework.
13461347
* Support duration suffixes (`ms`, `s` and `m`) for duration configuration options.
13471348
Not using the duration suffix logs out a deprecation warning and will not be supported in future versions.
13481349
* Add ability to add multiple APM server URLs, which enables client-side load balancing.

apm-agent-api/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<artifactId>apm-agent-parent</artifactId>
77
<groupId>co.elastic.apm</groupId>
8-
<version>1.29.1-SNAPSHOT</version>
8+
<version>1.30.0-SNAPSHOT</version>
99
</parent>
1010

1111
<artifactId>apm-agent-api</artifactId>

apm-agent-attach-cli/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<parent>
44
<artifactId>apm-agent-parent</artifactId>
55
<groupId>co.elastic.apm</groupId>
6-
<version>1.29.1-SNAPSHOT</version>
6+
<version>1.30.0-SNAPSHOT</version>
77
</parent>
88
<modelVersion>4.0.0</modelVersion>
99

apm-agent-attach/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<artifactId>apm-agent-parent</artifactId>
77
<groupId>co.elastic.apm</groupId>
8-
<version>1.29.1-SNAPSHOT</version>
8+
<version>1.30.0-SNAPSHOT</version>
99
</parent>
1010

1111
<artifactId>apm-agent-attach</artifactId>

apm-agent-benchmarks/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<artifactId>apm-agent-parent</artifactId>
77
<groupId>co.elastic.apm</groupId>
8-
<version>1.29.1-SNAPSHOT</version>
8+
<version>1.30.0-SNAPSHOT</version>
99
</parent>
1010

1111
<artifactId>apm-agent-benchmarks</artifactId>

apm-agent-bootstrap/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<artifactId>apm-agent-parent</artifactId>
77
<groupId>co.elastic.apm</groupId>
8-
<version>1.29.1-SNAPSHOT</version>
8+
<version>1.30.0-SNAPSHOT</version>
99
</parent>
1010

1111
<artifactId>apm-agent-bootstrap</artifactId>

apm-agent-cached-lookup-key/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<parent>
44
<artifactId>apm-agent-parent</artifactId>
55
<groupId>co.elastic.apm</groupId>
6-
<version>1.29.1-SNAPSHOT</version>
6+
<version>1.30.0-SNAPSHOT</version>
77
</parent>
88
<modelVersion>4.0.0</modelVersion>
99

apm-agent-common/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<parent>
44
<artifactId>apm-agent-parent</artifactId>
55
<groupId>co.elastic.apm</groupId>
6-
<version>1.29.1-SNAPSHOT</version>
6+
<version>1.30.0-SNAPSHOT</version>
77
</parent>
88
<modelVersion>4.0.0</modelVersion>
99

apm-agent-core/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<artifactId>apm-agent-parent</artifactId>
77
<groupId>co.elastic.apm</groupId>
8-
<version>1.29.1-SNAPSHOT</version>
8+
<version>1.30.0-SNAPSHOT</version>
99
</parent>
1010

1111
<artifactId>apm-agent-core</artifactId>

0 commit comments

Comments
 (0)