# ApiServerSpanExporter

class ApiServerSpanExporter : SpanExporter

A custom SpanExporter that stores relevant span data. It handles two types of trace data storage:

1. Event-ID based: Stores attributes of specific spans (call_llm, send_data, tool_response) keyed by `gcp.vertex.agent.event_id`. This is used for debugging individual events.

2. Session-ID based: Stores all exported spans and maintains a mapping from `session_id` (extracted from `call_llm` spans) to a list of `trace_id`s. This is used for retrieving all spans related to a session.

## Constructors

ApiServerSpanExporter
Link copied to clipboard
constructor()

## Types

Companion
Link copied to clipboard
object Companion

## Functions

close
Link copied to clipboard
open override fun close()
export
Link copied to clipboard
open override fun export(spans: Collection<SpanData>): CompletableResultCode
flush
Link copied to clipboard
open override fun flush(): CompletableResultCode
getAllExportedSpans
Link copied to clipboard
fun getAllExportedSpans(): List<SpanData>
getEventTraceAttributes
Link copied to clipboard
fun getEventTraceAttributes(eventId: String): Map<String, Any>?
getSessionToTraceIdsMap
Link copied to clipboard
fun getSessionToTraceIdsMap(): Map<String, List<String>>
shutdown
Link copied to clipboard
open override fun shutdown(): CompletableResultCode