Package com.ants.platform.otel
Class AntsPlatformSpanProcessor
java.lang.Object
com.ants.platform.otel.AntsPlatformSpanProcessor
- All Implemented Interfaces:
io.opentelemetry.sdk.trace.SpanProcessor,Closeable,AutoCloseable
public final class AntsPlatformSpanProcessor
extends Object
implements io.opentelemetry.sdk.trace.SpanProcessor
OpenTelemetry
SpanProcessor that ships spans to the Agentic Ants OTLP
ingestion endpoint and decorates them with Ants-specific attributes.
Mirrors AntsPlatformSpanProcessor in the JavaScript
(@antsplatform/otel) and Python SDKs:
- Wraps an
OtlpHttpSpanExporterpointed at${baseUrl}/api/public/otel/v1/traceswithAuthorization: Basic base64(publicKey:secretKey)and thex_antsPlatform_public_keyheader. - On span start, stamps
environment/releaseand (when an agent is configured and the project id has resolved) the agent identifiers. - Asynchronously fetches the project id from
/api/public/projectsso a deterministicagent.idcan be generated, matching the other SDKs.
Build one with builder() and hand it to
AntsPlatformOtel.configure(com.ants.platform.otel.AntsPlatformSpanProcessor.Builder).
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classFluent builder forAntsPlatformSpanProcessor. -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionbuilder()io.opentelemetry.sdk.common.CompletableResultCodeExposes the resolved project id so the observation layer can derive per-agent ids.booleanbooleanvoidonEnd(io.opentelemetry.sdk.trace.ReadableSpan span) voidonStart(io.opentelemetry.context.Context parentContext, io.opentelemetry.sdk.trace.ReadWriteSpan span) io.opentelemetry.sdk.common.CompletableResultCodeshutdown()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.opentelemetry.sdk.trace.SpanProcessor
close
-
Field Details
-
DEFAULT_BASE_URL
Default ingestion host. Theapi.host -- NOTapp., NOT*.ants-platform.com.- See Also:
-
-
Method Details
-
getProjectId
Exposes the resolved project id so the observation layer can derive per-agent ids. -
onStart
public void onStart(io.opentelemetry.context.Context parentContext, io.opentelemetry.sdk.trace.ReadWriteSpan span) - Specified by:
onStartin interfaceio.opentelemetry.sdk.trace.SpanProcessor
-
isStartRequired
public boolean isStartRequired()- Specified by:
isStartRequiredin interfaceio.opentelemetry.sdk.trace.SpanProcessor
-
onEnd
public void onEnd(io.opentelemetry.sdk.trace.ReadableSpan span) - Specified by:
onEndin interfaceio.opentelemetry.sdk.trace.SpanProcessor
-
isEndRequired
public boolean isEndRequired()- Specified by:
isEndRequiredin interfaceio.opentelemetry.sdk.trace.SpanProcessor
-
forceFlush
public io.opentelemetry.sdk.common.CompletableResultCode forceFlush()- Specified by:
forceFlushin interfaceio.opentelemetry.sdk.trace.SpanProcessor
-
shutdown
public io.opentelemetry.sdk.common.CompletableResultCode shutdown()- Specified by:
shutdownin interfaceio.opentelemetry.sdk.trace.SpanProcessor
-
builder
-