From 856062d7bf10ab2b005270dcae4b3eab33ddb831 Mon Sep 17 00:00:00 2001 From: Mike Terhar Date: Fri, 20 Dec 2024 11:55:56 -0500 Subject: [PATCH 1/3] [receiver/libhoney] Update metadata and contrib manifest (#36911) #### Description Mark the Libhoney receiver as Alpha. #### Link to tracking issue Fixes #36693 --- .chloggen/set-libhoneyreceiver-alpha.yaml | 27 +++++++++++++++++++ cmd/otelcontribcol/builder-config.yaml | 2 ++ receiver/libhoneyreceiver/README.md | 7 ++--- .../internal/metadata/generated_status.go | 4 +-- receiver/libhoneyreceiver/metadata.yaml | 3 ++- reports/distributions/contrib.yaml | 1 + 6 files changed, 38 insertions(+), 6 deletions(-) create mode 100644 .chloggen/set-libhoneyreceiver-alpha.yaml diff --git a/.chloggen/set-libhoneyreceiver-alpha.yaml b/.chloggen/set-libhoneyreceiver-alpha.yaml new file mode 100644 index 000000000000..8f56831168ea --- /dev/null +++ b/.chloggen/set-libhoneyreceiver-alpha.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: libhoneyreceiver + +# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). +note: Mark the libhoney receiver exporter as Alpha. + +# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists. +issues: [36693] + +# (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] \ No newline at end of file diff --git a/cmd/otelcontribcol/builder-config.yaml b/cmd/otelcontribcol/builder-config.yaml index 3de89d69304f..b8fb5e134cd8 100644 --- a/cmd/otelcontribcol/builder-config.yaml +++ b/cmd/otelcontribcol/builder-config.yaml @@ -174,6 +174,7 @@ receivers: - gomod: github.com/open-telemetry/opentelemetry-collector-contrib/receiver/kafkametricsreceiver v0.116.0 - gomod: github.com/open-telemetry/opentelemetry-collector-contrib/receiver/kafkareceiver v0.116.0 - gomod: github.com/open-telemetry/opentelemetry-collector-contrib/receiver/kubeletstatsreceiver v0.116.0 + - gomod: github.com/open-telemetry/opentelemetry-collector-contrib/receiver/libhoneyreceiver v0.116.0 - gomod: github.com/open-telemetry/opentelemetry-collector-contrib/receiver/lokireceiver v0.116.0 - gomod: github.com/open-telemetry/opentelemetry-collector-contrib/receiver/memcachedreceiver v0.116.0 - gomod: github.com/open-telemetry/opentelemetry-collector-contrib/receiver/mongodbatlasreceiver v0.116.0 @@ -443,6 +444,7 @@ replaces: - github.com/open-telemetry/opentelemetry-collector-contrib/receiver/datadogreceiver => ../../receiver/datadogreceiver - github.com/open-telemetry/opentelemetry-collector-contrib/receiver/chronyreceiver => ../../receiver/chronyreceiver - github.com/open-telemetry/opentelemetry-collector-contrib/extension/observer/ecstaskobserver => ../../extension/observer/ecstaskobserver + - github.com/open-telemetry/opentelemetry-collector-contrib/receiver/libhoneyreceiver => ../../receiver/libhoneyreceiver - github.com/open-telemetry/opentelemetry-collector-contrib/receiver/lokireceiver => ../../receiver/lokireceiver - github.com/open-telemetry/opentelemetry-collector-contrib/receiver/filestatsreceiver => ../../receiver/filestatsreceiver - github.com/open-telemetry/opentelemetry-collector-contrib/exporter/awss3exporter => ../../exporter/awss3exporter diff --git a/receiver/libhoneyreceiver/README.md b/receiver/libhoneyreceiver/README.md index a765c45383f4..4024f8ea20f9 100644 --- a/receiver/libhoneyreceiver/README.md +++ b/receiver/libhoneyreceiver/README.md @@ -2,12 +2,13 @@ | Status | | | ------------- |-----------| -| Stability | [development]: traces, logs | -| Distributions | [] | +| Stability | [alpha]: traces, logs | +| Distributions | [contrib] | | Issues | [![Open issues](https://img.shields.io/github/issues-search/open-telemetry/opentelemetry-collector-contrib?query=is%3Aissue%20is%3Aopen%20label%3Areceiver%2Flibhoney%20&label=open&color=orange&logo=opentelemetry)](https://github.com/open-telemetry/opentelemetry-collector-contrib/issues?q=is%3Aopen+is%3Aissue+label%3Areceiver%2Flibhoney) [![Closed issues](https://img.shields.io/github/issues-search/open-telemetry/opentelemetry-collector-contrib?query=is%3Aissue%20is%3Aclosed%20label%3Areceiver%2Flibhoney%20&label=closed&color=blue&logo=opentelemetry)](https://github.com/open-telemetry/opentelemetry-collector-contrib/issues?q=is%3Aclosed+is%3Aissue+label%3Areceiver%2Flibhoney) | | [Code Owners](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/CONTRIBUTING.md#becoming-a-code-owner) | [@TylerHelmuth](https://www.github.com/TylerHelmuth) | -[development]: https://github.com/open-telemetry/opentelemetry-collector/blob/main/docs/component-stability.md#development +[alpha]: https://github.com/open-telemetry/opentelemetry-collector/blob/main/docs/component-stability.md#alpha +[contrib]: https://github.com/open-telemetry/opentelemetry-collector-releases/tree/main/distributions/otelcol-contrib ### The purpose and use-cases of the new component diff --git a/receiver/libhoneyreceiver/internal/metadata/generated_status.go b/receiver/libhoneyreceiver/internal/metadata/generated_status.go index ef6ead1f4954..f3cb75e3fe13 100644 --- a/receiver/libhoneyreceiver/internal/metadata/generated_status.go +++ b/receiver/libhoneyreceiver/internal/metadata/generated_status.go @@ -12,6 +12,6 @@ var ( ) const ( - TracesStability = component.StabilityLevelDevelopment - LogsStability = component.StabilityLevelDevelopment + TracesStability = component.StabilityLevelAlpha + LogsStability = component.StabilityLevelAlpha ) diff --git a/receiver/libhoneyreceiver/metadata.yaml b/receiver/libhoneyreceiver/metadata.yaml index 18710f4b2a5e..d9da44082ad6 100644 --- a/receiver/libhoneyreceiver/metadata.yaml +++ b/receiver/libhoneyreceiver/metadata.yaml @@ -3,6 +3,7 @@ type: libhoney status: class: receiver stability: - development: [traces, logs] + alpha: [traces, logs] + distributions: [contrib] codeowners: active: [TylerHelmuth] \ No newline at end of file diff --git a/reports/distributions/contrib.yaml b/reports/distributions/contrib.yaml index fa453c991396..a4f0c3b4b075 100644 --- a/reports/distributions/contrib.yaml +++ b/reports/distributions/contrib.yaml @@ -152,6 +152,7 @@ components: - kafka - kafkametrics - kubeletstats + - libhoney - loki - memcached - mongodb From c413eeb8f0e9b29d1dcf72957d6871e8e92eb147 Mon Sep 17 00:00:00 2001 From: Bogdan Drutu Date: Fri, 20 Dec 2024 09:55:42 -0800 Subject: [PATCH 2/3] [chore] Upgrade golangci and fix lint issues (#36913) For the moment, disabling the G115 rule, but will create an issue to ask for help to enable it. Signed-off-by: Bogdan Drutu --- .golangci.yml | 5 +- Makefile.Common | 2 +- .../connector_metrics_test.go | 3 - .../spanmetricsconnector/connector_test.go | 4 - .../internal/cache/cache_test.go | 4 - exporter/awskinesisexporter/exporter_test.go | 1 - .../internal/producer/batcher_test.go | 1 - .../adx_exporter_test.go | 3 +- exporter/fileexporter/buffered_writer_test.go | 1 - exporter/kafkaexporter/factory_test.go | 3 - .../metrics_exporter_test.go | 9 - .../exporter_test.go | 3 +- exporter/sapmexporter/exporter_test.go | 1 - .../sentryexporter/sentry_exporter_test.go | 1 - .../internal/apm/correlations/client_test.go | 2 - .../internal/apm/tracetracker/tracker.go | 6 - exporter/sumologicexporter/config_test.go | 2 - extension/ackextension/inmemory_test.go | 3 - .../internal/grpc/grpc_test.go | 2 - .../internal/remote_strategy_cache_test.go | 3 +- extension/storage/filestorage/client_test.go | 1 - .../sumologicextension/extension_test.go | 2 - internal/tools/go.mod | 81 ++++---- internal/tools/go.sum | 180 +++++++++--------- pkg/stanza/adapter/converter_test.go | 2 - pkg/stanza/fileconsumer/config_test.go | 3 - pkg/stanza/fileconsumer/file_test.go | 2 - .../internal/fingerprint/fingerprint_test.go | 1 - .../internal/reader/reader_test.go | 2 - pkg/stanza/operator/input/file/config_test.go | 1 - .../skywalkingproto_to_traces_test.go | 2 +- .../attributes_log_test.go | 3 +- .../attributes_trace_test.go | 3 +- .../internal/migrate/attributes_test.go | 2 - .../internal/migrate/conditional_test.go | 2 - .../migrate/multi_conditional_test.go | 1 - .../internal/migrate/signal_test.go | 2 - .../internal/translation/revision_v1_test.go | 2 - processor/spanprocessor/span_test.go | 3 +- .../internal/chrony/client_test.go | 2 - .../cloudfoundryreceiver/converter_test.go | 3 +- receiver/datadogreceiver/receiver_test.go | 2 - .../scraper/githubscraper/github_scraper.go | 1 - .../scraper/cpuscraper/cpu_scraper_test.go | 1 - .../ucal/cpu_utilization_calculator_test.go | 1 - .../filesystem_scraper_test.go | 1 - .../ucal/cpu_utilization_calculator_test.go | 1 - .../internal/metadata/entities_test.go | 56 +++--- receiver/mongodbatlasreceiver/access_logs.go | 1 - receiver/mongodbatlasreceiver/alerts_test.go | 1 - receiver/mongodbreceiver/metrics.go | 3 + .../internal/metricfamily_test.go | 4 - .../internal/prom_to_otlp_test.go | 1 - .../prometheusreceiver/internal/util_test.go | 2 - receiver/snowflakereceiver/client_test.go | 3 +- receiver/snowflakereceiver/config_test.go | 4 +- testbed/tests/scenarios.go | 4 +- 57 files changed, 181 insertions(+), 264 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index 8951500c9f83..19fda8292c04 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -146,11 +146,11 @@ linters-settings: linters: enable: + - copyloopvar - decorder - depguard - errcheck - errorlint - - exportloopref - exhaustive - gci - gocritic @@ -183,3 +183,6 @@ issues: - text: "G402:" linters: - gosec + - text: "G115:" + linters: + - gosec diff --git a/Makefile.Common b/Makefile.Common index b8f2bb59913d..386dcf760dd7 100644 --- a/Makefile.Common +++ b/Makefile.Common @@ -217,7 +217,7 @@ fmt: $(GOFUMPT) $(GOIMPORTS) .PHONY: lint lint: $(LINT) checklicense misspell - $(LINT) run --allow-parallel-runners --verbose --build-tags integration --timeout=30m --path-prefix $(shell basename "$(CURDIR)") + $(LINT) run --allow-parallel-runners --build-tags integration --timeout=30m --path-prefix $(shell basename "$(CURDIR)") .PHONY: govulncheck govulncheck: $(GOVULNCHECK) diff --git a/connector/exceptionsconnector/connector_metrics_test.go b/connector/exceptionsconnector/connector_metrics_test.go index ef0b350a761c..a478abf01409 100644 --- a/connector/exceptionsconnector/connector_metrics_test.go +++ b/connector/exceptionsconnector/connector_metrics_test.go @@ -67,9 +67,6 @@ func TestConnectorConsumeTraces(t *testing.T) { } for _, tc := range testcases { - // Since parallelism is enabled in these tests, to avoid flaky behavior, - // instantiate a copy of the test case for t.Run's closure to use. - tc := tc t.Run(tc.name, func(t *testing.T) { msink := &consumertest.MetricsSink{} diff --git a/connector/spanmetricsconnector/connector_test.go b/connector/spanmetricsconnector/connector_test.go index a17e7d6bf605..21d1d83ca0eb 100644 --- a/connector/spanmetricsconnector/connector_test.go +++ b/connector/spanmetricsconnector/connector_test.go @@ -877,9 +877,6 @@ func TestConsumeTraces(t *testing.T) { } for _, tc := range testcases { - // Since parallelism is enabled in these tests, to avoid flaky behavior, - // instantiate a copy of the test case for t.Run's closure to use. - tc := tc t.Run(tc.name, func(t *testing.T) { // Prepare @@ -1070,7 +1067,6 @@ func TestExcludeDimensionsConsumeTraces(t *testing.T) { excludeDimensions := []string{"span.kind", "span.name", "totallyWrongNameDoesNotAffectAnything"} for _, tc := range testcases { - tc := tc t.Run(tc.dsc, func(t *testing.T) { // Set feature gate value previousValue := legacyMetricNamesFeatureGate.IsEnabled() diff --git a/connector/spanmetricsconnector/internal/cache/cache_test.go b/connector/spanmetricsconnector/internal/cache/cache_test.go index 83e9b16333d1..c7361f23dc7c 100644 --- a/connector/spanmetricsconnector/internal/cache/cache_test.go +++ b/connector/spanmetricsconnector/internal/cache/cache_test.go @@ -41,7 +41,6 @@ func TestNewCache(t *testing.T) { }, } for _, tt := range tests { - tt := tt t.Run(tt.name, func(t *testing.T) { t.Parallel() _, err := NewCache[string, string](tt.args.size) @@ -122,7 +121,6 @@ func TestCache_Get(t *testing.T) { }, } for _, tt := range tests { - tt := tt t.Run(tt.name, func(t *testing.T) { t.Parallel() c := tt.lruCache() @@ -162,7 +160,6 @@ func TestCache_RemoveEvictedItems(t *testing.T) { }, } for _, tt := range tests { - tt := tt t.Run(tt.name, func(t *testing.T) { t.Parallel() cache, err := tt.lruCache() @@ -212,7 +209,6 @@ func TestCache_PurgeItems(t *testing.T) { }, } for _, tt := range tests { - tt := tt t.Run(tt.name, func(t *testing.T) { t.Parallel() cache, err := tt.lruCache() diff --git a/exporter/awskinesisexporter/exporter_test.go b/exporter/awskinesisexporter/exporter_test.go index ffab5b0c58c3..4444ce111e42 100644 --- a/exporter/awskinesisexporter/exporter_test.go +++ b/exporter/awskinesisexporter/exporter_test.go @@ -57,7 +57,6 @@ func TestCreatingExporter(t *testing.T) { }, }, } { - tc := tc t.Run(tc.name, func(t *testing.T) { t.Parallel() diff --git a/exporter/awskinesisexporter/internal/producer/batcher_test.go b/exporter/awskinesisexporter/internal/producer/batcher_test.go index e2c1de74bb67..9fd08c869139 100644 --- a/exporter/awskinesisexporter/internal/producer/batcher_test.go +++ b/exporter/awskinesisexporter/internal/producer/batcher_test.go @@ -83,7 +83,6 @@ func TestBatchedExporter(t *testing.T) { } for _, tc := range cases { - tc := tc t.Run(tc.name, func(t *testing.T) { be, err := producer.NewBatcher( SetPutRecordsOperation(tc.PutRecordsOP), diff --git a/exporter/azuredataexplorerexporter/adx_exporter_test.go b/exporter/azuredataexplorerexporter/adx_exporter_test.go index 7bd1313347fb..85d3735c009f 100644 --- a/exporter/azuredataexplorerexporter/adx_exporter_test.go +++ b/exporter/azuredataexplorerexporter/adx_exporter_test.go @@ -228,8 +228,7 @@ func TestCreateKcsb(t *testing.T) { isAzureAuth: true, }, } - for i := range tests { - tt := tests[i] + for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { wantAppID := tt.applicationID gotKcsb := createKcsb(&tt.config, "1.0.0") diff --git a/exporter/fileexporter/buffered_writer_test.go b/exporter/fileexporter/buffered_writer_test.go index ef56914076be..d97832bb6eb1 100644 --- a/exporter/fileexporter/buffered_writer_test.go +++ b/exporter/fileexporter/buffered_writer_test.go @@ -72,7 +72,6 @@ func BenchmarkWriter(b *testing.B) { "raw-file": tempfile(b), "buffered-file": newBufferedWriteCloser(tempfile(b)), } { - w := w b.Run(fmt.Sprintf("%s_%d_bytes", name, payloadSize), func(b *testing.B) { b.ReportAllocs() b.ResetTimer() diff --git a/exporter/kafkaexporter/factory_test.go b/exporter/kafkaexporter/factory_test.go index 96fdfbd243e2..9b8433cc7461 100644 --- a/exporter/kafkaexporter/factory_test.go +++ b/exporter/kafkaexporter/factory_test.go @@ -73,7 +73,6 @@ func TestCreateMetricExporter(t *testing.T) { } for _, tc := range tests { - tc := tc t.Run(tc.name, func(t *testing.T) { t.Parallel() @@ -138,7 +137,6 @@ func TestCreateLogExporter(t *testing.T) { } for _, tc := range tests { - tc := tc t.Run(tc.name, func(t *testing.T) { t.Parallel() @@ -203,7 +201,6 @@ func TestCreateTraceExporter(t *testing.T) { } for _, tc := range tests { - tc := tc t.Run(tc.name, func(t *testing.T) { t.Parallel() diff --git a/exporter/loadbalancingexporter/metrics_exporter_test.go b/exporter/loadbalancingexporter/metrics_exporter_test.go index 1013dcda2a5e..669f873ec3a9 100644 --- a/exporter/loadbalancingexporter/metrics_exporter_test.go +++ b/exporter/loadbalancingexporter/metrics_exporter_test.go @@ -287,9 +287,6 @@ func TestSplitMetrics(t *testing.T) { } for _, tc := range testCases { - // Purposely make a copy since we're running in a goroutine due to t.Parallel() - tc := tc - t.Run(tc.name, func(t *testing.T) { t.Parallel() @@ -334,9 +331,6 @@ func TestConsumeMetrics_SingleEndpoint(t *testing.T) { } for _, tc := range testCases { - // Purposely make a copy since we're running in a goroutine due to t.Parallel() - tc := tc - t.Run(tc.name, func(t *testing.T) { t.Parallel() @@ -443,9 +437,6 @@ func TestConsumeMetrics_TripleEndpoint(t *testing.T) { } for _, tc := range testCases { - // Purposely make a copy since we're running in a goroutine due to t.Parallel() - tc := tc - t.Run(tc.name, func(t *testing.T) { t.Parallel() diff --git a/exporter/prometheusremotewriteexporter/exporter_test.go b/exporter/prometheusremotewriteexporter/exporter_test.go index 864e85323bdb..d35a06ea3840 100644 --- a/exporter/prometheusremotewriteexporter/exporter_test.go +++ b/exporter/prometheusremotewriteexporter/exporter_test.go @@ -684,8 +684,7 @@ func Test_PushMetrics(t *testing.T) { if useWAL { t.Skip("Flaky test, see https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/9124") } - for _, ttt := range tests { - tt := ttt + for _, tt := range tests { if useWAL && tt.skipForWAL { t.Skip("test not supported when using WAL") } diff --git a/exporter/sapmexporter/exporter_test.go b/exporter/sapmexporter/exporter_test.go index 10302879acc8..c922ec65a127 100644 --- a/exporter/sapmexporter/exporter_test.go +++ b/exporter/sapmexporter/exporter_test.go @@ -353,7 +353,6 @@ func TestCompression(t *testing.T) { }, } for _, tt := range tests { - tt := tt t.Run( tt.name, func(t *testing.T) { tracesReceived := false diff --git a/exporter/sentryexporter/sentry_exporter_test.go b/exporter/sentryexporter/sentry_exporter_test.go index 032426758d0d..c3278a8337b9 100644 --- a/exporter/sentryexporter/sentry_exporter_test.go +++ b/exporter/sentryexporter/sentry_exporter_test.go @@ -266,7 +266,6 @@ func TestSpanEventToSentryEvent(t *testing.T) { } for _, test := range testCases { - test := test t.Run(test.testName, func(t *testing.T) { sentryEvent, err := sentryEventFromError(test.errorMessage, test.errorType, test.sampleSentrySpan) if sentryEvent != nil { diff --git a/exporter/signalfxexporter/internal/apm/correlations/client_test.go b/exporter/signalfxexporter/internal/apm/correlations/client_test.go index 95d737f280f3..055f32d14e8c 100644 --- a/exporter/signalfxexporter/internal/apm/correlations/client_test.go +++ b/exporter/signalfxexporter/internal/apm/correlations/client_test.go @@ -191,8 +191,6 @@ func TestCorrelationClient(t *testing.T) { for _, correlationType := range []Type{Service, Environment} { for _, op := range []string{http.MethodPut, http.MethodDelete} { - op := op - correlationType := correlationType t.Run(fmt.Sprintf("%v %v", op, correlationType), func(t *testing.T) { testData := &Correlation{Type: correlationType, DimName: "host", DimValue: "test-box", Value: "test-service"} switch op { diff --git a/exporter/signalfxexporter/internal/apm/tracetracker/tracker.go b/exporter/signalfxexporter/internal/apm/tracetracker/tracker.go index dc8434ed2b7e..c486f9f8ce12 100644 --- a/exporter/signalfxexporter/internal/apm/tracetracker/tracker.go +++ b/exporter/signalfxexporter/internal/apm/tracetracker/tracker.go @@ -69,8 +69,6 @@ type ActiveServiceTracker struct { func (a *ActiveServiceTracker) LoadHostIDDimCorrelations() { // asynchronously fetch all services and environments for each hostIDDim at startup for dimName, dimValue := range a.hostIDDims { - dimName := dimName - dimValue := dimValue a.correlationClient.Get(dimName, dimValue, func(correlations map[string][]string) { if services, ok := correlations["sf_services"]; ok { for _, service := range services { @@ -179,8 +177,6 @@ func (a *ActiveServiceTracker) processEnvironment(res pcommon.Resource, now time // container / pod level stuff // this cache is necessary to identify environments associated with a kubernetes pod or container id for sourceAttr, dimName := range a.dimsToSyncSource { - sourceAttr := sourceAttr - dimName := dimName if val, ok := attrs.Get(sourceAttr); ok { // Note that the value is not set on the cache key. We only send the first environment received for a // given pod/container, and we never delete the values set on the container/pod dimension. @@ -239,8 +235,6 @@ func (a *ActiveServiceTracker) processService(res pcommon.Resource, now time.Tim // container / pod level stuff (this should not directly affect the active service count) // this cache is necessary to identify services associated with a kubernetes pod or container id for sourceAttr, dimName := range a.dimsToSyncSource { - sourceAttr := sourceAttr - dimName := dimName if val, ok := res.Attributes().Get(sourceAttr); ok { // Note that the value is not set on the cache key. We only send the first service received for a // given pod/container, and we never delete the values set on the container/pod dimension. diff --git a/exporter/sumologicexporter/config_test.go b/exporter/sumologicexporter/config_test.go index 03e74efcbf2b..aca10aedfb4d 100644 --- a/exporter/sumologicexporter/config_test.go +++ b/exporter/sumologicexporter/config_test.go @@ -67,7 +67,6 @@ func TestInitExporterInvalidConfiguration(t *testing.T) { } for _, tc := range testcases { - tc := tc t.Run(tc.name, func(t *testing.T) { err := component.ValidateConfig(tc.cfg) @@ -108,7 +107,6 @@ func TestConfigInvalidTimeout(t *testing.T) { } for _, tc := range testcases { - tc := tc t.Run(tc.name, func(t *testing.T) { err := tc.cfg.Validate() diff --git a/extension/ackextension/inmemory_test.go b/extension/ackextension/inmemory_test.go index 1b9dc1fe0ee5..da5bb59733d8 100644 --- a/extension/ackextension/inmemory_test.go +++ b/extension/ackextension/inmemory_test.go @@ -218,7 +218,6 @@ func TestExtensionAckAsync(t *testing.T) { wg.Add(partitionCount) // send events through different partitions for i := 0; i < partitionCount; i++ { - i := i go func() { // each partition has 3 events for j := 0; j < 3; j++ { @@ -242,7 +241,6 @@ func TestExtensionAckAsync(t *testing.T) { wg.Add(partitionCount) // ack the second event of all even partitions and first and third events of all odd partitions for i := 0; i < partitionCount; i++ { - i := i go func() { if i%2 == 0 { ext.Ack(fmt.Sprintf("part-%d", i), 2) @@ -275,7 +273,6 @@ func TestExtensionAckAsync(t *testing.T) { resultChan := make(chan map[uint64]bool, partitionCount) // querying the same acked events should result in false for i := 0; i < partitionCount; i++ { - i := i go func() { resultChan <- ext.QueryAcks(fmt.Sprintf("part-%d", i), []uint64{1, 2, 3}) wg.Done() diff --git a/extension/healthcheckv2extension/internal/grpc/grpc_test.go b/extension/healthcheckv2extension/internal/grpc/grpc_test.go index 6294d14d8963..033b4bde8fa0 100644 --- a/extension/healthcheckv2extension/internal/grpc/grpc_test.go +++ b/extension/healthcheckv2extension/internal/grpc/grpc_test.go @@ -1579,8 +1579,6 @@ func TestWatch(t *testing.T) { wg.Add(len(watchers)) for svc, watcher := range watchers { - svc := svc - watcher := watcher go func() { resp, err := watcher.Recv() // Ensure there are not any unread messages diff --git a/extension/jaegerremotesampling/internal/remote_strategy_cache_test.go b/extension/jaegerremotesampling/internal/remote_strategy_cache_test.go index 22f03b30a076..816c333e02c9 100644 --- a/extension/jaegerremotesampling/internal/remote_strategy_cache_test.go +++ b/extension/jaegerremotesampling/internal/remote_strategy_cache_test.go @@ -247,11 +247,10 @@ func Test_serviceStrategyCache_Concurrency(t *testing.T) { wg := sync.WaitGroup{} wg.Add(numThreads) for i := 0; i < numThreads; i++ { - ii := i go func() { for j := 0; j < numIterationsPerThread; j++ { for _, svcName := range []string{ - fmt.Sprintf("thread-specific-service-%d", ii), + fmt.Sprintf("thread-specific-service-%d", i), "contended-for-service", } { if _, ok := cache.get(context.Background(), svcName); !ok { diff --git a/extension/storage/filestorage/client_test.go b/extension/storage/filestorage/client_test.go index 09c97469f7ad..dc0657039d7a 100644 --- a/extension/storage/filestorage/client_test.go +++ b/extension/storage/filestorage/client_test.go @@ -393,7 +393,6 @@ func TestClientConcurrentCompaction(t *testing.T) { } for i := 0; i < 10; i++ { - i := i t.Run(fmt.Sprintf("client-operations-thread-%d", i), func(t *testing.T) { t.Parallel() clientOperationsThread(t, i) diff --git a/extension/sumologicextension/extension_test.go b/extension/sumologicextension/extension_test.go index 5ea1377a654f..7fb0177d0c30 100644 --- a/extension/sumologicextension/extension_test.go +++ b/extension/sumologicextension/extension_test.go @@ -988,8 +988,6 @@ func TestCollectorCheckingCredentialsFoundInLocalStorage(t *testing.T) { for _, tc := range testcases { t.Run(tc.name, func(t *testing.T) { - tc := tc - srv, reqCount := tc.srvFn() t.Cleanup(func() { srv.Close() }) diff --git a/internal/tools/go.mod b/internal/tools/go.mod index 1b345095a40d..2b7a7ab1a9d6 100644 --- a/internal/tools/go.mod +++ b/internal/tools/go.mod @@ -7,7 +7,7 @@ require ( github.com/Khan/genqlient v0.7.0 github.com/client9/misspell v0.3.4 github.com/daixiang0/gci v0.13.5 - github.com/golangci/golangci-lint v1.60.1 + github.com/golangci/golangci-lint v1.62.2 github.com/google/addlicense v1.1.1 github.com/jcchavezs/porto v0.6.0 github.com/jstemmer/go-junit-report v1.0.0 @@ -22,7 +22,7 @@ require ( golang.org/x/tools v0.28.0 golang.org/x/vuln v1.1.3 gotest.tools/gotestsum v1.12.0 - mvdan.cc/gofumpt v0.6.0 + mvdan.cc/gofumpt v0.7.0 ) require ( @@ -30,34 +30,34 @@ require ( 4d63.com/gochecknoglobals v0.2.1 // indirect dario.cat/mergo v1.0.0 // indirect github.com/4meepo/tagalign v1.3.4 // indirect - github.com/Abirdcfly/dupword v0.0.14 // indirect - github.com/Antonboom/errname v0.1.13 // indirect - github.com/Antonboom/nilnil v0.1.9 // indirect + github.com/Abirdcfly/dupword v0.1.3 // indirect + github.com/Antonboom/errname v1.0.0 // indirect + github.com/Antonboom/nilnil v1.0.0 // indirect github.com/BurntSushi/toml v1.4.1-0.20240526193622-a339e1f7089c // indirect - github.com/Crocmagnon/fatcontext v0.4.0 // indirect + github.com/Crocmagnon/fatcontext v0.5.3 // indirect github.com/Djarvur/go-err113 v0.0.0-20210108212216-aea10b59be24 // indirect github.com/GaijinEntertainment/go-exhaustruct/v3 v3.3.0 // indirect - github.com/Masterminds/semver/v3 v3.2.1 // indirect + github.com/Masterminds/semver/v3 v3.3.0 // indirect github.com/Microsoft/go-winio v0.6.1 // indirect github.com/OpenPeeDeeP/depguard/v2 v2.2.0 // indirect github.com/ProtonMail/go-crypto v1.0.0 // indirect github.com/agnivade/levenshtein v1.1.1 // indirect - github.com/alecthomas/go-check-sumtype v0.1.4 // indirect + github.com/alecthomas/go-check-sumtype v0.2.0 // indirect github.com/alexflint/go-arg v1.5.0 // indirect github.com/alexflint/go-scalar v1.2.0 // indirect - github.com/alexkohler/nakedret/v2 v2.0.4 // indirect + github.com/alexkohler/nakedret/v2 v2.0.5 // indirect github.com/alexkohler/prealloc v1.0.0 // indirect github.com/alingse/asasalint v0.0.11 // indirect github.com/ashanbrown/forbidigo v1.6.0 // indirect github.com/ashanbrown/makezero v1.1.1 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/bitfield/gotestdox v0.2.2 // indirect - github.com/bkielbasa/cyclop v1.2.1 // indirect + github.com/bkielbasa/cyclop v1.2.3 // indirect github.com/blizzy78/varnamelen v0.8.0 // indirect github.com/bmatcuk/doublestar/v4 v4.0.2 // indirect github.com/bombsimon/wsl/v4 v4.4.1 // indirect - github.com/breml/bidichk v0.2.7 // indirect - github.com/breml/errchkjson v0.3.6 // indirect + github.com/breml/bidichk v0.3.2 // indirect + github.com/breml/errchkjson v0.4.0 // indirect github.com/butuzov/ireturn v0.3.0 // indirect github.com/butuzov/mirror v1.2.0 // indirect github.com/catenacyber/perfsprint v0.7.1 // indirect @@ -65,7 +65,7 @@ require ( github.com/cespare/xxhash/v2 v2.3.0 // indirect github.com/charithe/durationcheck v0.0.10 // indirect github.com/chavacava/garif v0.1.0 // indirect - github.com/ckaznocha/intrange v0.1.2 // indirect + github.com/ckaznocha/intrange v0.2.1 // indirect github.com/cloudflare/circl v1.3.7 // indirect github.com/curioswitch/go-reassign v0.2.0 // indirect github.com/cyphar/filepath-securejoin v0.2.4 // indirect @@ -74,13 +74,13 @@ require ( github.com/dnephin/pflag v1.0.7 // indirect github.com/emirpasic/gods v1.18.1 // indirect github.com/ettle/strcase v0.2.0 // indirect - github.com/fatih/color v1.17.0 // indirect + github.com/fatih/color v1.18.0 // indirect github.com/fatih/structtag v1.2.0 // indirect github.com/firefart/nonamedreturns v1.0.5 // indirect github.com/fsnotify/fsnotify v1.7.0 // indirect github.com/fzipp/gocyclo v0.6.0 // indirect - github.com/ghostiam/protogetter v0.3.6 // indirect - github.com/go-critic/go-critic v0.11.4 // indirect + github.com/ghostiam/protogetter v0.3.8 // indirect + github.com/go-critic/go-critic v0.11.5 // indirect github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 // indirect github.com/go-git/go-billy/v5 v5.5.0 // indirect github.com/go-git/go-git/v5 v5.12.0 // indirect @@ -98,7 +98,8 @@ require ( github.com/gogo/protobuf v1.3.2 // indirect github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect github.com/golangci/dupl v0.0.0-20180902072040-3e9179ac440a // indirect - github.com/golangci/gofmt v0.0.0-20231018234816-f50ced29576e // indirect + github.com/golangci/go-printf-func-name v0.1.0 // indirect + github.com/golangci/gofmt v0.0.0-20240816233607-d8596aa466a9 // indirect github.com/golangci/misspell v0.6.0 // indirect github.com/golangci/modinfo v0.3.4 // indirect github.com/golangci/plugin-module-register v0.1.1 // indirect @@ -120,14 +121,13 @@ require ( github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect github.com/jgautheron/goconst v1.7.1 // indirect github.com/jingyugao/rowserrcheck v1.1.1 // indirect - github.com/jirfag/go-printf-func-name v0.0.0-20200119135958-7558a9eaa5af // indirect github.com/jjti/go-spancheck v0.6.2 // indirect github.com/joshdk/go-junit v1.0.0 // indirect github.com/json-iterator/go v1.1.12 // indirect github.com/julz/importas v0.1.0 // indirect github.com/karamaru-alpha/copyloopvar v1.1.0 // indirect github.com/kevinburke/ssh_config v1.2.0 // indirect - github.com/kisielk/errcheck v1.7.0 // indirect + github.com/kisielk/errcheck v1.8.0 // indirect github.com/kkHAIKE/contextcheck v1.1.5 // indirect github.com/knadh/koanf/maps v0.1.1 // indirect github.com/knadh/koanf/parsers/yaml v0.1.0 // indirect @@ -139,11 +139,10 @@ require ( github.com/kulti/thelper v0.6.3 // indirect github.com/kunwardeep/paralleltest v1.0.10 // indirect github.com/kyoh86/exportloopref v0.1.11 // indirect - github.com/lasiar/canonicalheader v1.1.1 // indirect + github.com/lasiar/canonicalheader v1.1.2 // indirect github.com/ldez/gomoddirectives v0.2.4 // indirect github.com/ldez/tagliatelle v0.5.0 // indirect github.com/leonklingele/grouper v1.1.2 // indirect - github.com/lufeee/execinquery v1.2.1 // indirect github.com/macabu/inamedparam v0.1.3 // indirect github.com/magiconair/properties v1.8.7 // indirect github.com/maratori/testableexamples v1.0.0 // indirect @@ -151,8 +150,8 @@ require ( github.com/matoous/godox v0.0.0-20230222163458-006bad1f9d26 // indirect github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-isatty v0.0.20 // indirect - github.com/mattn/go-runewidth v0.0.9 // indirect - github.com/mgechev/revive v1.3.9 // indirect + github.com/mattn/go-runewidth v0.0.16 // indirect + github.com/mgechev/revive v1.5.1 // indirect github.com/mitchellh/copystructure v1.2.0 // indirect github.com/mitchellh/go-homedir v1.1.0 // indirect github.com/mitchellh/mapstructure v1.5.1-0.20220423185008-bf980b35cac4 // indirect @@ -164,22 +163,25 @@ require ( github.com/nakabonne/nestif v0.3.1 // indirect github.com/nishanths/exhaustive v0.12.0 // indirect github.com/nishanths/predeclared v0.2.2 // indirect - github.com/nunnatsa/ginkgolinter v0.16.2 // indirect + github.com/nunnatsa/ginkgolinter v0.18.3 // indirect github.com/olekukonko/tablewriter v0.0.5 // indirect - github.com/pelletier/go-toml/v2 v2.2.2 // indirect + github.com/pelletier/go-toml/v2 v2.2.3 // indirect github.com/pjbgf/sha1cd v0.3.0 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect - github.com/polyfloyd/go-errorlint v1.6.0 // indirect + github.com/polyfloyd/go-errorlint v1.7.0 // indirect github.com/prometheus/client_golang v1.20.3 // indirect github.com/prometheus/client_model v0.6.1 // indirect github.com/prometheus/common v0.59.1 // indirect github.com/prometheus/procfs v0.15.1 // indirect - github.com/quasilyte/go-ruleguard v0.4.2 // indirect + github.com/quasilyte/go-ruleguard v0.4.3-0.20240823090925-0fe6f58b47b1 // indirect github.com/quasilyte/go-ruleguard/dsl v0.3.22 // indirect github.com/quasilyte/gogrep v0.5.0 // indirect github.com/quasilyte/regex/syntax v0.0.0-20210819130434-b3f0c404a727 // indirect github.com/quasilyte/stdinfo v0.0.0-20220114132959-f7386bf02567 // indirect - github.com/ryancurrah/gomodguard v1.3.3 // indirect + github.com/raeperd/recvcheck v0.1.2 // indirect + github.com/rivo/uniseg v0.4.7 // indirect + github.com/rogpeppe/go-internal v1.13.1 // indirect + github.com/ryancurrah/gomodguard v1.3.5 // indirect github.com/ryanrolds/sqlclosecheck v0.5.1 // indirect github.com/sagikazarmark/locafero v0.4.0 // indirect github.com/sagikazarmark/slog-shim v0.1.0 // indirect @@ -187,14 +189,14 @@ require ( github.com/santhosh-tekuri/jsonschema/v5 v5.3.1 // indirect github.com/sashamelentyev/interfacebloat v1.1.0 // indirect github.com/sashamelentyev/usestdlibvars v1.27.0 // indirect - github.com/securego/gosec/v2 v2.20.1-0.20240525090044-5f0084eb01a9 // indirect + github.com/securego/gosec/v2 v2.21.4 // indirect github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3 // indirect github.com/shazow/go-diff v0.0.0-20160112020656-b6b7b6733b8c // indirect github.com/sirupsen/logrus v1.9.3 // indirect github.com/sivchari/containedctx v1.0.3 // indirect - github.com/sivchari/tenv v1.10.0 // indirect + github.com/sivchari/tenv v1.12.1 // indirect github.com/skeema/knownhosts v1.2.2 // indirect - github.com/sonatard/noctx v0.0.2 // indirect + github.com/sonatard/noctx v0.1.0 // indirect github.com/sourcegraph/conc v0.3.0 // indirect github.com/sourcegraph/go-diff v0.7.0 // indirect github.com/spf13/afero v1.11.0 // indirect @@ -208,14 +210,15 @@ require ( github.com/stretchr/testify v1.10.0 // indirect github.com/subosito/gotenv v1.6.0 // indirect github.com/tdakkota/asciicheck v0.2.0 // indirect - github.com/tetafro/godot v1.4.16 // indirect + github.com/tetafro/godot v1.4.18 // indirect github.com/timakin/bodyclose v0.0.0-20230421092635-574207250966 // indirect - github.com/timonwong/loggercheck v0.9.4 // indirect - github.com/tomarrell/wrapcheck/v2 v2.8.3 // indirect + github.com/timonwong/loggercheck v0.10.1 // indirect + github.com/tomarrell/wrapcheck/v2 v2.9.0 // indirect github.com/tommy-muehle/go-mnd/v2 v2.5.1 // indirect github.com/ultraware/funlen v0.1.0 // indirect github.com/ultraware/whitespace v0.1.1 // indirect github.com/uudashr/gocognit v1.1.3 // indirect + github.com/uudashr/iface v1.2.1 // indirect github.com/vektah/gqlparser/v2 v2.5.16 // indirect github.com/xanzy/ssh-agent v0.3.3 // indirect github.com/xen0n/gosmopolitan v1.2.2 // indirect @@ -223,7 +226,7 @@ require ( github.com/yeya24/promlinter v0.3.0 // indirect github.com/ykadowak/zerologlint v0.1.5 // indirect gitlab.com/bosi/decorder v0.4.2 // indirect - go-simpler.org/musttag v0.12.2 // indirect + go-simpler.org/musttag v0.13.0 // indirect go-simpler.org/sloglint v0.7.2 // indirect go.opentelemetry.io/build-tools v0.15.0 // indirect go.opentelemetry.io/collector/component v0.116.0 // indirect @@ -235,12 +238,12 @@ require ( go.opentelemetry.io/otel v1.32.0 // indirect go.opentelemetry.io/otel/metric v1.32.0 // indirect go.opentelemetry.io/otel/trace v1.32.0 // indirect - go.uber.org/automaxprocs v1.5.3 // indirect + go.uber.org/automaxprocs v1.6.0 // indirect go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.27.0 // indirect golang.org/x/crypto v0.31.0 // indirect - golang.org/x/exp v0.0.0-20240103183307-be819d1f06fc // indirect - golang.org/x/exp/typeparams v0.0.0-20240314144324-c7f7c6466f7f // indirect + golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 // indirect + golang.org/x/exp/typeparams v0.0.0-20241108190413-2d47ceb2692f // indirect golang.org/x/mod v0.22.0 // indirect golang.org/x/net v0.32.0 // indirect golang.org/x/oauth2 v0.23.0 // indirect @@ -256,7 +259,7 @@ require ( gopkg.in/warnings.v0 v0.1.2 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect - honnef.co/go/tools v0.5.0 // indirect + honnef.co/go/tools v0.5.1 // indirect mvdan.cc/unparam v0.0.0-20240528143540-8a5130ca722f // indirect ) diff --git a/internal/tools/go.sum b/internal/tools/go.sum index ee91bb9f264b..99fb448250af 100644 --- a/internal/tools/go.sum +++ b/internal/tools/go.sum @@ -6,26 +6,26 @@ dario.cat/mergo v1.0.0 h1:AGCNq9Evsj31mOgNPcLyXc+4PNABt905YmuqPYYpBWk= dario.cat/mergo v1.0.0/go.mod h1:uNxQE+84aUszobStD9th8a29P2fMDhsBdgRYvZOxGmk= github.com/4meepo/tagalign v1.3.4 h1:P51VcvBnf04YkHzjfclN6BbsopfJR5rxs1n+5zHt+w8= github.com/4meepo/tagalign v1.3.4/go.mod h1:M+pnkHH2vG8+qhE5bVc/zeP7HS/j910Fwa9TUSyZVI0= -github.com/Abirdcfly/dupword v0.0.14 h1:3U4ulkc8EUo+CaT105/GJ1BQwtgyj6+VaBVbAX11Ba8= -github.com/Abirdcfly/dupword v0.0.14/go.mod h1:VKDAbxdY8YbKUByLGg8EETzYSuC4crm9WwI6Y3S0cLI= -github.com/Antonboom/errname v0.1.13 h1:JHICqsewj/fNckzrfVSe+T33svwQxmjC+1ntDsHOVvM= -github.com/Antonboom/errname v0.1.13/go.mod h1:uWyefRYRN54lBg6HseYCFhs6Qjcy41Y3Jl/dVhA87Ns= -github.com/Antonboom/nilnil v0.1.9 h1:eKFMejSxPSA9eLSensFmjW2XTgTwJMjZ8hUHtV4s/SQ= -github.com/Antonboom/nilnil v0.1.9/go.mod h1:iGe2rYwCq5/Me1khrysB4nwI7swQvjclR8/YRPl5ihQ= +github.com/Abirdcfly/dupword v0.1.3 h1:9Pa1NuAsZvpFPi9Pqkd93I7LIYRURj+A//dFd5tgBeE= +github.com/Abirdcfly/dupword v0.1.3/go.mod h1:8VbB2t7e10KRNdwTVoxdBaxla6avbhGzb8sCTygUMhw= +github.com/Antonboom/errname v1.0.0 h1:oJOOWR07vS1kRusl6YRSlat7HFnb3mSfMl6sDMRoTBA= +github.com/Antonboom/errname v1.0.0/go.mod h1:gMOBFzK/vrTiXN9Oh+HFs+e6Ndl0eTFbtsRTSRdXyGI= +github.com/Antonboom/nilnil v1.0.0 h1:n+v+B12dsE5tbAqRODXmEKfZv9j2KcTBrp+LkoM4HZk= +github.com/Antonboom/nilnil v1.0.0/go.mod h1:fDJ1FSFoLN6yoG65ANb1WihItf6qt9PJVTn/s2IrcII= github.com/Antonboom/testifylint v1.5.2 h1:4s3Xhuv5AvdIgbd8wOOEeo0uZG7PbDKQyKY5lGoQazk= github.com/Antonboom/testifylint v1.5.2/go.mod h1:vxy8VJ0bc6NavlYqjZfmp6EfqXMtBgQ4+mhCojwC1P8= github.com/BurntSushi/toml v1.4.1-0.20240526193622-a339e1f7089c h1:pxW6RcqyfI9/kWtOwnv/G+AzdKuy2ZrqINhenH4HyNs= github.com/BurntSushi/toml v1.4.1-0.20240526193622-a339e1f7089c/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2lLoLwho= -github.com/Crocmagnon/fatcontext v0.4.0 h1:4ykozu23YHA0JB6+thiuEv7iT6xq995qS1vcuWZq0tg= -github.com/Crocmagnon/fatcontext v0.4.0/go.mod h1:ZtWrXkgyfsYPzS6K3O88va6t2GEglG93vnII/F94WC0= +github.com/Crocmagnon/fatcontext v0.5.3 h1:zCh/wjc9oyeF+Gmp+V60wetm8ph2tlsxocgg/J0hOps= +github.com/Crocmagnon/fatcontext v0.5.3/go.mod h1:XoCQYY1J+XTfyv74qLXvNw4xFunr3L1wkopIIKG7wGM= github.com/Djarvur/go-err113 v0.0.0-20210108212216-aea10b59be24 h1:sHglBQTwgx+rWPdisA5ynNEsoARbiCBOyGcJM4/OzsM= github.com/Djarvur/go-err113 v0.0.0-20210108212216-aea10b59be24/go.mod h1:4UJr5HIiMZrwgkSPdsjy2uOQExX/WEILpIrO9UPGuXs= github.com/GaijinEntertainment/go-exhaustruct/v3 v3.3.0 h1:/fTUt5vmbkAcMBt4YQiuC23cV0kEsN1MVMNqeOW43cU= github.com/GaijinEntertainment/go-exhaustruct/v3 v3.3.0/go.mod h1:ONJg5sxcbsdQQ4pOW8TGdTidT2TMAUy/2Xhr8mrYaao= github.com/Khan/genqlient v0.7.0 h1:GZ1meyRnzcDTK48EjqB8t3bcfYvHArCUUvgOwpz1D4w= github.com/Khan/genqlient v0.7.0/go.mod h1:HNyy3wZvuYwmW3Y7mkoQLZsa/R5n5yIRajS1kPBvSFM= -github.com/Masterminds/semver/v3 v3.2.1 h1:RN9w6+7QoMeJVGyfmbcgs28Br8cvmnucEXnY0rYXWg0= -github.com/Masterminds/semver/v3 v3.2.1/go.mod h1:qvl/7zhW3nngYb5+80sSMF+FG2BjYrf8m9wsX0PNOMQ= +github.com/Masterminds/semver/v3 v3.3.0 h1:B8LGeaivUe71a5qox1ICM/JLl0NqZSW5CHyL+hmvYS0= +github.com/Masterminds/semver/v3 v3.3.0/go.mod h1:4V+yj/TJE1HU9XfppCwVMZq3I84lprf4nC11bSS5beM= github.com/Microsoft/go-winio v0.5.2/go.mod h1:WpS1mjBmmwHBEWmogvA2mj8546UReBk4v8QkMxJ6pZY= github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migciow= github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= @@ -37,16 +37,16 @@ github.com/agnivade/levenshtein v1.1.1 h1:QY8M92nrzkmr798gCo3kmMyqXFzdQVpxLlGPRB github.com/agnivade/levenshtein v1.1.1/go.mod h1:veldBMzWxcCG2ZvUTKD2kJNRdCk5hVbJomOvKkmgYbo= github.com/alecthomas/assert/v2 v2.2.2 h1:Z/iVC0xZfWTaFNE6bA3z07T86hd45Xe2eLt6WVy2bbk= github.com/alecthomas/assert/v2 v2.2.2/go.mod h1:pXcQ2Asjp247dahGEmsZ6ru0UVwnkhktn7S0bBDLxvQ= -github.com/alecthomas/go-check-sumtype v0.1.4 h1:WCvlB3l5Vq5dZQTFmodqL2g68uHiSwwlWcT5a2FGK0c= -github.com/alecthomas/go-check-sumtype v0.1.4/go.mod h1:WyYPfhfkdhyrdaligV6svFopZV8Lqdzn5pyVBaV6jhQ= +github.com/alecthomas/go-check-sumtype v0.2.0 h1:Bo+e4DFf3rs7ME9w/0SU/g6nmzJaphduP8Cjiz0gbwY= +github.com/alecthomas/go-check-sumtype v0.2.0/go.mod h1:WyYPfhfkdhyrdaligV6svFopZV8Lqdzn5pyVBaV6jhQ= github.com/alecthomas/repr v0.2.0 h1:HAzS41CIzNW5syS8Mf9UwXhNH1J9aix/BvDRf1Ml2Yk= github.com/alecthomas/repr v0.2.0/go.mod h1:Fr0507jx4eOXV7AlPV6AVZLYrLIuIeSOWtW57eE/O/4= github.com/alexflint/go-arg v1.5.0 h1:rwMKGiaQuRbXfZNyRUvIfke63QvOBt1/QTshlGQHohM= github.com/alexflint/go-arg v1.5.0/go.mod h1:A7vTJzvjoaSTypg4biM5uYNTkJ27SkNTArtYXnlqVO8= github.com/alexflint/go-scalar v1.2.0 h1:WR7JPKkeNpnYIOfHRa7ivM21aWAdHD0gEWHCx+WQBRw= github.com/alexflint/go-scalar v1.2.0/go.mod h1:LoFvNMqS1CPrMVltza4LvnGKhaSpc3oyLEBUZVhhS2o= -github.com/alexkohler/nakedret/v2 v2.0.4 h1:yZuKmjqGi0pSmjGpOC016LtPJysIL0WEUiaXW5SUnNg= -github.com/alexkohler/nakedret/v2 v2.0.4/go.mod h1:bF5i0zF2Wo2o4X4USt9ntUWve6JbFv02Ff4vlkmS/VU= +github.com/alexkohler/nakedret/v2 v2.0.5 h1:fP5qLgtwbx9EJE8dGEERT02YwS8En4r9nnZ71RK+EVU= +github.com/alexkohler/nakedret/v2 v2.0.5/go.mod h1:bF5i0zF2Wo2o4X4USt9ntUWve6JbFv02Ff4vlkmS/VU= github.com/alexkohler/prealloc v1.0.0 h1:Hbq0/3fJPQhNkN0dR95AVrr6R7tou91y0uHG5pOcUuw= github.com/alexkohler/prealloc v1.0.0/go.mod h1:VetnK3dIgFBBKmg0YnD9F9x6Icjd+9cvfHR56wJVlKE= github.com/alingse/asasalint v0.0.11 h1:SFwnQXJ49Kx/1GghOFz1XGqHYKp21Kq1nHad/0WQRnw= @@ -67,8 +67,8 @@ github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= github.com/bitfield/gotestdox v0.2.2 h1:x6RcPAbBbErKLnapz1QeAlf3ospg8efBsedU93CDsnE= github.com/bitfield/gotestdox v0.2.2/go.mod h1:D+gwtS0urjBrzguAkTM2wodsTQYFHdpx8eqRJ3N+9pY= -github.com/bkielbasa/cyclop v1.2.1 h1:AeF71HZDob1P2/pRm1so9cd1alZnrpyc4q2uP2l0gJY= -github.com/bkielbasa/cyclop v1.2.1/go.mod h1:K/dT/M0FPAiYjBgQGau7tz+3TMh4FWAEqlMhzFWCrgM= +github.com/bkielbasa/cyclop v1.2.3 h1:faIVMIGDIANuGPWH031CZJTi2ymOQBULs9H21HSMa5w= +github.com/bkielbasa/cyclop v1.2.3/go.mod h1:kHTwA9Q0uZqOADdupvcFJQtp/ksSnytRMe8ztxG8Fuo= github.com/blizzy78/varnamelen v0.8.0 h1:oqSblyuQvFsW1hbBHh1zfwrKe3kcSj0rnXkKzsQ089M= github.com/blizzy78/varnamelen v0.8.0/go.mod h1:V9TzQZ4fLJ1DSrjVDfl89H7aMnTvKkApdHeyESmyR7k= github.com/bmatcuk/doublestar/v4 v4.0.2 h1:X0krlUVAVmtr2cRoTqR8aDMrDqnB36ht8wpWTiQ3jsA= @@ -77,10 +77,10 @@ github.com/bombsimon/wsl/v4 v4.4.1 h1:jfUaCkN+aUpobrMO24zwyAMwMAV5eSziCkOKEauOLd github.com/bombsimon/wsl/v4 v4.4.1/go.mod h1:Xu/kDxGZTofQcDGCtQe9KCzhHphIe0fDuyWTxER9Feo= github.com/bradleyjkemp/cupaloy/v2 v2.6.0 h1:knToPYa2xtfg42U3I6punFEjaGFKWQRXJwj0JTv4mTs= github.com/bradleyjkemp/cupaloy/v2 v2.6.0/go.mod h1:bm7JXdkRd4BHJk9HpwqAI8BoAY1lps46Enkdqw6aRX0= -github.com/breml/bidichk v0.2.7 h1:dAkKQPLl/Qrk7hnP6P+E0xOodrq8Us7+U0o4UBOAlQY= -github.com/breml/bidichk v0.2.7/go.mod h1:YodjipAGI9fGcYM7II6wFvGhdMYsC5pHDlGzqvEW3tQ= -github.com/breml/errchkjson v0.3.6 h1:VLhVkqSBH96AvXEyclMR37rZslRrY2kcyq+31HCsVrA= -github.com/breml/errchkjson v0.3.6/go.mod h1:jhSDoFheAF2RSDOlCfhHO9KqhZgAYLyvHe7bRCX8f/U= +github.com/breml/bidichk v0.3.2 h1:xV4flJ9V5xWTqxL+/PMFF6dtJPvZLPsyixAoPe8BGJs= +github.com/breml/bidichk v0.3.2/go.mod h1:VzFLBxuYtT23z5+iVkamXO386OB+/sVwZOpIj6zXGos= +github.com/breml/errchkjson v0.4.0 h1:gftf6uWZMtIa/Is3XJgibewBm2ksAQSY/kABDNFTAdk= +github.com/breml/errchkjson v0.4.0/go.mod h1:AuBOSTHyLSaaAFlWsRSuRBIroCh3eh7ZHh5YeelDIk8= github.com/butuzov/ireturn v0.3.0 h1:hTjMqWw3y5JC3kpnC5vXmFJAWI/m31jaCYQqzkS6PL0= github.com/butuzov/ireturn v0.3.0/go.mod h1:A09nIiwiqzN/IoVo9ogpa0Hzi9fex1kd9PSD6edP5ZA= github.com/butuzov/mirror v1.2.0 h1:9YVK1qIjNspaqWutSv8gsge2e/Xpq1eqEkslEUHy5cs= @@ -96,8 +96,8 @@ github.com/charithe/durationcheck v0.0.10 h1:wgw73BiocdBDQPik+zcEoBG/ob8uyBHf2iy github.com/charithe/durationcheck v0.0.10/go.mod h1:bCWXb7gYRysD1CU3C+u4ceO49LoGOY1C1L6uouGNreQ= github.com/chavacava/garif v0.1.0 h1:2JHa3hbYf5D9dsgseMKAmc/MZ109otzgNFk5s87H9Pc= github.com/chavacava/garif v0.1.0/go.mod h1:XMyYCkEL58DF0oyW4qDjjnPWONs2HBqYKI+UIPD+Gww= -github.com/ckaznocha/intrange v0.1.2 h1:3Y4JAxcMntgb/wABQ6e8Q8leMd26JbX2790lIss9MTI= -github.com/ckaznocha/intrange v0.1.2/go.mod h1:RWffCw/vKBwHeOEwWdCikAtY0q4gGt8VhJZEEA5n+RE= +github.com/ckaznocha/intrange v0.2.1 h1:M07spnNEQoALOJhwrImSrJLaxwuiQK+hA2DeajBlwYk= +github.com/ckaznocha/intrange v0.2.1/go.mod h1:7NEhVyf8fzZO5Ds7CRaqPEm52Ut83hsTiL5zbER/HYk= github.com/client9/misspell v0.3.4 h1:ta993UF76GwbvJcIo3Y68y/M3WxlpEHPWIGDkJYwzJI= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/cloudflare/circl v1.3.3/go.mod h1:5XYMA4rFBvNIrhs50XuiBJ15vF2pZn4nnUKZrLbUZFA= @@ -128,8 +128,8 @@ github.com/ettle/strcase v0.2.0 h1:fGNiVF21fHXpX1niBgk0aROov1LagYsOwV/xqKDKR/Q= github.com/ettle/strcase v0.2.0/go.mod h1:DajmHElDSaX76ITe3/VHVyMin4LWSJN5Z909Wp+ED1A= github.com/fatih/color v1.15.0/go.mod h1:0h5ZqXfHYED7Bhv2ZJamyIOUej9KtShiJESRwBDUSsw= github.com/fatih/color v1.16.0/go.mod h1:fL2Sau1YI5c0pdGEVCbKQbLXB6edEj1ZgiY4NijnWvE= -github.com/fatih/color v1.17.0 h1:GlRw1BRJxkpqUCBKzKOw098ed57fEsKeNjpTe3cSjK4= -github.com/fatih/color v1.17.0/go.mod h1:YZ7TlrGPkiz6ku9fK3TLD/pl3CpsiFyu8N92HLgmosI= +github.com/fatih/color v1.18.0 h1:S8gINlzdQ840/4pfAwic/ZE0djQEH3wM94VfqLTZcOM= +github.com/fatih/color v1.18.0/go.mod h1:4FelSpRwEGDpQ12mAdzqdOukCy4u8WUtOY6lkT/6HfU= github.com/fatih/structtag v1.2.0 h1:/OdNE99OxoI/PqaW/SuSK9uxxT3f/tcSZgon/ssNSx4= github.com/fatih/structtag v1.2.0/go.mod h1:mBJUNpUnHmRKrKlQQlmCrh5PuhftFbNv8Ys4/aAZl94= github.com/firefart/nonamedreturns v1.0.5 h1:tM+Me2ZaXs8tfdDw3X6DOX++wMCOqzYUho6tUTYIdRA= @@ -140,12 +140,12 @@ github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nos github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM= github.com/fzipp/gocyclo v0.6.0 h1:lsblElZG7d3ALtGMx9fmxeTKZaLLpU8mET09yN4BBLo= github.com/fzipp/gocyclo v0.6.0/go.mod h1:rXPyn8fnlpa0R2csP/31uerbiVBugk5whMdlyaLkLoA= -github.com/ghostiam/protogetter v0.3.6 h1:R7qEWaSgFCsy20yYHNIJsU9ZOb8TziSRRxuAOTVKeOk= -github.com/ghostiam/protogetter v0.3.6/go.mod h1:7lpeDnEJ1ZjL/YtyoN99ljO4z0pd3H0d18/t2dPBxHw= +github.com/ghostiam/protogetter v0.3.8 h1:LYcXbYvybUyTIxN2Mj9h6rHrDZBDwZloPoKctWrFyJY= +github.com/ghostiam/protogetter v0.3.8/go.mod h1:WZ0nw9pfzsgxuRsPOFQomgDVSWtDLJRfQJEhsGbmQMA= github.com/gliderlabs/ssh v0.3.7 h1:iV3Bqi942d9huXnzEF2Mt+CY9gLu8DNM4Obd+8bODRE= github.com/gliderlabs/ssh v0.3.7/go.mod h1:zpHEXBstFnQYtGnB8k8kQLol82umzn/2/snG7alWVD8= -github.com/go-critic/go-critic v0.11.4 h1:O7kGOCx0NDIni4czrkRIXTnit0mkyKOCePh3My6OyEU= -github.com/go-critic/go-critic v0.11.4/go.mod h1:2QAdo4iuLik5S9YG0rT4wcZ8QxwHYkrr6/2MWAiv/vc= +github.com/go-critic/go-critic v0.11.5 h1:TkDTOn5v7EEngMxu8KbuFqFR43USaaH8XRJLz1jhVYA= +github.com/go-critic/go-critic v0.11.5/go.mod h1:wu6U7ny9PiaHaZHcvMDmdysMqvDem162Rh3zWTrqk8M= github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 h1:+zs/tPmkDkHx3U66DAb0lQFJrpS6731Oaa12ikc+DiI= github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376/go.mod h1:an3vInlBmSxCcxctByoQdvwPiA7DTK7jaaFDBTtu0ic= github.com/go-git/go-billy/v5 v5.5.0 h1:yEY4yhzCDuMGSv83oGxiBotRzhwhNr8VZyphhiu+mTU= @@ -158,6 +158,8 @@ 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-quicktest/qt v1.101.0 h1:O1K29Txy5P2OK0dGo59b7b0LR6wKfIhttaAhHUyn7eI= +github.com/go-quicktest/qt v1.101.0/go.mod h1:14Bz/f7NwaXPtdYEgzsx46kqSxVwTbzVZsDC26tQJow= github.com/go-task/slim-sprig/v3 v3.0.0 h1:sUs3vkvUymDpBKi3qH1YSqBQk9+9D/8M2mN1vB6EwHI= github.com/go-task/slim-sprig/v3 v3.0.0/go.mod h1:W848ghGpv3Qj3dhTPRyJypKRiqCdHZiAzKg9hl15HA8= github.com/go-toolsmith/astcast v1.1.0 h1:+JN9xZV1A+Re+95pgnMgDboWNVnIMMQXwfBwLRPgSC8= @@ -195,10 +197,12 @@ github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= github.com/golangci/dupl v0.0.0-20180902072040-3e9179ac440a h1:w8hkcTqaFpzKqonE9uMCefW1WDie15eSP/4MssdenaM= github.com/golangci/dupl v0.0.0-20180902072040-3e9179ac440a/go.mod h1:ryS0uhF+x9jgbj/N71xsEqODy9BN81/GonCZiOzirOk= -github.com/golangci/gofmt v0.0.0-20231018234816-f50ced29576e h1:ULcKCDV1LOZPFxGZaA6TlQbiM3J2GCPnkx/bGF6sX/g= -github.com/golangci/gofmt v0.0.0-20231018234816-f50ced29576e/go.mod h1:Pm5KhLPA8gSnQwrQ6ukebRcapGb/BG9iUkdaiCcGHJM= -github.com/golangci/golangci-lint v1.60.1 h1:DRKNqNTQRLBJZ1il5u4fvgLQCjQc7QFs0DbhksJtVJE= -github.com/golangci/golangci-lint v1.60.1/go.mod h1:jDIPN1rYaIA+ijp9OZcUmUCoQOtZ76pOlFbi15FlLJY= +github.com/golangci/go-printf-func-name v0.1.0 h1:dVokQP+NMTO7jwO4bwsRwLWeudOVUPPyAKJuzv8pEJU= +github.com/golangci/go-printf-func-name v0.1.0/go.mod h1:wqhWFH5mUdJQhweRnldEywnR5021wTdZSNgwYceV14s= +github.com/golangci/gofmt v0.0.0-20240816233607-d8596aa466a9 h1:/1322Qns6BtQxUZDTAT4SdcoxknUki7IAoK4SAXr8ME= +github.com/golangci/gofmt v0.0.0-20240816233607-d8596aa466a9/go.mod h1:Oesb/0uFAyWoaw1U1qS5zyjCg5NP9C9iwjnI4tIsXEE= +github.com/golangci/golangci-lint v1.62.2 h1:b8K5K9PN+rZN1+mKLtsZHz2XXS9aYKzQ9i25x3Qnxxw= +github.com/golangci/golangci-lint v1.62.2/go.mod h1:ILWWyeFUrctpHVGMa1dg2xZPKoMUTc5OIMgW7HZr34g= github.com/golangci/misspell v0.6.0 h1:JCle2HUTNWirNlDIAUO44hUsKhOFqGPoC4LZxlaSXDs= github.com/golangci/misspell v0.6.0/go.mod h1:keMNyY6R9isGaSAu+4Q8NMBwMPkh15Gtc8UCVoDtAWo= github.com/golangci/modinfo v0.3.4 h1:oU5huX3fbxqQXdfspamej74DFX0kyGLkw1ppvXoJ8GA= @@ -226,8 +230,8 @@ github.com/google/go-github v17.0.0+incompatible/go.mod h1:zLgOLi98H3fifZn+44m+u github.com/google/go-querystring v1.0.0 h1:Xkwi/a1rcvNg1PPYe5vI8GbeBY/jrVuDX5ASuANWTrk= github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= -github.com/google/pprof v0.0.0-20240424215950-a892ee059fd6 h1:k7nVchz72niMH6YLQNvHSdIE7iqsQxK1P41mySCvssg= -github.com/google/pprof v0.0.0-20240424215950-a892ee059fd6/go.mod h1:kf6iHlnVGwgKolg33glAes7Yg/8iWP8ukqeldJSO7jw= +github.com/google/pprof v0.0.0-20240827171923-fa2c70bbbfe5 h1:5iH8iuqE5apketRbSFBy+X1V0o+l+8NF1avt4HWl7cA= +github.com/google/pprof v0.0.0-20240827171923-fa2c70bbbfe5/go.mod h1:vavhavw2zAxS5dIdcRluK6cSGGPlZynqzFM8NdvU144= github.com/google/renameio v0.1.0 h1:GOZbcHa3HfsPKPlmyPyN2KEohoMXOhdMbHrvbpl2QaA= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 h1:El6M4kTTCOh6aBiKaUGG7oYTSPP8MxqL4YI3kZKwcP4= @@ -265,8 +269,6 @@ github.com/jgautheron/goconst v1.7.1 h1:VpdAG7Ca7yvvJk5n8dMwQhfEZJh95kl/Hl9S1OI5 github.com/jgautheron/goconst v1.7.1/go.mod h1:aAosetZ5zaeC/2EfMeRswtxUFBpe2Hr7HzkgX4fanO4= github.com/jingyugao/rowserrcheck v1.1.1 h1:zibz55j/MJtLsjP1OF4bSdgXxwL1b+Vn7Tjzq7gFzUs= github.com/jingyugao/rowserrcheck v1.1.1/go.mod h1:4yvlZSDb3IyDTUZJUmpZfm2Hwok+Dtp+nu2qOq+er9c= -github.com/jirfag/go-printf-func-name v0.0.0-20200119135958-7558a9eaa5af h1:KA9BjwUk7KlCh6S9EAGWBt1oExIUv9WyNCiRz5amv48= -github.com/jirfag/go-printf-func-name v0.0.0-20200119135958-7558a9eaa5af/go.mod h1:HEWGJkRDzjJY2sqdDwxccsGicWEf9BQOZsq2tV+xzM0= github.com/jjti/go-spancheck v0.6.2 h1:iYtoxqPMzHUPp7St+5yA8+cONdyXD3ug6KK15n7Pklk= github.com/jjti/go-spancheck v0.6.2/go.mod h1:+X7lvIrR5ZdUTkxFYqzJ0abr8Sb5LOo80uOhWNqIrYA= github.com/joshdk/go-junit v1.0.0 h1:S86cUKIdwBHWwA6xCmFlf3RTLfVXYQfvanM5Uh+K6GE= @@ -282,8 +284,8 @@ github.com/karamaru-alpha/copyloopvar v1.1.0/go.mod h1:u7CIfztblY0jZLOQZgH3oYsJz github.com/kevinburke/ssh_config v1.2.0 h1:x584FjTGwHzMwvHx18PXxbBVzfnxogHaAReU4gf13a4= github.com/kevinburke/ssh_config v1.2.0/go.mod h1:CT57kijsi8u/K/BOFA39wgDQJ9CxiF4nAY/ojJ6r6mM= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= -github.com/kisielk/errcheck v1.7.0 h1:+SbscKmWJ5mOK/bO1zS60F5I9WwZDWOfRsC4RwfwRV0= -github.com/kisielk/errcheck v1.7.0/go.mod h1:1kLL+jV4e+CFfueBmI1dSK2ADDyQnlrnrY/FqKluHJQ= +github.com/kisielk/errcheck v1.8.0 h1:ZX/URYa7ilESY19ik/vBmCn6zdGQLxACwjAcWbHlYlg= +github.com/kisielk/errcheck v1.8.0/go.mod h1:1kLL+jV4e+CFfueBmI1dSK2ADDyQnlrnrY/FqKluHJQ= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/kkHAIKE/contextcheck v1.1.5 h1:CdnJh63tcDe53vG+RebdpdXJTc9atMgGqdx8LXxiilg= github.com/kkHAIKE/contextcheck v1.1.5/go.mod h1:O930cpht4xb1YQpK+1+AgoM3mFsvxr7uyFptcnWTYUA= @@ -316,16 +318,14 @@ github.com/kunwardeep/paralleltest v1.0.10 h1:wrodoaKYzS2mdNVnc4/w31YaXFtsc21PCT github.com/kunwardeep/paralleltest v1.0.10/go.mod h1:2C7s65hONVqY7Q5Efj5aLzRCNLjw2h4eMc9EcypGjcY= github.com/kyoh86/exportloopref v0.1.11 h1:1Z0bcmTypkL3Q4k+IDHMWTcnCliEZcaPiIe0/ymEyhQ= github.com/kyoh86/exportloopref v0.1.11/go.mod h1:qkV4UF1zGl6EkF1ox8L5t9SwyeBAZ3qLMd6up458uqA= -github.com/lasiar/canonicalheader v1.1.1 h1:wC+dY9ZfiqiPwAexUApFush/csSPXeIi4QqyxXmng8I= -github.com/lasiar/canonicalheader v1.1.1/go.mod h1:cXkb3Dlk6XXy+8MVQnF23CYKWlyA7kfQhSw2CcZtZb0= +github.com/lasiar/canonicalheader v1.1.2 h1:vZ5uqwvDbyJCnMhmFYimgMZnJMjwljN5VGY0VKbMXb4= +github.com/lasiar/canonicalheader v1.1.2/go.mod h1:qJCeLFS0G/QlLQ506T+Fk/fWMa2VmBUiEI2cuMK4djI= github.com/ldez/gomoddirectives v0.2.4 h1:j3YjBIjEBbqZ0NKtBNzr8rtMHTOrLPeiwTkfUJZ3alg= github.com/ldez/gomoddirectives v0.2.4/go.mod h1:oWu9i62VcQDYp9EQ0ONTfqLNh+mDLWWDO+SO0qSQw5g= github.com/ldez/tagliatelle v0.5.0 h1:epgfuYt9v0CG3fms0pEgIMNPuFf/LpPIfjk4kyqSioo= github.com/ldez/tagliatelle v0.5.0/go.mod h1:rj1HmWiL1MiKQuOONhd09iySTEkUuE/8+5jtPYz9xa4= github.com/leonklingele/grouper v1.1.2 h1:o1ARBDLOmmasUaNDesWqWCIFH3u7hoFlM84YrjT3mIY= github.com/leonklingele/grouper v1.1.2/go.mod h1:6D0M/HVkhs2yRKRFZUoGjeDy7EZTfFBE9gl4kjmIGkA= -github.com/lufeee/execinquery v1.2.1 h1:hf0Ems4SHcUGBxpGN7Jz78z1ppVkP/837ZlETPCEtOM= -github.com/lufeee/execinquery v1.2.1/go.mod h1:EC7DrEKView09ocscGHC+apXMIaorh4xqSxS/dy8SbM= github.com/macabu/inamedparam v0.1.3 h1:2tk/phHkMlEL/1GNe/Yf6kkR/hkcUdAEY3L0hjYV1Mk= github.com/macabu/inamedparam v0.1.3/go.mod h1:93FLICAIk/quk7eaPPQvbzihUdn/QkGDwIZEoLtpH6I= github.com/magiconair/properties v1.8.7 h1:IeQXZAiQcpL9mgcAe1Nu6cX9LLw6ExEHKjN0VQdvPDY= @@ -345,10 +345,11 @@ github.com/mattn/go-isatty v0.0.17/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/ github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= -github.com/mattn/go-runewidth v0.0.9 h1:Lm995f3rfxdpd6TSmuVCHVb/QhupuXlYr8sCI/QdE+0= github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= -github.com/mgechev/revive v1.3.9 h1:18Y3R4a2USSBF+QZKFQwVkBROUda7uoBlkEuBD+YD1A= -github.com/mgechev/revive v1.3.9/go.mod h1:+uxEIr5UH0TjXWHTno3xh4u7eg6jDpXKzQccA9UGhHU= +github.com/mattn/go-runewidth v0.0.16 h1:E5ScNMtiwvlvB5paMFdw9p4kSQzbXFikJ5SQO6TULQc= +github.com/mattn/go-runewidth v0.0.16/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= +github.com/mgechev/revive v1.5.1 h1:hE+QPeq0/wIzJwOphdVyUJ82njdd8Khp4fUIHGZHW3M= +github.com/mgechev/revive v1.5.1/go.mod h1:lC9AhkJIBs5zwx8wkudyHrU+IJkrEKmpCmGMnIJPk4o= 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/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y= @@ -372,14 +373,14 @@ github.com/nishanths/exhaustive v0.12.0 h1:vIY9sALmw6T/yxiASewa4TQcFsVYZQQRUQJhK github.com/nishanths/exhaustive v0.12.0/go.mod h1:mEZ95wPIZW+x8kC4TgC+9YCUgiST7ecevsVDTgc2obs= github.com/nishanths/predeclared v0.2.2 h1:V2EPdZPliZymNAn79T8RkNApBjMmVKh5XRpLm/w98Vk= github.com/nishanths/predeclared v0.2.2/go.mod h1:RROzoN6TnGQupbC+lqggsOlcgysk3LMK/HI84Mp280c= -github.com/nunnatsa/ginkgolinter v0.16.2 h1:8iLqHIZvN4fTLDC0Ke9tbSZVcyVHoBs0HIbnVSxfHJk= -github.com/nunnatsa/ginkgolinter v0.16.2/go.mod h1:4tWRinDN1FeJgU+iJANW/kz7xKN5nYRAOfJDQUS9dOQ= +github.com/nunnatsa/ginkgolinter v0.18.3 h1:WgS7X3zzmni3vwHSBhvSgqrRgUecN6PQUcfB0j1noDw= +github.com/nunnatsa/ginkgolinter v0.18.3/go.mod h1:BE1xyB/PNtXXG1azrvrqJW5eFH0hSRylNzFy8QHPwzs= github.com/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N7AbDhec= github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6HuIJcUGPhkA7kY= -github.com/onsi/ginkgo/v2 v2.17.3 h1:oJcvKpIb7/8uLpDDtnQuf18xVnwKp8DTD7DQ6gTd/MU= -github.com/onsi/ginkgo/v2 v2.17.3/go.mod h1:nP2DPOQoNsQmsVyv5rDA8JkXQoCs6goXIvr/PRJ1eCc= -github.com/onsi/gomega v1.33.1 h1:dsYjIxxSR755MDmKVsaFQTE22ChNBcuuTWgkUDSubOk= -github.com/onsi/gomega v1.33.1/go.mod h1:U4R44UsT+9eLIaYRB2a5qajjtQYn0hauxvRm16AVYg0= +github.com/onsi/ginkgo/v2 v2.20.2 h1:7NVCeyIWROIAheY21RLS+3j2bb52W0W82tkberYytp4= +github.com/onsi/ginkgo/v2 v2.20.2/go.mod h1:K9gyxPIlb+aIvnZ8bd9Ak+YP18w3APlR+5coaZoE2ag= +github.com/onsi/gomega v1.34.2 h1:pNCwDkzrsv7MS9kpaQvVb1aVLahQXyJ/Tv5oAZMI3i8= +github.com/onsi/gomega v1.34.2/go.mod h1:v1xfxRgk0KIsG+QOdm7p8UosrOzPYRo60fd3B/1Dukc= github.com/otiai10/copy v1.2.0/go.mod h1:rrF5dJ5F0t/EWSYODDu4j9/vEeYHMkc8jt0zJChqQWw= github.com/otiai10/copy v1.14.0 h1:dCI/t1iTdYGtkvCuBG2BgR6KZa83PTclw4U5n2wAllU= github.com/otiai10/copy v1.14.0/go.mod h1:ECfuL02W+/FkTWZWgQqXPWZgW9oeKCSQ5qVfSc4qc4w= @@ -387,8 +388,8 @@ github.com/otiai10/curr v0.0.0-20150429015615-9b4961190c95/go.mod h1:9qAhocn7zKJ github.com/otiai10/curr v1.0.0/go.mod h1:LskTG5wDwr8Rs+nNQ+1LlxRjAtTZZjtJW4rMXl6j4vs= github.com/otiai10/mint v1.3.0/go.mod h1:F5AjcsTsWUqX+Na9fpHb52P8pcRX2CI6A3ctIT91xUo= github.com/otiai10/mint v1.3.1/go.mod h1:/yxELlJQ0ufhjUwhshSj+wFjZ78CnZ48/1wtmBH1OTc= -github.com/pelletier/go-toml/v2 v2.2.2 h1:aYUidT7k73Pcl9nb2gScu7NSrKCSHIDE89b3+6Wq+LM= -github.com/pelletier/go-toml/v2 v2.2.2/go.mod h1:1t835xjRzz80PqgE6HHgN2JOsmgYu/h4qDAS4n929Rs= +github.com/pelletier/go-toml/v2 v2.2.3 h1:YmeHyLY8mFWbdkNWwpr+qIL2bEqT0o95WSdkNHvL12M= +github.com/pelletier/go-toml/v2 v2.2.3/go.mod h1:MfCQTFTvCcUyyvvwm1+G6H/jORL20Xlb6rzQu9GuUkc= github.com/pjbgf/sha1cd v0.3.0 h1:4D5XXmUUBUl/xQ6IjCkEAbqXskkq/4O7LmGn0AqMDs4= github.com/pjbgf/sha1cd v0.3.0/go.mod h1:nZ1rrWOcGJ5uZgEEVL1VUM9iRQiZvWdbZjkKyFzPPsI= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= @@ -396,8 +397,8 @@ github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINE github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/polyfloyd/go-errorlint v1.6.0 h1:tftWV9DE7txiFzPpztTAwyoRLKNj9gpVm2cg8/OwcYY= -github.com/polyfloyd/go-errorlint v1.6.0/go.mod h1:HR7u8wuP1kb1NeN1zqTd1ZMlqUKPPHF+Id4vIPvDqVw= +github.com/polyfloyd/go-errorlint v1.7.0 h1:Zp6lzCK4hpBDj8y8a237YK4EPrMXQWvOe3nGoH4pFrU= +github.com/polyfloyd/go-errorlint v1.7.0/go.mod h1:dGWKu85mGHnegQ2SWpEybFityCg3j7ZbwsVUxAOk9gY= github.com/prashantv/gostub v1.1.0 h1:BTyx3RfQjRHnUWaGF9oQos79AlQ5k8WNktv7VGvVH4g= github.com/prashantv/gostub v1.1.0/go.mod h1:A5zLQHz7ieHGG7is6LLXLz7I8+3LZzsrV0P1IAHhP5U= github.com/prometheus/client_golang v1.20.3 h1:oPksm4K8B+Vt35tUhw6GbSNSgVlVSBH0qELP/7u83l4= @@ -408,8 +409,8 @@ github.com/prometheus/common v0.59.1 h1:LXb1quJHWm1P6wq/U824uxYi4Sg0oGvNeUm1z5dJ github.com/prometheus/common v0.59.1/go.mod h1:GpWM7dewqmVYcd7SmRaiWVe9SSqjf0UrwnYnpEZNuT0= github.com/prometheus/procfs v0.15.1 h1:YagwOFzUgYfKKHX6Dr+sHT7km/hxC76UB0learggepc= github.com/prometheus/procfs v0.15.1/go.mod h1:fB45yRUv8NstnjriLhBQLuOUt+WW4BsoGhij/e3PBqk= -github.com/quasilyte/go-ruleguard v0.4.2 h1:htXcXDK6/rO12kiTHKfHuqR4kr3Y4M0J0rOL6CH/BYs= -github.com/quasilyte/go-ruleguard v0.4.2/go.mod h1:GJLgqsLeo4qgavUoL8JeGFNS7qcisx3awV/w9eWTmNI= +github.com/quasilyte/go-ruleguard v0.4.3-0.20240823090925-0fe6f58b47b1 h1:+Wl/0aFp0hpuHM3H//KMft64WQ1yX9LdJY64Qm/gFCo= +github.com/quasilyte/go-ruleguard v0.4.3-0.20240823090925-0fe6f58b47b1/go.mod h1:GJLgqsLeo4qgavUoL8JeGFNS7qcisx3awV/w9eWTmNI= github.com/quasilyte/go-ruleguard/dsl v0.3.22 h1:wd8zkOhSNr+I+8Qeciml08ivDt1pSXe60+5DqOpCjPE= github.com/quasilyte/go-ruleguard/dsl v0.3.22/go.mod h1:KeCP03KrjuSO0H1kTuZQCWlQPulDV6YMIXmpQss17rU= github.com/quasilyte/gogrep v0.5.0 h1:eTKODPXbI8ffJMN+W2aE0+oL0z/nh8/5eNdiO34SOAo= @@ -418,12 +419,17 @@ github.com/quasilyte/regex/syntax v0.0.0-20210819130434-b3f0c404a727 h1:TCg2WBOl github.com/quasilyte/regex/syntax v0.0.0-20210819130434-b3f0c404a727/go.mod h1:rlzQ04UMyJXu/aOvhd8qT+hvDrFpiwqp8MRXDY9szc0= github.com/quasilyte/stdinfo v0.0.0-20220114132959-f7386bf02567 h1:M8mH9eK4OUR4lu7Gd+PU1fV2/qnDNfzT635KRSObncs= github.com/quasilyte/stdinfo v0.0.0-20220114132959-f7386bf02567/go.mod h1:DWNGW8A4Y+GyBgPuaQJuWiy0XYftx4Xm/y5Jqk9I6VQ= +github.com/raeperd/recvcheck v0.1.2 h1:SjdquRsRXJc26eSonWIo8b7IMtKD3OAT2Lb5G3ZX1+4= +github.com/raeperd/recvcheck v0.1.2/go.mod h1:n04eYkwIR0JbgD73wT8wL4JjPC3wm0nFtzBnWNocnYU= +github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= +github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ= +github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88= github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUzkipdSkR5nkCZA= -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/rogpeppe/go-internal v1.13.1 h1:KvO1DLK/DRN07sQ1LQKScxyZJuNnedQ5/wKSR38lUII= +github.com/rogpeppe/go-internal v1.13.1/go.mod h1:uMEvuHeurkdAXX61udpOXGD/AzZDWNMNyH2VO9fmH0o= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= -github.com/ryancurrah/gomodguard v1.3.3 h1:eiSQdJVNr9KTNxY2Niij8UReSwR8Xrte3exBrAZfqpg= -github.com/ryancurrah/gomodguard v1.3.3/go.mod h1:rsKQjj4l3LXe8N344Ow7agAy5p9yjsWOtRzUMYmA0QY= +github.com/ryancurrah/gomodguard v1.3.5 h1:cShyguSwUEeC0jS7ylOiG/idnd1TpJ1LfHGpV3oJmPU= +github.com/ryancurrah/gomodguard v1.3.5/go.mod h1:MXlEPQRxgfPQa62O8wzK3Ozbkv9Rkqr+wKjSxTdsNJE= github.com/ryanrolds/sqlclosecheck v0.5.1 h1:dibWW826u0P8jNLsLN+En7+RqWWTYrjCB9fJfSfdyCU= github.com/ryanrolds/sqlclosecheck v0.5.1/go.mod h1:2g3dUjoS6AL4huFdv6wn55WpLIDjY7ZgUR4J8HOO/XQ= github.com/sagikazarmark/locafero v0.4.0 h1:HApY1R9zGo4DBgr7dqsTH/JJxLTTsOt7u6keLGt6kNQ= @@ -438,8 +444,8 @@ github.com/sashamelentyev/interfacebloat v1.1.0 h1:xdRdJp0irL086OyW1H/RTZTr1h/tM github.com/sashamelentyev/interfacebloat v1.1.0/go.mod h1:+Y9yU5YdTkrNvoX0xHc84dxiN1iBi9+G8zZIhPVoNjQ= github.com/sashamelentyev/usestdlibvars v1.27.0 h1:t/3jZpSXtRPRf2xr0m63i32ZrusyurIGT9E5wAvXQnI= github.com/sashamelentyev/usestdlibvars v1.27.0/go.mod h1:9nl0jgOfHKWNFS43Ojw0i7aRoS4j6EBye3YBhmAIRF8= -github.com/securego/gosec/v2 v2.20.1-0.20240525090044-5f0084eb01a9 h1:rnO6Zp1YMQwv8AyxzuwsVohljJgp4L0ZqiCgtACsPsc= -github.com/securego/gosec/v2 v2.20.1-0.20240525090044-5f0084eb01a9/go.mod h1:dg7lPlu/xK/Ut9SedURCoZbVCR4yC7fM65DtH9/CDHs= +github.com/securego/gosec/v2 v2.21.4 h1:Le8MSj0PDmOnHJgUATjD96PaXRvCpKC+DGJvwyy0Mlk= +github.com/securego/gosec/v2 v2.21.4/go.mod h1:Jtb/MwRQfRxCXyCm1rfM1BEiiiTfUOdyzzAhlr6lUTA= github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3 h1:n661drycOFuPLCN3Uc8sB6B/s6Z4t2xvBgU1htSHuq8= github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3/go.mod h1:A0bzQcvG0E7Rwjx0REVgAGH58e96+X0MeOfepqsbeW4= github.com/shazow/go-diff v0.0.0-20160112020656-b6b7b6733b8c h1:W65qqJCIOVP4jpqPQ0YvHYKwcMEMVWIzWC5iNQQfBTU= @@ -451,12 +457,12 @@ github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= github.com/sivchari/containedctx v1.0.3 h1:x+etemjbsh2fB5ewm5FeLNi5bUjK0V8n0RB+Wwfd0XE= github.com/sivchari/containedctx v1.0.3/go.mod h1:c1RDvCbnJLtH4lLcYD/GqwiBSSf4F5Qk0xld2rBqzJ4= -github.com/sivchari/tenv v1.10.0 h1:g/hzMA+dBCKqGXgW8AV/1xIWhAvDrx0zFKNR48NFMg0= -github.com/sivchari/tenv v1.10.0/go.mod h1:tdY24masnVoZFxYrHv/nD6Tc8FbkEtAQEEziXpyMgqY= +github.com/sivchari/tenv v1.12.1 h1:+E0QzjktdnExv/wwsnnyk4oqZBUfuh89YMQT1cyuvSY= +github.com/sivchari/tenv v1.12.1/go.mod h1:1LjSOUCc25snIr5n3DtGGrENhX3LuWefcplwVGC24mw= github.com/skeema/knownhosts v1.2.2 h1:Iug2P4fLmDw9f41PB6thxUkNUkJzB5i+1/exaj40L3A= github.com/skeema/knownhosts v1.2.2/go.mod h1:xYbVRSPxqBZFrdmDyMmsOs+uX1UZC3nTN3ThzgDxUwo= -github.com/sonatard/noctx v0.0.2 h1:L7Dz4De2zDQhW8S0t+KUjY0MAQJd6SgVwhzNIc4ok00= -github.com/sonatard/noctx v0.0.2/go.mod h1:kzFz+CzWSjQ2OzIm46uJZoXuBpa2+0y3T36U18dWqIo= +github.com/sonatard/noctx v0.1.0 h1:JjqOc2WN16ISWAjAk8M5ej0RfExEXtkEyExl2hLW+OM= +github.com/sonatard/noctx v0.1.0/go.mod h1:0RvBxqY8D4j9cTTTWE8ylt2vqj2EPI8fHmrxHdsaZ2c= github.com/sourcegraph/conc v0.3.0 h1:OQTbbt6P72L20UqAkXXuLOj79LfEanQ+YQFNpLA9ySo= github.com/sourcegraph/conc v0.3.0/go.mod h1:Sdozi7LEKbFPqYX2/J+iBAM6HpqSLTASQIKqDmF7Mt0= github.com/sourcegraph/go-diff v0.7.0 h1:9uLlrd5T46OXs5qpp8L/MTltk0zikUGi0sNNyCpA8G0= @@ -489,7 +495,6 @@ github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA= github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8= @@ -500,14 +505,14 @@ github.com/tenntenn/modver v1.0.1 h1:2klLppGhDgzJrScMpkj9Ujy3rXPUspSjAcev9tSEBgA github.com/tenntenn/modver v1.0.1/go.mod h1:bePIyQPb7UeioSRkw3Q0XeMhYZSMx9B8ePqg6SAMGH0= github.com/tenntenn/text/transform v0.0.0-20200319021203-7eef512accb3 h1:f+jULpRQGxTSkNYKJ51yaw6ChIqO+Je8UqsTKN/cDag= github.com/tenntenn/text/transform v0.0.0-20200319021203-7eef512accb3/go.mod h1:ON8b8w4BN/kE1EOhwT0o+d62W65a6aPw1nouo9LMgyY= -github.com/tetafro/godot v1.4.16 h1:4ChfhveiNLk4NveAZ9Pu2AN8QZ2nkUGFuadM9lrr5D0= -github.com/tetafro/godot v1.4.16/go.mod h1:2oVxTBSftRTh4+MVfUaUXR6bn2GDXCaMcOG4Dk3rfio= +github.com/tetafro/godot v1.4.18 h1:ouX3XGiziKDypbpXqShBfnNLTSjR8r3/HVzrtJ+bHlI= +github.com/tetafro/godot v1.4.18/go.mod h1:2oVxTBSftRTh4+MVfUaUXR6bn2GDXCaMcOG4Dk3rfio= github.com/timakin/bodyclose v0.0.0-20230421092635-574207250966 h1:quvGphlmUVU+nhpFa4gg4yJyTRJ13reZMDHrKwYw53M= github.com/timakin/bodyclose v0.0.0-20230421092635-574207250966/go.mod h1:27bSVNWSBOHm+qRp1T9qzaIpsWEP6TbUnei/43HK+PQ= -github.com/timonwong/loggercheck v0.9.4 h1:HKKhqrjcVj8sxL7K77beXh0adEm6DLjV/QOGeMXEVi4= -github.com/timonwong/loggercheck v0.9.4/go.mod h1:caz4zlPcgvpEkXgVnAJGowHAMW2NwHaNlpS8xDbVhTg= -github.com/tomarrell/wrapcheck/v2 v2.8.3 h1:5ov+Cbhlgi7s/a42BprYoxsr73CbdMUTzE3bRDFASUs= -github.com/tomarrell/wrapcheck/v2 v2.8.3/go.mod h1:g9vNIyhb5/9TQgumxQyOEqDHsmGYcGsVMOx/xGkqdMo= +github.com/timonwong/loggercheck v0.10.1 h1:uVZYClxQFpw55eh+PIoqM7uAOHMrhVcDoWDery9R8Lg= +github.com/timonwong/loggercheck v0.10.1/go.mod h1:HEAWU8djynujaAVX7QI65Myb8qgfcZ1uKbdpg3ZzKl8= +github.com/tomarrell/wrapcheck/v2 v2.9.0 h1:801U2YCAjLhdN8zhZ/7tdjB3EnAoRlJHt/s+9hijLQ4= +github.com/tomarrell/wrapcheck/v2 v2.9.0/go.mod h1:g9vNIyhb5/9TQgumxQyOEqDHsmGYcGsVMOx/xGkqdMo= github.com/tommy-muehle/go-mnd/v2 v2.5.1 h1:NowYhSdyE/1zwK9QCLeRb6USWdoif80Ie+v+yU8u1Zw= github.com/tommy-muehle/go-mnd/v2 v2.5.1/go.mod h1:WsUAkMJMYww6l/ufffCD3m+P7LEvr8TnZn9lwVDlgzw= github.com/ultraware/funlen v0.1.0 h1:BuqclbkY6pO+cvxoq7OsktIXZpgBSkYTQtmwhAK81vI= @@ -516,6 +521,8 @@ github.com/ultraware/whitespace v0.1.1 h1:bTPOGejYFulW3PkcrqkeQwOd6NKOOXvmGD9bo/ github.com/ultraware/whitespace v0.1.1/go.mod h1:XcP1RLD81eV4BW8UhQlpaR+SDc2givTvyI8a586WjW8= github.com/uudashr/gocognit v1.1.3 h1:l+a111VcDbKfynh+airAy/DJQKaXh2m9vkoysMPSZyM= github.com/uudashr/gocognit v1.1.3/go.mod h1:aKH8/e8xbTRBwjbCkwZ8qt4l2EpKXl31KMHgSS+lZ2U= +github.com/uudashr/iface v1.2.1 h1:vHHyzAUmWZ64Olq6NZT3vg/z1Ws56kyPdBOd5kTXDF8= +github.com/uudashr/iface v1.2.1/go.mod h1:4QvspiRd3JLPAEXBQ9AiZpLbJlrWWgRChOKDJEuQTdg= github.com/vektah/gqlparser/v2 v2.5.16 h1:1gcmLTvs3JLKXckwCwlUagVn/IlV2bwqle0vJ0vy5p8= github.com/vektah/gqlparser/v2 v2.5.16/go.mod h1:1lz1OeCqgQbQepsGxPVywrjdBHW2T08PUS3pJqepRww= github.com/xanzy/ssh-agent v0.3.3 h1:+/15pJfg/RsTxqYcX6fHqOXZwwMP+2VyYWJeWM2qQFM= @@ -539,8 +546,8 @@ gitlab.com/bosi/decorder v0.4.2 h1:qbQaV3zgwnBZ4zPMhGLW4KZe7A7NwxEhJx39R3shffo= gitlab.com/bosi/decorder v0.4.2/go.mod h1:muuhHoaJkA9QLcYHq4Mj8FJUwDZ+EirSHRiaTcTf6T8= go-simpler.org/assert v0.9.0 h1:PfpmcSvL7yAnWyChSjOz6Sp6m9j5lyK8Ok9pEL31YkQ= go-simpler.org/assert v0.9.0/go.mod h1:74Eqh5eI6vCK6Y5l3PI8ZYFXG4Sa+tkr70OIPJAUr28= -go-simpler.org/musttag v0.12.2 h1:J7lRc2ysXOq7eM8rwaTYnNrHd5JwjppzB6mScysB2Cs= -go-simpler.org/musttag v0.12.2/go.mod h1:uN1DVIasMTQKk6XSik7yrJoEysGtR2GRqvWnI9S7TYM= +go-simpler.org/musttag v0.13.0 h1:Q/YAW0AHvaoaIbsPj3bvEI5/QFP7w696IMUpnKXQfCE= +go-simpler.org/musttag v0.13.0/go.mod h1:FTzIGeK6OkKlUDVpj0iQUXZLUO1Js9+mvykDQy9C5yM= go-simpler.org/sloglint v0.7.2 h1:Wc9Em/Zeuu7JYpl+oKoYOsQSy2X560aVueCW/m6IijY= go-simpler.org/sloglint v0.7.2/go.mod h1:US+9C80ppl7VsThQclkM7BkCHQAzuz8kHLsW3ppuluo= go.opentelemetry.io/build-tools v0.15.0 h1:SJFD+MSKKrSIP0oujmmY/zRi8TgVFzUc1080nIBmRzA= @@ -581,8 +588,8 @@ go.opentelemetry.io/otel/sdk/metric v1.32.0 h1:rZvFnvmvawYb0alrYkjraqJq0Z4ZUJAiy 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/automaxprocs v1.5.3 h1:kWazyxZUrS3Gs4qUpbwo5kEIMGe/DAvi5Z4tl2NW4j8= -go.uber.org/automaxprocs v1.5.3/go.mod h1:eRbA25aqJrxAbsLO0xy5jVwPt7FQnRgjW+efnwa1WM0= +go.uber.org/automaxprocs v1.6.0 h1:O3y2/QNTOdbF+e/dpXNNW7Rx2hZ4sTIPyybbxyNqTUs= +go.uber.org/automaxprocs v1.6.0/go.mod h1:ifeIMSnPZuznNm6jmdzmU3/bfk01Fe2fotchwEFJ8r8= 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= @@ -603,12 +610,12 @@ golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDf golang.org/x/crypto v0.21.0/go.mod h1:0BP7YvVV9gBbVKyeTG0Gyn+gZm94bibOW5BjDEYAOMs= golang.org/x/crypto v0.31.0 h1:ihbySMvVjLAeSH1IbfcRTkD/iNscyz8rGzjF/E5hV6U= golang.org/x/crypto v0.31.0/go.mod h1:kDsLvtWBEx7MV9tJOj9bnXsPbxwJQ6csT/x4KIN4Ssk= -golang.org/x/exp v0.0.0-20240103183307-be819d1f06fc h1:ao2WRsKSzW6KuUY9IWPwWahcHCgR0s52IfwutMfEbdM= -golang.org/x/exp v0.0.0-20240103183307-be819d1f06fc/go.mod h1:iRJReGqOEeBhDZGkGbynYwcHlctCvnjTYIamk7uXpHI= +golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 h1:e66Fs6Z+fZTbFBAxKfP3PALWBtpfqks2bwGcexMxgtk= +golang.org/x/exp v0.0.0-20240909161429-701f63a606c0/go.mod h1:2TbTHSBQa924w8M6Xs1QcRcFwyucIwBGpK1p2f1YFFY= golang.org/x/exp/typeparams v0.0.0-20220428152302-39d4317da171/go.mod h1:AbB0pIl9nAr9wVwH+Z2ZpaocVmF5I4GyWCDIsVjR0bk= golang.org/x/exp/typeparams v0.0.0-20230203172020-98cc5a0785f9/go.mod h1:AbB0pIl9nAr9wVwH+Z2ZpaocVmF5I4GyWCDIsVjR0bk= -golang.org/x/exp/typeparams v0.0.0-20240314144324-c7f7c6466f7f h1:phY1HzDcf18Aq9A8KkmRtY9WvOFIxN8wgfvy6Zm1DV8= -golang.org/x/exp/typeparams v0.0.0-20240314144324-c7f7c6466f7f/go.mod h1:AbB0pIl9nAr9wVwH+Z2ZpaocVmF5I4GyWCDIsVjR0bk= +golang.org/x/exp/typeparams v0.0.0-20241108190413-2d47ceb2692f h1:WTyX8eCCyfdqiPYkRGm0MqElSfYFH3yR1+rl/mct9sA= +golang.org/x/exp/typeparams v0.0.0-20241108190413-2d47ceb2692f/go.mod h1:AbB0pIl9nAr9wVwH+Z2ZpaocVmF5I4GyWCDIsVjR0bk= 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/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= @@ -728,7 +735,6 @@ golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190321232350-e250d351ecad/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190910044552-dd2b5c81c578/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191108193012-7d206e10da11/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20200324003944-a576cf524670/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8= golang.org/x/tools v0.0.0-20200329025819-fd4102a86c65/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8= @@ -784,9 +790,9 @@ gotest.tools/gotestsum v1.12.0 h1:CmwtaGDkHxrZm4Ib0Vob89MTfpc3GrEFMJKovliPwGk= gotest.tools/gotestsum v1.12.0/go.mod h1:fAvqkSptospfSbQw26CTYzNwnsE/ztqLeyhP0h67ARY= gotest.tools/v3 v3.5.1 h1:EENdUnS3pdur5nybKYIh2Vfgc8IUNBjxDPSjtiJcOzU= gotest.tools/v3 v3.5.1/go.mod h1:isy3WKz7GK6uNw/sbHzfKBLvlvXwUyV06n6brMxxopU= -honnef.co/go/tools v0.5.0 h1:29uoiIormS3Z6R+t56STz/oI4v+mB51TSmEOdJPgRnE= -honnef.co/go/tools v0.5.0/go.mod h1:e9irvo83WDG9/irijV44wr3tbhcFeRnfpVlRqVwpzMs= -mvdan.cc/gofumpt v0.6.0 h1:G3QvahNDmpD+Aek/bNOLrFR2XC6ZAdo62dZu65gmwGo= -mvdan.cc/gofumpt v0.6.0/go.mod h1:4L0wf+kgIPZtcCWXynNS2e6bhmj73umwnuXSZarixzA= +honnef.co/go/tools v0.5.1 h1:4bH5o3b5ZULQ4UrBmP+63W9r7qIkqJClEA9ko5YKx+I= +honnef.co/go/tools v0.5.1/go.mod h1:e9irvo83WDG9/irijV44wr3tbhcFeRnfpVlRqVwpzMs= +mvdan.cc/gofumpt v0.7.0 h1:bg91ttqXmi9y2xawvkuMXyvAA/1ZGJqYAEGjXuP0JXU= +mvdan.cc/gofumpt v0.7.0/go.mod h1:txVFJy/Sc/mvaycET54pV8SW8gWxTlUuGHVEcncmNUo= mvdan.cc/unparam v0.0.0-20240528143540-8a5130ca722f h1:lMpcwN6GxNbWtbpI1+xzFLSW8XzX0u72NttUGVFjO3U= mvdan.cc/unparam v0.0.0-20240528143540-8a5130ca722f/go.mod h1:RSLa7mKKCNeTTMHBw5Hsy2rfJmd6O2ivt9Dw9ZqCQpQ= diff --git a/pkg/stanza/adapter/converter_test.go b/pkg/stanza/adapter/converter_test.go index a527e3bddb84..2da3c2226a2b 100644 --- a/pkg/stanza/adapter/converter_test.go +++ b/pkg/stanza/adapter/converter_test.go @@ -378,8 +378,6 @@ func TestAllConvertedEntriesScopeGrouping(t *testing.T) { } for i, tc := range testcases { - tc := tc - t.Run(strconv.Itoa(i), func(t *testing.T) { t.Parallel() diff --git a/pkg/stanza/fileconsumer/config_test.go b/pkg/stanza/fileconsumer/config_test.go index 72d06fd2478c..51af232c9e37 100644 --- a/pkg/stanza/fileconsumer/config_test.go +++ b/pkg/stanza/fileconsumer/config_test.go @@ -642,7 +642,6 @@ func TestBuild(t *testing.T) { for _, tc := range cases { t.Run(tc.name, func(t *testing.T) { - tc := tc t.Parallel() cfg := basicConfig() tc.modifyBaseConfig(cfg) @@ -712,7 +711,6 @@ func TestBuildWithSplitFunc(t *testing.T) { for _, tc := range cases { t.Run(tc.name, func(t *testing.T) { - tc := tc t.Parallel() cfg := basicConfig() tc.modifyBaseConfig(cfg) @@ -805,7 +803,6 @@ func TestBuildWithHeader(t *testing.T) { for _, tc := range cases { t.Run(tc.name, func(t *testing.T) { - tc := tc t.Parallel() cfg := basicConfig() tc.modifyBaseConfig(cfg) diff --git a/pkg/stanza/fileconsumer/file_test.go b/pkg/stanza/fileconsumer/file_test.go index e4faf03a8fef..84c72044ef47 100644 --- a/pkg/stanza/fileconsumer/file_test.go +++ b/pkg/stanza/fileconsumer/file_test.go @@ -748,7 +748,6 @@ func TestRestartOffsets(t *testing.T) { } for _, tc := range testCases { - tc := tc t.Run(tc.name, func(t *testing.T) { t.Parallel() @@ -990,7 +989,6 @@ func TestEncodings(t *testing.T) { } for _, tc := range cases { - tc := tc t.Run(tc.name, func(t *testing.T) { t.Parallel() diff --git a/pkg/stanza/fileconsumer/internal/fingerprint/fingerprint_test.go b/pkg/stanza/fileconsumer/internal/fingerprint/fingerprint_test.go index 6d2141fbf2e7..89f64e76b3ab 100644 --- a/pkg/stanza/fileconsumer/internal/fingerprint/fingerprint_test.go +++ b/pkg/stanza/fileconsumer/internal/fingerprint/fingerprint_test.go @@ -114,7 +114,6 @@ func TestNewFromFile(t *testing.T) { } for _, tc := range cases { - tc := tc t.Run(tc.name, func(t *testing.T) { t.Parallel() diff --git a/pkg/stanza/fileconsumer/internal/reader/reader_test.go b/pkg/stanza/fileconsumer/internal/reader/reader_test.go index 5f07b23821ee..8d9733f5e735 100644 --- a/pkg/stanza/fileconsumer/internal/reader/reader_test.go +++ b/pkg/stanza/fileconsumer/internal/reader/reader_test.go @@ -57,7 +57,6 @@ func TestFingerprintGrowsAndStops(t *testing.T) { lineLens := []int{3, 5, 7, 11, 13, 17, 19, 23, 27} for _, lineLen := range lineLens { - lineLen := lineLen t.Run(fmt.Sprintf("%d", lineLen), func(t *testing.T) { t.Parallel() @@ -118,7 +117,6 @@ func TestFingerprintChangeSize(t *testing.T) { lineLens := []int{3, 4, 5, 6, 7, 8, 11, 12, 13, 17, 19, 23, 27, 36} for _, lineLen := range lineLens { - lineLen := lineLen t.Run(fmt.Sprintf("%d", lineLen), func(t *testing.T) { t.Parallel() diff --git a/pkg/stanza/operator/input/file/config_test.go b/pkg/stanza/operator/input/file/config_test.go index bb2e346afdc1..3bcfd7702ded 100644 --- a/pkg/stanza/operator/input/file/config_test.go +++ b/pkg/stanza/operator/input/file/config_test.go @@ -533,7 +533,6 @@ func TestBuild(t *testing.T) { for _, tc := range cases { t.Run(tc.name, func(t *testing.T) { - tc := tc t.Parallel() cfg := basicConfig() tc.modifyBaseConfig(cfg) diff --git a/pkg/translator/skywalking/skywalkingproto_to_traces_test.go b/pkg/translator/skywalking/skywalkingproto_to_traces_test.go index 6637e3669d94..c3d14b1b007f 100644 --- a/pkg/translator/skywalking/skywalkingproto_to_traces_test.go +++ b/pkg/translator/skywalking/skywalkingproto_to_traces_test.go @@ -216,7 +216,7 @@ func Test_stringToTraceID_Unique(t *testing.T) { } var results [2][16]byte - for i := 0; i < 2; i++ { + for i := 0; i < len(tests); i++ { tt := tests[i] t.Run(tt.name, func(_ *testing.T) { got := swTraceIDToTraceID(tt.segmentObject.traceID) diff --git a/processor/attributesprocessor/attributes_log_test.go b/processor/attributesprocessor/attributes_log_test.go index 5d1a1d14f562..cf49903330e9 100644 --- a/processor/attributesprocessor/attributes_log_test.go +++ b/processor/attributesprocessor/attributes_log_test.go @@ -84,8 +84,7 @@ func TestLogProcessor_NilEmptyData(t *testing.T) { context.Background(), processortest.NewNopSettings(), oCfg, consumertest.NewNop()) require.NoError(t, err) require.NotNil(t, tp) - for i := range testCases { - tt := testCases[i] + for _, tt := range testCases { t.Run(tt.name, func(t *testing.T) { assert.NoError(t, tp.ConsumeLogs(context.Background(), tt.input)) assert.EqualValues(t, tt.output, tt.input) diff --git a/processor/attributesprocessor/attributes_trace_test.go b/processor/attributesprocessor/attributes_trace_test.go index 7cdb128ee6b7..16020604130b 100644 --- a/processor/attributesprocessor/attributes_trace_test.go +++ b/processor/attributesprocessor/attributes_trace_test.go @@ -93,8 +93,7 @@ func TestSpanProcessor_NilEmptyData(t *testing.T) { tp, err := factory.CreateTraces(context.Background(), processortest.NewNopSettings(), oCfg, consumertest.NewNop()) require.NoError(t, err) require.NotNil(t, tp) - for i := range testCases { - tt := testCases[i] + for _, tt := range testCases { t.Run(tt.name, func(t *testing.T) { assert.NoError(t, tp.ConsumeTraces(context.Background(), tt.input)) assert.EqualValues(t, tt.output, tt.input) diff --git a/processor/schemaprocessor/internal/migrate/attributes_test.go b/processor/schemaprocessor/internal/migrate/attributes_test.go index 051693a74acc..7505f41edfb6 100644 --- a/processor/schemaprocessor/internal/migrate/attributes_test.go +++ b/processor/schemaprocessor/internal/migrate/attributes_test.go @@ -100,7 +100,6 @@ func TestAttributeChangeSetApply(t *testing.T) { errVal: "value \"service.name\" already exists", }, } { - tc := tc t.Run(tc.name, func(t *testing.T) { t.Parallel() @@ -175,7 +174,6 @@ func TestAttributeChangeSetRollback(t *testing.T) { errVal: "value \"application.name\" already exists", }, } { - tc := tc t.Run(tc.name, func(t *testing.T) { t.Parallel() diff --git a/processor/schemaprocessor/internal/migrate/conditional_test.go b/processor/schemaprocessor/internal/migrate/conditional_test.go index 183944100d98..de6e5cad298c 100644 --- a/processor/schemaprocessor/internal/migrate/conditional_test.go +++ b/processor/schemaprocessor/internal/migrate/conditional_test.go @@ -80,7 +80,6 @@ func TestConditionalAttributeSetApply(t *testing.T) { }), }, } { - tc := tc t.Run(tc.name, func(t *testing.T) { t.Parallel() @@ -160,7 +159,6 @@ func TestConditionalAttributeSetRollback(t *testing.T) { }), }, } { - tc := tc t.Run(tc.name, func(t *testing.T) { t.Parallel() diff --git a/processor/schemaprocessor/internal/migrate/multi_conditional_test.go b/processor/schemaprocessor/internal/migrate/multi_conditional_test.go index 0b8ae8e8197f..98c2c204b43a 100644 --- a/processor/schemaprocessor/internal/migrate/multi_conditional_test.go +++ b/processor/schemaprocessor/internal/migrate/multi_conditional_test.go @@ -139,7 +139,6 @@ func TestMultiConditionalAttributeSetApply(t *testing.T) { }), }, } { - tc := tc t.Run(tc.name, func(t *testing.T) { t.Parallel() require.NoError(t, tc.cond.Do(StateSelectorApply, tc.inAttr, tc.inCondData)) diff --git a/processor/schemaprocessor/internal/migrate/signal_test.go b/processor/schemaprocessor/internal/migrate/signal_test.go index 3c82a59f15d4..bfa09bc61002 100644 --- a/processor/schemaprocessor/internal/migrate/signal_test.go +++ b/processor/schemaprocessor/internal/migrate/signal_test.go @@ -60,7 +60,6 @@ func TestSignalApply(t *testing.T) { expect: "instance.uptime", }, } { - tc := tc t.Run(tc.name, func(t *testing.T) { t.Parallel() @@ -118,7 +117,6 @@ func TestSignalRollback(t *testing.T) { expect: "system.uptime", }, } { - tc := tc t.Run(tc.name, func(t *testing.T) { t.Parallel() diff --git a/processor/schemaprocessor/internal/translation/revision_v1_test.go b/processor/schemaprocessor/internal/translation/revision_v1_test.go index ff0a453e77af..b7694e011a24 100644 --- a/processor/schemaprocessor/internal/translation/revision_v1_test.go +++ b/processor/schemaprocessor/internal/translation/revision_v1_test.go @@ -257,8 +257,6 @@ func TestNewRevisionV1(t *testing.T) { }, }, } { - tc := tc - t.Run(tc.name, func(t *testing.T) { t.Parallel() diff --git a/processor/spanprocessor/span_test.go b/processor/spanprocessor/span_test.go index 437873b1e962..7086318fc117 100644 --- a/processor/spanprocessor/span_test.go +++ b/processor/spanprocessor/span_test.go @@ -106,8 +106,7 @@ func TestSpanProcessor_NilEmptyData(t *testing.T) { tp, err := factory.CreateTraces(context.Background(), processortest.NewNopSettings(), oCfg, consumertest.NewNop()) require.NoError(t, err) require.NotNil(t, tp) - for i := range testCases { - tt := testCases[i] + for _, tt := range testCases { t.Run(tt.name, func(t *testing.T) { assert.NoError(t, tp.ConsumeTraces(context.Background(), tt.input)) assert.NoError(t, ptracetest.CompareTraces(tt.output, tt.input)) diff --git a/receiver/chronyreceiver/internal/chrony/client_test.go b/receiver/chronyreceiver/internal/chrony/client_test.go index 0343866d4e11..4c8900d11fd3 100644 --- a/receiver/chronyreceiver/internal/chrony/client_test.go +++ b/receiver/chronyreceiver/internal/chrony/client_test.go @@ -66,7 +66,6 @@ func TestNew(t *testing.T) { } for _, tc := range tests { - tc := tc t.Run(tc.scenario, func(t *testing.T) { t.Parallel() cl, err := New(tc.addr, time.Second) @@ -207,7 +206,6 @@ func TestGettingTrackingData(t *testing.T) { } for _, tc := range tests { - tc := tc t.Run(tc.scenario, func(t *testing.T) { t.Parallel() diff --git a/receiver/cloudfoundryreceiver/converter_test.go b/receiver/cloudfoundryreceiver/converter_test.go index 0953e8f400f8..ffe0496948ba 100644 --- a/receiver/cloudfoundryreceiver/converter_test.go +++ b/receiver/cloudfoundryreceiver/converter_test.go @@ -212,8 +212,7 @@ func TestConvertLogsEnvelope(t *testing.T) { }, }, } - for i := range tests { - tt := tests[i] + for _, tt := range tests { t.Run(tt.id, func(t *testing.T) { logSlice := plog.NewLogRecordSlice() e := convertEnvelopeToLogs(&tt.envelope, logSlice, now) diff --git a/receiver/datadogreceiver/receiver_test.go b/receiver/datadogreceiver/receiver_test.go index c9fc5c9b00f9..79c1072b7581 100644 --- a/receiver/datadogreceiver/receiver_test.go +++ b/receiver/datadogreceiver/receiver_test.go @@ -111,7 +111,6 @@ func TestDatadogServer(t *testing.T) { expectContent: "{}", }, } { - tc := tc t.Run(tc.name, func(t *testing.T) { t.Parallel() @@ -277,7 +276,6 @@ func TestDatadogInfoEndpoint(t *testing.T) { }`, }, } { - tc := tc t.Run(tc.name, func(t *testing.T) { cfg := createDefaultConfig().(*Config) cfg.Endpoint = "localhost:0" // Using a randomly assigned address diff --git a/receiver/githubreceiver/internal/scraper/githubscraper/github_scraper.go b/receiver/githubreceiver/internal/scraper/githubscraper/github_scraper.go index 10b9ee8434f4..811059609fbf 100644 --- a/receiver/githubreceiver/internal/scraper/githubscraper/github_scraper.go +++ b/receiver/githubreceiver/internal/scraper/githubscraper/github_scraper.go @@ -102,7 +102,6 @@ func (ghs *githubScraper) scrape(ctx context.Context) (pmetric.Metrics, error) { var mux sync.Mutex for _, repo := range repos { - repo := repo name := repo.Name url := repo.Url trunk := repo.DefaultBranchRef.Name diff --git a/receiver/hostmetricsreceiver/internal/scraper/cpuscraper/cpu_scraper_test.go b/receiver/hostmetricsreceiver/internal/scraper/cpuscraper/cpu_scraper_test.go index da20a185eb1d..437d827fce8d 100644 --- a/receiver/hostmetricsreceiver/internal/scraper/cpuscraper/cpu_scraper_test.go +++ b/receiver/hostmetricsreceiver/internal/scraper/cpuscraper/cpu_scraper_test.go @@ -163,7 +163,6 @@ func TestScrape_CpuUtilization(t *testing.T) { } for _, test := range testCases { - test := test t.Run(test.name, func(t *testing.T) { t.Parallel() settings := test.metricsConfig diff --git a/receiver/hostmetricsreceiver/internal/scraper/cpuscraper/ucal/cpu_utilization_calculator_test.go b/receiver/hostmetricsreceiver/internal/scraper/cpuscraper/ucal/cpu_utilization_calculator_test.go index 9886f24ed413..33d5c1cb68fd 100644 --- a/receiver/hostmetricsreceiver/internal/scraper/cpuscraper/ucal/cpu_utilization_calculator_test.go +++ b/receiver/hostmetricsreceiver/internal/scraper/cpuscraper/ucal/cpu_utilization_calculator_test.go @@ -150,7 +150,6 @@ func TestCpuUtilizationCalculator_Calculate(t *testing.T) { }, } for _, test := range testCases { - test := test t.Run(test.name, func(t *testing.T) { t.Parallel() recorder := inMemoryRecorder{} diff --git a/receiver/hostmetricsreceiver/internal/scraper/filesystemscraper/filesystem_scraper_test.go b/receiver/hostmetricsreceiver/internal/scraper/filesystemscraper/filesystem_scraper_test.go index 7d338de7b495..f4b3b9471a36 100644 --- a/receiver/hostmetricsreceiver/internal/scraper/filesystemscraper/filesystem_scraper_test.go +++ b/receiver/hostmetricsreceiver/internal/scraper/filesystemscraper/filesystem_scraper_test.go @@ -386,7 +386,6 @@ func TestScrape(t *testing.T) { } for _, test := range testCases { - test := test t.Run(test.name, func(t *testing.T) { envMap := common.EnvMap{} for k, v := range test.osEnv { diff --git a/receiver/hostmetricsreceiver/internal/scraper/processscraper/ucal/cpu_utilization_calculator_test.go b/receiver/hostmetricsreceiver/internal/scraper/processscraper/ucal/cpu_utilization_calculator_test.go index 35d5e1611902..724e5b640875 100644 --- a/receiver/hostmetricsreceiver/internal/scraper/processscraper/ucal/cpu_utilization_calculator_test.go +++ b/receiver/hostmetricsreceiver/internal/scraper/processscraper/ucal/cpu_utilization_calculator_test.go @@ -114,7 +114,6 @@ func TestCpuUtilizationCalculator_Calculate(t *testing.T) { }, } for _, test := range testCases { - test := test t.Run(test.name, func(t *testing.T) { recorder := inMemoryRecorder{} calculator := CPUUtilizationCalculator{ diff --git a/receiver/k8sclusterreceiver/internal/metadata/entities_test.go b/receiver/k8sclusterreceiver/internal/metadata/entities_test.go index 04ebe1ccab6a..9602d826bbac 100644 --- a/receiver/k8sclusterreceiver/internal/metadata/entities_test.go +++ b/receiver/k8sclusterreceiver/internal/metadata/entities_test.go @@ -176,37 +176,35 @@ func Test_GetEntityEvents(t *testing.T) { }(), }, } - for _, test := range tests { - tt := test - t.Run( - tt.name, func(t *testing.T) { - // Make sure test data is correct. - for k, v := range tt.old { - assert.EqualValues(t, k, v.ResourceID) - } - for k, v := range tt.new { - assert.EqualValues(t, k, v.ResourceID) - } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + // Make sure test data is correct. + for k, v := range tt.old { + assert.EqualValues(t, k, v.ResourceID) + } + for k, v := range tt.new { + assert.EqualValues(t, k, v.ResourceID) + } - // Convert and test expected events. - timestamp := pcommon.NewTimestampFromTime(time.Now()) - events := GetEntityEvents(tt.old, tt.new, timestamp, 1*time.Hour) - require.Equal(t, tt.events.Len(), events.Len()) - for i := 0; i < events.Len(); i++ { - actual := events.At(i) - expected := tt.events.At(i) - assert.EqualValues(t, timestamp, actual.Timestamp()) - assert.EqualValues(t, expected.EventType(), actual.EventType()) - assert.EqualValues(t, expected.ID().AsRaw(), actual.ID().AsRaw()) - if expected.EventType() == metadataPkg.EventTypeState { - estate := expected.EntityStateDetails() - astate := actual.EntityStateDetails() - assert.EqualValues(t, estate.EntityType(), astate.EntityType()) - assert.EqualValues(t, 1*time.Hour, astate.Interval()) - assert.EqualValues(t, estate.Attributes().AsRaw(), astate.Attributes().AsRaw()) - } + // Convert and test expected events. + timestamp := pcommon.NewTimestampFromTime(time.Now()) + events := GetEntityEvents(tt.old, tt.new, timestamp, 1*time.Hour) + require.Equal(t, tt.events.Len(), events.Len()) + for i := 0; i < events.Len(); i++ { + actual := events.At(i) + expected := tt.events.At(i) + assert.EqualValues(t, timestamp, actual.Timestamp()) + assert.EqualValues(t, expected.EventType(), actual.EventType()) + assert.EqualValues(t, expected.ID().AsRaw(), actual.ID().AsRaw()) + if expected.EventType() == metadataPkg.EventTypeState { + estate := expected.EntityStateDetails() + astate := actual.EntityStateDetails() + assert.EqualValues(t, estate.EntityType(), astate.EntityType()) + assert.EqualValues(t, 1*time.Hour, astate.Interval()) + assert.EqualValues(t, estate.Attributes().AsRaw(), astate.Attributes().AsRaw()) } - }, + } + }, ) } } diff --git a/receiver/mongodbatlasreceiver/access_logs.go b/receiver/mongodbatlasreceiver/access_logs.go index c1bda20a8c4d..b34606ed30fb 100644 --- a/receiver/mongodbatlasreceiver/access_logs.go +++ b/receiver/mongodbatlasreceiver/access_logs.go @@ -101,7 +101,6 @@ func (alr *accessLogsReceiver) Shutdown(_ context.Context) error { func (alr *accessLogsReceiver) startPolling(ctx context.Context) error { for _, pc := range alr.cfg.Logs.Projects { - pc := pc if pc.AccessLogs == nil || !pc.AccessLogs.IsEnabled() { continue } diff --git a/receiver/mongodbatlasreceiver/alerts_test.go b/receiver/mongodbatlasreceiver/alerts_test.go index 77e176e71a0a..63419170cbf5 100644 --- a/receiver/mongodbatlasreceiver/alerts_test.go +++ b/receiver/mongodbatlasreceiver/alerts_test.go @@ -582,7 +582,6 @@ func TestAlertsRetrieval(t *testing.T) { } for _, tc := range cases { - tc := tc t.Run(tc.name, func(t *testing.T) { t.Parallel() logSink := &consumertest.LogsSink{} diff --git a/receiver/mongodbreceiver/metrics.go b/receiver/mongodbreceiver/metrics.go index bb1579cdaa78..c70627f5988c 100644 --- a/receiver/mongodbreceiver/metrics.go +++ b/receiver/mongodbreceiver/metrics.go @@ -563,6 +563,9 @@ func collectMetric(document bson.M, path []string) (int64, error) { } func dig(document bson.M, path []string) (any, error) { + if len(path) == 0 { + return nil, errKeyNotFound + } curItem, remainingPath := path[0], path[1:] value := document[curItem] if value == nil { diff --git a/receiver/prometheusreceiver/internal/metricfamily_test.go b/receiver/prometheusreceiver/internal/metricfamily_test.go index 0f377c36d487..0eb315e2b80f 100644 --- a/receiver/prometheusreceiver/internal/metricfamily_test.go +++ b/receiver/prometheusreceiver/internal/metricfamily_test.go @@ -251,7 +251,6 @@ func TestMetricGroupData_toDistributionUnitTest(t *testing.T) { } for _, tt := range tests { - tt := tt t.Run(tt.name, func(t *testing.T) { mp := newMetricFamily(tt.metricName, mc, zap.NewNop()) for i, tv := range tt.scrapes { @@ -431,7 +430,6 @@ func TestMetricGroupData_toExponentialDistributionUnitTest(t *testing.T) { } for _, tt := range tests { - tt := tt t.Run(tt.name, func(t *testing.T) { mp := newMetricFamily(tt.metricName, mc, zap.NewNop()) for i, tv := range tt.scrapes { @@ -734,7 +732,6 @@ func TestMetricGroupData_toSummaryUnitTest(t *testing.T) { } for _, tt := range tests { - tt := tt t.Run(tt.name, func(t *testing.T) { mp := newMetricFamily(tt.name, mc, zap.NewNop()) for _, lbs := range tt.labelsScrapes { @@ -877,7 +874,6 @@ func TestMetricGroupData_toNumberDataUnitTest(t *testing.T) { } for _, tt := range tests { - tt := tt t.Run(tt.name, func(t *testing.T) { mp := newMetricFamily(tt.metricKind, mc, zap.NewNop()) for _, tv := range tt.scrapes { diff --git a/receiver/prometheusreceiver/internal/prom_to_otlp_test.go b/receiver/prometheusreceiver/internal/prom_to_otlp_test.go index bea18664e51c..6680c995e78b 100644 --- a/receiver/prometheusreceiver/internal/prom_to_otlp_test.go +++ b/receiver/prometheusreceiver/internal/prom_to_otlp_test.go @@ -353,7 +353,6 @@ func TestCreateNodeAndResourcePromToOTLP(t *testing.T) { } for _, tt := range tests { - tt := tt t.Run(tt.name, func(t *testing.T) { testutil.SetFeatureGateForTest(t, removeOldSemconvFeatureGate, tt.removeOldSemconvFeatureGate) got := CreateResource(tt.job, tt.instance, tt.sdLabels) diff --git a/receiver/prometheusreceiver/internal/util_test.go b/receiver/prometheusreceiver/internal/util_test.go index 8ca44ff9f708..7567c68e1a10 100644 --- a/receiver/prometheusreceiver/internal/util_test.go +++ b/receiver/prometheusreceiver/internal/util_test.go @@ -113,7 +113,6 @@ func TestConvToMetricType(t *testing.T) { } for _, tt := range tests { - tt := tt t.Run(tt.name, func(t *testing.T) { got, monotonic := convToMetricType(tt.mtype) require.Equal(t, got.String(), tt.want.String()) @@ -169,7 +168,6 @@ func TestGetBoundary(t *testing.T) { } for _, tt := range tests { - tt := tt t.Run(tt.name, func(t *testing.T) { value, err := getBoundary(tt.mtype, tt.labels) if tt.wantErr != nil { diff --git a/receiver/snowflakereceiver/client_test.go b/receiver/snowflakereceiver/client_test.go index 7da44b41f598..40534292a2f7 100644 --- a/receiver/snowflakereceiver/client_test.go +++ b/receiver/snowflakereceiver/client_test.go @@ -256,8 +256,7 @@ func TestMetricQueries(t *testing.T) { }, } - for i := range tests { - test := tests[i] + for _, test := range tests { t.Run(test.desc, func(t *testing.T) { db, mock, err := sqlmock.New(sqlmock.QueryMatcherOption(sqlmock.QueryMatcherEqual)) if err != nil { diff --git a/receiver/snowflakereceiver/config_test.go b/receiver/snowflakereceiver/config_test.go index 77ccd5ab6480..2955da57e4a1 100644 --- a/receiver/snowflakereceiver/config_test.go +++ b/receiver/snowflakereceiver/config_test.go @@ -90,9 +90,7 @@ func TestValidateConfig(t *testing.T) { }, } - for i := range tests { - test := tests[i] - + for _, test := range tests { t.Run(test.desc, func(t *testing.T) { t.Parallel() diff --git a/testbed/tests/scenarios.go b/testbed/tests/scenarios.go index a5aa6fc84e96..ed908720f1a9 100644 --- a/testbed/tests/scenarios.go +++ b/testbed/tests/scenarios.go @@ -273,9 +273,7 @@ func genRandByteString(length int) string { // Scenario1kSPSWithAttrs runs a performance test at 1k sps with specified span attributes // and test options. func Scenario1kSPSWithAttrs(t *testing.T, args []string, tests []TestCase, processors []ProcessorNameAndConfigBody, extensions map[string]string) { - for i := range tests { - test := tests[i] - + for _, test := range tests { t.Run(fmt.Sprintf("%d*%dbytes", test.attrCount, test.attrSizeByte), func(t *testing.T) { options := constructLoadOptions(test) From 96368fa7aed6d4efe4aa5ea17df7358c4481323e Mon Sep 17 00:00:00 2001 From: odubajDT <93584209+odubajDT@users.noreply.github.com> Date: Fri, 20 Dec 2024 19:02:08 +0100 Subject: [PATCH 3/3] [receiver/cloudfoundry]: move datapoint level attributes to resource level (#34905) **Description:** Introduce a feature gate enable copying envelope tags to the metrics as resource attributes instead of datapoint attributes. **Link to tracking Issue:** #34824 --------- Signed-off-by: odubajDT --- .chloggen/move-attributes.yaml | 27 + receiver/cloudfoundryreceiver/README.md | 33 +- receiver/cloudfoundryreceiver/converter.go | 74 +- .../cloudfoundryreceiver/converter_test.go | 248 +++++-- receiver/cloudfoundryreceiver/go.mod | 5 +- receiver/cloudfoundryreceiver/go.sum | 36 +- receiver/cloudfoundryreceiver/receiver.go | 78 ++- .../cloudfoundryreceiver/receiver_test.go | 655 ++++++++++++++++++ 8 files changed, 1061 insertions(+), 95 deletions(-) create mode 100644 .chloggen/move-attributes.yaml diff --git a/.chloggen/move-attributes.yaml b/.chloggen/move-attributes.yaml new file mode 100644 index 000000000000..b63b3992b981 --- /dev/null +++ b/.chloggen/move-attributes.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: breaking + +# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver) +component: cloudfoundryreceiver + +# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). +note: Introduce a feature gate enable copying envelope tags to the metrics as resource attributes instead of datapoint attributes. + +# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists. +issues: [34824] + +# (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: [] diff --git a/receiver/cloudfoundryreceiver/README.md b/receiver/cloudfoundryreceiver/README.md index 322c01948d8e..ce7f85c151c6 100644 --- a/receiver/cloudfoundryreceiver/README.md +++ b/receiver/cloudfoundryreceiver/README.md @@ -132,4 +132,35 @@ The receiver maps the envelope attribute tags to the following OpenTelemetry att * `instance_id` - numerical index of the origin. If origin is `rep` (`source_type` is `APP`) this is the application index. However, for other cases this is the instance index. * `process_id` - process ID (GUID) * `process_instance_id` - unique ID of a process instance, should be treated as an opaque string -* `process_type` - process type. Each application has exactly one process of type `web`, but many have any number of other processes \ No newline at end of file +* `process_type` - process type. Each application has exactly one process of type `web`, but many have any number of other processes + +## Feature Gate + +### `cloudfoundry.resourceAttributes.allow` + +#### Purpose + +The `cloudfoundry.resourceAttributes.allow` [feature gate](https://github.com/open-telemetry/opentelemetry-collector/blob/main/featuregate/README.md#collector-feature-gates) allows the envelope tags being copied to the metrics as resource attributes instead of datapoint attributes (default `false`). +Therefore all `org.cloudfoundry.*` datapoint attributes won't be present anymore on metrics datapoint level, but on resource level instead, since the attributes describe the resource and not the datapoints itself. + +The `cloudfoundry.resourceAttributes.allow` feature gate is available since version `v0.117.0` and will be held at least for 2 versions (`v0.119.0`) until promoting to `beta` and another 2 vesions (`v0.121.0`) until promoting to `stable`. + +Below you can see the list of attributes that are present the resource level instead of datapoint level (when `cloudfoundry.resourceAttributes.allow` feature gate is enabled): + +``` + - org.cloudfoundry.index + - org.cloudfoundry.ip + - org.cloudfoundry.deployment + - org.cloudfoundry.id + - org.cloudfoundry.job + - org.cloudfoundry.product + - org.cloudfoundry.instance_group + - org.cloudfoundry.instance_id + - org.cloudfoundry.origin + - org.cloudfoundry.system_domain + - org.cloudfoundry.source_id + - org.cloudfoundry.source_type + - org.cloudfoundry.process_type + - org.cloudfoundry.process_id + - org.cloudfoundry.process_instance_id +``` diff --git a/receiver/cloudfoundryreceiver/converter.go b/receiver/cloudfoundryreceiver/converter.go index b03cac337df9..040ae58ae637 100644 --- a/receiver/cloudfoundryreceiver/converter.go +++ b/receiver/cloudfoundryreceiver/converter.go @@ -5,9 +5,11 @@ package cloudfoundryreceiver // import "github.com/open-telemetry/opentelemetry- import ( "fmt" + "slices" "time" "code.cloudfoundry.org/go-loggregator/rpc/loggregator_v2" + "go.opentelemetry.io/collector/featuregate" "go.opentelemetry.io/collector/pdata/pcommon" "go.opentelemetry.io/collector/pdata/plog" "go.opentelemetry.io/collector/pdata/pmetric" @@ -17,6 +19,31 @@ const ( attributeNamePrefix = "org.cloudfoundry." ) +var ResourceAttributesKeys = []string{ + "index", + "ip", + "deployment", + "id", + "job", + "product", + "instance_group", + "instance_id", + "origin", + "system_domain", + "source_id", + "source_type", + "process_type", + "process_id", + "process_instance_id", +} + +var allowResourceAttributes = featuregate.GlobalRegistry().MustRegister( + "cloudfoundry.resourceAttributes.allow", + featuregate.StageAlpha, + featuregate.WithRegisterDescription("When enabled, envelope tags are copied to the metrics as resource attributes instead of datapoint attributes"), + featuregate.WithRegisterFromVersion("v0.117.0"), +) + func convertEnvelopeToMetrics(envelope *loggregator_v2.Envelope, metricSlice pmetric.MetricSlice, startTime time.Time) { namePrefix := envelope.Tags["origin"] + "." @@ -28,7 +55,12 @@ func convertEnvelopeToMetrics(envelope *loggregator_v2.Envelope, metricSlice pme dataPoint.SetDoubleValue(float64(message.Counter.GetTotal())) dataPoint.SetTimestamp(pcommon.Timestamp(envelope.GetTimestamp())) dataPoint.SetStartTimestamp(pcommon.NewTimestampFromTime(startTime)) - copyEnvelopeAttributes(dataPoint.Attributes(), envelope) + if allowResourceAttributes.IsEnabled() { + attrs := getEnvelopeDataAttributes(envelope) + attrs.CopyTo(dataPoint.Attributes()) + } else { + copyEnvelopeAttributes(dataPoint.Attributes(), envelope) + } case *loggregator_v2.Envelope_Gauge: for name, value := range message.Gauge.GetMetrics() { metric := metricSlice.AppendEmpty() @@ -37,7 +69,12 @@ func convertEnvelopeToMetrics(envelope *loggregator_v2.Envelope, metricSlice pme dataPoint.SetDoubleValue(value.Value) dataPoint.SetTimestamp(pcommon.Timestamp(envelope.GetTimestamp())) dataPoint.SetStartTimestamp(pcommon.NewTimestampFromTime(startTime)) - copyEnvelopeAttributes(dataPoint.Attributes(), envelope) + if allowResourceAttributes.IsEnabled() { + attrs := getEnvelopeDataAttributes(envelope) + attrs.CopyTo(dataPoint.Attributes()) + } else { + copyEnvelopeAttributes(dataPoint.Attributes(), envelope) + } } } } @@ -59,7 +96,12 @@ func convertEnvelopeToLogs(envelope *loggregator_v2.Envelope, logSlice plog.LogR default: return fmt.Errorf("unsupported envelope log type: %s", envelope.GetLog().GetType()) } - copyEnvelopeAttributes(log.Attributes(), envelope) + if allowResourceAttributes.IsEnabled() { + attrs := getEnvelopeDataAttributes(envelope) + attrs.CopyTo(log.Attributes()) + } else { + copyEnvelopeAttributes(log.Attributes(), envelope) + } return nil } @@ -74,3 +116,29 @@ func copyEnvelopeAttributes(attributes pcommon.Map, envelope *loggregator_v2.Env attributes.PutStr(attributeNamePrefix+"instance_id", envelope.InstanceId) } } + +func getEnvelopeDataAttributes(envelope *loggregator_v2.Envelope) pcommon.Map { + attrs := pcommon.NewMap() + for key, value := range envelope.Tags { + if !slices.Contains(ResourceAttributesKeys, key) { + attrs.PutStr(attributeNamePrefix+key, value) + } + } + return attrs +} + +func getEnvelopeResourceAttributes(envelope *loggregator_v2.Envelope) pcommon.Map { + attrs := pcommon.NewMap() + for key, value := range envelope.Tags { + if slices.Contains(ResourceAttributesKeys, key) { + attrs.PutStr(attributeNamePrefix+key, value) + } + } + if envelope.SourceId != "" { + attrs.PutStr(attributeNamePrefix+"source_id", envelope.SourceId) + } + if envelope.InstanceId != "" { + attrs.PutStr(attributeNamePrefix+"instance_id", envelope.InstanceId) + } + return attrs +} diff --git a/receiver/cloudfoundryreceiver/converter_test.go b/receiver/cloudfoundryreceiver/converter_test.go index ffe0496948ba..218575cf839b 100644 --- a/receiver/cloudfoundryreceiver/converter_test.go +++ b/receiver/cloudfoundryreceiver/converter_test.go @@ -10,6 +10,7 @@ import ( "code.cloudfoundry.org/go-loggregator/rpc/loggregator_v2" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + "go.opentelemetry.io/collector/featuregate" "go.opentelemetry.io/collector/pdata/pcommon" "go.opentelemetry.io/collector/pdata/plog" "go.opentelemetry.io/collector/pdata/pmetric" @@ -28,6 +29,7 @@ func TestConvertCountEnvelope(t *testing.T) { "job": "router", "index": "bc276108-8282-48a5-bae7-c009c4392246", "ip": "10.244.0.34", + "custom": "datapoint", }, Message: &loggregator_v2.Envelope_Counter{ Counter: &loggregator_v2.Counter{ @@ -38,30 +40,64 @@ func TestConvertCountEnvelope(t *testing.T) { }, } - metricSlice := pmetric.NewMetricSlice() - - convertEnvelopeToMetrics(&envelope, metricSlice, before) - - require.Equal(t, 1, metricSlice.Len()) - - metric := metricSlice.At(0) - assert.Equal(t, "gorouter.bad_gateways", metric.Name()) - assert.Equal(t, pmetric.MetricTypeSum, metric.Type()) - dataPoints := metric.Sum().DataPoints() - assert.Equal(t, 1, dataPoints.Len()) - dataPoint := dataPoints.At(0) - assert.Equal(t, pcommon.NewTimestampFromTime(now), dataPoint.Timestamp()) - assert.Equal(t, pcommon.NewTimestampFromTime(before), dataPoint.StartTimestamp()) - assert.Equal(t, 10.0, dataPoint.DoubleValue()) - - assertAttributes(t, map[string]string{ + expectedAttributes := map[string]string{ "org.cloudfoundry.source_id": "uaa", "org.cloudfoundry.origin": "gorouter", "org.cloudfoundry.deployment": "cf", "org.cloudfoundry.job": "router", "org.cloudfoundry.index": "bc276108-8282-48a5-bae7-c009c4392246", "org.cloudfoundry.ip": "10.244.0.34", - }, dataPoint.Attributes()) + "org.cloudfoundry.custom": "datapoint", + } + + tests := []struct { + name string + envelope loggregator_v2.Envelope + expected map[string]string + resourceAttrs bool + }{ + { + name: "resource attributes true", + envelope: envelope, + expected: map[string]string{ + "org.cloudfoundry.custom": "datapoint", + }, + resourceAttrs: true, + }, + { + name: "resource attributes false", + envelope: envelope, + expected: expectedAttributes, + resourceAttrs: false, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + resourceMetricSlice := pmetric.NewResourceMetricsSlice() + + if tt.resourceAttrs { + require.NoError(t, featuregate.GlobalRegistry().Set(allowResourceAttributes.ID(), true)) + t.Cleanup(func() { + require.NoError(t, featuregate.GlobalRegistry().Set(allowResourceAttributes.ID(), false)) + }) + } + + convertEnvelopeToMetrics(&tt.envelope, resourceMetricSlice.AppendEmpty().ScopeMetrics().AppendEmpty().Metrics(), before) + + require.Equal(t, 1, resourceMetricSlice.Len()) + + metric := resourceMetricSlice.At(0).ScopeMetrics().At(0).Metrics().At(0) + assert.Equal(t, "gorouter.bad_gateways", metric.Name()) + assert.Equal(t, pmetric.MetricTypeSum, metric.Type()) + dataPoints := metric.Sum().DataPoints() + assert.Equal(t, 1, dataPoints.Len()) + dataPoint := dataPoints.At(0) + assert.Equal(t, pcommon.NewTimestampFromTime(now), dataPoint.Timestamp()) + assert.Equal(t, pcommon.NewTimestampFromTime(before), dataPoint.StartTimestamp()) + assert.Equal(t, 10.0, dataPoint.DoubleValue()) + assertAttributes(t, tt.expected, dataPoint.Attributes()) + }) + } } func TestConvertGaugeEnvelope(t *testing.T) { @@ -81,6 +117,7 @@ func TestConvertGaugeEnvelope(t *testing.T) { "job": "compute", "index": "7505d2c9-beab-4aaa-afe3-41322ebcd13d", "ip": "10.0.4.8", + "custom": "datapoint", }, Message: &loggregator_v2.Envelope_Gauge{ Gauge: &loggregator_v2.Gauge{ @@ -109,38 +146,74 @@ func TestConvertGaugeEnvelope(t *testing.T) { "org.cloudfoundry.job": "compute", "org.cloudfoundry.index": "7505d2c9-beab-4aaa-afe3-41322ebcd13d", "org.cloudfoundry.ip": "10.0.4.8", + "org.cloudfoundry.custom": "datapoint", } - metricSlice := pmetric.NewMetricSlice() + tests := []struct { + name string + envelope loggregator_v2.Envelope + expected map[string]string + resourceAttrs bool + }{ + { + name: "resource attributes true", + envelope: envelope, + expected: map[string]string{ + "org.cloudfoundry.custom": "datapoint", + }, + resourceAttrs: true, + }, + { + name: "resource attributes false", + envelope: envelope, + expected: expectedAttributes, + resourceAttrs: false, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + resourceMetricSlice := pmetric.NewResourceMetricsSlice() - convertEnvelopeToMetrics(&envelope, metricSlice, before) + if tt.resourceAttrs { + require.NoError(t, featuregate.GlobalRegistry().Set(allowResourceAttributes.ID(), true)) + t.Cleanup(func() { + require.NoError(t, featuregate.GlobalRegistry().Set(allowResourceAttributes.ID(), false)) + }) + } - require.Equal(t, 2, metricSlice.Len()) - memoryMetricPosition := 0 + convertEnvelopeToMetrics(&tt.envelope, resourceMetricSlice.AppendEmpty().ScopeMetrics().AppendEmpty().Metrics(), before) - if metricSlice.At(1).Name() == "rep.memory" { - memoryMetricPosition = 1 - } + require.Equal(t, 1, resourceMetricSlice.Len()) + + metricSlice := resourceMetricSlice.At(0).ScopeMetrics().At(0).Metrics() + require.Equal(t, 2, metricSlice.Len()) + memoryMetricPosition := 0 + + if metricSlice.At(1).Name() == "rep.memory" { + memoryMetricPosition = 1 + } - metric := metricSlice.At(memoryMetricPosition) - assert.Equal(t, "rep.memory", metric.Name()) - assert.Equal(t, pmetric.MetricTypeGauge, metric.Type()) - assert.Equal(t, 1, metric.Gauge().DataPoints().Len()) - dataPoint := metric.Gauge().DataPoints().At(0) - assert.Equal(t, pcommon.NewTimestampFromTime(now), dataPoint.Timestamp()) - assert.Equal(t, pcommon.NewTimestampFromTime(before), dataPoint.StartTimestamp()) - assert.Equal(t, 17046641.0, dataPoint.DoubleValue()) - assertAttributes(t, expectedAttributes, dataPoint.Attributes()) - - metric = metricSlice.At(1 - memoryMetricPosition) - assert.Equal(t, "rep.disk", metric.Name()) - assert.Equal(t, pmetric.MetricTypeGauge, metric.Type()) - assert.Equal(t, 1, metric.Gauge().DataPoints().Len()) - dataPoint = metric.Gauge().DataPoints().At(0) - assert.Equal(t, pcommon.NewTimestampFromTime(now), dataPoint.Timestamp()) - assert.Equal(t, pcommon.NewTimestampFromTime(before), dataPoint.StartTimestamp()) - assert.Equal(t, 10231808.0, dataPoint.DoubleValue()) - assertAttributes(t, expectedAttributes, dataPoint.Attributes()) + metric := metricSlice.At(memoryMetricPosition) + assert.Equal(t, "rep.memory", metric.Name()) + assert.Equal(t, pmetric.MetricTypeGauge, metric.Type()) + assert.Equal(t, 1, metric.Gauge().DataPoints().Len()) + dataPoint := metric.Gauge().DataPoints().At(0) + assert.Equal(t, pcommon.NewTimestampFromTime(now), dataPoint.Timestamp()) + assert.Equal(t, pcommon.NewTimestampFromTime(before), dataPoint.StartTimestamp()) + assert.Equal(t, 17046641.0, dataPoint.DoubleValue()) + assertAttributes(t, tt.expected, dataPoint.Attributes()) + + metric = metricSlice.At(1 - memoryMetricPosition) + assert.Equal(t, "rep.disk", metric.Name()) + assert.Equal(t, pmetric.MetricTypeGauge, metric.Type()) + assert.Equal(t, 1, metric.Gauge().DataPoints().Len()) + dataPoint = metric.Gauge().DataPoints().At(0) + assert.Equal(t, pcommon.NewTimestampFromTime(now), dataPoint.Timestamp()) + assert.Equal(t, pcommon.NewTimestampFromTime(before), dataPoint.StartTimestamp()) + assert.Equal(t, 10231808.0, dataPoint.DoubleValue()) + assertAttributes(t, tt.expected, dataPoint.Attributes()) + }) + } } func TestConvertLogsEnvelope(t *testing.T) { @@ -148,16 +221,19 @@ func TestConvertLogsEnvelope(t *testing.T) { before := time.Now().Add(-time.Second) t.Parallel() tests := []struct { - id string - envelope loggregator_v2.Envelope - expected map[string]any + id string + envelope loggregator_v2.Envelope + expected map[string]any + resourceAttrs bool }{ { id: "normal-without-sourcetype-tag", envelope: loggregator_v2.Envelope{ Timestamp: before.UnixNano(), SourceId: "744e75bb-69d1-4cf4-b037-76875368097b", - Tags: map[string]string{}, + Tags: map[string]string{ + "custom": "datapoint", + }, Message: &loggregator_v2.Envelope_Log{ Log: &loggregator_v2.Log{ Payload: []byte(`test-app. Says Hello. on index: 0`), @@ -169,11 +245,38 @@ func TestConvertLogsEnvelope(t *testing.T) { "Timestamp": before, "Attributes": map[string]string{ "org.cloudfoundry.source_id": "744e75bb-69d1-4cf4-b037-76875368097b", + "org.cloudfoundry.custom": "datapoint", + }, + "Body": `test-app. Says Hello. on index: 0`, + "SeverityNumber": plog.SeverityNumberInfo, + "SeverityText": plog.SeverityNumberInfo.String(), + }, + }, + { + id: "normal-without-sourcetype-tag-resource-attrs", + envelope: loggregator_v2.Envelope{ + Timestamp: before.UnixNano(), + SourceId: "744e75bb-69d1-4cf4-b037-76875368097b", + Tags: map[string]string{ + "custom": "datapoint", + }, + Message: &loggregator_v2.Envelope_Log{ + Log: &loggregator_v2.Log{ + Payload: []byte(`test-app. Says Hello. on index: 0`), + Type: loggregator_v2.Log_OUT, + }, + }, + }, + expected: map[string]any{ + "Timestamp": before, + "Attributes": map[string]string{ + "org.cloudfoundry.custom": "datapoint", }, "Body": `test-app. Says Hello. on index: 0`, "SeverityNumber": plog.SeverityNumberInfo, "SeverityText": plog.SeverityNumberInfo.String(), }, + resourceAttrs: true, }, { id: "json-log-with-sourcetype-error", @@ -187,6 +290,7 @@ func TestConvertLogsEnvelope(t *testing.T) { "job": "diego-cell", "index": "bc276108-8282-48a5-bae7-c009c4392246", "ip": "10.80.0.2", + "custom": "datapoint", }, Message: &loggregator_v2.Envelope_Log{ Log: &loggregator_v2.Log{ @@ -205,20 +309,60 @@ func TestConvertLogsEnvelope(t *testing.T) { "org.cloudfoundry.job": "diego-cell", "org.cloudfoundry.index": "bc276108-8282-48a5-bae7-c009c4392246", "org.cloudfoundry.ip": "10.80.0.2", + "org.cloudfoundry.custom": "datapoint", }, "Body": `{"timestamp":"2024-05-29T16:16:28.063062903Z","level":"info","source":"guardian","message":"guardian.api.garden-server.get-properties.got-properties","data":{"handle":"e885e8be-c6a7-43b1-5066-a821","session":"2.1.209666"}}`, "SeverityNumber": plog.SeverityNumberError, "SeverityText": plog.SeverityNumberError.String(), }, }, + { + id: "json-log-with-sourcetype-error-resource-attrs", + envelope: loggregator_v2.Envelope{ + Timestamp: before.UnixNano(), + SourceId: "df75aec8-b937-4dc8-9b4d-c336e36e3895", + Tags: map[string]string{ + "source_type": "APP/PROC/WEB", + "origin": "rep", + "deployment": "cf", + "job": "diego-cell", + "index": "bc276108-8282-48a5-bae7-c009c4392246", + "ip": "10.80.0.2", + "custom": "datapoint", + }, + Message: &loggregator_v2.Envelope_Log{ + Log: &loggregator_v2.Log{ + Payload: []byte(`{"timestamp":"2024-05-29T16:16:28.063062903Z","level":"info","source":"guardian","message":"guardian.api.garden-server.get-properties.got-properties","data":{"handle":"e885e8be-c6a7-43b1-5066-a821","session":"2.1.209666"}}`), + Type: loggregator_v2.Log_ERR, + }, + }, + }, + expected: map[string]any{ + "Timestamp": before, + "Attributes": map[string]string{ + "org.cloudfoundry.custom": "datapoint", + }, + "Body": `{"timestamp":"2024-05-29T16:16:28.063062903Z","level":"info","source":"guardian","message":"guardian.api.garden-server.get-properties.got-properties","data":{"handle":"e885e8be-c6a7-43b1-5066-a821","session":"2.1.209666"}}`, + "SeverityNumber": plog.SeverityNumberError, + "SeverityText": plog.SeverityNumberError.String(), + }, + resourceAttrs: true, + }, } for _, tt := range tests { t.Run(tt.id, func(t *testing.T) { - logSlice := plog.NewLogRecordSlice() - e := convertEnvelopeToLogs(&tt.envelope, logSlice, now) + resourceLogSlice := plog.NewResourceLogsSlice() + if tt.resourceAttrs { + require.NoError(t, featuregate.GlobalRegistry().Set(allowResourceAttributes.ID(), true)) + t.Cleanup(func() { + require.NoError(t, featuregate.GlobalRegistry().Set(allowResourceAttributes.ID(), false)) + }) + } + e := convertEnvelopeToLogs(&tt.envelope, resourceLogSlice.AppendEmpty().ScopeLogs().AppendEmpty().LogRecords(), now) require.NoError(t, e) - require.Equal(t, 1, logSlice.Len()) - log := logSlice.At(0) + require.Equal(t, 1, resourceLogSlice.Len()) + + log := resourceLogSlice.At(0).ScopeLogs().At(0).LogRecords().At(0) assert.Equal(t, tt.expected["Body"], log.Body().AsString()) assert.Equal(t, tt.expected["SeverityText"], log.SeverityText()) assert.Equal(t, pcommon.NewTimestampFromTime(tt.expected["Timestamp"].(time.Time)), log.Timestamp()) diff --git a/receiver/cloudfoundryreceiver/go.mod b/receiver/cloudfoundryreceiver/go.mod index 77e89aaafa23..90ac1e559e67 100644 --- a/receiver/cloudfoundryreceiver/go.mod +++ b/receiver/cloudfoundryreceiver/go.mod @@ -15,6 +15,7 @@ require ( go.opentelemetry.io/collector/confmap v1.22.0 go.opentelemetry.io/collector/consumer v1.22.0 go.opentelemetry.io/collector/consumer/consumertest v0.116.0 + go.opentelemetry.io/collector/featuregate v1.22.0 go.opentelemetry.io/collector/pdata v1.22.0 go.opentelemetry.io/collector/receiver v0.116.0 go.opentelemetry.io/collector/receiver/receivertest v0.116.0 @@ -23,7 +24,7 @@ require ( ) require ( - code.cloudfoundry.org/go-diodes v0.0.0-20211115184647-b584dd5df32c // indirect + code.cloudfoundry.org/go-diodes v0.0.0-20241007161556-ec30366c7912 // indirect code.cloudfoundry.org/rfc5424 v0.0.0-20201103192249-000122071b78 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/felixge/httpsnoop v1.0.4 // indirect @@ -35,6 +36,7 @@ require ( github.com/golang/protobuf v1.5.4 // indirect github.com/golang/snappy v0.0.4 // indirect github.com/google/uuid v1.6.0 // indirect + github.com/hashicorp/go-version v1.7.0 // indirect github.com/json-iterator/go v1.1.12 // indirect github.com/klauspost/compress v1.17.11 // indirect github.com/knadh/koanf/maps v0.1.1 // indirect @@ -45,7 +47,6 @@ require ( github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.2 // indirect github.com/onsi/ginkgo v1.16.5 // indirect - github.com/onsi/gomega v1.17.0 // indirect github.com/pierrec/lz4/v4 v4.1.21 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/rs/cors v1.11.1 // indirect diff --git a/receiver/cloudfoundryreceiver/go.sum b/receiver/cloudfoundryreceiver/go.sum index 8f1330566bce..eb07f375663d 100644 --- a/receiver/cloudfoundryreceiver/go.sum +++ b/receiver/cloudfoundryreceiver/go.sum @@ -1,5 +1,5 @@ -code.cloudfoundry.org/go-diodes v0.0.0-20211115184647-b584dd5df32c h1:N2GMlHc/SJQk7BkaME/kDHaciVTy4NuRmxVJLhnqKK8= -code.cloudfoundry.org/go-diodes v0.0.0-20211115184647-b584dd5df32c/go.mod h1:o7lq/SmHshDVxHdRJ/fMT3VPcoXyE1HcRXbG8QibO3k= +code.cloudfoundry.org/go-diodes v0.0.0-20241007161556-ec30366c7912 h1:4Lj5tSZsoT1Fn98SdQHt4pjaUeopFH7/7pFHpuMJCyM= +code.cloudfoundry.org/go-diodes v0.0.0-20241007161556-ec30366c7912/go.mod h1:UswWmjC8YkMF7v0jCgMOWNRfqJoTTBbpRzX3Emk2HBU= code.cloudfoundry.org/go-loggregator v7.4.0+incompatible h1:KqZYloMQWM5Zg/BQKunOIA4OODh7djZbk48qqbowNFI= code.cloudfoundry.org/go-loggregator v7.4.0+incompatible/go.mod h1:KPBTRqj+y738Nhf1+g4JHFaBU8j7dedirR5ETNHvMXU= code.cloudfoundry.org/rfc5424 v0.0.0-20201103192249-000122071b78 h1:mrZQaZmuDIPhSp6b96b+CRKC2uH44ifa5cjDV2epKis= @@ -20,7 +20,10 @@ 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-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0 h1:p104kn46Q8WdvHunIJ9dAyjPVtrBPhSr3KT2yUst43I= github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE= +github.com/go-task/slim-sprig/v3 v3.0.0 h1:sUs3vkvUymDpBKi3qH1YSqBQk9+9D/8M2mN1vB6EwHI= +github.com/go-task/slim-sprig/v3 v3.0.0/go.mod h1:W848ghGpv3Qj3dhTPRyJypKRiqCdHZiAzKg9hl15HA8= 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= @@ -32,8 +35,6 @@ github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrU github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= -github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= -github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM= @@ -41,12 +42,15 @@ github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEW github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= 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/pprof v0.0.0-20240827171923-fa2c70bbbfe5 h1:5iH8iuqE5apketRbSFBy+X1V0o+l+8NF1avt4HWl7cA= +github.com/google/pprof v0.0.0-20240827171923-fa2c70bbbfe5/go.mod h1:vavhavw2zAxS5dIdcRluK6cSGGPlZynqzFM8NdvU144= 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/hashicorp/go-version v1.7.0 h1:5tqGy27NaOTB8yJKUZELlFAS/LTKJkrmONwQKeRZfjY= +github.com/hashicorp/go-version v1.7.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= @@ -78,15 +82,14 @@ github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE= github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU= github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= -github.com/onsi/ginkgo v1.16.2/go.mod h1:CObGmKUOKaSC0RjmoAK7tKyn4Azo5P2IWuoMnvwxz1E= -github.com/onsi/ginkgo v1.16.4/go.mod h1:dX+/inL/fNMqNlz0e9LfyB9TswhZpCVdJM/Z6Vvnwo0= github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE= github.com/onsi/ginkgo v1.16.5/go.mod h1:+E8gABHa3K6zRBolWtd+ROzc/U5bkGt0FwiG042wbpU= +github.com/onsi/ginkgo/v2 v2.20.2 h1:7NVCeyIWROIAheY21RLS+3j2bb52W0W82tkberYytp4= +github.com/onsi/ginkgo/v2 v2.20.2/go.mod h1:K9gyxPIlb+aIvnZ8bd9Ak+YP18w3APlR+5coaZoE2ag= github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= -github.com/onsi/gomega v1.13.0/go.mod h1:lRk9szgn8TxENtWd0Tp4c3wjlRfMTMH27I+3Je41yGY= -github.com/onsi/gomega v1.17.0 h1:9Luw4uT5HTjHTN8+aNcSThgH1vdXnmdJ8xIfZ4wyTRE= -github.com/onsi/gomega v1.17.0/go.mod h1:HnhC7FXeEQY45zxNK3PPoIUhzk/80Xly9PcubAlGdZY= +github.com/onsi/gomega v1.34.2 h1:pNCwDkzrsv7MS9kpaQvVb1aVLahQXyJ/Tv5oAZMI3i8= +github.com/onsi/gomega v1.34.2/go.mod h1:v1xfxRgk0KIsG+QOdm7p8UosrOzPYRo60fd3B/1Dukc= github.com/pierrec/lz4/v4 v4.1.21 h1:yOVMLb6qSIDP67pl/5F7RepeKYu/VmTyEXvuMI5d9mQ= github.com/pierrec/lz4/v4 v4.1.21/go.mod h1:gZWDp/Ze/IJXGXf23ltt2EXimqmTUXEy0GFuRQyBid4= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= @@ -140,6 +143,8 @@ go.opentelemetry.io/collector/extension/auth v0.116.0 h1:oolKkFBIS4vhJ4ZWTD4Bp+3 go.opentelemetry.io/collector/extension/auth v0.116.0/go.mod h1:3WeZgIiiP7wcB+tID4G3ml6J/R2oJ359PxQh/pUFnSk= go.opentelemetry.io/collector/extension/auth/authtest v0.116.0 h1:KcMvjb4R0wpkmmi7EOk7zT5sgl7uwXY/VQfMEUVYcLM= go.opentelemetry.io/collector/extension/auth/authtest v0.116.0/go.mod h1:zyWTdh+CUKh7BbszTWUWp806NA6EDyix77O4Q6XaOA8= +go.opentelemetry.io/collector/featuregate v1.22.0 h1:1TUcdqA5VpEsX1Lrr6GG15CptZxDXxiu5AXgwpeNSR4= +go.opentelemetry.io/collector/featuregate v1.22.0/go.mod h1:3GaXqflNDVwWndNGBJ1+XJFy3Fv/XrFgjMN60N3z7yg= go.opentelemetry.io/collector/pdata v1.22.0 h1:3yhjL46NLdTMoP8rkkcE9B0pzjf2973crn0KKhX5UrI= go.opentelemetry.io/collector/pdata v1.22.0/go.mod h1:nLLf6uDg8Kn5g3WNZwGyu8+kf77SwOqQvMTb5AXEbEY= go.opentelemetry.io/collector/pdata/pprofile v0.116.0 h1:iE6lqkO7Hi6lTIIml1RI7yQ55CKqW12R2qHinwF5Zuk= @@ -183,7 +188,6 @@ golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLL golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT/9KSuxbyM7479/AVlXFRxuMCk= golang.org/x/net v0.32.0 h1:ZqPmj8Kzc+Y6e0+skZsuACbx+wzMgo5MQsJh9Qd6aYI= golang.org/x/net v0.32.0/go.mod h1:CwU0IoeOlnQQWJ6ioyFrfRuomB8GKF6KbYXZVyeXNfs= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -198,15 +202,11 @@ golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.28.0 h1:Fksou7UEQUWlKvIdsqzJmUmCX3cZuD2+P3XyyzwMhlA= golang.org/x/sys v0.28.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= 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.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.21.0 h1:zyQAAkrwaneQ066sspRyJaG9VNi/YJ1NfzcGB3hZ/qo= golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -214,6 +214,8 @@ golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtn golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.24.0 h1:J1shsA93PJUEVaUSaay7UXAyE8aimq3GW0pjlolpa24= +golang.org/x/tools v0.24.0/go.mod h1:YhNqVBIfWHdzvTLs0d8LCuMhkKUgSUKldakyV7W/WDQ= 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= @@ -228,8 +230,6 @@ google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQ google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= -google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.35.2 h1:8Ar7bF+apOIoThw1EdZl0p1oWvMqTHmpA2fRTyZO8io= google.golang.org/protobuf v1.35.2/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= @@ -241,7 +241,5 @@ gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWD gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= -gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= 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/receiver/cloudfoundryreceiver/receiver.go b/receiver/cloudfoundryreceiver/receiver.go index 4084af4f5650..c5d3deb06d3b 100644 --- a/receiver/cloudfoundryreceiver/receiver.go +++ b/receiver/cloudfoundryreceiver/receiver.go @@ -7,10 +7,12 @@ import ( "context" "errors" "fmt" + "reflect" "sync" "time" "code.cloudfoundry.org/go-loggregator" + "code.cloudfoundry.org/go-loggregator/rpc/loggregator_v2" "go.opentelemetry.io/collector/component" "go.opentelemetry.io/collector/component/componentstatus" "go.opentelemetry.io/collector/consumer" @@ -171,15 +173,12 @@ func (cfr *cloudFoundryReceiver) streamMetrics( break } metrics := pmetric.NewMetrics() - libraryMetrics := createLibraryMetricsSlice(metrics) for _, envelope := range envelopes { if envelope != nil { - // There is no concept of startTime in CF loggregator, and we do not know the uptime of the component - // from which the metric originates, so just provide receiver start time as metric start time - convertEnvelopeToMetrics(envelope, libraryMetrics, cfr.receiverStartTime) + buildMetrics(metrics, envelope, cfr.receiverStartTime) } } - if libraryMetrics.Len() > 0 { + if metrics.ResourceMetrics().Len() > 0 { obsCtx := cfr.obsrecv.StartMetricsOp(ctx) err := cfr.nextMetrics.ConsumeMetrics(ctx, metrics) if err != nil { @@ -209,14 +208,13 @@ func (cfr *cloudFoundryReceiver) streamLogs( break } logs := plog.NewLogs() - libraryLogs := createLibraryLogsSlice(logs) observedTime := time.Now() for _, envelope := range envelopes { if envelope != nil { - _ = convertEnvelopeToLogs(envelope, libraryLogs, observedTime) + buildLogs(logs, envelope, observedTime) } } - if libraryLogs.Len() > 0 { + if logs.ResourceLogs().Len() > 0 { obsCtx := cfr.obsrecv.StartLogsOp(ctx) err := cfr.nextLogs.ConsumeLogs(ctx, logs) if err != nil { @@ -227,16 +225,60 @@ func (cfr *cloudFoundryReceiver) streamLogs( } } -func createLibraryMetricsSlice(metrics pmetric.Metrics) pmetric.MetricSlice { - resourceMetric := metrics.ResourceMetrics().AppendEmpty() - libraryMetrics := resourceMetric.ScopeMetrics().AppendEmpty() - libraryMetrics.Scope().SetName(metadata.ScopeName) - return libraryMetrics.Metrics() +func buildLogs(logs plog.Logs, envelope *loggregator_v2.Envelope, observedTime time.Time) { + resourceLogs := getResourceLogs(logs, envelope) + setupLogsScope(resourceLogs) + _ = convertEnvelopeToLogs(envelope, resourceLogs.ScopeLogs().At(0).LogRecords(), observedTime) } -func createLibraryLogsSlice(logs plog.Logs) plog.LogRecordSlice { - resourceLog := logs.ResourceLogs().AppendEmpty() - libraryLogs := resourceLog.ScopeLogs().AppendEmpty() - libraryLogs.Scope().SetName(metadata.ScopeName) - return libraryLogs.LogRecords() +func buildMetrics(metrics pmetric.Metrics, envelope *loggregator_v2.Envelope, observedTime time.Time) { + resourceMetrics := getResourceMetrics(metrics, envelope) + setupMetricsScope(resourceMetrics) + convertEnvelopeToMetrics(envelope, resourceMetrics.ScopeMetrics().At(0).Metrics(), observedTime) +} + +func setupMetricsScope(resourceMetrics pmetric.ResourceMetrics) { + if resourceMetrics.ScopeMetrics().Len() == 0 { + libraryMetrics := resourceMetrics.ScopeMetrics().AppendEmpty() + libraryMetrics.Scope().SetName(metadata.ScopeName) + } +} + +func getResourceMetrics(metrics pmetric.Metrics, envelope *loggregator_v2.Envelope) pmetric.ResourceMetrics { + if !allowResourceAttributes.IsEnabled() { + return metrics.ResourceMetrics().AppendEmpty() + } + + attrs := getEnvelopeResourceAttributes(envelope) + for i := 0; i < metrics.ResourceMetrics().Len(); i++ { + if reflect.DeepEqual(metrics.ResourceMetrics().At(i).Resource().Attributes().AsRaw(), attrs.AsRaw()) { + return metrics.ResourceMetrics().At(i) + } + } + resource := metrics.ResourceMetrics().AppendEmpty() + attrs.CopyTo(resource.Resource().Attributes()) + return resource +} + +func setupLogsScope(resourceLogs plog.ResourceLogs) { + if resourceLogs.ScopeLogs().Len() == 0 { + libraryLogs := resourceLogs.ScopeLogs().AppendEmpty() + libraryLogs.Scope().SetName(metadata.ScopeName) + } +} + +func getResourceLogs(logs plog.Logs, envelope *loggregator_v2.Envelope) plog.ResourceLogs { + if !allowResourceAttributes.IsEnabled() { + return logs.ResourceLogs().AppendEmpty() + } + + attrs := getEnvelopeResourceAttributes(envelope) + for i := 0; i < logs.ResourceLogs().Len(); i++ { + if reflect.DeepEqual(logs.ResourceLogs().At(i).Resource().Attributes().AsRaw(), attrs.AsRaw()) { + return logs.ResourceLogs().At(i) + } + } + resource := logs.ResourceLogs().AppendEmpty() + attrs.CopyTo(resource.Resource().Attributes()) + return resource } diff --git a/receiver/cloudfoundryreceiver/receiver_test.go b/receiver/cloudfoundryreceiver/receiver_test.go index eec1da92e50c..b5ce98a5191b 100644 --- a/receiver/cloudfoundryreceiver/receiver_test.go +++ b/receiver/cloudfoundryreceiver/receiver_test.go @@ -6,11 +6,18 @@ package cloudfoundryreceiver import ( "context" "testing" + "time" + "code.cloudfoundry.org/go-loggregator/rpc/loggregator_v2" "github.com/stretchr/testify/require" "go.opentelemetry.io/collector/component/componenttest" "go.opentelemetry.io/collector/consumer/consumertest" + "go.opentelemetry.io/collector/featuregate" + "go.opentelemetry.io/collector/pdata/plog" + "go.opentelemetry.io/collector/pdata/pmetric" "go.opentelemetry.io/collector/receiver/receivertest" + + "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/cloudfoundryreceiver/internal/metadata" ) // Test to make sure a new metrics receiver can be created properly, started and shutdown with the default config @@ -62,3 +69,651 @@ func TestDefaultValidLogsReceiver(t *testing.T) { err = receiver.Shutdown(ctx) require.NoError(t, err) } + +func TestSetupMetricsScope(t *testing.T) { + resourceSetup := pmetric.NewResourceMetrics() + scope := resourceSetup.ScopeMetrics().AppendEmpty() + scope.Scope().SetName(metadata.ScopeName) + + tests := []struct { + name string + in pmetric.ResourceMetrics + out pmetric.ResourceMetrics + }{ + { + name: "scope empty", + in: pmetric.NewResourceMetrics(), + out: resourceSetup, + }, + { + name: "scope set", + in: resourceSetup, + out: resourceSetup, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + setupMetricsScope(tt.in) + require.Equal(t, tt.out, tt.in) + }) + } +} + +func TestGetResourceMetrics(t *testing.T) { + metrics := pmetric.NewMetrics() + resource := metrics.ResourceMetrics().AppendEmpty() + resource.Resource().Attributes().PutStr("org.cloudfoundry.origin", "rep") + + resource2 := pmetric.NewResourceMetrics() + resource2.Resource().Attributes().PutStr("org.cloudfoundry.origin", "rep2") + + tests := []struct { + name string + resourceAttrs bool + envelope loggregator_v2.Envelope + metrics pmetric.Metrics + expected pmetric.ResourceMetrics + }{ + { + name: "resource attributes false", + envelope: loggregator_v2.Envelope{}, + resourceAttrs: false, + metrics: pmetric.NewMetrics(), + expected: pmetric.NewResourceMetrics(), + }, + { + name: "empty metrics", + envelope: loggregator_v2.Envelope{}, + resourceAttrs: true, + metrics: pmetric.NewMetrics(), + expected: pmetric.NewResourceMetrics(), + }, + { + name: "matched resource metrics", + envelope: loggregator_v2.Envelope{ + Tags: map[string]string{ + "origin": "rep", + "custom": "datapoint", + }, + }, + resourceAttrs: true, + metrics: metrics, + expected: resource, + }, + { + name: "non-matched resource metrics", + envelope: loggregator_v2.Envelope{ + Tags: map[string]string{ + "origin": "rep2", + "custom": "datapoint", + }, + }, + resourceAttrs: true, + metrics: metrics, + expected: resource2, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + if tt.resourceAttrs { + require.NoError(t, featuregate.GlobalRegistry().Set(allowResourceAttributes.ID(), true)) + t.Cleanup(func() { + require.NoError(t, featuregate.GlobalRegistry().Set(allowResourceAttributes.ID(), false)) + }) + } + require.Equal(t, tt.expected, getResourceMetrics(tt.metrics, &tt.envelope)) + }) + } +} + +func TestSetupLogsScope(t *testing.T) { + resourceSetup := plog.NewResourceLogs() + scope := resourceSetup.ScopeLogs().AppendEmpty() + scope.Scope().SetName(metadata.ScopeName) + + tests := []struct { + name string + in plog.ResourceLogs + out plog.ResourceLogs + }{ + { + name: "scope empty", + in: plog.NewResourceLogs(), + out: resourceSetup, + }, + { + name: "scope set", + in: resourceSetup, + out: resourceSetup, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + setupLogsScope(tt.in) + require.Equal(t, tt.out, tt.in) + }) + } +} + +func TestGetResourceLogs(t *testing.T) { + logs := plog.NewLogs() + resource := logs.ResourceLogs().AppendEmpty() + resource.Resource().Attributes().PutStr("org.cloudfoundry.origin", "rep") + + resource2 := plog.NewResourceLogs() + resource2.Resource().Attributes().PutStr("org.cloudfoundry.origin", "rep2") + + tests := []struct { + name string + resourceAttrs bool + envelope loggregator_v2.Envelope + logs plog.Logs + expected plog.ResourceLogs + }{ + { + name: "resource attributes false", + envelope: loggregator_v2.Envelope{}, + resourceAttrs: false, + logs: plog.NewLogs(), + expected: plog.NewResourceLogs(), + }, + { + name: "empty logs", + envelope: loggregator_v2.Envelope{}, + resourceAttrs: true, + logs: plog.NewLogs(), + expected: plog.NewResourceLogs(), + }, + { + name: "matched resource logs", + envelope: loggregator_v2.Envelope{ + Tags: map[string]string{ + "origin": "rep", + "custom": "datapoint", + }, + }, + resourceAttrs: true, + logs: logs, + expected: resource, + }, + { + name: "non-matched resource logs", + envelope: loggregator_v2.Envelope{ + Tags: map[string]string{ + "origin": "rep2", + "custom": "datapoint", + }, + }, + resourceAttrs: true, + logs: logs, + expected: resource2, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + if tt.resourceAttrs { + require.NoError(t, featuregate.GlobalRegistry().Set(allowResourceAttributes.ID(), true)) + t.Cleanup(func() { + require.NoError(t, featuregate.GlobalRegistry().Set(allowResourceAttributes.ID(), false)) + }) + } + require.Equal(t, tt.expected, getResourceLogs(tt.logs, &tt.envelope)) + }) + } +} + +func TestBuildLogsWithResourceAttrs(t *testing.T) { + logs := plog.NewLogs() + observedTime := time.Date(2022, time.July, 14, 9, 30, 0, 0, time.UTC) + + require.NoError(t, featuregate.GlobalRegistry().Set(allowResourceAttributes.ID(), true)) + t.Cleanup(func() { + require.NoError(t, featuregate.GlobalRegistry().Set(allowResourceAttributes.ID(), false)) + }) + + // adding the first item to the logs + + envelope := &loggregator_v2.Envelope{ + Timestamp: observedTime.Unix(), + SourceId: "uaa", + Tags: map[string]string{ + "origin": "gorouter", + "deployment": "cf", + "job": "router", + "index": "bc276108-8282-48a5-bae7-c009c4392246", + "ip": "10.244.0.34", + "custom": "datapoint", + }, + } + + buildLogs(logs, envelope, observedTime) + + // check if the first log resource was created successfully + // we await single resource, with single scope and single log + require.Equal(t, 1, logs.ResourceLogs().Len()) + require.Equal(t, map[string]any{ + "org.cloudfoundry.origin": "gorouter", + "org.cloudfoundry.deployment": "cf", + "org.cloudfoundry.job": "router", + "org.cloudfoundry.index": "bc276108-8282-48a5-bae7-c009c4392246", + "org.cloudfoundry.ip": "10.244.0.34", + "org.cloudfoundry.source_id": "uaa", + }, logs.ResourceLogs().At(0).Resource().Attributes().AsRaw()) + require.Equal(t, 1, logs.ResourceLogs().At(0).ScopeLogs().Len()) + require.Equal(t, metadata.ScopeName, logs.ResourceLogs().At(0).ScopeLogs().At(0).Scope().Name()) + require.Equal(t, 1, logs.ResourceLogs().At(0).ScopeLogs().At(0).LogRecords().Len()) + require.Equal(t, map[string]any{ + "org.cloudfoundry.custom": "datapoint", + }, logs.ResourceLogs().At(0).ScopeLogs().At(0).LogRecords().At(0).Attributes().AsRaw()) + + // adding another envelope matching the same resource attributes + + envelope = &loggregator_v2.Envelope{ + Timestamp: observedTime.Unix(), + SourceId: "uaa", + Tags: map[string]string{ + "origin": "gorouter", + "deployment": "cf", + "job": "router", + "index": "bc276108-8282-48a5-bae7-c009c4392246", + "ip": "10.244.0.34", + "custom2": "datapoint2", + }, + } + + buildLogs(logs, envelope, observedTime) + + // check that the first log resource contains a single scope, but 2 logs + require.Equal(t, 1, logs.ResourceLogs().Len()) + require.Equal(t, map[string]any{ + "org.cloudfoundry.origin": "gorouter", + "org.cloudfoundry.deployment": "cf", + "org.cloudfoundry.job": "router", + "org.cloudfoundry.index": "bc276108-8282-48a5-bae7-c009c4392246", + "org.cloudfoundry.ip": "10.244.0.34", + "org.cloudfoundry.source_id": "uaa", + }, logs.ResourceLogs().At(0).Resource().Attributes().AsRaw()) + require.Equal(t, 1, logs.ResourceLogs().At(0).ScopeLogs().Len()) + require.Equal(t, metadata.ScopeName, logs.ResourceLogs().At(0).ScopeLogs().At(0).Scope().Name()) + require.Equal(t, 2, logs.ResourceLogs().At(0).ScopeLogs().At(0).LogRecords().Len()) + require.Equal(t, map[string]any{ + "org.cloudfoundry.custom": "datapoint", + }, logs.ResourceLogs().At(0).ScopeLogs().At(0).LogRecords().At(0).Attributes().AsRaw()) + require.Equal(t, map[string]any{ + "org.cloudfoundry.custom2": "datapoint2", + }, logs.ResourceLogs().At(0).ScopeLogs().At(0).LogRecords().At(1).Attributes().AsRaw()) + + // adding another envelope not matching the resource attributes + + envelope = &loggregator_v2.Envelope{ + Timestamp: observedTime.Unix(), + SourceId: "uaa33", + Tags: map[string]string{ + "origin": "gorouter", + "deployment": "cf", + "job": "router", + "index": "bc276108-8282-48a5-bae7-c009c4392246", + "ip": "10.244.0.34", + "custom3": "datapoint3", + }, + } + + buildLogs(logs, envelope, observedTime) + + // check that the new resource was created and exists next to the original one + require.Equal(t, 2, logs.ResourceLogs().Len()) + require.Equal(t, map[string]any{ + "org.cloudfoundry.origin": "gorouter", + "org.cloudfoundry.deployment": "cf", + "org.cloudfoundry.job": "router", + "org.cloudfoundry.index": "bc276108-8282-48a5-bae7-c009c4392246", + "org.cloudfoundry.ip": "10.244.0.34", + "org.cloudfoundry.source_id": "uaa33", + }, logs.ResourceLogs().At(1).Resource().Attributes().AsRaw()) + require.Equal(t, 1, logs.ResourceLogs().At(1).ScopeLogs().Len()) + require.Equal(t, metadata.ScopeName, logs.ResourceLogs().At(1).ScopeLogs().At(0).Scope().Name()) + require.Equal(t, 1, logs.ResourceLogs().At(1).ScopeLogs().At(0).LogRecords().Len()) + require.Equal(t, map[string]any{ + "org.cloudfoundry.custom3": "datapoint3", + }, logs.ResourceLogs().At(1).ScopeLogs().At(0).LogRecords().At(0).Attributes().AsRaw()) +} + +func TestBuildLogs(t *testing.T) { + logs := plog.NewLogs() + observedTime := time.Date(2022, time.July, 14, 9, 30, 0, 0, time.UTC) + + // adding the first item to the logs + + envelope := &loggregator_v2.Envelope{ + Timestamp: observedTime.Unix(), + SourceId: "uaa", + Tags: map[string]string{ + "origin": "gorouter", + "deployment": "cf", + "job": "router", + "index": "bc276108-8282-48a5-bae7-c009c4392246", + "ip": "10.244.0.34", + "custom": "datapoint", + }, + } + + buildLogs(logs, envelope, observedTime) + + // check if the first log resource was created successfully + // we await single resource, with single scope and single log + require.Equal(t, 1, logs.ResourceLogs().Len()) + require.Equal(t, 0, logs.ResourceLogs().At(0).Resource().Attributes().Len()) + require.Equal(t, 1, logs.ResourceLogs().At(0).ScopeLogs().Len()) + require.Equal(t, metadata.ScopeName, logs.ResourceLogs().At(0).ScopeLogs().At(0).Scope().Name()) + require.Equal(t, 1, logs.ResourceLogs().At(0).ScopeLogs().At(0).LogRecords().Len()) + require.Equal(t, map[string]any{ + "org.cloudfoundry.custom": "datapoint", + "org.cloudfoundry.origin": "gorouter", + "org.cloudfoundry.deployment": "cf", + "org.cloudfoundry.job": "router", + "org.cloudfoundry.index": "bc276108-8282-48a5-bae7-c009c4392246", + "org.cloudfoundry.ip": "10.244.0.34", + "org.cloudfoundry.source_id": "uaa", + }, logs.ResourceLogs().At(0).ScopeLogs().At(0).LogRecords().At(0).Attributes().AsRaw()) + + // adding another envelope matching the same resource attributes + + envelope = &loggregator_v2.Envelope{ + Timestamp: observedTime.Unix(), + SourceId: "uaa", + Tags: map[string]string{ + "origin": "gorouter", + "deployment": "cf", + "job": "router", + "index": "bc276108-8282-48a5-bae7-c009c4392246", + "ip": "10.244.0.34", + "custom2": "datapoint2", + }, + } + + buildLogs(logs, envelope, observedTime) + + // check that another resource was created + require.Equal(t, 2, logs.ResourceLogs().Len()) + require.Equal(t, 0, logs.ResourceLogs().At(0).Resource().Attributes().Len()) + require.Equal(t, 0, logs.ResourceLogs().At(1).Resource().Attributes().Len()) + require.Equal(t, 1, logs.ResourceLogs().At(0).ScopeLogs().Len()) + require.Equal(t, metadata.ScopeName, logs.ResourceLogs().At(0).ScopeLogs().At(0).Scope().Name()) + require.Equal(t, 1, logs.ResourceLogs().At(1).ScopeLogs().Len()) + require.Equal(t, metadata.ScopeName, logs.ResourceLogs().At(1).ScopeLogs().At(0).Scope().Name()) + require.Equal(t, 1, logs.ResourceLogs().At(0).ScopeLogs().At(0).LogRecords().Len()) + require.Equal(t, map[string]any{ + "org.cloudfoundry.custom": "datapoint", + "org.cloudfoundry.origin": "gorouter", + "org.cloudfoundry.deployment": "cf", + "org.cloudfoundry.job": "router", + "org.cloudfoundry.index": "bc276108-8282-48a5-bae7-c009c4392246", + "org.cloudfoundry.ip": "10.244.0.34", + "org.cloudfoundry.source_id": "uaa", + }, logs.ResourceLogs().At(0).ScopeLogs().At(0).LogRecords().At(0).Attributes().AsRaw()) + require.Equal(t, 1, logs.ResourceLogs().At(1).ScopeLogs().At(0).LogRecords().Len()) + require.Equal(t, map[string]any{ + "org.cloudfoundry.custom2": "datapoint2", + "org.cloudfoundry.origin": "gorouter", + "org.cloudfoundry.deployment": "cf", + "org.cloudfoundry.job": "router", + "org.cloudfoundry.index": "bc276108-8282-48a5-bae7-c009c4392246", + "org.cloudfoundry.ip": "10.244.0.34", + "org.cloudfoundry.source_id": "uaa", + }, logs.ResourceLogs().At(1).ScopeLogs().At(0).LogRecords().At(0).Attributes().AsRaw()) +} + +func TestBuildMetricsWithResourceAttrs(t *testing.T) { + metrics := pmetric.NewMetrics() + observedTime := time.Date(2022, time.July, 14, 9, 30, 0, 0, time.UTC) + + require.NoError(t, featuregate.GlobalRegistry().Set(allowResourceAttributes.ID(), true)) + t.Cleanup(func() { + require.NoError(t, featuregate.GlobalRegistry().Set(allowResourceAttributes.ID(), false)) + }) + + // adding the first item to the metrics + + envelope := &loggregator_v2.Envelope{ + Timestamp: observedTime.Unix(), + SourceId: "uaa", + Tags: map[string]string{ + "origin": "gorouter", + "deployment": "cf", + "job": "router", + "index": "bc276108-8282-48a5-bae7-c009c4392246", + "ip": "10.244.0.34", + "custom": "datapoint", + }, + Message: &loggregator_v2.Envelope_Gauge{ + Gauge: &loggregator_v2.Gauge{ + Metrics: map[string]*loggregator_v2.GaugeValue{ + "memory": { + Unit: "bytes", + Value: 17046641.0, + }, + }, + }, + }, + } + + buildMetrics(metrics, envelope, observedTime) + + // check if the first metric resource was created successfully + // we await single resource, with single scope and single metric + require.Equal(t, 1, metrics.ResourceMetrics().Len()) + require.Equal(t, map[string]any{ + "org.cloudfoundry.origin": "gorouter", + "org.cloudfoundry.deployment": "cf", + "org.cloudfoundry.job": "router", + "org.cloudfoundry.index": "bc276108-8282-48a5-bae7-c009c4392246", + "org.cloudfoundry.ip": "10.244.0.34", + "org.cloudfoundry.source_id": "uaa", + }, metrics.ResourceMetrics().At(0).Resource().Attributes().AsRaw()) + require.Equal(t, 1, metrics.ResourceMetrics().At(0).ScopeMetrics().Len()) + require.Equal(t, metadata.ScopeName, metrics.ResourceMetrics().At(0).ScopeMetrics().At(0).Scope().Name()) + require.Equal(t, 1, metrics.ResourceMetrics().At(0).ScopeMetrics().At(0).Metrics().Len()) + require.Equal(t, map[string]any{ + "org.cloudfoundry.custom": "datapoint", + }, metrics.ResourceMetrics().At(0).ScopeMetrics().At(0).Metrics().At(0).Gauge().DataPoints().At(0).Attributes().AsRaw()) + + // adding another envelope matching the same resource attributes + + envelope = &loggregator_v2.Envelope{ + Timestamp: observedTime.Unix(), + SourceId: "uaa", + Tags: map[string]string{ + "origin": "gorouter", + "deployment": "cf", + "job": "router", + "index": "bc276108-8282-48a5-bae7-c009c4392246", + "ip": "10.244.0.34", + "custom2": "datapoint2", + }, + Message: &loggregator_v2.Envelope_Gauge{ + Gauge: &loggregator_v2.Gauge{ + Metrics: map[string]*loggregator_v2.GaugeValue{ + "memory": { + Unit: "bytes", + Value: 17046641.0, + }, + }, + }, + }, + } + + buildMetrics(metrics, envelope, observedTime) + + // check that the first metric resource contains a single scope, but 2 metrics + require.Equal(t, 1, metrics.ResourceMetrics().Len()) + require.Equal(t, map[string]any{ + "org.cloudfoundry.origin": "gorouter", + "org.cloudfoundry.deployment": "cf", + "org.cloudfoundry.job": "router", + "org.cloudfoundry.index": "bc276108-8282-48a5-bae7-c009c4392246", + "org.cloudfoundry.ip": "10.244.0.34", + "org.cloudfoundry.source_id": "uaa", + }, metrics.ResourceMetrics().At(0).Resource().Attributes().AsRaw()) + require.Equal(t, 1, metrics.ResourceMetrics().At(0).ScopeMetrics().Len()) + require.Equal(t, metadata.ScopeName, metrics.ResourceMetrics().At(0).ScopeMetrics().At(0).Scope().Name()) + require.Equal(t, 2, metrics.ResourceMetrics().At(0).ScopeMetrics().At(0).Metrics().Len()) + require.Equal(t, map[string]any{ + "org.cloudfoundry.custom": "datapoint", + }, metrics.ResourceMetrics().At(0).ScopeMetrics().At(0).Metrics().At(0).Gauge().DataPoints().At(0).Attributes().AsRaw()) + require.Equal(t, map[string]any{ + "org.cloudfoundry.custom2": "datapoint2", + }, metrics.ResourceMetrics().At(0).ScopeMetrics().At(0).Metrics().At(1).Gauge().DataPoints().At(0).Attributes().AsRaw()) + + // adding another envelope not matching the resource attributes + + envelope = &loggregator_v2.Envelope{ + Timestamp: observedTime.Unix(), + SourceId: "uaa33", + Tags: map[string]string{ + "origin": "gorouter", + "deployment": "cf", + "job": "router", + "index": "bc276108-8282-48a5-bae7-c009c4392246", + "ip": "10.244.0.34", + "custom3": "datapoint3", + }, + Message: &loggregator_v2.Envelope_Gauge{ + Gauge: &loggregator_v2.Gauge{ + Metrics: map[string]*loggregator_v2.GaugeValue{ + "memory": { + Unit: "bytes", + Value: 17046641.0, + }, + }, + }, + }, + } + + buildMetrics(metrics, envelope, observedTime) + + // check that the new resource was created and exists next to the original one + require.Equal(t, 2, metrics.ResourceMetrics().Len()) + require.Equal(t, map[string]any{ + "org.cloudfoundry.origin": "gorouter", + "org.cloudfoundry.deployment": "cf", + "org.cloudfoundry.job": "router", + "org.cloudfoundry.index": "bc276108-8282-48a5-bae7-c009c4392246", + "org.cloudfoundry.ip": "10.244.0.34", + "org.cloudfoundry.source_id": "uaa33", + }, metrics.ResourceMetrics().At(1).Resource().Attributes().AsRaw()) + require.Equal(t, 1, metrics.ResourceMetrics().At(1).ScopeMetrics().Len()) + require.Equal(t, metadata.ScopeName, metrics.ResourceMetrics().At(1).ScopeMetrics().At(0).Scope().Name()) + require.Equal(t, 1, metrics.ResourceMetrics().At(1).ScopeMetrics().At(0).Metrics().Len()) + require.Equal(t, map[string]any{ + "org.cloudfoundry.custom3": "datapoint3", + }, metrics.ResourceMetrics().At(1).ScopeMetrics().At(0).Metrics().At(0).Gauge().DataPoints().At(0).Attributes().AsRaw()) +} + +func TestBuildMetrics(t *testing.T) { + metrics := pmetric.NewMetrics() + observedTime := time.Date(2022, time.July, 14, 9, 30, 0, 0, time.UTC) + + // adding the first item to the metrics + + envelope := &loggregator_v2.Envelope{ + Timestamp: observedTime.Unix(), + SourceId: "uaa", + Tags: map[string]string{ + "origin": "gorouter", + "deployment": "cf", + "job": "router", + "index": "bc276108-8282-48a5-bae7-c009c4392246", + "ip": "10.244.0.34", + "custom": "datapoint", + }, + Message: &loggregator_v2.Envelope_Gauge{ + Gauge: &loggregator_v2.Gauge{ + Metrics: map[string]*loggregator_v2.GaugeValue{ + "memory": { + Unit: "bytes", + Value: 17046641.0, + }, + }, + }, + }, + } + + buildMetrics(metrics, envelope, observedTime) + + // check if the first metric resource was created successfully + // we await single resource, with single scope and single metric + require.Equal(t, 1, metrics.ResourceMetrics().Len()) + require.Equal(t, 0, metrics.ResourceMetrics().At(0).Resource().Attributes().Len()) + require.Equal(t, 1, metrics.ResourceMetrics().At(0).ScopeMetrics().Len()) + require.Equal(t, metadata.ScopeName, metrics.ResourceMetrics().At(0).ScopeMetrics().At(0).Scope().Name()) + require.Equal(t, 1, metrics.ResourceMetrics().At(0).ScopeMetrics().At(0).Metrics().Len()) + require.Equal(t, map[string]any{ + "org.cloudfoundry.custom": "datapoint", + "org.cloudfoundry.origin": "gorouter", + "org.cloudfoundry.deployment": "cf", + "org.cloudfoundry.job": "router", + "org.cloudfoundry.index": "bc276108-8282-48a5-bae7-c009c4392246", + "org.cloudfoundry.ip": "10.244.0.34", + "org.cloudfoundry.source_id": "uaa", + }, metrics.ResourceMetrics().At(0).ScopeMetrics().At(0).Metrics().At(0).Gauge().DataPoints().At(0).Attributes().AsRaw()) + + // adding another envelope matching the resource attributes + + envelope = &loggregator_v2.Envelope{ + Timestamp: observedTime.Unix(), + SourceId: "uaa", + Tags: map[string]string{ + "origin": "gorouter", + "deployment": "cf", + "job": "router", + "index": "bc276108-8282-48a5-bae7-c009c4392246", + "ip": "10.244.0.34", + "custom2": "datapoint2", + }, + Message: &loggregator_v2.Envelope_Gauge{ + Gauge: &loggregator_v2.Gauge{ + Metrics: map[string]*loggregator_v2.GaugeValue{ + "memory": { + Unit: "bytes", + Value: 17046641.0, + }, + }, + }, + }, + } + + buildMetrics(metrics, envelope, observedTime) + + // check that another resource was created + require.Equal(t, 2, metrics.ResourceMetrics().Len()) + require.Equal(t, 0, metrics.ResourceMetrics().At(0).Resource().Attributes().Len()) + require.Equal(t, 0, metrics.ResourceMetrics().At(1).Resource().Attributes().Len()) + require.Equal(t, 1, metrics.ResourceMetrics().At(0).ScopeMetrics().Len()) + require.Equal(t, metadata.ScopeName, metrics.ResourceMetrics().At(0).ScopeMetrics().At(0).Scope().Name()) + require.Equal(t, 1, metrics.ResourceMetrics().At(1).ScopeMetrics().Len()) + require.Equal(t, metadata.ScopeName, metrics.ResourceMetrics().At(1).ScopeMetrics().At(0).Scope().Name()) + require.Equal(t, 1, metrics.ResourceMetrics().At(0).ScopeMetrics().At(0).Metrics().Len()) + require.Equal(t, map[string]any{ + "org.cloudfoundry.custom": "datapoint", + "org.cloudfoundry.origin": "gorouter", + "org.cloudfoundry.deployment": "cf", + "org.cloudfoundry.job": "router", + "org.cloudfoundry.index": "bc276108-8282-48a5-bae7-c009c4392246", + "org.cloudfoundry.ip": "10.244.0.34", + "org.cloudfoundry.source_id": "uaa", + }, metrics.ResourceMetrics().At(0).ScopeMetrics().At(0).Metrics().At(0).Gauge().DataPoints().At(0).Attributes().AsRaw()) + require.Equal(t, 1, metrics.ResourceMetrics().At(1).ScopeMetrics().At(0).Metrics().Len()) + require.Equal(t, map[string]any{ + "org.cloudfoundry.custom2": "datapoint2", + "org.cloudfoundry.origin": "gorouter", + "org.cloudfoundry.deployment": "cf", + "org.cloudfoundry.job": "router", + "org.cloudfoundry.index": "bc276108-8282-48a5-bae7-c009c4392246", + "org.cloudfoundry.ip": "10.244.0.34", + "org.cloudfoundry.source_id": "uaa", + }, metrics.ResourceMetrics().At(1).ScopeMetrics().At(0).Metrics().At(0).Gauge().DataPoints().At(0).Attributes().AsRaw()) +}