signalbuilder

package
v0.34.0 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2026 License: Apache-2.0 Imports: 13 Imported by: 4

Documentation

Overview

Package signalbuilder provides efficient builders for constructing OpenTelemetry signals (metrics, traces, and logs) with automatic deduplication and structured organization.

Overview

SignalBuilder optimizes the creation of OpenTelemetry pdata structures by:

  • Deduplicating resources based on attributes using fast hash-based lookups
  • Organizing data hierarchically: Resource → Scope → Signal
  • Minimizing memory allocation through internal caching
  • Providing both protobuf and structured (JSON/YAML) output formats

Architecture

The package follows OpenTelemetry's data model hierarchy:

Resource (service.name, host.name, etc.)
  ├── Scope (instrumentation library)
      ├── Metrics/Traces/Logs

Each builder maintains a hash map of resources to ensure exactly one Resource object per unique set of attributes, and exactly one Scope per resource.

Supported Signal Types

  • Metrics: All OTEL metric types (Gauge, Sum, Histogram, ExponentialHistogram, Summary)
  • Traces: Span data with full trace context support
  • Logs: Structured log records with severity levels and attributes

Usage Examples

Basic metrics usage:

builder := NewMetricsBuilder()
resourceAttrs := map[string]any{"service.name": "my-service"}
scopeAttrs := map[string]any{"version": "1.0.0"}

// Add a gauge metric
builder.AddGauge("cpu_usage", "percent", "CPU usage percentage",
    resourceAttrs, "otelcol", "0.1.0", "", scopeAttrs,
    map[string]any{"cpu": "cpu0"}, 85.5, time.Now().UnixNano())

Export to different formats:

pmetrics := builder.Build()                    // OpenTelemetry pdata
jsonBytes := builder.BuildStructuredJSON()     // JSON format
yamlBytes := builder.BuildStructuredYAML()     // YAML format

Configuration Notes

  • Sum metrics default to non-monotonic delta aggregation
  • Histogram metrics use explicit bounds
  • ExponentialHistogram metrics use base-2 exponential buckets
  • All timestamps should be in nanoseconds since Unix epoch

Thread Safety

This package is NOT thread-safe. Use separate builder instances for concurrent operations or provide external synchronization.

Performance Characteristics

  • O(1) resource lookup via hash maps
  • Memory-efficient through resource/scope deduplication
  • Optimized for high-throughput telemetry data processing

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ExponentialBuckets added in v0.30.21

type ExponentialBuckets struct {
	Offset       int32    `json:"offset,omitempty" yaml:"offset,omitempty"`
	BucketCounts []uint64 `json:"bucket_counts,omitempty" yaml:"bucket_counts,omitempty"`
}

ExponentialBuckets represents exponential histogram buckets

type ExponentialHistogramDataPoint added in v0.30.21

type ExponentialHistogramDataPoint struct {
	Attributes      map[string]any      `json:"attributes,omitempty" yaml:"attributes,omitempty"`
	StartTimestamp  int64               `json:"start_timestamp,omitempty" yaml:"start_timestamp,omitempty"`
	Timestamp       int64               `json:"timestamp" yaml:"timestamp"`
	Count           uint64              `json:"count" yaml:"count"`
	Sum             *float64            `json:"sum,omitempty" yaml:"sum,omitempty"`
	Min             *float64            `json:"min,omitempty" yaml:"min,omitempty"`
	Max             *float64            `json:"max,omitempty" yaml:"max,omitempty"`
	Scale           int32               `json:"scale,omitempty" yaml:"scale,omitempty"`
	ZeroCount       uint64              `json:"zero_count,omitempty" yaml:"zero_count,omitempty"`
	PositiveBuckets *ExponentialBuckets `json:"positive_buckets,omitempty" yaml:"positive_buckets,omitempty"`
	NegativeBuckets *ExponentialBuckets `json:"negative_buckets,omitempty" yaml:"negative_buckets,omitempty"`
	Flags           uint32              `json:"flags,omitempty" yaml:"flags,omitempty"`
}

ExponentialHistogramDataPoint represents an exponential histogram data point

