otlpingest

package
v1.6.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 5, 2026 License: Apache-2.0 Imports: 18 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package otlpingest decodes OTLP/HTTP trace exports into stored spans.

Index

Constants

View Source
const (
	EdgeOK      = "ok"
	EdgeErrors  = "errors"
	EdgeUnknown = "unknown"
)

Edge states. There is no state meaning healthy without evidence: a sample cut short with no error seen is unknown.

View Source
const MaxSpansPerRequest = 5000

MaxSpansPerRequest bounds one export, so a single request cannot be an unbounded write.

Variables

View Source
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.

View Source
var ErrTooMany = errors.New("otlp: too many records in one request")

ErrTooMany is returned when a request carries more records than the limit.

View Source
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

func DecodeTraces(contentType string, body []byte, resourceID string) ([]telemetry.Span, error)

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

type MapEdge

type MapEdge struct {
	From       string
	To         string
	Calls      int
	Errors     int
	ErrorShare float64
	P95Ms      float64
	State      string
}

MapEdge is the observed traffic from one app to another.

func BuildServiceMap

func BuildServiceMap(spans []telemetry.CallSpan, truncated bool) []MapEdge

BuildServiceMap folds call spans into app to app edges. Apps come only from the stored resource id (stamped from the ingest key), never from attributes. One call is one caller span per callee, so a callee repeating a parent id cannot inflate the count; latency is the caller's own span.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL