Skip to content

Use OpenTelemetry with HTTP/gRPC exporters in apm-integration #80762

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

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
152 changes: 150 additions & 2 deletions x-pack/plugin/apm-integration/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,34 @@ dependencies {
implementation "io.opentelemetry:opentelemetry-sdk-metrics:${versions.opentelemetry}-alpha"
implementation "io.opentelemetry:opentelemetry-semconv:${versions.opentelemetry}-alpha"
implementation "io.opentelemetry:opentelemetry-exporter-logging:${versions.opentelemetry}"
// required to use OTLP (to get OtlpGrpcSpanExporter)
implementation "io.opentelemetry:opentelemetry-exporter-otlp-trace:${versions.opentelemetry}"
// required by OTLP (to get GrpcExporter, Marshaller etc)
implementation "io.opentelemetry:opentelemetry-exporter-otlp-common:${versions.opentelemetry}"
// required by OTLP common & trace
implementation "io.grpc:grpc-api:1.42.1"
implementation "io.grpc:grpc-stub:1.42.1"
implementation "io.grpc:grpc-core:1.42.1"
implementation "io.grpc:grpc-context:1.42.1"
// netty HTTP client is used for gRPC calls to Elastic's APM server
implementation "io.grpc:grpc-netty:1.42.1"
// okio and okhttp are required by GrpcExporter as the default implementation, but we don't use it
implementation "com.squareup.okhttp3:okhttp:3.14.9"
implementation "com.squareup.okio:okio:1.17.2"
// required by io.grpc
implementation 'io.perfmark:perfmark-api:0.24.0'
implementation 'io.perfmark:perfmark-impl:0.24.0'
implementation 'com.google.guava:failureaccess:1.0.1'
// required by grpc-netty
api "io.netty:netty-buffer:${versions.netty}"
api "io.netty:netty-transport:${versions.netty}"
api "io.netty:netty-common:${versions.netty}"
api "io.netty:netty-codec:${versions.netty}"
api "io.netty:netty-codec-http:${versions.netty}"
api "io.netty:netty-codec-http2:${versions.netty}"
api "io.netty:netty-handler:${versions.netty}"
api "io.netty:netty-resolver:${versions.netty}"
runtimeOnly 'com.google.guava:guava:31.0.1-jre'

compileOnly project(path: xpackModule('core'))
internalClusterTestImplementation(testArtifact(project(xpackModule('core'))))
Expand All @@ -33,17 +61,137 @@ dependencies {
// no unit-test for now
tasks.named("test").configure { enabled = false }

tasks.named("dependencyLicenses").configure {
mapping from: /opentelemetry-.*/, to: 'opentelemetry'
mapping from: /grpc-.*/, to: 'grpc'
mapping from: /netty-.*/, to: 'netty'
mapping from: /perfmark-.*/, to: 'perfmark'
}

tasks.named("thirdPartyAudit").configure {
ignoreViolations(
'io.opentelemetry.internal.shaded.jctools.queues.MpscArrayQueueConsumerIndexField',
'io.opentelemetry.internal.shaded.jctools.queues.MpscArrayQueueProducerIndexField',
'io.opentelemetry.internal.shaded.jctools.queues.MpscArrayQueueProducerLimitField',
'io.opentelemetry.internal.shaded.jctools.util.UnsafeAccess',
'io.opentelemetry.internal.shaded.jctools.util.UnsafeRefArrayAccess'
'io.opentelemetry.internal.shaded.jctools.util.UnsafeRefArrayAccess',
'com.google.common.cache.Striped64',
'com.google.common.cache.Striped64$1',
'com.google.common.cache.Striped64$Cell',
'com.google.common.hash.LittleEndianByteArray$UnsafeByteArray',
'com.google.common.hash.LittleEndianByteArray$UnsafeByteArray$1',
'com.google.common.hash.LittleEndianByteArray$UnsafeByteArray$2',
'com.google.common.hash.LittleEndianByteArray$UnsafeByteArray$3',
'com.google.common.hash.Striped64',
'com.google.common.hash.Striped64$1',
'com.google.common.hash.Striped64$Cell',
'com.google.common.primitives.UnsignedBytes$LexicographicalComparatorHolder$UnsafeComparator',
'com.google.common.primitives.UnsignedBytes$LexicographicalComparatorHolder$UnsafeComparator$1',
'com.google.common.util.concurrent.AbstractFuture$UnsafeAtomicHelper',
'com.google.common.util.concurrent.AbstractFuture$UnsafeAtomicHelper$1',
'io.netty.handler.ssl.util.OpenJdkSelfSignedCertGenerator',
'io.netty.util.internal.PlatformDependent0',
'io.netty.util.internal.PlatformDependent0$1',
'io.netty.util.internal.PlatformDependent0$2',
'io.netty.util.internal.PlatformDependent0$3',
'io.netty.util.internal.PlatformDependent0$5',
'io.netty.util.internal.shaded.org.jctools.queues.BaseLinkedQueueConsumerNodeRef',
'io.netty.util.internal.shaded.org.jctools.queues.BaseLinkedQueueProducerNodeRef',
'io.netty.util.internal.shaded.org.jctools.queues.BaseMpscLinkedArrayQueueColdProducerFields',
'io.netty.util.internal.shaded.org.jctools.queues.BaseMpscLinkedArrayQueueConsumerFields',
'io.netty.util.internal.shaded.org.jctools.queues.BaseMpscLinkedArrayQueueProducerFields',
'io.netty.util.internal.shaded.org.jctools.queues.LinkedQueueNode',
'io.netty.util.internal.shaded.org.jctools.queues.MpscArrayQueueConsumerIndexField',
'io.netty.util.internal.shaded.org.jctools.queues.MpscArrayQueueProducerIndexField',
'io.netty.util.internal.shaded.org.jctools.queues.MpscArrayQueueProducerLimitField',
'io.netty.util.internal.shaded.org.jctools.util.UnsafeAccess',
'io.netty.util.internal.shaded.org.jctools.util.UnsafeRefArrayAccess'
)
ignoreMissingClasses(
'io.opentelemetry.sdk.logs.data.Body',
'io.opentelemetry.sdk.logs.data.LogData',
'io.opentelemetry.sdk.logs.export.LogExporter'
'io.opentelemetry.sdk.logs.export.LogExporter',
'android.net.ssl.SSLSockets',
'android.os.Build$VERSION',
'android.util.Log',
'com.aayushatharva.brotli4j.Brotli4jLoader',
'com.aayushatharva.brotli4j.decoder.DecoderJNI$Status',
'com.aayushatharva.brotli4j.decoder.DecoderJNI$Wrapper',
'com.aayushatharva.brotli4j.encoder.Encoder',
'com.aayushatharva.brotli4j.encoder.Encoder$Mode',
'com.aayushatharva.brotli4j.encoder.Encoder$Parameters',
'com.github.luben.zstd.Zstd',
'com.google.gson.stream.JsonReader',
'com.google.gson.stream.JsonToken',
'com.google.protobuf.ExtensionRegistry',
'com.google.protobuf.ExtensionRegistryLite',
'com.google.protobuf.MessageLite',
'com.google.protobuf.MessageLite$Builder',
'com.google.protobuf.MessageLiteOrBuilder',
'com.google.protobuf.Parser',
'com.google.protobuf.nano.CodedOutputByteBufferNano',
'com.google.protobuf.nano.MessageNano',
'com.jcraft.jzlib.Deflater',
'com.jcraft.jzlib.Inflater',
'com.jcraft.jzlib.JZlib',
'com.jcraft.jzlib.JZlib$WrapperType',
'com.ning.compress.BufferRecycler',
'com.ning.compress.lzf.ChunkDecoder',
'com.ning.compress.lzf.ChunkEncoder',
'com.ning.compress.lzf.LZFChunk',
'com.ning.compress.lzf.LZFEncoder',
'com.ning.compress.lzf.util.ChunkDecoderFactory',
'com.ning.compress.lzf.util.ChunkEncoderFactory',
'io.grpc.netty.shaded.io.grpc.netty.GrpcSslContexts',
'io.grpc.netty.shaded.io.grpc.netty.NettyChannelBuilder',
'io.grpc.netty.shaded.io.netty.handler.ssl.SslContextBuilder',
'io.grpc.okhttp.OkHttpChannelBuilder',
'io.netty.handler.proxy.HttpProxyHandler',
'io.netty.internal.tcnative.AsyncSSLPrivateKeyMethod',
'io.netty.internal.tcnative.AsyncTask',
'io.netty.internal.tcnative.Buffer',
'io.netty.internal.tcnative.CertificateCallback',
'io.netty.internal.tcnative.CertificateVerifier',
'io.netty.internal.tcnative.Library',
'io.netty.internal.tcnative.ResultCallback',
'io.netty.internal.tcnative.SSL',
'io.netty.internal.tcnative.SSLContext',
'io.netty.internal.tcnative.SSLPrivateKeyMethod',
'io.netty.internal.tcnative.SSLSession',
'io.netty.internal.tcnative.SSLSessionCache',
'io.netty.internal.tcnative.SessionTicketKey',
'io.netty.internal.tcnative.SniHostNameMatcher',
'io.opentelemetry.sdk.logs.data.Severity',
'lzma.sdk.lzma.Encoder',
'org.bouncycastle.asn1.x500.X500Name',
'org.bouncycastle.cert.X509v3CertificateBuilder',
'org.bouncycastle.cert.jcajce.JcaX509CertificateConverter',
'org.bouncycastle.cert.jcajce.JcaX509v3CertificateBuilder',
'org.bouncycastle.jce.provider.BouncyCastleProvider',
'org.bouncycastle.operator.jcajce.JcaContentSignerBuilder',
'org.conscrypt.AllocatedBuffer',
'org.conscrypt.BufferAllocator',
'org.conscrypt.Conscrypt',
'org.conscrypt.Conscrypt$ProviderBuilder',
'org.conscrypt.HandshakeListener',
'org.eclipse.jetty.alpn.ALPN',
'org.eclipse.jetty.alpn.ALPN$ClientProvider',
'org.eclipse.jetty.alpn.ALPN$ServerProvider',
'org.eclipse.jetty.npn.NextProtoNego',
'org.eclipse.jetty.npn.NextProtoNego$ClientProvider',
'org.eclipse.jetty.npn.NextProtoNego$ServerProvider',
'org.jboss.marshalling.ByteInput',
'org.jboss.marshalling.ByteOutput',
'org.jboss.marshalling.Marshaller',
'org.jboss.marshalling.MarshallerFactory',
'org.jboss.marshalling.MarshallingConfiguration',
'org.jboss.marshalling.Unmarshaller',
'org.slf4j.Logger',
'org.slf4j.LoggerFactory',
'org.slf4j.helpers.FormattingTuple',
'org.slf4j.helpers.MessageFormatter',
'org.slf4j.spi.LocationAwareLogger',
'reactor.blockhound.BlockHound$Builder',
'reactor.blockhound.integration.BlockHoundIntegration'
)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1dcf1de382a0bf95a3d8b0849546c88bac1292c9
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
Expand Down
62 changes: 62 additions & 0 deletions x-pack/plugin/apm-integration/licenses/grpc-NOTICE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
Copyright 2014 The gRPC Authors

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

-----------------------------------------------------------------------

This product contains a modified portion of 'OkHttp', an open source
HTTP & SPDY client for Android and Java applications, which can be obtained
at:

* LICENSE:
* okhttp/third_party/okhttp/LICENSE (Apache License 2.0)
* HOMEPAGE:
* https://github.com/square/okhttp
* LOCATION_IN_GRPC:
* okhttp/third_party/okhttp

This product contains a modified portion of 'Envoy', an open source
cloud-native high-performance edge/middle/service proxy, which can be
obtained at:

* LICENSE:
* xds/third_party/envoy/LICENSE (Apache License 2.0)
* NOTICE:
* xds/third_party/envoy/NOTICE
* HOMEPAGE:
* https://www.envoyproxy.io
* LOCATION_IN_GRPC:
* xds/third_party/envoy

This product contains a modified portion of 'protoc-gen-validate (PGV)',
an open source protoc plugin to generate polyglot message validators,
which can be obtained at:

* LICENSE:
* xds/third_party/protoc-gen-validate/LICENSE (Apache License 2.0)
* NOTICE:
* xds/third_party/protoc-gen-validate/NOTICE
* HOMEPAGE:
* https://github.com/envoyproxy/protoc-gen-validate
* LOCATION_IN_GRPC:
* xds/third_party/protoc-gen-validate

This product contains a modified portion of 'udpa',
an open source universal data plane API, which can be obtained at:

* LICENSE:
* xds/third_party/udpa/LICENSE (Apache License 2.0)
* HOMEPAGE:
* https://github.com/cncf/udpa
* LOCATION_IN_GRPC:
* xds/third_party/udpa
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
4a7f734f57ad5b68e4ac591481eb562cdb3d2a94
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
c0cc9e5e08ced39792908aeda77e694bff39cea1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2d142647452a700189908baa488dc928233e8be9
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
f2bdcaf11b237122efbd8a30e4177250fde5b458
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
6fa0c2fb4ff581c89b4aab2d47fb2b568503f630
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
119ea2b2bc205b138974d351777b20f02b92704b
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
Expand Down
116 changes: 116 additions & 0 deletions x-pack/plugin/apm-integration/licenses/netty-NOTICE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@

The Netty Project
=================

Please visit the Netty web site for more information:

* http://netty.io/

Copyright 2011 The Netty Project

The Netty Project licenses this file to you under the Apache License,
version 2.0 (the "License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at:

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
License for the specific language governing permissions and limitations
under the License.

Also, please refer to each LICENSE.<component>.txt file, which is located in
the 'license' directory of the distribution file, for the license terms of the
components that this product depends on.

-------------------------------------------------------------------------------
This product contains the extensions to Java Collections Framework which has
been derived from the works by JSR-166 EG, Doug Lea, and Jason T. Greene:

* LICENSE:
* license/LICENSE.jsr166y.txt (Public Domain)
* HOMEPAGE:
* http://gee.cs.oswego.edu/cgi-bin/viewcvs.cgi/jsr166/
* http://viewvc.jboss.org/cgi-bin/viewvc.cgi/jbosscache/experimental/jsr166/

This product contains a modified version of Robert Harder's Public Domain
Base64 Encoder and Decoder, which can be obtained at:

* LICENSE:
* license/LICENSE.base64.txt (Public Domain)
* HOMEPAGE:
* http://iharder.sourceforge.net/current/java/base64/

This product contains a modified version of 'JZlib', a re-implementation of
zlib in pure Java, which can be obtained at:

* LICENSE:
* license/LICENSE.jzlib.txt (BSD Style License)
* HOMEPAGE:
* http://www.jcraft.com/jzlib/

This product contains a modified version of 'Webbit', a Java event based
WebSocket and HTTP server:

* LICENSE:
* license/LICENSE.webbit.txt (BSD License)
* HOMEPAGE:
* https://github.com/joewalnes/webbit

This product optionally depends on 'Protocol Buffers', Google's data
interchange format, which can be obtained at:

* LICENSE:
* license/LICENSE.protobuf.txt (New BSD License)
* HOMEPAGE:
* http://code.google.com/p/protobuf/

This product optionally depends on 'Bouncy Castle Crypto APIs' to generate
a temporary self-signed X.509 certificate when the JVM does not provide the
equivalent functionality. It can be obtained at:

* LICENSE:
* license/LICENSE.bouncycastle.txt (MIT License)
* HOMEPAGE:
* http://www.bouncycastle.org/

This product optionally depends on 'SLF4J', a simple logging facade for Java,
which can be obtained at:

* LICENSE:
* license/LICENSE.slf4j.txt (MIT License)
* HOMEPAGE:
* http://www.slf4j.org/

This product optionally depends on 'Apache Commons Logging', a logging
framework, which can be obtained at:

* LICENSE:
* license/LICENSE.commons-logging.txt (Apache License 2.0)
* HOMEPAGE:
* http://commons.apache.org/logging/

This product optionally depends on 'Apache Log4J', a logging framework,
which can be obtained at:

* LICENSE:
* license/LICENSE.log4j.txt (Apache License 2.0)
* HOMEPAGE:
* http://logging.apache.org/log4j/

This product optionally depends on 'JBoss Logging', a logging framework,
which can be obtained at:

* LICENSE:
* license/LICENSE.jboss-logging.txt (GNU LGPL 2.1)
* HOMEPAGE:
* http://anonsvn.jboss.org/repos/common/common-logging-spi/

This product optionally depends on 'Apache Felix', an open source OSGi
framework implementation, which can be obtained at:

* LICENSE:
* license/LICENSE.felix.txt (Apache License 2.0)
* HOMEPAGE:
* http://felix.apache.org/
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
8d4be9506ea5f54af58bcd596ba3fe2fc5036413
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
e7cfff848e6c1294645638d74fce6ad89cc6f3f3
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
15fff6bae9e4b09ba5d48a70bb88841c9fc22a32
Loading