type ExponentialHistogramMetric added in v0.30.21

type ExponentialHistogramMetric struct {
	AggregationTemporality string                          `json:"aggregation_temporality,omitempty" yaml:"aggregation_temporality,omitempty"`
	DataPoints             []ExponentialHistogramDataPoint `json:"data_points" yaml:"data_points"`
}

ExponentialHistogramMetric represents an exponential histogram metric

type GaugeMetric added in v0.30.21

type GaugeMetric struct {
	DataPoints []NumberDataPoint `json:"data_points" yaml:"data_points"`
}

GaugeMetric represents a gauge metric

type HistogramDataPoint added in v0.30.21

type HistogramDataPoint struct {
	Attributes     map[string]any `json:"attributes,omitempty" yaml:"attributes,omitempty"`
	StartTimestamp int64          `json:"start_timestamp,omitempty" yaml:"start_timestamp,omitempty"`
	Timestamp      int64          `json:"timestamp" yaml:"timestamp"`
	Count          uint64         `json:"count" yaml:"count"`
	Sum            *float64       `json:"sum,omitempty" yaml:"sum,omitempty"`
	Min            *float64       `json:"min,omitempty" yaml:"min,omitempty"`
	Max            *float64       `json:"max,omitempty" yaml:"max,omitempty"`
	BucketCounts   []uint64       `json:"bucket_counts,omitempty" yaml:"bucket_counts,omitempty"`
	ExplicitBounds []float64      `json:"explicit_bounds,omitempty" yaml:"explicit_bounds,omitempty"`
	Flags          uint32         `json:"flags,omitempty" yaml:"flags,omitempty"`
}

HistogramDataPoint represents a histogram data point

type HistogramMetric added in v0.30.21

type HistogramMetric struct {
	AggregationTemporality string               `json:"aggregation_temporality,omitempty" yaml:"aggregation_temporality,omitempty"`
	DataPoints             []HistogramDataPoint `json:"data_points" yaml:"data_points"`
}

HistogramMetric represents a histogram metric

type LogBuilder added in v0.30.0

type LogBuilder struct {
	// contains filtered or unexported fields
}

func NewLogBuilder added in v0.30.0

func NewLogBuilder() *LogBuilder

func (*LogBuilder) Add added in v0.30.21

func (lb *LogBuilder) Add(rl *ResourceLogs) error

func (*LogBuilder) AddFromYAML added in v0.30.21

func (lb *LogBuilder) AddFromYAML(data []byte, opts ...ParseOptions) error

AddFromYAML parses YAML data and adds the logs to the builder. Note: JSON is a subset of YAML, so this function can also accept JSON format data.

func (*LogBuilder) Build added in v0.30.0

func (lb *LogBuilder) Build() plog.Logs

func (*LogBuilder) Resource added in v0.30.0

func (lb *LogBuilder) Resource(rattr pcommon.Map) *LogResourceBuilder

type LogRecord added in v0.30.21

type LogRecord struct {
	Timestamp              int64          `json:"timestamp,omitempty" yaml:"timestamp,omitempty"`
	ObservedTimestamp      int64          `json:"observed_timestamp,omitempty" yaml:"observed_timestamp,omitempty"`
	SeverityText           string         `json:"severity_text,omitempty" yaml:"severity_text,omitempty"`
	SeverityNumber         int32          `json:"severity_number,omitempty" yaml:"severity_number,omitempty"`
	Body                   any            `json:"body" yaml:"body"`
	Attributes             map[string]any `json:"attributes,omitempty" yaml:"attributes,omitempty"`
	TraceID                string         `json:"trace_id,omitempty" yaml:"trace_id,omitempty"`
	SpanID                 string         `json:"span_id,omitempty" yaml:"span_id,omitempty"`
	Flags                  uint32         `json:"flags,omitempty" yaml:"flags,omitempty"`
	DroppedAttributesCount uint32         `json:"dropped_attributes_count,omitempty" yaml:"dropped_attributes_count,omitempty"`
	EventName              string         `json:"event_name,omitempty" yaml:"event_name,omitempty"`
}

