Skip to content

Commit

Permalink
updates based on several suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
dmarkwat committed Oct 24, 2022
1 parent 10efe1f commit f39b68f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 21 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,23 @@

package io.opentelemetry.opencensusshim;

import static java.util.Collections.singletonList;

import com.google.auto.service.AutoService;
import io.opentelemetry.javaagent.extension.instrumentation.InstrumentationModule;
import io.opentelemetry.javaagent.extension.instrumentation.TypeInstrumentation;
import java.util.Arrays;
import java.util.List;

@AutoService(InstrumentationModule.class)
public class OpencensusShimInstrumentationModule extends InstrumentationModule {

public OpencensusShimInstrumentationModule() {
super("opencensus-shim", "io.opentelemetry.opencensusshim");
super("opencensus-shim");
}

@Override
public List<TypeInstrumentation> typeInstrumentations() {
return Arrays.asList(new OpenTelemetryCtxInstrumentation());
return singletonList(new OpenTelemetryCtxInstrumentation());
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@

package io.opentelemetry.opencensusshim;

import static io.opentelemetry.sdk.testing.assertj.OpenTelemetryAssertions.equalTo;

import io.opencensus.trace.AttributeValue;
import io.opencensus.trace.Tracing;
import io.opentelemetry.api.common.AttributeKey;
import io.opentelemetry.api.common.Attributes;
import io.opentelemetry.api.trace.Span;
import io.opentelemetry.api.trace.SpanKind;
import io.opentelemetry.api.trace.Tracer;
Expand All @@ -22,7 +23,7 @@ public abstract class AbstractOpenCensusShimTest {

@Test
void testCrossOtelOcBoundary() {
Tracer tracer = testing().getOpenTelemetry().getTracer("opencensus-shim", "0.0.0");
Tracer tracer = testing().getOpenTelemetry().getTracer("test");
Span span = tracer.spanBuilder("test-span").setSpanKind(SpanKind.INTERNAL).startSpan();
Scope scope = span.makeCurrent();
try {
Expand Down Expand Up @@ -51,7 +52,7 @@ void testCrossOtelOcBoundary() {
spanAssert
.hasName("internal")
.hasParentSpanId(span.getSpanContext().getSpanId())
.hasAttributes(
Attributes.of(AttributeKey.booleanKey("internal-only"), true))));
.hasAttributesSatisfyingExactly(
equalTo(AttributeKey.booleanKey("internal-only"), true))));
}
}

0 comments on commit f39b68f

Please sign in to comment.