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 OtlpHttpSpanExporter pointed at ${baseUrl}/api/public/otel/v1/traces with Authorization: Basic base64(publicKey:secretKey) and the x_antsPlatform_public_key header.
  • On span start, stamps environment / release and (when an agent is configured and the project id has resolved) the agent identifiers.
  • Asynchronously fetches the project id from /api/public/projects so a deterministic agent.id can be generated, matching the other SDKs.

Build one with builder() and hand it to AntsPlatformOtel.configure(com.ants.platform.otel.AntsPlatformSpanProcessor.Builder).

  • Field Details

    • DEFAULT_BASE_URL

      public static final String DEFAULT_BASE_URL
      Default ingestion host. The api. host -- NOT app., NOT *.ants-platform.com.
      See Also:
  • Method Details

    • getProjectId

      public String 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:
      onStart in interface io.opentelemetry.sdk.trace.SpanProcessor
    • isStartRequired

      public boolean isStartRequired()
      Specified by:
      isStartRequired in interface io.opentelemetry.sdk.trace.SpanProcessor
    • onEnd

      public void onEnd(io.opentelemetry.sdk.trace.ReadableSpan span)
      Specified by:
      onEnd in interface io.opentelemetry.sdk.trace.SpanProcessor
    • isEndRequired

      public boolean isEndRequired()
      Specified by:
      isEndRequired in interface io.opentelemetry.sdk.trace.SpanProcessor
    • forceFlush

      public io.opentelemetry.sdk.common.CompletableResultCode forceFlush()
      Specified by:
      forceFlush in interface io.opentelemetry.sdk.trace.SpanProcessor
    • shutdown

      public io.opentelemetry.sdk.common.CompletableResultCode shutdown()
      Specified by:
      shutdown in interface io.opentelemetry.sdk.trace.SpanProcessor
    • builder

      public static AntsPlatformSpanProcessor.Builder builder()