LogRecord represents a single log entry

type LogResourceBuilder added in v0.30.0

type LogResourceBuilder struct {
	// contains filtered or unexported fields
}

func NewLogResourceBuilder added in v0.30.0

func NewLogResourceBuilder(resource plog.ResourceLogs) *LogResourceBuilder

func (*LogResourceBuilder) Scope added in v0.30.0

func (lrb *LogResourceBuilder) Scope(sattr pcommon.Map) *LogScopeBuilder

func (*LogResourceBuilder) ScopeWithInfo added in v0.30.21

func (lrb *LogResourceBuilder) ScopeWithInfo(name, version, schemaURL string, sattr pcommon.Map) *LogScopeBuilder

type LogScopeBuilder added in v0.30.0

type LogScopeBuilder struct {
	// contains filtered or unexported fields
}

func NewLogScopeBuilder added in v0.30.0

func NewLogScopeBuilder(scope plog.ScopeLogs) *LogScopeBuilder

func (*LogScopeBuilder) AddRecord added in v0.30.0

func (lsb *LogScopeBuilder) AddRecord() plog.LogRecord

func (*LogScopeBuilder) Get added in v0.30.0

func (lsb *LogScopeBuilder) Get() plog.ScopeLogs

type Metric added in v0.30.21

type Metric struct {
	Name                 string                      `json:"name" yaml:"name"`
	Description          string                      `json:"description,omitempty" yaml:"description,omitempty"`
	Unit                 string                      `json:"unit,omitempty" yaml:"unit,omitempty"`
	Type                 string                      `json:"type" yaml:"type"`
	Gauge                *GaugeMetric                `json:"gauge,omitempty" yaml:"gauge,omitempty"`
	Sum                  *SumMetric                  `json:"sum,omitempty" yaml:"sum,omitempty"`
	Summary              *SummaryMetric              `json:"summary,omitempty" yaml:"summary,omitempty"`
	Histogram            *HistogramMetric            `json:"histogram,omitempty" yaml:"histogram,omitempty"`
	ExponentialHistogram *ExponentialHistogramMetric `json:"exponential_histogram,omitempty" yaml:"exponential_histogram,omitempty"`
}

Metric represents a single metric

type MetricDatapointBuilder

type MetricDatapointBuilder interface {
	Datapoint(attr pcommon.Map, timestamp pcommon.Timestamp) (dp pmetric.NumberDataPoint, ty pmetric.MetricType, isNew bool)
}

type MetricExponentialHistogramBuilder added in v0.30.21

type MetricExponentialHistogramBuilder struct {
	// contains filtered or unexported fields
}

func NewMetricExponentialHistogramBuilder added in v0.30.21

func NewMetricExponentialHistogramBuilder(metric pmetric.Metric) *MetricExponentialHistogramBuilder

func (*MetricExponentialHistogramBuilder) Datapoint added in v0.30.21

func (*MetricExponentialHistogramBuilder) SetDescription added in v0.30.21

func (mehb *MetricExponentialHistogramBuilder) SetDescription(description string)

func (*MetricExponentialHistogramBuilder) SetUnit added in v0.30.21

func (mehb *MetricExponentialHistogramBuilder) SetUnit(unit string)

type MetricGaugeBuilder

type MetricGaugeBuilder struct {
	// contains filtered or unexported fields
}

func NewMetricGaugeBuilder

func NewMetricGaugeBuilder(metric pmetric.Metric) *MetricGaugeBuilder

func (*MetricGaugeBuilder) Datapoint

func (mb *MetricGaugeBuilder) Datapoint(attr pcommon.Map, timestamp pcommon.Timestamp) (dp pmetric.NumberDataPoint, ty pmetric.MetricType, isNew bool)

func (*MetricGaugeBuilder) SetDescription added in v0.30.21

func (mgb *MetricGaugeBuilder) SetDescription(description string)

func (*MetricGaugeBuilder) SetUnit added in v0.30.21

func (mgb *MetricGaugeBuilder) SetUnit(unit string)

type MetricHistogramBuilder added in v0.30.21

