Update distro example to 0.17.0
MODIFY
examples/distro/build.gradle
examples/distro/build.gradle
@@ -8,20 +8,20 @@ subprojects {
ext {
versions = [
- opentelemetry : "0.16.0",
- opentelemetryJavaagent : "0.16.0-SNAPSHOT",
+ opentelemetry : "0.17.1",
+ opentelemetryJavaagent: "0.17.0",
bytebuddy : "1.10.18",
guava : "30.1-jre"
-
]
versions.opentelemetryAlpha = "${versions.opentelemetry}-alpha"
+ versions.opentelemetryJavaagentAlpha = "${versions.opentelemetryJavaagent}-alpha"
+
deps = [
bytebuddy : dependencies.create(group: 'net.bytebuddy', name: 'byte-buddy', version: versions.bytebuddy),
bytebuddyagent : dependencies.create(group: 'net.bytebuddy', name: 'byte-buddy-agent', version: versions.bytebuddy),
autoservice : [
dependencies.create(group: 'com.google.auto.service', name: 'auto-service', version: '1.0-rc7'),
dependencies.create(group: 'com.google.auto', name: 'auto-common', version: '0.8'),
- // These are the last versions that support guava 20.0. Upgrading has odd interactions with shadow.
dependencies.create(group: 'com.google.guava', name: 'guava', version: "${versions.guava}"),
],
autoValueAnnotations: "com.google.auto.value:auto-value-annotations:${versions.autoValue}",
@@ -29,7 +29,6 @@ subprojects {
}
repositories {
- jcenter()
maven {
url = uri("https://oss.sonatype.org/content/repositories/snapshots")
}

MODIFY
examples/distro/custom/build.gradle
examples/distro/custom/build.gradle
@@ -6,7 +6,7 @@ plugins {
dependencies {
compileOnly("io.opentelemetry:opentelemetry-sdk:${versions.opentelemetry}")
compileOnly("io.opentelemetry:opentelemetry-sdk-extension-autoconfigure:${versions.opentelemetryAlpha}")
- compileOnly("io.opentelemetry.javaagent:opentelemetry-javaagent-spi:${versions.opentelemetryJavaagent}")
+ compileOnly("io.opentelemetry.javaagent:opentelemetry-javaagent-spi:${versions.opentelemetryJavaagentAlpha}")
}
tasks {

MODIFY
examples/distro/custom/src/main/java/com/example/javaagent/DemoPropagator.java
examples/distro/custom/src/main/java/com/example/javaagent/DemoPropagator.java
@@ -2,7 +2,9 @@ package com.example.javaagent;
import io.opentelemetry.context.Context;
import io.opentelemetry.context.ContextKey;
+import io.opentelemetry.context.propagation.TextMapGetter;
import io.opentelemetry.context.propagation.TextMapPropagator;
+import io.opentelemetry.context.propagation.TextMapSetter;
import java.util.Collections;
import java.util.List;
@@ -22,7 +24,7 @@ public class DemoPropagator implements TextMapPropagator {
}
@Override
- public <C> void inject(Context context, C carrier, Setter<C> setter) {
+ public <C> void inject(Context context, C carrier, TextMapSetter<C> setter) {
Long propagationStart = context.get(PROPAGATION_START_KEY);
if (propagationStart == null) {
propagationStart = System.currentTimeMillis();
@@ -31,7 +33,7 @@ public class DemoPropagator implements TextMapPropagator {
}
@Override
- public <C> Context extract(Context context, C carrier, Getter<C> getter) {
+ public <C> Context extract(Context context, C carrier, TextMapGetter<C> getter) {
String propagationStart = getter.get(carrier, FIELD);
if (propagationStart != null) {
return context.with(PROPAGATION_START_KEY, Long.valueOf(propagationStart));

MODIFY
examples/distro/custom/src/main/java/com/example/javaagent/DemoResourceProvider.java
examples/distro/custom/src/main/java/com/example/javaagent/DemoResourceProvider.java
package com.example.javaagent;
import io.opentelemetry.api.common.Attributes;
-import io.opentelemetry.sdk.resources.ResourceProvider;
+import io.opentelemetry.sdk.autoconfigure.ConfigProperties;
+import io.opentelemetry.sdk.autoconfigure.spi.ResourceProvider;
+import io.opentelemetry.sdk.resources.Resource;
-public class DemoResourceProvider extends ResourceProvider {
+public class DemoResourceProvider implements ResourceProvider {
@Override
- protected Attributes getAttributes() {
- return Attributes.builder().put("custom.resource", "demo").build();
+ public Resource createResource(ConfigProperties config) {
+ Attributes attributes = Attributes.builder().put("custom.resource", "demo").build();
+ return Resource.create(attributes);
}
}

MODIFY
examples/distro/custom/src/main/java/com/example/javaagent/DemoSdkTracerProviderConfigurer.java
examples/distro/custom/src/main/java/com/example/javaagent/DemoSdkTracerProviderConfigurer.java
@@ -20,7 +20,7 @@ public class DemoSdkTracerProviderConfigurer implements SdkTracerProviderConfigu
public void configure(SdkTracerProviderBuilder tracerProvider) {
tracerProvider
.setIdGenerator(new DemoIdGenerator())
- .setSpanLimits(SpanLimits.builder().setMaxLengthOfAttributeValues(128).build())
+ .setSpanLimits(SpanLimits.builder().setMaxNumberOfAttributes(1024).build())
.setSampler(new DemoSampler())
.addSpanProcessor(new DemoSpanProcessor())
.addSpanProcessor(SimpleSpanProcessor.create(new DemoSpanExporter()));

RENAME
examples/distro/custom/src/main/resources/META-INF/services/io.opentelemetry.sdk.resources.ResourceProvider
examples/distro/custom/src/main/resources/META-INF/services/io.opentelemetry.sdk.autoconfigure.spi.ResourceProvider
MODIFY
examples/distro/instrumentation/build.gradle
examples/distro/instrumentation/build.gradle
@@ -11,8 +11,8 @@ subprojects {
dependencies {
compileOnly("io.opentelemetry:opentelemetry-sdk:${versions.opentelemetry}")
- compileOnly("io.opentelemetry.javaagent:opentelemetry-javaagent-api:${versions.opentelemetryJavaagent}")
- compileOnly("io.opentelemetry.javaagent:opentelemetry-javaagent-tooling:${versions.opentelemetryJavaagent}")
+ compileOnly("io.opentelemetry.javaagent:opentelemetry-javaagent-api:${versions.opentelemetryJavaagentAlpha}")
+ compileOnly("io.opentelemetry.javaagent:opentelemetry-javaagent-tooling:${versions.opentelemetryJavaagentAlpha}")
compileOnly deps.bytebuddy
compileOnly deps.bytebuddyagent

Update distro example to 0.17.0 (#2371)