Documentation
¶
Overview ¶
Package otlpingest decodes OTLP/HTTP trace exports into stored spans.
Index ¶
- Constants
- Variables
- func DecodeLogs(contentType string, body []byte, resourceID string, maxRecords, maxLine int) ([]telemetry.LogEntry, error)
- func DecodeMetrics(contentType string, body []byte, resourceID string, maxPoints int) ([]telemetry.Sample, error)
- func DecodeTraces(contentType string, body []byte, resourceID string) ([]telemetry.Span, error)
Constants ¶
const MaxSpansPerRequest = 5000
MaxSpansPerRequest bounds one export, so a single request cannot be an unbounded write.
Variables ¶
var ErrNoValidSpans = errors.New("otlp: no span had a 16 byte trace id and an 8 byte span id")
ErrNoValidSpans is returned when an export held spans but none had valid ids, so the sender learns its ids are malformed instead of seeing success.
var ErrTooMany = errors.New("otlp: too many records in one request")
ErrTooMany is returned when a request carries more records than the limit.
var ErrUnsupportedType = errors.New("otlp: content type must be application/x-protobuf or application/json")
ErrUnsupportedType is returned for a content type that is neither OTLP protobuf nor OTLP JSON.
Functions ¶
func DecodeLogs ¶
func DecodeLogs(contentType string, body []byte, resourceID string, maxRecords, maxLine int) ([]telemetry.LogEntry, error)
DecodeLogs maps an OTLP logs export onto log entries for resourceID. Only the body text is kept: attributes may hold secrets and have no column.
func DecodeMetrics ¶
func DecodeMetrics(contentType string, body []byte, resourceID string, maxPoints int) ([]telemetry.Sample, error)
DecodeMetrics maps gauge, sum and histogram points onto samples named "otlp.<metric>". Attributes are dropped so cardinality stays bounded; two series that differ only by attributes share one name and the later point wins.
func DecodeTraces ¶
DecodeTraces parses one export request and returns its spans stamped with resourceID. The sender's own service.name is kept as an attribute but never decides which app the spans belong to.
Types ¶
This section is empty.