type MetricHistogramBuilder struct {
	// contains filtered or unexported fields
}

func NewMetricHistogramBuilder added in v0.30.21

func NewMetricHistogramBuilder(metric pmetric.Metric) *MetricHistogramBuilder

func (*MetricHistogramBuilder) Datapoint added in v0.30.21

func (*MetricHistogramBuilder) SetDescription added in v0.30.21

func (mhb *MetricHistogramBuilder) SetDescription(description string)

func (*MetricHistogramBuilder) SetUnit added in v0.30.21

func (mhb *MetricHistogramBuilder) SetUnit(unit string)

type MetricResourceBuilder

type MetricResourceBuilder struct {
	// contains filtered or unexported fields
}

func NewMetricResourceBuilder

func NewMetricResourceBuilder(resource pmetric.ResourceMetrics) *MetricResourceBuilder

func (*MetricResourceBuilder) Scope

func (*MetricResourceBuilder) ScopeWithInfo added in v0.30.21

func (mrb *MetricResourceBuilder) ScopeWithInfo(name, version, schemaURL string, sattr pcommon.Map) *MetricScopeBuilder

type MetricScopeBuilder

type MetricScopeBuilder struct {
	// contains filtered or unexported fields
}

func NewMetricScopeBuilder

func NewMetricScopeBuilder(scope pmetric.ScopeMetrics) *MetricScopeBuilder

func (*MetricScopeBuilder) ExponentialHistogram added in v0.30.21

func (msb *MetricScopeBuilder) ExponentialHistogram(name string) *MetricExponentialHistogramBuilder

func (*MetricScopeBuilder) Gauge added in v0.30.21

func (msb *MetricScopeBuilder) Gauge(name string) *MetricGaugeBuilder

func (*MetricScopeBuilder) Get added in v0.15.1

func (*MetricScopeBuilder) Histogram added in v0.30.21

func (msb *MetricScopeBuilder) Histogram(name string) *MetricHistogramBuilder

func (*MetricScopeBuilder) Metric

func (*MetricScopeBuilder) Sum added in v0.30.21

func (msb *MetricScopeBuilder) Sum(name string) *MetricSumBuilder

func (*MetricScopeBuilder) Summary added in v0.30.21

func (msb *MetricScopeBuilder) Summary(name string) *MetricSummaryBuilder

type MetricSumBuilder

type MetricSumBuilder struct {
	// contains filtered or unexported fields
}

func NewMetricSumBuilder

func NewMetricSumBuilder(metric pmetric.Metric) *MetricSumBuilder

func (*MetricSumBuilder) Datapoint

func (mb *MetricSumBuilder) Datapoint(attr pcommon.Map, timestamp pcommon.Timestamp) (dp pmetric.NumberDataPoint, ty pmetric.MetricType, isNew bool)

func (*MetricSumBuilder) SetAggregationTemporality added in v0.32.2

func (msb *MetricSumBuilder) SetAggregationTemporality(at pmetric.AggregationTemporality)

func (*MetricSumBuilder) SetDescription added in v0.30.21

func (msb *MetricSumBuilder) SetDescription(description string)

func (*MetricSumBuilder) SetUnit added in v0.30.21

func (msb *MetricSumBuilder) SetUnit(unit string)

type MetricSummaryBuilder added in v0.30.21

type MetricSummaryBuilder struct {
	// contains filtered or unexported fields
}

func NewMetricSummaryBuilder added in v0.30.21

func NewMetricSummaryBuilder(metric pmetric.Metric) *MetricSummaryBuilder

func (*MetricSummaryBuilder) Datapoint added in v0.30.21

func (msb *MetricSummaryBuilder) Datapoint(attr pcommon.Map, timestamp pcommon.Timestamp) pmetric.SummaryDataPoint

func (*MetricSummaryBuilder) SetDescription added in v0.30.21

func (msb *MetricSummaryBuilder) SetDescription(description string)

func (*MetricSummaryBuilder) SetUnit added in v0.30.21

func (msb *MetricSummaryBuilder) SetUnit(unit string)

type MetricsBuilder

type MetricsBuilder struct {
	// contains filtered or unexported fields
}

