Class Instrumentation.ClosableTelemetryScope

java.lang.Object
com.google.adk.telemetry.Instrumentation.ClosableTelemetryScope
All Implemented Interfaces:
AutoCloseable
Direct Known Subclasses:
Instrumentation.AgentInvocation, Instrumentation.ToolExecution
Enclosing class:
Instrumentation

public abstract static class Instrumentation.ClosableTelemetryScope extends Object implements AutoCloseable
Base class for AutoCloseable telemetry tracking scopes.
  • Field Details

    • startTimeNanos

      protected final long startTimeNanos
    • span

      protected final io.opentelemetry.api.trace.Span span
    • scope

      protected final io.opentelemetry.context.Scope scope
    • telemetryContext

      protected final Instrumentation.TelemetryContext telemetryContext
    • caughtError

      protected @Nullable Throwable caughtError
    • closed

      protected final AtomicBoolean closed
  • Method Details

    • context

    • setError

      public void setError(Throwable caughtError)
    • close

      public final void close()
      Specified by:
      close in interface AutoCloseable
    • beforeSpanEnd

      protected void beforeSpanEnd()
      Hook for subclasses to run code before span ends.
    • recordMetrics

      protected abstract void recordMetrics(Duration elapsed, @Nullable Throwable error)
      Hook for subclasses to record metrics.
    • handleMetricsError

      protected abstract void handleMetricsError(RuntimeException e)
      Hook for subclasses to handle metrics recording errors.