README
¶
Metric Context
The Metric Context is a Context implementation for pdata Metric, the collector's internal representation for OTLP metrics. This Context should be used when interacting with individual OTLP metrics.
Paths
In general, the Metric Context supports accessing pdata using the field names from the metrics proto. All integers are returned and set via int64
. All doubles are returned and set via float64
.
The following paths are supported.
path | field accessed | type |
---|---|---|
cache | the value of the current transform context's temporary cache. cache can be used as a temporary placeholder for data during complex transformations | pcommon.Map |
cache[""] | the value of an item in cache. Supports multiple indexes to access nested fields. | string, bool, int64, float64, pcommon.Map, pcommon.Slice, []byte or nil |
resource | resource of the metric being processed | pcommon.Resource |
resource.attributes | resource attributes of the metric being processed | pcommon.Map |
resource.attributes[""] | the value of the resource attribute of the metric being processed. Supports multiple indexes to access nested fields. | string, bool, int64, float64, pcommon.Map, pcommon.Slice, []byte or nil |
instrumentation_scope | instrumentation scope of the metric being processed | pcommon.InstrumentationScope |
instrumentation_scope.name | name of the instrumentation scope of the metric being processed | string |
instrumentation_scope.version | version of the instrumentation scope of the metric being processed | string |
instrumentation_scope.attributes | instrumentation scope attributes of the metric being processed | pcommon.Map |
instrumentation_scope.attributes[""] | the value of the instrumentation scope attribute of the metric being processed. Supports multiple indexes to access nested fields. | string, bool, int64, float64, pcommon.Map, pcommon.Slice, []byte or nil |
name | the name of the metric | string |
description | the description of the metric | string |
unit | the unit of the metric | string |
type | the data type of the metric | int64 |
aggregation_temporality | the aggregation temporality of the metric | int64 |
is_monotonic | the monotonicity of the metric | bool |
data_points | the data points of the metric | pmetric.NumberDataPointSlice, pmetric.HistogramDataPointSlice, pmetric.ExponentialHistogramDataPointSlice, or pmetric.SummaryDataPointSlice |
Enums
The Metrics Context supports the enum names from the metrics proto.
In addition, it also supports an enum for metrics data type, with the numeric value being defined by pdata.
Enum Symbol | Value |
---|---|
AGGREGATION_TEMPORALITY_UNSPECIFIED | 0 |
AGGREGATION_TEMPORALITY_DELTA | 1 |
AGGREGATION_TEMPORALITY_CUMULATIVE | 2 |
METRIC_DATA_TYPE_NONE | 0 |
METRIC_DATA_TYPE_GAUGE | 1 |
METRIC_DATA_TYPE_SUM | 2 |
METRIC_DATA_TYPE_HISTOGRAM | 3 |
METRIC_DATA_TYPE_EXPONENTIAL_HISTOGRAM | 4 |
METRIC_DATA_TYPE_SUMMARY | 5 |
Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewParser ¶
func NewParser(functions map[string]ottl.Factory[TransformContext], telemetrySettings component.TelemetrySettings, options ...Option) (ottl.Parser[TransformContext], error)
func NewStatements ¶ added in v0.72.0
func NewStatements(statements []*ottl.Statement[TransformContext], telemetrySettings component.TelemetrySettings, options ...StatementsOption) ottl.Statements[TransformContext]
Types ¶
type Option ¶ added in v0.70.0
type Option func(*ottl.Parser[TransformContext])
type StatementsOption ¶ added in v0.72.0
type StatementsOption func(*ottl.Statements[TransformContext])
func WithErrorMode ¶ added in v0.72.0
func WithErrorMode(errorMode ottl.ErrorMode) StatementsOption
type TransformContext ¶
type TransformContext struct {
// contains filtered or unexported fields
}
func NewTransformContext ¶
func NewTransformContext(metric pmetric.Metric, instrumentationScope pcommon.InstrumentationScope, resource pcommon.Resource) TransformContext
func (TransformContext) GetInstrumentationScope ¶
func (tCtx TransformContext) GetInstrumentationScope() pcommon.InstrumentationScope
func (TransformContext) GetMetric ¶
func (tCtx TransformContext) GetMetric() pmetric.Metric
func (TransformContext) GetResource ¶
func (tCtx TransformContext) GetResource() pcommon.Resource
Click to show internal directories.
Click to hide internal directories.