func NewMetricsBuilder

func NewMetricsBuilder() *MetricsBuilder

func (*MetricsBuilder) Add added in v0.30.21

func (mb *MetricsBuilder) Add(rm *ResourceMetrics) error

func (*MetricsBuilder) AddFromYAML added in v0.30.21

func (mb *MetricsBuilder) AddFromYAML(data []byte, opts ...ParseOptions) error

AddFromYAML parses YAML data and adds the metrics to the builder. Note: JSON is a subset of YAML, so this function can also accept JSON format data.

func (*MetricsBuilder) Build

func (mb *MetricsBuilder) Build() pmetric.Metrics

func (*MetricsBuilder) Resource

func (mb *MetricsBuilder) Resource(rattr pcommon.Map) *MetricResourceBuilder

type NumberDataPoint added in v0.30.21

type NumberDataPoint struct {
	Attributes     map[string]any `json:"attributes,omitempty" yaml:"attributes,omitempty"`
	StartTimestamp int64          `json:"start_timestamp,omitempty" yaml:"start_timestamp,omitempty"`
	Timestamp      int64          `json:"timestamp" yaml:"timestamp"`
	Value          float64        `json:"value" yaml:"value"`
	Flags          uint32         `json:"flags,omitempty" yaml:"flags,omitempty"`
}

NumberDataPoint represents a number data point

type ParseOptions added in v0.30.21

type ParseOptions struct {
	StrictMode bool // If true, fail on unknown fields (default: true)
}

ParseOptions controls parsing behavior

type QuantileValue added in v0.30.21

type QuantileValue struct {
	Quantile float64 `json:"quantile" yaml:"quantile"`
	Value    float64 `json:"value" yaml:"value"`
}

QuantileValue represents a quantile value in a summary

type ResourceLogs added in v0.30.21

type ResourceLogs struct {
	Resource  map[string]any `json:"resource,omitempty" yaml:"resource,omitempty"`
	ScopeLogs []ScopeLogs    `json:"scopes" yaml:"scopes"`
}

ResourceLogs represents logs grouped by resource

func MustParseLogs added in v0.30.21

func MustParseLogs(data []byte, opts ...ParseOptions) *ResourceLogs

MustParseLogs parses YAML bytes into ResourceLogs, panicking on error. This is useful for unit tests where parsing is expected to succeed.

func ParseLogs added in v0.30.21

func ParseLogs(data []byte, opts ...ParseOptions) (*ResourceLogs, error)

ParseLogs parses YAML (or JSON) data into ResourceLogs

type ResourceMetrics added in v0.30.21

type ResourceMetrics struct {
	Resource     map[string]any `json:"resource,omitempty" yaml:"resource,omitempty"`
	ScopeMetrics []ScopeMetrics `json:"scopes" yaml:"scopes"`
}

ResourceMetrics represents metrics grouped by resource

func MustParseMetrics added in v0.30.21

func MustParseMetrics(data []byte, opts ...ParseOptions) *ResourceMetrics

MustParseMetrics parses YAML bytes into ResourceMetrics, panicking on error. This is useful for unit tests where parsing is expected to succeed.

func ParseMetrics added in v0.30.21

func ParseMetrics(data []byte, opts ...ParseOptions) (*ResourceMetrics, error)

ParseMetrics parses YAML (or JSON) data into ResourceMetrics

type ResourceTraces added in v0.30.21

type ResourceTraces struct {
	Resource    map[string]any `json:"resource,omitempty" yaml:"resource,omitempty"`
	ScopeTraces []ScopeTraces  `json:"scopes" yaml:"scopes"`
}

ResourceTraces represents traces grouped by resource

func MustParseTraces added in v0.30.21

func MustParseTraces(data []byte, opts ...ParseOptions) *ResourceTraces

MustParseTraces parses YAML bytes into ResourceTraces, panicking on error. This is useful for unit tests where parsing is expected to succeed.

func ParseTraces added in v0.30.21

func ParseTraces(data []byte, opts ...ParseOptions) (*ResourceTraces, error)

ParseTraces parses YAML (or JSON) data into ResourceTraces

