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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ private SdkTracerProviderBuilder configureSdkTracerProvider(
SdkTracerProviderBuilder tracerProvider, ConfigProperties config) {
return tracerProvider
.setSampler(new SentrySampler())
.addSpanProcessor(new PotelSentrySpanProcessor())
.addSpanProcessor(new OtelSentrySpanProcessor())
.addSpanProcessor(BatchSpanProcessor.builder(new SentrySpanExporter()).build());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@
public final class SentryPropagatorProvider implements ConfigurablePropagatorProvider {
@Override
public TextMapPropagator getPropagator(ConfigProperties config) {
// return new SentryPropagator();
return new PotelSentryPropagator();
return new OtelSentryPropagator();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package io.sentry.opentelemetry;

import io.opentelemetry.api.common.AttributeKey;
import org.jetbrains.annotations.ApiStatus;

@ApiStatus.Internal
public final class InternalSemanticAttributes {
public static final AttributeKey<Boolean> SAMPLED = AttributeKey.booleanKey("sentry.sampled");
public static final AttributeKey<Double> SAMPLE_RATE =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@
import io.sentry.IScopes;
import io.sentry.IScopesStorage;
import io.sentry.ISentryLifecycleToken;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

@ApiStatus.Internal
@SuppressWarnings("MustBeClosedChecker")
public final class OtelContextScopesStorage implements IScopesStorage {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@
import io.sentry.TracesSamplingDecision;
import io.sentry.protocol.SentryId;
import java.lang.ref.WeakReference;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

@ApiStatus.Internal
public final class OtelSpanContext extends SpanContext {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@
import io.opentelemetry.context.Scope;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;

@ApiStatus.Internal
public final class SentryContextStorage implements ContextStorage {
private final @NotNull Logger logger = Logger.getLogger(SentryContextStorage.class.getName());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@
import io.opentelemetry.context.ContextKey;
import io.sentry.IScopes;
import io.sentry.Sentry;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

@ApiStatus.Internal
public final class SentryContextWrapper implements Context {

private final @NotNull Context delegate;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,31 +15,31 @@ public final class io/sentry/opentelemetry/OtelSamplingUtil {
public static fun extractSamplingDecisionOrDefault (Lio/opentelemetry/api/common/Attributes;)Lio/sentry/TracesSamplingDecision;
}

public final class io/sentry/opentelemetry/OtelSpanInfo {
public fun <init> (Ljava/lang/String;Ljava/lang/String;Lio/sentry/protocol/TransactionNameSource;)V
public fun <init> (Ljava/lang/String;Ljava/lang/String;Lio/sentry/protocol/TransactionNameSource;Ljava/util/Map;)V
public fun addDataField (Ljava/lang/String;Ljava/lang/Object;)V
public fun getDataFields ()Ljava/util/Map;
public fun getDescription ()Ljava/lang/String;
public fun getOp ()Ljava/lang/String;
public fun getTransactionNameSource ()Lio/sentry/protocol/TransactionNameSource;
}

public final class io/sentry/opentelemetry/PotelSentryPropagator : io/opentelemetry/context/propagation/TextMapPropagator {
public final class io/sentry/opentelemetry/OtelSentryPropagator : io/opentelemetry/context/propagation/TextMapPropagator {
public fun <init> ()V
public fun extract (Lio/opentelemetry/context/Context;Ljava/lang/Object;Lio/opentelemetry/context/propagation/TextMapGetter;)Lio/opentelemetry/context/Context;
public fun fields ()Ljava/util/Collection;
public fun inject (Lio/opentelemetry/context/Context;Ljava/lang/Object;Lio/opentelemetry/context/propagation/TextMapSetter;)V
}

public final class io/sentry/opentelemetry/PotelSentrySpanProcessor : io/opentelemetry/sdk/trace/SpanProcessor {
public final class io/sentry/opentelemetry/OtelSentrySpanProcessor : io/opentelemetry/sdk/trace/SpanProcessor {
public fun <init> ()V
public fun isEndRequired ()Z
public fun isStartRequired ()Z
public fun onEnd (Lio/opentelemetry/sdk/trace/ReadableSpan;)V
public fun onStart (Lio/opentelemetry/context/Context;Lio/opentelemetry/sdk/trace/ReadWriteSpan;)V
}

public final class io/sentry/opentelemetry/OtelSpanInfo {
public fun <init> (Ljava/lang/String;Ljava/lang/String;Lio/sentry/protocol/TransactionNameSource;)V
public fun <init> (Ljava/lang/String;Ljava/lang/String;Lio/sentry/protocol/TransactionNameSource;Ljava/util/Map;)V
public fun addDataField (Ljava/lang/String;Ljava/lang/Object;)V
public fun getDataFields ()Ljava/util/Map;
public fun getDescription ()Ljava/lang/String;
public fun getOp ()Ljava/lang/String;
public fun getTransactionNameSource ()Lio/sentry/protocol/TransactionNameSource;
}

public final class io/sentry/opentelemetry/SentryPropagator : io/opentelemetry/context/propagation/TextMapPropagator {
public fun <init> ()V
public fun extract (Lio/opentelemetry/context/Context;Ljava/lang/Object;Lio/opentelemetry/context/propagation/TextMapGetter;)Lio/opentelemetry/context/Context;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,18 @@
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

public final class PotelSentryPropagator implements TextMapPropagator {
public final class OtelSentryPropagator implements TextMapPropagator {

private static final @NotNull List<String> FIELDS =
Arrays.asList(SentryTraceHeader.SENTRY_TRACE_HEADER, BaggageHeader.BAGGAGE_HEADER);
private final @NotNull SentryWeakSpanStorage spanStorage = SentryWeakSpanStorage.getInstance();
private final @NotNull IScopes scopes;

public PotelSentryPropagator() {
public OtelSentryPropagator() {
this(ScopesAdapter.getInstance());
}

PotelSentryPropagator(final @NotNull IScopes scopes) {
OtelSentryPropagator(final @NotNull IScopes scopes) {
this.scopes = scopes;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

public final class PotelSentrySpanProcessor implements SpanProcessor {
public final class OtelSentrySpanProcessor implements SpanProcessor {
private final @NotNull SentryWeakSpanStorage spanStorage = SentryWeakSpanStorage.getInstance();
private final @NotNull IScopes scopes;

public PotelSentrySpanProcessor() {
public OtelSentrySpanProcessor() {
this(ScopesAdapter.getInstance());
}

PotelSentrySpanProcessor(final @NotNull IScopes scopes) {
OtelSentrySpanProcessor(final @NotNull IScopes scopes) {
this.scopes = scopes;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import org.jetbrains.annotations.Nullable;

/**
* @deprecated please use {@link PotelSentryPropagator} instead
* @deprecated please use {@link OtelSentryPropagator} instead
*/
@Deprecated
public final class SentryPropagator implements TextMapPropagator {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@
import io.opentelemetry.sdk.trace.samplers.SamplingDecision;
import io.opentelemetry.sdk.trace.samplers.SamplingResult;
import io.sentry.TracesSamplingDecision;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;

@ApiStatus.Internal
public final class SentrySamplingResult implements SamplingResult {
private final TracesSamplingDecision sentryDecision;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public final class SentrySpanExporter implements SpanExporter {
InternalSemanticAttributes.PARENT_SAMPLED.getKey());
private static final @NotNull Long SPAN_TIMEOUT = DateUtils.secondsToNanos(5 * 60);

public static final String TRACE_ORIGIN = "auto.potel";
public static final String TRACE_ORIGIN = "auto.otel";

public SentrySpanExporter() {
this(ScopesAdapter.getInstance());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
import org.jetbrains.annotations.Nullable;

/**
* @deprecated please use {@link PotelSentrySpanProcessor} instead.
* @deprecated please use {@link OtelSentrySpanProcessor} instead.
*/
@Deprecated
public final class SentrySpanProcessor implements SpanProcessor {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@
import io.opentelemetry.sdk.trace.data.SpanData;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

@ApiStatus.Internal
public final class SpanNode {
private final @NotNull String id;
private @Nullable SpanData span;
Expand Down
2 changes: 2 additions & 0 deletions sentry/src/main/java/io/sentry/DefaultScopesStorage.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
package io.sentry;

import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

@ApiStatus.Internal
public final class DefaultScopesStorage implements IScopesStorage {

private static final @NotNull ThreadLocal<IScopes> currentScopes = new ThreadLocal<>();
Expand Down
2 changes: 2 additions & 0 deletions sentry/src/main/java/io/sentry/IScopesStorage.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
package io.sentry;

import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

@ApiStatus.Internal
public interface IScopesStorage {

@NotNull
Expand Down
2 changes: 2 additions & 0 deletions sentry/src/main/java/io/sentry/ScopesStorageFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@

import io.sentry.util.LoadClass;
import java.lang.reflect.InvocationTargetException;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

@ApiStatus.Internal
public final class ScopesStorageFactory {

private static final String OTEL_SCOPES_STORAGE =
Expand Down
2 changes: 2 additions & 0 deletions sentry/src/main/java/io/sentry/SentryOptions.java
Original file line number Diff line number Diff line change
Expand Up @@ -2727,11 +2727,13 @@ private void addPackageInfo() {
.addPackage("maven:io.sentry:sentry", BuildConfig.VERSION_NAME);
}

@ApiStatus.Internal
public @NotNull ISpanFactory getSpanFactory() {
// TODO [POTEL] use a util for checking if OTel is active or similar
return spanFactory;
}

@ApiStatus.Internal
public void setSpanFactory(final @NotNull ISpanFactory spanFactory) {
this.spanFactory = spanFactory;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
* into the bootstrap classloader, then this hack should no longer be necessary.
*/
@ApiStatus.Experimental
@ApiStatus.Internal
public final class SentrySpanFactoryHolder {

private static ISpanFactory spanFactory = new DefaultSpanFactory();
Expand Down