common

package module
v0.2.13 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2022 License: MIT Imports: 6 Imported by: 17

Documentation

Index

Constants

View Source
const (
	MeasurementSpans      = "spans"
	MeasurementSpanLinks  = "span-links"
	MeasurementLogs       = "logs"
	MeasurementPrometheus = "prometheus"

	MetricGaugeFieldKey          = "gauge"
	MetricCounterFieldKey        = "counter"
	MetricHistogramCountFieldKey = "count"
	MetricHistogramSumFieldKey   = "sum"
	MetricHistogramInfFieldKey   = "inf"
	MetricHistogramBoundKeyV2    = "le"
	MetricHistogramCountSuffix   = "_count"
	MetricHistogramSumSuffix     = "_sum"
	MetricHistogramBucketSuffix  = "_bucket"
	MetricSummaryCountFieldKey   = "count"
	MetricSummarySumFieldKey     = "sum"
	MetricSummaryQuantileKeyV2   = "quantile"
	MetricSummaryCountSuffix     = "_count"
	MetricSummarySumSuffix       = "_sum"

	// These attribute key names are influenced by the proto message keys.
	// https://github.com/open-telemetry/opentelemetry-proto/blob/abbf7b7b49a5342d0d6c0e86e91d713bbedb6580/opentelemetry/proto/trace/v1/trace.proto
	// https://github.com/open-telemetry/opentelemetry-proto/blob/abbf7b7b49a5342d0d6c0e86e91d713bbedb6580/opentelemetry/proto/metrics/v1/metrics.proto
	// https://github.com/open-telemetry/opentelemetry-proto/blob/abbf7b7b49a5342d0d6c0e86e91d713bbedb6580/opentelemetry/proto/logs/v1/logs.proto
	AttributeTraceID                        = "trace_id"
	AttributeSpanID                         = "span_id"
	AttributeTraceState                     = "trace_state"
	AttributeParentSpanID                   = "parent_span_id"
	AttributeName                           = "name"
	AttributeSpanKind                       = "kind"
	AttributeEndTimeUnixNano                = "end_time_unix_nano"
	AttributeDurationNano                   = "duration_nano"
	AttributeDroppedResourceAttributesCount = "otel.resource.dropped_attributes_count"
	AttributeDroppedSpanAttributesCount     = "otel.span.dropped_attributes_count"
	AttributeDroppedEventAttributesCount    = "otel.event.dropped_attributes_count"
	AttributeDroppedEventsCount             = "otel.span.dropped_events_count"
	AttributeDroppedLinkAttributesCount     = "otel.link.dropped_attributes_count"
	AttributeDroppedLinksCount              = "otel.span.dropped_links_count"
	AttributeLinkedTraceID                  = "linked_trace_id"
	AttributeLinkedSpanID                   = "linked_span_id"
	AttributeStatusCode                     = "otel.status_code"
	AttributeStatusCodeOK                   = "OK"
	AttributeStatusCodeError                = "ERROR"
	AttributeStatusMessage                  = "otel.status_description"
	AttributeInstrumentationLibraryName     = "otel.library.name"
	AttributeInstrumentationLibraryVersion  = "otel.library.version"
	AttributeSeverityNumber                 = "severity_number"
	AttributeSeverityText                   = "severity_text"
	AttributeBody                           = "body"
)

Variables

View Source
var ResourceNamespace = regexp.MustCompile(`^(service\.|telemetry\.|container\.|process\.|host\.|os\.|cloud\.|deployment\.|k8s\.|aws\.|gcp\.|azure\.|faas\.name|faas\.id|faas\.version|faas\.instance|faas\.max_memory)`)

https://github.com/open-telemetry/opentelemetry-specification/tree/v1.0.1/specification/resource/semantic_conventions

Functions

func AttributeValueToInfluxFieldValue added in v0.2.5

func AttributeValueToInfluxFieldValue(value pdata.AttributeValue) (interface{}, error)

func AttributeValueToInfluxTagValue added in v0.2.5

func AttributeValueToInfluxTagValue(value pdata.AttributeValue) (string, error)

func InstrumentationLibraryToTags added in v0.2.5

func InstrumentationLibraryToTags(instrumentationLibrary pdata.InstrumentationLibrary, tags map[string]string) (tagsAgain map[string]string)

func ResourceToTags added in v0.2.5

func ResourceToTags(logger Logger, resource pdata.Resource, tags map[string]string) (tagsAgain map[string]string)

func SortResourceMetrics

func SortResourceMetrics(rm pdata.ResourceMetricsSlice)

Types

type ErrorLogger

type ErrorLogger struct {
	Logger
}

ErrorLogger intercepts log entries emitted by this package, adding key "error" before any error type value.

ErrorLogger panicks if the resulting kv slice length is odd.

func (*ErrorLogger) Debug

func (e *ErrorLogger) Debug(msg string, kv ...interface{})

type InfluxMetricValueType

type InfluxMetricValueType uint8
const (
	InfluxMetricValueTypeUntyped InfluxMetricValueType = iota
	InfluxMetricValueTypeGauge
	InfluxMetricValueTypeSum
	InfluxMetricValueTypeHistogram
	InfluxMetricValueTypeSummary
)

func (InfluxMetricValueType) String

func (vType InfluxMetricValueType) String() string

type Logger

type Logger interface {
	Debug(msg string, kv ...interface{})
}

Logger must be implemented by the user of this package. Emitted logs indicate non-fatal conversion errors.

type MetricsSchema

type MetricsSchema uint8
const (
	MetricsSchemaTelegrafPrometheusV1 MetricsSchema
	MetricsSchemaTelegrafPrometheusV2
)

func (MetricsSchema) String

func (ms MetricsSchema) String() string

type NoopLogger

type NoopLogger struct{}

NoopLogger is a no-op implementation of Logger.

func (NoopLogger) Debug

func (_ NoopLogger) Debug(_ string, _ ...interface{})

type RetryableError

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

Jump to

Keyboard shortcuts

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