type ScopeLogs added in v0.30.21

type ScopeLogs struct {
	Name       string         `json:"name,omitempty" yaml:"name,omitempty"`
	Version    string         `json:"version,omitempty" yaml:"version,omitempty"`
	SchemaURL  string         `json:"schema_url,omitempty" yaml:"schema_url,omitempty"`
	Attributes map[string]any `json:"attributes,omitempty" yaml:"attributes,omitempty"`
	LogRecords []LogRecord    `json:"records" yaml:"records"`
}

ScopeLogs represents logs grouped by instrumentation scope

type ScopeMetrics added in v0.30.21

type ScopeMetrics struct {
	Name       string         `json:"name,omitempty" yaml:"name,omitempty"`
	Version    string         `json:"version,omitempty" yaml:"version,omitempty"`
	SchemaURL  string         `json:"schema_url,omitempty" yaml:"schema_url,omitempty"`
	Attributes map[string]any `json:"attributes,omitempty" yaml:"attributes,omitempty"`
	Metrics    []Metric       `json:"metrics" yaml:"metrics"`
}

ScopeMetrics represents metrics grouped by instrumentation scope

type ScopeTraces added in v0.30.21

type ScopeTraces struct {
	Name       string         `json:"name,omitempty" yaml:"name,omitempty"`
	Version    string         `json:"version,omitempty" yaml:"version,omitempty"`
	SchemaURL  string         `json:"schema_url,omitempty" yaml:"schema_url,omitempty"`
	Attributes map[string]any `json:"attributes,omitempty" yaml:"attributes,omitempty"`
	Spans      []Span         `json:"spans" yaml:"spans"`
}

ScopeTraces represents traces grouped by instrumentation scope

type Span added in v0.30.21

type Span struct {
	TraceID                string         `json:"trace_id,omitempty" yaml:"trace_id,omitempty"`
	SpanID                 string         `json:"span_id,omitempty" yaml:"span_id,omitempty"`
	ParentSpanID           string         `json:"parent_span_id,omitempty" yaml:"parent_span_id,omitempty"`
	Name                   string         `json:"name" yaml:"name"`
	Kind                   int32          `json:"kind,omitempty" yaml:"kind,omitempty"`
	StartTimestamp         int64          `json:"start_timestamp,omitempty" yaml:"start_timestamp,omitempty"`
	EndTimestamp           int64          `json:"end_timestamp,omitempty" yaml:"end_timestamp,omitempty"`
	Attributes             map[string]any `json:"attributes,omitempty" yaml:"attributes,omitempty"`
	DroppedAttributesCount uint32         `json:"dropped_attributes_count,omitempty" yaml:"dropped_attributes_count,omitempty"`
	Events                 []SpanEvent    `json:"events,omitempty" yaml:"events,omitempty"`
	DroppedEventsCount     uint32         `json:"dropped_events_count,omitempty" yaml:"dropped_events_count,omitempty"`
	Links                  []SpanLink     `json:"links,omitempty" yaml:"links,omitempty"`
	DroppedLinksCount      uint32         `json:"dropped_links_count,omitempty" yaml:"dropped_links_count,omitempty"`
	Status                 SpanStatus     `json:"status,omitempty" yaml:"status,omitempty"`
	Flags                  uint32         `json:"flags,omitempty" yaml:"flags,omitempty"`
}

Span represents a single span entry

type SpanEvent added in v0.30.21

type SpanEvent struct {
	Timestamp              int64          `json:"timestamp" yaml:"timestamp"`
	Name                   string         `json:"name" yaml:"name"`
	Attributes             map[string]any `json:"attributes,omitempty" yaml:"attributes,omitempty"`
	DroppedAttributesCount uint32         `json:"dropped_attributes_count,omitempty" yaml:"dropped_attributes_count,omitempty"`
}

SpanEvent represents a span event

