// Code generated from semantic convention specification. DO NOT EDIT.

// Copyright The OpenTelemetry Authors
// SPDX-License-Identifier: Apache-2.0

// Package httpconv provides types and functionality for OpenTelemetry semantic // conventions in the "otel" namespace.
package otelconv import ( ) var ( addOptPool = &sync.Pool{New: func() any { return &[]metric.AddOption{} }} recOptPool = &sync.Pool{New: func() any { return &[]metric.RecordOption{} }} ) // ErrorTypeAttr is an attribute conforming to the error.type semantic // conventions. It represents the describes a class of error the operation ended // with. type ErrorTypeAttr string var ( // ErrorTypeOther is a fallback error value to be used when the instrumentation // doesn't define a custom value. ErrorTypeOther ErrorTypeAttr = "_OTHER" ) // ComponentTypeAttr is an attribute conforming to the otel.component.type // semantic conventions. It represents a name identifying the type of the // OpenTelemetry component. type ComponentTypeAttr string var ( // ComponentTypeBatchingSpanProcessor is the builtin SDK batching span // processor. ComponentTypeBatchingSpanProcessor ComponentTypeAttr = "batching_span_processor" // ComponentTypeSimpleSpanProcessor is the builtin SDK simple span processor. ComponentTypeSimpleSpanProcessor ComponentTypeAttr = "simple_span_processor" // ComponentTypeBatchingLogProcessor is the builtin SDK batching log record // processor. ComponentTypeBatchingLogProcessor ComponentTypeAttr = "batching_log_processor" // ComponentTypeSimpleLogProcessor is the builtin SDK simple log record // processor. ComponentTypeSimpleLogProcessor ComponentTypeAttr = "simple_log_processor" // ComponentTypeOtlpGRPCSpanExporter is the OTLP span exporter over gRPC with // protobuf serialization. ComponentTypeOtlpGRPCSpanExporter ComponentTypeAttr = "otlp_grpc_span_exporter" // ComponentTypeOtlpHTTPSpanExporter is the OTLP span exporter over HTTP with // protobuf serialization. ComponentTypeOtlpHTTPSpanExporter ComponentTypeAttr = "otlp_http_span_exporter" // ComponentTypeOtlpHTTPJSONSpanExporter is the OTLP span exporter over HTTP // with JSON serialization. ComponentTypeOtlpHTTPJSONSpanExporter ComponentTypeAttr = "otlp_http_json_span_exporter" // ComponentTypeZipkinHTTPSpanExporter is the zipkin span exporter over HTTP. ComponentTypeZipkinHTTPSpanExporter ComponentTypeAttr = "zipkin_http_span_exporter" // ComponentTypeOtlpGRPCLogExporter is the OTLP log record exporter over gRPC // with protobuf serialization. ComponentTypeOtlpGRPCLogExporter ComponentTypeAttr = "otlp_grpc_log_exporter" // ComponentTypeOtlpHTTPLogExporter is the OTLP log record exporter over HTTP // with protobuf serialization. ComponentTypeOtlpHTTPLogExporter ComponentTypeAttr = "otlp_http_log_exporter" // ComponentTypeOtlpHTTPJSONLogExporter is the OTLP log record exporter over // HTTP with JSON serialization. ComponentTypeOtlpHTTPJSONLogExporter ComponentTypeAttr = "otlp_http_json_log_exporter" // ComponentTypePeriodicMetricReader is the builtin SDK periodically exporting // metric reader. ComponentTypePeriodicMetricReader ComponentTypeAttr = "periodic_metric_reader" // ComponentTypeOtlpGRPCMetricExporter is the OTLP metric exporter over gRPC // with protobuf serialization. ComponentTypeOtlpGRPCMetricExporter ComponentTypeAttr = "otlp_grpc_metric_exporter" // ComponentTypeOtlpHTTPMetricExporter is the OTLP metric exporter over HTTP // with protobuf serialization. ComponentTypeOtlpHTTPMetricExporter ComponentTypeAttr = "otlp_http_metric_exporter" // ComponentTypeOtlpHTTPJSONMetricExporter is the OTLP metric exporter over HTTP // with JSON serialization. ComponentTypeOtlpHTTPJSONMetricExporter ComponentTypeAttr = "otlp_http_json_metric_exporter" // ComponentTypePrometheusHTTPTextMetricExporter is the prometheus metric // exporter over HTTP with the default text-based format. ComponentTypePrometheusHTTPTextMetricExporter ComponentTypeAttr = "prometheus_http_text_metric_exporter" ) // SpanParentOriginAttr is an attribute conforming to the otel.span.parent.origin // semantic conventions. It represents the determines whether the span has a // parent span, and if so, [whether it is a remote parent]. // // [whether it is a remote parent]: https://opentelemetry.io/docs/specs/otel/trace/api/#isremote type SpanParentOriginAttr string var ( // SpanParentOriginNone is the span does not have a parent, it is a root span. SpanParentOriginNone SpanParentOriginAttr = "none" // SpanParentOriginLocal is the span has a parent and the parent's span context // [isRemote()] is false. // // [isRemote()]: https://opentelemetry.io/docs/specs/otel/trace/api/#isremote SpanParentOriginLocal SpanParentOriginAttr = "local" // SpanParentOriginRemote is the span has a parent and the parent's span context // [isRemote()] is true. // // [isRemote()]: https://opentelemetry.io/docs/specs/otel/trace/api/#isremote SpanParentOriginRemote SpanParentOriginAttr = "remote" ) // SpanSamplingResultAttr is an attribute conforming to the // otel.span.sampling_result semantic conventions. It represents the result value // of the sampler for this span. type SpanSamplingResultAttr string var ( // SpanSamplingResultDrop is the span is not sampled and not recording. SpanSamplingResultDrop SpanSamplingResultAttr = "DROP" // SpanSamplingResultRecordOnly is the span is not sampled, but recording. SpanSamplingResultRecordOnly SpanSamplingResultAttr = "RECORD_ONLY" // SpanSamplingResultRecordAndSample is the span is sampled and recording. SpanSamplingResultRecordAndSample SpanSamplingResultAttr = "RECORD_AND_SAMPLE" ) // RPCGRPCStatusCodeAttr is an attribute conforming to the rpc.grpc.status_code // semantic conventions. It represents the gRPC status code of the last gRPC // requests performed in scope of this export call. type RPCGRPCStatusCodeAttr int64 var ( // RPCGRPCStatusCodeOk is the OK. RPCGRPCStatusCodeOk RPCGRPCStatusCodeAttr = 0 // RPCGRPCStatusCodeCancelled is the CANCELLED. RPCGRPCStatusCodeCancelled RPCGRPCStatusCodeAttr = 1 // RPCGRPCStatusCodeUnknown is the UNKNOWN. RPCGRPCStatusCodeUnknown RPCGRPCStatusCodeAttr = 2 // RPCGRPCStatusCodeInvalidArgument is the INVALID_ARGUMENT. RPCGRPCStatusCodeInvalidArgument RPCGRPCStatusCodeAttr = 3 // RPCGRPCStatusCodeDeadlineExceeded is the DEADLINE_EXCEEDED. RPCGRPCStatusCodeDeadlineExceeded RPCGRPCStatusCodeAttr = 4 // RPCGRPCStatusCodeNotFound is the NOT_FOUND. RPCGRPCStatusCodeNotFound RPCGRPCStatusCodeAttr = 5 // RPCGRPCStatusCodeAlreadyExists is the ALREADY_EXISTS. RPCGRPCStatusCodeAlreadyExists RPCGRPCStatusCodeAttr = 6 // RPCGRPCStatusCodePermissionDenied is the PERMISSION_DENIED. RPCGRPCStatusCodePermissionDenied RPCGRPCStatusCodeAttr = 7 // RPCGRPCStatusCodeResourceExhausted is the RESOURCE_EXHAUSTED. RPCGRPCStatusCodeResourceExhausted RPCGRPCStatusCodeAttr = 8 // RPCGRPCStatusCodeFailedPrecondition is the FAILED_PRECONDITION. RPCGRPCStatusCodeFailedPrecondition RPCGRPCStatusCodeAttr = 9 // RPCGRPCStatusCodeAborted is the ABORTED. RPCGRPCStatusCodeAborted RPCGRPCStatusCodeAttr = 10 // RPCGRPCStatusCodeOutOfRange is the OUT_OF_RANGE. RPCGRPCStatusCodeOutOfRange RPCGRPCStatusCodeAttr = 11 // RPCGRPCStatusCodeUnimplemented is the UNIMPLEMENTED. RPCGRPCStatusCodeUnimplemented RPCGRPCStatusCodeAttr = 12 // RPCGRPCStatusCodeInternal is the INTERNAL. RPCGRPCStatusCodeInternal RPCGRPCStatusCodeAttr = 13 // RPCGRPCStatusCodeUnavailable is the UNAVAILABLE. RPCGRPCStatusCodeUnavailable RPCGRPCStatusCodeAttr = 14 // RPCGRPCStatusCodeDataLoss is the DATA_LOSS. RPCGRPCStatusCodeDataLoss RPCGRPCStatusCodeAttr = 15 // RPCGRPCStatusCodeUnauthenticated is the UNAUTHENTICATED. RPCGRPCStatusCodeUnauthenticated RPCGRPCStatusCodeAttr = 16 ) // SDKExporterLogExported is an instrument used to record metric values // conforming to the "otel.sdk.exporter.log.exported" semantic conventions. It // represents the number of log records for which the export has finished, either // successful or failed. type SDKExporterLogExported struct { metric.Int64Counter } // NewSDKExporterLogExported returns a new SDKExporterLogExported instrument. func ( metric.Meter, ...metric.Int64CounterOption, ) (SDKExporterLogExported, error) { // Check if the meter is nil. if == nil { return SDKExporterLogExported{noop.Int64Counter{}}, nil } , := .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}"), }, ...)..., ) if != nil { return SDKExporterLogExported{noop.Int64Counter{}}, } return SDKExporterLogExported{}, nil } // Inst returns the underlying metric instrument. func ( SDKExporterLogExported) () metric.Int64Counter { return .Int64Counter } // Name returns the semantic convention name of the instrument. func (SDKExporterLogExported) () string { return "otel.sdk.exporter.log.exported" } // Unit returns the semantic convention unit of the instrument func (SDKExporterLogExported) () string { return "{log_record}" } // Description returns the semantic convention description of the instrument func (SDKExporterLogExported) () string { return "The number of log records for which the export has finished, either successful or failed." } // Add adds incr to the existing count for attrs. // // All additional attrs passed are included in the recorded value. // // For successful exports, `error.type` MUST NOT be set. For failed exports, // `error.type` MUST contain the failure cause. // For exporters with partial success semantics (e.g. OTLP with // `rejected_log_records`), rejected log records MUST count as failed and only // non-rejected log records count as success. // If no rejection reason is available, `rejected` SHOULD be used as value for // `error.type`. func ( SDKExporterLogExported) ( context.Context, int64, ...attribute.KeyValue, ) { if len() == 0 { .Int64Counter.Add(, ) return } := addOptPool.Get().(*[]metric.AddOption) defer func() { * = (*)[:0] addOptPool.Put() }() * = append( *, metric.WithAttributes( ..., ), ) .Int64Counter.Add(, , *...) } // AddSet adds incr to the existing count for set. // // For successful exports, `error.type` MUST NOT be set. For failed exports, // `error.type` MUST contain the failure cause. // For exporters with partial success semantics (e.g. OTLP with // `rejected_log_records`), rejected log records MUST count as failed and only // non-rejected log records count as success. // If no rejection reason is available, `rejected` SHOULD be used as value for // `error.type`. func ( SDKExporterLogExported) ( context.Context, int64, attribute.Set) { if .Len() == 0 { .Int64Counter.Add(, ) return } := addOptPool.Get().(*[]metric.AddOption) defer func() { * = (*)[:0] addOptPool.Put() }() * = append(*, metric.WithAttributeSet()) .Int64Counter.Add(, , *...) } // AttrErrorType returns an optional attribute for the "error.type" semantic // convention. It represents the describes a class of error the operation ended // with. func (SDKExporterLogExported) ( ErrorTypeAttr) attribute.KeyValue { return attribute.String("error.type", string()) } // AttrComponentName returns an optional attribute for the "otel.component.name" // semantic convention. It represents a name uniquely identifying the instance of // the OpenTelemetry component within its containing SDK instance. func (SDKExporterLogExported) ( string) attribute.KeyValue { return attribute.String("otel.component.name", ) } // AttrComponentType returns an optional attribute for the "otel.component.type" // semantic convention. It represents a name identifying the type of the // OpenTelemetry component. func (SDKExporterLogExported) ( ComponentTypeAttr) attribute.KeyValue { return attribute.String("otel.component.type", string()) } // AttrServerAddress returns an optional attribute for the "server.address" // semantic convention. It represents the server domain name if available without // reverse DNS lookup; otherwise, IP address or Unix domain socket name. func (SDKExporterLogExported) ( string) attribute.KeyValue { return attribute.String("server.address", ) } // AttrServerPort returns an optional attribute for the "server.port" semantic // convention. It represents the server port number. func (SDKExporterLogExported) ( int) attribute.KeyValue { return attribute.Int("server.port", ) } // SDKExporterLogInflight is an instrument used to record metric values // conforming to the "otel.sdk.exporter.log.inflight" semantic conventions. It // represents the number of log records which were passed to the exporter, but // that have not been exported yet (neither successful, nor failed). type SDKExporterLogInflight struct { metric.Int64UpDownCounter } // NewSDKExporterLogInflight returns a new SDKExporterLogInflight instrument. func ( metric.Meter, ...metric.Int64UpDownCounterOption, ) (SDKExporterLogInflight, error) { // Check if the meter is nil. if == nil { return SDKExporterLogInflight{noop.Int64UpDownCounter{}}, nil } , := .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}"), }, ...)..., ) if != nil { return SDKExporterLogInflight{noop.Int64UpDownCounter{}}, } return SDKExporterLogInflight{}, nil } // Inst returns the underlying metric instrument. func ( SDKExporterLogInflight) () metric.Int64UpDownCounter { return .Int64UpDownCounter } // Name returns the semantic convention name of the instrument. func (SDKExporterLogInflight) () string { return "otel.sdk.exporter.log.inflight" } // Unit returns the semantic convention unit of the instrument func (SDKExporterLogInflight) () string { return "{log_record}" } // Description returns the semantic convention description of the instrument func (SDKExporterLogInflight) () string { return "The number of log records which were passed to the exporter, but that have not been exported yet (neither successful, nor failed)." } // Add adds incr to the existing count for attrs. // // All additional attrs passed are included in the recorded value. // // For successful exports, `error.type` MUST NOT be set. For failed exports, // `error.type` MUST contain the failure cause. func ( SDKExporterLogInflight) ( context.Context, int64, ...attribute.KeyValue, ) { if len() == 0 { .Int64UpDownCounter.Add(, ) return } := addOptPool.Get().(*[]metric.AddOption) defer func() { * = (*)[:0] addOptPool.Put() }() * = append( *, metric.WithAttributes( ..., ), ) .Int64UpDownCounter.Add(, , *...) } // AddSet adds incr to the existing count for set. // // For successful exports, `error.type` MUST NOT be set. For failed exports, // `error.type` MUST contain the failure cause. func ( SDKExporterLogInflight) ( context.Context, int64, attribute.Set) { if .Len() == 0 { .Int64UpDownCounter.Add(, ) return } := addOptPool.Get().(*[]metric.AddOption) defer func() { * = (*)[:0] addOptPool.Put() }() * = append(*, metric.WithAttributeSet()) .Int64UpDownCounter.Add(, , *...) } // AttrComponentName returns an optional attribute for the "otel.component.name" // semantic convention. It represents a name uniquely identifying the instance of // the OpenTelemetry component within its containing SDK instance. func (SDKExporterLogInflight) ( string) attribute.KeyValue { return attribute.String("otel.component.name", ) } // AttrComponentType returns an optional attribute for the "otel.component.type" // semantic convention. It represents a name identifying the type of the // OpenTelemetry component. func (SDKExporterLogInflight) ( ComponentTypeAttr) attribute.KeyValue { return attribute.String("otel.component.type", string()) } // AttrServerAddress returns an optional attribute for the "server.address" // semantic convention. It represents the server domain name if available without // reverse DNS lookup; otherwise, IP address or Unix domain socket name. func (SDKExporterLogInflight) ( string) attribute.KeyValue { return attribute.String("server.address", ) } // AttrServerPort returns an optional attribute for the "server.port" semantic // convention. It represents the server port number. func (SDKExporterLogInflight) ( int) attribute.KeyValue { return attribute.Int("server.port", ) } // SDKExporterMetricDataPointExported is an instrument used to record metric // values conforming to the "otel.sdk.exporter.metric_data_point.exported" // semantic conventions. It represents the number of metric data points for which // the export has finished, either successful or failed. type SDKExporterMetricDataPointExported struct { metric.Int64Counter } // NewSDKExporterMetricDataPointExported returns a new // SDKExporterMetricDataPointExported instrument. func ( metric.Meter, ...metric.Int64CounterOption, ) (SDKExporterMetricDataPointExported, error) { // Check if the meter is nil. if == nil { return SDKExporterMetricDataPointExported{noop.Int64Counter{}}, nil } , := .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}"), }, ...)..., ) if != nil { return SDKExporterMetricDataPointExported{noop.Int64Counter{}}, } return SDKExporterMetricDataPointExported{}, nil } // Inst returns the underlying metric instrument. func ( SDKExporterMetricDataPointExported) () metric.Int64Counter { return .Int64Counter } // Name returns the semantic convention name of the instrument. func (SDKExporterMetricDataPointExported) () string { return "otel.sdk.exporter.metric_data_point.exported" } // Unit returns the semantic convention unit of the instrument func (SDKExporterMetricDataPointExported) () string { return "{data_point}" } // Description returns the semantic convention description of the instrument func (SDKExporterMetricDataPointExported) () string { return "The number of metric data points for which the export has finished, either successful or failed." } // Add adds incr to the existing count for attrs. // // All additional attrs passed are included in the recorded value. // // For successful exports, `error.type` MUST NOT be set. For failed exports, // `error.type` MUST contain the failure cause. // For exporters with partial success semantics (e.g. OTLP with // `rejected_data_points`), rejected data points MUST count as failed and only // non-rejected data points count as success. // If no rejection reason is available, `rejected` SHOULD be used as value for // `error.type`. func ( SDKExporterMetricDataPointExported) ( context.Context, int64, ...attribute.KeyValue, ) { if len() == 0 { .Int64Counter.Add(, ) return } := addOptPool.Get().(*[]metric.AddOption) defer func() { * = (*)[:0] addOptPool.Put() }() * = append( *, metric.WithAttributes( ..., ), ) .Int64Counter.Add(, , *...) } // AddSet adds incr to the existing count for set. // // For successful exports, `error.type` MUST NOT be set. For failed exports, // `error.type` MUST contain the failure cause. // For exporters with partial success semantics (e.g. OTLP with // `rejected_data_points`), rejected data points MUST count as failed and only // non-rejected data points count as success. // If no rejection reason is available, `rejected` SHOULD be used as value for // `error.type`. func ( SDKExporterMetricDataPointExported) ( context.Context, int64, attribute.Set) { if .Len() == 0 { .Int64Counter.Add(, ) return } := addOptPool.Get().(*[]metric.AddOption) defer func() { * = (*)[:0] addOptPool.Put() }() * = append(*, metric.WithAttributeSet()) .Int64Counter.Add(, , *...) } // AttrErrorType returns an optional attribute for the "error.type" semantic // convention. It represents the describes a class of error the operation ended // with. func (SDKExporterMetricDataPointExported) ( ErrorTypeAttr) attribute.KeyValue { return attribute.String("error.type", string()) } // AttrComponentName returns an optional attribute for the "otel.component.name" // semantic convention. It represents a name uniquely identifying the instance of // the OpenTelemetry component within its containing SDK instance. func (SDKExporterMetricDataPointExported) ( string) attribute.KeyValue { return attribute.String("otel.component.name", ) } // AttrComponentType returns an optional attribute for the "otel.component.type" // semantic convention. It represents a name identifying the type of the // OpenTelemetry component. func (SDKExporterMetricDataPointExported) ( ComponentTypeAttr) attribute.KeyValue { return attribute.String("otel.component.type", string()) } // AttrServerAddress returns an optional attribute for the "server.address" // semantic convention. It represents the server domain name if available without // reverse DNS lookup; otherwise, IP address or Unix domain socket name. func (SDKExporterMetricDataPointExported) ( string) attribute.KeyValue { return attribute.String("server.address", ) } // AttrServerPort returns an optional attribute for the "server.port" semantic // convention. It represents the server port number. func (SDKExporterMetricDataPointExported) ( int) attribute.KeyValue { return attribute.Int("server.port", ) } // SDKExporterMetricDataPointInflight is an instrument used to record metric // values conforming to the "otel.sdk.exporter.metric_data_point.inflight" // semantic conventions. It represents the number of metric data points which // were passed to the exporter, but that have not been exported yet (neither // successful, nor failed). type SDKExporterMetricDataPointInflight struct { metric.Int64UpDownCounter } // NewSDKExporterMetricDataPointInflight returns a new // SDKExporterMetricDataPointInflight instrument. func ( metric.Meter, ...metric.Int64UpDownCounterOption, ) (SDKExporterMetricDataPointInflight, error) { // Check if the meter is nil. if == nil { return SDKExporterMetricDataPointInflight{noop.Int64UpDownCounter{}}, nil } , := .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}"), }, ...)..., ) if != nil { return SDKExporterMetricDataPointInflight{noop.Int64UpDownCounter{}}, } return SDKExporterMetricDataPointInflight{}, nil } // Inst returns the underlying metric instrument. func ( SDKExporterMetricDataPointInflight) () metric.Int64UpDownCounter { return .Int64UpDownCounter } // Name returns the semantic convention name of the instrument. func (SDKExporterMetricDataPointInflight) () string { return "otel.sdk.exporter.metric_data_point.inflight" } // Unit returns the semantic convention unit of the instrument func (SDKExporterMetricDataPointInflight) () string { return "{data_point}" } // Description returns the semantic convention description of the instrument func (SDKExporterMetricDataPointInflight) () 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)." } // Add adds incr to the existing count for attrs. // // All additional attrs passed are included in the recorded value. // // For successful exports, `error.type` MUST NOT be set. For failed exports, // `error.type` MUST contain the failure cause. func ( SDKExporterMetricDataPointInflight) ( context.Context, int64, ...attribute.KeyValue, ) { if len() == 0 { .Int64UpDownCounter.Add(, ) return } := addOptPool.Get().(*[]metric.AddOption) defer func() { * = (*)[:0] addOptPool.Put() }() * = append( *, metric.WithAttributes( ..., ), ) .Int64UpDownCounter.Add(, , *...) } // AddSet adds incr to the existing count for set. // // For successful exports, `error.type` MUST NOT be set. For failed exports, // `error.type` MUST contain the failure cause. func ( SDKExporterMetricDataPointInflight) ( context.Context, int64, attribute.Set) { if .Len() == 0 { .Int64UpDownCounter.Add(, ) return } := addOptPool.Get().(*[]metric.AddOption) defer func() { * = (*)[:0] addOptPool.Put() }() * = append(*, metric.WithAttributeSet()) .Int64UpDownCounter.Add(, , *...) } // AttrComponentName returns an optional attribute for the "otel.component.name" // semantic convention. It represents a name uniquely identifying the instance of // the OpenTelemetry component within its containing SDK instance. func (SDKExporterMetricDataPointInflight) ( string) attribute.KeyValue { return attribute.String("otel.component.name", ) } // AttrComponentType returns an optional attribute for the "otel.component.type" // semantic convention. It represents a name identifying the type of the // OpenTelemetry component. func (SDKExporterMetricDataPointInflight) ( ComponentTypeAttr) attribute.KeyValue { return attribute.String("otel.component.type", string()) } // AttrServerAddress returns an optional attribute for the "server.address" // semantic convention. It represents the server domain name if available without // reverse DNS lookup; otherwise, IP address or Unix domain socket name. func (SDKExporterMetricDataPointInflight) ( string) attribute.KeyValue { return attribute.String("server.address", ) } // AttrServerPort returns an optional attribute for the "server.port" semantic // convention. It represents the server port number. func (SDKExporterMetricDataPointInflight) ( int) attribute.KeyValue { return attribute.Int("server.port", ) } // SDKExporterOperationDuration is an instrument used to record metric values // conforming to the "otel.sdk.exporter.operation.duration" semantic conventions. // It represents the duration of exporting a batch of telemetry records. type SDKExporterOperationDuration struct { metric.Float64Histogram } // NewSDKExporterOperationDuration returns a new SDKExporterOperationDuration // instrument. func ( metric.Meter, ...metric.Float64HistogramOption, ) (SDKExporterOperationDuration, error) { // Check if the meter is nil. if == nil { return SDKExporterOperationDuration{noop.Float64Histogram{}}, nil } , := .Float64Histogram( "otel.sdk.exporter.operation.duration", append([]metric.Float64HistogramOption{ metric.WithDescription("The duration of exporting a batch of telemetry records."), metric.WithUnit("s"), }, ...)..., ) if != nil { return SDKExporterOperationDuration{noop.Float64Histogram{}}, } return SDKExporterOperationDuration{}, nil } // Inst returns the underlying metric instrument. func ( SDKExporterOperationDuration) () metric.Float64Histogram { return .Float64Histogram } // Name returns the semantic convention name of the instrument. func (SDKExporterOperationDuration) () string { return "otel.sdk.exporter.operation.duration" } // Unit returns the semantic convention unit of the instrument func (SDKExporterOperationDuration) () string { return "s" } // Description returns the semantic convention description of the instrument func (SDKExporterOperationDuration) () string { return "The duration of exporting a batch of telemetry records." } // Record records val to the current distribution for attrs. // // All additional attrs passed are included in the recorded value. // // This metric defines successful operations using the full success definitions // for [http] // and [grpc]. Anything else is defined as an unsuccessful operation. For // successful // operations, `error.type` MUST NOT be set. For unsuccessful export operations, // `error.type` MUST contain a relevant failure cause. // // [http]: https://github.com/open-telemetry/opentelemetry-proto/blob/v1.5.0/docs/specification.md#full-success-1 // [grpc]: https://github.com/open-telemetry/opentelemetry-proto/blob/v1.5.0/docs/specification.md#full-success func ( SDKExporterOperationDuration) ( context.Context, float64, ...attribute.KeyValue, ) { if len() == 0 { .Float64Histogram.Record(, ) return } := recOptPool.Get().(*[]metric.RecordOption) defer func() { * = (*)[:0] recOptPool.Put() }() * = append( *, metric.WithAttributes( ..., ), ) .Float64Histogram.Record(, , *...) } // RecordSet records val to the current distribution for set. // // This metric defines successful operations using the full success definitions // for [http] // and [grpc]. Anything else is defined as an unsuccessful operation. For // successful // operations, `error.type` MUST NOT be set. For unsuccessful export operations, // `error.type` MUST contain a relevant failure cause. // // [http]: https://github.com/open-telemetry/opentelemetry-proto/blob/v1.5.0/docs/specification.md#full-success-1 // [grpc]: https://github.com/open-telemetry/opentelemetry-proto/blob/v1.5.0/docs/specification.md#full-success func ( SDKExporterOperationDuration) ( context.Context, float64, attribute.Set) { if .Len() == 0 { .Float64Histogram.Record(, ) } := recOptPool.Get().(*[]metric.RecordOption) defer func() { * = (*)[:0] recOptPool.Put() }() * = append(*, metric.WithAttributeSet()) .Float64Histogram.Record(, , *...) } // AttrErrorType returns an optional attribute for the "error.type" semantic // convention. It represents the describes a class of error the operation ended // with. func (SDKExporterOperationDuration) ( ErrorTypeAttr) attribute.KeyValue { return attribute.String("error.type", string()) } // AttrHTTPResponseStatusCode returns an optional attribute for the // "http.response.status_code" semantic convention. It represents the HTTP status // code of the last HTTP request performed in scope of this export call. func (SDKExporterOperationDuration) ( int) attribute.KeyValue { return attribute.Int("http.response.status_code", ) } // AttrComponentName returns an optional attribute for the "otel.component.name" // semantic convention. It represents a name uniquely identifying the instance of // the OpenTelemetry component within its containing SDK instance. func (SDKExporterOperationDuration) ( string) attribute.KeyValue { return attribute.String("otel.component.name", ) } // AttrComponentType returns an optional attribute for the "otel.component.type" // semantic convention. It represents a name identifying the type of the // OpenTelemetry component. func (SDKExporterOperationDuration) ( ComponentTypeAttr) attribute.KeyValue { return attribute.String("otel.component.type", string()) } // AttrRPCGRPCStatusCode returns an optional attribute for the // "rpc.grpc.status_code" semantic convention. It represents the gRPC status code // of the last gRPC requests performed in scope of this export call. func (SDKExporterOperationDuration) ( RPCGRPCStatusCodeAttr) attribute.KeyValue { return attribute.Int64("rpc.grpc.status_code", int64()) } // AttrServerAddress returns an optional attribute for the "server.address" // semantic convention. It represents the server domain name if available without // reverse DNS lookup; otherwise, IP address or Unix domain socket name. func (SDKExporterOperationDuration) ( string) attribute.KeyValue { return attribute.String("server.address", ) } // AttrServerPort returns an optional attribute for the "server.port" semantic // convention. It represents the server port number. func (SDKExporterOperationDuration) ( int) attribute.KeyValue { return attribute.Int("server.port", ) } // SDKExporterSpanExported is an instrument used to record metric values // conforming to the "otel.sdk.exporter.span.exported" semantic conventions. It // represents the number of spans for which the export has finished, either // successful or failed. type SDKExporterSpanExported struct { metric.Int64Counter } // NewSDKExporterSpanExported returns a new SDKExporterSpanExported instrument. func ( metric.Meter, ...metric.Int64CounterOption, ) (SDKExporterSpanExported, error) { // Check if the meter is nil. if == nil { return SDKExporterSpanExported{noop.Int64Counter{}}, nil } , := .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}"), }, ...)..., ) if != nil { return SDKExporterSpanExported{noop.Int64Counter{}}, } return SDKExporterSpanExported{}, nil } // Inst returns the underlying metric instrument. func ( SDKExporterSpanExported) () metric.Int64Counter { return .Int64Counter } // Name returns the semantic convention name of the instrument. func (SDKExporterSpanExported) () string { return "otel.sdk.exporter.span.exported" } // Unit returns the semantic convention unit of the instrument func (SDKExporterSpanExported) () string { return "{span}" } // Description returns the semantic convention description of the instrument func (SDKExporterSpanExported) () string { return "The number of spans for which the export has finished, either successful or failed." } // Add adds incr to the existing count for attrs. // // All additional attrs passed are included in the recorded value. // // For successful exports, `error.type` MUST NOT be set. For failed exports, // `error.type` MUST contain the failure cause. // For exporters with partial success semantics (e.g. OTLP with `rejected_spans` // ), rejected spans MUST count as failed and only non-rejected spans count as // success. // If no rejection reason is available, `rejected` SHOULD be used as value for // `error.type`. func ( SDKExporterSpanExported) ( context.Context, int64, ...attribute.KeyValue, ) { if len() == 0 { .Int64Counter.Add(, ) return } := addOptPool.Get().(*[]metric.AddOption) defer func() { * = (*)[:0] addOptPool.Put() }() * = append( *, metric.WithAttributes( ..., ), ) .Int64Counter.Add(, , *...) } // AddSet adds incr to the existing count for set. // // For successful exports, `error.type` MUST NOT be set. For failed exports, // `error.type` MUST contain the failure cause. // For exporters with partial success semantics (e.g. OTLP with `rejected_spans` // ), rejected spans MUST count as failed and only non-rejected spans count as // success. // If no rejection reason is available, `rejected` SHOULD be used as value for // `error.type`. func ( SDKExporterSpanExported) ( context.Context, int64, attribute.Set) { if .Len() == 0 { .Int64Counter.Add(, ) return } := addOptPool.Get().(*[]metric.AddOption) defer func() { * = (*)[:0] addOptPool.Put() }() * = append(*, metric.WithAttributeSet()) .Int64Counter.Add(, , *...) } // AttrErrorType returns an optional attribute for the "error.type" semantic // convention. It represents the describes a class of error the operation ended // with. func (SDKExporterSpanExported) ( ErrorTypeAttr) attribute.KeyValue { return attribute.String("error.type", string()) } // AttrComponentName returns an optional attribute for the "otel.component.name" // semantic convention. It represents a name uniquely identifying the instance of // the OpenTelemetry component within its containing SDK instance. func (SDKExporterSpanExported) ( string) attribute.KeyValue { return attribute.String("otel.component.name", ) } // AttrComponentType returns an optional attribute for the "otel.component.type" // semantic convention. It represents a name identifying the type of the // OpenTelemetry component. func (SDKExporterSpanExported) ( ComponentTypeAttr) attribute.KeyValue { return attribute.String("otel.component.type", string()) } // AttrServerAddress returns an optional attribute for the "server.address" // semantic convention. It represents the server domain name if available without // reverse DNS lookup; otherwise, IP address or Unix domain socket name. func (SDKExporterSpanExported) ( string) attribute.KeyValue { return attribute.String("server.address", ) } // AttrServerPort returns an optional attribute for the "server.port" semantic // convention. It represents the server port number. func (SDKExporterSpanExported) ( int) attribute.KeyValue { return attribute.Int("server.port", ) } // SDKExporterSpanInflight is an instrument used to record metric values // conforming to the "otel.sdk.exporter.span.inflight" semantic conventions. It // represents the number of spans which were passed to the exporter, but that // have not been exported yet (neither successful, nor failed). type SDKExporterSpanInflight struct { metric.Int64UpDownCounter } // NewSDKExporterSpanInflight returns a new SDKExporterSpanInflight instrument. func ( metric.Meter, ...metric.Int64UpDownCounterOption, ) (SDKExporterSpanInflight, error) { // Check if the meter is nil. if == nil { return SDKExporterSpanInflight{noop.Int64UpDownCounter{}}, nil } , := .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}"), }, ...)..., ) if != nil { return SDKExporterSpanInflight{noop.Int64UpDownCounter{}}, } return SDKExporterSpanInflight{}, nil } // Inst returns the underlying metric instrument. func ( SDKExporterSpanInflight) () metric.Int64UpDownCounter { return .Int64UpDownCounter } // Name returns the semantic convention name of the instrument. func (SDKExporterSpanInflight) () string { return "otel.sdk.exporter.span.inflight" } // Unit returns the semantic convention unit of the instrument func (SDKExporterSpanInflight) () string { return "{span}" } // Description returns the semantic convention description of the instrument func (SDKExporterSpanInflight) () string { return "The number of spans which were passed to the exporter, but that have not been exported yet (neither successful, nor failed)." } // Add adds incr to the existing count for attrs. // // All additional attrs passed are included in the recorded value. // // For successful exports, `error.type` MUST NOT be set. For failed exports, // `error.type` MUST contain the failure cause. func ( SDKExporterSpanInflight) ( context.Context, int64, ...attribute.KeyValue, ) { if len() == 0 { .Int64UpDownCounter.Add(, ) return } := addOptPool.Get().(*[]metric.AddOption) defer func() { * = (*)[:0] addOptPool.Put() }() * = append( *, metric.WithAttributes( ..., ), ) .Int64UpDownCounter.Add(, , *...) } // AddSet adds incr to the existing count for set. // // For successful exports, `error.type` MUST NOT be set. For failed exports, // `error.type` MUST contain the failure cause. func ( SDKExporterSpanInflight) ( context.Context, int64, attribute.Set) { if .Len() == 0 { .Int64UpDownCounter.Add(, ) return } := addOptPool.Get().(*[]metric.AddOption) defer func() { * = (*)[:0] addOptPool.Put() }() * = append(*, metric.WithAttributeSet()) .Int64UpDownCounter.Add(, , *...) } // AttrComponentName returns an optional attribute for the "otel.component.name" // semantic convention. It represents a name uniquely identifying the instance of // the OpenTelemetry component within its containing SDK instance. func (SDKExporterSpanInflight) ( string) attribute.KeyValue { return attribute.String("otel.component.name", ) } // AttrComponentType returns an optional attribute for the "otel.component.type" // semantic convention. It represents a name identifying the type of the // OpenTelemetry component. func (SDKExporterSpanInflight) ( ComponentTypeAttr) attribute.KeyValue { return attribute.String("otel.component.type", string()) } // AttrServerAddress returns an optional attribute for the "server.address" // semantic convention. It represents the server domain name if available without // reverse DNS lookup; otherwise, IP address or Unix domain socket name. func (SDKExporterSpanInflight) ( string) attribute.KeyValue { return attribute.String("server.address", ) } // AttrServerPort returns an optional attribute for the "server.port" semantic // convention. It represents the server port number. func (SDKExporterSpanInflight) ( int) attribute.KeyValue { return attribute.Int("server.port", ) } // SDKLogCreated is an instrument used to record metric values conforming to the // "otel.sdk.log.created" semantic conventions. It represents the number of logs // submitted to enabled SDK Loggers. type SDKLogCreated struct { metric.Int64Counter } // NewSDKLogCreated returns a new SDKLogCreated instrument. func ( metric.Meter, ...metric.Int64CounterOption, ) (SDKLogCreated, error) { // Check if the meter is nil. if == nil { return SDKLogCreated{noop.Int64Counter{}}, nil } , := .Int64Counter( "otel.sdk.log.created", append([]metric.Int64CounterOption{ metric.WithDescription("The number of logs submitted to enabled SDK Loggers."), metric.WithUnit("{log_record}"), }, ...)..., ) if != nil { return SDKLogCreated{noop.Int64Counter{}}, } return SDKLogCreated{}, nil } // Inst returns the underlying metric instrument. func ( SDKLogCreated) () metric.Int64Counter { return .Int64Counter } // Name returns the semantic convention name of the instrument. func (SDKLogCreated) () string { return "otel.sdk.log.created" } // Unit returns the semantic convention unit of the instrument func (SDKLogCreated) () string { return "{log_record}" } // Description returns the semantic convention description of the instrument func (SDKLogCreated) () string { return "The number of logs submitted to enabled SDK Loggers." } // Add adds incr to the existing count for attrs. func ( SDKLogCreated) ( context.Context, int64, ...attribute.KeyValue) { if len() == 0 { .Int64Counter.Add(, ) return } := addOptPool.Get().(*[]metric.AddOption) defer func() { * = (*)[:0] addOptPool.Put() }() * = append(*, metric.WithAttributes(...)) .Int64Counter.Add(, , *...) } // AddSet adds incr to the existing count for set. func ( SDKLogCreated) ( context.Context, int64, attribute.Set) { if .Len() == 0 { .Int64Counter.Add(, ) return } := addOptPool.Get().(*[]metric.AddOption) defer func() { * = (*)[:0] addOptPool.Put() }() * = append(*, metric.WithAttributeSet()) .Int64Counter.Add(, , *...) } // SDKMetricReaderCollectionDuration is an instrument used to record metric // values conforming to the "otel.sdk.metric_reader.collection.duration" semantic // conventions. It represents the duration of the collect operation of the metric // reader. type SDKMetricReaderCollectionDuration struct { metric.Float64Histogram } // NewSDKMetricReaderCollectionDuration returns a new // SDKMetricReaderCollectionDuration instrument. func ( metric.Meter, ...metric.Float64HistogramOption, ) (SDKMetricReaderCollectionDuration, error) { // Check if the meter is nil. if == nil { return SDKMetricReaderCollectionDuration{noop.Float64Histogram{}}, nil } , := .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"), }, ...)..., ) if != nil { return SDKMetricReaderCollectionDuration{noop.Float64Histogram{}}, } return SDKMetricReaderCollectionDuration{}, nil } // Inst returns the underlying metric instrument. func ( SDKMetricReaderCollectionDuration) () metric.Float64Histogram { return .Float64Histogram } // Name returns the semantic convention name of the instrument. func (SDKMetricReaderCollectionDuration) () string { return "otel.sdk.metric_reader.collection.duration" } // Unit returns the semantic convention unit of the instrument func (SDKMetricReaderCollectionDuration) () string { return "s" } // Description returns the semantic convention description of the instrument func (SDKMetricReaderCollectionDuration) () string { return "The duration of the collect operation of the metric reader." } // Record records val to the current distribution for attrs. // // All additional attrs passed are included in the recorded value. // // For successful collections, `error.type` MUST NOT be set. For failed // collections, `error.type` SHOULD contain the failure cause. // It can happen that metrics collection is successful for some MetricProducers, // while others fail. In that case `error.type` SHOULD be set to any of the // failure causes. func ( SDKMetricReaderCollectionDuration) ( context.Context, float64, ...attribute.KeyValue, ) { if len() == 0 { .Float64Histogram.Record(, ) return } := recOptPool.Get().(*[]metric.RecordOption) defer func() { * = (*)[:0] recOptPool.Put() }() * = append( *, metric.WithAttributes( ..., ), ) .Float64Histogram.Record(, , *...) } // RecordSet records val to the current distribution for set. // // For successful collections, `error.type` MUST NOT be set. For failed // collections, `error.type` SHOULD contain the failure cause. // It can happen that metrics collection is successful for some MetricProducers, // while others fail. In that case `error.type` SHOULD be set to any of the // failure causes. func ( SDKMetricReaderCollectionDuration) ( context.Context, float64, attribute.Set) { if .Len() == 0 { .Float64Histogram.Record(, ) } := recOptPool.Get().(*[]metric.RecordOption) defer func() { * = (*)[:0] recOptPool.Put() }() * = append(*, metric.WithAttributeSet()) .Float64Histogram.Record(, , *...) } // AttrErrorType returns an optional attribute for the "error.type" semantic // convention. It represents the describes a class of error the operation ended // with. func (SDKMetricReaderCollectionDuration) ( ErrorTypeAttr) attribute.KeyValue { return attribute.String("error.type", string()) } // AttrComponentName returns an optional attribute for the "otel.component.name" // semantic convention. It represents a name uniquely identifying the instance of // the OpenTelemetry component within its containing SDK instance. func (SDKMetricReaderCollectionDuration) ( string) attribute.KeyValue { return attribute.String("otel.component.name", ) } // AttrComponentType returns an optional attribute for the "otel.component.type" // semantic convention. It represents a name identifying the type of the // OpenTelemetry component. func (SDKMetricReaderCollectionDuration) ( ComponentTypeAttr) attribute.KeyValue { return attribute.String("otel.component.type", string()) } // SDKProcessorLogProcessed is an instrument used to record metric values // conforming to the "otel.sdk.processor.log.processed" semantic conventions. It // represents the number of log records for which the processing has finished, // either successful or failed. type SDKProcessorLogProcessed struct { metric.Int64Counter } // NewSDKProcessorLogProcessed returns a new SDKProcessorLogProcessed instrument. func ( metric.Meter, ...metric.Int64CounterOption, ) (SDKProcessorLogProcessed, error) { // Check if the meter is nil. if == nil { return SDKProcessorLogProcessed{noop.Int64Counter{}}, nil } , := .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}"), }, ...)..., ) if != nil { return SDKProcessorLogProcessed{noop.Int64Counter{}}, } return SDKProcessorLogProcessed{}, nil } // Inst returns the underlying metric instrument. func ( SDKProcessorLogProcessed) () metric.Int64Counter { return .Int64Counter } // Name returns the semantic convention name of the instrument. func (SDKProcessorLogProcessed) () string { return "otel.sdk.processor.log.processed" } // Unit returns the semantic convention unit of the instrument func (SDKProcessorLogProcessed) () string { return "{log_record}" } // Description returns the semantic convention description of the instrument func (SDKProcessorLogProcessed) () string { return "The number of log records for which the processing has finished, either successful or failed." } // Add adds incr to the existing count for attrs. // // All additional attrs passed are included in the recorded value. // // For successful processing, `error.type` MUST NOT be set. For failed // processing, `error.type` MUST contain the failure cause. // For the SDK Simple and Batching Log Record Processor a log record is // considered to be processed already when it has been submitted to the exporter, // not when the corresponding export call has finished. func ( SDKProcessorLogProcessed) ( context.Context, int64, ...attribute.KeyValue, ) { if len() == 0 { .Int64Counter.Add(, ) return } := addOptPool.Get().(*[]metric.AddOption) defer func() { * = (*)[:0] addOptPool.Put() }() * = append( *, metric.WithAttributes( ..., ), ) .Int64Counter.Add(, , *...) } // AddSet adds incr to the existing count for set. // // For successful processing, `error.type` MUST NOT be set. For failed // processing, `error.type` MUST contain the failure cause. // For the SDK Simple and Batching Log Record Processor a log record is // considered to be processed already when it has been submitted to the exporter, // not when the corresponding export call has finished. func ( SDKProcessorLogProcessed) ( context.Context, int64, attribute.Set) { if .Len() == 0 { .Int64Counter.Add(, ) return } := addOptPool.Get().(*[]metric.AddOption) defer func() { * = (*)[:0] addOptPool.Put() }() * = append(*, metric.WithAttributeSet()) .Int64Counter.Add(, , *...) } // AttrErrorType returns an optional attribute for the "error.type" semantic // convention. It represents a low-cardinality description of the failure reason. // SDK Batching Log Record Processors MUST use `queue_full` for log records // dropped due to a full queue. func (SDKProcessorLogProcessed) ( ErrorTypeAttr) attribute.KeyValue { return attribute.String("error.type", string()) } // AttrComponentName returns an optional attribute for the "otel.component.name" // semantic convention. It represents a name uniquely identifying the instance of // the OpenTelemetry component within its containing SDK instance. func (SDKProcessorLogProcessed) ( string) attribute.KeyValue { return attribute.String("otel.component.name", ) } // AttrComponentType returns an optional attribute for the "otel.component.type" // semantic convention. It represents a name identifying the type of the // OpenTelemetry component. func (SDKProcessorLogProcessed) ( ComponentTypeAttr) attribute.KeyValue { return attribute.String("otel.component.type", string()) } // SDKProcessorLogQueueCapacity is an instrument used to record metric values // conforming to the "otel.sdk.processor.log.queue.capacity" semantic // conventions. It represents the maximum number of log records the queue of a // given instance of an SDK Log Record processor can hold. type SDKProcessorLogQueueCapacity struct { metric.Int64ObservableUpDownCounter } // NewSDKProcessorLogQueueCapacity returns a new SDKProcessorLogQueueCapacity // instrument. func ( metric.Meter, ...metric.Int64ObservableUpDownCounterOption, ) (SDKProcessorLogQueueCapacity, error) { // Check if the meter is nil. if == nil { return SDKProcessorLogQueueCapacity{noop.Int64ObservableUpDownCounter{}}, nil } , := .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}"), }, ...)..., ) if != nil { return SDKProcessorLogQueueCapacity{noop.Int64ObservableUpDownCounter{}}, } return SDKProcessorLogQueueCapacity{}, nil } // Inst returns the underlying metric instrument. func ( SDKProcessorLogQueueCapacity) () metric.Int64ObservableUpDownCounter { return .Int64ObservableUpDownCounter } // Name returns the semantic convention name of the instrument. func (SDKProcessorLogQueueCapacity) () string { return "otel.sdk.processor.log.queue.capacity" } // Unit returns the semantic convention unit of the instrument func (SDKProcessorLogQueueCapacity) () string { return "{log_record}" } // Description returns the semantic convention description of the instrument func (SDKProcessorLogQueueCapacity) () string { return "The maximum number of log records the queue of a given instance of an SDK Log Record processor can hold." } // AttrComponentName returns an optional attribute for the "otel.component.name" // semantic convention. It represents a name uniquely identifying the instance of // the OpenTelemetry component within its containing SDK instance. func (SDKProcessorLogQueueCapacity) ( string) attribute.KeyValue { return attribute.String("otel.component.name", ) } // AttrComponentType returns an optional attribute for the "otel.component.type" // semantic convention. It represents a name identifying the type of the // OpenTelemetry component. func (SDKProcessorLogQueueCapacity) ( ComponentTypeAttr) attribute.KeyValue { return attribute.String("otel.component.type", string()) } // SDKProcessorLogQueueSize is an instrument used to record metric values // conforming to the "otel.sdk.processor.log.queue.size" semantic conventions. It // represents the number of log records in the queue of a given instance of an // SDK log processor. type SDKProcessorLogQueueSize struct { metric.Int64ObservableUpDownCounter } // NewSDKProcessorLogQueueSize returns a new SDKProcessorLogQueueSize instrument. func ( metric.Meter, ...metric.Int64ObservableUpDownCounterOption, ) (SDKProcessorLogQueueSize, error) { // Check if the meter is nil. if == nil { return SDKProcessorLogQueueSize{noop.Int64ObservableUpDownCounter{}}, nil } , := .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}"), }, ...)..., ) if != nil { return SDKProcessorLogQueueSize{noop.Int64ObservableUpDownCounter{}}, } return SDKProcessorLogQueueSize{}, nil } // Inst returns the underlying metric instrument. func ( SDKProcessorLogQueueSize) () metric.Int64ObservableUpDownCounter { return .Int64ObservableUpDownCounter } // Name returns the semantic convention name of the instrument. func (SDKProcessorLogQueueSize) () string { return "otel.sdk.processor.log.queue.size" } // Unit returns the semantic convention unit of the instrument func (SDKProcessorLogQueueSize) () string { return "{log_record}" } // Description returns the semantic convention description of the instrument func (SDKProcessorLogQueueSize) () string { return "The number of log records in the queue of a given instance of an SDK log processor." } // AttrComponentName returns an optional attribute for the "otel.component.name" // semantic convention. It represents a name uniquely identifying the instance of // the OpenTelemetry component within its containing SDK instance. func (SDKProcessorLogQueueSize) ( string) attribute.KeyValue { return attribute.String("otel.component.name", ) } // AttrComponentType returns an optional attribute for the "otel.component.type" // semantic convention. It represents a name identifying the type of the // OpenTelemetry component. func (SDKProcessorLogQueueSize) ( ComponentTypeAttr) attribute.KeyValue { return attribute.String("otel.component.type", string()) } // SDKProcessorSpanProcessed is an instrument used to record metric values // conforming to the "otel.sdk.processor.span.processed" semantic conventions. It // represents the number of spans for which the processing has finished, either // successful or failed. type SDKProcessorSpanProcessed struct { metric.Int64Counter } // NewSDKProcessorSpanProcessed returns a new SDKProcessorSpanProcessed // instrument. func ( metric.Meter, ...metric.Int64CounterOption, ) (SDKProcessorSpanProcessed, error) { // Check if the meter is nil. if == nil { return SDKProcessorSpanProcessed{noop.Int64Counter{}}, nil } , := .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}"), }, ...)..., ) if != nil { return SDKProcessorSpanProcessed{noop.Int64Counter{}}, } return SDKProcessorSpanProcessed{}, nil } // Inst returns the underlying metric instrument. func ( SDKProcessorSpanProcessed) () metric.Int64Counter { return .Int64Counter } // Name returns the semantic convention name of the instrument. func (SDKProcessorSpanProcessed) () string { return "otel.sdk.processor.span.processed" } // Unit returns the semantic convention unit of the instrument func (SDKProcessorSpanProcessed) () string { return "{span}" } // Description returns the semantic convention description of the instrument func (SDKProcessorSpanProcessed) () string { return "The number of spans for which the processing has finished, either successful or failed." } // Add adds incr to the existing count for attrs. // // All additional attrs passed are included in the recorded value. // // For successful processing, `error.type` MUST NOT be set. For failed // processing, `error.type` MUST contain the failure cause. // For the SDK Simple and Batching Span Processor a span is considered to be // processed already when it has been submitted to the exporter, not when the // corresponding export call has finished. func ( SDKProcessorSpanProcessed) ( context.Context, int64, ...attribute.KeyValue, ) { if len() == 0 { .Int64Counter.Add(, ) return } := addOptPool.Get().(*[]metric.AddOption) defer func() { * = (*)[:0] addOptPool.Put() }() * = append( *, metric.WithAttributes( ..., ), ) .Int64Counter.Add(, , *...) } // AddSet adds incr to the existing count for set. // // For successful processing, `error.type` MUST NOT be set. For failed // processing, `error.type` MUST contain the failure cause. // For the SDK Simple and Batching Span Processor a span is considered to be // processed already when it has been submitted to the exporter, not when the // corresponding export call has finished. func ( SDKProcessorSpanProcessed) ( context.Context, int64, attribute.Set) { if .Len() == 0 { .Int64Counter.Add(, ) return } := addOptPool.Get().(*[]metric.AddOption) defer func() { * = (*)[:0] addOptPool.Put() }() * = append(*, metric.WithAttributeSet()) .Int64Counter.Add(, , *...) } // AttrErrorType returns an optional attribute for the "error.type" semantic // convention. It represents a low-cardinality description of the failure reason. // SDK Batching Span Processors MUST use `queue_full` for spans dropped due to a // full queue. func (SDKProcessorSpanProcessed) ( ErrorTypeAttr) attribute.KeyValue { return attribute.String("error.type", string()) } // AttrComponentName returns an optional attribute for the "otel.component.name" // semantic convention. It represents a name uniquely identifying the instance of // the OpenTelemetry component within its containing SDK instance. func (SDKProcessorSpanProcessed) ( string) attribute.KeyValue { return attribute.String("otel.component.name", ) } // AttrComponentType returns an optional attribute for the "otel.component.type" // semantic convention. It represents a name identifying the type of the // OpenTelemetry component. func (SDKProcessorSpanProcessed) ( ComponentTypeAttr) attribute.KeyValue { return attribute.String("otel.component.type", string()) } // SDKProcessorSpanQueueCapacity is an instrument used to record metric values // conforming to the "otel.sdk.processor.span.queue.capacity" semantic // conventions. It represents the maximum number of spans the queue of a given // instance of an SDK span processor can hold. type SDKProcessorSpanQueueCapacity struct { metric.Int64ObservableUpDownCounter } // NewSDKProcessorSpanQueueCapacity returns a new SDKProcessorSpanQueueCapacity // instrument. func ( metric.Meter, ...metric.Int64ObservableUpDownCounterOption, ) (SDKProcessorSpanQueueCapacity, error) { // Check if the meter is nil. if == nil { return SDKProcessorSpanQueueCapacity{noop.Int64ObservableUpDownCounter{}}, nil } , := .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}"), }, ...)..., ) if != nil { return SDKProcessorSpanQueueCapacity{noop.Int64ObservableUpDownCounter{}}, } return SDKProcessorSpanQueueCapacity{}, nil } // Inst returns the underlying metric instrument. func ( SDKProcessorSpanQueueCapacity) () metric.Int64ObservableUpDownCounter { return .Int64ObservableUpDownCounter } // Name returns the semantic convention name of the instrument. func (SDKProcessorSpanQueueCapacity) () string { return "otel.sdk.processor.span.queue.capacity" } // Unit returns the semantic convention unit of the instrument func (SDKProcessorSpanQueueCapacity) () string { return "{span}" } // Description returns the semantic convention description of the instrument func (SDKProcessorSpanQueueCapacity) () string { return "The maximum number of spans the queue of a given instance of an SDK span processor can hold." } // AttrComponentName returns an optional attribute for the "otel.component.name" // semantic convention. It represents a name uniquely identifying the instance of // the OpenTelemetry component within its containing SDK instance. func (SDKProcessorSpanQueueCapacity) ( string) attribute.KeyValue { return attribute.String("otel.component.name", ) } // AttrComponentType returns an optional attribute for the "otel.component.type" // semantic convention. It represents a name identifying the type of the // OpenTelemetry component. func (SDKProcessorSpanQueueCapacity) ( ComponentTypeAttr) attribute.KeyValue { return attribute.String("otel.component.type", string()) } // SDKProcessorSpanQueueSize is an instrument used to record metric values // conforming to the "otel.sdk.processor.span.queue.size" semantic conventions. // It represents the number of spans in the queue of a given instance of an SDK // span processor. type SDKProcessorSpanQueueSize struct { metric.Int64ObservableUpDownCounter } // NewSDKProcessorSpanQueueSize returns a new SDKProcessorSpanQueueSize // instrument. func ( metric.Meter, ...metric.Int64ObservableUpDownCounterOption, ) (SDKProcessorSpanQueueSize, error) { // Check if the meter is nil. if == nil { return SDKProcessorSpanQueueSize{noop.Int64ObservableUpDownCounter{}}, nil } , := .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}"), }, ...)..., ) if != nil { return SDKProcessorSpanQueueSize{noop.Int64ObservableUpDownCounter{}}, } return SDKProcessorSpanQueueSize{}, nil } // Inst returns the underlying metric instrument. func ( SDKProcessorSpanQueueSize) () metric.Int64ObservableUpDownCounter { return .Int64ObservableUpDownCounter } // Name returns the semantic convention name of the instrument. func (SDKProcessorSpanQueueSize) () string { return "otel.sdk.processor.span.queue.size" } // Unit returns the semantic convention unit of the instrument func (SDKProcessorSpanQueueSize) () string { return "{span}" } // Description returns the semantic convention description of the instrument func (SDKProcessorSpanQueueSize) () string { return "The number of spans in the queue of a given instance of an SDK span processor." } // AttrComponentName returns an optional attribute for the "otel.component.name" // semantic convention. It represents a name uniquely identifying the instance of // the OpenTelemetry component within its containing SDK instance. func (SDKProcessorSpanQueueSize) ( string) attribute.KeyValue { return attribute.String("otel.component.name", ) } // AttrComponentType returns an optional attribute for the "otel.component.type" // semantic convention. It represents a name identifying the type of the // OpenTelemetry component. func (SDKProcessorSpanQueueSize) ( ComponentTypeAttr) attribute.KeyValue { return attribute.String("otel.component.type", string()) } // SDKSpanLive is an instrument used to record metric values conforming to the // "otel.sdk.span.live" semantic conventions. It represents the number of created // spans with `recording=true` for which the end operation has not been called // yet. type SDKSpanLive struct { metric.Int64UpDownCounter } // NewSDKSpanLive returns a new SDKSpanLive instrument. func ( metric.Meter, ...metric.Int64UpDownCounterOption, ) (SDKSpanLive, error) { // Check if the meter is nil. if == nil { return SDKSpanLive{noop.Int64UpDownCounter{}}, nil } , := .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}"), }, ...)..., ) if != nil { return SDKSpanLive{noop.Int64UpDownCounter{}}, } return SDKSpanLive{}, nil } // Inst returns the underlying metric instrument. func ( SDKSpanLive) () metric.Int64UpDownCounter { return .Int64UpDownCounter } // Name returns the semantic convention name of the instrument. func (SDKSpanLive) () string { return "otel.sdk.span.live" } // Unit returns the semantic convention unit of the instrument func (SDKSpanLive) () string { return "{span}" } // Description returns the semantic convention description of the instrument func (SDKSpanLive) () string { return "The number of created spans with `recording=true` for which the end operation has not been called yet." } // Add adds incr to the existing count for attrs. // // All additional attrs passed are included in the recorded value. func ( SDKSpanLive) ( context.Context, int64, ...attribute.KeyValue, ) { if len() == 0 { .Int64UpDownCounter.Add(, ) return } := addOptPool.Get().(*[]metric.AddOption) defer func() { * = (*)[:0] addOptPool.Put() }() * = append( *, metric.WithAttributes( ..., ), ) .Int64UpDownCounter.Add(, , *...) } // AddSet adds incr to the existing count for set. func ( SDKSpanLive) ( context.Context, int64, attribute.Set) { if .Len() == 0 { .Int64UpDownCounter.Add(, ) return } := addOptPool.Get().(*[]metric.AddOption) defer func() { * = (*)[:0] addOptPool.Put() }() * = append(*, metric.WithAttributeSet()) .Int64UpDownCounter.Add(, , *...) } // AttrSpanSamplingResult returns an optional attribute for the // "otel.span.sampling_result" semantic convention. It represents the result // value of the sampler for this span. func (SDKSpanLive) ( SpanSamplingResultAttr) attribute.KeyValue { return attribute.String("otel.span.sampling_result", string()) } // SDKSpanStarted is an instrument used to record metric values conforming to the // "otel.sdk.span.started" semantic conventions. It represents the number of // created spans. type SDKSpanStarted struct { metric.Int64Counter } // NewSDKSpanStarted returns a new SDKSpanStarted instrument. func ( metric.Meter, ...metric.Int64CounterOption, ) (SDKSpanStarted, error) { // Check if the meter is nil. if == nil { return SDKSpanStarted{noop.Int64Counter{}}, nil } , := .Int64Counter( "otel.sdk.span.started", append([]metric.Int64CounterOption{ metric.WithDescription("The number of created spans."), metric.WithUnit("{span}"), }, ...)..., ) if != nil { return SDKSpanStarted{noop.Int64Counter{}}, } return SDKSpanStarted{}, nil } // Inst returns the underlying metric instrument. func ( SDKSpanStarted) () metric.Int64Counter { return .Int64Counter } // Name returns the semantic convention name of the instrument. func (SDKSpanStarted) () string { return "otel.sdk.span.started" } // Unit returns the semantic convention unit of the instrument func (SDKSpanStarted) () string { return "{span}" } // Description returns the semantic convention description of the instrument func (SDKSpanStarted) () string { return "The number of created spans." } // Add adds incr to the existing count for attrs. // // All additional attrs passed are included in the recorded value. // // Implementations MUST record this metric for all spans, even for non-recording // ones. func ( SDKSpanStarted) ( context.Context, int64, ...attribute.KeyValue, ) { if len() == 0 { .Int64Counter.Add(, ) return } := addOptPool.Get().(*[]metric.AddOption) defer func() { * = (*)[:0] addOptPool.Put() }() * = append( *, metric.WithAttributes( ..., ), ) .Int64Counter.Add(, , *...) } // AddSet adds incr to the existing count for set. // // Implementations MUST record this metric for all spans, even for non-recording // ones. func ( SDKSpanStarted) ( context.Context, int64, attribute.Set) { if .Len() == 0 { .Int64Counter.Add(, ) return } := addOptPool.Get().(*[]metric.AddOption) defer func() { * = (*)[:0] addOptPool.Put() }() * = append(*, metric.WithAttributeSet()) .Int64Counter.Add(, , *...) } // AttrSpanParentOrigin returns an optional attribute for the // "otel.span.parent.origin" semantic convention. It represents the determines // whether the span has a parent span, and if so, [whether it is a remote parent] // . // // [whether it is a remote parent]: https://opentelemetry.io/docs/specs/otel/trace/api/#isremote func (SDKSpanStarted) ( SpanParentOriginAttr) attribute.KeyValue { return attribute.String("otel.span.parent.origin", string()) } // AttrSpanSamplingResult returns an optional attribute for the // "otel.span.sampling_result" semantic convention. It represents the result // value of the sampler for this span. func (SDKSpanStarted) ( SpanSamplingResultAttr) attribute.KeyValue { return attribute.String("otel.span.sampling_result", string()) }