Documentation
¶
Index ¶
- func AttributeMap(attrs []KeyValue) map[string]string
- func ResourceServiceName(r Resource) string
- type AnyValue
- type ExportLogsRequest
- type ExportMetricsRequest
- type ExportTraceRequest
- type Gauge
- type Histogram
- type HistogramDataPoint
- type InstrumentationScope
- type KeyValue
- type LogRecord
- type Metric
- type NumberDataPoint
- type Resource
- type ResourceLog
- type ResourceMetric
- type ResourceSpan
- type ScopeLog
- type ScopeMetric
- type ScopeSpan
- type Server
- type Span
- type SpanEvent
- type SpanStatus
- type Sum
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AttributeMap ¶
AttributeMap converts a slice of KeyValue pairs to a map[string]string.
func ResourceServiceName ¶
ResourceServiceName extracts the "service.name" attribute from a Resource. Returns "unknown" if not found.
Types ¶
type AnyValue ¶
type AnyValue struct {
StringValue *string `json:"stringValue,omitempty"`
IntValue *string `json:"intValue,omitempty"` // JSON encodes int64 as string
DoubleValue *float64 `json:"doubleValue,omitempty"`
BoolValue *bool `json:"boolValue,omitempty"`
}
AnyValue is an OTLP polymorphic value.
type ExportLogsRequest ¶
type ExportLogsRequest struct {
ResourceLogs []ResourceLog `json:"resourceLogs"`
}
ExportLogsRequest is the top-level OTLP logs export payload.
type ExportMetricsRequest ¶
type ExportMetricsRequest struct {
ResourceMetrics []ResourceMetric `json:"resourceMetrics"`
}
ExportMetricsRequest is the top-level OTLP metrics export payload.
type ExportTraceRequest ¶
type ExportTraceRequest struct {
ResourceSpans []ResourceSpan `json:"resourceSpans"`
}
ExportTraceRequest is the top-level OTLP trace export payload.
type Gauge ¶
type Gauge struct {
DataPoints []NumberDataPoint `json:"dataPoints"`
}
Gauge represents a gauge metric.
type Histogram ¶
type Histogram struct {
DataPoints []HistogramDataPoint `json:"dataPoints"`
AggregationTemporality int `json:"aggregationTemporality"`
}
Histogram represents a histogram metric.
type HistogramDataPoint ¶
type HistogramDataPoint struct {
Attributes []KeyValue `json:"attributes"`
TimeUnixNano string `json:"timeUnixNano"`
Count uint64 `json:"count"`
Sum *float64 `json:"sum,omitempty"`
BucketCounts []uint64 `json:"bucketCounts"`
ExplicitBounds []float64 `json:"explicitBounds"`
Min *float64 `json:"min,omitempty"`
Max *float64 `json:"max,omitempty"`
}
HistogramDataPoint is a single data point for histogram metrics.
type InstrumentationScope ¶
InstrumentationScope identifies the instrumentation library.
type LogRecord ¶
type LogRecord struct {
TimeUnixNano string `json:"timeUnixNano"`
ObservedTimeUnixNano string `json:"observedTimeUnixNano"`
SeverityNumber int `json:"severityNumber"`
SeverityText string `json:"severityText"`
Body AnyValue `json:"body"`
Attributes []KeyValue `json:"attributes"`
TraceID string `json:"traceId"`
SpanID string `json:"spanId"`
}
LogRecord represents a single OTLP log record.
type Metric ¶
type Metric struct {
Name string `json:"name"`
Description string `json:"description"`
Unit string `json:"unit"`
Gauge *Gauge `json:"gauge,omitempty"`
Sum *Sum `json:"sum,omitempty"`
Histogram *Histogram `json:"histogram,omitempty"`
}
Metric represents a single OTLP metric.
type NumberDataPoint ¶
type NumberDataPoint struct {
Attributes []KeyValue `json:"attributes"`
TimeUnixNano string `json:"timeUnixNano"`
AsDouble *float64 `json:"asDouble,omitempty"`
AsInt *string `json:"asInt,omitempty"` // OTLP JSON encodes int64 as string
}
NumberDataPoint is a single data point for gauge/sum metrics.
type Resource ¶
type Resource struct {
Attributes []KeyValue `json:"attributes"`
}
Resource describes the entity producing telemetry.
type ResourceLog ¶
type ResourceLog struct {
Resource Resource `json:"resource"`
ScopeLogs []ScopeLog `json:"scopeLogs"`
}
ResourceLog groups log records by originating resource.
type ResourceMetric ¶
type ResourceMetric struct {
Resource Resource `json:"resource"`
ScopeMetrics []ScopeMetric `json:"scopeMetrics"`
}
ResourceMetric groups metrics by originating resource.
type ResourceSpan ¶
type ResourceSpan struct {
Resource Resource `json:"resource"`
ScopeSpans []ScopeSpan `json:"scopeSpans"`
}
ResourceSpan groups spans by originating resource.
type ScopeLog ¶
type ScopeLog struct {
Scope InstrumentationScope `json:"scope"`
LogRecords []LogRecord `json:"logRecords"`
}
ScopeLog groups log records by instrumentation scope.
type ScopeMetric ¶
type ScopeMetric struct {
Scope InstrumentationScope `json:"scope"`
Metrics []Metric `json:"metrics"`
}
ScopeMetric groups metrics by instrumentation scope.
type ScopeSpan ¶
type ScopeSpan struct {
Scope InstrumentationScope `json:"scope"`
Spans []Span `json:"spans"`
}
ScopeSpan groups spans by instrumentation scope.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server handles OTLP/HTTP ingestion for traces, metrics, and logs.
func (*Server) RegisterGRPC ¶
RegisterGRPC registers the OTLP Trace/Metrics/Logs collector services on the given gRPC server. They share the exact ingestion pipeline as the HTTP server: each proto request is rendered to OTLP-JSON via protojson, decoded into the server's existing request structs, and run through convertTraces / ingestMetrics / ingestLogs.
type Span ¶
type Span struct {
TraceID string `json:"traceId"`
SpanID string `json:"spanId"`
ParentSpanID string `json:"parentSpanId"`
Name string `json:"name"`
Kind int `json:"kind"` // 0=unspecified,1=internal,2=server,3=client,4=producer,5=consumer
StartTimeUnixNano string `json:"startTimeUnixNano"`
EndTimeUnixNano string `json:"endTimeUnixNano"`
Attributes []KeyValue `json:"attributes"`
Status SpanStatus `json:"status"`
Events []SpanEvent `json:"events"`
}
Span represents a single OTLP span.
type SpanEvent ¶
type SpanEvent struct {
TimeUnixNano string `json:"timeUnixNano"`
Name string `json:"name"`
Attributes []KeyValue `json:"attributes"`
}
SpanEvent represents a timed event within a span.
type SpanStatus ¶
type SpanStatus struct {
Code int `json:"code"` // 0=unset,1=ok,2=error
Message string `json:"message"`
}
SpanStatus represents the status of a span.
type Sum ¶
type Sum struct {
DataPoints []NumberDataPoint `json:"dataPoints"`
AggregationTemporality int `json:"aggregationTemporality"`
IsMonotonic bool `json:"isMonotonic"`
}
Sum represents a sum (counter) metric.