type SpanLink struct {
	TraceID                string         `json:"trace_id" yaml:"trace_id"`
	SpanID                 string         `json:"span_id" yaml:"span_id"`
	TraceState             string         `json:"trace_state,omitempty" yaml:"trace_state,omitempty"`
	Attributes             map[string]any `json:"attributes,omitempty" yaml:"attributes,omitempty"`
	DroppedAttributesCount uint32         `json:"dropped_attributes_count,omitempty" yaml:"dropped_attributes_count,omitempty"`
}

SpanLink represents a span link

type SpanStatus added in v0.30.21

type SpanStatus struct {
	Code    int32  `json:"code,omitempty" yaml:"code,omitempty"`
	Message string `json:"message,omitempty" yaml:"message,omitempty"`
}

SpanStatus represents a span status

type SumMetric added in v0.30.21

type SumMetric struct {
	AggregationTemporality string            `json:"aggregation_temporality,omitempty" yaml:"aggregation_temporality,omitempty"`
	IsMonotonic            bool              `json:"is_monotonic,omitempty" yaml:"is_monotonic,omitempty"`
	DataPoints             []NumberDataPoint `json:"data_points" yaml:"data_points"`
}

SumMetric represents a sum metric

type SummaryDataPoint added in v0.30.21

type SummaryDataPoint struct {
	Attributes     map[string]any  `json:"attributes,omitempty" yaml:"attributes,omitempty"`
	StartTimestamp int64           `json:"start_timestamp,omitempty" yaml:"start_timestamp,omitempty"`
	Timestamp      int64           `json:"timestamp" yaml:"timestamp"`
	Count          uint64          `json:"count" yaml:"count"`
	Sum            float64         `json:"sum" yaml:"sum"`
	Quantiles      []QuantileValue `json:"quantiles,omitempty" yaml:"quantiles,omitempty"`
	Flags          uint32          `json:"flags,omitempty" yaml:"flags,omitempty"`
}

SummaryDataPoint represents a summary data point

type SummaryMetric added in v0.30.21

type SummaryMetric struct {
	DataPoints []SummaryDataPoint `json:"data_points" yaml:"data_points"`
}

SummaryMetric represents a summary metric

type TraceResourceBuilder added in v0.25.16

type TraceResourceBuilder struct {
	// contains filtered or unexported fields
}

func NewTraceResourceBuilder added in v0.25.16

func NewTraceResourceBuilder(resource ptrace.ResourceSpans) *TraceResourceBuilder

func (*TraceResourceBuilder) Scope added in v0.25.16

func (*TraceResourceBuilder) ScopeWithInfo added in v0.30.21

func (mrb *TraceResourceBuilder) ScopeWithInfo(name, version, schemaURL string, sattr pcommon.Map) *TraceScopeBuilder

type TraceScopeBuilder added in v0.25.16

type TraceScopeBuilder struct {
	// contains filtered or unexported fields
}

func NewTraceScopeBuilder added in v0.25.16

func NewTraceScopeBuilder(scope ptrace.ScopeSpans) *TraceScopeBuilder

func (*TraceScopeBuilder) AddSpan added in v0.25.16

func (msb *TraceScopeBuilder) AddSpan() ptrace.Span

func (*TraceScopeBuilder) Get added in v0.25.16

func (msb *TraceScopeBuilder) Get() ptrace.ScopeSpans

type TracesBuilder added in v0.25.16

type TracesBuilder struct {
	// contains filtered or unexported fields
}

func NewTracesBuilder added in v0.25.16

func NewTracesBuilder() *TracesBuilder

func (*TracesBuilder) Add added in v0.30.21

func (tb *TracesBuilder) Add(rt *ResourceTraces) error

func (*TracesBuilder) AddFromYAML added in v0.30.21

func (tb *TracesBuilder) AddFromYAML(data []byte, opts ...ParseOptions) error

AddFromYAML parses YAML data and adds the traces to the builder. Note: JSON is a subset of YAML, so this function can also accept JSON format data.

func (*TracesBuilder) Build added in v0.25.16

func (mb *TracesBuilder) Build() ptrace.Traces

func (*TracesBuilder) Resource added in v0.25.16

func (mb *TracesBuilder) Resource(rattr pcommon.Map) *TraceResourceBuilder

Jump to

Keyboard shortcuts

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