Better naming around around shaded/unshaded (#953)
This commit is contained in:
parent
bf9c160570
commit
622ab27ae8
|
@ -87,6 +87,6 @@ shadowJar {
|
|||
relocate "io.grpc.Context", "io.opentelemetry.auto.shaded.io.grpc.Context"
|
||||
|
||||
// this is for instrumentation on opentelemetry-api itself
|
||||
relocate "unshaded.io.opentelemetry", "io.opentelemetry"
|
||||
relocate "unshaded.io.grpc", "io.grpc"
|
||||
relocate "application.io.opentelemetry", "io.opentelemetry"
|
||||
relocate "application.io.grpc", "io.grpc"
|
||||
}
|
||||
|
|
|
@ -13,12 +13,12 @@ dependencies {
|
|||
// the "temporarily shaded" OpenTelemetry API is unshaded, so that it will apply to the
|
||||
// OpenTelemetry API that the user brings
|
||||
//
|
||||
// so in the code "unshaded.io.opentelemetry.*" refers to the (unshaded) OpenTelemetry API that
|
||||
// the user brings (as those references will be translated during the build to remove the
|
||||
// "unshaded." prefix)
|
||||
// so in the code "application.io.opentelemetry.*" refers to the (unshaded) OpenTelemetry API that
|
||||
// the application brings (as those references will be translated during the build to remove the
|
||||
// "application." prefix)
|
||||
//
|
||||
// and in the code "io.opentelemetry.*" refers to the (shaded) OpenTelemetry API that is in the
|
||||
// bootstrap class loader (as those references will later be shaded)
|
||||
// and in the code "io.opentelemetry.*" refers to the (shaded) OpenTelemetry API that is used by
|
||||
// the agent (as those references will later be shaded)
|
||||
compileOnly project(path: ':opentelemetry-api-beta-shaded-for-instrumenting', configuration: 'shadow')
|
||||
compileOnly project(path: ':opentelemetry-auto-annotations-beta-shaded-for-instrumenting', configuration: 'shadow')
|
||||
|
||||
|
|
|
@ -30,73 +30,75 @@ public abstract class AbstractInstrumentation extends Instrumenter.Default {
|
|||
public String[] helperClassNames() {
|
||||
return new String[] {
|
||||
packageName + ".context.ContextUtils",
|
||||
packageName + ".context.UnshadedScope",
|
||||
packageName + ".context.ApplicationScope",
|
||||
packageName + ".context.NoopScope",
|
||||
packageName + ".context.propagation.UnshadedContextPropagators",
|
||||
packageName + ".context.propagation.UnshadedHttpTextFormat",
|
||||
packageName + ".context.propagation.UnshadedHttpTextFormat$UnshadedSetter",
|
||||
packageName + ".context.propagation.UnshadedHttpTextFormat$UnshadedGetter",
|
||||
packageName + ".metrics.UnshadedBatchRecorder",
|
||||
packageName + ".metrics.UnshadedDoubleCounter",
|
||||
packageName + ".metrics.UnshadedDoubleCounter$BoundInstrument",
|
||||
packageName + ".metrics.UnshadedDoubleCounter$Builder",
|
||||
packageName + ".metrics.UnshadedDoubleSumObserver",
|
||||
packageName + ".metrics.UnshadedDoubleSumObserver$Builder",
|
||||
packageName + ".metrics.UnshadedDoubleSumObserver$ShadedResultDoubleSumObserver",
|
||||
packageName + ".metrics.UnshadedDoubleSumObserver$UnshadedResultDoubleSumObserver",
|
||||
packageName + ".metrics.UnshadedDoubleUpDownCounter",
|
||||
packageName + ".metrics.UnshadedDoubleUpDownCounter$BoundInstrument",
|
||||
packageName + ".metrics.UnshadedDoubleUpDownCounter$Builder",
|
||||
packageName + ".metrics.UnshadedDoubleUpDownSumObserver",
|
||||
packageName + ".metrics.UnshadedDoubleUpDownSumObserver$Builder",
|
||||
packageName + ".metrics.UnshadedDoubleUpDownSumObserver$ShadedResultDoubleUpDownSumObserver",
|
||||
packageName + ".context.propagation.ApplicationContextPropagators",
|
||||
packageName + ".context.propagation.ApplicationHttpTextFormat",
|
||||
packageName + ".context.propagation.ApplicationHttpTextFormat$AgentSetter",
|
||||
packageName + ".context.propagation.ApplicationHttpTextFormat$AgentGetter",
|
||||
packageName + ".metrics.ApplicationBatchRecorder",
|
||||
packageName + ".metrics.ApplicationDoubleCounter",
|
||||
packageName + ".metrics.ApplicationDoubleCounter$BoundInstrument",
|
||||
packageName + ".metrics.ApplicationDoubleCounter$Builder",
|
||||
packageName + ".metrics.ApplicationDoubleSumObserver",
|
||||
packageName + ".metrics.ApplicationDoubleSumObserver$Builder",
|
||||
packageName + ".metrics.ApplicationDoubleSumObserver$AgentResultDoubleSumObserver",
|
||||
packageName + ".metrics.ApplicationDoubleSumObserver$ApplicationResultDoubleSumObserver",
|
||||
packageName + ".metrics.ApplicationDoubleUpDownCounter",
|
||||
packageName + ".metrics.ApplicationDoubleUpDownCounter$BoundInstrument",
|
||||
packageName + ".metrics.ApplicationDoubleUpDownCounter$Builder",
|
||||
packageName + ".metrics.ApplicationDoubleUpDownSumObserver",
|
||||
packageName + ".metrics.ApplicationDoubleUpDownSumObserver$Builder",
|
||||
packageName
|
||||
+ ".metrics.UnshadedDoubleUpDownSumObserver$UnshadedResultDoubleUpDownSumObserver",
|
||||
packageName + ".metrics.UnshadedDoubleValueObserver",
|
||||
packageName + ".metrics.UnshadedDoubleValueObserver$Builder",
|
||||
packageName + ".metrics.UnshadedDoubleValueObserver$ShadedResultDoubleValueObserver",
|
||||
packageName + ".metrics.UnshadedDoubleValueObserver$UnshadedResultDoubleValueObserver",
|
||||
packageName + ".metrics.UnshadedDoubleValueRecorder",
|
||||
packageName + ".metrics.UnshadedDoubleValueRecorder$BoundInstrument",
|
||||
packageName + ".metrics.UnshadedDoubleValueRecorder$Builder",
|
||||
packageName + ".metrics.UnshadedLongCounter",
|
||||
packageName + ".metrics.UnshadedLongCounter$BoundInstrument",
|
||||
packageName + ".metrics.UnshadedLongCounter$Builder",
|
||||
packageName + ".metrics.UnshadedLongSumObserver",
|
||||
packageName + ".metrics.UnshadedLongSumObserver$Builder",
|
||||
packageName + ".metrics.UnshadedLongSumObserver$ShadedResultLongSumObserver",
|
||||
packageName + ".metrics.UnshadedLongSumObserver$UnshadedResultLongSumObserver",
|
||||
packageName + ".metrics.UnshadedLongUpDownCounter",
|
||||
packageName + ".metrics.UnshadedLongUpDownCounter$BoundInstrument",
|
||||
packageName + ".metrics.UnshadedLongUpDownCounter$Builder",
|
||||
packageName + ".metrics.UnshadedLongUpDownSumObserver",
|
||||
packageName + ".metrics.UnshadedLongUpDownSumObserver$Builder",
|
||||
packageName + ".metrics.UnshadedLongUpDownSumObserver$ShadedResultLongUpDownSumObserver",
|
||||
packageName + ".metrics.UnshadedLongUpDownSumObserver$UnshadedResultLongUpDownSumObserver",
|
||||
packageName + ".metrics.UnshadedLongValueObserver",
|
||||
packageName + ".metrics.UnshadedLongValueObserver$Builder",
|
||||
packageName + ".metrics.UnshadedLongValueObserver$ShadedResultLongValueObserver",
|
||||
packageName + ".metrics.UnshadedLongValueObserver$UnshadedResultLongValueObserver",
|
||||
packageName + ".metrics.UnshadedLongValueRecorder",
|
||||
packageName + ".metrics.UnshadedLongValueRecorder$BoundInstrument",
|
||||
packageName + ".metrics.UnshadedLongValueRecorder$Builder",
|
||||
packageName + ".metrics.UnshadedMeter",
|
||||
packageName + ".metrics.UnshadedMeterProvider",
|
||||
+ ".metrics.ApplicationDoubleUpDownSumObserver$AgentResultDoubleUpDownSumObserver",
|
||||
packageName
|
||||
+ ".metrics.ApplicationDoubleUpDownSumObserver$ApplicationResultDoubleUpDownSumObserver",
|
||||
packageName + ".metrics.ApplicationDoubleValueObserver",
|
||||
packageName + ".metrics.ApplicationDoubleValueObserver$Builder",
|
||||
packageName + ".metrics.ApplicationDoubleValueObserver$AgentResultDoubleValueObserver",
|
||||
packageName + ".metrics.ApplicationDoubleValueObserver$ApplicationResultDoubleValueObserver",
|
||||
packageName + ".metrics.ApplicationDoubleValueRecorder",
|
||||
packageName + ".metrics.ApplicationDoubleValueRecorder$BoundInstrument",
|
||||
packageName + ".metrics.ApplicationDoubleValueRecorder$Builder",
|
||||
packageName + ".metrics.ApplicationLongCounter",
|
||||
packageName + ".metrics.ApplicationLongCounter$BoundInstrument",
|
||||
packageName + ".metrics.ApplicationLongCounter$Builder",
|
||||
packageName + ".metrics.ApplicationLongSumObserver",
|
||||
packageName + ".metrics.ApplicationLongSumObserver$Builder",
|
||||
packageName + ".metrics.ApplicationLongSumObserver$AgentResultLongSumObserver",
|
||||
packageName + ".metrics.ApplicationLongSumObserver$ApplicationResultLongSumObserver",
|
||||
packageName + ".metrics.ApplicationLongUpDownCounter",
|
||||
packageName + ".metrics.ApplicationLongUpDownCounter$BoundInstrument",
|
||||
packageName + ".metrics.ApplicationLongUpDownCounter$Builder",
|
||||
packageName + ".metrics.ApplicationLongUpDownSumObserver",
|
||||
packageName + ".metrics.ApplicationLongUpDownSumObserver$Builder",
|
||||
packageName + ".metrics.ApplicationLongUpDownSumObserver$AgentResultLongUpDownSumObserver",
|
||||
packageName
|
||||
+ ".metrics.ApplicationLongUpDownSumObserver$ApplicationResultLongUpDownSumObserver",
|
||||
packageName + ".metrics.ApplicationLongValueObserver",
|
||||
packageName + ".metrics.ApplicationLongValueObserver$Builder",
|
||||
packageName + ".metrics.ApplicationLongValueObserver$AgentResultLongValueObserver",
|
||||
packageName + ".metrics.ApplicationLongValueObserver$ApplicationResultLongValueObserver",
|
||||
packageName + ".metrics.ApplicationLongValueRecorder",
|
||||
packageName + ".metrics.ApplicationLongValueRecorder$BoundInstrument",
|
||||
packageName + ".metrics.ApplicationLongValueRecorder$Builder",
|
||||
packageName + ".metrics.ApplicationMeter",
|
||||
packageName + ".metrics.ApplicationMeterProvider",
|
||||
packageName + ".trace.Bridging",
|
||||
packageName + ".trace.Bridging$1",
|
||||
packageName + ".trace.Bridging$2",
|
||||
packageName + ".trace.TracingContextUtils",
|
||||
packageName + ".trace.UnshadedSpan",
|
||||
packageName + ".trace.UnshadedSpan$Builder",
|
||||
packageName + ".trace.UnshadedTracer",
|
||||
packageName + ".trace.UnshadedTracerProvider",
|
||||
packageName + ".LabelsShader",
|
||||
packageName + ".LabelsShader$Consumer"
|
||||
packageName + ".trace.ApplicationSpan",
|
||||
packageName + ".trace.ApplicationSpan$Builder",
|
||||
packageName + ".trace.ApplicationTracer",
|
||||
packageName + ".trace.ApplicationTracerProvider",
|
||||
packageName + ".LabelBridging",
|
||||
packageName + ".LabelBridging$Consumer"
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, String> contextStore() {
|
||||
return singletonMap("unshaded.io.grpc.Context", "io.grpc.Context");
|
||||
return singletonMap("application.io.grpc.Context", "io.grpc.Context");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,6 +22,8 @@ import static net.bytebuddy.matcher.ElementMatchers.isStatic;
|
|||
import static net.bytebuddy.matcher.ElementMatchers.named;
|
||||
import static net.bytebuddy.matcher.ElementMatchers.takesArguments;
|
||||
|
||||
import application.io.grpc.Context;
|
||||
import application.io.opentelemetry.context.Scope;
|
||||
import com.google.auto.service.AutoService;
|
||||
import io.opentelemetry.auto.instrumentation.opentelemetryapi.context.ContextUtils;
|
||||
import io.opentelemetry.auto.tooling.Instrumenter;
|
||||
|
@ -33,15 +35,13 @@ import net.bytebuddy.asm.Advice;
|
|||
import net.bytebuddy.description.method.MethodDescription;
|
||||
import net.bytebuddy.description.type.TypeDescription;
|
||||
import net.bytebuddy.matcher.ElementMatcher;
|
||||
import unshaded.io.grpc.Context;
|
||||
import unshaded.io.opentelemetry.context.Scope;
|
||||
|
||||
@AutoService(Instrumenter.class)
|
||||
public class ContextUtilsInstrumentation extends AbstractInstrumentation {
|
||||
|
||||
@Override
|
||||
public ElementMatcher<? super TypeDescription> typeMatcher() {
|
||||
return named("unshaded.io.opentelemetry.context.ContextUtils");
|
||||
return named("application.io.opentelemetry.context.ContextUtils");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -66,11 +66,12 @@ public class ContextUtilsInstrumentation extends AbstractInstrumentation {
|
|||
|
||||
@Advice.OnMethodExit(onThrowable = Throwable.class, suppress = Throwable.class)
|
||||
public static void methodExit(
|
||||
@Advice.Argument(0) final Context context, @Advice.Return(readOnly = false) Scope scope) {
|
||||
@Advice.Argument(0) final Context applicationContext,
|
||||
@Advice.Return(readOnly = false) Scope applicationScope) {
|
||||
|
||||
ContextStore<Context, io.grpc.Context> contextStore =
|
||||
InstrumentationContext.get(Context.class, io.grpc.Context.class);
|
||||
scope = ContextUtils.withScopedContext(context, contextStore);
|
||||
applicationScope = ContextUtils.withScopedContext(applicationContext, contextStore);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,6 +21,7 @@ import static net.bytebuddy.matcher.ElementMatchers.isPublic;
|
|||
import static net.bytebuddy.matcher.ElementMatchers.isStatic;
|
||||
import static net.bytebuddy.matcher.ElementMatchers.named;
|
||||
|
||||
import application.io.opentelemetry.trace.Span;
|
||||
import com.google.auto.service.AutoService;
|
||||
import io.opentelemetry.auto.instrumentation.opentelemetryapi.trace.Bridging;
|
||||
import io.opentelemetry.auto.tooling.Instrumenter;
|
||||
|
@ -36,7 +37,7 @@ import net.bytebuddy.matcher.ElementMatcher;
|
|||
public class DefaultSpanInstrumentation extends AbstractInstrumentation {
|
||||
@Override
|
||||
public ElementMatcher<? super TypeDescription> typeMatcher() {
|
||||
return named("unshaded.io.opentelemetry.trace.DefaultSpan");
|
||||
return named("application.io.opentelemetry.trace.DefaultSpan");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -48,9 +49,10 @@ public class DefaultSpanInstrumentation extends AbstractInstrumentation {
|
|||
|
||||
public static class CreateAdvice {
|
||||
@Advice.OnMethodExit(onThrowable = Throwable.class, suppress = Throwable.class)
|
||||
public static void methodExit(
|
||||
@Advice.Return(readOnly = false) unshaded.io.opentelemetry.trace.Span span) {
|
||||
span = Bridging.toUnshaded(DefaultSpan.create(Bridging.toShaded(span.getContext())));
|
||||
public static void methodExit(@Advice.Return(readOnly = false) Span applicationSpan) {
|
||||
applicationSpan =
|
||||
Bridging.toApplication(
|
||||
DefaultSpan.create(Bridging.toAgent(applicationSpan.getContext())));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,6 +22,7 @@ import static net.bytebuddy.matcher.ElementMatchers.isStatic;
|
|||
import static net.bytebuddy.matcher.ElementMatchers.named;
|
||||
import static net.bytebuddy.matcher.ElementMatchers.takesArguments;
|
||||
|
||||
import application.io.grpc.Context;
|
||||
import com.google.auto.service.AutoService;
|
||||
import io.opentelemetry.auto.instrumentation.opentelemetryapi.context.ContextUtils;
|
||||
import io.opentelemetry.auto.tooling.Instrumenter;
|
||||
|
@ -33,14 +34,13 @@ import net.bytebuddy.asm.Advice;
|
|||
import net.bytebuddy.description.method.MethodDescription;
|
||||
import net.bytebuddy.description.type.TypeDescription;
|
||||
import net.bytebuddy.matcher.ElementMatcher;
|
||||
import unshaded.io.grpc.Context;
|
||||
|
||||
@AutoService(Instrumenter.class)
|
||||
public class GrpcContextInstrumentation extends AbstractInstrumentation {
|
||||
|
||||
@Override
|
||||
public ElementMatcher<? super TypeDescription> typeMatcher() {
|
||||
return named("unshaded.io.grpc.Context");
|
||||
return named("application.io.grpc.Context");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -55,10 +55,10 @@ public class GrpcContextInstrumentation extends AbstractInstrumentation {
|
|||
public static class CurrentAdvice {
|
||||
|
||||
@Advice.OnMethodExit(onThrowable = Throwable.class, suppress = Throwable.class)
|
||||
public static void methodExit(@Advice.Return final unshaded.io.grpc.Context context) {
|
||||
public static void methodExit(@Advice.Return final Context applicationContext) {
|
||||
ContextStore<Context, io.grpc.Context> contextStore =
|
||||
InstrumentationContext.get(Context.class, io.grpc.Context.class);
|
||||
contextStore.put(context, io.grpc.Context.current());
|
||||
contextStore.put(applicationContext, io.grpc.Context.current());
|
||||
}
|
||||
|
||||
// this is to make muzzle think we need ContextUtils to make sure we do not apply this
|
||||
|
|
|
@ -16,20 +16,21 @@
|
|||
|
||||
package io.opentelemetry.auto.instrumentation.opentelemetryapi;
|
||||
|
||||
import application.io.opentelemetry.common.ReadableKeyValuePairs.KeyValueConsumer;
|
||||
import io.opentelemetry.common.Labels;
|
||||
import io.opentelemetry.common.Labels.Builder;
|
||||
import unshaded.io.opentelemetry.common.ReadableKeyValuePairs.KeyValueConsumer;
|
||||
|
||||
/**
|
||||
* This class converts between Labels class that user brings and Labels class that agent has.
|
||||
* This class converts between Labels class that application brings and Labels class that agent
|
||||
* uses.
|
||||
*
|
||||
* <p>TODO probably not the most performant solution...
|
||||
*/
|
||||
public class LabelsShader {
|
||||
public class LabelBridging {
|
||||
|
||||
public static Labels shade(unshaded.io.opentelemetry.common.Labels labels) {
|
||||
public static Labels toAgent(application.io.opentelemetry.common.Labels applicationLabels) {
|
||||
io.opentelemetry.common.Labels.Builder builder = io.opentelemetry.common.Labels.newBuilder();
|
||||
labels.forEach(new Consumer(builder));
|
||||
applicationLabels.forEach(new Consumer(builder));
|
||||
return builder.build();
|
||||
}
|
||||
|
|
@ -21,10 +21,13 @@ import static net.bytebuddy.matcher.ElementMatchers.isPublic;
|
|||
import static net.bytebuddy.matcher.ElementMatchers.named;
|
||||
import static net.bytebuddy.matcher.ElementMatchers.takesArguments;
|
||||
|
||||
import application.io.grpc.Context;
|
||||
import application.io.opentelemetry.context.propagation.ContextPropagators;
|
||||
import application.io.opentelemetry.metrics.MeterProvider;
|
||||
import com.google.auto.service.AutoService;
|
||||
import io.opentelemetry.auto.instrumentation.opentelemetryapi.context.propagation.UnshadedContextPropagators;
|
||||
import io.opentelemetry.auto.instrumentation.opentelemetryapi.metrics.UnshadedMeterProvider;
|
||||
import io.opentelemetry.auto.instrumentation.opentelemetryapi.trace.UnshadedTracerProvider;
|
||||
import io.opentelemetry.auto.instrumentation.opentelemetryapi.context.propagation.ApplicationContextPropagators;
|
||||
import io.opentelemetry.auto.instrumentation.opentelemetryapi.metrics.ApplicationMeterProvider;
|
||||
import io.opentelemetry.auto.instrumentation.opentelemetryapi.trace.ApplicationTracerProvider;
|
||||
import io.opentelemetry.auto.tooling.Instrumenter;
|
||||
import io.opentelemetry.instrumentation.auto.api.ContextStore;
|
||||
import io.opentelemetry.instrumentation.auto.api.InstrumentationContext;
|
||||
|
@ -34,14 +37,13 @@ import net.bytebuddy.asm.Advice;
|
|||
import net.bytebuddy.description.method.MethodDescription;
|
||||
import net.bytebuddy.description.type.TypeDescription;
|
||||
import net.bytebuddy.matcher.ElementMatcher;
|
||||
import unshaded.io.grpc.Context;
|
||||
|
||||
@AutoService(Instrumenter.class)
|
||||
public class OpenTelemetryApiInstrumentation extends AbstractInstrumentation {
|
||||
|
||||
@Override
|
||||
public ElementMatcher<? super TypeDescription> typeMatcher() {
|
||||
return named("unshaded.io.opentelemetry.OpenTelemetry");
|
||||
return named("application.io.opentelemetry.OpenTelemetry");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -64,10 +66,11 @@ public class OpenTelemetryApiInstrumentation extends AbstractInstrumentation {
|
|||
@Advice.OnMethodExit(onThrowable = Throwable.class, suppress = Throwable.class)
|
||||
public static void methodExit(
|
||||
@Advice.Return(readOnly = false)
|
||||
unshaded.io.opentelemetry.trace.TracerProvider tracerProvider) {
|
||||
application.io.opentelemetry.trace.TracerProvider applicationTracerProvider) {
|
||||
ContextStore<Context, io.grpc.Context> contextStore =
|
||||
InstrumentationContext.get(Context.class, io.grpc.Context.class);
|
||||
tracerProvider = new UnshadedTracerProvider(contextStore, tracerProvider);
|
||||
applicationTracerProvider =
|
||||
new ApplicationTracerProvider(contextStore, applicationTracerProvider);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -75,9 +78,8 @@ public class OpenTelemetryApiInstrumentation extends AbstractInstrumentation {
|
|||
|
||||
@Advice.OnMethodExit(onThrowable = Throwable.class, suppress = Throwable.class)
|
||||
public static void methodExit(
|
||||
@Advice.Return(readOnly = false)
|
||||
unshaded.io.opentelemetry.metrics.MeterProvider meterProvider) {
|
||||
meterProvider = new UnshadedMeterProvider();
|
||||
@Advice.Return(readOnly = false) MeterProvider applicationMeterProvider) {
|
||||
applicationMeterProvider = new ApplicationMeterProvider();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -85,11 +87,10 @@ public class OpenTelemetryApiInstrumentation extends AbstractInstrumentation {
|
|||
|
||||
@Advice.OnMethodExit(onThrowable = Throwable.class, suppress = Throwable.class)
|
||||
public static void methodExit(
|
||||
@Advice.Return(readOnly = false)
|
||||
unshaded.io.opentelemetry.context.propagation.ContextPropagators contextPropagators) {
|
||||
@Advice.Return(readOnly = false) ContextPropagators applicationContextPropagators) {
|
||||
ContextStore<Context, io.grpc.Context> contextStore =
|
||||
InstrumentationContext.get(Context.class, io.grpc.Context.class);
|
||||
contextPropagators = new UnshadedContextPropagators(contextStore);
|
||||
applicationContextPropagators = new ApplicationContextPropagators(contextStore);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,6 +22,9 @@ import static net.bytebuddy.matcher.ElementMatchers.isStatic;
|
|||
import static net.bytebuddy.matcher.ElementMatchers.named;
|
||||
import static net.bytebuddy.matcher.ElementMatchers.takesArguments;
|
||||
|
||||
import application.io.grpc.Context;
|
||||
import application.io.opentelemetry.context.Scope;
|
||||
import application.io.opentelemetry.trace.Span;
|
||||
import com.google.auto.service.AutoService;
|
||||
import io.opentelemetry.auto.instrumentation.opentelemetryapi.trace.TracingContextUtils;
|
||||
import io.opentelemetry.auto.tooling.Instrumenter;
|
||||
|
@ -33,16 +36,13 @@ import net.bytebuddy.asm.Advice;
|
|||
import net.bytebuddy.description.method.MethodDescription;
|
||||
import net.bytebuddy.description.type.TypeDescription;
|
||||
import net.bytebuddy.matcher.ElementMatcher;
|
||||
import unshaded.io.grpc.Context;
|
||||
import unshaded.io.opentelemetry.context.Scope;
|
||||
import unshaded.io.opentelemetry.trace.Span;
|
||||
|
||||
@AutoService(Instrumenter.class)
|
||||
public class TracingContextUtilsInstrumentation extends AbstractInstrumentation {
|
||||
|
||||
@Override
|
||||
public ElementMatcher<? super TypeDescription> typeMatcher() {
|
||||
return named("unshaded.io.opentelemetry.trace.TracingContextUtils");
|
||||
return named("application.io.opentelemetry.trace.TracingContextUtils");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -87,13 +87,14 @@ public class TracingContextUtilsInstrumentation extends AbstractInstrumentation
|
|||
|
||||
@Advice.OnMethodExit(onThrowable = Throwable.class, suppress = Throwable.class)
|
||||
public static void methodExit(
|
||||
@Advice.Argument(0) final Span span,
|
||||
@Advice.Argument(1) final Context context,
|
||||
@Advice.Return(readOnly = false) Context updatedContext) {
|
||||
@Advice.Argument(0) final Span applicationSpan,
|
||||
@Advice.Argument(1) final Context applicationContext,
|
||||
@Advice.Return(readOnly = false) Context applicationUpdatedContext) {
|
||||
|
||||
ContextStore<Context, io.grpc.Context> contextStore =
|
||||
InstrumentationContext.get(Context.class, io.grpc.Context.class);
|
||||
updatedContext = TracingContextUtils.withSpan(span, context, contextStore);
|
||||
applicationUpdatedContext =
|
||||
TracingContextUtils.withSpan(applicationSpan, applicationContext, contextStore);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -105,8 +106,8 @@ public class TracingContextUtilsInstrumentation extends AbstractInstrumentation
|
|||
}
|
||||
|
||||
@Advice.OnMethodExit(onThrowable = Throwable.class, suppress = Throwable.class)
|
||||
public static void methodExit(@Advice.Return(readOnly = false) Span span) {
|
||||
span = TracingContextUtils.getCurrentSpan();
|
||||
public static void methodExit(@Advice.Return(readOnly = false) Span applicationSpan) {
|
||||
applicationSpan = TracingContextUtils.getCurrentSpan();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -119,11 +120,12 @@ public class TracingContextUtilsInstrumentation extends AbstractInstrumentation
|
|||
|
||||
@Advice.OnMethodExit(onThrowable = Throwable.class, suppress = Throwable.class)
|
||||
public static void methodExit(
|
||||
@Advice.Argument(0) final Context context, @Advice.Return(readOnly = false) Span span) {
|
||||
@Advice.Argument(0) final Context context,
|
||||
@Advice.Return(readOnly = false) Span applicationSpan) {
|
||||
|
||||
ContextStore<Context, io.grpc.Context> contextStore =
|
||||
InstrumentationContext.get(Context.class, io.grpc.Context.class);
|
||||
span = TracingContextUtils.getSpan(context, contextStore);
|
||||
applicationSpan = TracingContextUtils.getSpan(context, contextStore);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -136,11 +138,12 @@ public class TracingContextUtilsInstrumentation extends AbstractInstrumentation
|
|||
|
||||
@Advice.OnMethodExit(onThrowable = Throwable.class, suppress = Throwable.class)
|
||||
public static void methodExit(
|
||||
@Advice.Argument(0) final Context context, @Advice.Return(readOnly = false) Span span) {
|
||||
@Advice.Argument(0) final Context context,
|
||||
@Advice.Return(readOnly = false) Span applicationSpan) {
|
||||
|
||||
ContextStore<Context, io.grpc.Context> contextStore =
|
||||
InstrumentationContext.get(Context.class, io.grpc.Context.class);
|
||||
span = TracingContextUtils.getSpanWithoutDefault(context, contextStore);
|
||||
applicationSpan = TracingContextUtils.getSpanWithoutDefault(context, contextStore);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -153,8 +156,9 @@ public class TracingContextUtilsInstrumentation extends AbstractInstrumentation
|
|||
|
||||
@Advice.OnMethodExit(onThrowable = Throwable.class, suppress = Throwable.class)
|
||||
public static void methodExit(
|
||||
@Advice.Argument(0) final Span span, @Advice.Return(readOnly = false) Scope scope) {
|
||||
scope = TracingContextUtils.currentContextWith(span);
|
||||
@Advice.Argument(0) final Span applicationSpan,
|
||||
@Advice.Return(readOnly = false) Scope applicationScope) {
|
||||
applicationScope = TracingContextUtils.currentContextWith(applicationSpan);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,15 +16,14 @@
|
|||
|
||||
package io.opentelemetry.auto.instrumentation.opentelemetryapi.anotations;
|
||||
|
||||
import application.io.opentelemetry.extensions.auto.annotations.WithSpan;
|
||||
import application.io.opentelemetry.trace.Span;
|
||||
import io.opentelemetry.OpenTelemetry;
|
||||
import io.opentelemetry.instrumentation.api.decorator.BaseDecorator;
|
||||
import io.opentelemetry.trace.Span;
|
||||
import io.opentelemetry.trace.Tracer;
|
||||
import java.lang.reflect.Method;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import unshaded.io.opentelemetry.extensions.auto.annotations.WithSpan;
|
||||
import unshaded.io.opentelemetry.trace.Span.Kind;
|
||||
|
||||
public class TraceDecorator extends BaseDecorator {
|
||||
public static final TraceDecorator DECORATE = new TraceDecorator();
|
||||
|
@ -40,24 +39,25 @@ public class TraceDecorator extends BaseDecorator {
|
|||
* tries to derive name from its {@code value} attribute. Otherwise delegates to {@link
|
||||
* #spanNameForMethod(Method)}.
|
||||
*/
|
||||
public String spanNameForMethodWithAnnotation(WithSpan annotation, Method method) {
|
||||
if (annotation != null && !annotation.value().isEmpty()) {
|
||||
return annotation.value();
|
||||
public String spanNameForMethodWithAnnotation(WithSpan applicationAnnotation, Method method) {
|
||||
if (applicationAnnotation != null && !applicationAnnotation.value().isEmpty()) {
|
||||
return applicationAnnotation.value();
|
||||
}
|
||||
return spanNameForMethod(method);
|
||||
}
|
||||
|
||||
public Span.Kind extractSpanKind(WithSpan annotation) {
|
||||
Kind unshadedKind = annotation != null ? annotation.kind() : Kind.INTERNAL;
|
||||
return toShadedOrNull(unshadedKind);
|
||||
public io.opentelemetry.trace.Span.Kind extractSpanKind(WithSpan applicationAnnotation) {
|
||||
Span.Kind applicationKind =
|
||||
applicationAnnotation != null ? applicationAnnotation.kind() : Span.Kind.INTERNAL;
|
||||
return toAgentOrNull(applicationKind);
|
||||
}
|
||||
|
||||
public static io.opentelemetry.trace.Span.Kind toShadedOrNull(
|
||||
final unshaded.io.opentelemetry.trace.Span.Kind unshadedSpanKind) {
|
||||
public static io.opentelemetry.trace.Span.Kind toAgentOrNull(
|
||||
final Span.Kind applicationSpanKind) {
|
||||
try {
|
||||
return io.opentelemetry.trace.Span.Kind.valueOf(unshadedSpanKind.name());
|
||||
return io.opentelemetry.trace.Span.Kind.valueOf(applicationSpanKind.name());
|
||||
} catch (final IllegalArgumentException e) {
|
||||
log.debug("unexpected span kind: {}", unshadedSpanKind.name());
|
||||
log.debug("unexpected span kind: {}", applicationSpanKind.name());
|
||||
return io.opentelemetry.trace.Span.Kind.INTERNAL;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,11 +20,11 @@ import static io.opentelemetry.auto.instrumentation.opentelemetryapi.anotations.
|
|||
import static io.opentelemetry.auto.instrumentation.opentelemetryapi.anotations.TraceDecorator.TRACER;
|
||||
import static io.opentelemetry.trace.TracingContextUtils.currentContextWith;
|
||||
|
||||
import application.io.opentelemetry.extensions.auto.annotations.WithSpan;
|
||||
import io.opentelemetry.instrumentation.auto.api.SpanWithScope;
|
||||
import io.opentelemetry.trace.Span;
|
||||
import java.lang.reflect.Method;
|
||||
import net.bytebuddy.asm.Advice;
|
||||
import unshaded.io.opentelemetry.extensions.auto.annotations.WithSpan;
|
||||
|
||||
/**
|
||||
* Instrumentation for methods annotated with {@link
|
||||
|
@ -36,12 +36,12 @@ public class WithSpanAdvice {
|
|||
|
||||
@Advice.OnMethodEnter(suppress = Throwable.class)
|
||||
public static SpanWithScope onEnter(@Advice.Origin final Method method) {
|
||||
WithSpan annotation = method.getAnnotation(WithSpan.class);
|
||||
WithSpan applicationAnnotation = method.getAnnotation(WithSpan.class);
|
||||
|
||||
Span span =
|
||||
TRACER
|
||||
.spanBuilder(DECORATE.spanNameForMethodWithAnnotation(annotation, method))
|
||||
.setSpanKind(DECORATE.extractSpanKind(annotation))
|
||||
.spanBuilder(DECORATE.spanNameForMethodWithAnnotation(applicationAnnotation, method))
|
||||
.setSpanKind(DECORATE.extractSpanKind(applicationAnnotation))
|
||||
.startSpan();
|
||||
DECORATE.afterStart(span);
|
||||
return new SpanWithScope(span, currentContextWith(span));
|
||||
|
|
|
@ -47,7 +47,7 @@ public final class WithSpanAnnotationInstrumentation
|
|||
public WithSpanAnnotationInstrumentation() {
|
||||
super("trace", "with-span-annotation");
|
||||
annotatedMethodMatcher =
|
||||
isAnnotatedWith(named("unshaded.io.opentelemetry.extensions.auto.annotations.WithSpan"));
|
||||
isAnnotatedWith(named("application.io.opentelemetry.extensions.auto.annotations.WithSpan"));
|
||||
excludedMethodsMatcher = configureExcludedMethods();
|
||||
}
|
||||
|
||||
|
|
|
@ -16,18 +16,18 @@
|
|||
|
||||
package io.opentelemetry.auto.instrumentation.opentelemetryapi.context;
|
||||
|
||||
import unshaded.io.opentelemetry.context.Scope;
|
||||
import application.io.opentelemetry.context.Scope;
|
||||
|
||||
public class UnshadedScope implements Scope {
|
||||
public class ApplicationScope implements Scope {
|
||||
|
||||
private final io.opentelemetry.context.Scope shadedScope;
|
||||
private final io.opentelemetry.context.Scope agentScope;
|
||||
|
||||
public UnshadedScope(final io.opentelemetry.context.Scope shadedScope) {
|
||||
this.shadedScope = shadedScope;
|
||||
public ApplicationScope(final io.opentelemetry.context.Scope agentScope) {
|
||||
this.agentScope = agentScope;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() {
|
||||
shadedScope.close();
|
||||
agentScope.close();
|
||||
}
|
||||
}
|
|
@ -16,11 +16,11 @@
|
|||
|
||||
package io.opentelemetry.auto.instrumentation.opentelemetryapi.context;
|
||||
|
||||
import application.io.grpc.Context;
|
||||
import application.io.opentelemetry.context.Scope;
|
||||
import io.opentelemetry.instrumentation.auto.api.ContextStore;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import unshaded.io.grpc.Context;
|
||||
import unshaded.io.opentelemetry.context.Scope;
|
||||
|
||||
public class ContextUtils {
|
||||
|
||||
|
@ -28,16 +28,16 @@ public class ContextUtils {
|
|||
|
||||
public static Scope withScopedContext(
|
||||
final Context context, final ContextStore<Context, io.grpc.Context> contextStore) {
|
||||
io.grpc.Context shadedContext = contextStore.get(context);
|
||||
if (shadedContext == null) {
|
||||
io.grpc.Context agentContext = contextStore.get(context);
|
||||
if (agentContext == null) {
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("unexpected context: {}", context, new Exception("unexpected context"));
|
||||
}
|
||||
return NoopScope.getInstance();
|
||||
}
|
||||
|
||||
io.opentelemetry.context.Scope scope =
|
||||
io.opentelemetry.context.ContextUtils.withScopedContext(shadedContext);
|
||||
return new UnshadedScope(scope);
|
||||
io.opentelemetry.context.Scope agentScope =
|
||||
io.opentelemetry.context.ContextUtils.withScopedContext(agentContext);
|
||||
return new ApplicationScope(agentScope);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
|
||||
package io.opentelemetry.auto.instrumentation.opentelemetryapi.context;
|
||||
|
||||
import unshaded.io.opentelemetry.context.Scope;
|
||||
import application.io.opentelemetry.context.Scope;
|
||||
|
||||
/** A {@link Scope} that does nothing when it is created or closed. */
|
||||
public final class NoopScope implements Scope {
|
||||
|
|
|
@ -16,24 +16,24 @@
|
|||
|
||||
package io.opentelemetry.auto.instrumentation.opentelemetryapi.context.propagation;
|
||||
|
||||
import application.io.grpc.Context;
|
||||
import application.io.opentelemetry.context.propagation.ContextPropagators;
|
||||
import application.io.opentelemetry.context.propagation.HttpTextFormat;
|
||||
import io.opentelemetry.OpenTelemetry;
|
||||
import io.opentelemetry.instrumentation.auto.api.ContextStore;
|
||||
import unshaded.io.grpc.Context;
|
||||
import unshaded.io.opentelemetry.context.propagation.ContextPropagators;
|
||||
import unshaded.io.opentelemetry.context.propagation.HttpTextFormat;
|
||||
|
||||
public class UnshadedContextPropagators implements ContextPropagators {
|
||||
public class ApplicationContextPropagators implements ContextPropagators {
|
||||
|
||||
private final UnshadedHttpTextFormat unshadedHttpTextFormat;
|
||||
private final ApplicationHttpTextFormat applicationHttpTextFormat;
|
||||
|
||||
public UnshadedContextPropagators(final ContextStore<Context, io.grpc.Context> contextStore) {
|
||||
unshadedHttpTextFormat =
|
||||
new UnshadedHttpTextFormat(
|
||||
public ApplicationContextPropagators(final ContextStore<Context, io.grpc.Context> contextStore) {
|
||||
applicationHttpTextFormat =
|
||||
new ApplicationHttpTextFormat(
|
||||
OpenTelemetry.getPropagators().getHttpTextFormat(), contextStore);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpTextFormat getHttpTextFormat() {
|
||||
return unshadedHttpTextFormat;
|
||||
return applicationHttpTextFormat;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,112 @@
|
|||
/*
|
||||
* Copyright The OpenTelemetry 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.
|
||||
*/
|
||||
|
||||
package io.opentelemetry.auto.instrumentation.opentelemetryapi.context.propagation;
|
||||
|
||||
import application.io.grpc.Context;
|
||||
import application.io.opentelemetry.context.propagation.HttpTextFormat;
|
||||
import io.opentelemetry.instrumentation.auto.api.ContextStore;
|
||||
import java.util.List;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
class ApplicationHttpTextFormat implements HttpTextFormat {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(ApplicationHttpTextFormat.class);
|
||||
|
||||
private final io.opentelemetry.context.propagation.HttpTextFormat agentHttpTextFormat;
|
||||
private final ContextStore<Context, io.grpc.Context> contextStore;
|
||||
|
||||
ApplicationHttpTextFormat(
|
||||
final io.opentelemetry.context.propagation.HttpTextFormat agentHttpTextFormat,
|
||||
final ContextStore<Context, io.grpc.Context> contextStore) {
|
||||
this.agentHttpTextFormat = agentHttpTextFormat;
|
||||
this.contextStore = contextStore;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> fields() {
|
||||
return agentHttpTextFormat.fields();
|
||||
}
|
||||
|
||||
@Override
|
||||
public <C> Context extract(
|
||||
final Context applicationContext,
|
||||
final C carrier,
|
||||
final HttpTextFormat.Getter<C> applicationGetter) {
|
||||
io.grpc.Context agentContext = contextStore.get(applicationContext);
|
||||
if (agentContext == null) {
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug(
|
||||
"unexpected context: {}", applicationContext, new Exception("unexpected context"));
|
||||
}
|
||||
return applicationContext;
|
||||
}
|
||||
io.grpc.Context agentUpdatedContext =
|
||||
agentHttpTextFormat.extract(agentContext, carrier, new AgentGetter<>(applicationGetter));
|
||||
if (agentUpdatedContext == agentContext) {
|
||||
return applicationContext;
|
||||
}
|
||||
contextStore.put(applicationContext, agentUpdatedContext);
|
||||
return applicationContext;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <C> void inject(
|
||||
final Context applicationContext,
|
||||
final C carrier,
|
||||
final HttpTextFormat.Setter<C> applicationSetter) {
|
||||
io.grpc.Context agentContext = contextStore.get(applicationContext);
|
||||
if (agentContext == null) {
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug(
|
||||
"unexpected context: {}", applicationContext, new Exception("unexpected context"));
|
||||
}
|
||||
return;
|
||||
}
|
||||
agentHttpTextFormat.inject(agentContext, carrier, new AgentSetter<>(applicationSetter));
|
||||
}
|
||||
|
||||
private static class AgentGetter<C>
|
||||
implements io.opentelemetry.context.propagation.HttpTextFormat.Getter<C> {
|
||||
|
||||
private final HttpTextFormat.Getter<C> applicationGetter;
|
||||
|
||||
AgentGetter(final HttpTextFormat.Getter<C> applicationGetter) {
|
||||
this.applicationGetter = applicationGetter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String get(final C carrier, final String key) {
|
||||
return applicationGetter.get(carrier, key);
|
||||
}
|
||||
}
|
||||
|
||||
private static class AgentSetter<C>
|
||||
implements io.opentelemetry.context.propagation.HttpTextFormat.Setter<C> {
|
||||
|
||||
private final HttpTextFormat.Setter<C> applicationSetter;
|
||||
|
||||
AgentSetter(final Setter<C> applicationSetter) {
|
||||
this.applicationSetter = applicationSetter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void set(final C carrier, final String key, final String value) {
|
||||
applicationSetter.set(carrier, key, value);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,106 +0,0 @@
|
|||
/*
|
||||
* Copyright The OpenTelemetry 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.
|
||||
*/
|
||||
|
||||
package io.opentelemetry.auto.instrumentation.opentelemetryapi.context.propagation;
|
||||
|
||||
import io.opentelemetry.instrumentation.auto.api.ContextStore;
|
||||
import java.util.List;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import unshaded.io.grpc.Context;
|
||||
import unshaded.io.opentelemetry.context.propagation.HttpTextFormat;
|
||||
|
||||
class UnshadedHttpTextFormat implements HttpTextFormat {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(UnshadedHttpTextFormat.class);
|
||||
|
||||
private final io.opentelemetry.context.propagation.HttpTextFormat shadedHttpTextFormat;
|
||||
private final ContextStore<Context, io.grpc.Context> contextStore;
|
||||
|
||||
UnshadedHttpTextFormat(
|
||||
final io.opentelemetry.context.propagation.HttpTextFormat shadedHttpTextFormat,
|
||||
final ContextStore<Context, io.grpc.Context> contextStore) {
|
||||
this.shadedHttpTextFormat = shadedHttpTextFormat;
|
||||
this.contextStore = contextStore;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> fields() {
|
||||
return shadedHttpTextFormat.fields();
|
||||
}
|
||||
|
||||
@Override
|
||||
public <C> Context extract(
|
||||
final Context context, final C carrier, final HttpTextFormat.Getter<C> getter) {
|
||||
io.grpc.Context shadedContext = contextStore.get(context);
|
||||
if (shadedContext == null) {
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("unexpected context: {}", context, new Exception("unexpected context"));
|
||||
}
|
||||
return context;
|
||||
}
|
||||
io.grpc.Context updatedShadedContext =
|
||||
shadedHttpTextFormat.extract(shadedContext, carrier, new UnshadedGetter<>(getter));
|
||||
if (updatedShadedContext == shadedContext) {
|
||||
return context;
|
||||
}
|
||||
contextStore.put(context, updatedShadedContext);
|
||||
return context;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <C> void inject(
|
||||
final Context context, final C carrier, final HttpTextFormat.Setter<C> setter) {
|
||||
io.grpc.Context shadedContext = contextStore.get(context);
|
||||
if (shadedContext == null) {
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("unexpected context: {}", context, new Exception("unexpected context"));
|
||||
}
|
||||
return;
|
||||
}
|
||||
shadedHttpTextFormat.inject(shadedContext, carrier, new UnshadedSetter<>(setter));
|
||||
}
|
||||
|
||||
private static class UnshadedGetter<C>
|
||||
implements io.opentelemetry.context.propagation.HttpTextFormat.Getter<C> {
|
||||
|
||||
private final HttpTextFormat.Getter<C> shadedGetter;
|
||||
|
||||
UnshadedGetter(final HttpTextFormat.Getter<C> shadedGetter) {
|
||||
this.shadedGetter = shadedGetter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String get(final C carrier, final String key) {
|
||||
return shadedGetter.get(carrier, key);
|
||||
}
|
||||
}
|
||||
|
||||
private static class UnshadedSetter<C>
|
||||
implements io.opentelemetry.context.propagation.HttpTextFormat.Setter<C> {
|
||||
|
||||
private final HttpTextFormat.Setter<C> shadedSetter;
|
||||
|
||||
UnshadedSetter(final Setter<C> shadedSetter) {
|
||||
this.shadedSetter = shadedSetter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void set(final C carrier, final String key, final String value) {
|
||||
shadedSetter.set(carrier, key, value);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -16,31 +16,31 @@
|
|||
|
||||
package io.opentelemetry.auto.instrumentation.opentelemetryapi.metrics;
|
||||
|
||||
import application.io.opentelemetry.metrics.BatchRecorder;
|
||||
import application.io.opentelemetry.metrics.DoubleCounter;
|
||||
import application.io.opentelemetry.metrics.DoubleUpDownCounter;
|
||||
import application.io.opentelemetry.metrics.DoubleValueRecorder;
|
||||
import application.io.opentelemetry.metrics.LongCounter;
|
||||
import application.io.opentelemetry.metrics.LongUpDownCounter;
|
||||
import application.io.opentelemetry.metrics.LongValueRecorder;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import unshaded.io.opentelemetry.metrics.BatchRecorder;
|
||||
import unshaded.io.opentelemetry.metrics.DoubleCounter;
|
||||
import unshaded.io.opentelemetry.metrics.DoubleUpDownCounter;
|
||||
import unshaded.io.opentelemetry.metrics.DoubleValueRecorder;
|
||||
import unshaded.io.opentelemetry.metrics.LongCounter;
|
||||
import unshaded.io.opentelemetry.metrics.LongUpDownCounter;
|
||||
import unshaded.io.opentelemetry.metrics.LongValueRecorder;
|
||||
|
||||
class UnshadedBatchRecorder implements BatchRecorder {
|
||||
class ApplicationBatchRecorder implements BatchRecorder {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(UnshadedBatchRecorder.class);
|
||||
private static final Logger log = LoggerFactory.getLogger(ApplicationBatchRecorder.class);
|
||||
|
||||
private final io.opentelemetry.metrics.BatchRecorder shadedBatchRecorder;
|
||||
private final io.opentelemetry.metrics.BatchRecorder agentBatchRecorder;
|
||||
|
||||
UnshadedBatchRecorder(final io.opentelemetry.metrics.BatchRecorder shadedBatchRecorder) {
|
||||
this.shadedBatchRecorder = shadedBatchRecorder;
|
||||
ApplicationBatchRecorder(final io.opentelemetry.metrics.BatchRecorder agentBatchRecorder) {
|
||||
this.agentBatchRecorder = agentBatchRecorder;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BatchRecorder put(final LongValueRecorder measure, final long value) {
|
||||
if (measure instanceof UnshadedLongValueRecorder) {
|
||||
shadedBatchRecorder.put(
|
||||
((UnshadedLongValueRecorder) measure).getShadedLongValueRecorder(), value);
|
||||
if (measure instanceof ApplicationLongValueRecorder) {
|
||||
agentBatchRecorder.put(
|
||||
((ApplicationLongValueRecorder) measure).getAgentLongValueRecorder(), value);
|
||||
} else {
|
||||
log.debug("unexpected measure: {}", measure);
|
||||
}
|
||||
|
@ -49,9 +49,9 @@ class UnshadedBatchRecorder implements BatchRecorder {
|
|||
|
||||
@Override
|
||||
public BatchRecorder put(final DoubleValueRecorder measure, final double value) {
|
||||
if (measure instanceof UnshadedDoubleValueRecorder) {
|
||||
shadedBatchRecorder.put(
|
||||
((UnshadedDoubleValueRecorder) measure).getShadedDoubleValueRecorder(), value);
|
||||
if (measure instanceof ApplicationDoubleValueRecorder) {
|
||||
agentBatchRecorder.put(
|
||||
((ApplicationDoubleValueRecorder) measure).getAgentDoubleValueRecorder(), value);
|
||||
} else {
|
||||
log.debug("unexpected measure: {}", measure);
|
||||
}
|
||||
|
@ -60,8 +60,8 @@ class UnshadedBatchRecorder implements BatchRecorder {
|
|||
|
||||
@Override
|
||||
public BatchRecorder put(final LongCounter counter, final long value) {
|
||||
if (counter instanceof UnshadedLongCounter) {
|
||||
shadedBatchRecorder.put(((UnshadedLongCounter) counter).getShadedLongCounter(), value);
|
||||
if (counter instanceof ApplicationLongCounter) {
|
||||
agentBatchRecorder.put(((ApplicationLongCounter) counter).getAgentLongCounter(), value);
|
||||
} else {
|
||||
log.debug("unexpected counter: {}", counter);
|
||||
}
|
||||
|
@ -70,8 +70,8 @@ class UnshadedBatchRecorder implements BatchRecorder {
|
|||
|
||||
@Override
|
||||
public BatchRecorder put(final DoubleCounter counter, final double value) {
|
||||
if (counter instanceof UnshadedDoubleCounter) {
|
||||
shadedBatchRecorder.put(((UnshadedDoubleCounter) counter).getShadedDoubleCounter(), value);
|
||||
if (counter instanceof ApplicationDoubleCounter) {
|
||||
agentBatchRecorder.put(((ApplicationDoubleCounter) counter).getAgentDoubleCounter(), value);
|
||||
} else {
|
||||
log.debug("unexpected counter: {}", counter);
|
||||
}
|
||||
|
@ -80,9 +80,9 @@ class UnshadedBatchRecorder implements BatchRecorder {
|
|||
|
||||
@Override
|
||||
public BatchRecorder put(final LongUpDownCounter counter, final long value) {
|
||||
if (counter instanceof UnshadedLongUpDownCounter) {
|
||||
shadedBatchRecorder.put(
|
||||
((UnshadedLongUpDownCounter) counter).getShadedLongUpDownCounter(), value);
|
||||
if (counter instanceof ApplicationLongUpDownCounter) {
|
||||
agentBatchRecorder.put(
|
||||
((ApplicationLongUpDownCounter) counter).getAgentLongUpDownCounter(), value);
|
||||
} else {
|
||||
log.debug("unexpected counter: {}", counter);
|
||||
}
|
||||
|
@ -91,9 +91,9 @@ class UnshadedBatchRecorder implements BatchRecorder {
|
|||
|
||||
@Override
|
||||
public BatchRecorder put(final DoubleUpDownCounter counter, final double value) {
|
||||
if (counter instanceof UnshadedDoubleUpDownCounter) {
|
||||
shadedBatchRecorder.put(
|
||||
((UnshadedDoubleUpDownCounter) counter).getShadedDoubleUpDownCounter(), value);
|
||||
if (counter instanceof ApplicationDoubleUpDownCounter) {
|
||||
agentBatchRecorder.put(
|
||||
((ApplicationDoubleUpDownCounter) counter).getAgentDoubleUpDownCounter(), value);
|
||||
} else {
|
||||
log.debug("unexpected counter: {}", counter);
|
||||
}
|
||||
|
@ -102,6 +102,6 @@ class UnshadedBatchRecorder implements BatchRecorder {
|
|||
|
||||
@Override
|
||||
public void record() {
|
||||
shadedBatchRecorder.record();
|
||||
agentBatchRecorder.record();
|
||||
}
|
||||
}
|
|
@ -16,82 +16,81 @@
|
|||
|
||||
package io.opentelemetry.auto.instrumentation.opentelemetryapi.metrics;
|
||||
|
||||
import io.opentelemetry.auto.instrumentation.opentelemetryapi.LabelsShader;
|
||||
import unshaded.io.opentelemetry.common.Labels;
|
||||
import unshaded.io.opentelemetry.metrics.DoubleCounter;
|
||||
import application.io.opentelemetry.common.Labels;
|
||||
import application.io.opentelemetry.metrics.DoubleCounter;
|
||||
import io.opentelemetry.auto.instrumentation.opentelemetryapi.LabelBridging;
|
||||
|
||||
class UnshadedDoubleCounter implements DoubleCounter {
|
||||
class ApplicationDoubleCounter implements DoubleCounter {
|
||||
|
||||
private final io.opentelemetry.metrics.DoubleCounter shadedDoubleCounter;
|
||||
private final io.opentelemetry.metrics.DoubleCounter agentDoubleCounter;
|
||||
|
||||
UnshadedDoubleCounter(final io.opentelemetry.metrics.DoubleCounter shadedDoubleCounter) {
|
||||
this.shadedDoubleCounter = shadedDoubleCounter;
|
||||
ApplicationDoubleCounter(final io.opentelemetry.metrics.DoubleCounter agentDoubleCounter) {
|
||||
this.agentDoubleCounter = agentDoubleCounter;
|
||||
}
|
||||
|
||||
io.opentelemetry.metrics.DoubleCounter getShadedDoubleCounter() {
|
||||
return shadedDoubleCounter;
|
||||
io.opentelemetry.metrics.DoubleCounter getAgentDoubleCounter() {
|
||||
return agentDoubleCounter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(final double delta, final Labels labels) {
|
||||
shadedDoubleCounter.add(delta, LabelsShader.shade(labels));
|
||||
agentDoubleCounter.add(delta, LabelBridging.toAgent(labels));
|
||||
}
|
||||
|
||||
@Override
|
||||
public BoundDoubleCounter bind(final Labels labels) {
|
||||
return new BoundInstrument(shadedDoubleCounter.bind(LabelsShader.shade(labels)));
|
||||
return new BoundInstrument(agentDoubleCounter.bind(LabelBridging.toAgent(labels)));
|
||||
}
|
||||
|
||||
static class BoundInstrument implements DoubleCounter.BoundDoubleCounter {
|
||||
|
||||
private final io.opentelemetry.metrics.DoubleCounter.BoundDoubleCounter
|
||||
shadedBoundDoubleCounter;
|
||||
private final io.opentelemetry.metrics.DoubleCounter.BoundDoubleCounter agentBoundDoubleCounter;
|
||||
|
||||
BoundInstrument(
|
||||
final io.opentelemetry.metrics.DoubleCounter.BoundDoubleCounter shadedBoundDoubleCounter) {
|
||||
this.shadedBoundDoubleCounter = shadedBoundDoubleCounter;
|
||||
final io.opentelemetry.metrics.DoubleCounter.BoundDoubleCounter agentBoundDoubleCounter) {
|
||||
this.agentBoundDoubleCounter = agentBoundDoubleCounter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(final double delta) {
|
||||
shadedBoundDoubleCounter.add(delta);
|
||||
agentBoundDoubleCounter.add(delta);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unbind() {
|
||||
shadedBoundDoubleCounter.unbind();
|
||||
agentBoundDoubleCounter.unbind();
|
||||
}
|
||||
}
|
||||
|
||||
static class Builder implements DoubleCounter.Builder {
|
||||
|
||||
private final io.opentelemetry.metrics.DoubleCounter.Builder shadedBuilder;
|
||||
private final io.opentelemetry.metrics.DoubleCounter.Builder agentBuilder;
|
||||
|
||||
Builder(final io.opentelemetry.metrics.DoubleCounter.Builder shadedBuilder) {
|
||||
this.shadedBuilder = shadedBuilder;
|
||||
Builder(final io.opentelemetry.metrics.DoubleCounter.Builder agentBuilder) {
|
||||
this.agentBuilder = agentBuilder;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DoubleCounter.Builder setDescription(final String description) {
|
||||
shadedBuilder.setDescription(description);
|
||||
agentBuilder.setDescription(description);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DoubleCounter.Builder setUnit(final String unit) {
|
||||
shadedBuilder.setUnit(unit);
|
||||
agentBuilder.setUnit(unit);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DoubleCounter.Builder setConstantLabels(final Labels constantLabels) {
|
||||
shadedBuilder.setConstantLabels(LabelsShader.shade(constantLabels));
|
||||
agentBuilder.setConstantLabels(LabelBridging.toAgent(constantLabels));
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DoubleCounter build() {
|
||||
return new UnshadedDoubleCounter(shadedBuilder.build());
|
||||
return new ApplicationDoubleCounter(agentBuilder.build());
|
||||
}
|
||||
}
|
||||
}
|
|
@ -16,87 +16,87 @@
|
|||
|
||||
package io.opentelemetry.auto.instrumentation.opentelemetryapi.metrics;
|
||||
|
||||
import io.opentelemetry.auto.instrumentation.opentelemetryapi.LabelsShader;
|
||||
import application.io.opentelemetry.common.Labels;
|
||||
import application.io.opentelemetry.metrics.DoubleSumObserver;
|
||||
import io.opentelemetry.auto.instrumentation.opentelemetryapi.LabelBridging;
|
||||
import io.opentelemetry.metrics.AsynchronousInstrument;
|
||||
import unshaded.io.opentelemetry.common.Labels;
|
||||
import unshaded.io.opentelemetry.metrics.DoubleSumObserver;
|
||||
|
||||
class UnshadedDoubleSumObserver implements DoubleSumObserver {
|
||||
class ApplicationDoubleSumObserver implements DoubleSumObserver {
|
||||
|
||||
private final io.opentelemetry.metrics.DoubleSumObserver shadedDoubleSumObserver;
|
||||
private final io.opentelemetry.metrics.DoubleSumObserver agentDoubleSumObserver;
|
||||
|
||||
protected UnshadedDoubleSumObserver(
|
||||
final io.opentelemetry.metrics.DoubleSumObserver shadedDoubleSumObserver) {
|
||||
this.shadedDoubleSumObserver = shadedDoubleSumObserver;
|
||||
protected ApplicationDoubleSumObserver(
|
||||
final io.opentelemetry.metrics.DoubleSumObserver agentDoubleSumObserver) {
|
||||
this.agentDoubleSumObserver = agentDoubleSumObserver;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCallback(final Callback<DoubleResult> metricUpdater) {
|
||||
shadedDoubleSumObserver.setCallback(new ShadedResultDoubleSumObserver(metricUpdater));
|
||||
agentDoubleSumObserver.setCallback(new AgentResultDoubleSumObserver(metricUpdater));
|
||||
}
|
||||
|
||||
static class ShadedResultDoubleSumObserver
|
||||
static class AgentResultDoubleSumObserver
|
||||
implements AsynchronousInstrument.Callback<
|
||||
io.opentelemetry.metrics.DoubleSumObserver.DoubleResult> {
|
||||
|
||||
private final Callback<DoubleResult> metricUpdater;
|
||||
|
||||
protected ShadedResultDoubleSumObserver(final Callback<DoubleResult> metricUpdater) {
|
||||
protected AgentResultDoubleSumObserver(final Callback<DoubleResult> metricUpdater) {
|
||||
this.metricUpdater = metricUpdater;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(final io.opentelemetry.metrics.DoubleSumObserver.DoubleResult result) {
|
||||
metricUpdater.update(new UnshadedResultDoubleSumObserver(result));
|
||||
metricUpdater.update(new ApplicationResultDoubleSumObserver(result));
|
||||
}
|
||||
}
|
||||
|
||||
static class UnshadedResultDoubleSumObserver implements DoubleResult {
|
||||
static class ApplicationResultDoubleSumObserver implements DoubleResult {
|
||||
|
||||
private final io.opentelemetry.metrics.DoubleSumObserver.DoubleResult
|
||||
shadedResultDoubleSumObserver;
|
||||
agentResultDoubleSumObserver;
|
||||
|
||||
public UnshadedResultDoubleSumObserver(
|
||||
public ApplicationResultDoubleSumObserver(
|
||||
final io.opentelemetry.metrics.DoubleSumObserver.DoubleResult
|
||||
shadedResultDoubleSumObserver) {
|
||||
this.shadedResultDoubleSumObserver = shadedResultDoubleSumObserver;
|
||||
agentResultDoubleSumObserver) {
|
||||
this.agentResultDoubleSumObserver = agentResultDoubleSumObserver;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void observe(final double value, final Labels labels) {
|
||||
shadedResultDoubleSumObserver.observe(value, LabelsShader.shade(labels));
|
||||
agentResultDoubleSumObserver.observe(value, LabelBridging.toAgent(labels));
|
||||
}
|
||||
}
|
||||
|
||||
static class Builder implements DoubleSumObserver.Builder {
|
||||
|
||||
private final io.opentelemetry.metrics.DoubleSumObserver.Builder shadedBuilder;
|
||||
private final io.opentelemetry.metrics.DoubleSumObserver.Builder agentBuilder;
|
||||
|
||||
protected Builder(final io.opentelemetry.metrics.DoubleSumObserver.Builder shadedBuilder) {
|
||||
this.shadedBuilder = shadedBuilder;
|
||||
protected Builder(final io.opentelemetry.metrics.DoubleSumObserver.Builder agentBuilder) {
|
||||
this.agentBuilder = agentBuilder;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DoubleSumObserver.Builder setDescription(final String description) {
|
||||
shadedBuilder.setDescription(description);
|
||||
agentBuilder.setDescription(description);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DoubleSumObserver.Builder setUnit(final String unit) {
|
||||
shadedBuilder.setUnit(unit);
|
||||
agentBuilder.setUnit(unit);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DoubleSumObserver.Builder setConstantLabels(final Labels constantLabels) {
|
||||
shadedBuilder.setConstantLabels(LabelsShader.shade(constantLabels));
|
||||
agentBuilder.setConstantLabels(LabelBridging.toAgent(constantLabels));
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DoubleSumObserver build() {
|
||||
return new UnshadedDoubleSumObserver(shadedBuilder.build());
|
||||
return new ApplicationDoubleSumObserver(agentBuilder.build());
|
||||
}
|
||||
}
|
||||
}
|
|
@ -16,84 +16,84 @@
|
|||
|
||||
package io.opentelemetry.auto.instrumentation.opentelemetryapi.metrics;
|
||||
|
||||
import io.opentelemetry.auto.instrumentation.opentelemetryapi.LabelsShader;
|
||||
import unshaded.io.opentelemetry.common.Labels;
|
||||
import unshaded.io.opentelemetry.metrics.DoubleUpDownCounter;
|
||||
import application.io.opentelemetry.common.Labels;
|
||||
import application.io.opentelemetry.metrics.DoubleUpDownCounter;
|
||||
import io.opentelemetry.auto.instrumentation.opentelemetryapi.LabelBridging;
|
||||
|
||||
class UnshadedDoubleUpDownCounter implements DoubleUpDownCounter {
|
||||
class ApplicationDoubleUpDownCounter implements DoubleUpDownCounter {
|
||||
|
||||
private final io.opentelemetry.metrics.DoubleUpDownCounter shadedDoubleUpDownCounter;
|
||||
private final io.opentelemetry.metrics.DoubleUpDownCounter agentDoubleUpDownCounter;
|
||||
|
||||
UnshadedDoubleUpDownCounter(
|
||||
final io.opentelemetry.metrics.DoubleUpDownCounter shadedDoubleUpDownCounter) {
|
||||
this.shadedDoubleUpDownCounter = shadedDoubleUpDownCounter;
|
||||
ApplicationDoubleUpDownCounter(
|
||||
final io.opentelemetry.metrics.DoubleUpDownCounter agentDoubleUpDownCounter) {
|
||||
this.agentDoubleUpDownCounter = agentDoubleUpDownCounter;
|
||||
}
|
||||
|
||||
io.opentelemetry.metrics.DoubleUpDownCounter getShadedDoubleUpDownCounter() {
|
||||
return shadedDoubleUpDownCounter;
|
||||
io.opentelemetry.metrics.DoubleUpDownCounter getAgentDoubleUpDownCounter() {
|
||||
return agentDoubleUpDownCounter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(final double delta, final Labels labels) {
|
||||
shadedDoubleUpDownCounter.add(delta, LabelsShader.shade(labels));
|
||||
agentDoubleUpDownCounter.add(delta, LabelBridging.toAgent(labels));
|
||||
}
|
||||
|
||||
@Override
|
||||
public BoundDoubleUpDownCounter bind(final Labels labels) {
|
||||
return new BoundInstrument(shadedDoubleUpDownCounter.bind(LabelsShader.shade(labels)));
|
||||
return new BoundInstrument(agentDoubleUpDownCounter.bind(LabelBridging.toAgent(labels)));
|
||||
}
|
||||
|
||||
static class BoundInstrument implements BoundDoubleUpDownCounter {
|
||||
|
||||
private final io.opentelemetry.metrics.DoubleUpDownCounter.BoundDoubleUpDownCounter
|
||||
shadedBoundDoubleUpDownCounter;
|
||||
agentBoundDoubleUpDownCounter;
|
||||
|
||||
BoundInstrument(
|
||||
final io.opentelemetry.metrics.DoubleUpDownCounter.BoundDoubleUpDownCounter
|
||||
shadedBoundDoubleUpDownCounter) {
|
||||
this.shadedBoundDoubleUpDownCounter = shadedBoundDoubleUpDownCounter;
|
||||
agentBoundDoubleUpDownCounter) {
|
||||
this.agentBoundDoubleUpDownCounter = agentBoundDoubleUpDownCounter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(final double delta) {
|
||||
shadedBoundDoubleUpDownCounter.add(delta);
|
||||
agentBoundDoubleUpDownCounter.add(delta);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unbind() {
|
||||
shadedBoundDoubleUpDownCounter.unbind();
|
||||
agentBoundDoubleUpDownCounter.unbind();
|
||||
}
|
||||
}
|
||||
|
||||
static class Builder implements DoubleUpDownCounter.Builder {
|
||||
|
||||
private final io.opentelemetry.metrics.DoubleUpDownCounter.Builder shadedBuilder;
|
||||
private final io.opentelemetry.metrics.DoubleUpDownCounter.Builder agentBuilder;
|
||||
|
||||
Builder(final io.opentelemetry.metrics.DoubleUpDownCounter.Builder shadedBuilder) {
|
||||
this.shadedBuilder = shadedBuilder;
|
||||
Builder(final io.opentelemetry.metrics.DoubleUpDownCounter.Builder agentBuilder) {
|
||||
this.agentBuilder = agentBuilder;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DoubleUpDownCounter.Builder setDescription(final String description) {
|
||||
shadedBuilder.setDescription(description);
|
||||
agentBuilder.setDescription(description);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DoubleUpDownCounter.Builder setUnit(final String unit) {
|
||||
shadedBuilder.setUnit(unit);
|
||||
agentBuilder.setUnit(unit);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DoubleUpDownCounter.Builder setConstantLabels(final Labels constantLabels) {
|
||||
shadedBuilder.setConstantLabels(LabelsShader.shade(constantLabels));
|
||||
agentBuilder.setConstantLabels(LabelBridging.toAgent(constantLabels));
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DoubleUpDownCounter build() {
|
||||
return new UnshadedDoubleUpDownCounter(shadedBuilder.build());
|
||||
return new ApplicationDoubleUpDownCounter(agentBuilder.build());
|
||||
}
|
||||
}
|
||||
}
|
|
@ -16,89 +16,87 @@
|
|||
|
||||
package io.opentelemetry.auto.instrumentation.opentelemetryapi.metrics;
|
||||
|
||||
import io.opentelemetry.auto.instrumentation.opentelemetryapi.LabelsShader;
|
||||
import application.io.opentelemetry.common.Labels;
|
||||
import application.io.opentelemetry.metrics.DoubleUpDownSumObserver;
|
||||
import io.opentelemetry.auto.instrumentation.opentelemetryapi.LabelBridging;
|
||||
import io.opentelemetry.metrics.AsynchronousInstrument;
|
||||
import unshaded.io.opentelemetry.common.Labels;
|
||||
import unshaded.io.opentelemetry.metrics.DoubleUpDownSumObserver;
|
||||
|
||||
class UnshadedDoubleUpDownSumObserver implements DoubleUpDownSumObserver {
|
||||
class ApplicationDoubleUpDownSumObserver implements DoubleUpDownSumObserver {
|
||||
|
||||
private final io.opentelemetry.metrics.DoubleUpDownSumObserver shadedDoubleUpDownSumObserver;
|
||||
private final io.opentelemetry.metrics.DoubleUpDownSumObserver agentDoubleUpDownSumObserver;
|
||||
|
||||
protected UnshadedDoubleUpDownSumObserver(
|
||||
final io.opentelemetry.metrics.DoubleUpDownSumObserver shadedDoubleUpDownSumObserver) {
|
||||
this.shadedDoubleUpDownSumObserver = shadedDoubleUpDownSumObserver;
|
||||
protected ApplicationDoubleUpDownSumObserver(
|
||||
final io.opentelemetry.metrics.DoubleUpDownSumObserver agentDoubleUpDownSumObserver) {
|
||||
this.agentDoubleUpDownSumObserver = agentDoubleUpDownSumObserver;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCallback(final Callback<DoubleResult> metricUpdater) {
|
||||
shadedDoubleUpDownSumObserver.setCallback(
|
||||
new ShadedResultDoubleUpDownSumObserver(metricUpdater));
|
||||
agentDoubleUpDownSumObserver.setCallback(new AgentResultDoubleUpDownSumObserver(metricUpdater));
|
||||
}
|
||||
|
||||
static class ShadedResultDoubleUpDownSumObserver
|
||||
static class AgentResultDoubleUpDownSumObserver
|
||||
implements AsynchronousInstrument.Callback<
|
||||
io.opentelemetry.metrics.DoubleUpDownSumObserver.DoubleResult> {
|
||||
|
||||
private final Callback<DoubleResult> metricUpdater;
|
||||
|
||||
protected ShadedResultDoubleUpDownSumObserver(final Callback<DoubleResult> metricUpdater) {
|
||||
protected AgentResultDoubleUpDownSumObserver(final Callback<DoubleResult> metricUpdater) {
|
||||
this.metricUpdater = metricUpdater;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(final io.opentelemetry.metrics.DoubleUpDownSumObserver.DoubleResult result) {
|
||||
metricUpdater.update(new UnshadedResultDoubleUpDownSumObserver(result));
|
||||
metricUpdater.update(new ApplicationResultDoubleUpDownSumObserver(result));
|
||||
}
|
||||
}
|
||||
|
||||
static class UnshadedResultDoubleUpDownSumObserver implements DoubleResult {
|
||||
static class ApplicationResultDoubleUpDownSumObserver implements DoubleResult {
|
||||
|
||||
private final io.opentelemetry.metrics.DoubleUpDownSumObserver.DoubleResult
|
||||
shadedResultDoubleUpDownSumObserver;
|
||||
agentResultDoubleUpDownSumObserver;
|
||||
|
||||
public UnshadedResultDoubleUpDownSumObserver(
|
||||
public ApplicationResultDoubleUpDownSumObserver(
|
||||
final io.opentelemetry.metrics.DoubleUpDownSumObserver.DoubleResult
|
||||
shadedResultDoubleUpDownSumObserver) {
|
||||
this.shadedResultDoubleUpDownSumObserver = shadedResultDoubleUpDownSumObserver;
|
||||
agentResultDoubleUpDownSumObserver) {
|
||||
this.agentResultDoubleUpDownSumObserver = agentResultDoubleUpDownSumObserver;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void observe(final double value, final Labels labels) {
|
||||
shadedResultDoubleUpDownSumObserver.observe(value, LabelsShader.shade(labels));
|
||||
agentResultDoubleUpDownSumObserver.observe(value, LabelBridging.toAgent(labels));
|
||||
}
|
||||
}
|
||||
|
||||
static class Builder implements DoubleUpDownSumObserver.Builder {
|
||||
|
||||
private final io.opentelemetry.metrics.DoubleUpDownSumObserver.Builder shadedBuilder;
|
||||
private final io.opentelemetry.metrics.DoubleUpDownSumObserver.Builder agentBuilder;
|
||||
|
||||
protected Builder(
|
||||
final io.opentelemetry.metrics.DoubleUpDownSumObserver.Builder shadedBuilder) {
|
||||
this.shadedBuilder = shadedBuilder;
|
||||
protected Builder(final io.opentelemetry.metrics.DoubleUpDownSumObserver.Builder agentBuilder) {
|
||||
this.agentBuilder = agentBuilder;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DoubleUpDownSumObserver.Builder setDescription(final String description) {
|
||||
shadedBuilder.setDescription(description);
|
||||
agentBuilder.setDescription(description);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DoubleUpDownSumObserver.Builder setUnit(final String unit) {
|
||||
shadedBuilder.setUnit(unit);
|
||||
agentBuilder.setUnit(unit);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DoubleUpDownSumObserver.Builder setConstantLabels(final Labels constantLabels) {
|
||||
shadedBuilder.setConstantLabels(LabelsShader.shade(constantLabels));
|
||||
agentBuilder.setConstantLabels(LabelBridging.toAgent(constantLabels));
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DoubleUpDownSumObserver build() {
|
||||
return new UnshadedDoubleUpDownSumObserver(shadedBuilder.build());
|
||||
return new ApplicationDoubleUpDownSumObserver(agentBuilder.build());
|
||||
}
|
||||
}
|
||||
}
|
|
@ -16,87 +16,87 @@
|
|||
|
||||
package io.opentelemetry.auto.instrumentation.opentelemetryapi.metrics;
|
||||
|
||||
import io.opentelemetry.auto.instrumentation.opentelemetryapi.LabelsShader;
|
||||
import application.io.opentelemetry.common.Labels;
|
||||
import application.io.opentelemetry.metrics.DoubleValueObserver;
|
||||
import io.opentelemetry.auto.instrumentation.opentelemetryapi.LabelBridging;
|
||||
import io.opentelemetry.metrics.AsynchronousInstrument;
|
||||
import unshaded.io.opentelemetry.common.Labels;
|
||||
import unshaded.io.opentelemetry.metrics.DoubleValueObserver;
|
||||
|
||||
class UnshadedDoubleValueObserver implements DoubleValueObserver {
|
||||
class ApplicationDoubleValueObserver implements DoubleValueObserver {
|
||||
|
||||
private final io.opentelemetry.metrics.DoubleValueObserver shadedDoubleValueObserver;
|
||||
private final io.opentelemetry.metrics.DoubleValueObserver agentDoubleValueObserver;
|
||||
|
||||
protected UnshadedDoubleValueObserver(
|
||||
final io.opentelemetry.metrics.DoubleValueObserver shadedDoubleValueObserver) {
|
||||
this.shadedDoubleValueObserver = shadedDoubleValueObserver;
|
||||
protected ApplicationDoubleValueObserver(
|
||||
final io.opentelemetry.metrics.DoubleValueObserver agentDoubleValueObserver) {
|
||||
this.agentDoubleValueObserver = agentDoubleValueObserver;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCallback(final Callback<DoubleResult> metricUpdater) {
|
||||
shadedDoubleValueObserver.setCallback(new ShadedResultDoubleValueObserver(metricUpdater));
|
||||
agentDoubleValueObserver.setCallback(new AgentResultDoubleValueObserver(metricUpdater));
|
||||
}
|
||||
|
||||
static class ShadedResultDoubleValueObserver
|
||||
static class AgentResultDoubleValueObserver
|
||||
implements AsynchronousInstrument.Callback<
|
||||
io.opentelemetry.metrics.DoubleValueObserver.DoubleResult> {
|
||||
|
||||
private final Callback<DoubleResult> metricUpdater;
|
||||
|
||||
protected ShadedResultDoubleValueObserver(final Callback<DoubleResult> metricUpdater) {
|
||||
protected AgentResultDoubleValueObserver(final Callback<DoubleResult> metricUpdater) {
|
||||
this.metricUpdater = metricUpdater;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(final io.opentelemetry.metrics.DoubleValueObserver.DoubleResult result) {
|
||||
metricUpdater.update(new UnshadedResultDoubleValueObserver(result));
|
||||
metricUpdater.update(new ApplicationResultDoubleValueObserver(result));
|
||||
}
|
||||
}
|
||||
|
||||
static class UnshadedResultDoubleValueObserver implements DoubleResult {
|
||||
static class ApplicationResultDoubleValueObserver implements DoubleResult {
|
||||
|
||||
private final io.opentelemetry.metrics.DoubleValueObserver.DoubleResult
|
||||
shadedResultDoubleValueObserver;
|
||||
agentResultDoubleValueObserver;
|
||||
|
||||
public UnshadedResultDoubleValueObserver(
|
||||
public ApplicationResultDoubleValueObserver(
|
||||
final io.opentelemetry.metrics.DoubleValueObserver.DoubleResult
|
||||
shadedResultDoubleValueObserver) {
|
||||
this.shadedResultDoubleValueObserver = shadedResultDoubleValueObserver;
|
||||
agentResultDoubleValueObserver) {
|
||||
this.agentResultDoubleValueObserver = agentResultDoubleValueObserver;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void observe(final double value, final Labels labels) {
|
||||
shadedResultDoubleValueObserver.observe(value, LabelsShader.shade(labels));
|
||||
agentResultDoubleValueObserver.observe(value, LabelBridging.toAgent(labels));
|
||||
}
|
||||
}
|
||||
|
||||
static class Builder implements DoubleValueObserver.Builder {
|
||||
|
||||
private final io.opentelemetry.metrics.DoubleValueObserver.Builder shadedBuilder;
|
||||
private final io.opentelemetry.metrics.DoubleValueObserver.Builder agentBuilder;
|
||||
|
||||
protected Builder(final io.opentelemetry.metrics.DoubleValueObserver.Builder shadedBuilder) {
|
||||
this.shadedBuilder = shadedBuilder;
|
||||
protected Builder(final io.opentelemetry.metrics.DoubleValueObserver.Builder agentBuilder) {
|
||||
this.agentBuilder = agentBuilder;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DoubleValueObserver.Builder setDescription(final String description) {
|
||||
shadedBuilder.setDescription(description);
|
||||
agentBuilder.setDescription(description);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DoubleValueObserver.Builder setUnit(final String unit) {
|
||||
shadedBuilder.setUnit(unit);
|
||||
agentBuilder.setUnit(unit);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DoubleValueObserver.Builder setConstantLabels(final Labels constantLabels) {
|
||||
shadedBuilder.setConstantLabels(LabelsShader.shade(constantLabels));
|
||||
agentBuilder.setConstantLabels(LabelBridging.toAgent(constantLabels));
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DoubleValueObserver build() {
|
||||
return new UnshadedDoubleValueObserver(shadedBuilder.build());
|
||||
return new ApplicationDoubleValueObserver(agentBuilder.build());
|
||||
}
|
||||
}
|
||||
}
|
|
@ -16,84 +16,84 @@
|
|||
|
||||
package io.opentelemetry.auto.instrumentation.opentelemetryapi.metrics;
|
||||
|
||||
import io.opentelemetry.auto.instrumentation.opentelemetryapi.LabelsShader;
|
||||
import unshaded.io.opentelemetry.common.Labels;
|
||||
import unshaded.io.opentelemetry.metrics.DoubleValueRecorder;
|
||||
import application.io.opentelemetry.common.Labels;
|
||||
import application.io.opentelemetry.metrics.DoubleValueRecorder;
|
||||
import io.opentelemetry.auto.instrumentation.opentelemetryapi.LabelBridging;
|
||||
|
||||
class UnshadedDoubleValueRecorder implements DoubleValueRecorder {
|
||||
class ApplicationDoubleValueRecorder implements DoubleValueRecorder {
|
||||
|
||||
private final io.opentelemetry.metrics.DoubleValueRecorder shadedDoubleValueRecorder;
|
||||
private final io.opentelemetry.metrics.DoubleValueRecorder agentDoubleValueRecorder;
|
||||
|
||||
protected UnshadedDoubleValueRecorder(
|
||||
final io.opentelemetry.metrics.DoubleValueRecorder shadedDoubleValueRecorder) {
|
||||
this.shadedDoubleValueRecorder = shadedDoubleValueRecorder;
|
||||
protected ApplicationDoubleValueRecorder(
|
||||
final io.opentelemetry.metrics.DoubleValueRecorder agentDoubleValueRecorder) {
|
||||
this.agentDoubleValueRecorder = agentDoubleValueRecorder;
|
||||
}
|
||||
|
||||
protected io.opentelemetry.metrics.DoubleValueRecorder getShadedDoubleValueRecorder() {
|
||||
return shadedDoubleValueRecorder;
|
||||
protected io.opentelemetry.metrics.DoubleValueRecorder getAgentDoubleValueRecorder() {
|
||||
return agentDoubleValueRecorder;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void record(final double delta, final Labels labels) {
|
||||
shadedDoubleValueRecorder.record(delta, LabelsShader.shade(labels));
|
||||
agentDoubleValueRecorder.record(delta, LabelBridging.toAgent(labels));
|
||||
}
|
||||
|
||||
@Override
|
||||
public BoundDoubleValueRecorder bind(final Labels labels) {
|
||||
return new BoundInstrument(shadedDoubleValueRecorder.bind(LabelsShader.shade(labels)));
|
||||
return new BoundInstrument(agentDoubleValueRecorder.bind(LabelBridging.toAgent(labels)));
|
||||
}
|
||||
|
||||
static class BoundInstrument implements DoubleValueRecorder.BoundDoubleValueRecorder {
|
||||
|
||||
private final io.opentelemetry.metrics.DoubleValueRecorder.BoundDoubleValueRecorder
|
||||
shadedBoundDoubleMeasure;
|
||||
agentBoundDoubleMeasure;
|
||||
|
||||
public BoundInstrument(
|
||||
final io.opentelemetry.metrics.DoubleValueRecorder.BoundDoubleValueRecorder
|
||||
shadedBoundDoubleMeasure) {
|
||||
this.shadedBoundDoubleMeasure = shadedBoundDoubleMeasure;
|
||||
agentBoundDoubleMeasure) {
|
||||
this.agentBoundDoubleMeasure = agentBoundDoubleMeasure;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void record(final double delta) {
|
||||
shadedBoundDoubleMeasure.record(delta);
|
||||
agentBoundDoubleMeasure.record(delta);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unbind() {
|
||||
shadedBoundDoubleMeasure.unbind();
|
||||
agentBoundDoubleMeasure.unbind();
|
||||
}
|
||||
}
|
||||
|
||||
static class Builder implements DoubleValueRecorder.Builder {
|
||||
|
||||
private final io.opentelemetry.metrics.DoubleValueRecorder.Builder shadedBuilder;
|
||||
private final io.opentelemetry.metrics.DoubleValueRecorder.Builder agentBuilder;
|
||||
|
||||
public Builder(final io.opentelemetry.metrics.DoubleValueRecorder.Builder shadedBuilder) {
|
||||
this.shadedBuilder = shadedBuilder;
|
||||
public Builder(final io.opentelemetry.metrics.DoubleValueRecorder.Builder agentBuilder) {
|
||||
this.agentBuilder = agentBuilder;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DoubleValueRecorder.Builder setDescription(final String description) {
|
||||
shadedBuilder.setDescription(description);
|
||||
agentBuilder.setDescription(description);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DoubleValueRecorder.Builder setUnit(final String unit) {
|
||||
shadedBuilder.setUnit(unit);
|
||||
agentBuilder.setUnit(unit);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DoubleValueRecorder.Builder setConstantLabels(final Labels constantLabels) {
|
||||
shadedBuilder.setConstantLabels(LabelsShader.shade(constantLabels));
|
||||
agentBuilder.setConstantLabels(LabelBridging.toAgent(constantLabels));
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DoubleValueRecorder build() {
|
||||
return new UnshadedDoubleValueRecorder(shadedBuilder.build());
|
||||
return new ApplicationDoubleValueRecorder(agentBuilder.build());
|
||||
}
|
||||
}
|
||||
}
|
|
@ -16,81 +16,81 @@
|
|||
|
||||
package io.opentelemetry.auto.instrumentation.opentelemetryapi.metrics;
|
||||
|
||||
import io.opentelemetry.auto.instrumentation.opentelemetryapi.LabelsShader;
|
||||
import unshaded.io.opentelemetry.common.Labels;
|
||||
import unshaded.io.opentelemetry.metrics.LongCounter;
|
||||
import application.io.opentelemetry.common.Labels;
|
||||
import application.io.opentelemetry.metrics.LongCounter;
|
||||
import io.opentelemetry.auto.instrumentation.opentelemetryapi.LabelBridging;
|
||||
|
||||
class UnshadedLongCounter implements LongCounter {
|
||||
class ApplicationLongCounter implements LongCounter {
|
||||
|
||||
private final io.opentelemetry.metrics.LongCounter shadedLongCounter;
|
||||
private final io.opentelemetry.metrics.LongCounter agentLongCounter;
|
||||
|
||||
UnshadedLongCounter(final io.opentelemetry.metrics.LongCounter shadedLongCounter) {
|
||||
this.shadedLongCounter = shadedLongCounter;
|
||||
ApplicationLongCounter(final io.opentelemetry.metrics.LongCounter agentLongCounter) {
|
||||
this.agentLongCounter = agentLongCounter;
|
||||
}
|
||||
|
||||
io.opentelemetry.metrics.LongCounter getShadedLongCounter() {
|
||||
return shadedLongCounter;
|
||||
io.opentelemetry.metrics.LongCounter getAgentLongCounter() {
|
||||
return agentLongCounter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(final long delta, final Labels labels) {
|
||||
shadedLongCounter.add(delta, LabelsShader.shade(labels));
|
||||
agentLongCounter.add(delta, LabelBridging.toAgent(labels));
|
||||
}
|
||||
|
||||
@Override
|
||||
public BoundLongCounter bind(final Labels labels) {
|
||||
return new BoundInstrument(shadedLongCounter.bind(LabelsShader.shade(labels)));
|
||||
return new BoundInstrument(agentLongCounter.bind(LabelBridging.toAgent(labels)));
|
||||
}
|
||||
|
||||
static class BoundInstrument implements LongCounter.BoundLongCounter {
|
||||
|
||||
private final io.opentelemetry.metrics.LongCounter.BoundLongCounter shadedBoundLongCounter;
|
||||
private final io.opentelemetry.metrics.LongCounter.BoundLongCounter agentBoundLongCounter;
|
||||
|
||||
BoundInstrument(
|
||||
final io.opentelemetry.metrics.LongCounter.BoundLongCounter shadedBoundLongCounter) {
|
||||
this.shadedBoundLongCounter = shadedBoundLongCounter;
|
||||
final io.opentelemetry.metrics.LongCounter.BoundLongCounter agentBoundLongCounter) {
|
||||
this.agentBoundLongCounter = agentBoundLongCounter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(final long delta) {
|
||||
shadedBoundLongCounter.add(delta);
|
||||
agentBoundLongCounter.add(delta);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unbind() {
|
||||
shadedBoundLongCounter.unbind();
|
||||
agentBoundLongCounter.unbind();
|
||||
}
|
||||
}
|
||||
|
||||
static class Builder implements LongCounter.Builder {
|
||||
|
||||
private final io.opentelemetry.metrics.LongCounter.Builder shadedBuilder;
|
||||
private final io.opentelemetry.metrics.LongCounter.Builder agentBuilder;
|
||||
|
||||
Builder(final io.opentelemetry.metrics.LongCounter.Builder shadedBuilder) {
|
||||
this.shadedBuilder = shadedBuilder;
|
||||
Builder(final io.opentelemetry.metrics.LongCounter.Builder agentBuilder) {
|
||||
this.agentBuilder = agentBuilder;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LongCounter.Builder setDescription(final String description) {
|
||||
shadedBuilder.setDescription(description);
|
||||
agentBuilder.setDescription(description);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LongCounter.Builder setUnit(final String unit) {
|
||||
shadedBuilder.setUnit(unit);
|
||||
agentBuilder.setUnit(unit);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LongCounter.Builder setConstantLabels(final Labels constantLabels) {
|
||||
shadedBuilder.setConstantLabels(LabelsShader.shade(constantLabels));
|
||||
agentBuilder.setConstantLabels(LabelBridging.toAgent(constantLabels));
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LongCounter build() {
|
||||
return new UnshadedLongCounter(shadedBuilder.build());
|
||||
return new ApplicationLongCounter(agentBuilder.build());
|
||||
}
|
||||
}
|
||||
}
|
|
@ -16,85 +16,85 @@
|
|||
|
||||
package io.opentelemetry.auto.instrumentation.opentelemetryapi.metrics;
|
||||
|
||||
import io.opentelemetry.auto.instrumentation.opentelemetryapi.LabelsShader;
|
||||
import application.io.opentelemetry.common.Labels;
|
||||
import application.io.opentelemetry.metrics.LongSumObserver;
|
||||
import io.opentelemetry.auto.instrumentation.opentelemetryapi.LabelBridging;
|
||||
import io.opentelemetry.metrics.AsynchronousInstrument;
|
||||
import unshaded.io.opentelemetry.common.Labels;
|
||||
import unshaded.io.opentelemetry.metrics.LongSumObserver;
|
||||
|
||||
class UnshadedLongSumObserver implements LongSumObserver {
|
||||
class ApplicationLongSumObserver implements LongSumObserver {
|
||||
|
||||
private final io.opentelemetry.metrics.LongSumObserver shadedLongSumObserver;
|
||||
private final io.opentelemetry.metrics.LongSumObserver agentLongSumObserver;
|
||||
|
||||
protected UnshadedLongSumObserver(
|
||||
final io.opentelemetry.metrics.LongSumObserver shadedLongSumObserver) {
|
||||
this.shadedLongSumObserver = shadedLongSumObserver;
|
||||
protected ApplicationLongSumObserver(
|
||||
final io.opentelemetry.metrics.LongSumObserver agentLongSumObserver) {
|
||||
this.agentLongSumObserver = agentLongSumObserver;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCallback(final Callback<LongResult> metricUpdater) {
|
||||
shadedLongSumObserver.setCallback(new ShadedResultLongSumObserver(metricUpdater));
|
||||
agentLongSumObserver.setCallback(new AgentResultLongSumObserver(metricUpdater));
|
||||
}
|
||||
|
||||
static class ShadedResultLongSumObserver
|
||||
static class AgentResultLongSumObserver
|
||||
implements AsynchronousInstrument.Callback<
|
||||
io.opentelemetry.metrics.LongSumObserver.LongResult> {
|
||||
|
||||
private final Callback<LongResult> metricUpdater;
|
||||
|
||||
protected ShadedResultLongSumObserver(final Callback<LongResult> metricUpdater) {
|
||||
protected AgentResultLongSumObserver(final Callback<LongResult> metricUpdater) {
|
||||
this.metricUpdater = metricUpdater;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(final io.opentelemetry.metrics.LongSumObserver.LongResult result) {
|
||||
metricUpdater.update(new UnshadedResultLongSumObserver(result));
|
||||
metricUpdater.update(new ApplicationResultLongSumObserver(result));
|
||||
}
|
||||
}
|
||||
|
||||
static class UnshadedResultLongSumObserver implements LongResult {
|
||||
static class ApplicationResultLongSumObserver implements LongResult {
|
||||
|
||||
private final io.opentelemetry.metrics.LongSumObserver.LongResult shadedResultLongSumObserver;
|
||||
private final io.opentelemetry.metrics.LongSumObserver.LongResult agentResultLongSumObserver;
|
||||
|
||||
public UnshadedResultLongSumObserver(
|
||||
final io.opentelemetry.metrics.LongSumObserver.LongResult shadedResultLongSumObserver) {
|
||||
this.shadedResultLongSumObserver = shadedResultLongSumObserver;
|
||||
public ApplicationResultLongSumObserver(
|
||||
final io.opentelemetry.metrics.LongSumObserver.LongResult agentResultLongSumObserver) {
|
||||
this.agentResultLongSumObserver = agentResultLongSumObserver;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void observe(final long value, final Labels labels) {
|
||||
shadedResultLongSumObserver.observe(value, LabelsShader.shade(labels));
|
||||
agentResultLongSumObserver.observe(value, LabelBridging.toAgent(labels));
|
||||
}
|
||||
}
|
||||
|
||||
static class Builder implements LongSumObserver.Builder {
|
||||
|
||||
private final io.opentelemetry.metrics.LongSumObserver.Builder shadedBuilder;
|
||||
private final io.opentelemetry.metrics.LongSumObserver.Builder agentBuilder;
|
||||
|
||||
protected Builder(final io.opentelemetry.metrics.LongSumObserver.Builder shadedBuilder) {
|
||||
this.shadedBuilder = shadedBuilder;
|
||||
protected Builder(final io.opentelemetry.metrics.LongSumObserver.Builder agentBuilder) {
|
||||
this.agentBuilder = agentBuilder;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LongSumObserver.Builder setDescription(final String description) {
|
||||
shadedBuilder.setDescription(description);
|
||||
agentBuilder.setDescription(description);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LongSumObserver.Builder setUnit(final String unit) {
|
||||
shadedBuilder.setUnit(unit);
|
||||
agentBuilder.setUnit(unit);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LongSumObserver.Builder setConstantLabels(final Labels constantLabels) {
|
||||
shadedBuilder.setConstantLabels(LabelsShader.shade(constantLabels));
|
||||
agentBuilder.setConstantLabels(LabelBridging.toAgent(constantLabels));
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LongSumObserver build() {
|
||||
return new UnshadedLongSumObserver(shadedBuilder.build());
|
||||
return new ApplicationLongSumObserver(agentBuilder.build());
|
||||
}
|
||||
}
|
||||
}
|
|
@ -16,84 +16,84 @@
|
|||
|
||||
package io.opentelemetry.auto.instrumentation.opentelemetryapi.metrics;
|
||||
|
||||
import io.opentelemetry.auto.instrumentation.opentelemetryapi.LabelsShader;
|
||||
import unshaded.io.opentelemetry.common.Labels;
|
||||
import unshaded.io.opentelemetry.metrics.LongUpDownCounter;
|
||||
import application.io.opentelemetry.common.Labels;
|
||||
import application.io.opentelemetry.metrics.LongUpDownCounter;
|
||||
import io.opentelemetry.auto.instrumentation.opentelemetryapi.LabelBridging;
|
||||
|
||||
class UnshadedLongUpDownCounter implements LongUpDownCounter {
|
||||
class ApplicationLongUpDownCounter implements LongUpDownCounter {
|
||||
|
||||
private final io.opentelemetry.metrics.LongUpDownCounter shadedLongUpDownCounter;
|
||||
private final io.opentelemetry.metrics.LongUpDownCounter agentLongUpDownCounter;
|
||||
|
||||
UnshadedLongUpDownCounter(
|
||||
final io.opentelemetry.metrics.LongUpDownCounter shadedLongUpDownCounter) {
|
||||
this.shadedLongUpDownCounter = shadedLongUpDownCounter;
|
||||
ApplicationLongUpDownCounter(
|
||||
final io.opentelemetry.metrics.LongUpDownCounter agentLongUpDownCounter) {
|
||||
this.agentLongUpDownCounter = agentLongUpDownCounter;
|
||||
}
|
||||
|
||||
io.opentelemetry.metrics.LongUpDownCounter getShadedLongUpDownCounter() {
|
||||
return shadedLongUpDownCounter;
|
||||
io.opentelemetry.metrics.LongUpDownCounter getAgentLongUpDownCounter() {
|
||||
return agentLongUpDownCounter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(final long delta, final Labels labels) {
|
||||
shadedLongUpDownCounter.add(delta, LabelsShader.shade(labels));
|
||||
agentLongUpDownCounter.add(delta, LabelBridging.toAgent(labels));
|
||||
}
|
||||
|
||||
@Override
|
||||
public BoundLongUpDownCounter bind(final Labels labels) {
|
||||
return new BoundInstrument(shadedLongUpDownCounter.bind(LabelsShader.shade(labels)));
|
||||
return new BoundInstrument(agentLongUpDownCounter.bind(LabelBridging.toAgent(labels)));
|
||||
}
|
||||
|
||||
static class BoundInstrument implements BoundLongUpDownCounter {
|
||||
|
||||
private final io.opentelemetry.metrics.LongUpDownCounter.BoundLongUpDownCounter
|
||||
shadedBoundLongUpDownCounter;
|
||||
agentBoundLongUpDownCounter;
|
||||
|
||||
BoundInstrument(
|
||||
final io.opentelemetry.metrics.LongUpDownCounter.BoundLongUpDownCounter
|
||||
shadedBoundLongUpDownCounter) {
|
||||
this.shadedBoundLongUpDownCounter = shadedBoundLongUpDownCounter;
|
||||
agentBoundLongUpDownCounter) {
|
||||
this.agentBoundLongUpDownCounter = agentBoundLongUpDownCounter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(final long delta) {
|
||||
shadedBoundLongUpDownCounter.add(delta);
|
||||
agentBoundLongUpDownCounter.add(delta);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unbind() {
|
||||
shadedBoundLongUpDownCounter.unbind();
|
||||
agentBoundLongUpDownCounter.unbind();
|
||||
}
|
||||
}
|
||||
|
||||
static class Builder implements LongUpDownCounter.Builder {
|
||||
|
||||
private final io.opentelemetry.metrics.LongUpDownCounter.Builder shadedBuilder;
|
||||
private final io.opentelemetry.metrics.LongUpDownCounter.Builder agentBuilder;
|
||||
|
||||
Builder(final io.opentelemetry.metrics.LongUpDownCounter.Builder shadedBuilder) {
|
||||
this.shadedBuilder = shadedBuilder;
|
||||
Builder(final io.opentelemetry.metrics.LongUpDownCounter.Builder agentBuilder) {
|
||||
this.agentBuilder = agentBuilder;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LongUpDownCounter.Builder setDescription(final String description) {
|
||||
shadedBuilder.setDescription(description);
|
||||
agentBuilder.setDescription(description);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LongUpDownCounter.Builder setUnit(final String unit) {
|
||||
shadedBuilder.setUnit(unit);
|
||||
agentBuilder.setUnit(unit);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LongUpDownCounter.Builder setConstantLabels(final Labels constantLabels) {
|
||||
shadedBuilder.setConstantLabels(LabelsShader.shade(constantLabels));
|
||||
agentBuilder.setConstantLabels(LabelBridging.toAgent(constantLabels));
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LongUpDownCounter build() {
|
||||
return new UnshadedLongUpDownCounter(shadedBuilder.build());
|
||||
return new ApplicationLongUpDownCounter(agentBuilder.build());
|
||||
}
|
||||
}
|
||||
}
|
|
@ -16,87 +16,87 @@
|
|||
|
||||
package io.opentelemetry.auto.instrumentation.opentelemetryapi.metrics;
|
||||
|
||||
import io.opentelemetry.auto.instrumentation.opentelemetryapi.LabelsShader;
|
||||
import application.io.opentelemetry.common.Labels;
|
||||
import application.io.opentelemetry.metrics.LongUpDownSumObserver;
|
||||
import io.opentelemetry.auto.instrumentation.opentelemetryapi.LabelBridging;
|
||||
import io.opentelemetry.metrics.AsynchronousInstrument;
|
||||
import unshaded.io.opentelemetry.common.Labels;
|
||||
import unshaded.io.opentelemetry.metrics.LongUpDownSumObserver;
|
||||
|
||||
class UnshadedLongUpDownSumObserver implements LongUpDownSumObserver {
|
||||
class ApplicationLongUpDownSumObserver implements LongUpDownSumObserver {
|
||||
|
||||
private final io.opentelemetry.metrics.LongUpDownSumObserver shadedLongUpDownSumObserver;
|
||||
private final io.opentelemetry.metrics.LongUpDownSumObserver agentLongUpDownSumObserver;
|
||||
|
||||
protected UnshadedLongUpDownSumObserver(
|
||||
final io.opentelemetry.metrics.LongUpDownSumObserver shadedLongUpDownSumObserver) {
|
||||
this.shadedLongUpDownSumObserver = shadedLongUpDownSumObserver;
|
||||
protected ApplicationLongUpDownSumObserver(
|
||||
final io.opentelemetry.metrics.LongUpDownSumObserver agentLongUpDownSumObserver) {
|
||||
this.agentLongUpDownSumObserver = agentLongUpDownSumObserver;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCallback(final Callback<LongResult> metricUpdater) {
|
||||
shadedLongUpDownSumObserver.setCallback(new ShadedResultLongUpDownSumObserver(metricUpdater));
|
||||
agentLongUpDownSumObserver.setCallback(new AgentResultLongUpDownSumObserver(metricUpdater));
|
||||
}
|
||||
|
||||
static class ShadedResultLongUpDownSumObserver
|
||||
static class AgentResultLongUpDownSumObserver
|
||||
implements AsynchronousInstrument.Callback<
|
||||
io.opentelemetry.metrics.LongUpDownSumObserver.LongResult> {
|
||||
|
||||
private final Callback<LongResult> metricUpdater;
|
||||
|
||||
protected ShadedResultLongUpDownSumObserver(final Callback<LongResult> metricUpdater) {
|
||||
protected AgentResultLongUpDownSumObserver(final Callback<LongResult> metricUpdater) {
|
||||
this.metricUpdater = metricUpdater;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(final io.opentelemetry.metrics.LongUpDownSumObserver.LongResult result) {
|
||||
metricUpdater.update(new UnshadedResultLongUpDownSumObserver(result));
|
||||
metricUpdater.update(new ApplicationResultLongUpDownSumObserver(result));
|
||||
}
|
||||
}
|
||||
|
||||
static class UnshadedResultLongUpDownSumObserver implements LongResult {
|
||||
static class ApplicationResultLongUpDownSumObserver implements LongResult {
|
||||
|
||||
private final io.opentelemetry.metrics.LongUpDownSumObserver.LongResult
|
||||
shadedResultLongUpDownSumObserver;
|
||||
agentResultLongUpDownSumObserver;
|
||||
|
||||
public UnshadedResultLongUpDownSumObserver(
|
||||
public ApplicationResultLongUpDownSumObserver(
|
||||
final io.opentelemetry.metrics.LongUpDownSumObserver.LongResult
|
||||
shadedResultLongUpDownSumObserver) {
|
||||
this.shadedResultLongUpDownSumObserver = shadedResultLongUpDownSumObserver;
|
||||
agentResultLongUpDownSumObserver) {
|
||||
this.agentResultLongUpDownSumObserver = agentResultLongUpDownSumObserver;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void observe(final long value, final Labels labels) {
|
||||
shadedResultLongUpDownSumObserver.observe(value, LabelsShader.shade(labels));
|
||||
agentResultLongUpDownSumObserver.observe(value, LabelBridging.toAgent(labels));
|
||||
}
|
||||
}
|
||||
|
||||
static class Builder implements LongUpDownSumObserver.Builder {
|
||||
|
||||
private final io.opentelemetry.metrics.LongUpDownSumObserver.Builder shadedBuilder;
|
||||
private final io.opentelemetry.metrics.LongUpDownSumObserver.Builder agentBuilder;
|
||||
|
||||
protected Builder(final io.opentelemetry.metrics.LongUpDownSumObserver.Builder shadedBuilder) {
|
||||
this.shadedBuilder = shadedBuilder;
|
||||
protected Builder(final io.opentelemetry.metrics.LongUpDownSumObserver.Builder agentBuilder) {
|
||||
this.agentBuilder = agentBuilder;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LongUpDownSumObserver.Builder setDescription(final String description) {
|
||||
shadedBuilder.setDescription(description);
|
||||
agentBuilder.setDescription(description);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LongUpDownSumObserver.Builder setUnit(final String unit) {
|
||||
shadedBuilder.setUnit(unit);
|
||||
agentBuilder.setUnit(unit);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LongUpDownSumObserver.Builder setConstantLabels(final Labels constantLabels) {
|
||||
shadedBuilder.setConstantLabels(LabelsShader.shade(constantLabels));
|
||||
agentBuilder.setConstantLabels(LabelBridging.toAgent(constantLabels));
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LongUpDownSumObserver build() {
|
||||
return new UnshadedLongUpDownSumObserver(shadedBuilder.build());
|
||||
return new ApplicationLongUpDownSumObserver(agentBuilder.build());
|
||||
}
|
||||
}
|
||||
}
|
|
@ -16,85 +16,85 @@
|
|||
|
||||
package io.opentelemetry.auto.instrumentation.opentelemetryapi.metrics;
|
||||
|
||||
import io.opentelemetry.auto.instrumentation.opentelemetryapi.LabelsShader;
|
||||
import unshaded.io.opentelemetry.common.Labels;
|
||||
import unshaded.io.opentelemetry.metrics.LongValueObserver;
|
||||
import application.io.opentelemetry.common.Labels;
|
||||
import application.io.opentelemetry.metrics.LongValueObserver;
|
||||
import io.opentelemetry.auto.instrumentation.opentelemetryapi.LabelBridging;
|
||||
|
||||
class UnshadedLongValueObserver implements LongValueObserver {
|
||||
class ApplicationLongValueObserver implements LongValueObserver {
|
||||
|
||||
private final io.opentelemetry.metrics.LongValueObserver shadedLongValueObserver;
|
||||
private final io.opentelemetry.metrics.LongValueObserver agentLongValueObserver;
|
||||
|
||||
public UnshadedLongValueObserver(
|
||||
final io.opentelemetry.metrics.LongValueObserver shadedLongValueObserver) {
|
||||
this.shadedLongValueObserver = shadedLongValueObserver;
|
||||
public ApplicationLongValueObserver(
|
||||
final io.opentelemetry.metrics.LongValueObserver agentLongValueObserver) {
|
||||
this.agentLongValueObserver = agentLongValueObserver;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCallback(final Callback<LongResult> metricUpdater) {
|
||||
shadedLongValueObserver.setCallback(new ShadedResultLongValueObserver(metricUpdater));
|
||||
agentLongValueObserver.setCallback(new AgentResultLongValueObserver(metricUpdater));
|
||||
}
|
||||
|
||||
public static class ShadedResultLongValueObserver
|
||||
public static class AgentResultLongValueObserver
|
||||
implements io.opentelemetry.metrics.AsynchronousInstrument.Callback<
|
||||
io.opentelemetry.metrics.LongValueObserver.LongResult> {
|
||||
|
||||
private final Callback<LongResult> metricUpdater;
|
||||
|
||||
public ShadedResultLongValueObserver(final Callback<LongResult> metricUpdater) {
|
||||
public AgentResultLongValueObserver(final Callback<LongResult> metricUpdater) {
|
||||
this.metricUpdater = metricUpdater;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(final io.opentelemetry.metrics.LongValueObserver.LongResult result) {
|
||||
metricUpdater.update(new UnshadedResultLongValueObserver(result));
|
||||
metricUpdater.update(new ApplicationResultLongValueObserver(result));
|
||||
}
|
||||
}
|
||||
|
||||
public static class UnshadedResultLongValueObserver implements LongResult {
|
||||
public static class ApplicationResultLongValueObserver implements LongResult {
|
||||
|
||||
private final io.opentelemetry.metrics.LongValueObserver.LongResult
|
||||
shadedResultLongValueObserver;
|
||||
agentResultLongValueObserver;
|
||||
|
||||
public UnshadedResultLongValueObserver(
|
||||
final io.opentelemetry.metrics.LongValueObserver.LongResult shadedResultLongValueObserver) {
|
||||
this.shadedResultLongValueObserver = shadedResultLongValueObserver;
|
||||
public ApplicationResultLongValueObserver(
|
||||
final io.opentelemetry.metrics.LongValueObserver.LongResult agentResultLongValueObserver) {
|
||||
this.agentResultLongValueObserver = agentResultLongValueObserver;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void observe(final long value, final Labels labels) {
|
||||
shadedResultLongValueObserver.observe(value, LabelsShader.shade(labels));
|
||||
agentResultLongValueObserver.observe(value, LabelBridging.toAgent(labels));
|
||||
}
|
||||
}
|
||||
|
||||
static class Builder implements LongValueObserver.Builder {
|
||||
|
||||
private final io.opentelemetry.metrics.LongValueObserver.Builder shadedBuilder;
|
||||
private final io.opentelemetry.metrics.LongValueObserver.Builder agentBuilder;
|
||||
|
||||
public Builder(final io.opentelemetry.metrics.LongValueObserver.Builder shadedBuilder) {
|
||||
this.shadedBuilder = shadedBuilder;
|
||||
public Builder(final io.opentelemetry.metrics.LongValueObserver.Builder agentBuilder) {
|
||||
this.agentBuilder = agentBuilder;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LongValueObserver.Builder setDescription(final String description) {
|
||||
shadedBuilder.setDescription(description);
|
||||
agentBuilder.setDescription(description);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LongValueObserver.Builder setUnit(final String unit) {
|
||||
shadedBuilder.setUnit(unit);
|
||||
agentBuilder.setUnit(unit);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LongValueObserver.Builder setConstantLabels(final Labels constantLabels) {
|
||||
shadedBuilder.setConstantLabels(LabelsShader.shade(constantLabels));
|
||||
agentBuilder.setConstantLabels(LabelBridging.toAgent(constantLabels));
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LongValueObserver build() {
|
||||
return new UnshadedLongValueObserver(shadedBuilder.build());
|
||||
return new ApplicationLongValueObserver(agentBuilder.build());
|
||||
}
|
||||
}
|
||||
}
|
|
@ -16,84 +16,84 @@
|
|||
|
||||
package io.opentelemetry.auto.instrumentation.opentelemetryapi.metrics;
|
||||
|
||||
import io.opentelemetry.auto.instrumentation.opentelemetryapi.LabelsShader;
|
||||
import unshaded.io.opentelemetry.common.Labels;
|
||||
import unshaded.io.opentelemetry.metrics.LongValueRecorder;
|
||||
import application.io.opentelemetry.common.Labels;
|
||||
import application.io.opentelemetry.metrics.LongValueRecorder;
|
||||
import io.opentelemetry.auto.instrumentation.opentelemetryapi.LabelBridging;
|
||||
|
||||
class UnshadedLongValueRecorder implements LongValueRecorder {
|
||||
class ApplicationLongValueRecorder implements LongValueRecorder {
|
||||
|
||||
private final io.opentelemetry.metrics.LongValueRecorder shadedLongValueRecorder;
|
||||
private final io.opentelemetry.metrics.LongValueRecorder agentLongValueRecorder;
|
||||
|
||||
protected UnshadedLongValueRecorder(
|
||||
final io.opentelemetry.metrics.LongValueRecorder shadedLongValueRecorder) {
|
||||
this.shadedLongValueRecorder = shadedLongValueRecorder;
|
||||
protected ApplicationLongValueRecorder(
|
||||
final io.opentelemetry.metrics.LongValueRecorder agentLongValueRecorder) {
|
||||
this.agentLongValueRecorder = agentLongValueRecorder;
|
||||
}
|
||||
|
||||
public io.opentelemetry.metrics.LongValueRecorder getShadedLongValueRecorder() {
|
||||
return shadedLongValueRecorder;
|
||||
public io.opentelemetry.metrics.LongValueRecorder getAgentLongValueRecorder() {
|
||||
return agentLongValueRecorder;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void record(final long delta, final Labels labels) {
|
||||
shadedLongValueRecorder.record(delta, LabelsShader.shade(labels));
|
||||
agentLongValueRecorder.record(delta, LabelBridging.toAgent(labels));
|
||||
}
|
||||
|
||||
@Override
|
||||
public BoundLongValueRecorder bind(final Labels labels) {
|
||||
return new BoundInstrument(shadedLongValueRecorder.bind(LabelsShader.shade(labels)));
|
||||
return new BoundInstrument(agentLongValueRecorder.bind(LabelBridging.toAgent(labels)));
|
||||
}
|
||||
|
||||
static class BoundInstrument implements LongValueRecorder.BoundLongValueRecorder {
|
||||
|
||||
private final io.opentelemetry.metrics.LongValueRecorder.BoundLongValueRecorder
|
||||
shadedBoundLongValueRecorder;
|
||||
agentBoundLongValueRecorder;
|
||||
|
||||
protected BoundInstrument(
|
||||
final io.opentelemetry.metrics.LongValueRecorder.BoundLongValueRecorder
|
||||
shadedBoundLongValueRecorder) {
|
||||
this.shadedBoundLongValueRecorder = shadedBoundLongValueRecorder;
|
||||
agentBoundLongValueRecorder) {
|
||||
this.agentBoundLongValueRecorder = agentBoundLongValueRecorder;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void record(final long delta) {
|
||||
shadedBoundLongValueRecorder.record(delta);
|
||||
agentBoundLongValueRecorder.record(delta);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unbind() {
|
||||
shadedBoundLongValueRecorder.unbind();
|
||||
agentBoundLongValueRecorder.unbind();
|
||||
}
|
||||
}
|
||||
|
||||
static class Builder implements LongValueRecorder.Builder {
|
||||
|
||||
private final io.opentelemetry.metrics.LongValueRecorder.Builder shadedBuilder;
|
||||
private final io.opentelemetry.metrics.LongValueRecorder.Builder agentBuilder;
|
||||
|
||||
protected Builder(final io.opentelemetry.metrics.LongValueRecorder.Builder shadedBuilder) {
|
||||
this.shadedBuilder = shadedBuilder;
|
||||
protected Builder(final io.opentelemetry.metrics.LongValueRecorder.Builder agentBuilder) {
|
||||
this.agentBuilder = agentBuilder;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LongValueRecorder.Builder setDescription(final String description) {
|
||||
shadedBuilder.setDescription(description);
|
||||
agentBuilder.setDescription(description);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LongValueRecorder.Builder setUnit(final String unit) {
|
||||
shadedBuilder.setUnit(unit);
|
||||
agentBuilder.setUnit(unit);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LongValueRecorder.Builder setConstantLabels(final Labels constantLabels) {
|
||||
shadedBuilder.setConstantLabels(LabelsShader.shade(constantLabels));
|
||||
agentBuilder.setConstantLabels(LabelBridging.toAgent(constantLabels));
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LongValueRecorder build() {
|
||||
return new UnshadedLongValueRecorder(shadedBuilder.build());
|
||||
return new ApplicationLongValueRecorder(agentBuilder.build());
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,108 @@
|
|||
/*
|
||||
* Copyright The OpenTelemetry 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.
|
||||
*/
|
||||
|
||||
package io.opentelemetry.auto.instrumentation.opentelemetryapi.metrics;
|
||||
|
||||
import application.io.opentelemetry.metrics.BatchRecorder;
|
||||
import application.io.opentelemetry.metrics.DoubleCounter;
|
||||
import application.io.opentelemetry.metrics.DoubleSumObserver;
|
||||
import application.io.opentelemetry.metrics.DoubleUpDownCounter;
|
||||
import application.io.opentelemetry.metrics.DoubleUpDownSumObserver;
|
||||
import application.io.opentelemetry.metrics.DoubleValueObserver;
|
||||
import application.io.opentelemetry.metrics.DoubleValueRecorder;
|
||||
import application.io.opentelemetry.metrics.LongCounter;
|
||||
import application.io.opentelemetry.metrics.LongSumObserver;
|
||||
import application.io.opentelemetry.metrics.LongUpDownCounter;
|
||||
import application.io.opentelemetry.metrics.LongUpDownSumObserver;
|
||||
import application.io.opentelemetry.metrics.LongValueObserver;
|
||||
import application.io.opentelemetry.metrics.LongValueRecorder;
|
||||
import application.io.opentelemetry.metrics.Meter;
|
||||
|
||||
class ApplicationMeter implements Meter {
|
||||
|
||||
private final io.opentelemetry.metrics.Meter agentMeter;
|
||||
|
||||
ApplicationMeter(final io.opentelemetry.metrics.Meter agentMeter) {
|
||||
this.agentMeter = agentMeter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DoubleCounter.Builder doubleCounterBuilder(final String name) {
|
||||
return new ApplicationDoubleCounter.Builder(agentMeter.doubleCounterBuilder(name));
|
||||
}
|
||||
|
||||
@Override
|
||||
public LongCounter.Builder longCounterBuilder(final String name) {
|
||||
return new ApplicationLongCounter.Builder(agentMeter.longCounterBuilder(name));
|
||||
}
|
||||
|
||||
@Override
|
||||
public DoubleUpDownCounter.Builder doubleUpDownCounterBuilder(final String name) {
|
||||
return new ApplicationDoubleUpDownCounter.Builder(agentMeter.doubleUpDownCounterBuilder(name));
|
||||
}
|
||||
|
||||
@Override
|
||||
public LongUpDownCounter.Builder longUpDownCounterBuilder(final String name) {
|
||||
return new ApplicationLongUpDownCounter.Builder(agentMeter.longUpDownCounterBuilder(name));
|
||||
}
|
||||
|
||||
@Override
|
||||
public DoubleValueRecorder.Builder doubleValueRecorderBuilder(final String name) {
|
||||
return new ApplicationDoubleValueRecorder.Builder(agentMeter.doubleValueRecorderBuilder(name));
|
||||
}
|
||||
|
||||
@Override
|
||||
public LongValueRecorder.Builder longValueRecorderBuilder(final String name) {
|
||||
return new ApplicationLongValueRecorder.Builder(agentMeter.longValueRecorderBuilder(name));
|
||||
}
|
||||
|
||||
@Override
|
||||
public DoubleSumObserver.Builder doubleSumObserverBuilder(final String name) {
|
||||
return new ApplicationDoubleSumObserver.Builder(agentMeter.doubleSumObserverBuilder(name));
|
||||
}
|
||||
|
||||
@Override
|
||||
public LongSumObserver.Builder longSumObserverBuilder(final String name) {
|
||||
return new ApplicationLongSumObserver.Builder(agentMeter.longSumObserverBuilder(name));
|
||||
}
|
||||
|
||||
@Override
|
||||
public DoubleUpDownSumObserver.Builder doubleUpDownSumObserverBuilder(final String name) {
|
||||
return new ApplicationDoubleUpDownSumObserver.Builder(
|
||||
agentMeter.doubleUpDownSumObserverBuilder(name));
|
||||
}
|
||||
|
||||
@Override
|
||||
public LongUpDownSumObserver.Builder longUpDownSumObserverBuilder(final String name) {
|
||||
return new ApplicationLongUpDownSumObserver.Builder(
|
||||
agentMeter.longUpDownSumObserverBuilder(name));
|
||||
}
|
||||
|
||||
@Override
|
||||
public DoubleValueObserver.Builder doubleValueObserverBuilder(final String name) {
|
||||
return new ApplicationDoubleValueObserver.Builder(agentMeter.doubleValueObserverBuilder(name));
|
||||
}
|
||||
|
||||
@Override
|
||||
public LongValueObserver.Builder longValueObserverBuilder(final String name) {
|
||||
return new ApplicationLongValueObserver.Builder(agentMeter.longValueObserverBuilder(name));
|
||||
}
|
||||
|
||||
@Override
|
||||
public BatchRecorder newBatchRecorder(final String... keyValuePairs) {
|
||||
return new ApplicationBatchRecorder(agentMeter.newBatchRecorder(keyValuePairs));
|
||||
}
|
||||
}
|
|
@ -16,20 +16,20 @@
|
|||
|
||||
package io.opentelemetry.auto.instrumentation.opentelemetryapi.metrics;
|
||||
|
||||
import unshaded.io.opentelemetry.metrics.Meter;
|
||||
import unshaded.io.opentelemetry.metrics.MeterProvider;
|
||||
import application.io.opentelemetry.metrics.Meter;
|
||||
import application.io.opentelemetry.metrics.MeterProvider;
|
||||
|
||||
public class UnshadedMeterProvider implements MeterProvider {
|
||||
public class ApplicationMeterProvider implements MeterProvider {
|
||||
|
||||
@Override
|
||||
public Meter get(final String instrumentationName) {
|
||||
return new UnshadedMeter(
|
||||
return new ApplicationMeter(
|
||||
io.opentelemetry.OpenTelemetry.getMeterProvider().get(instrumentationName));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Meter get(final String instrumentationName, final String instrumentationVersion) {
|
||||
return new UnshadedMeter(
|
||||
return new ApplicationMeter(
|
||||
io.opentelemetry.OpenTelemetry.getMeterProvider()
|
||||
.get(instrumentationName, instrumentationVersion));
|
||||
}
|
|
@ -1,108 +0,0 @@
|
|||
/*
|
||||
* Copyright The OpenTelemetry 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.
|
||||
*/
|
||||
|
||||
package io.opentelemetry.auto.instrumentation.opentelemetryapi.metrics;
|
||||
|
||||
import unshaded.io.opentelemetry.metrics.BatchRecorder;
|
||||
import unshaded.io.opentelemetry.metrics.DoubleCounter;
|
||||
import unshaded.io.opentelemetry.metrics.DoubleSumObserver;
|
||||
import unshaded.io.opentelemetry.metrics.DoubleUpDownCounter;
|
||||
import unshaded.io.opentelemetry.metrics.DoubleUpDownSumObserver;
|
||||
import unshaded.io.opentelemetry.metrics.DoubleValueObserver;
|
||||
import unshaded.io.opentelemetry.metrics.DoubleValueRecorder;
|
||||
import unshaded.io.opentelemetry.metrics.LongCounter;
|
||||
import unshaded.io.opentelemetry.metrics.LongSumObserver;
|
||||
import unshaded.io.opentelemetry.metrics.LongUpDownCounter;
|
||||
import unshaded.io.opentelemetry.metrics.LongUpDownSumObserver;
|
||||
import unshaded.io.opentelemetry.metrics.LongValueObserver;
|
||||
import unshaded.io.opentelemetry.metrics.LongValueRecorder;
|
||||
import unshaded.io.opentelemetry.metrics.Meter;
|
||||
|
||||
class UnshadedMeter implements Meter {
|
||||
|
||||
private final io.opentelemetry.metrics.Meter shadedMeter;
|
||||
|
||||
UnshadedMeter(final io.opentelemetry.metrics.Meter shadedMeter) {
|
||||
this.shadedMeter = shadedMeter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DoubleCounter.Builder doubleCounterBuilder(final String name) {
|
||||
return new UnshadedDoubleCounter.Builder(shadedMeter.doubleCounterBuilder(name));
|
||||
}
|
||||
|
||||
@Override
|
||||
public LongCounter.Builder longCounterBuilder(final String name) {
|
||||
return new UnshadedLongCounter.Builder(shadedMeter.longCounterBuilder(name));
|
||||
}
|
||||
|
||||
@Override
|
||||
public DoubleUpDownCounter.Builder doubleUpDownCounterBuilder(final String name) {
|
||||
return new UnshadedDoubleUpDownCounter.Builder(shadedMeter.doubleUpDownCounterBuilder(name));
|
||||
}
|
||||
|
||||
@Override
|
||||
public LongUpDownCounter.Builder longUpDownCounterBuilder(final String name) {
|
||||
return new UnshadedLongUpDownCounter.Builder(shadedMeter.longUpDownCounterBuilder(name));
|
||||
}
|
||||
|
||||
@Override
|
||||
public DoubleValueRecorder.Builder doubleValueRecorderBuilder(final String name) {
|
||||
return new UnshadedDoubleValueRecorder.Builder(shadedMeter.doubleValueRecorderBuilder(name));
|
||||
}
|
||||
|
||||
@Override
|
||||
public LongValueRecorder.Builder longValueRecorderBuilder(final String name) {
|
||||
return new UnshadedLongValueRecorder.Builder(shadedMeter.longValueRecorderBuilder(name));
|
||||
}
|
||||
|
||||
@Override
|
||||
public DoubleSumObserver.Builder doubleSumObserverBuilder(final String name) {
|
||||
return new UnshadedDoubleSumObserver.Builder(shadedMeter.doubleSumObserverBuilder(name));
|
||||
}
|
||||
|
||||
@Override
|
||||
public LongSumObserver.Builder longSumObserverBuilder(final String name) {
|
||||
return new UnshadedLongSumObserver.Builder(shadedMeter.longSumObserverBuilder(name));
|
||||
}
|
||||
|
||||
@Override
|
||||
public DoubleUpDownSumObserver.Builder doubleUpDownSumObserverBuilder(final String name) {
|
||||
return new UnshadedDoubleUpDownSumObserver.Builder(
|
||||
shadedMeter.doubleUpDownSumObserverBuilder(name));
|
||||
}
|
||||
|
||||
@Override
|
||||
public LongUpDownSumObserver.Builder longUpDownSumObserverBuilder(final String name) {
|
||||
return new UnshadedLongUpDownSumObserver.Builder(
|
||||
shadedMeter.longUpDownSumObserverBuilder(name));
|
||||
}
|
||||
|
||||
@Override
|
||||
public DoubleValueObserver.Builder doubleValueObserverBuilder(final String name) {
|
||||
return new UnshadedDoubleValueObserver.Builder(shadedMeter.doubleValueObserverBuilder(name));
|
||||
}
|
||||
|
||||
@Override
|
||||
public LongValueObserver.Builder longValueObserverBuilder(final String name) {
|
||||
return new UnshadedLongValueObserver.Builder(shadedMeter.longValueObserverBuilder(name));
|
||||
}
|
||||
|
||||
@Override
|
||||
public BatchRecorder newBatchRecorder(final String... keyValuePairs) {
|
||||
return new UnshadedBatchRecorder(shadedMeter.newBatchRecorder(keyValuePairs));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,268 @@
|
|||
/*
|
||||
* Copyright The OpenTelemetry 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.
|
||||
*/
|
||||
|
||||
package io.opentelemetry.auto.instrumentation.opentelemetryapi.trace;
|
||||
|
||||
import static io.opentelemetry.auto.instrumentation.opentelemetryapi.trace.Bridging.toAgent;
|
||||
import static io.opentelemetry.auto.instrumentation.opentelemetryapi.trace.Bridging.toAgentOrNull;
|
||||
|
||||
import application.io.grpc.Context;
|
||||
import application.io.opentelemetry.common.AttributeValue;
|
||||
import application.io.opentelemetry.common.Attributes;
|
||||
import application.io.opentelemetry.trace.EndSpanOptions;
|
||||
import application.io.opentelemetry.trace.Event;
|
||||
import application.io.opentelemetry.trace.Link;
|
||||
import application.io.opentelemetry.trace.Span;
|
||||
import application.io.opentelemetry.trace.SpanContext;
|
||||
import application.io.opentelemetry.trace.Status;
|
||||
import io.opentelemetry.instrumentation.auto.api.ContextStore;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
class ApplicationSpan implements Span {
|
||||
|
||||
private final io.opentelemetry.trace.Span agentSpan;
|
||||
|
||||
ApplicationSpan(final io.opentelemetry.trace.Span agentSpan) {
|
||||
this.agentSpan = agentSpan;
|
||||
}
|
||||
|
||||
io.opentelemetry.trace.Span getAgentSpan() {
|
||||
return agentSpan;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAttribute(final String key, final String value) {
|
||||
agentSpan.setAttribute(key, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAttribute(final String key, final long value) {
|
||||
agentSpan.setAttribute(key, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAttribute(final String key, final double value) {
|
||||
agentSpan.setAttribute(key, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAttribute(final String key, final boolean value) {
|
||||
agentSpan.setAttribute(key, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAttribute(final String key, final AttributeValue applicationValue) {
|
||||
io.opentelemetry.common.AttributeValue agentValue = Bridging.toAgentOrNull(applicationValue);
|
||||
if (agentValue != null) {
|
||||
agentSpan.setAttribute(key, agentValue);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addEvent(final String name) {
|
||||
agentSpan.addEvent(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addEvent(final String name, final long timestamp) {
|
||||
agentSpan.addEvent(name, timestamp);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addEvent(final String name, final Attributes applicationAttributes) {
|
||||
agentSpan.addEvent(name, Bridging.toAgent(applicationAttributes));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addEvent(
|
||||
final String name, final Attributes applicationAttributes, final long timestamp) {
|
||||
agentSpan.addEvent(name, Bridging.toAgent(applicationAttributes), timestamp);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addEvent(final Event applicationEvent) {
|
||||
addEvent(applicationEvent.getName(), applicationEvent.getAttributes());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addEvent(final Event applicationEvent, final long timestamp) {
|
||||
addEvent(applicationEvent.getName(), applicationEvent.getAttributes(), timestamp);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setStatus(final Status applicationStatus) {
|
||||
io.opentelemetry.trace.Status agentStatus = Bridging.toAgentOrNull(applicationStatus);
|
||||
if (agentStatus != null) {
|
||||
agentSpan.setStatus(agentStatus);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void recordException(Throwable throwable) {
|
||||
agentSpan.recordException(throwable);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateName(final String name) {
|
||||
agentSpan.updateName(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void end() {
|
||||
agentSpan.end();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void end(final EndSpanOptions applicationEndOptions) {
|
||||
agentSpan.end(toAgent(applicationEndOptions));
|
||||
}
|
||||
|
||||
@Override
|
||||
public SpanContext getContext() {
|
||||
return Bridging.toApplication(agentSpan.getContext());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isRecording() {
|
||||
return agentSpan.isRecording();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(final Object other) {
|
||||
if (!(other instanceof ApplicationSpan)) {
|
||||
return false;
|
||||
}
|
||||
return agentSpan.equals(((ApplicationSpan) other).agentSpan);
|
||||
}
|
||||
|
||||
static class Builder implements Span.Builder {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(Builder.class);
|
||||
|
||||
private final io.opentelemetry.trace.Span.Builder agentBuilder;
|
||||
private final ContextStore<Context, io.grpc.Context> contextStore;
|
||||
|
||||
Builder(
|
||||
final io.opentelemetry.trace.Span.Builder agentBuilder,
|
||||
ContextStore<Context, io.grpc.Context> contextStore) {
|
||||
this.agentBuilder = agentBuilder;
|
||||
this.contextStore = contextStore;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Span.Builder setParent(final Span applicationParent) {
|
||||
if (applicationParent instanceof ApplicationSpan) {
|
||||
agentBuilder.setParent(((ApplicationSpan) applicationParent).getAgentSpan());
|
||||
} else {
|
||||
log.debug("unexpected parent span: {}", applicationParent);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Span.Builder setParent(final SpanContext applicationRemoteParent) {
|
||||
agentBuilder.setParent(Bridging.toAgent(applicationRemoteParent));
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Span.Builder setParent(Context applicationContext) {
|
||||
agentBuilder.setParent(contextStore.get(applicationContext));
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Span.Builder setNoParent() {
|
||||
agentBuilder.setNoParent();
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Span.Builder addLink(final SpanContext applicationSpanContext) {
|
||||
agentBuilder.addLink(Bridging.toAgent(applicationSpanContext));
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Span.Builder addLink(
|
||||
final SpanContext applicationSpanContext, final Attributes applicationAttributes) {
|
||||
agentBuilder.addLink(Bridging.toAgent(applicationSpanContext));
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Span.Builder addLink(final Link applicationLink) {
|
||||
agentBuilder.addLink(
|
||||
Bridging.toAgent(applicationLink.getContext()),
|
||||
Bridging.toAgent(applicationLink.getAttributes()));
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Span.Builder setAttribute(final String key, final String value) {
|
||||
agentBuilder.setAttribute(key, value);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Span.Builder setAttribute(final String key, final long value) {
|
||||
agentBuilder.setAttribute(key, value);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Span.Builder setAttribute(final String key, final double value) {
|
||||
agentBuilder.setAttribute(key, value);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Span.Builder setAttribute(final String key, final boolean value) {
|
||||
agentBuilder.setAttribute(key, value);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Span.Builder setAttribute(final String key, final AttributeValue applicationValue) {
|
||||
io.opentelemetry.common.AttributeValue agentValue = Bridging.toAgentOrNull(applicationValue);
|
||||
if (agentValue != null) {
|
||||
agentBuilder.setAttribute(key, agentValue);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Span.Builder setSpanKind(final Span.Kind applicationSpanKind) {
|
||||
io.opentelemetry.trace.Span.Kind agentSpanKind = toAgentOrNull(applicationSpanKind);
|
||||
if (agentSpanKind != null) {
|
||||
agentBuilder.setSpanKind(agentSpanKind);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Span.Builder setStartTimestamp(final long startTimestamp) {
|
||||
agentBuilder.setStartTimestamp(startTimestamp);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Span startSpan() {
|
||||
return new ApplicationSpan(agentBuilder.startSpan());
|
||||
}
|
||||
}
|
||||
}
|
|
@ -16,36 +16,36 @@
|
|||
|
||||
package io.opentelemetry.auto.instrumentation.opentelemetryapi.trace;
|
||||
|
||||
import application.io.grpc.Context;
|
||||
import application.io.opentelemetry.context.Scope;
|
||||
import application.io.opentelemetry.trace.Span;
|
||||
import application.io.opentelemetry.trace.Tracer;
|
||||
import io.opentelemetry.instrumentation.auto.api.ContextStore;
|
||||
import unshaded.io.grpc.Context;
|
||||
import unshaded.io.opentelemetry.context.Scope;
|
||||
import unshaded.io.opentelemetry.trace.Span;
|
||||
import unshaded.io.opentelemetry.trace.Tracer;
|
||||
|
||||
class UnshadedTracer implements Tracer {
|
||||
class ApplicationTracer implements Tracer {
|
||||
|
||||
private final io.opentelemetry.trace.Tracer shadedTracer;
|
||||
private final io.opentelemetry.trace.Tracer agentTracer;
|
||||
private final ContextStore<Context, io.grpc.Context> contextStore;
|
||||
|
||||
UnshadedTracer(
|
||||
final io.opentelemetry.trace.Tracer shadedTracer,
|
||||
ApplicationTracer(
|
||||
final io.opentelemetry.trace.Tracer agentTracer,
|
||||
ContextStore<Context, io.grpc.Context> contextStore) {
|
||||
this.shadedTracer = shadedTracer;
|
||||
this.agentTracer = agentTracer;
|
||||
this.contextStore = contextStore;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Span getCurrentSpan() {
|
||||
return Bridging.toUnshaded(shadedTracer.getCurrentSpan());
|
||||
return Bridging.toApplication(agentTracer.getCurrentSpan());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Scope withSpan(final Span span) {
|
||||
return TracingContextUtils.currentContextWith(span);
|
||||
public Scope withSpan(final Span applicationSpan) {
|
||||
return TracingContextUtils.currentContextWith(applicationSpan);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Span.Builder spanBuilder(final String spanName) {
|
||||
return new UnshadedSpan.Builder(shadedTracer.spanBuilder(spanName), contextStore);
|
||||
return new ApplicationSpan.Builder(agentTracer.spanBuilder(spanName), contextStore);
|
||||
}
|
||||
}
|
|
@ -16,39 +16,40 @@
|
|||
|
||||
package io.opentelemetry.auto.instrumentation.opentelemetryapi.trace;
|
||||
|
||||
import application.io.grpc.Context;
|
||||
import application.io.opentelemetry.internal.Obfuscated;
|
||||
import application.io.opentelemetry.trace.Tracer;
|
||||
import application.io.opentelemetry.trace.TracerProvider;
|
||||
import io.opentelemetry.instrumentation.auto.api.ContextStore;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import unshaded.io.grpc.Context;
|
||||
import unshaded.io.opentelemetry.internal.Obfuscated;
|
||||
import unshaded.io.opentelemetry.trace.Tracer;
|
||||
import unshaded.io.opentelemetry.trace.TracerProvider;
|
||||
|
||||
public class UnshadedTracerProvider implements TracerProvider, Obfuscated {
|
||||
public class ApplicationTracerProvider implements TracerProvider, Obfuscated {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(UnshadedTracerProvider.class);
|
||||
private static final Logger log = LoggerFactory.getLogger(ApplicationTracerProvider.class);
|
||||
|
||||
private static final AtomicBoolean messageAlreadyLogged = new AtomicBoolean();
|
||||
|
||||
private final ContextStore<Context, io.grpc.Context> contextStore;
|
||||
private final TracerProvider originalTracerProvider;
|
||||
private final TracerProvider applicationOriginalTracerProvider;
|
||||
|
||||
public UnshadedTracerProvider(
|
||||
ContextStore<Context, io.grpc.Context> contextStore, TracerProvider originalTracerProvider) {
|
||||
public ApplicationTracerProvider(
|
||||
ContextStore<Context, io.grpc.Context> contextStore,
|
||||
TracerProvider applicationOriginalTracerProvider) {
|
||||
this.contextStore = contextStore;
|
||||
this.originalTracerProvider = originalTracerProvider;
|
||||
this.applicationOriginalTracerProvider = applicationOriginalTracerProvider;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Tracer get(final String instrumentationName) {
|
||||
return new UnshadedTracer(
|
||||
return new ApplicationTracer(
|
||||
io.opentelemetry.OpenTelemetry.getTracerProvider().get(instrumentationName), contextStore);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Tracer get(final String instrumentationName, final String instrumentationVersion) {
|
||||
return new UnshadedTracer(
|
||||
return new ApplicationTracer(
|
||||
io.opentelemetry.OpenTelemetry.getTracerProvider()
|
||||
.get(instrumentationName, instrumentationVersion),
|
||||
contextStore);
|
||||
|
@ -69,6 +70,6 @@ public class UnshadedTracerProvider implements TracerProvider, Obfuscated {
|
|||
log.info(message);
|
||||
}
|
||||
}
|
||||
return ((Obfuscated<?>) originalTracerProvider).unobfuscate();
|
||||
return ((Obfuscated<?>) applicationOriginalTracerProvider).unobfuscate();
|
||||
}
|
||||
}
|
|
@ -16,32 +16,31 @@
|
|||
|
||||
package io.opentelemetry.auto.instrumentation.opentelemetryapi.trace;
|
||||
|
||||
import io.opentelemetry.common.Attributes.Builder;
|
||||
import application.io.opentelemetry.common.AttributeValue;
|
||||
import application.io.opentelemetry.common.Attributes;
|
||||
import application.io.opentelemetry.common.ReadableKeyValuePairs.KeyValueConsumer;
|
||||
import application.io.opentelemetry.trace.DefaultSpan;
|
||||
import application.io.opentelemetry.trace.EndSpanOptions;
|
||||
import application.io.opentelemetry.trace.Span;
|
||||
import application.io.opentelemetry.trace.SpanContext;
|
||||
import application.io.opentelemetry.trace.SpanId;
|
||||
import application.io.opentelemetry.trace.Status;
|
||||
import application.io.opentelemetry.trace.TraceFlags;
|
||||
import application.io.opentelemetry.trace.TraceId;
|
||||
import application.io.opentelemetry.trace.TraceState;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import unshaded.io.opentelemetry.common.AttributeValue;
|
||||
import unshaded.io.opentelemetry.common.Attributes;
|
||||
import unshaded.io.opentelemetry.common.ReadableKeyValuePairs.KeyValueConsumer;
|
||||
import unshaded.io.opentelemetry.trace.DefaultSpan;
|
||||
import unshaded.io.opentelemetry.trace.EndSpanOptions;
|
||||
import unshaded.io.opentelemetry.trace.Span;
|
||||
import unshaded.io.opentelemetry.trace.SpanContext;
|
||||
import unshaded.io.opentelemetry.trace.SpanId;
|
||||
import unshaded.io.opentelemetry.trace.Status;
|
||||
import unshaded.io.opentelemetry.trace.TraceFlags;
|
||||
import unshaded.io.opentelemetry.trace.TraceId;
|
||||
import unshaded.io.opentelemetry.trace.TraceState;
|
||||
|
||||
/**
|
||||
* This class translates between the (unshaded) OpenTelemetry API that the user brings and the
|
||||
* (shaded) OpenTelemetry API that is in the bootstrap class loader and used to report telemetry to
|
||||
* the agent.
|
||||
* This class translates between the (unshaded) OpenTelemetry API that the application brings and
|
||||
* the (shaded) OpenTelemetry API that is used by the agent.
|
||||
*
|
||||
* <p>"unshaded.io.opentelemetry.*" refers to the (unshaded) OpenTelemetry API that the user brings
|
||||
* (as those references will be translated during the build to remove the "unshaded." prefix).
|
||||
* <p>"application.io.opentelemetry.*" refers to the (unshaded) OpenTelemetry API that the
|
||||
* application brings (as those references will be translated during the build to remove the
|
||||
* "application." prefix).
|
||||
*
|
||||
* <p>"io.opentelemetry.*" refers to the (shaded) OpenTelemetry API that is in the bootstrap class
|
||||
* loader (as those references will later be shaded).
|
||||
* <p>"io.opentelemetry.*" refers to the (shaded) OpenTelemetry API that is used by the agent (as
|
||||
* those references will later be shaded).
|
||||
*
|
||||
* <p>Also see comments in this module's gradle file.
|
||||
*/
|
||||
|
@ -52,169 +51,173 @@ public class Bridging {
|
|||
// this is just an optimization to save some byte array allocations
|
||||
public static final ThreadLocal<byte[]> BUFFER = new ThreadLocal<>();
|
||||
|
||||
public static Span toUnshaded(final io.opentelemetry.trace.Span shadedSpan) {
|
||||
if (!shadedSpan.getContext().isValid()) {
|
||||
public static Span toApplication(final io.opentelemetry.trace.Span agentSpan) {
|
||||
if (!agentSpan.getContext().isValid()) {
|
||||
// no need to wrap
|
||||
return DefaultSpan.getInvalid();
|
||||
} else {
|
||||
return new UnshadedSpan(shadedSpan);
|
||||
return new ApplicationSpan(agentSpan);
|
||||
}
|
||||
}
|
||||
|
||||
public static io.opentelemetry.trace.Span toShadedOrNull(final Span unshadedSpan) {
|
||||
if (!unshadedSpan.getContext().isValid()) {
|
||||
public static io.opentelemetry.trace.Span toAgentOrNull(final Span applicationSpan) {
|
||||
if (!applicationSpan.getContext().isValid()) {
|
||||
// no need to wrap
|
||||
return io.opentelemetry.trace.DefaultSpan.getInvalid();
|
||||
} else if (unshadedSpan instanceof UnshadedSpan) {
|
||||
return ((UnshadedSpan) unshadedSpan).getShadedSpan();
|
||||
} else if (applicationSpan instanceof ApplicationSpan) {
|
||||
return ((ApplicationSpan) applicationSpan).getAgentSpan();
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static SpanContext toUnshaded(final io.opentelemetry.trace.SpanContext shadedContext) {
|
||||
if (shadedContext.isRemote()) {
|
||||
public static SpanContext toApplication(final io.opentelemetry.trace.SpanContext agentContext) {
|
||||
if (agentContext.isRemote()) {
|
||||
return SpanContext.createFromRemoteParent(
|
||||
toUnshaded(shadedContext.getTraceId()),
|
||||
toUnshaded(shadedContext.getSpanId()),
|
||||
toUnshaded(shadedContext.getTraceFlags()),
|
||||
toUnshaded(shadedContext.getTraceState()));
|
||||
toApplication(agentContext.getTraceId()),
|
||||
toApplication(agentContext.getSpanId()),
|
||||
toApplication(agentContext.getTraceFlags()),
|
||||
toApplication(agentContext.getTraceState()));
|
||||
} else {
|
||||
return SpanContext.create(
|
||||
toUnshaded(shadedContext.getTraceId()),
|
||||
toUnshaded(shadedContext.getSpanId()),
|
||||
toUnshaded(shadedContext.getTraceFlags()),
|
||||
toUnshaded(shadedContext.getTraceState()));
|
||||
toApplication(agentContext.getTraceId()),
|
||||
toApplication(agentContext.getSpanId()),
|
||||
toApplication(agentContext.getTraceFlags()),
|
||||
toApplication(agentContext.getTraceState()));
|
||||
}
|
||||
}
|
||||
|
||||
public static io.opentelemetry.trace.SpanContext toShaded(final SpanContext unshadedContext) {
|
||||
if (unshadedContext.isRemote()) {
|
||||
public static io.opentelemetry.trace.SpanContext toAgent(final SpanContext applicationContext) {
|
||||
if (applicationContext.isRemote()) {
|
||||
return io.opentelemetry.trace.SpanContext.createFromRemoteParent(
|
||||
toShaded(unshadedContext.getTraceId()),
|
||||
toShaded(unshadedContext.getSpanId()),
|
||||
toShaded(unshadedContext.getTraceFlags()),
|
||||
toShaded(unshadedContext.getTraceState()));
|
||||
toAgent(applicationContext.getTraceId()),
|
||||
toAgent(applicationContext.getSpanId()),
|
||||
toAgent(applicationContext.getTraceFlags()),
|
||||
toAgent(applicationContext.getTraceState()));
|
||||
} else {
|
||||
return io.opentelemetry.trace.SpanContext.create(
|
||||
toShaded(unshadedContext.getTraceId()),
|
||||
toShaded(unshadedContext.getSpanId()),
|
||||
toShaded(unshadedContext.getTraceFlags()),
|
||||
toShaded(unshadedContext.getTraceState()));
|
||||
toAgent(applicationContext.getTraceId()),
|
||||
toAgent(applicationContext.getSpanId()),
|
||||
toAgent(applicationContext.getTraceFlags()),
|
||||
toAgent(applicationContext.getTraceState()));
|
||||
}
|
||||
}
|
||||
|
||||
public static io.opentelemetry.common.Attributes toShaded(final Attributes unshadedAttributes) {
|
||||
final Builder builder = io.opentelemetry.common.Attributes.newBuilder();
|
||||
unshadedAttributes.forEach(
|
||||
public static io.opentelemetry.common.Attributes toAgent(final Attributes applicationAttributes) {
|
||||
final io.opentelemetry.common.Attributes.Builder agentAttributes =
|
||||
io.opentelemetry.common.Attributes.newBuilder();
|
||||
applicationAttributes.forEach(
|
||||
new KeyValueConsumer<AttributeValue>() {
|
||||
@Override
|
||||
public void consume(String key, AttributeValue attributeValue) {
|
||||
io.opentelemetry.common.AttributeValue shadedValue = toShadedOrNull(attributeValue);
|
||||
if (shadedValue != null) {
|
||||
builder.setAttribute(key, shadedValue);
|
||||
io.opentelemetry.common.AttributeValue agentValue = toAgentOrNull(attributeValue);
|
||||
if (agentValue != null) {
|
||||
agentAttributes.setAttribute(key, agentValue);
|
||||
}
|
||||
}
|
||||
});
|
||||
return builder.build();
|
||||
return agentAttributes.build();
|
||||
}
|
||||
|
||||
public static io.opentelemetry.common.AttributeValue toShadedOrNull(
|
||||
final AttributeValue unshadedValue) {
|
||||
switch (unshadedValue.getType()) {
|
||||
public static io.opentelemetry.common.AttributeValue toAgentOrNull(
|
||||
final AttributeValue applicationValue) {
|
||||
switch (applicationValue.getType()) {
|
||||
case STRING:
|
||||
return io.opentelemetry.common.AttributeValue.stringAttributeValue(
|
||||
unshadedValue.getStringValue());
|
||||
applicationValue.getStringValue());
|
||||
case LONG:
|
||||
return io.opentelemetry.common.AttributeValue.longAttributeValue(
|
||||
unshadedValue.getLongValue());
|
||||
applicationValue.getLongValue());
|
||||
case BOOLEAN:
|
||||
return io.opentelemetry.common.AttributeValue.booleanAttributeValue(
|
||||
unshadedValue.getBooleanValue());
|
||||
applicationValue.getBooleanValue());
|
||||
case DOUBLE:
|
||||
return io.opentelemetry.common.AttributeValue.doubleAttributeValue(
|
||||
unshadedValue.getDoubleValue());
|
||||
applicationValue.getDoubleValue());
|
||||
default:
|
||||
log.debug("unexpected attribute type: {}", unshadedValue.getType());
|
||||
log.debug("unexpected attribute type: {}", applicationValue.getType());
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static io.opentelemetry.trace.Status toShadedOrNull(final Status unshadedStatus) {
|
||||
io.opentelemetry.trace.Status.CanonicalCode canonicalCode;
|
||||
public static io.opentelemetry.trace.Status toAgentOrNull(final Status applicationStatus) {
|
||||
io.opentelemetry.trace.Status.CanonicalCode agentCanonicalCode;
|
||||
try {
|
||||
canonicalCode =
|
||||
agentCanonicalCode =
|
||||
io.opentelemetry.trace.Status.CanonicalCode.valueOf(
|
||||
unshadedStatus.getCanonicalCode().name());
|
||||
applicationStatus.getCanonicalCode().name());
|
||||
} catch (final IllegalArgumentException e) {
|
||||
log.debug("unexpected status canonical code: {}", unshadedStatus.getCanonicalCode().name());
|
||||
log.debug(
|
||||
"unexpected status canonical code: {}", applicationStatus.getCanonicalCode().name());
|
||||
return null;
|
||||
}
|
||||
return canonicalCode.toStatus().withDescription(unshadedStatus.getDescription());
|
||||
return agentCanonicalCode.toStatus().withDescription(applicationStatus.getDescription());
|
||||
}
|
||||
|
||||
public static io.opentelemetry.trace.Span.Kind toShadedOrNull(final Span.Kind unshadedSpanKind) {
|
||||
public static io.opentelemetry.trace.Span.Kind toAgentOrNull(
|
||||
final Span.Kind applicationSpanKind) {
|
||||
try {
|
||||
return io.opentelemetry.trace.Span.Kind.valueOf(unshadedSpanKind.name());
|
||||
return io.opentelemetry.trace.Span.Kind.valueOf(applicationSpanKind.name());
|
||||
} catch (final IllegalArgumentException e) {
|
||||
log.debug("unexpected span kind: {}", unshadedSpanKind.name());
|
||||
log.debug("unexpected span kind: {}", applicationSpanKind.name());
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static io.opentelemetry.trace.EndSpanOptions toShaded(
|
||||
final EndSpanOptions unshadedEndSpanOptions) {
|
||||
public static io.opentelemetry.trace.EndSpanOptions toAgent(
|
||||
final EndSpanOptions applicationEndSpanOptions) {
|
||||
return io.opentelemetry.trace.EndSpanOptions.builder()
|
||||
.setEndTimestamp(unshadedEndSpanOptions.getEndTimestamp())
|
||||
.setEndTimestamp(applicationEndSpanOptions.getEndTimestamp())
|
||||
.build();
|
||||
}
|
||||
|
||||
private static TraceId toUnshaded(final io.opentelemetry.trace.TraceId shadedTraceId) {
|
||||
private static TraceId toApplication(final io.opentelemetry.trace.TraceId agentTraceId) {
|
||||
byte[] bytes = getBuffer();
|
||||
shadedTraceId.copyBytesTo(bytes, 0);
|
||||
agentTraceId.copyBytesTo(bytes, 0);
|
||||
return TraceId.fromBytes(bytes, 0);
|
||||
}
|
||||
|
||||
private static SpanId toUnshaded(final io.opentelemetry.trace.SpanId shadedSpanId) {
|
||||
private static SpanId toApplication(final io.opentelemetry.trace.SpanId agentSpanId) {
|
||||
byte[] bytes = getBuffer();
|
||||
shadedSpanId.copyBytesTo(bytes, 0);
|
||||
agentSpanId.copyBytesTo(bytes, 0);
|
||||
return SpanId.fromBytes(bytes, 0);
|
||||
}
|
||||
|
||||
private static TraceFlags toUnshaded(final io.opentelemetry.trace.TraceFlags shadedTraceFlags) {
|
||||
return TraceFlags.fromByte(shadedTraceFlags.getByte());
|
||||
private static TraceFlags toApplication(final io.opentelemetry.trace.TraceFlags agentTraceFlags) {
|
||||
return TraceFlags.fromByte(agentTraceFlags.getByte());
|
||||
}
|
||||
|
||||
private static TraceState toUnshaded(final io.opentelemetry.trace.TraceState shadedTraceState) {
|
||||
TraceState.Builder builder = TraceState.builder();
|
||||
for (io.opentelemetry.trace.TraceState.Entry entry : shadedTraceState.getEntries()) {
|
||||
builder.set(entry.getKey(), entry.getValue());
|
||||
private static TraceState toApplication(final io.opentelemetry.trace.TraceState agentTraceState) {
|
||||
TraceState.Builder applicationTraceState = TraceState.builder();
|
||||
for (io.opentelemetry.trace.TraceState.Entry entry : agentTraceState.getEntries()) {
|
||||
applicationTraceState.set(entry.getKey(), entry.getValue());
|
||||
}
|
||||
return builder.build();
|
||||
return applicationTraceState.build();
|
||||
}
|
||||
|
||||
private static io.opentelemetry.trace.TraceId toShaded(final TraceId unshadedTraceId) {
|
||||
private static io.opentelemetry.trace.TraceId toAgent(final TraceId applicationTraceId) {
|
||||
byte[] bytes = getBuffer();
|
||||
unshadedTraceId.copyBytesTo(bytes, 0);
|
||||
applicationTraceId.copyBytesTo(bytes, 0);
|
||||
return io.opentelemetry.trace.TraceId.fromBytes(bytes, 0);
|
||||
}
|
||||
|
||||
private static io.opentelemetry.trace.SpanId toShaded(final SpanId unshadedSpanId) {
|
||||
private static io.opentelemetry.trace.SpanId toAgent(final SpanId applicationSpanId) {
|
||||
byte[] bytes = getBuffer();
|
||||
unshadedSpanId.copyBytesTo(bytes, 0);
|
||||
applicationSpanId.copyBytesTo(bytes, 0);
|
||||
return io.opentelemetry.trace.SpanId.fromBytes(bytes, 0);
|
||||
}
|
||||
|
||||
private static io.opentelemetry.trace.TraceFlags toShaded(final TraceFlags unshadedTraceFlags) {
|
||||
return io.opentelemetry.trace.TraceFlags.fromByte(unshadedTraceFlags.getByte());
|
||||
private static io.opentelemetry.trace.TraceFlags toAgent(final TraceFlags applicationTraceFlags) {
|
||||
return io.opentelemetry.trace.TraceFlags.fromByte(applicationTraceFlags.getByte());
|
||||
}
|
||||
|
||||
private static io.opentelemetry.trace.TraceState toShaded(final TraceState unshadedTraceState) {
|
||||
io.opentelemetry.trace.TraceState.Builder builder = io.opentelemetry.trace.TraceState.builder();
|
||||
for (final TraceState.Entry entry : unshadedTraceState.getEntries()) {
|
||||
builder.set(entry.getKey(), entry.getValue());
|
||||
private static io.opentelemetry.trace.TraceState toAgent(final TraceState applicationTraceState) {
|
||||
io.opentelemetry.trace.TraceState.Builder agentTraceState =
|
||||
io.opentelemetry.trace.TraceState.builder();
|
||||
for (final TraceState.Entry entry : applicationTraceState.getEntries()) {
|
||||
agentTraceState.set(entry.getKey(), entry.getValue());
|
||||
}
|
||||
return builder.build();
|
||||
return agentTraceState.build();
|
||||
}
|
||||
|
||||
private static byte[] getBuffer() {
|
||||
|
|
|
@ -16,92 +16,94 @@
|
|||
|
||||
package io.opentelemetry.auto.instrumentation.opentelemetryapi.trace;
|
||||
|
||||
import static io.opentelemetry.auto.instrumentation.opentelemetryapi.trace.Bridging.toShadedOrNull;
|
||||
import static io.opentelemetry.auto.instrumentation.opentelemetryapi.trace.Bridging.toUnshaded;
|
||||
import static io.opentelemetry.auto.instrumentation.opentelemetryapi.trace.Bridging.toApplication;
|
||||
|
||||
import application.io.grpc.Context;
|
||||
import application.io.opentelemetry.context.Scope;
|
||||
import application.io.opentelemetry.trace.DefaultSpan;
|
||||
import application.io.opentelemetry.trace.Span;
|
||||
import io.opentelemetry.auto.instrumentation.opentelemetryapi.context.ApplicationScope;
|
||||
import io.opentelemetry.auto.instrumentation.opentelemetryapi.context.NoopScope;
|
||||
import io.opentelemetry.auto.instrumentation.opentelemetryapi.context.UnshadedScope;
|
||||
import io.opentelemetry.instrumentation.auto.api.ContextStore;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import unshaded.io.grpc.Context;
|
||||
import unshaded.io.opentelemetry.context.Scope;
|
||||
import unshaded.io.opentelemetry.trace.DefaultSpan;
|
||||
import unshaded.io.opentelemetry.trace.Span;
|
||||
|
||||
public class TracingContextUtils {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(TracingContextUtils.class);
|
||||
|
||||
public static Context withSpan(
|
||||
final Span span,
|
||||
final Context context,
|
||||
final Span applicationSpan,
|
||||
final Context applicationContext,
|
||||
final ContextStore<Context, io.grpc.Context> contextStore) {
|
||||
io.opentelemetry.trace.Span shadedSpan = toShadedOrNull(span);
|
||||
if (shadedSpan == null) {
|
||||
io.opentelemetry.trace.Span agentSpan = Bridging.toAgentOrNull(applicationSpan);
|
||||
if (agentSpan == null) {
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("unexpected span: {}", span, new Exception("unexpected span"));
|
||||
log.debug("unexpected span: {}", applicationSpan, new Exception("unexpected span"));
|
||||
}
|
||||
return context;
|
||||
return applicationContext;
|
||||
}
|
||||
io.grpc.Context shadedContext = contextStore.get(context);
|
||||
if (shadedContext == null) {
|
||||
io.grpc.Context agentContext = contextStore.get(applicationContext);
|
||||
if (agentContext == null) {
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("unexpected context: {}", context, new Exception("unexpected context"));
|
||||
log.debug(
|
||||
"unexpected context: {}", applicationContext, new Exception("unexpected context"));
|
||||
}
|
||||
return context;
|
||||
return applicationContext;
|
||||
}
|
||||
io.grpc.Context updatedShadedContext =
|
||||
io.opentelemetry.trace.TracingContextUtils.withSpan(shadedSpan, shadedContext);
|
||||
Context updatedContext = context.fork();
|
||||
contextStore.put(updatedContext, updatedShadedContext);
|
||||
return updatedContext;
|
||||
io.grpc.Context agentUpdatedContext =
|
||||
io.opentelemetry.trace.TracingContextUtils.withSpan(agentSpan, agentContext);
|
||||
Context applicationUpdatedContext = applicationContext.fork();
|
||||
contextStore.put(applicationUpdatedContext, agentUpdatedContext);
|
||||
return applicationUpdatedContext;
|
||||
}
|
||||
|
||||
public static Span getCurrentSpan() {
|
||||
return toUnshaded(io.opentelemetry.trace.TracingContextUtils.getCurrentSpan());
|
||||
return toApplication(io.opentelemetry.trace.TracingContextUtils.getCurrentSpan());
|
||||
}
|
||||
|
||||
public static Span getSpan(
|
||||
final Context context, final ContextStore<Context, io.grpc.Context> contextStore) {
|
||||
io.grpc.Context shadedContext = contextStore.get(context);
|
||||
if (shadedContext == null) {
|
||||
final Context applicationContext, final ContextStore<Context, io.grpc.Context> contextStore) {
|
||||
io.grpc.Context agentContext = contextStore.get(applicationContext);
|
||||
if (agentContext == null) {
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("unexpected context: {}", context, new Exception("unexpected context"));
|
||||
log.debug(
|
||||
"unexpected context: {}", applicationContext, new Exception("unexpected context"));
|
||||
}
|
||||
return DefaultSpan.getInvalid();
|
||||
}
|
||||
return toUnshaded(io.opentelemetry.trace.TracingContextUtils.getSpan(shadedContext));
|
||||
return toApplication(io.opentelemetry.trace.TracingContextUtils.getSpan(agentContext));
|
||||
}
|
||||
|
||||
public static Span getSpanWithoutDefault(
|
||||
final Context context, final ContextStore<Context, io.grpc.Context> contextStore) {
|
||||
io.grpc.Context shadedContext = contextStore.get(context);
|
||||
if (shadedContext == null) {
|
||||
final Context applicationContext, final ContextStore<Context, io.grpc.Context> contextStore) {
|
||||
io.grpc.Context agentContext = contextStore.get(applicationContext);
|
||||
if (agentContext == null) {
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("unexpected context: {}", context, new Exception("unexpected context"));
|
||||
log.debug(
|
||||
"unexpected context: {}", applicationContext, new Exception("unexpected context"));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
io.opentelemetry.trace.Span shadedSpan =
|
||||
io.opentelemetry.trace.TracingContextUtils.getSpanWithoutDefault(shadedContext);
|
||||
return shadedSpan == null ? null : toUnshaded(shadedSpan);
|
||||
io.opentelemetry.trace.Span agentSpan =
|
||||
io.opentelemetry.trace.TracingContextUtils.getSpanWithoutDefault(agentContext);
|
||||
return agentSpan == null ? null : toApplication(agentSpan);
|
||||
}
|
||||
|
||||
public static Scope currentContextWith(final Span span) {
|
||||
if (!span.getContext().isValid()) {
|
||||
// this supports direct usage of unshaded DefaultSpan.getInvalid()
|
||||
return new UnshadedScope(
|
||||
public static Scope currentContextWith(final Span applicationSpan) {
|
||||
if (!applicationSpan.getContext().isValid()) {
|
||||
// this supports direct usage of DefaultSpan.getInvalid()
|
||||
return new ApplicationScope(
|
||||
io.opentelemetry.trace.TracingContextUtils.currentContextWith(
|
||||
io.opentelemetry.trace.DefaultSpan.getInvalid()));
|
||||
}
|
||||
if (span instanceof UnshadedSpan) {
|
||||
return new UnshadedScope(
|
||||
if (applicationSpan instanceof ApplicationSpan) {
|
||||
return new ApplicationScope(
|
||||
io.opentelemetry.trace.TracingContextUtils.currentContextWith(
|
||||
((UnshadedSpan) span).getShadedSpan()));
|
||||
((ApplicationSpan) applicationSpan).getAgentSpan()));
|
||||
}
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("unexpected span: {}", span, new Exception("unexpected span"));
|
||||
log.debug("unexpected span: {}", applicationSpan, new Exception("unexpected span"));
|
||||
}
|
||||
return NoopScope.getInstance();
|
||||
}
|
||||
|
|
|
@ -1,264 +0,0 @@
|
|||
/*
|
||||
* Copyright The OpenTelemetry 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.
|
||||
*/
|
||||
|
||||
package io.opentelemetry.auto.instrumentation.opentelemetryapi.trace;
|
||||
|
||||
import static io.opentelemetry.auto.instrumentation.opentelemetryapi.trace.Bridging.toShaded;
|
||||
import static io.opentelemetry.auto.instrumentation.opentelemetryapi.trace.Bridging.toShadedOrNull;
|
||||
|
||||
import io.opentelemetry.instrumentation.auto.api.ContextStore;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import unshaded.io.grpc.Context;
|
||||
import unshaded.io.opentelemetry.common.AttributeValue;
|
||||
import unshaded.io.opentelemetry.common.Attributes;
|
||||
import unshaded.io.opentelemetry.trace.EndSpanOptions;
|
||||
import unshaded.io.opentelemetry.trace.Event;
|
||||
import unshaded.io.opentelemetry.trace.Link;
|
||||
import unshaded.io.opentelemetry.trace.Span;
|
||||
import unshaded.io.opentelemetry.trace.SpanContext;
|
||||
import unshaded.io.opentelemetry.trace.Status;
|
||||
|
||||
class UnshadedSpan implements Span {
|
||||
|
||||
private final io.opentelemetry.trace.Span shadedSpan;
|
||||
|
||||
UnshadedSpan(final io.opentelemetry.trace.Span shadedSpan) {
|
||||
this.shadedSpan = shadedSpan;
|
||||
}
|
||||
|
||||
io.opentelemetry.trace.Span getShadedSpan() {
|
||||
return shadedSpan;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAttribute(final String key, final String value) {
|
||||
shadedSpan.setAttribute(key, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAttribute(final String key, final long value) {
|
||||
shadedSpan.setAttribute(key, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAttribute(final String key, final double value) {
|
||||
shadedSpan.setAttribute(key, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAttribute(final String key, final boolean value) {
|
||||
shadedSpan.setAttribute(key, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAttribute(final String key, final AttributeValue value) {
|
||||
io.opentelemetry.common.AttributeValue convertedValue = Bridging.toShadedOrNull(value);
|
||||
if (convertedValue != null) {
|
||||
shadedSpan.setAttribute(key, convertedValue);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addEvent(final String name) {
|
||||
shadedSpan.addEvent(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addEvent(final String name, final long timestamp) {
|
||||
shadedSpan.addEvent(name, timestamp);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addEvent(final String name, final Attributes attributes) {
|
||||
shadedSpan.addEvent(name, toShaded(attributes));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addEvent(final String name, final Attributes attributes, final long timestamp) {
|
||||
shadedSpan.addEvent(name, toShaded(attributes), timestamp);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addEvent(final Event event) {
|
||||
addEvent(event.getName(), event.getAttributes());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addEvent(final Event event, final long timestamp) {
|
||||
addEvent(event.getName(), event.getAttributes(), timestamp);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setStatus(final Status status) {
|
||||
io.opentelemetry.trace.Status shadedStatus = toShadedOrNull(status);
|
||||
if (shadedStatus != null) {
|
||||
shadedSpan.setStatus(shadedStatus);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void recordException(Throwable throwable) {
|
||||
shadedSpan.recordException(throwable);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateName(final String name) {
|
||||
shadedSpan.updateName(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void end() {
|
||||
shadedSpan.end();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void end(final EndSpanOptions endOptions) {
|
||||
shadedSpan.end(toShaded(endOptions));
|
||||
}
|
||||
|
||||
@Override
|
||||
public SpanContext getContext() {
|
||||
return Bridging.toUnshaded(shadedSpan.getContext());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isRecording() {
|
||||
return shadedSpan.isRecording();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(final Object other) {
|
||||
if (!(other instanceof UnshadedSpan)) {
|
||||
return false;
|
||||
}
|
||||
return shadedSpan.equals(((UnshadedSpan) other).shadedSpan);
|
||||
}
|
||||
|
||||
static class Builder implements Span.Builder {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(Builder.class);
|
||||
|
||||
private final io.opentelemetry.trace.Span.Builder shadedBuilder;
|
||||
private final ContextStore<Context, io.grpc.Context> contextStore;
|
||||
|
||||
Builder(
|
||||
final io.opentelemetry.trace.Span.Builder shadedBuilder,
|
||||
ContextStore<Context, io.grpc.Context> contextStore) {
|
||||
this.shadedBuilder = shadedBuilder;
|
||||
this.contextStore = contextStore;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Span.Builder setParent(final Span parent) {
|
||||
if (parent instanceof UnshadedSpan) {
|
||||
shadedBuilder.setParent(((UnshadedSpan) parent).getShadedSpan());
|
||||
} else {
|
||||
log.debug("unexpected parent span: {}", parent);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Span.Builder setParent(final SpanContext remoteParent) {
|
||||
shadedBuilder.setParent(toShaded(remoteParent));
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Span.Builder setParent(Context context) {
|
||||
shadedBuilder.setParent(contextStore.get(context));
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Span.Builder setNoParent() {
|
||||
shadedBuilder.setNoParent();
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Span.Builder addLink(final SpanContext spanContext) {
|
||||
shadedBuilder.addLink(toShaded(spanContext));
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Span.Builder addLink(final SpanContext spanContext, final Attributes attributes) {
|
||||
shadedBuilder.addLink(toShaded(spanContext));
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Span.Builder addLink(final Link link) {
|
||||
shadedBuilder.addLink(toShaded(link.getContext()), toShaded(link.getAttributes()));
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Span.Builder setAttribute(final String key, final String value) {
|
||||
shadedBuilder.setAttribute(key, value);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Span.Builder setAttribute(final String key, final long value) {
|
||||
shadedBuilder.setAttribute(key, value);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Span.Builder setAttribute(final String key, final double value) {
|
||||
shadedBuilder.setAttribute(key, value);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Span.Builder setAttribute(final String key, final boolean value) {
|
||||
shadedBuilder.setAttribute(key, value);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Span.Builder setAttribute(final String key, final AttributeValue value) {
|
||||
io.opentelemetry.common.AttributeValue convertedValue = Bridging.toShadedOrNull(value);
|
||||
if (convertedValue != null) {
|
||||
shadedBuilder.setAttribute(key, convertedValue);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Span.Builder setSpanKind(final Span.Kind spanKind) {
|
||||
io.opentelemetry.trace.Span.Kind shadedSpanKind = toShadedOrNull(spanKind);
|
||||
if (shadedSpanKind != null) {
|
||||
shadedBuilder.setSpanKind(shadedSpanKind);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Span.Builder setStartTimestamp(final long startTimestamp) {
|
||||
shadedBuilder.setStartTimestamp(startTimestamp);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Span startSpan() {
|
||||
return new UnshadedSpan(shadedBuilder.startSpan());
|
||||
}
|
||||
}
|
||||
}
|
|
@ -14,12 +14,12 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import application.io.opentelemetry.OpenTelemetry
|
||||
import application.io.opentelemetry.common.Labels
|
||||
import application.io.opentelemetry.metrics.AsynchronousInstrument
|
||||
import io.opentelemetry.auto.test.AgentTestRunner
|
||||
import io.opentelemetry.sdk.OpenTelemetrySdk
|
||||
import io.opentelemetry.sdk.metrics.data.MetricData
|
||||
import unshaded.io.opentelemetry.OpenTelemetry
|
||||
import unshaded.io.opentelemetry.common.Labels
|
||||
import unshaded.io.opentelemetry.metrics.AsynchronousInstrument
|
||||
|
||||
import static io.opentelemetry.sdk.metrics.data.MetricData.Descriptor.Type.MONOTONIC_DOUBLE
|
||||
import static io.opentelemetry.sdk.metrics.data.MetricData.Descriptor.Type.MONOTONIC_LONG
|
||||
|
|
|
@ -14,17 +14,17 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import application.io.opentelemetry.sdk.OpenTelemetrySdk
|
||||
import application.io.opentelemetry.sdk.trace.TracerSdkProvider
|
||||
import io.opentelemetry.auto.test.AgentTestRunner
|
||||
import unshaded.io.opentelemetry.sdk.OpenTelemetrySdk
|
||||
import unshaded.io.opentelemetry.sdk.trace.TracerSdkProvider
|
||||
|
||||
class TracerSdkTest extends AgentTestRunner {
|
||||
|
||||
def "direct access to sdk should not fail"() {
|
||||
when:
|
||||
def provider = OpenTelemetrySdk.getTracerProvider()
|
||||
def "direct access to sdk should not fail"() {
|
||||
when:
|
||||
def provider = OpenTelemetrySdk.getTracerProvider()
|
||||
|
||||
then:
|
||||
provider instanceof TracerSdkProvider
|
||||
}
|
||||
then:
|
||||
provider instanceof TracerSdkProvider
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,21 +14,21 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import application.io.grpc.Context
|
||||
import application.io.opentelemetry.OpenTelemetry
|
||||
import application.io.opentelemetry.context.Scope
|
||||
import application.io.opentelemetry.trace.DefaultSpan
|
||||
import application.io.opentelemetry.trace.Span
|
||||
import application.io.opentelemetry.trace.Status
|
||||
import io.opentelemetry.auto.test.AgentTestRunner
|
||||
import io.opentelemetry.trace.attributes.SemanticAttributes
|
||||
import unshaded.io.grpc.Context
|
||||
import unshaded.io.opentelemetry.OpenTelemetry
|
||||
import unshaded.io.opentelemetry.context.Scope
|
||||
import unshaded.io.opentelemetry.trace.DefaultSpan
|
||||
import unshaded.io.opentelemetry.trace.Span
|
||||
import unshaded.io.opentelemetry.trace.Status
|
||||
|
||||
import static unshaded.io.opentelemetry.context.ContextUtils.withScopedContext
|
||||
import static unshaded.io.opentelemetry.trace.Span.Kind.PRODUCER
|
||||
import static unshaded.io.opentelemetry.trace.TracingContextUtils.currentContextWith
|
||||
import static unshaded.io.opentelemetry.trace.TracingContextUtils.getCurrentSpan
|
||||
import static unshaded.io.opentelemetry.trace.TracingContextUtils.getSpan
|
||||
import static unshaded.io.opentelemetry.trace.TracingContextUtils.withSpan
|
||||
import static application.io.opentelemetry.context.ContextUtils.withScopedContext
|
||||
import static application.io.opentelemetry.trace.Span.Kind.PRODUCER
|
||||
import static application.io.opentelemetry.trace.TracingContextUtils.currentContextWith
|
||||
import static application.io.opentelemetry.trace.TracingContextUtils.getCurrentSpan
|
||||
import static application.io.opentelemetry.trace.TracingContextUtils.getSpan
|
||||
import static application.io.opentelemetry.trace.TracingContextUtils.withSpan
|
||||
|
||||
class TracerTest extends AgentTestRunner {
|
||||
|
||||
|
|
|
@ -14,14 +14,14 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import application.io.grpc.Context
|
||||
import io.opentelemetry.auto.test.AgentTestRunner
|
||||
import unshaded.io.grpc.Context
|
||||
|
||||
import static unshaded.io.opentelemetry.OpenTelemetry.getTracerProvider
|
||||
import static unshaded.io.opentelemetry.trace.TracingContextUtils.currentContextWith
|
||||
import static unshaded.io.opentelemetry.trace.TracingContextUtils.getCurrentSpan
|
||||
import static unshaded.io.opentelemetry.trace.TracingContextUtils.getSpan
|
||||
import static unshaded.io.opentelemetry.trace.TracingContextUtils.getSpanWithoutDefault
|
||||
import static application.io.opentelemetry.OpenTelemetry.getTracerProvider
|
||||
import static application.io.opentelemetry.trace.TracingContextUtils.currentContextWith
|
||||
import static application.io.opentelemetry.trace.TracingContextUtils.getCurrentSpan
|
||||
import static application.io.opentelemetry.trace.TracingContextUtils.getSpan
|
||||
import static application.io.opentelemetry.trace.TracingContextUtils.getSpanWithoutDefault
|
||||
|
||||
class TracingContextUtilsTest extends AgentTestRunner {
|
||||
|
||||
|
|
|
@ -16,10 +16,10 @@
|
|||
|
||||
package io.opentelemetry.test.annotation;
|
||||
|
||||
import application.io.opentelemetry.extensions.auto.annotations.WithSpan;
|
||||
import application.io.opentelemetry.trace.Span.Kind;
|
||||
import io.opentelemetry.OpenTelemetry;
|
||||
import io.opentelemetry.trace.Tracer;
|
||||
import unshaded.io.opentelemetry.extensions.auto.annotations.WithSpan;
|
||||
import unshaded.io.opentelemetry.trace.Span.Kind;
|
||||
|
||||
public class TracedWithSpan {
|
||||
|
||||
|
|
|
@ -13,6 +13,6 @@ dependencies {
|
|||
// (see more explanation in opentelemetry-api-beta.gradle)
|
||||
shadowJar {
|
||||
|
||||
relocate "io.opentelemetry", "unshaded.io.opentelemetry"
|
||||
relocate "io.grpc", "unshaded.io.grpc"
|
||||
relocate "io.opentelemetry", "application.io.opentelemetry"
|
||||
relocate "io.grpc", "application.io.grpc"
|
||||
}
|
||||
|
|
|
@ -13,5 +13,5 @@ dependencies {
|
|||
// (see more explanation in opentelemetry-api-beta.gradle)
|
||||
shadowJar {
|
||||
|
||||
relocate "io.opentelemetry", "unshaded.io.opentelemetry"
|
||||
relocate "io.opentelemetry", "application.io.opentelemetry"
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ dependencies {
|
|||
shadowJar {
|
||||
|
||||
mergeServiceFiles()
|
||||
|
||||
relocate "io.opentelemetry", "unshaded.io.opentelemetry"
|
||||
relocate "io.grpc", "unshaded.io.grpc"
|
||||
|
||||
relocate "io.opentelemetry", "application.io.opentelemetry"
|
||||
relocate "io.grpc", "application.io.grpc"
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue