package otelconv
import (
"context"
"sync"
"go.opentelemetry.io/otel/attribute"
"go.opentelemetry.io/otel/metric"
"go.opentelemetry.io/otel/metric/noop"
)
var (
addOptPool = &sync .Pool {New : func () any { return &[]metric .AddOption {} }}
recOptPool = &sync .Pool {New : func () any { return &[]metric .RecordOption {} }}
)
type ErrorTypeAttr string
var (
ErrorTypeOther ErrorTypeAttr = "_OTHER"
)
type ComponentTypeAttr string
var (
ComponentTypeBatchingSpanProcessor ComponentTypeAttr = "batching_span_processor"
ComponentTypeSimpleSpanProcessor ComponentTypeAttr = "simple_span_processor"
ComponentTypeBatchingLogProcessor ComponentTypeAttr = "batching_log_processor"
ComponentTypeSimpleLogProcessor ComponentTypeAttr = "simple_log_processor"
ComponentTypeOtlpGRPCSpanExporter ComponentTypeAttr = "otlp_grpc_span_exporter"
ComponentTypeOtlpHTTPSpanExporter ComponentTypeAttr = "otlp_http_span_exporter"
ComponentTypeOtlpHTTPJSONSpanExporter ComponentTypeAttr = "otlp_http_json_span_exporter"
ComponentTypeZipkinHTTPSpanExporter ComponentTypeAttr = "zipkin_http_span_exporter"
ComponentTypeOtlpGRPCLogExporter ComponentTypeAttr = "otlp_grpc_log_exporter"
ComponentTypeOtlpHTTPLogExporter ComponentTypeAttr = "otlp_http_log_exporter"
ComponentTypeOtlpHTTPJSONLogExporter ComponentTypeAttr = "otlp_http_json_log_exporter"
ComponentTypePeriodicMetricReader ComponentTypeAttr = "periodic_metric_reader"
ComponentTypeOtlpGRPCMetricExporter ComponentTypeAttr = "otlp_grpc_metric_exporter"
ComponentTypeOtlpHTTPMetricExporter ComponentTypeAttr = "otlp_http_metric_exporter"
ComponentTypeOtlpHTTPJSONMetricExporter ComponentTypeAttr = "otlp_http_json_metric_exporter"
ComponentTypePrometheusHTTPTextMetricExporter ComponentTypeAttr = "prometheus_http_text_metric_exporter"
)
type SpanParentOriginAttr string
var (
SpanParentOriginNone SpanParentOriginAttr = "none"
SpanParentOriginLocal SpanParentOriginAttr = "local"
SpanParentOriginRemote SpanParentOriginAttr = "remote"
)
type SpanSamplingResultAttr string
var (
SpanSamplingResultDrop SpanSamplingResultAttr = "DROP"
SpanSamplingResultRecordOnly SpanSamplingResultAttr = "RECORD_ONLY"
SpanSamplingResultRecordAndSample SpanSamplingResultAttr = "RECORD_AND_SAMPLE"
)
type RPCGRPCStatusCodeAttr int64
var (
RPCGRPCStatusCodeOk RPCGRPCStatusCodeAttr = 0
RPCGRPCStatusCodeCancelled RPCGRPCStatusCodeAttr = 1
RPCGRPCStatusCodeUnknown RPCGRPCStatusCodeAttr = 2
RPCGRPCStatusCodeInvalidArgument RPCGRPCStatusCodeAttr = 3
RPCGRPCStatusCodeDeadlineExceeded RPCGRPCStatusCodeAttr = 4
RPCGRPCStatusCodeNotFound RPCGRPCStatusCodeAttr = 5
RPCGRPCStatusCodeAlreadyExists RPCGRPCStatusCodeAttr = 6
RPCGRPCStatusCodePermissionDenied RPCGRPCStatusCodeAttr = 7
RPCGRPCStatusCodeResourceExhausted RPCGRPCStatusCodeAttr = 8
RPCGRPCStatusCodeFailedPrecondition RPCGRPCStatusCodeAttr = 9
RPCGRPCStatusCodeAborted RPCGRPCStatusCodeAttr = 10
RPCGRPCStatusCodeOutOfRange RPCGRPCStatusCodeAttr = 11
RPCGRPCStatusCodeUnimplemented RPCGRPCStatusCodeAttr = 12
RPCGRPCStatusCodeInternal RPCGRPCStatusCodeAttr = 13
RPCGRPCStatusCodeUnavailable RPCGRPCStatusCodeAttr = 14
RPCGRPCStatusCodeDataLoss RPCGRPCStatusCodeAttr = 15
RPCGRPCStatusCodeUnauthenticated RPCGRPCStatusCodeAttr = 16
)
type SDKExporterLogExported struct {
metric .Int64Counter
}
func NewSDKExporterLogExported (
m metric .Meter ,
opt ...metric .Int64CounterOption ,
) (SDKExporterLogExported , error ) {
if m == nil {
return SDKExporterLogExported {noop .Int64Counter {}}, nil
}
i , err := m .Int64Counter (
"otel.sdk.exporter.log.exported" ,
append ([]metric .Int64CounterOption {
metric .WithDescription ("The number of log records for which the export has finished, either successful or failed." ),
metric .WithUnit ("{log_record}" ),
}, opt ...)...,
)
if err != nil {
return SDKExporterLogExported {noop .Int64Counter {}}, err
}
return SDKExporterLogExported {i }, nil
}
func (m SDKExporterLogExported ) Inst () metric .Int64Counter {
return m .Int64Counter
}
func (SDKExporterLogExported ) Name () string {
return "otel.sdk.exporter.log.exported"
}
func (SDKExporterLogExported ) Unit () string {
return "{log_record}"
}
func (SDKExporterLogExported ) Description () string {
return "The number of log records for which the export has finished, either successful or failed."
}
func (m SDKExporterLogExported ) Add (
ctx context .Context ,
incr int64 ,
attrs ...attribute .KeyValue ,
) {
if len (attrs ) == 0 {
m .Int64Counter .Add (ctx , incr )
return
}
o := addOptPool .Get ().(*[]metric .AddOption )
defer func () {
*o = (*o )[:0 ]
addOptPool .Put (o )
}()
*o = append (
*o ,
metric .WithAttributes (
attrs ...,
),
)
m .Int64Counter .Add (ctx , incr , *o ...)
}
func (m SDKExporterLogExported ) AddSet (ctx context .Context , incr int64 , set attribute .Set ) {
if set .Len () == 0 {
m .Int64Counter .Add (ctx , incr )
return
}
o := addOptPool .Get ().(*[]metric .AddOption )
defer func () {
*o = (*o )[:0 ]
addOptPool .Put (o )
}()
*o = append (*o , metric .WithAttributeSet (set ))
m .Int64Counter .Add (ctx , incr , *o ...)
}
func (SDKExporterLogExported ) AttrErrorType (val ErrorTypeAttr ) attribute .KeyValue {
return attribute .String ("error.type" , string (val ))
}
func (SDKExporterLogExported ) AttrComponentName (val string ) attribute .KeyValue {
return attribute .String ("otel.component.name" , val )
}
func (SDKExporterLogExported ) AttrComponentType (val ComponentTypeAttr ) attribute .KeyValue {
return attribute .String ("otel.component.type" , string (val ))
}
func (SDKExporterLogExported ) AttrServerAddress (val string ) attribute .KeyValue {
return attribute .String ("server.address" , val )
}
func (SDKExporterLogExported ) AttrServerPort (val int ) attribute .KeyValue {
return attribute .Int ("server.port" , val )
}
type SDKExporterLogInflight struct {
metric .Int64UpDownCounter
}
func NewSDKExporterLogInflight (
m metric .Meter ,
opt ...metric .Int64UpDownCounterOption ,
) (SDKExporterLogInflight , error ) {
if m == nil {
return SDKExporterLogInflight {noop .Int64UpDownCounter {}}, nil
}
i , err := m .Int64UpDownCounter (
"otel.sdk.exporter.log.inflight" ,
append ([]metric .Int64UpDownCounterOption {
metric .WithDescription ("The number of log records which were passed to the exporter, but that have not been exported yet (neither successful, nor failed)." ),
metric .WithUnit ("{log_record}" ),
}, opt ...)...,
)
if err != nil {
return SDKExporterLogInflight {noop .Int64UpDownCounter {}}, err
}
return SDKExporterLogInflight {i }, nil
}
func (m SDKExporterLogInflight ) Inst () metric .Int64UpDownCounter {
return m .Int64UpDownCounter
}
func (SDKExporterLogInflight ) Name () string {
return "otel.sdk.exporter.log.inflight"
}
func (SDKExporterLogInflight ) Unit () string {
return "{log_record}"
}
func (SDKExporterLogInflight ) Description () string {
return "The number of log records which were passed to the exporter, but that have not been exported yet (neither successful, nor failed)."
}
func (m SDKExporterLogInflight ) Add (
ctx context .Context ,
incr int64 ,
attrs ...attribute .KeyValue ,
) {
if len (attrs ) == 0 {
m .Int64UpDownCounter .Add (ctx , incr )
return
}
o := addOptPool .Get ().(*[]metric .AddOption )
defer func () {
*o = (*o )[:0 ]
addOptPool .Put (o )
}()
*o = append (
*o ,
metric .WithAttributes (
attrs ...,
),
)
m .Int64UpDownCounter .Add (ctx , incr , *o ...)
}
func (m SDKExporterLogInflight ) AddSet (ctx context .Context , incr int64 , set attribute .Set ) {
if set .Len () == 0 {
m .Int64UpDownCounter .Add (ctx , incr )
return
}
o := addOptPool .Get ().(*[]metric .AddOption )
defer func () {
*o = (*o )[:0 ]
addOptPool .Put (o )
}()
*o = append (*o , metric .WithAttributeSet (set ))
m .Int64UpDownCounter .Add (ctx , incr , *o ...)
}
func (SDKExporterLogInflight ) AttrComponentName (val string ) attribute .KeyValue {
return attribute .String ("otel.component.name" , val )
}
func (SDKExporterLogInflight ) AttrComponentType (val ComponentTypeAttr ) attribute .KeyValue {
return attribute .String ("otel.component.type" , string (val ))
}
func (SDKExporterLogInflight ) AttrServerAddress (val string ) attribute .KeyValue {
return attribute .String ("server.address" , val )
}
func (SDKExporterLogInflight ) AttrServerPort (val int ) attribute .KeyValue {
return attribute .Int ("server.port" , val )
}
type SDKExporterMetricDataPointExported struct {
metric .Int64Counter
}
func NewSDKExporterMetricDataPointExported (
m metric .Meter ,
opt ...metric .Int64CounterOption ,
) (SDKExporterMetricDataPointExported , error ) {
if m == nil {
return SDKExporterMetricDataPointExported {noop .Int64Counter {}}, nil
}
i , err := m .Int64Counter (
"otel.sdk.exporter.metric_data_point.exported" ,
append ([]metric .Int64CounterOption {
metric .WithDescription ("The number of metric data points for which the export has finished, either successful or failed." ),
metric .WithUnit ("{data_point}" ),
}, opt ...)...,
)
if err != nil {
return SDKExporterMetricDataPointExported {noop .Int64Counter {}}, err
}
return SDKExporterMetricDataPointExported {i }, nil
}
func (m SDKExporterMetricDataPointExported ) Inst () metric .Int64Counter {
return m .Int64Counter
}
func (SDKExporterMetricDataPointExported ) Name () string {
return "otel.sdk.exporter.metric_data_point.exported"
}
func (SDKExporterMetricDataPointExported ) Unit () string {
return "{data_point}"
}
func (SDKExporterMetricDataPointExported ) Description () string {
return "The number of metric data points for which the export has finished, either successful or failed."
}
func (m SDKExporterMetricDataPointExported ) Add (
ctx context .Context ,
incr int64 ,
attrs ...attribute .KeyValue ,
) {
if len (attrs ) == 0 {
m .Int64Counter .Add (ctx , incr )
return
}
o := addOptPool .Get ().(*[]metric .AddOption )
defer func () {
*o = (*o )[:0 ]
addOptPool .Put (o )
}()
*o = append (
*o ,
metric .WithAttributes (
attrs ...,
),
)
m .Int64Counter .Add (ctx , incr , *o ...)
}
func (m SDKExporterMetricDataPointExported ) AddSet (ctx context .Context , incr int64 , set attribute .Set ) {
if set .Len () == 0 {
m .Int64Counter .Add (ctx , incr )
return
}
o := addOptPool .Get ().(*[]metric .AddOption )
defer func () {
*o = (*o )[:0 ]
addOptPool .Put (o )
}()
*o = append (*o , metric .WithAttributeSet (set ))
m .Int64Counter .Add (ctx , incr , *o ...)
}
func (SDKExporterMetricDataPointExported ) AttrErrorType (val ErrorTypeAttr ) attribute .KeyValue {
return attribute .String ("error.type" , string (val ))
}
func (SDKExporterMetricDataPointExported ) AttrComponentName (val string ) attribute .KeyValue {
return attribute .String ("otel.component.name" , val )
}
func (SDKExporterMetricDataPointExported ) AttrComponentType (val ComponentTypeAttr ) attribute .KeyValue {
return attribute .String ("otel.component.type" , string (val ))
}
func (SDKExporterMetricDataPointExported ) AttrServerAddress (val string ) attribute .KeyValue {
return attribute .String ("server.address" , val )
}
func (SDKExporterMetricDataPointExported ) AttrServerPort (val int ) attribute .KeyValue {
return attribute .Int ("server.port" , val )
}
type SDKExporterMetricDataPointInflight struct {
metric .Int64UpDownCounter
}
func NewSDKExporterMetricDataPointInflight (
m metric .Meter ,
opt ...metric .Int64UpDownCounterOption ,
) (SDKExporterMetricDataPointInflight , error ) {
if m == nil {
return SDKExporterMetricDataPointInflight {noop .Int64UpDownCounter {}}, nil
}
i , err := m .Int64UpDownCounter (
"otel.sdk.exporter.metric_data_point.inflight" ,
append ([]metric .Int64UpDownCounterOption {
metric .WithDescription ("The number of metric data points which were passed to the exporter, but that have not been exported yet (neither successful, nor failed)." ),
metric .WithUnit ("{data_point}" ),
}, opt ...)...,
)
if err != nil {
return SDKExporterMetricDataPointInflight {noop .Int64UpDownCounter {}}, err
}
return SDKExporterMetricDataPointInflight {i }, nil
}
func (m SDKExporterMetricDataPointInflight ) Inst () metric .Int64UpDownCounter {
return m .Int64UpDownCounter
}
func (SDKExporterMetricDataPointInflight ) Name () string {
return "otel.sdk.exporter.metric_data_point.inflight"
}
func (SDKExporterMetricDataPointInflight ) Unit () string {
return "{data_point}"
}
func (SDKExporterMetricDataPointInflight ) Description () string {
return "The number of metric data points which were passed to the exporter, but that have not been exported yet (neither successful, nor failed)."
}
func (m SDKExporterMetricDataPointInflight ) Add (
ctx context .Context ,
incr int64 ,
attrs ...attribute .KeyValue ,
) {
if len (attrs ) == 0 {
m .Int64UpDownCounter .Add (ctx , incr )
return
}
o := addOptPool .Get ().(*[]metric .AddOption )
defer func () {
*o = (*o )[:0 ]
addOptPool .Put (o )
}()
*o = append (
*o ,
metric .WithAttributes (
attrs ...,
),
)
m .Int64UpDownCounter .Add (ctx , incr , *o ...)
}
func (m SDKExporterMetricDataPointInflight ) AddSet (ctx context .Context , incr int64 , set attribute .Set ) {
if set .Len () == 0 {
m .Int64UpDownCounter .Add (ctx , incr )
return
}
o := addOptPool .Get ().(*[]metric .AddOption )
defer func () {
*o = (*o )[:0 ]
addOptPool .Put (o )
}()
*o = append (*o , metric .WithAttributeSet (set ))
m .Int64UpDownCounter .Add (ctx , incr , *o ...)
}
func (SDKExporterMetricDataPointInflight ) AttrComponentName (val string ) attribute .KeyValue {
return attribute .String ("otel.component.name" , val )
}
func (SDKExporterMetricDataPointInflight ) AttrComponentType (val ComponentTypeAttr ) attribute .KeyValue {
return attribute .String ("otel.component.type" , string (val ))
}
func (SDKExporterMetricDataPointInflight ) AttrServerAddress (val string ) attribute .KeyValue {
return attribute .String ("server.address" , val )
}
func (SDKExporterMetricDataPointInflight ) AttrServerPort (val int ) attribute .KeyValue {
return attribute .Int ("server.port" , val )
}
type SDKExporterOperationDuration struct {
metric .Float64Histogram
}
func NewSDKExporterOperationDuration (
m metric .Meter ,
opt ...metric .Float64HistogramOption ,
) (SDKExporterOperationDuration , error ) {
if m == nil {
return SDKExporterOperationDuration {noop .Float64Histogram {}}, nil
}
i , err := m .Float64Histogram (
"otel.sdk.exporter.operation.duration" ,
append ([]metric .Float64HistogramOption {
metric .WithDescription ("The duration of exporting a batch of telemetry records." ),
metric .WithUnit ("s" ),
}, opt ...)...,
)
if err != nil {
return SDKExporterOperationDuration {noop .Float64Histogram {}}, err
}
return SDKExporterOperationDuration {i }, nil
}
func (m SDKExporterOperationDuration ) Inst () metric .Float64Histogram {
return m .Float64Histogram
}
func (SDKExporterOperationDuration ) Name () string {
return "otel.sdk.exporter.operation.duration"
}
func (SDKExporterOperationDuration ) Unit () string {
return "s"
}
func (SDKExporterOperationDuration ) Description () string {
return "The duration of exporting a batch of telemetry records."
}
func (m SDKExporterOperationDuration ) Record (
ctx context .Context ,
val float64 ,
attrs ...attribute .KeyValue ,
) {
if len (attrs ) == 0 {
m .Float64Histogram .Record (ctx , val )
return
}
o := recOptPool .Get ().(*[]metric .RecordOption )
defer func () {
*o = (*o )[:0 ]
recOptPool .Put (o )
}()
*o = append (
*o ,
metric .WithAttributes (
attrs ...,
),
)
m .Float64Histogram .Record (ctx , val , *o ...)
}
func (m SDKExporterOperationDuration ) RecordSet (ctx context .Context , val float64 , set attribute .Set ) {
if set .Len () == 0 {
m .Float64Histogram .Record (ctx , val )
}
o := recOptPool .Get ().(*[]metric .RecordOption )
defer func () {
*o = (*o )[:0 ]
recOptPool .Put (o )
}()
*o = append (*o , metric .WithAttributeSet (set ))
m .Float64Histogram .Record (ctx , val , *o ...)
}
func (SDKExporterOperationDuration ) AttrErrorType (val ErrorTypeAttr ) attribute .KeyValue {
return attribute .String ("error.type" , string (val ))
}
func (SDKExporterOperationDuration ) AttrHTTPResponseStatusCode (val int ) attribute .KeyValue {
return attribute .Int ("http.response.status_code" , val )
}
func (SDKExporterOperationDuration ) AttrComponentName (val string ) attribute .KeyValue {
return attribute .String ("otel.component.name" , val )
}
func (SDKExporterOperationDuration ) AttrComponentType (val ComponentTypeAttr ) attribute .KeyValue {
return attribute .String ("otel.component.type" , string (val ))
}
func (SDKExporterOperationDuration ) AttrRPCGRPCStatusCode (val RPCGRPCStatusCodeAttr ) attribute .KeyValue {
return attribute .Int64 ("rpc.grpc.status_code" , int64 (val ))
}
func (SDKExporterOperationDuration ) AttrServerAddress (val string ) attribute .KeyValue {
return attribute .String ("server.address" , val )
}
func (SDKExporterOperationDuration ) AttrServerPort (val int ) attribute .KeyValue {
return attribute .Int ("server.port" , val )
}
type SDKExporterSpanExported struct {
metric .Int64Counter
}
func NewSDKExporterSpanExported (
m metric .Meter ,
opt ...metric .Int64CounterOption ,
) (SDKExporterSpanExported , error ) {
if m == nil {
return SDKExporterSpanExported {noop .Int64Counter {}}, nil
}
i , err := m .Int64Counter (
"otel.sdk.exporter.span.exported" ,
append ([]metric .Int64CounterOption {
metric .WithDescription ("The number of spans for which the export has finished, either successful or failed." ),
metric .WithUnit ("{span}" ),
}, opt ...)...,
)
if err != nil {
return SDKExporterSpanExported {noop .Int64Counter {}}, err
}
return SDKExporterSpanExported {i }, nil
}
func (m SDKExporterSpanExported ) Inst () metric .Int64Counter {
return m .Int64Counter
}
func (SDKExporterSpanExported ) Name () string {
return "otel.sdk.exporter.span.exported"
}
func (SDKExporterSpanExported ) Unit () string {
return "{span}"
}
func (SDKExporterSpanExported ) Description () string {
return "The number of spans for which the export has finished, either successful or failed."
}
func (m SDKExporterSpanExported ) Add (
ctx context .Context ,
incr int64 ,
attrs ...attribute .KeyValue ,
) {
if len (attrs ) == 0 {
m .Int64Counter .Add (ctx , incr )
return
}
o := addOptPool .Get ().(*[]metric .AddOption )
defer func () {
*o = (*o )[:0 ]
addOptPool .Put (o )
}()
*o = append (
*o ,
metric .WithAttributes (
attrs ...,
),
)
m .Int64Counter .Add (ctx , incr , *o ...)
}
func (m SDKExporterSpanExported ) AddSet (ctx context .Context , incr int64 , set attribute .Set ) {
if set .Len () == 0 {
m .Int64Counter .Add (ctx , incr )
return
}
o := addOptPool .Get ().(*[]metric .AddOption )
defer func () {
*o = (*o )[:0 ]
addOptPool .Put (o )
}()
*o = append (*o , metric .WithAttributeSet (set ))
m .Int64Counter .Add (ctx , incr , *o ...)
}
func (SDKExporterSpanExported ) AttrErrorType (val ErrorTypeAttr ) attribute .KeyValue {
return attribute .String ("error.type" , string (val ))
}
func (SDKExporterSpanExported ) AttrComponentName (val string ) attribute .KeyValue {
return attribute .String ("otel.component.name" , val )
}
func (SDKExporterSpanExported ) AttrComponentType (val ComponentTypeAttr ) attribute .KeyValue {
return attribute .String ("otel.component.type" , string (val ))
}
func (SDKExporterSpanExported ) AttrServerAddress (val string ) attribute .KeyValue {
return attribute .String ("server.address" , val )
}
func (SDKExporterSpanExported ) AttrServerPort (val int ) attribute .KeyValue {
return attribute .Int ("server.port" , val )
}
type SDKExporterSpanInflight struct {
metric .Int64UpDownCounter
}
func NewSDKExporterSpanInflight (
m metric .Meter ,
opt ...metric .Int64UpDownCounterOption ,
) (SDKExporterSpanInflight , error ) {
if m == nil {
return SDKExporterSpanInflight {noop .Int64UpDownCounter {}}, nil
}
i , err := m .Int64UpDownCounter (
"otel.sdk.exporter.span.inflight" ,
append ([]metric .Int64UpDownCounterOption {
metric .WithDescription ("The number of spans which were passed to the exporter, but that have not been exported yet (neither successful, nor failed)." ),
metric .WithUnit ("{span}" ),
}, opt ...)...,
)
if err != nil {
return SDKExporterSpanInflight {noop .Int64UpDownCounter {}}, err
}
return SDKExporterSpanInflight {i }, nil
}
func (m SDKExporterSpanInflight ) Inst () metric .Int64UpDownCounter {
return m .Int64UpDownCounter
}
func (SDKExporterSpanInflight ) Name () string {
return "otel.sdk.exporter.span.inflight"
}
func (SDKExporterSpanInflight ) Unit () string {
return "{span}"
}
func (SDKExporterSpanInflight ) Description () string {
return "The number of spans which were passed to the exporter, but that have not been exported yet (neither successful, nor failed)."
}
func (m SDKExporterSpanInflight ) Add (
ctx context .Context ,
incr int64 ,
attrs ...attribute .KeyValue ,
) {
if len (attrs ) == 0 {
m .Int64UpDownCounter .Add (ctx , incr )
return
}
o := addOptPool .Get ().(*[]metric .AddOption )
defer func () {
*o = (*o )[:0 ]
addOptPool .Put (o )
}()
*o = append (
*o ,
metric .WithAttributes (
attrs ...,
),
)
m .Int64UpDownCounter .Add (ctx , incr , *o ...)
}
func (m SDKExporterSpanInflight ) AddSet (ctx context .Context , incr int64 , set attribute .Set ) {
if set .Len () == 0 {
m .Int64UpDownCounter .Add (ctx , incr )
return
}
o := addOptPool .Get ().(*[]metric .AddOption )
defer func () {
*o = (*o )[:0 ]
addOptPool .Put (o )
}()
*o = append (*o , metric .WithAttributeSet (set ))
m .Int64UpDownCounter .Add (ctx , incr , *o ...)
}
func (SDKExporterSpanInflight ) AttrComponentName (val string ) attribute .KeyValue {
return attribute .String ("otel.component.name" , val )
}
func (SDKExporterSpanInflight ) AttrComponentType (val ComponentTypeAttr ) attribute .KeyValue {
return attribute .String ("otel.component.type" , string (val ))
}
func (SDKExporterSpanInflight ) AttrServerAddress (val string ) attribute .KeyValue {
return attribute .String ("server.address" , val )
}
func (SDKExporterSpanInflight ) AttrServerPort (val int ) attribute .KeyValue {
return attribute .Int ("server.port" , val )
}
type SDKLogCreated struct {
metric .Int64Counter
}
func NewSDKLogCreated (
m metric .Meter ,
opt ...metric .Int64CounterOption ,
) (SDKLogCreated , error ) {
if m == nil {
return SDKLogCreated {noop .Int64Counter {}}, nil
}
i , err := m .Int64Counter (
"otel.sdk.log.created" ,
append ([]metric .Int64CounterOption {
metric .WithDescription ("The number of logs submitted to enabled SDK Loggers." ),
metric .WithUnit ("{log_record}" ),
}, opt ...)...,
)
if err != nil {
return SDKLogCreated {noop .Int64Counter {}}, err
}
return SDKLogCreated {i }, nil
}
func (m SDKLogCreated ) Inst () metric .Int64Counter {
return m .Int64Counter
}
func (SDKLogCreated ) Name () string {
return "otel.sdk.log.created"
}
func (SDKLogCreated ) Unit () string {
return "{log_record}"
}
func (SDKLogCreated ) Description () string {
return "The number of logs submitted to enabled SDK Loggers."
}
func (m SDKLogCreated ) Add (ctx context .Context , incr int64 , attrs ...attribute .KeyValue ) {
if len (attrs ) == 0 {
m .Int64Counter .Add (ctx , incr )
return
}
o := addOptPool .Get ().(*[]metric .AddOption )
defer func () {
*o = (*o )[:0 ]
addOptPool .Put (o )
}()
*o = append (*o , metric .WithAttributes (attrs ...))
m .Int64Counter .Add (ctx , incr , *o ...)
}
func (m SDKLogCreated ) AddSet (ctx context .Context , incr int64 , set attribute .Set ) {
if set .Len () == 0 {
m .Int64Counter .Add (ctx , incr )
return
}
o := addOptPool .Get ().(*[]metric .AddOption )
defer func () {
*o = (*o )[:0 ]
addOptPool .Put (o )
}()
*o = append (*o , metric .WithAttributeSet (set ))
m .Int64Counter .Add (ctx , incr , *o ...)
}
type SDKMetricReaderCollectionDuration struct {
metric .Float64Histogram
}
func NewSDKMetricReaderCollectionDuration (
m metric .Meter ,
opt ...metric .Float64HistogramOption ,
) (SDKMetricReaderCollectionDuration , error ) {
if m == nil {
return SDKMetricReaderCollectionDuration {noop .Float64Histogram {}}, nil
}
i , err := m .Float64Histogram (
"otel.sdk.metric_reader.collection.duration" ,
append ([]metric .Float64HistogramOption {
metric .WithDescription ("The duration of the collect operation of the metric reader." ),
metric .WithUnit ("s" ),
}, opt ...)...,
)
if err != nil {
return SDKMetricReaderCollectionDuration {noop .Float64Histogram {}}, err
}
return SDKMetricReaderCollectionDuration {i }, nil
}
func (m SDKMetricReaderCollectionDuration ) Inst () metric .Float64Histogram {
return m .Float64Histogram
}
func (SDKMetricReaderCollectionDuration ) Name () string {
return "otel.sdk.metric_reader.collection.duration"
}
func (SDKMetricReaderCollectionDuration ) Unit () string {
return "s"
}
func (SDKMetricReaderCollectionDuration ) Description () string {
return "The duration of the collect operation of the metric reader."
}
func (m SDKMetricReaderCollectionDuration ) Record (
ctx context .Context ,
val float64 ,
attrs ...attribute .KeyValue ,
) {
if len (attrs ) == 0 {
m .Float64Histogram .Record (ctx , val )
return
}
o := recOptPool .Get ().(*[]metric .RecordOption )
defer func () {
*o = (*o )[:0 ]
recOptPool .Put (o )
}()
*o = append (
*o ,
metric .WithAttributes (
attrs ...,
),
)
m .Float64Histogram .Record (ctx , val , *o ...)
}
func (m SDKMetricReaderCollectionDuration ) RecordSet (ctx context .Context , val float64 , set attribute .Set ) {
if set .Len () == 0 {
m .Float64Histogram .Record (ctx , val )
}
o := recOptPool .Get ().(*[]metric .RecordOption )
defer func () {
*o = (*o )[:0 ]
recOptPool .Put (o )
}()
*o = append (*o , metric .WithAttributeSet (set ))
m .Float64Histogram .Record (ctx , val , *o ...)
}
func (SDKMetricReaderCollectionDuration ) AttrErrorType (val ErrorTypeAttr ) attribute .KeyValue {
return attribute .String ("error.type" , string (val ))
}
func (SDKMetricReaderCollectionDuration ) AttrComponentName (val string ) attribute .KeyValue {
return attribute .String ("otel.component.name" , val )
}
func (SDKMetricReaderCollectionDuration ) AttrComponentType (val ComponentTypeAttr ) attribute .KeyValue {
return attribute .String ("otel.component.type" , string (val ))
}
type SDKProcessorLogProcessed struct {
metric .Int64Counter
}
func NewSDKProcessorLogProcessed (
m metric .Meter ,
opt ...metric .Int64CounterOption ,
) (SDKProcessorLogProcessed , error ) {
if m == nil {
return SDKProcessorLogProcessed {noop .Int64Counter {}}, nil
}
i , err := m .Int64Counter (
"otel.sdk.processor.log.processed" ,
append ([]metric .Int64CounterOption {
metric .WithDescription ("The number of log records for which the processing has finished, either successful or failed." ),
metric .WithUnit ("{log_record}" ),
}, opt ...)...,
)
if err != nil {
return SDKProcessorLogProcessed {noop .Int64Counter {}}, err
}
return SDKProcessorLogProcessed {i }, nil
}
func (m SDKProcessorLogProcessed ) Inst () metric .Int64Counter {
return m .Int64Counter
}
func (SDKProcessorLogProcessed ) Name () string {
return "otel.sdk.processor.log.processed"
}
func (SDKProcessorLogProcessed ) Unit () string {
return "{log_record}"
}
func (SDKProcessorLogProcessed ) Description () string {
return "The number of log records for which the processing has finished, either successful or failed."
}
func (m SDKProcessorLogProcessed ) Add (
ctx context .Context ,
incr int64 ,
attrs ...attribute .KeyValue ,
) {
if len (attrs ) == 0 {
m .Int64Counter .Add (ctx , incr )
return
}
o := addOptPool .Get ().(*[]metric .AddOption )
defer func () {
*o = (*o )[:0 ]
addOptPool .Put (o )
}()
*o = append (
*o ,
metric .WithAttributes (
attrs ...,
),
)
m .Int64Counter .Add (ctx , incr , *o ...)
}
func (m SDKProcessorLogProcessed ) AddSet (ctx context .Context , incr int64 , set attribute .Set ) {
if set .Len () == 0 {
m .Int64Counter .Add (ctx , incr )
return
}
o := addOptPool .Get ().(*[]metric .AddOption )
defer func () {
*o = (*o )[:0 ]
addOptPool .Put (o )
}()
*o = append (*o , metric .WithAttributeSet (set ))
m .Int64Counter .Add (ctx , incr , *o ...)
}
func (SDKProcessorLogProcessed ) AttrErrorType (val ErrorTypeAttr ) attribute .KeyValue {
return attribute .String ("error.type" , string (val ))
}
func (SDKProcessorLogProcessed ) AttrComponentName (val string ) attribute .KeyValue {
return attribute .String ("otel.component.name" , val )
}
func (SDKProcessorLogProcessed ) AttrComponentType (val ComponentTypeAttr ) attribute .KeyValue {
return attribute .String ("otel.component.type" , string (val ))
}
type SDKProcessorLogQueueCapacity struct {
metric .Int64ObservableUpDownCounter
}
func NewSDKProcessorLogQueueCapacity (
m metric .Meter ,
opt ...metric .Int64ObservableUpDownCounterOption ,
) (SDKProcessorLogQueueCapacity , error ) {
if m == nil {
return SDKProcessorLogQueueCapacity {noop .Int64ObservableUpDownCounter {}}, nil
}
i , err := m .Int64ObservableUpDownCounter (
"otel.sdk.processor.log.queue.capacity" ,
append ([]metric .Int64ObservableUpDownCounterOption {
metric .WithDescription ("The maximum number of log records the queue of a given instance of an SDK Log Record processor can hold." ),
metric .WithUnit ("{log_record}" ),
}, opt ...)...,
)
if err != nil {
return SDKProcessorLogQueueCapacity {noop .Int64ObservableUpDownCounter {}}, err
}
return SDKProcessorLogQueueCapacity {i }, nil
}
func (m SDKProcessorLogQueueCapacity ) Inst () metric .Int64ObservableUpDownCounter {
return m .Int64ObservableUpDownCounter
}
func (SDKProcessorLogQueueCapacity ) Name () string {
return "otel.sdk.processor.log.queue.capacity"
}
func (SDKProcessorLogQueueCapacity ) Unit () string {
return "{log_record}"
}
func (SDKProcessorLogQueueCapacity ) Description () string {
return "The maximum number of log records the queue of a given instance of an SDK Log Record processor can hold."
}
func (SDKProcessorLogQueueCapacity ) AttrComponentName (val string ) attribute .KeyValue {
return attribute .String ("otel.component.name" , val )
}
func (SDKProcessorLogQueueCapacity ) AttrComponentType (val ComponentTypeAttr ) attribute .KeyValue {
return attribute .String ("otel.component.type" , string (val ))
}
type SDKProcessorLogQueueSize struct {
metric .Int64ObservableUpDownCounter
}
func NewSDKProcessorLogQueueSize (
m metric .Meter ,
opt ...metric .Int64ObservableUpDownCounterOption ,
) (SDKProcessorLogQueueSize , error ) {
if m == nil {
return SDKProcessorLogQueueSize {noop .Int64ObservableUpDownCounter {}}, nil
}
i , err := m .Int64ObservableUpDownCounter (
"otel.sdk.processor.log.queue.size" ,
append ([]metric .Int64ObservableUpDownCounterOption {
metric .WithDescription ("The number of log records in the queue of a given instance of an SDK log processor." ),
metric .WithUnit ("{log_record}" ),
}, opt ...)...,
)
if err != nil {
return SDKProcessorLogQueueSize {noop .Int64ObservableUpDownCounter {}}, err
}
return SDKProcessorLogQueueSize {i }, nil
}
func (m SDKProcessorLogQueueSize ) Inst () metric .Int64ObservableUpDownCounter {
return m .Int64ObservableUpDownCounter
}
func (SDKProcessorLogQueueSize ) Name () string {
return "otel.sdk.processor.log.queue.size"
}
func (SDKProcessorLogQueueSize ) Unit () string {
return "{log_record}"
}
func (SDKProcessorLogQueueSize ) Description () string {
return "The number of log records in the queue of a given instance of an SDK log processor."
}
func (SDKProcessorLogQueueSize ) AttrComponentName (val string ) attribute .KeyValue {
return attribute .String ("otel.component.name" , val )
}
func (SDKProcessorLogQueueSize ) AttrComponentType (val ComponentTypeAttr ) attribute .KeyValue {
return attribute .String ("otel.component.type" , string (val ))
}
type SDKProcessorSpanProcessed struct {
metric .Int64Counter
}
func NewSDKProcessorSpanProcessed (
m metric .Meter ,
opt ...metric .Int64CounterOption ,
) (SDKProcessorSpanProcessed , error ) {
if m == nil {
return SDKProcessorSpanProcessed {noop .Int64Counter {}}, nil
}
i , err := m .Int64Counter (
"otel.sdk.processor.span.processed" ,
append ([]metric .Int64CounterOption {
metric .WithDescription ("The number of spans for which the processing has finished, either successful or failed." ),
metric .WithUnit ("{span}" ),
}, opt ...)...,
)
if err != nil {
return SDKProcessorSpanProcessed {noop .Int64Counter {}}, err
}
return SDKProcessorSpanProcessed {i }, nil
}
func (m SDKProcessorSpanProcessed ) Inst () metric .Int64Counter {
return m .Int64Counter
}
func (SDKProcessorSpanProcessed ) Name () string {
return "otel.sdk.processor.span.processed"
}
func (SDKProcessorSpanProcessed ) Unit () string {
return "{span}"
}
func (SDKProcessorSpanProcessed ) Description () string {
return "The number of spans for which the processing has finished, either successful or failed."
}
func (m SDKProcessorSpanProcessed ) Add (
ctx context .Context ,
incr int64 ,
attrs ...attribute .KeyValue ,
) {
if len (attrs ) == 0 {
m .Int64Counter .Add (ctx , incr )
return
}
o := addOptPool .Get ().(*[]metric .AddOption )
defer func () {
*o = (*o )[:0 ]
addOptPool .Put (o )
}()
*o = append (
*o ,
metric .WithAttributes (
attrs ...,
),
)
m .Int64Counter .Add (ctx , incr , *o ...)
}
func (m SDKProcessorSpanProcessed ) AddSet (ctx context .Context , incr int64 , set attribute .Set ) {
if set .Len () == 0 {
m .Int64Counter .Add (ctx , incr )
return
}
o := addOptPool .Get ().(*[]metric .AddOption )
defer func () {
*o = (*o )[:0 ]
addOptPool .Put (o )
}()
*o = append (*o , metric .WithAttributeSet (set ))
m .Int64Counter .Add (ctx , incr , *o ...)
}
func (SDKProcessorSpanProcessed ) AttrErrorType (val ErrorTypeAttr ) attribute .KeyValue {
return attribute .String ("error.type" , string (val ))
}
func (SDKProcessorSpanProcessed ) AttrComponentName (val string ) attribute .KeyValue {
return attribute .String ("otel.component.name" , val )
}
func (SDKProcessorSpanProcessed ) AttrComponentType (val ComponentTypeAttr ) attribute .KeyValue {
return attribute .String ("otel.component.type" , string (val ))
}
type SDKProcessorSpanQueueCapacity struct {
metric .Int64ObservableUpDownCounter
}
func NewSDKProcessorSpanQueueCapacity (
m metric .Meter ,
opt ...metric .Int64ObservableUpDownCounterOption ,
) (SDKProcessorSpanQueueCapacity , error ) {
if m == nil {
return SDKProcessorSpanQueueCapacity {noop .Int64ObservableUpDownCounter {}}, nil
}
i , err := m .Int64ObservableUpDownCounter (
"otel.sdk.processor.span.queue.capacity" ,
append ([]metric .Int64ObservableUpDownCounterOption {
metric .WithDescription ("The maximum number of spans the queue of a given instance of an SDK span processor can hold." ),
metric .WithUnit ("{span}" ),
}, opt ...)...,
)
if err != nil {
return SDKProcessorSpanQueueCapacity {noop .Int64ObservableUpDownCounter {}}, err
}
return SDKProcessorSpanQueueCapacity {i }, nil
}
func (m SDKProcessorSpanQueueCapacity ) Inst () metric .Int64ObservableUpDownCounter {
return m .Int64ObservableUpDownCounter
}
func (SDKProcessorSpanQueueCapacity ) Name () string {
return "otel.sdk.processor.span.queue.capacity"
}
func (SDKProcessorSpanQueueCapacity ) Unit () string {
return "{span}"
}
func (SDKProcessorSpanQueueCapacity ) Description () string {
return "The maximum number of spans the queue of a given instance of an SDK span processor can hold."
}
func (SDKProcessorSpanQueueCapacity ) AttrComponentName (val string ) attribute .KeyValue {
return attribute .String ("otel.component.name" , val )
}
func (SDKProcessorSpanQueueCapacity ) AttrComponentType (val ComponentTypeAttr ) attribute .KeyValue {
return attribute .String ("otel.component.type" , string (val ))
}
type SDKProcessorSpanQueueSize struct {
metric .Int64ObservableUpDownCounter
}
func NewSDKProcessorSpanQueueSize (
m metric .Meter ,
opt ...metric .Int64ObservableUpDownCounterOption ,
) (SDKProcessorSpanQueueSize , error ) {
if m == nil {
return SDKProcessorSpanQueueSize {noop .Int64ObservableUpDownCounter {}}, nil
}
i , err := m .Int64ObservableUpDownCounter (
"otel.sdk.processor.span.queue.size" ,
append ([]metric .Int64ObservableUpDownCounterOption {
metric .WithDescription ("The number of spans in the queue of a given instance of an SDK span processor." ),
metric .WithUnit ("{span}" ),
}, opt ...)...,
)
if err != nil {
return SDKProcessorSpanQueueSize {noop .Int64ObservableUpDownCounter {}}, err
}
return SDKProcessorSpanQueueSize {i }, nil
}
func (m SDKProcessorSpanQueueSize ) Inst () metric .Int64ObservableUpDownCounter {
return m .Int64ObservableUpDownCounter
}
func (SDKProcessorSpanQueueSize ) Name () string {
return "otel.sdk.processor.span.queue.size"
}
func (SDKProcessorSpanQueueSize ) Unit () string {
return "{span}"
}
func (SDKProcessorSpanQueueSize ) Description () string {
return "The number of spans in the queue of a given instance of an SDK span processor."
}
func (SDKProcessorSpanQueueSize ) AttrComponentName (val string ) attribute .KeyValue {
return attribute .String ("otel.component.name" , val )
}
func (SDKProcessorSpanQueueSize ) AttrComponentType (val ComponentTypeAttr ) attribute .KeyValue {
return attribute .String ("otel.component.type" , string (val ))
}
type SDKSpanLive struct {
metric .Int64UpDownCounter
}
func NewSDKSpanLive (
m metric .Meter ,
opt ...metric .Int64UpDownCounterOption ,
) (SDKSpanLive , error ) {
if m == nil {
return SDKSpanLive {noop .Int64UpDownCounter {}}, nil
}
i , err := m .Int64UpDownCounter (
"otel.sdk.span.live" ,
append ([]metric .Int64UpDownCounterOption {
metric .WithDescription ("The number of created spans with `recording=true` for which the end operation has not been called yet." ),
metric .WithUnit ("{span}" ),
}, opt ...)...,
)
if err != nil {
return SDKSpanLive {noop .Int64UpDownCounter {}}, err
}
return SDKSpanLive {i }, nil
}
func (m SDKSpanLive ) Inst () metric .Int64UpDownCounter {
return m .Int64UpDownCounter
}
func (SDKSpanLive ) Name () string {
return "otel.sdk.span.live"
}
func (SDKSpanLive ) Unit () string {
return "{span}"
}
func (SDKSpanLive ) Description () string {
return "The number of created spans with `recording=true` for which the end operation has not been called yet."
}
func (m SDKSpanLive ) Add (
ctx context .Context ,
incr int64 ,
attrs ...attribute .KeyValue ,
) {
if len (attrs ) == 0 {
m .Int64UpDownCounter .Add (ctx , incr )
return
}
o := addOptPool .Get ().(*[]metric .AddOption )
defer func () {
*o = (*o )[:0 ]
addOptPool .Put (o )
}()
*o = append (
*o ,
metric .WithAttributes (
attrs ...,
),
)
m .Int64UpDownCounter .Add (ctx , incr , *o ...)
}
func (m SDKSpanLive ) AddSet (ctx context .Context , incr int64 , set attribute .Set ) {
if set .Len () == 0 {
m .Int64UpDownCounter .Add (ctx , incr )
return
}
o := addOptPool .Get ().(*[]metric .AddOption )
defer func () {
*o = (*o )[:0 ]
addOptPool .Put (o )
}()
*o = append (*o , metric .WithAttributeSet (set ))
m .Int64UpDownCounter .Add (ctx , incr , *o ...)
}
func (SDKSpanLive ) AttrSpanSamplingResult (val SpanSamplingResultAttr ) attribute .KeyValue {
return attribute .String ("otel.span.sampling_result" , string (val ))
}
type SDKSpanStarted struct {
metric .Int64Counter
}
func NewSDKSpanStarted (
m metric .Meter ,
opt ...metric .Int64CounterOption ,
) (SDKSpanStarted , error ) {
if m == nil {
return SDKSpanStarted {noop .Int64Counter {}}, nil
}
i , err := m .Int64Counter (
"otel.sdk.span.started" ,
append ([]metric .Int64CounterOption {
metric .WithDescription ("The number of created spans." ),
metric .WithUnit ("{span}" ),
}, opt ...)...,
)
if err != nil {
return SDKSpanStarted {noop .Int64Counter {}}, err
}
return SDKSpanStarted {i }, nil
}
func (m SDKSpanStarted ) Inst () metric .Int64Counter {
return m .Int64Counter
}
func (SDKSpanStarted ) Name () string {
return "otel.sdk.span.started"
}
func (SDKSpanStarted ) Unit () string {
return "{span}"
}
func (SDKSpanStarted ) Description () string {
return "The number of created spans."
}
func (m SDKSpanStarted ) Add (
ctx context .Context ,
incr int64 ,
attrs ...attribute .KeyValue ,
) {
if len (attrs ) == 0 {
m .Int64Counter .Add (ctx , incr )
return
}
o := addOptPool .Get ().(*[]metric .AddOption )
defer func () {
*o = (*o )[:0 ]
addOptPool .Put (o )
}()
*o = append (
*o ,
metric .WithAttributes (
attrs ...,
),
)
m .Int64Counter .Add (ctx , incr , *o ...)
}
func (m SDKSpanStarted ) AddSet (ctx context .Context , incr int64 , set attribute .Set ) {
if set .Len () == 0 {
m .Int64Counter .Add (ctx , incr )
return
}
o := addOptPool .Get ().(*[]metric .AddOption )
defer func () {
*o = (*o )[:0 ]
addOptPool .Put (o )
}()
*o = append (*o , metric .WithAttributeSet (set ))
m .Int64Counter .Add (ctx , incr , *o ...)
}
func (SDKSpanStarted ) AttrSpanParentOrigin (val SpanParentOriginAttr ) attribute .KeyValue {
return attribute .String ("otel.span.parent.origin" , string (val ))
}
func (SDKSpanStarted ) AttrSpanSamplingResult (val SpanSamplingResultAttr ) attribute .KeyValue {
return attribute .String ("otel.span.sampling_result" , string (val ))
}
The pages are generated with Golds v0.8.2 . (GOOS=linux GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu .
PR and bug reports are welcome and can be submitted to the issue list .
Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds .