apiserverspanexporter.go

Overview

This file defines the APIServerSpanExporter type, a custom implementation of the sdktrace.SpanExporter interface from OpenTelemetry. Its primary purpose is to collect and store trace span data related to specific span events (call_llm, send_data, and spans prefixed with execute_tool). The stored data is maintained in-memory as a map keyed by a unique event identifier (gcp.vertex.agent.event_id). This exporter is designed mainly for debugging and analyzing individual event traces in the system.

The APIServerSpanExporter thus serves as a specialized trace exporter focused on capturing span attributes relevant to API server operations involving LLM calls, data sending, and tool execution.


Types and Functions

Type: APIServerSpanExporter


Function: NewAPIServerSpanExporter() *APIServerSpanExporter


Method: (s *APIServerSpanExporter) GetTraceDict() map[string]map[string]string


Method: (s *APIServerSpanExporter) ExportSpans(ctx context.Context, spans []sdktrace.ReadOnlySpan) error


Method: (s *APIServerSpanExporter) Shutdown(ctx context.Context) error


Implementation Details and Algorithms


Interactions with Other System Components


Diagram: Structure of APIServerSpanExporter

classDiagram
class APIServerSpanExporter {
-traceDict map[string]map[string]string
+NewAPIServerSpanExporter()
+GetTraceDict() map[string]map[string]string
+ExportSpans(ctx, spans) error
+Shutdown(ctx) error
}
APIServerSpanExporter ..|> sdktrace.SpanExporter

References