Files
zeekayandHanzo Dev c16ed9fe26 Go 1.27.1, and the code it can say more simply
Modules declare go 1.27.1 and the build images follow. go fix applied the
modernizers; omitzero is not applied, since it changes what the JSON says.

Co-authored-by: Hanzo Dev <[email protected]>
2026-09-17 02:34:35 -07:00

41 lines
1.3 KiB
Go

// Copyright The OpenTelemetry Authors
// SPDX-License-Identifier: Apache-2.0
package metrics // import "github.com/hanzoai/otel-collector/processor/o11ytransformprocessor/internal/metrics"
import (
"maps"
"github.com/open-telemetry/opentelemetry-collector-contrib/pkg/ottl"
"github.com/open-telemetry/opentelemetry-collector-contrib/pkg/ottl/contexts/ottldatapoint"
"github.com/open-telemetry/opentelemetry-collector-contrib/pkg/ottl/contexts/ottlmetric"
"github.com/open-telemetry/opentelemetry-collector-contrib/pkg/ottl/ottlfuncs"
)
func DataPointFunctions() map[string]ottl.Factory[*ottldatapoint.TransformContext] {
functions := ottlfuncs.StandardFuncs[*ottldatapoint.TransformContext]()
datapointFunctions := ottl.CreateFactoryMap[*ottldatapoint.TransformContext](
newConvertSumToGaugeFactory(),
newConvertGaugeToSumFactory(),
newConvertSummarySumValToSumFactory(),
newConvertSummaryCountValToSumFactory(),
)
maps.Copy(functions, datapointFunctions)
return functions
}
func MetricFunctions() map[string]ottl.Factory[*ottlmetric.TransformContext] {
functions := ottlfuncs.StandardFuncs[*ottlmetric.TransformContext]()
metricFunctions := ottl.CreateFactoryMap[*ottlmetric.TransformContext](
newExtractSumMetricFactory(),
newExtractCountMetricFactory(),
)
maps.Copy(functions, metricFunctions)
return functions
}