@@ -25,12 +25,16 @@ description = 'Example showing OTLP exporter being used for traces export to GCP
2525dependencies {
2626 implementation(libraries. opentelemetry_api)
2727 implementation(libraries. opentelemetry_sdk)
28- implementation(libraries. opentelemetry_otlp_exporter)
29- implementation(libraries. opentelemetry_sdk_autoconf)
28+ // [START opentelemetry_autoconf_otlp_required_deps]
29+ implementation(" io.opentelemetry:opentelemetry-exporter-otlp:1.56.0" )
30+ implementation(" io.opentelemetry:opentelemetry-sdk-extension-autoconfigure:1.56.0" )
31+ // [END opentelemetry_autoconf_otlp_required_deps]
3032 implementation(libraries. opentelemetry_gcp_auth_extension)
3133 implementation(libraries. opentelemetry_gcp_resources)
3234}
3335
36+ // [START opentelemetry_autoconf_otlp_config]
37+ // You can switch the desired protocol here by changing `otel.exporter.otlp.protocol`.
3438def autoconf_config = [
3539 ' -Dotel.exporter.otlp.endpoint=https://telemetry.googleapis.com' ,
3640 ' -Dotel.traces.exporter=otlp' ,
@@ -40,8 +44,12 @@ def autoconf_config = [
4044 ' -Dotel.exporter.otlp.protocol=http/protobuf' ,
4145 ' -Dotel.java.global-autoconfigure.enabled=true' ,
4246]
47+ // [END opentelemetry_autoconf_otlp_config]
4348
49+ // [START opentelemetry_autoconf_app_config]
4450application {
4551 mainClassName = ' com.google.cloud.opentelemetry.example.otlptrace.OTLPTraceExample'
52+ // Pass the config as JVM arguments to the Java application
4653 applicationDefaultJvmArgs = autoconf_config
4754}
55+ // [END opentelemetry_autoconf_app_config]
0 commit comments