telemetry

package
v0.0.0-...-af38ec4 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrEmptySpansSlice = errors.New("slice of spans associated with this traceID must not be empty")
View Source
var ErrTraceIDMismatch = errors.New("traceID mismatch between TraceStore.traceMap and TraceStore.traceQueue")
View Source
var ErrTraceIDNotFound = errors.New("traceID not found")
View Source
var WarningInvalidServiceName = errors.New("warning: Resource.Attributes['service.name'] must be a string value that helps to distinguish a group of services")
View Source
var WarningMissingRootSpan = errors.New("warning: trace is incomplete - no root span found")

Functions

This section is empty.

Types

type EventData

type EventData struct {
	Name                   string                 `json:"name"`
	Timestamp              time.Time              `json:"timestamp"`
	Attributes             map[string]interface{} `json:"attributes"`
	DroppedAttributesCount uint32                 `json:"droppedAttributesCount"`
}

type LinkData

type LinkData struct {
	TraceID                string                 `json:"traceID"`
	SpanID                 string                 `json:"spanID"`
	TraceState             string                 `json:"traceState"`
	Attributes             map[string]interface{} `json:"attributes"`
	DroppedAttributesCount uint32                 `json:"droppedAttributesCount"`
}

type LogData

type LogData struct {
	Body                   string                 `json:"body,omitempty"`
	TraceID                string                 `json:"traceID,omitempty"`
	SpanID                 string                 `json:"spanID,omitempty"`
	Timestamp              time.Time              `json:"timestamp,omitempty"`
	ObservedTimestamp      time.Time              `json:"observedTimestamp,omitempty"`
	Attributes             map[string]interface{} `json:"attributes,omitempty"`
	SeverityText           string                 `json:"severityText,omitempty"`
	SeverityNumber         plog.SeverityNumber    `json:"severityNumber,omitempty"`
	DroppedAttributesCount uint32                 `json:"droppedAttributeCount,omitempty"`
	Flags                  plog.LogRecordFlags    `json:"flags,omitempty"`
	Resource               *ResourceData          `json:"resource"`
	Scope                  *ScopeData             `json:"scope"`
}

func (LogData) ID

func (l LogData) ID() string

type MetricData

type MetricData struct {
	Name        string             `json:"name,omitempty"`
	Description string             `json:"description,omitempty"`
	Unit        string             `json:"unit,omitempty"`
	Type        pmetric.MetricType `json:"type,omitempty"`
	// add datapoints
	Resource *ResourceData `json:"resource"`
	Scope    *ScopeData    `json:"scope"`
	Received time.Time     `json:"-"`
}

func (MetricData) ID

func (m MetricData) ID() string

type RecentSummaries

type RecentSummaries struct {
	TraceSummaries []TraceSummary `json:"traceSummaries"`
}

type RecentTelemetrySummaries

type RecentTelemetrySummaries struct {
	Summaries []TelemetrySummary `json:"summaries"`
}

type ResourceData

type ResourceData struct {
	Attributes             map[string]interface{} `json:"attributes"`
	DroppedAttributesCount uint32                 `json:"droppedAttributesCount"`
}

type ScopeData

type ScopeData struct {
	Name                   string                 `json:"name"`
	Version                string                 `json:"version"`
	Attributes             map[string]interface{} `json:"attributes"`
	DroppedAttributesCount uint32                 `json:"droppedAttributesCount"`
}

type SpanData

type SpanData struct {
	TraceID      string `json:"traceID"`
	TraceState   string `json:"traceState"`
	SpanID       string `json:"spanID"`
	ParentSpanID string `json:"parentSpanID"`

	Name      string    `json:"name"`
	Kind      string    `json:"kind"`
	StartTime time.Time `json:"startTime"`
	EndTime   time.Time `json:"endTime"`

	Attributes map[string]interface{} `json:"attributes"`
	Events     []EventData            `json:"events"`
	Links      []LinkData             `json:"links"`
	Resource   *ResourceData          `json:"resource"`
	Scope      *ScopeData             `json:"scope"`

	DroppedAttributesCount uint32 `json:"droppedAttributesCount"`
	DroppedEventsCount     uint32 `json:"droppedEventsCount"`
	DroppedLinksCount      uint32 `json:"droppedLinksCount"`

	StatusCode    string `json:"statusCode"`
	StatusMessage string `json:"statusMessage"`
}

func (*SpanData) GetServiceName

func (spanData *SpanData) GetServiceName() string

Get the service name of a span with respect to OTEL semanic conventions: service.name must be a string value having a meaning that helps to distinguish a group of services. Read more here: (https://opentelemetry.io/docs/reference/specification/resource/semantic_conventions/#service)

type Store

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

func NewTelemetryStore

func NewTelemetryStore(maxQueueSize int) *Store

func (*Store) AddLog

func (store *Store) AddLog(_ context.Context, ld LogData)

func (*Store) AddMetric

func (store *Store) AddMetric(_ context.Context, md MetricData)

func (*Store) AddSpan

func (store *Store) AddSpan(_ context.Context, spanData SpanData)

func (*Store) Clear

func (store *Store) Clear()

func (*Store) GetRecentTelemetry

func (store *Store) GetRecentTelemetry(traceCount int) []TelemetryData

func (*Store) GetTelemetry

func (store *Store) GetTelemetry(id string) (TelemetryData, error)

type TelemetryData

type TelemetryData struct {
	ID     string     `json:"ID"`
	Type   string     `json:"type"`
	Metric MetricData `json:"metric,omitempty"`
	Log    LogData    `json:"log,omitempty"`
	Trace  TraceData  `json:"trace,omitempty"`
}

func (*TelemetryData) GetSummary

func (t *TelemetryData) GetSummary() TelemetrySummary

type TelemetrySummary

type TelemetrySummary struct {
	ServiceName string `json:"serviceName"`
	Type        string `json:"type"`
	ID          string `json:"ID"`
}

type TraceData

type TraceData struct {
	TraceID string     `json:"traceID"`
	Spans   []SpanData `json:"spans"`
}

func (*TraceData) GetTraceSummary

func (trace *TraceData) GetTraceSummary() TraceSummary

type TraceSummary

type TraceSummary struct {
	HasRootSpan bool `json:"hasRootSpan"`

	RootServiceName string    `json:"rootServiceName"`
	RootName        string    `json:"rootName"`
	RootStartTime   time.Time `json:"rootStartTime"`
	RootEndTime     time.Time `json:"rootEndTime"`

	SpanCount uint32 `json:"spanCount"`
	TraceID   string `json:"traceID"`
}

type Unique

type Unique interface {
	ID() string
}

Jump to

Keyboard shortcuts

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