From 51abe4d70e127722d7f7d4eee30149b80a172ffa Mon Sep 17 00:00:00 2001 From: Vishal Raj Date: Tue, 19 Nov 2024 18:44:58 +0000 Subject: [PATCH 1/8] [connector/signaltometrics] Add boilerplate for the connector --- .chloggen/add-signaltometrics-connector.yaml | 27 ++++ .github/CODEOWNERS | 1 + .github/ISSUE_TEMPLATE/bug_report.yaml | 1 + .github/ISSUE_TEMPLATE/feature_request.yaml | 1 + .github/ISSUE_TEMPLATE/other.yaml | 1 + .github/ISSUE_TEMPLATE/unmaintained.yaml | 1 + connector/signaltometricsconnector/Makefile | 1 + connector/signaltometricsconnector/README.md | 26 ++++ .../signaltometricsconnector/config/config.go | 10 ++ .../signaltometricsconnector/connector.go | 50 +++++++ connector/signaltometricsconnector/doc.go | 7 + connector/signaltometricsconnector/factory.go | 57 +++++++ .../signaltometricsconnector/factory_test.go | 90 +++++++++++ .../generated_component_test.go | 88 +++++++++++ .../generated_package_test.go | 13 ++ connector/signaltometricsconnector/go.mod | 55 +++++++ connector/signaltometricsconnector/go.sum | 140 ++++++++++++++++++ .../internal/metadata/generated_status.go | 18 +++ .../signaltometricsconnector/metadata.yaml | 12 ++ reports/distributions/contrib.yaml | 1 + versions.yaml | 1 + 21 files changed, 601 insertions(+) create mode 100644 .chloggen/add-signaltometrics-connector.yaml create mode 100644 connector/signaltometricsconnector/Makefile create mode 100644 connector/signaltometricsconnector/README.md create mode 100644 connector/signaltometricsconnector/config/config.go create mode 100644 connector/signaltometricsconnector/connector.go create mode 100644 connector/signaltometricsconnector/doc.go create mode 100644 connector/signaltometricsconnector/factory.go create mode 100644 connector/signaltometricsconnector/factory_test.go create mode 100644 connector/signaltometricsconnector/generated_component_test.go create mode 100644 connector/signaltometricsconnector/generated_package_test.go create mode 100644 connector/signaltometricsconnector/go.mod create mode 100644 connector/signaltometricsconnector/go.sum create mode 100644 connector/signaltometricsconnector/internal/metadata/generated_status.go create mode 100644 connector/signaltometricsconnector/metadata.yaml diff --git a/.chloggen/add-signaltometrics-connector.yaml b/.chloggen/add-signaltometrics-connector.yaml new file mode 100644 index 000000000000..2cd05341aa91 --- /dev/null +++ b/.chloggen/add-signaltometrics-connector.yaml @@ -0,0 +1,27 @@ +# Use this changelog template to create an entry for release notes. + +# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' +change_type: new_component + +# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver) +component: signaltometricsconnector + +# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). +note: New component for generating metrics from raw signals using user defined OTTL expressions. + +# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists. +issues: [35930] + +# (Optional) One or more lines of additional information to render under the primary note. +# These lines will be padded with 2 spaces and then inserted directly into the document. +# Use pipe (|) for multiline entries. +subtext: + +# If your change doesn't affect end users or the exported elements of any package, +# you should instead start your pull request title with [chore] or use the "Skip Changelog" label. +# Optional: The change log or logs in which this entry should be included. +# e.g. '[user]' or '[user, api]' +# Include 'user' if the change is relevant to end users. +# Include 'api' if there is a change to a library API. +# Default: '[user]' +change_logs: [user] diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index c7b9e6740253..1206cff79aa8 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -34,6 +34,7 @@ connector/otlpjsonconnector/ @open-telemetry/collector-cont connector/roundrobinconnector/ @open-telemetry/collector-contrib-approvers @bogdandrutu connector/routingconnector/ @open-telemetry/collector-contrib-approvers @jpkrohling @mwear connector/servicegraphconnector/ @open-telemetry/collector-contrib-approvers @jpkrohling @mapno @JaredTan95 +connector/signaltometricsconnector/ @open-telemetry/collector-contrib-approvers @ChrsMark @lahsivjar connector/spanmetricsconnector/ @open-telemetry/collector-contrib-approvers @portertech @Frapschen connector/sumconnector/ @open-telemetry/collector-contrib-approvers @greatestusername @shalper2 @crobert-1 diff --git a/.github/ISSUE_TEMPLATE/bug_report.yaml b/.github/ISSUE_TEMPLATE/bug_report.yaml index ae072a77e5a1..c785a3af6842 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yaml +++ b/.github/ISSUE_TEMPLATE/bug_report.yaml @@ -35,6 +35,7 @@ body: - connector/roundrobin - connector/routing - connector/servicegraph + - connector/signaltometrics - connector/spanmetrics - connector/sum - examples/demo diff --git a/.github/ISSUE_TEMPLATE/feature_request.yaml b/.github/ISSUE_TEMPLATE/feature_request.yaml index 88d834ed4c69..f3993d40bab4 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.yaml +++ b/.github/ISSUE_TEMPLATE/feature_request.yaml @@ -29,6 +29,7 @@ body: - connector/roundrobin - connector/routing - connector/servicegraph + - connector/signaltometrics - connector/spanmetrics - connector/sum - examples/demo diff --git a/.github/ISSUE_TEMPLATE/other.yaml b/.github/ISSUE_TEMPLATE/other.yaml index 9ea88909bf95..ef313c26c837 100644 --- a/.github/ISSUE_TEMPLATE/other.yaml +++ b/.github/ISSUE_TEMPLATE/other.yaml @@ -29,6 +29,7 @@ body: - connector/roundrobin - connector/routing - connector/servicegraph + - connector/signaltometrics - connector/spanmetrics - connector/sum - examples/demo diff --git a/.github/ISSUE_TEMPLATE/unmaintained.yaml b/.github/ISSUE_TEMPLATE/unmaintained.yaml index b8c0263ef714..5188e755c53f 100644 --- a/.github/ISSUE_TEMPLATE/unmaintained.yaml +++ b/.github/ISSUE_TEMPLATE/unmaintained.yaml @@ -34,6 +34,7 @@ body: - connector/roundrobin - connector/routing - connector/servicegraph + - connector/signaltometrics - connector/spanmetrics - connector/sum - examples/demo diff --git a/connector/signaltometricsconnector/Makefile b/connector/signaltometricsconnector/Makefile new file mode 100644 index 000000000000..ded7a36092dc --- /dev/null +++ b/connector/signaltometricsconnector/Makefile @@ -0,0 +1 @@ +include ../../Makefile.Common diff --git a/connector/signaltometricsconnector/README.md b/connector/signaltometricsconnector/README.md new file mode 100644 index 000000000000..d971b1329ed3 --- /dev/null +++ b/connector/signaltometricsconnector/README.md @@ -0,0 +1,26 @@ +# Signal to metrics connector + +Signal to metrics connector produces metrics from all signal types (traces, logs, or metrics). + + +| Status | | +| ------------- |-----------| +| Distributions | [] | +| Issues | [![Open issues](https://img.shields.io/github/issues-search/open-telemetry/opentelemetry-collector-contrib?query=is%3Aissue%20is%3Aopen%20label%3Aconnector%2Fsignaltometrics%20&label=open&color=orange&logo=opentelemetry)](https://github.com/open-telemetry/opentelemetry-collector-contrib/issues?q=is%3Aopen+is%3Aissue+label%3Aconnector%2Fsignaltometrics) [![Closed issues](https://img.shields.io/github/issues-search/open-telemetry/opentelemetry-collector-contrib?query=is%3Aissue%20is%3Aclosed%20label%3Aconnector%2Fsignaltometrics%20&label=closed&color=blue&logo=opentelemetry)](https://github.com/open-telemetry/opentelemetry-collector-contrib/issues?q=is%3Aclosed+is%3Aissue+label%3Aconnector%2Fsignaltometrics) | +| [Code Owners](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/CONTRIBUTING.md#becoming-a-code-owner) | [@ChrsMark](https://www.github.com/ChrsMark), [@lahsivjar](https://www.github.com/lahsivjar) | + +[development]: https://github.com/open-telemetry/opentelemetry-collector/blob/main/docs/component-stability.md#development + +## Supported Pipeline Types + +| [Exporter Pipeline Type] | [Receiver Pipeline Type] | [Stability Level] | +| ------------------------ | ------------------------ | ----------------- | +| traces | metrics | [development] | +| logs | metrics | [development] | +| metrics | metrics | [development] | + +[Exporter Pipeline Type]: https://github.com/open-telemetry/opentelemetry-collector/blob/main/connector/README.md#exporter-pipeline-type +[Receiver Pipeline Type]: https://github.com/open-telemetry/opentelemetry-collector/blob/main/connector/README.md#receiver-pipeline-type +[Stability Level]: https://github.com/open-telemetry/opentelemetry-collector/blob/main/docs/component-stability.md#stability-levels + + diff --git a/connector/signaltometricsconnector/config/config.go b/connector/signaltometricsconnector/config/config.go new file mode 100644 index 000000000000..4046c646c516 --- /dev/null +++ b/connector/signaltometricsconnector/config/config.go @@ -0,0 +1,10 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package config // import "github.com/open-telemetry/opentelemetry-collector-contrib/connector/signaltometricsconnector/config" + +type Config struct{} + +func (c *Config) Validate() error { + return nil +} diff --git a/connector/signaltometricsconnector/connector.go b/connector/signaltometricsconnector/connector.go new file mode 100644 index 000000000000..d6f5f5b8283b --- /dev/null +++ b/connector/signaltometricsconnector/connector.go @@ -0,0 +1,50 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package signaltometricsconnector // import "github.com/open-telemetry/opentelemetry-collector-contrib/connector/signaltometricsconnector" + +import ( + "context" + + "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/connector" + "go.opentelemetry.io/collector/consumer" + "go.opentelemetry.io/collector/pdata/plog" + "go.opentelemetry.io/collector/pdata/pmetric" + "go.opentelemetry.io/collector/pdata/ptrace" + "go.uber.org/zap" +) + +type signalToMetrics struct { + next consumer.Metrics + logger *zap.Logger + + component.StartFunc + component.ShutdownFunc +} + +func newSignalToMetrics( + set connector.Settings, + next consumer.Metrics, +) *signalToMetrics { + return &signalToMetrics{ + logger: set.Logger, + next: next, + } +} + +func (sm *signalToMetrics) Capabilities() consumer.Capabilities { + return consumer.Capabilities{MutatesData: false} +} + +func (sm *signalToMetrics) ConsumeTraces(context.Context, ptrace.Traces) error { + return nil +} + +func (sm *signalToMetrics) ConsumeMetrics(context.Context, pmetric.Metrics) error { + return nil +} + +func (sm *signalToMetrics) ConsumeLogs(context.Context, plog.Logs) error { + return nil +} diff --git a/connector/signaltometricsconnector/doc.go b/connector/signaltometricsconnector/doc.go new file mode 100644 index 000000000000..f27f0cda71e8 --- /dev/null +++ b/connector/signaltometricsconnector/doc.go @@ -0,0 +1,7 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +//go:generate mdatagen metadata.yaml + +// Package signaltometricsconnector provides a stateless connector for generating metrics from raw signals. +package signaltometricsconnector // import "github.com/open-telemetry/opentelemetry-collector-contrib/connector/signaltometricsconnector" diff --git a/connector/signaltometricsconnector/factory.go b/connector/signaltometricsconnector/factory.go new file mode 100644 index 000000000000..4bf1fcb8d1a3 --- /dev/null +++ b/connector/signaltometricsconnector/factory.go @@ -0,0 +1,57 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package signaltometricsconnector // import "github.com/open-telemetry/opentelemetry-collector-contrib/connector/signaltometricsconnector" + +import ( + "context" + + "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/connector" + "go.opentelemetry.io/collector/consumer" + + "github.com/open-telemetry/opentelemetry-collector-contrib/connector/signaltometricsconnector/config" + "github.com/open-telemetry/opentelemetry-collector-contrib/connector/signaltometricsconnector/internal/metadata" +) + +// NewFactory returns a ConnectorFactory. +func NewFactory() connector.Factory { + return connector.NewFactory( + metadata.Type, + createDefaultConfig, + connector.WithTracesToMetrics(createTracesToMetrics, metadata.TracesToMetricsStability), + connector.WithMetricsToMetrics(createMetricsToMetrics, metadata.MetricsToMetricsStability), + connector.WithLogsToMetrics(createLogsToMetrics, metadata.LogsToMetricsStability), + ) +} + +func createDefaultConfig() component.Config { + return &config.Config{} +} + +func createTracesToMetrics( + _ context.Context, + set connector.Settings, + _ component.Config, + nextConsumer consumer.Metrics, +) (connector.Traces, error) { + return newSignalToMetrics(set, nextConsumer), nil +} + +func createMetricsToMetrics( + _ context.Context, + set connector.Settings, + _ component.Config, + nextConsumer consumer.Metrics, +) (connector.Metrics, error) { + return newSignalToMetrics(set, nextConsumer), nil +} + +func createLogsToMetrics( + _ context.Context, + set connector.Settings, + _ component.Config, + nextConsumer consumer.Metrics, +) (connector.Logs, error) { + return newSignalToMetrics(set, nextConsumer), nil +} diff --git a/connector/signaltometricsconnector/factory_test.go b/connector/signaltometricsconnector/factory_test.go new file mode 100644 index 000000000000..a172f0ac1f28 --- /dev/null +++ b/connector/signaltometricsconnector/factory_test.go @@ -0,0 +1,90 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package signaltometricsconnector + +import ( + "context" + "testing" + + "github.com/stretchr/testify/require" + "go.opentelemetry.io/collector/connector/connectortest" + "go.opentelemetry.io/collector/consumer" + "go.opentelemetry.io/collector/pdata/pmetric" + + "github.com/open-telemetry/opentelemetry-collector-contrib/connector/signaltometricsconnector/internal/metadata" +) + +func TestNewFactoryWithLogs(t *testing.T) { + for _, tc := range []struct { + name string + f func(*testing.T) + }{ + { + name: "factory_type", + f: func(t *testing.T) { + factory := NewFactory() + require.EqualValues(t, metadata.Type, factory.Type()) + }, + }, + { + name: "traces_to_metrics", + f: func(t *testing.T) { + mc, err := consumer.NewMetrics(func(context.Context, pmetric.Metrics) error { + return nil + }) + require.NoError(t, err) + + factory := NewFactory() + c, err := factory.CreateTracesToMetrics( + context.Background(), + connectortest.NewNopSettings(), + factory.CreateDefaultConfig(), + mc, + ) + require.NoError(t, err) + require.NotNil(t, c) + }, + }, + { + name: "logs_to_metrics", + f: func(t *testing.T) { + mc, err := consumer.NewMetrics(func(context.Context, pmetric.Metrics) error { + return nil + }) + require.NoError(t, err) + + factory := NewFactory() + c, err := factory.CreateLogsToMetrics( + context.Background(), + connectortest.NewNopSettings(), + factory.CreateDefaultConfig(), + mc, + ) + require.NoError(t, err) + require.NotNil(t, c) + }, + }, + { + name: "metrics_to_metrics", + f: func(t *testing.T) { + mc, err := consumer.NewMetrics(func(context.Context, pmetric.Metrics) error { + return nil + }) + require.NoError(t, err) + + factory := NewFactory() + c, err := factory.CreateMetricsToMetrics( + context.Background(), + connectortest.NewNopSettings(), + factory.CreateDefaultConfig(), + mc, + ) + require.NoError(t, err) + require.NotNil(t, c) + }, + }, + } { + t.Run(tc.name, tc.f) + } +} diff --git a/connector/signaltometricsconnector/generated_component_test.go b/connector/signaltometricsconnector/generated_component_test.go new file mode 100644 index 000000000000..751f8f306fd9 --- /dev/null +++ b/connector/signaltometricsconnector/generated_component_test.go @@ -0,0 +1,88 @@ +// Code generated by mdatagen. DO NOT EDIT. + +package signaltometricsconnector + +import ( + "context" + "testing" + + "github.com/stretchr/testify/require" + "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/component/componenttest" + "go.opentelemetry.io/collector/confmap/confmaptest" + "go.opentelemetry.io/collector/connector" + "go.opentelemetry.io/collector/connector/connectortest" + "go.opentelemetry.io/collector/consumer" + "go.opentelemetry.io/collector/consumer/consumertest" + "go.opentelemetry.io/collector/pipeline" +) + +func TestComponentFactoryType(t *testing.T) { + require.Equal(t, "signaltometrics", NewFactory().Type().String()) +} + +func TestComponentConfigStruct(t *testing.T) { + require.NoError(t, componenttest.CheckConfigStruct(NewFactory().CreateDefaultConfig())) +} + +func TestComponentLifecycle(t *testing.T) { + factory := NewFactory() + + tests := []struct { + name string + createFn func(ctx context.Context, set connector.Settings, cfg component.Config) (component.Component, error) + }{ + + { + name: "logs_to_metrics", + createFn: func(ctx context.Context, set connector.Settings, cfg component.Config) (component.Component, error) { + router := connector.NewMetricsRouter(map[pipeline.ID]consumer.Metrics{pipeline.NewID(pipeline.SignalMetrics): consumertest.NewNop()}) + return factory.CreateLogsToMetrics(ctx, set, cfg, router) + }, + }, + + { + name: "metrics_to_metrics", + createFn: func(ctx context.Context, set connector.Settings, cfg component.Config) (component.Component, error) { + router := connector.NewMetricsRouter(map[pipeline.ID]consumer.Metrics{pipeline.NewID(pipeline.SignalMetrics): consumertest.NewNop()}) + return factory.CreateMetricsToMetrics(ctx, set, cfg, router) + }, + }, + + { + name: "traces_to_metrics", + createFn: func(ctx context.Context, set connector.Settings, cfg component.Config) (component.Component, error) { + router := connector.NewMetricsRouter(map[pipeline.ID]consumer.Metrics{pipeline.NewID(pipeline.SignalMetrics): consumertest.NewNop()}) + return factory.CreateTracesToMetrics(ctx, set, cfg, router) + }, + }, + } + + cm, err := confmaptest.LoadConf("metadata.yaml") + require.NoError(t, err) + cfg := factory.CreateDefaultConfig() + sub, err := cm.Sub("tests::config") + require.NoError(t, err) + require.NoError(t, sub.Unmarshal(&cfg)) + + for _, tt := range tests { + t.Run(tt.name+"-shutdown", func(t *testing.T) { + c, err := tt.createFn(context.Background(), connectortest.NewNopSettings(), cfg) + require.NoError(t, err) + err = c.Shutdown(context.Background()) + require.NoError(t, err) + }) + t.Run(tt.name+"-lifecycle", func(t *testing.T) { + firstConnector, err := tt.createFn(context.Background(), connectortest.NewNopSettings(), cfg) + require.NoError(t, err) + host := componenttest.NewNopHost() + require.NoError(t, err) + require.NoError(t, firstConnector.Start(context.Background(), host)) + require.NoError(t, firstConnector.Shutdown(context.Background())) + secondConnector, err := tt.createFn(context.Background(), connectortest.NewNopSettings(), cfg) + require.NoError(t, err) + require.NoError(t, secondConnector.Start(context.Background(), host)) + require.NoError(t, secondConnector.Shutdown(context.Background())) + }) + } +} diff --git a/connector/signaltometricsconnector/generated_package_test.go b/connector/signaltometricsconnector/generated_package_test.go new file mode 100644 index 000000000000..beb8cdc87cfa --- /dev/null +++ b/connector/signaltometricsconnector/generated_package_test.go @@ -0,0 +1,13 @@ +// Code generated by mdatagen. DO NOT EDIT. + +package signaltometricsconnector + +import ( + "testing" + + "go.uber.org/goleak" +) + +func TestMain(m *testing.M) { + goleak.VerifyTestMain(m) +} diff --git a/connector/signaltometricsconnector/go.mod b/connector/signaltometricsconnector/go.mod new file mode 100644 index 000000000000..224f311e2f17 --- /dev/null +++ b/connector/signaltometricsconnector/go.mod @@ -0,0 +1,55 @@ +module github.com/open-telemetry/opentelemetry-collector-contrib/connector/signaltometricsconnector + +go 1.22.7 + +require ( + github.com/stretchr/testify v1.9.0 + go.opentelemetry.io/collector/component v0.114.0 + go.opentelemetry.io/collector/component/componenttest v0.114.0 + go.opentelemetry.io/collector/confmap v1.20.0 + go.opentelemetry.io/collector/connector v0.114.0 + go.opentelemetry.io/collector/connector/connectortest v0.114.0 + go.opentelemetry.io/collector/consumer v0.114.0 + go.opentelemetry.io/collector/consumer/consumertest v0.114.0 + go.opentelemetry.io/collector/pdata v1.20.0 + go.opentelemetry.io/collector/pipeline v0.114.0 + go.uber.org/goleak v1.3.0 + go.uber.org/zap v1.27.0 +) + +require ( + github.com/davecgh/go-spew v1.1.1 // indirect + github.com/go-logr/logr v1.4.2 // indirect + github.com/go-logr/stdr v1.2.2 // indirect + github.com/go-viper/mapstructure/v2 v2.2.1 // indirect + github.com/gogo/protobuf v1.3.2 // indirect + github.com/google/uuid v1.6.0 // indirect + github.com/json-iterator/go v1.1.12 // indirect + github.com/knadh/koanf/maps v0.1.1 // indirect + github.com/knadh/koanf/providers/confmap v0.1.0 // indirect + github.com/knadh/koanf/v2 v2.1.2 // indirect + github.com/mitchellh/copystructure v1.2.0 // indirect + github.com/mitchellh/reflectwalk v1.0.2 // indirect + github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect + github.com/modern-go/reflect2 v1.0.2 // indirect + github.com/pmezard/go-difflib v1.0.0 // indirect + go.opentelemetry.io/collector/config/configtelemetry v0.114.0 // indirect + go.opentelemetry.io/collector/connector/connectorprofiles v0.114.0 // indirect + go.opentelemetry.io/collector/consumer/consumerprofiles v0.114.0 // indirect + go.opentelemetry.io/collector/internal/fanoutconsumer v0.114.0 // indirect + go.opentelemetry.io/collector/pdata/pprofile v0.114.0 // indirect + go.opentelemetry.io/collector/pipeline/pipelineprofiles v0.114.0 // indirect + go.opentelemetry.io/otel v1.32.0 // indirect + go.opentelemetry.io/otel/metric v1.32.0 // indirect + go.opentelemetry.io/otel/sdk v1.32.0 // indirect + go.opentelemetry.io/otel/sdk/metric v1.32.0 // indirect + go.opentelemetry.io/otel/trace v1.32.0 // indirect + go.uber.org/multierr v1.11.0 // indirect + golang.org/x/net v0.28.0 // indirect + golang.org/x/sys v0.27.0 // indirect + golang.org/x/text v0.18.0 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240822170219-fc7c04adadcd // indirect + google.golang.org/grpc v1.67.1 // indirect + google.golang.org/protobuf v1.35.1 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect +) diff --git a/connector/signaltometricsconnector/go.sum b/connector/signaltometricsconnector/go.sum new file mode 100644 index 000000000000..c183a1b5db9e --- /dev/null +++ b/connector/signaltometricsconnector/go.sum @@ -0,0 +1,140 @@ +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY= +github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= +github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= +github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= +github.com/go-viper/mapstructure/v2 v2.2.1 h1:ZAaOCxANMuZx5RCeg0mBdEZk7DZasvvZIxtHqx8aGss= +github.com/go-viper/mapstructure/v2 v2.2.1/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM= +github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= +github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= +github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= +github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= +github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= +github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= +github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= +github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= +github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= +github.com/knadh/koanf/maps v0.1.1 h1:G5TjmUh2D7G2YWf5SQQqSiHRJEjaicvU0KpypqB3NIs= +github.com/knadh/koanf/maps v0.1.1/go.mod h1:npD/QZY3V6ghQDdcQzl1W4ICNVTkohC8E73eI2xW4yI= +github.com/knadh/koanf/providers/confmap v0.1.0 h1:gOkxhHkemwG4LezxxN8DMOFopOPghxRVp7JbIvdvqzU= +github.com/knadh/koanf/providers/confmap v0.1.0/go.mod h1:2uLhxQzJnyHKfxG927awZC7+fyHFdQkd697K4MdLnIU= +github.com/knadh/koanf/v2 v2.1.2 h1:I2rtLRqXRy1p01m/utEtpZSSA6dcJbgGVuE27kW2PzQ= +github.com/knadh/koanf/v2 v2.1.2/go.mod h1:Gphfaen0q1Fc1HTgJgSTC4oRX9R2R5ErYMZJy8fLJBo= +github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= +github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= +github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= +github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/mitchellh/copystructure v1.2.0 h1:vpKXTN4ewci03Vljg/q9QvCGUDttBOGBIa15WveJJGw= +github.com/mitchellh/copystructure v1.2.0/go.mod h1:qLl+cE2AmVv+CoeAwDPye/v+N2HKCj9FbZEVFJRxO9s= +github.com/mitchellh/reflectwalk v1.0.2 h1:G2LzWKi524PWgd3mLHV8Y5k7s6XUvT0Gef6zxSIeXaQ= +github.com/mitchellh/reflectwalk v1.0.2/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= +github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= +github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= +github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8= +github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= +github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= +github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +go.opentelemetry.io/collector/component v0.114.0 h1:SVGbm5LvHGSTEDv7p92oPuBgK5tuiWR82I9+LL4TtBE= +go.opentelemetry.io/collector/component v0.114.0/go.mod h1:MLxtjZ6UVHjDxSdhGLuJfHBHvfl1iT/Y7IaQPD24Eww= +go.opentelemetry.io/collector/component/componenttest v0.114.0 h1:GM4FTTlfeXoVm6sZYBHImwlRN8ayh2oAfUhvaFj7Zo8= +go.opentelemetry.io/collector/component/componenttest v0.114.0/go.mod h1:ZZEJMtbJtoVC/3/9R1HzERq+cYQRxuMFQrPCpfZ4Xos= +go.opentelemetry.io/collector/config/configtelemetry v0.114.0 h1:kjLeyrumge6wsX6ZIkicdNOlBXaEyW2PI2ZdVXz/rzY= +go.opentelemetry.io/collector/config/configtelemetry v0.114.0/go.mod h1:R0MBUxjSMVMIhljuDHWIygzzJWQyZHXXWIgQNxcFwhc= +go.opentelemetry.io/collector/confmap v1.20.0 h1:ARfOwmkKxFOud1njl03yAHQ30+uenlzqCO6LBYamDTE= +go.opentelemetry.io/collector/confmap v1.20.0/go.mod h1:DMpd9Ay/ffls3JoQBQ73vWeRsz1rNuLbwjo6WtjSQus= +go.opentelemetry.io/collector/connector v0.114.0 h1:efGAeTCtg8zp5Hyd7Am8kBUgsSxWEFlFtAu4OX4mcEA= +go.opentelemetry.io/collector/connector v0.114.0/go.mod h1:8DhGgD8RhkF0ooELl4NOPPD/wgHuXHmY7g90RwJ2eNo= +go.opentelemetry.io/collector/connector/connectorprofiles v0.114.0 h1:uVs9gy3UfQBmH0636ouIbGIoWis7zmKN+ny4XOGm36U= +go.opentelemetry.io/collector/connector/connectorprofiles v0.114.0/go.mod h1:X681qFEAsEPMDQ0pMsD/3DqePw58sfLew1QbBKvGnmw= +go.opentelemetry.io/collector/connector/connectortest v0.114.0 h1:Fpy1JHyNOLdVzNcmxUY6Jwxdz6JDcTXL1NCfw8k1AOc= +go.opentelemetry.io/collector/connector/connectortest v0.114.0/go.mod h1:1zaAlODuL9iNyfyjHQeGCpbcaUjf5b68t8LqlwHKBNA= +go.opentelemetry.io/collector/consumer v0.114.0 h1:1zVaHvfIZowGwZRitRBRo3i+RP2StlU+GClYiofSw0Q= +go.opentelemetry.io/collector/consumer v0.114.0/go.mod h1:d+Mrzt9hsH1ub3zmwSlnQVPLeTYir4Mgo7CrWfnncN4= +go.opentelemetry.io/collector/consumer/consumerprofiles v0.114.0 h1:5pXYy3E6UK5Huu3aQbsYL8B6E6MyWx4fvXXDn+oXZaA= +go.opentelemetry.io/collector/consumer/consumerprofiles v0.114.0/go.mod h1:PMq3f54KcJQO4v1tue0QxQScu7REFVADlXxXSAYMiN0= +go.opentelemetry.io/collector/consumer/consumertest v0.114.0 h1:isaTwJK5DOy8Bs7GuLq23ejfgj8gLIo5dOUvkRnLF4g= +go.opentelemetry.io/collector/consumer/consumertest v0.114.0/go.mod h1:GNeLPkfRPdh06n/Rv1UKa/cAtCKjN0a7ADyHjIj4HFE= +go.opentelemetry.io/collector/internal/fanoutconsumer v0.114.0 h1:JM9huYqy5LTzmuxQmbPST3l5Ez5kJNit28c6WFWls34= +go.opentelemetry.io/collector/internal/fanoutconsumer v0.114.0/go.mod h1:V28tDU4Wvf1PfW1Ty/SBL9tpKul2iYGno/HkCWGDrj0= +go.opentelemetry.io/collector/pdata v1.20.0 h1:ePcwt4bdtISP0loHaE+C9xYoU2ZkIvWv89Fob16o9SM= +go.opentelemetry.io/collector/pdata v1.20.0/go.mod h1:Ox1YVLe87cZDB/TL30i4SUz1cA5s6AM6SpFMfY61ICs= +go.opentelemetry.io/collector/pdata/pprofile v0.114.0 h1:pUNfTzsI/JUTiE+DScDM4lsrPoxnVNLI2fbTxR/oapo= +go.opentelemetry.io/collector/pdata/pprofile v0.114.0/go.mod h1:4aNcj6WM1n1uXyFSXlhVs4ibrERgNYsTbzcYI2zGhxA= +go.opentelemetry.io/collector/pdata/testdata v0.114.0 h1:+AzszWSL1i4K6meQ8rU0JDDW55SYCXa6FVqfDixhhTo= +go.opentelemetry.io/collector/pdata/testdata v0.114.0/go.mod h1:bv8XFdCTZxG2MQB5l9dKxSxf5zBrcodwO6JOy1+AxXM= +go.opentelemetry.io/collector/pipeline v0.114.0 h1:v3YOhc5z0tD6QbO5n/pnftpIeroihM2ks9Z2yKPCcwY= +go.opentelemetry.io/collector/pipeline v0.114.0/go.mod h1:4vOvjVsoYTHVGTbfFwqfnQOSV2K3RKUHofh3jNRc2Mg= +go.opentelemetry.io/collector/pipeline/pipelineprofiles v0.114.0 h1:LZgxMQ2zXcz8ILBefhxpZBpn/Rx+TJTncIIQy0LgtgY= +go.opentelemetry.io/collector/pipeline/pipelineprofiles v0.114.0/go.mod h1:bmyqQCJWcA53/GtqZJ2ahwmLdFl6UelFH2nR6OJFqpw= +go.opentelemetry.io/otel v1.32.0 h1:WnBN+Xjcteh0zdk01SVqV55d/m62NJLJdIyb4y/WO5U= +go.opentelemetry.io/otel v1.32.0/go.mod h1:00DCVSB0RQcnzlwyTfqtxSm+DRr9hpYrHjNGiBHVQIg= +go.opentelemetry.io/otel/metric v1.32.0 h1:xV2umtmNcThh2/a/aCP+h64Xx5wsj8qqnkYZktzNa0M= +go.opentelemetry.io/otel/metric v1.32.0/go.mod h1:jH7CIbbK6SH2V2wE16W05BHCtIDzauciCRLoc/SyMv8= +go.opentelemetry.io/otel/sdk v1.32.0 h1:RNxepc9vK59A8XsgZQouW8ue8Gkb4jpWtJm9ge5lEG4= +go.opentelemetry.io/otel/sdk v1.32.0/go.mod h1:LqgegDBjKMmb2GC6/PrTnteJG39I8/vJCAP9LlJXEjU= +go.opentelemetry.io/otel/sdk/metric v1.32.0 h1:rZvFnvmvawYb0alrYkjraqJq0Z4ZUJAiyYCU9snn1CU= +go.opentelemetry.io/otel/sdk/metric v1.32.0/go.mod h1:PWeZlq0zt9YkYAp3gjKZ0eicRYvOh1Gd+X99x6GHpCQ= +go.opentelemetry.io/otel/trace v1.32.0 h1:WIC9mYrXf8TmY/EXuULKc8hR17vE+Hjv2cssQDe03fM= +go.opentelemetry.io/otel/trace v1.32.0/go.mod h1:+i4rkvCraA+tG6AzwloGaCtkx53Fa+L+V8e9a7YvhT8= +go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= +go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= +go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= +go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= +go.uber.org/zap v1.27.0 h1:aJMhYGrd5QSmlpLMr2MftRKl7t8J8PTZPA732ud/XR8= +go.uber.org/zap v1.27.0/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.28.0 h1:a9JDOJc5GMUJ0+UDqmLT86WiEy7iWyIhz8gz8E4e5hE= +golang.org/x/net v0.28.0/go.mod h1:yqtgsTWOOnlGLG9GFRrK3++bGOUEkNBoHZc8MEDWPNg= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.27.0 h1:wBqf8DvsY9Y/2P8gAfPDEYNuS30J4lPHJxXSb/nJZ+s= +golang.org/x/sys v0.27.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.18.0 h1:XvMDiNzPAl0jr17s6W9lcaIhGUfUORdGCNsuLmPG224= +golang.org/x/text v0.18.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240822170219-fc7c04adadcd h1:6TEm2ZxXoQmFWFlt1vNxvVOa1Q0dXFQD1m/rYjXmS0E= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240822170219-fc7c04adadcd/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU= +google.golang.org/grpc v1.67.1 h1:zWnc1Vrcno+lHZCOofnIMvycFcc0QRGIzm9dhnDX68E= +google.golang.org/grpc v1.67.1/go.mod h1:1gLDyUQU7CTLJI90u3nXZ9ekeghjeM7pTDZlqFNg2AA= +google.golang.org/protobuf v1.35.1 h1:m3LfL6/Ca+fqnjnlqQXNpFPABW1UD7mjh8KO2mKFytA= +google.golang.org/protobuf v1.35.1/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/connector/signaltometricsconnector/internal/metadata/generated_status.go b/connector/signaltometricsconnector/internal/metadata/generated_status.go new file mode 100644 index 000000000000..bb48af2b993f --- /dev/null +++ b/connector/signaltometricsconnector/internal/metadata/generated_status.go @@ -0,0 +1,18 @@ +// Code generated by mdatagen. DO NOT EDIT. + +package metadata + +import ( + "go.opentelemetry.io/collector/component" +) + +var ( + Type = component.MustNewType("signaltometrics") + ScopeName = "github.com/open-telemetry/opentelemetry-collector-contrib/connector/signaltometricsconnector" +) + +const ( + TracesToMetricsStability = component.StabilityLevelDevelopment + LogsToMetricsStability = component.StabilityLevelDevelopment + MetricsToMetricsStability = component.StabilityLevelDevelopment +) diff --git a/connector/signaltometricsconnector/metadata.yaml b/connector/signaltometricsconnector/metadata.yaml new file mode 100644 index 000000000000..d803cd6821b4 --- /dev/null +++ b/connector/signaltometricsconnector/metadata.yaml @@ -0,0 +1,12 @@ +type: signaltometrics + +status: + class: connector + stability: + development: [traces_to_metrics, logs_to_metrics, metrics_to_metrics] + distributions: [] + codeowners: + active: [ChrsMark, lahsivjar] + +tests: + config: {} diff --git a/reports/distributions/contrib.yaml b/reports/distributions/contrib.yaml index 2d8cbb868933..1a3226ba4d5b 100644 --- a/reports/distributions/contrib.yaml +++ b/reports/distributions/contrib.yaml @@ -12,6 +12,7 @@ components: - roundrobin - routing - servicegraph + - signaltometrics - spanmetrics exporter: - alibabacloud_logservice diff --git a/versions.yaml b/versions.yaml index dddba38d63ca..14375987a147 100644 --- a/versions.yaml +++ b/versions.yaml @@ -21,6 +21,7 @@ module-sets: - github.com/open-telemetry/opentelemetry-collector-contrib/connector/roundrobinconnector - github.com/open-telemetry/opentelemetry-collector-contrib/connector/routingconnector - github.com/open-telemetry/opentelemetry-collector-contrib/connector/servicegraphconnector + - github.com/open-telemetry/opentelemetry-collector-contrib/connector/signaltometricsconnector - github.com/open-telemetry/opentelemetry-collector-contrib/connector/spanmetricsconnector - github.com/open-telemetry/opentelemetry-collector-contrib/connector/sumconnector - github.com/open-telemetry/opentelemetry-collector-contrib/examples/demo/client From fd6d0be0335bf1e80da5a10b88ad38fc42726ad6 Mon Sep 17 00:00:00 2001 From: Vishal Raj Date: Wed, 20 Nov 2024 10:42:11 +0000 Subject: [PATCH 2/8] Fix distributions and add config struct --- cmd/otelcontribcol/builder-config.yaml | 2 + connector/signaltometricsconnector/README.md | 3 +- .../signaltometricsconnector/config/config.go | 59 ++++++++++++++++- .../config/config_test.go | 65 +++++++++++++++++++ .../signaltometricsconnector/metadata.yaml | 25 ++++++- .../testdata/configs/empty.yaml | 1 + 6 files changed, 151 insertions(+), 4 deletions(-) create mode 100644 connector/signaltometricsconnector/config/config_test.go create mode 100644 connector/signaltometricsconnector/testdata/configs/empty.yaml diff --git a/cmd/otelcontribcol/builder-config.yaml b/cmd/otelcontribcol/builder-config.yaml index b31409e27bae..6816b45a58c5 100644 --- a/cmd/otelcontribcol/builder-config.yaml +++ b/cmd/otelcontribcol/builder-config.yaml @@ -231,6 +231,7 @@ connectors: - gomod: github.com/open-telemetry/opentelemetry-collector-contrib/connector/roundrobinconnector v0.114.0 - gomod: github.com/open-telemetry/opentelemetry-collector-contrib/connector/routingconnector v0.114.0 - gomod: github.com/open-telemetry/opentelemetry-collector-contrib/connector/servicegraphconnector v0.114.0 + - gomod: github.com/open-telemetry/opentelemetry-collector-contrib/connector/signaltometricsconnector v0.114.0 - gomod: github.com/open-telemetry/opentelemetry-collector-contrib/connector/spanmetricsconnector v0.114.0 - gomod: github.com/open-telemetry/opentelemetry-collector-contrib/connector/sumconnector v0.114.0 @@ -465,6 +466,7 @@ replaces: - github.com/open-telemetry/opentelemetry-collector-contrib/connector/roundrobinconnector => ../../connector/roundrobinconnector - github.com/open-telemetry/opentelemetry-collector-contrib/connector/routingconnector => ../../connector/routingconnector - github.com/open-telemetry/opentelemetry-collector-contrib/connector/servicegraphconnector => ../../connector/servicegraphconnector + - github.com/open-telemetry/opentelemetry-collector-contrib/connector/signaltometricsconnector => ../../connector/signaltometricsconnector - github.com/open-telemetry/opentelemetry-collector-contrib/connector/spanmetricsconnector => ../../connector/spanmetricsconnector - github.com/open-telemetry/opentelemetry-collector-contrib/connector/sumconnector => ../../connector/sumconnector - github.com/openshift/api v3.9.0+incompatible => github.com/openshift/api v0.0.0-20180801171038-322a19404e37 diff --git a/connector/signaltometricsconnector/README.md b/connector/signaltometricsconnector/README.md index d971b1329ed3..17c3a21e9d63 100644 --- a/connector/signaltometricsconnector/README.md +++ b/connector/signaltometricsconnector/README.md @@ -5,11 +5,12 @@ Signal to metrics connector produces metrics from all signal types (traces, logs | Status | | | ------------- |-----------| -| Distributions | [] | +| Distributions | [contrib] | | Issues | [![Open issues](https://img.shields.io/github/issues-search/open-telemetry/opentelemetry-collector-contrib?query=is%3Aissue%20is%3Aopen%20label%3Aconnector%2Fsignaltometrics%20&label=open&color=orange&logo=opentelemetry)](https://github.com/open-telemetry/opentelemetry-collector-contrib/issues?q=is%3Aopen+is%3Aissue+label%3Aconnector%2Fsignaltometrics) [![Closed issues](https://img.shields.io/github/issues-search/open-telemetry/opentelemetry-collector-contrib?query=is%3Aissue%20is%3Aclosed%20label%3Aconnector%2Fsignaltometrics%20&label=closed&color=blue&logo=opentelemetry)](https://github.com/open-telemetry/opentelemetry-collector-contrib/issues?q=is%3Aclosed+is%3Aissue+label%3Aconnector%2Fsignaltometrics) | | [Code Owners](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/CONTRIBUTING.md#becoming-a-code-owner) | [@ChrsMark](https://www.github.com/ChrsMark), [@lahsivjar](https://www.github.com/lahsivjar) | [development]: https://github.com/open-telemetry/opentelemetry-collector/blob/main/docs/component-stability.md#development +[contrib]: https://github.com/open-telemetry/opentelemetry-collector-releases/tree/main/distributions/otelcol-contrib ## Supported Pipeline Types diff --git a/connector/signaltometricsconnector/config/config.go b/connector/signaltometricsconnector/config/config.go index 4046c646c516..b9bc17c02167 100644 --- a/connector/signaltometricsconnector/config/config.go +++ b/connector/signaltometricsconnector/config/config.go @@ -3,8 +3,65 @@ package config // import "github.com/open-telemetry/opentelemetry-collector-contrib/connector/signaltometricsconnector/config" -type Config struct{} +import "fmt" + +// Config for the connector. Each configuration field describes the metrics +// to produce from a specific signal. +type Config struct { + Spans []MetricInfo `mapstructure:"spans"` + Datapoints []MetricInfo `mapstructure:"datapoints"` + Logs []MetricInfo `mapstructure:"logs"` +} func (c *Config) Validate() error { + if len(c.Spans) == 0 && len(c.Datapoints) == 0 && len(c.Logs) == 0 { + return fmt.Errorf("no configuration provided, at least one should be specified") + } return nil } + +// MetricInfo defines the structure of the metric produced by the connector. +type MetricInfo struct { + Name string `mapstructure:"name"` + Description string `mapstructure:"description"` + // Unit, if not-empty, will set the unit associated with the metric. + // See: https://github.com/open-telemetry/opentelemetry-collector/blob/b06236cc794982916cc956f20828b3e18eb33264/pdata/pmetric/generated_metric.go#L72-L81 + Unit string `mapstructure:"unit"` + // IncludeResourceAttributes is a list of resource attributes that + // needs to be included in the generated metric. If no resource + // attribute is included in the list then all attributes are included. + // Metric data streams MUST obey single-writer. The component produces + // metrics from non-metric signals as well as alters resource attributes + // from the source signals. To keep the single-writer valid, the + // component adds collector information as resource attribute with the + // component name as the prefix of the resource attributes. + IncludeResourceAttributes []Attribute `mapstructure:"include_resource_attributes"` + Attributes []Attribute `mapstructure:"attributes"` + // Conditions are a set of OTTL condtions which are ORd. Data is + // processed into metrics only if the sequence evaluates to true. + Conditions []string `mapstructure:"conditions"` + Histogram *Histogram `mapstructure:"histogram"` + ExponentialHistogram *ExponentialHistogram `mapstructure:"exponential_histogram"` + Sum *Sum `mapstructure:"sum"` +} + +type Attribute struct { + Key string `mapstructure:"key"` + DefaultValue any `mapstructure:"default_value"` +} + +type Histogram struct { + Buckets []float64 `mapstructure:"buckets"` + Count string `mapstructure:"count"` + Value string `mapstructure:"value"` +} + +type ExponentialHistogram struct { + MaxSize int32 `mapstructure:"max_size"` + Count string `mapstructure:"count"` + Value string `mapstructure:"value"` +} + +type Sum struct { + Value string `mapstructure:"value"` +} diff --git a/connector/signaltometricsconnector/config/config_test.go b/connector/signaltometricsconnector/config/config_test.go new file mode 100644 index 000000000000..317031a49ad6 --- /dev/null +++ b/connector/signaltometricsconnector/config/config_test.go @@ -0,0 +1,65 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package config + +import ( + "fmt" + "path/filepath" + "testing" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/confmap/confmaptest" + + "github.com/open-telemetry/opentelemetry-collector-contrib/connector/signaltometricsconnector/internal/metadata" +) + +func TestConfig(t *testing.T) { + for _, tc := range []struct { + path string // relative to `testdata/configs` directory + expected *Config + errorMsgs []string // all error message are checked + }{ + { + path: "empty", + errorMsgs: []string{"no configuration provided"}, + }, + } { + t.Run(tc.path, func(t *testing.T) { + dir := filepath.Join("..", "testdata", "configs") + cfg := &Config{} + cm, err := confmaptest.LoadConf(filepath.Join(dir, tc.path+".yaml")) + require.NoError(t, err) + + sub, err := cm.Sub(component.NewIDWithName(metadata.Type, "").String()) + require.NoError(t, err) + require.NoError(t, sub.Unmarshal(&cfg)) + + err = component.ValidateConfig(cfg) + if len(tc.errorMsgs) > 0 { + for _, errMsg := range tc.errorMsgs { + assert.ErrorContains(t, err, errMsg) + } + return + } + + assert.NoError(t, err) + assert.Equal(t, tc.expected, cfg) + }) + } +} + +const validationMsgFormat = "failed to validate %s configuration: %s" + +func fullErrorForSignal(t *testing.T, signal, errMsg string) string { + t.Helper() + + switch signal { + case "spans", "datapoints", "logs": + return fmt.Sprintf(validationMsgFormat, signal, errMsg) + default: + panic("unhandled signal type") + } +} diff --git a/connector/signaltometricsconnector/metadata.yaml b/connector/signaltometricsconnector/metadata.yaml index d803cd6821b4..92dd9b1072fc 100644 --- a/connector/signaltometricsconnector/metadata.yaml +++ b/connector/signaltometricsconnector/metadata.yaml @@ -4,9 +4,30 @@ status: class: connector stability: development: [traces_to_metrics, logs_to_metrics, metrics_to_metrics] - distributions: [] + distributions: [contrib] codeowners: active: [ChrsMark, lahsivjar] tests: - config: {} + config: + spans: + - name: span.duration.histogram + description: "Span duration as histogram" + unit: us + histogram: + value: Microseconds(end_time - start_time) + - name: span.duration.exponential_histogram + description: "Span duration as exponential histogram" + unit: us + exponential_histogram: + value: Microseconds(end_time - start_time) + logs: + - name: logrecord.count + description: "Count of log record" + sum: + value: "1" # Count each log record as 1, has to be a string + datapoints: + - name: datapoint.count + description: "Count of datapoint" + sum: + value: Int(1) # Count each data point as 1, can also use the Int converter diff --git a/connector/signaltometricsconnector/testdata/configs/empty.yaml b/connector/signaltometricsconnector/testdata/configs/empty.yaml new file mode 100644 index 000000000000..b00cc3dc1131 --- /dev/null +++ b/connector/signaltometricsconnector/testdata/configs/empty.yaml @@ -0,0 +1 @@ +signaltometrics: {} From c844e735963b8accabf999fdf92a5f0f00d56e31 Mon Sep 17 00:00:00 2001 From: Vishal Raj Date: Wed, 20 Nov 2024 12:29:05 +0000 Subject: [PATCH 3/8] Remove unused methods from config --- .../signaltometricsconnector/config/config_test.go | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/connector/signaltometricsconnector/config/config_test.go b/connector/signaltometricsconnector/config/config_test.go index 317031a49ad6..a542a189df5e 100644 --- a/connector/signaltometricsconnector/config/config_test.go +++ b/connector/signaltometricsconnector/config/config_test.go @@ -4,7 +4,6 @@ package config import ( - "fmt" "path/filepath" "testing" @@ -50,16 +49,3 @@ func TestConfig(t *testing.T) { }) } } - -const validationMsgFormat = "failed to validate %s configuration: %s" - -func fullErrorForSignal(t *testing.T, signal, errMsg string) string { - t.Helper() - - switch signal { - case "spans", "datapoints", "logs": - return fmt.Sprintf(validationMsgFormat, signal, errMsg) - default: - panic("unhandled signal type") - } -} From e9bb114952ef048636c40681b8dd70259dd7f57e Mon Sep 17 00:00:00 2001 From: Vishal Raj Date: Wed, 20 Nov 2024 15:14:29 +0000 Subject: [PATCH 4/8] Add full README --- connector/signaltometricsconnector/README.md | 196 +++++++++++++++++++ 1 file changed, 196 insertions(+) diff --git a/connector/signaltometricsconnector/README.md b/connector/signaltometricsconnector/README.md index 17c3a21e9d63..a8c38aace613 100644 --- a/connector/signaltometricsconnector/README.md +++ b/connector/signaltometricsconnector/README.md @@ -25,3 +25,199 @@ Signal to metrics connector produces metrics from all signal types (traces, logs [Stability Level]: https://github.com/open-telemetry/opentelemetry-collector/blob/main/docs/component-stability.md#stability-levels +## Configuration + +The component can produce metrics from spans, datapoints (for metrics), and logs. +At least one of the metrics for one signal type MUST be specified correctly for +the component to work. + +All signal types can be configured to produce metrics with the same configuration +structure. For example, the below configuration will produce delta temporality counters +for counting number of events for each of the configured signals: + +```yaml +signaltometrics: + spans: + - name: span.count + description: Count of spans + sum: + value: Int(AbsoluteCount()) # Count of total spans represented by each span + datapoints: + - name: datapoint.count + description: Count of datapoints + sum: + value: "1" # increment by 1 for each datapoint + logs: + - name: logrecord.count + description: Count of log records + sum: + value: "1" # increment by 1 for each log record +``` + +### Metrics types + +`signaltometrics` produces a variety of metric types by utilizing [OTTL](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/pkg/ottl/README.md) +to extract the relevant data for a metric type from the incoming data. The +component can produce the following metric types for each signal types: + +- [Sum](https://opentelemetry.io/docs/specs/otel/metrics/data-model/#sums) +- [Histogram](https://opentelemetry.io/docs/specs/otel/metrics/data-model/#histogram) +- [Exponential Histogram](https://opentelemetry.io/docs/specs/otel/metrics/data-model/#exponentialhistogram) + +#### Sum + +Sum metrics have the following configurations: + +```yaml +sum: + value: +``` + +- [**Required**] `value` represents an OTTL expression to extract a value from the + incoming data. Only OTTL expressions that return a value are accepted. The + returned value determines the value type of the `sum` metric (`int` or `double`). + [OTTL converters](https://pkg.go.dev/github.com/open-telemetry/opentelemetry-collector-contrib/pkg/ottl/ottlfuncs#readme-converters) can be used to transform the data. + +#### Histogram + +Histogram metrics have the following configurations: + +```yaml +histogram: + buckets: []float64 + count: + value: +``` + +- [**Optional**] `buckets` represents the buckets to be used for the histogram. If no + buckets are configured then it defaults to: + + ```go + []float64{2, 4, 6, 8, 10, 50, 100, 200, 400, 800, 1000, 1400, 2000, 5000, 10_000, 15_000} + ``` + +- [**Optional**] `count` represents an OTTL expression to extract the count to be recorded + in the histogram from the incoming data. If no expression is provided then it + defaults to the count of the signal i.e. [adjusted count](https://opentelemetry.io/docs/specs/otel/trace/tracestate-probability-sampling-experimental/#adjusted-count) for spans and count for others. + [OTTL converters](https://pkg.go.dev/github.com/open-telemetry/opentelemetry-collector-contrib/pkg/ottl/ottlfuncs#readme-converters) can be used to transform the data. +- [**Required**] `value` represents an OTTL expression to extract the value to be recorded + in the histogram from the incoming data. + [OTTL converters](https://pkg.go.dev/github.com/open-telemetry/opentelemetry-collector-contrib/pkg/ottl/ottlfuncs#readme-converters) can be used to transform the data. + +#### Exponential Histogram + +Exponential histogram metrics have the following configurations: + +```yaml +exponential_histogram: + max_size: + count: + value: +``` + +- [**Optional**] `max_size` represents the maximum number of buckets per positive or + negative number range. Defaults to `160`. +- [**Optional**] `count` represents an OTTL expression to extract the count to be recorded + in the exponential histogram from the incoming data. If no expression is provided + then it defaults to the count of the signal i.e. [adjusted count](https://opentelemetry.io/docs/specs/otel/trace/tracestate-probability-sampling-experimental/#adjusted-count) + for spans and count for others. + [OTTL converters](https://pkg.go.dev/github.com/open-telemetry/opentelemetry-collector-contrib/pkg/ottl/ottlfuncs#readme-converters) can be used to transform the data. +- [**Required**] `value` represents an OTTL expression to extract the value to be recorded + in the exponential histogram from the incoming data. + [OTTL converters](https://pkg.go.dev/github.com/open-telemetry/opentelemetry-collector-contrib/pkg/ottl/ottlfuncs#readme-converters) can be used to transform the data. + +### Attributes + +The component can produce metrics categorized by the attributes (span attributes for +traces, datapoint attributes for datapoints, or log record attributes for logs) from +the incoming data by configuring `attributes` for the configured metrics. + +If no `attributes` are configured then the metrics are produced without any attributes. + +```yaml +attributes: + - key: datapoint.foo + - key: datapoint.bar + default_value: bar +``` + +If attributes are specified then a separate metric will be generated for each unique set +of attribute values. Optionally, a `default_value` can be used to always include the +attribute with the value of the attribute defaulting to the value specified in +`default_value` if the incoming data is missing that attribute. + +### Conditions + +Conditions are an optional list of OTTL conditions that are evaluated on the incoming +data and are ORd together. For example: + +```yaml +signaltometrics: + datapoints: + - name: gauge.to.exphistogram + conditions: + - metric.type == 1 # select all gauges + - resource.attributes["resource.foo"] != nil + exponential_histogram: + count: "1" # 1 count for each datapoint + value: Double(value_int) + value_double # handle both int and double +``` + +The above configuration produces exponential histogram from gauge metrics with resource +attributes `resource.foo` set. + +### Customizing resource attributes + +The component allows customizing the resource attributes for the produced metrics by +specifying a list of attributes that should be included in the final metrics. If +no attributes are specified for `include_resource_attributes` then no filtering is +performed i.e. all resource attributes of the incoming data is considered. + +```yaml +include_resource_attributes: + - key: resource.foo # Include resource.foo attribute if present + - key: resource.bar # Always include resource.bar attribute, default to bar + default_value: bar +``` + +With the above configuration the produced metrics would only have the couple of +resource attributes specified in the list: + +- `resource.foo` will be present for the produced metrics if the incoming data also + has the attribute defined. +- `resource.bar` will always be present because of the `default_value`. If the incoming + data does not have a resource attribute with name `resource.bar` then the configured + `default_value` of `bar` will be used. + +### Single writer + +Metrics data streams MUST obey [single-writer](https://opentelemetry.io/docs/specs/otel/metrics/data-model/#single-writer) principle. However, +since `signaltometrics` component produces metrics from all signal types and also +allows customizing the resource attributes, there is a possibility of violating the +single-writer principle. To keep the single-writer principle intact, the component +adds collector instance information as resource attributes. The following resource +attributes are added to each produced metrics: + +```yaml +signaltometrics.service.name: +signaltometrics.service.namespace: +signaltometrics.service.instance.id: +``` + +### Custom OTTL functions + +The component implements a couple of custom OTTL functions: + +1. `AdjustedCount`: a converter capable of calculating [adjusted count for a span](https://github.com/open-telemetry/oteps/blob/main/text/trace/0235-sampling-threshold-in-trace-state.md). +2. `get`: a temporary solution to parse OTTL expressions with only values. This should +not be used explicitly and is a stopgap measure ([see this for more details](https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/35621)). + +### Examples + +More examples for using this component are available in the [testdata](./testdata) directory. +The examples are categorized for each signal type. The corresponding output of the +component can also be perused based on a sample input file in the directories: + +- For traces, input file is [traces.yaml](./testdata/traces/traces.yaml) +- For metrics, input file is [metrics.yaml](./testdata/metrics/metrics.yaml) +- For logs, input file is [logs.yaml](./testdata/logs/logs.yaml) From df1b867667fae48fab0ab4af0761c81a094b8579 Mon Sep 17 00:00:00 2001 From: Vishal Raj Date: Wed, 20 Nov 2024 16:01:09 +0000 Subject: [PATCH 5/8] Update readme with details on component usage --- connector/signaltometricsconnector/README.md | 111 ++++++++++--------- 1 file changed, 58 insertions(+), 53 deletions(-) diff --git a/connector/signaltometricsconnector/README.md b/connector/signaltometricsconnector/README.md index a8c38aace613..46299406d676 100644 --- a/connector/signaltometricsconnector/README.md +++ b/connector/signaltometricsconnector/README.md @@ -1,6 +1,7 @@ # Signal to metrics connector -Signal to metrics connector produces metrics from all signal types (traces, logs, or metrics). +Signal to metrics connector produces metrics from all signal types (traces, +logs, or metrics). | Status | | @@ -64,6 +65,10 @@ component can produce the following metric types for each signal types: - [Histogram](https://opentelemetry.io/docs/specs/otel/metrics/data-model/#histogram) - [Exponential Histogram](https://opentelemetry.io/docs/specs/otel/metrics/data-model/#exponentialhistogram) +The component does NOT perform any stateful or time based aggregations. The metric +types are aggregated for the payload sent in each `Consume*` call. The final metric +is then sent forward in the pipeline. + #### Sum Sum metrics have the following configurations: @@ -76,7 +81,8 @@ sum: - [**Required**] `value` represents an OTTL expression to extract a value from the incoming data. Only OTTL expressions that return a value are accepted. The returned value determines the value type of the `sum` metric (`int` or `double`). - [OTTL converters](https://pkg.go.dev/github.com/open-telemetry/opentelemetry-collector-contrib/pkg/ottl/ottlfuncs#readme-converters) can be used to transform the data. + [OTTL converters](https://pkg.go.dev/github.com/open-telemetry/opentelemetry-collector-contrib/pkg/ottl/ottlfuncs#readme-converters) + can be used to transform the data. #### Histogram @@ -89,20 +95,21 @@ histogram: value: ``` -- [**Optional**] `buckets` represents the buckets to be used for the histogram. If no - buckets are configured then it defaults to: +- [**Optional**] `buckets` represents the buckets to be used for the histogram. + If no buckets are configured then it defaults to: ```go []float64{2, 4, 6, 8, 10, 50, 100, 200, 400, 800, 1000, 1400, 2000, 5000, 10_000, 15_000} ``` -- [**Optional**] `count` represents an OTTL expression to extract the count to be recorded - in the histogram from the incoming data. If no expression is provided then it - defaults to the count of the signal i.e. [adjusted count](https://opentelemetry.io/docs/specs/otel/trace/tracestate-probability-sampling-experimental/#adjusted-count) for spans and count for others. - [OTTL converters](https://pkg.go.dev/github.com/open-telemetry/opentelemetry-collector-contrib/pkg/ottl/ottlfuncs#readme-converters) can be used to transform the data. -- [**Required**] `value` represents an OTTL expression to extract the value to be recorded - in the histogram from the incoming data. - [OTTL converters](https://pkg.go.dev/github.com/open-telemetry/opentelemetry-collector-contrib/pkg/ottl/ottlfuncs#readme-converters) can be used to transform the data. +- [**Optional**] `count` represents an OTTL expression to extract the count to be + recorded in the histogram from the incoming data. If no expression is provided + then it defaults to the count of the signal i.e. [adjusted count](https://opentelemetry.io/docs/specs/otel/trace/tracestate-probability-sampling-experimental/#adjusted-count) + for spans and count for others. [OTTL converters](https://pkg.go.dev/github.com/open-telemetry/opentelemetry-collector-contrib/pkg/ottl/ottlfuncs#readme-converters) + can be used to transform the data. +- [**Required**] `value` represents an OTTL expression to extract the value to be + recorded in the histogram from the incoming data. [OTTL converters](https://pkg.go.dev/github.com/open-telemetry/opentelemetry-collector-contrib/pkg/ottl/ottlfuncs#readme-converters) + can be used to transform the data. #### Exponential Histogram @@ -115,11 +122,11 @@ exponential_histogram: value: ``` -- [**Optional**] `max_size` represents the maximum number of buckets per positive or - negative number range. Defaults to `160`. -- [**Optional**] `count` represents an OTTL expression to extract the count to be recorded - in the exponential histogram from the incoming data. If no expression is provided - then it defaults to the count of the signal i.e. [adjusted count](https://opentelemetry.io/docs/specs/otel/trace/tracestate-probability-sampling-experimental/#adjusted-count) +- [**Optional**] `max_size` represents the maximum number of buckets per positive + or negative number range. Defaults to `160`. +- [**Optional**] `count` represents an OTTL expression to extract the count to be + recorded in the exponential histogram from the incoming data. If no expression + is provided then it defaults to the count of the signal i.e. [adjusted count](https://opentelemetry.io/docs/specs/otel/trace/tracestate-probability-sampling-experimental/#adjusted-count) for spans and count for others. [OTTL converters](https://pkg.go.dev/github.com/open-telemetry/opentelemetry-collector-contrib/pkg/ottl/ottlfuncs#readme-converters) can be used to transform the data. - [**Required**] `value` represents an OTTL expression to extract the value to be recorded @@ -128,9 +135,9 @@ exponential_histogram: ### Attributes -The component can produce metrics categorized by the attributes (span attributes for -traces, datapoint attributes for datapoints, or log record attributes for logs) from -the incoming data by configuring `attributes` for the configured metrics. +The component can produce metrics categorized by the attributes (span attributes +for traces, datapoint attributes for datapoints, or log record attributes for logs) +from the incoming data by configuring `attributes` for the configured metrics. If no `attributes` are configured then the metrics are produced without any attributes. @@ -141,23 +148,39 @@ attributes: default_value: bar ``` -If attributes are specified then a separate metric will be generated for each unique set -of attribute values. Optionally, a `default_value` can be used to always include the -attribute with the value of the attribute defaulting to the value specified in +If attributes are specified then a separate metric will be generated for each unique +set of attribute values. Optionally, a `default_value` can be used to always include +the attribute with the value of the attribute defaulting to the value specified in `default_value` if the incoming data is missing that attribute. ### Conditions Conditions are an optional list of OTTL conditions that are evaluated on the incoming -data and are ORd together. For example: +data and are ORed together. For example: + +```yaml +signaltometrics: + datapoints: + - name: datapoint.bar.sum + description: Count total number of datapoints as per datapoint.bar attribute + conditions: + - resource.attributes["foo"] != nil + - resource.attributes["bar"] != nil + sum: + value: "1" +``` + +The above configuration will produce sum metrics from datapoints with either `foo` +OR `bar` resource attribute defined. + +Conditions can also be ANDed together, for example: ```yaml signaltometrics: datapoints: - name: gauge.to.exphistogram conditions: - - metric.type == 1 # select all gauges - - resource.attributes["resource.foo"] != nil + - metric.type == 1 AND resource.attributes["resource.foo"] != nil exponential_histogram: count: "1" # 1 count for each datapoint value: Double(value_int) + value_double # handle both int and double @@ -168,10 +191,10 @@ attributes `resource.foo` set. ### Customizing resource attributes -The component allows customizing the resource attributes for the produced metrics by -specifying a list of attributes that should be included in the final metrics. If -no attributes are specified for `include_resource_attributes` then no filtering is -performed i.e. all resource attributes of the incoming data is considered. +The component allows customizing the resource attributes for the produced metrics +by specifying a list of attributes that should be included in the final metrics. +If no attributes are specified for `include_resource_attributes` then no filtering +is performed i.e. all resource attributes of the incoming data is considered. ```yaml include_resource_attributes: @@ -191,33 +214,15 @@ resource attributes specified in the list: ### Single writer -Metrics data streams MUST obey [single-writer](https://opentelemetry.io/docs/specs/otel/metrics/data-model/#single-writer) principle. However, -since `signaltometrics` component produces metrics from all signal types and also -allows customizing the resource attributes, there is a possibility of violating the -single-writer principle. To keep the single-writer principle intact, the component -adds collector instance information as resource attributes. The following resource -attributes are added to each produced metrics: +Metrics data streams MUST obey [single-writer](https://opentelemetry.io/docs/specs/otel/metrics/data-model/#single-writer) +principle. However, since `signaltometrics` component produces metrics from all signal +types and also allows customizing the resource attributes, there is a possibility +of violating the single-writer principle. To keep the single-writer principle intact, +the component adds collector instance information as resource attributes. The following +resource attributes are added to each produced metrics: ```yaml signaltometrics.service.name: signaltometrics.service.namespace: signaltometrics.service.instance.id: ``` - -### Custom OTTL functions - -The component implements a couple of custom OTTL functions: - -1. `AdjustedCount`: a converter capable of calculating [adjusted count for a span](https://github.com/open-telemetry/oteps/blob/main/text/trace/0235-sampling-threshold-in-trace-state.md). -2. `get`: a temporary solution to parse OTTL expressions with only values. This should -not be used explicitly and is a stopgap measure ([see this for more details](https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/35621)). - -### Examples - -More examples for using this component are available in the [testdata](./testdata) directory. -The examples are categorized for each signal type. The corresponding output of the -component can also be perused based on a sample input file in the directories: - -- For traces, input file is [traces.yaml](./testdata/traces/traces.yaml) -- For metrics, input file is [metrics.yaml](./testdata/metrics/metrics.yaml) -- For logs, input file is [logs.yaml](./testdata/logs/logs.yaml) From 4e0bdab6586665f38e67281518d29e117ebfde59 Mon Sep 17 00:00:00 2001 From: Vishal Raj Date: Wed, 20 Nov 2024 16:55:22 +0000 Subject: [PATCH 6/8] Use 1.22.0 as go version --- connector/signaltometricsconnector/go.mod | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/connector/signaltometricsconnector/go.mod b/connector/signaltometricsconnector/go.mod index 224f311e2f17..6154c6a5641d 100644 --- a/connector/signaltometricsconnector/go.mod +++ b/connector/signaltometricsconnector/go.mod @@ -1,6 +1,6 @@ module github.com/open-telemetry/opentelemetry-collector-contrib/connector/signaltometricsconnector -go 1.22.7 +go 1.22.0 require ( github.com/stretchr/testify v1.9.0 From 931149103aae41d83f8c0d7894b735cdd326a772 Mon Sep 17 00:00:00 2001 From: Vishal Raj Date: Thu, 21 Nov 2024 16:02:01 +0000 Subject: [PATCH 7/8] remove contrib distribution --- connector/signaltometricsconnector/README.md | 3 +-- connector/signaltometricsconnector/config/config.go | 7 +------ connector/signaltometricsconnector/metadata.yaml | 2 +- reports/distributions/contrib.yaml | 1 - 4 files changed, 3 insertions(+), 10 deletions(-) diff --git a/connector/signaltometricsconnector/README.md b/connector/signaltometricsconnector/README.md index 46299406d676..9e0851209780 100644 --- a/connector/signaltometricsconnector/README.md +++ b/connector/signaltometricsconnector/README.md @@ -6,12 +6,11 @@ logs, or metrics). | Status | | | ------------- |-----------| -| Distributions | [contrib] | +| Distributions | [] | | Issues | [![Open issues](https://img.shields.io/github/issues-search/open-telemetry/opentelemetry-collector-contrib?query=is%3Aissue%20is%3Aopen%20label%3Aconnector%2Fsignaltometrics%20&label=open&color=orange&logo=opentelemetry)](https://github.com/open-telemetry/opentelemetry-collector-contrib/issues?q=is%3Aopen+is%3Aissue+label%3Aconnector%2Fsignaltometrics) [![Closed issues](https://img.shields.io/github/issues-search/open-telemetry/opentelemetry-collector-contrib?query=is%3Aissue%20is%3Aclosed%20label%3Aconnector%2Fsignaltometrics%20&label=closed&color=blue&logo=opentelemetry)](https://github.com/open-telemetry/opentelemetry-collector-contrib/issues?q=is%3Aclosed+is%3Aissue+label%3Aconnector%2Fsignaltometrics) | | [Code Owners](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/CONTRIBUTING.md#becoming-a-code-owner) | [@ChrsMark](https://www.github.com/ChrsMark), [@lahsivjar](https://www.github.com/lahsivjar) | [development]: https://github.com/open-telemetry/opentelemetry-collector/blob/main/docs/component-stability.md#development -[contrib]: https://github.com/open-telemetry/opentelemetry-collector-releases/tree/main/distributions/otelcol-contrib ## Supported Pipeline Types diff --git a/connector/signaltometricsconnector/config/config.go b/connector/signaltometricsconnector/config/config.go index b9bc17c02167..7a2beb6787c8 100644 --- a/connector/signaltometricsconnector/config/config.go +++ b/connector/signaltometricsconnector/config/config.go @@ -30,14 +30,9 @@ type MetricInfo struct { // IncludeResourceAttributes is a list of resource attributes that // needs to be included in the generated metric. If no resource // attribute is included in the list then all attributes are included. - // Metric data streams MUST obey single-writer. The component produces - // metrics from non-metric signals as well as alters resource attributes - // from the source signals. To keep the single-writer valid, the - // component adds collector information as resource attribute with the - // component name as the prefix of the resource attributes. IncludeResourceAttributes []Attribute `mapstructure:"include_resource_attributes"` Attributes []Attribute `mapstructure:"attributes"` - // Conditions are a set of OTTL condtions which are ORd. Data is + // Conditions are a set of OTTL condtions which are ORed. Data is // processed into metrics only if the sequence evaluates to true. Conditions []string `mapstructure:"conditions"` Histogram *Histogram `mapstructure:"histogram"` diff --git a/connector/signaltometricsconnector/metadata.yaml b/connector/signaltometricsconnector/metadata.yaml index 92dd9b1072fc..e677dde4d8ae 100644 --- a/connector/signaltometricsconnector/metadata.yaml +++ b/connector/signaltometricsconnector/metadata.yaml @@ -4,7 +4,7 @@ status: class: connector stability: development: [traces_to_metrics, logs_to_metrics, metrics_to_metrics] - distributions: [contrib] + distributions: [] codeowners: active: [ChrsMark, lahsivjar] diff --git a/reports/distributions/contrib.yaml b/reports/distributions/contrib.yaml index 1a3226ba4d5b..2d8cbb868933 100644 --- a/reports/distributions/contrib.yaml +++ b/reports/distributions/contrib.yaml @@ -12,7 +12,6 @@ components: - roundrobin - routing - servicegraph - - signaltometrics - spanmetrics exporter: - alibabacloud_logservice From 4bab28fc9e36f3dd81553934a6be71910ec1cb73 Mon Sep 17 00:00:00 2001 From: Vishal Raj Date: Thu, 21 Nov 2024 16:20:00 +0000 Subject: [PATCH 8/8] Remove from otelcontribcol --- cmd/otelcontribcol/builder-config.yaml | 2 -- 1 file changed, 2 deletions(-) diff --git a/cmd/otelcontribcol/builder-config.yaml b/cmd/otelcontribcol/builder-config.yaml index 6816b45a58c5..b31409e27bae 100644 --- a/cmd/otelcontribcol/builder-config.yaml +++ b/cmd/otelcontribcol/builder-config.yaml @@ -231,7 +231,6 @@ connectors: - gomod: github.com/open-telemetry/opentelemetry-collector-contrib/connector/roundrobinconnector v0.114.0 - gomod: github.com/open-telemetry/opentelemetry-collector-contrib/connector/routingconnector v0.114.0 - gomod: github.com/open-telemetry/opentelemetry-collector-contrib/connector/servicegraphconnector v0.114.0 - - gomod: github.com/open-telemetry/opentelemetry-collector-contrib/connector/signaltometricsconnector v0.114.0 - gomod: github.com/open-telemetry/opentelemetry-collector-contrib/connector/spanmetricsconnector v0.114.0 - gomod: github.com/open-telemetry/opentelemetry-collector-contrib/connector/sumconnector v0.114.0 @@ -466,7 +465,6 @@ replaces: - github.com/open-telemetry/opentelemetry-collector-contrib/connector/roundrobinconnector => ../../connector/roundrobinconnector - github.com/open-telemetry/opentelemetry-collector-contrib/connector/routingconnector => ../../connector/routingconnector - github.com/open-telemetry/opentelemetry-collector-contrib/connector/servicegraphconnector => ../../connector/servicegraphconnector - - github.com/open-telemetry/opentelemetry-collector-contrib/connector/signaltometricsconnector => ../../connector/signaltometricsconnector - github.com/open-telemetry/opentelemetry-collector-contrib/connector/spanmetricsconnector => ../../connector/spanmetricsconnector - github.com/open-telemetry/opentelemetry-collector-contrib/connector/sumconnector => ../../connector/sumconnector - github.com/openshift/api v3.9.0+incompatible => github.com/openshift/api v0.0.0-20180801171038-322a19404e37