diff --git a/cmd/plugindocgen/go.mod b/cmd/plugindocgen/go.mod index 29820fcd8..e7b74ae0c 100644 --- a/cmd/plugindocgen/go.mod +++ b/cmd/plugindocgen/go.mod @@ -3,7 +3,7 @@ module github.com/observiq/bindplane-agent/plugindocgen go 1.20 require ( - github.com/observiq/bindplane-agent/receiver/pluginreceiver v1.35.0 + github.com/observiq/bindplane-agent/receiver/pluginreceiver v1.35.1 github.com/spf13/pflag v1.0.5 gopkg.in/yaml.v3 v3.0.1 ) diff --git a/collector/collector.go b/collector/collector.go index 3b1a152f1..272b92f0f 100644 --- a/collector/collector.go +++ b/collector/collector.go @@ -98,6 +98,11 @@ func (c *collector) Run(ctx context.Context) error { return errors.New("service already running") } + // Register component telemetry before running to ensure a clean state for this run + if err := factories.RegisterComponentTelemetry(); err != nil { + return fmt.Errorf("register component telemetry: %w", err) + } + // The OT collector only supports using settings once during the lifetime // of a single collector instance. We must remake the settings on each startup. settings, err := NewSettings(c.configPaths, c.version, c.loggingOpts, c.factories) diff --git a/factories/factories.go b/factories/factories.go index e2490e173..9c00dfc47 100644 --- a/factories/factories.go +++ b/factories/factories.go @@ -34,6 +34,19 @@ func DefaultFactories() (otelcol.Factories, error) { return combineFactories(defaultReceivers, defaultProcessors, defaultExporters, defaultExtensions, defaultConnectors) } +// RegisterComponentTelemetry registers or re-registers components with telemetry so that any stale metrics are cleaned out. +func RegisterComponentTelemetry() error { + if err := throughputmeasurementprocessor.RegisterMetricViews(); err != nil { + return fmt.Errorf("failed to register throughput measurement processor telemetry: %w", err) + } + + if err := throughputwrapper.RegisterMetricViews(); err != nil { + return fmt.Errorf("failed to register throughput wrapper telemetry: %w", err) + } + + return nil +} + // combineFactories combines the supplied factories into a single Factories struct. // Any errors encountered will also be combined into a single error. func combineFactories(receivers []receiver.Factory, processors []processor.Factory, @@ -41,8 +54,8 @@ func combineFactories(receivers []receiver.Factory, processors []processor.Facto connectors []connector.Factory) (otelcol.Factories, error) { var errs []error - // Register component telemetry - if err := registerComponentTelemetry(); err != nil { + // Ensure component telemetry is registered at least once by having it in this method + if err := RegisterComponentTelemetry(); err != nil { errs = append(errs, err) } @@ -89,15 +102,3 @@ func wrapReceivers(receivers []receiver.Factory) []receiver.Factory { return wrappedReceivers } - -func registerComponentTelemetry() error { - if err := throughputmeasurementprocessor.RegisterMetricViews(); err != nil { - return fmt.Errorf("failed to register throughput measurement processor telemetry: %w", err) - } - - if err := throughputwrapper.RegisterMetricViews(); err != nil { - return fmt.Errorf("failed to register throughput wrapper telemetry: %w", err) - } - - return nil -} diff --git a/go.mod b/go.mod index 6bf828565..c1e489135 100644 --- a/go.mod +++ b/go.mod @@ -5,25 +5,25 @@ go 1.20 require ( github.com/google/uuid v1.3.1 github.com/mholt/archiver/v3 v3.5.1 - github.com/observiq/bindplane-agent/exporter/azureblobexporter v1.35.0 - github.com/observiq/bindplane-agent/exporter/googlecloudexporter v1.35.0 - github.com/observiq/bindplane-agent/exporter/googlemanagedprometheusexporter v1.35.0 - github.com/observiq/bindplane-agent/packagestate v1.35.0 - github.com/observiq/bindplane-agent/processor/datapointcountprocessor v1.35.0 - github.com/observiq/bindplane-agent/processor/logcountprocessor v1.35.0 - github.com/observiq/bindplane-agent/processor/logdeduplicationprocessor v1.35.0 - github.com/observiq/bindplane-agent/processor/maskprocessor v1.35.0 - github.com/observiq/bindplane-agent/processor/metricextractprocessor v1.35.0 - github.com/observiq/bindplane-agent/processor/metricstatsprocessor v1.35.0 - github.com/observiq/bindplane-agent/processor/removeemptyvaluesprocessor v1.35.0 - github.com/observiq/bindplane-agent/processor/resourceattributetransposerprocessor v1.35.0 - github.com/observiq/bindplane-agent/processor/samplingprocessor v1.35.0 - github.com/observiq/bindplane-agent/processor/spancountprocessor v1.35.0 - github.com/observiq/bindplane-agent/processor/throughputmeasurementprocessor v1.35.0 - github.com/observiq/bindplane-agent/receiver/m365receiver v1.35.0 - github.com/observiq/bindplane-agent/receiver/pluginreceiver v1.35.0 - github.com/observiq/bindplane-agent/receiver/routereceiver v1.35.0 - github.com/observiq/bindplane-agent/receiver/sapnetweaverreceiver v1.35.0 + github.com/observiq/bindplane-agent/exporter/azureblobexporter v1.35.1 + github.com/observiq/bindplane-agent/exporter/googlecloudexporter v1.35.1 + github.com/observiq/bindplane-agent/exporter/googlemanagedprometheusexporter v1.35.1 + github.com/observiq/bindplane-agent/packagestate v1.35.1 + github.com/observiq/bindplane-agent/processor/datapointcountprocessor v1.35.1 + github.com/observiq/bindplane-agent/processor/logcountprocessor v1.35.1 + github.com/observiq/bindplane-agent/processor/logdeduplicationprocessor v1.35.1 + github.com/observiq/bindplane-agent/processor/maskprocessor v1.35.1 + github.com/observiq/bindplane-agent/processor/metricextractprocessor v1.35.1 + github.com/observiq/bindplane-agent/processor/metricstatsprocessor v1.35.1 + github.com/observiq/bindplane-agent/processor/removeemptyvaluesprocessor v1.35.1 + github.com/observiq/bindplane-agent/processor/resourceattributetransposerprocessor v1.35.1 + github.com/observiq/bindplane-agent/processor/samplingprocessor v1.35.1 + github.com/observiq/bindplane-agent/processor/spancountprocessor v1.35.1 + github.com/observiq/bindplane-agent/processor/throughputmeasurementprocessor v1.35.1 + github.com/observiq/bindplane-agent/receiver/m365receiver v1.35.1 + github.com/observiq/bindplane-agent/receiver/pluginreceiver v1.35.1 + github.com/observiq/bindplane-agent/receiver/routereceiver v1.35.1 + github.com/observiq/bindplane-agent/receiver/sapnetweaverreceiver v1.35.1 github.com/oklog/ulid/v2 v2.1.0 github.com/open-telemetry/opamp-go v0.2.0 github.com/open-telemetry/opentelemetry-collector-contrib/connector/countconnector v0.85.0 @@ -222,8 +222,8 @@ require ( github.com/kylelemons/godebug v1.1.0 // indirect github.com/minio/asm2plan9s v0.0.0-20200509001527-cdd76441f9d8 // indirect github.com/minio/c2goasm v0.0.0-20190812172519-36a3d3bbc4f3 // indirect - github.com/observiq/bindplane-agent/counter v1.35.0 // indirect - github.com/observiq/bindplane-agent/expr v1.35.0 // indirect + github.com/observiq/bindplane-agent/counter v1.35.1 // indirect + github.com/observiq/bindplane-agent/expr v1.35.1 // indirect github.com/open-telemetry/opentelemetry-collector-contrib/exporter/googlemanagedprometheusexporter v0.85.0 // indirect github.com/open-telemetry/opentelemetry-collector-contrib/processor/servicegraphprocessor v0.85.0 // indirect github.com/outcaste-io/ristretto v0.2.1 // indirect diff --git a/processor/datapointcountprocessor/go.mod b/processor/datapointcountprocessor/go.mod index 1167501a0..1376c5265 100644 --- a/processor/datapointcountprocessor/go.mod +++ b/processor/datapointcountprocessor/go.mod @@ -3,9 +3,9 @@ module github.com/observiq/bindplane-agent/processor/datapointcountprocessor go 1.20 require ( - github.com/observiq/bindplane-agent/counter v1.35.0 - github.com/observiq/bindplane-agent/expr v1.35.0 - github.com/observiq/bindplane-agent/receiver/routereceiver v1.35.0 + github.com/observiq/bindplane-agent/counter v1.35.1 + github.com/observiq/bindplane-agent/expr v1.35.1 + github.com/observiq/bindplane-agent/receiver/routereceiver v1.35.1 github.com/open-telemetry/opentelemetry-collector-contrib/pkg/ottl v0.85.0 github.com/stretchr/testify v1.8.4 go.opentelemetry.io/collector/component v0.85.0 diff --git a/processor/logcountprocessor/go.mod b/processor/logcountprocessor/go.mod index 4043b8b49..cafb8c94e 100644 --- a/processor/logcountprocessor/go.mod +++ b/processor/logcountprocessor/go.mod @@ -3,9 +3,9 @@ module github.com/observiq/bindplane-agent/processor/logcountprocessor go 1.20 require ( - github.com/observiq/bindplane-agent/counter v1.35.0 - github.com/observiq/bindplane-agent/expr v1.35.0 - github.com/observiq/bindplane-agent/receiver/routereceiver v1.35.0 + github.com/observiq/bindplane-agent/counter v1.35.1 + github.com/observiq/bindplane-agent/expr v1.35.1 + github.com/observiq/bindplane-agent/receiver/routereceiver v1.35.1 github.com/open-telemetry/opentelemetry-collector-contrib/pkg/ottl v0.85.0 github.com/stretchr/testify v1.8.4 go.opentelemetry.io/collector/component v0.85.0 diff --git a/processor/metricextractprocessor/go.mod b/processor/metricextractprocessor/go.mod index 982159c97..ccfdd0725 100644 --- a/processor/metricextractprocessor/go.mod +++ b/processor/metricextractprocessor/go.mod @@ -3,8 +3,8 @@ module github.com/observiq/bindplane-agent/processor/metricextractprocessor go 1.20 require ( - github.com/observiq/bindplane-agent/expr v1.35.0 - github.com/observiq/bindplane-agent/receiver/routereceiver v1.35.0 + github.com/observiq/bindplane-agent/expr v1.35.1 + github.com/observiq/bindplane-agent/receiver/routereceiver v1.35.1 github.com/open-telemetry/opentelemetry-collector-contrib/pkg/ottl v0.85.0 github.com/open-telemetry/opentelemetry-collector-contrib/pkg/pdatatest v0.85.0 github.com/stretchr/testify v1.8.4 diff --git a/processor/spancountprocessor/go.mod b/processor/spancountprocessor/go.mod index b4186eaa8..21c2840fd 100644 --- a/processor/spancountprocessor/go.mod +++ b/processor/spancountprocessor/go.mod @@ -3,9 +3,9 @@ module github.com/observiq/bindplane-agent/processor/spancountprocessor go 1.20 require ( - github.com/observiq/bindplane-agent/counter v1.35.0 - github.com/observiq/bindplane-agent/expr v1.35.0 - github.com/observiq/bindplane-agent/receiver/routereceiver v1.35.0 + github.com/observiq/bindplane-agent/counter v1.35.1 + github.com/observiq/bindplane-agent/expr v1.35.1 + github.com/observiq/bindplane-agent/receiver/routereceiver v1.35.1 github.com/open-telemetry/opentelemetry-collector-contrib/pkg/ottl v0.85.0 github.com/stretchr/testify v1.8.4 go.opentelemetry.io/collector/component v0.85.0 diff --git a/updater/go.mod b/updater/go.mod index 1a60031a0..526798c36 100644 --- a/updater/go.mod +++ b/updater/go.mod @@ -4,7 +4,7 @@ go 1.20 require ( github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 - github.com/observiq/bindplane-agent/packagestate v1.35.0 + github.com/observiq/bindplane-agent/packagestate v1.35.1 github.com/open-telemetry/opamp-go v0.2.0 github.com/spf13/pflag v1.0.5 github.com/stretchr/testify v1.8.4