Documentation
¶
Overview ¶
Package otlpemit sends a rows file to an OpenTelemetry backend as traces over OTLP/HTTP: one span per model request.
Token counts travel as integers under the OpenTelemetry GenAI attributes. A request's cost travels as three strings, costroid.cost.amount, costroid.cost.currency and costroid.cost.basis, so no backend reads it as a float and rounds it. Amounts are summed only within one request, whose rows share one currency.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FromEnvironment ¶
FromEnvironment reads the OTLP exporter variables. A value the specification says to ignore is read as unset and returned as a warning. An endpoint that is not http or https, the grpc protocol and a certificate that does not load are errors.
Types ¶
type Config ¶
type Config struct {
Endpoint *url.URL
// Headers are sent with every request. Their values are credentials as
// often as not, so nothing prints them.
Headers [][2]string
Protocol Protocol
Timeout time.Duration
Gzip bool
// TLS is nil unless a certificate variable is set.
TLS *tls.Config
}
Config is where and how the spans go.
type Emitter ¶
type Emitter struct {
Config Config
Version string
// Sleep waits between tries. Nil waits on a timer.
Sleep func(context.Context, time.Duration) error
}
Emitter sends rows as spans.
type RefusedError ¶
RefusedError is an endpoint that answered a request with a status other than 2xx, after any retries. The spans of that request were not taken.
func (*RefusedError) Error ¶
func (e *RefusedError) Error() string
type Result ¶
type Result struct {
Rows, Spans int
// Rejected counts the spans an endpoint answered as refused in a partial
// success, and Message is its reason, cleaned of control characters.
Rejected int64
Message string
}
Result is what one Emit sent.
type Warning ¶
type Warning struct {
Variable string
// Value and Want are empty for an entry of the headers, whose values are
// credentials as often as not.
Value, Want string
}
Warning is a variable whose value the exporter specification says to ignore: it was read as unset, or one entry of it was.