From 19ddd213df47414f88927fc9ef4914b96bf6f0cc Mon Sep 17 00:00:00 2001 From: VihasMakwana <121151420+VihasMakwana@users.noreply.github.com> Date: Wed, 9 Oct 2024 19:04:07 +0530 Subject: [PATCH 001/140] [chore][fileconsumer/archive] - add signature methods for archive feature (#35098) Description: This PR introduces the `archive` method to store files older than 3 poll cycles. The core logic for reading will be introduced in a follow up PR. Link to tracking Issue: https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/32727 Testing: To be included in future PRs Documentation: To be included in future PRs --- pkg/stanza/fileconsumer/config.go | 11 +---- pkg/stanza/fileconsumer/file.go | 29 +++++++++-- .../internal/checkpoint/checkpoint.go | 6 ++- .../fileconsumer/internal/tracker/tracker.go | 48 ++++++++++++++++++- pkg/stanza/fileconsumer/util_test.go | 3 ++ 5 files changed, 81 insertions(+), 16 deletions(-) diff --git a/pkg/stanza/fileconsumer/config.go b/pkg/stanza/fileconsumer/config.go index 2eec1b6b2e79..bd0daf2d3e40 100644 --- a/pkg/stanza/fileconsumer/config.go +++ b/pkg/stanza/fileconsumer/config.go @@ -25,7 +25,6 @@ import ( "github.com/open-telemetry/opentelemetry-collector-contrib/pkg/stanza/fileconsumer/internal/metadata" "github.com/open-telemetry/opentelemetry-collector-contrib/pkg/stanza/fileconsumer/internal/reader" "github.com/open-telemetry/opentelemetry-collector-contrib/pkg/stanza/fileconsumer/internal/scanner" - "github.com/open-telemetry/opentelemetry-collector-contrib/pkg/stanza/fileconsumer/internal/tracker" "github.com/open-telemetry/opentelemetry-collector-contrib/pkg/stanza/fileconsumer/matcher" "github.com/open-telemetry/opentelemetry-collector-contrib/pkg/stanza/operator" "github.com/open-telemetry/opentelemetry-collector-contrib/pkg/stanza/operator/helper" @@ -87,6 +86,7 @@ type Config struct { DeleteAfterRead bool `mapstructure:"delete_after_read,omitempty"` IncludeFileRecordNumber bool `mapstructure:"include_file_record_number,omitempty"` Compression string `mapstructure:"compression,omitempty"` + PollsToArchive int `mapstructure:"-"` // TODO: activate this config once archiving is set up AcquireFSLock bool `mapstructure:"acquire_fs_lock,omitempty"` } @@ -174,13 +174,6 @@ func (c Config) Build(set component.TelemetrySettings, emit emit.Callback, opts AcquireFSLock: c.AcquireFSLock, } - var t tracker.Tracker - if o.noTracking { - t = tracker.NewNoStateTracker(set, c.MaxConcurrentFiles/2) - } else { - t = tracker.NewFileTracker(set, c.MaxConcurrentFiles/2) - } - telemetryBuilder, err := metadata.NewTelemetryBuilder(set) if err != nil { return nil, err @@ -192,8 +185,8 @@ func (c Config) Build(set component.TelemetrySettings, emit emit.Callback, opts pollInterval: c.PollInterval, maxBatchFiles: c.MaxConcurrentFiles / 2, maxBatches: c.MaxBatches, - tracker: t, telemetryBuilder: telemetryBuilder, + noTracking: o.noTracking, }, nil } diff --git a/pkg/stanza/fileconsumer/file.go b/pkg/stanza/fileconsumer/file.go index d46507ecf3eb..c5675a90a063 100644 --- a/pkg/stanza/fileconsumer/file.go +++ b/pkg/stanza/fileconsumer/file.go @@ -30,11 +30,13 @@ type Manager struct { readerFactory reader.Factory fileMatcher *matcher.Matcher tracker tracker.Tracker + noTracking bool - pollInterval time.Duration - persister operator.Persister - maxBatches int - maxBatchFiles int + pollInterval time.Duration + persister operator.Persister + maxBatches int + maxBatchFiles int + pollsToArchive int telemetryBuilder *metadata.TelemetryBuilder } @@ -47,6 +49,9 @@ func (m *Manager) Start(persister operator.Persister) error { m.set.Logger.Warn("finding files", zap.Error(err)) } + // instantiate the tracker + m.instantiateTracker(persister) + if persister != nil { m.persister = persister offsets, err := checkpoint.Load(ctx, m.persister) @@ -58,6 +63,8 @@ func (m *Manager) Start(persister operator.Persister) error { m.readerFactory.FromBeginning = true m.tracker.LoadMetadata(offsets) } + } else if m.pollsToArchive > 0 { + m.set.Logger.Error("archiving is not supported in memory, please use a storage extension") } // Start polling goroutine @@ -73,7 +80,9 @@ func (m *Manager) Stop() error { m.cancel = nil } m.wg.Wait() - m.telemetryBuilder.FileconsumerOpenFiles.Add(context.TODO(), int64(0-m.tracker.ClosePreviousFiles())) + if m.tracker != nil { + m.telemetryBuilder.FileconsumerOpenFiles.Add(context.TODO(), int64(0-m.tracker.ClosePreviousFiles())) + } if m.persister != nil { if err := checkpoint.Save(context.Background(), m.persister, m.tracker.GetMetadata()); err != nil { m.set.Logger.Error("save offsets", zap.Error(err)) @@ -261,3 +270,13 @@ func (m *Manager) newReader(ctx context.Context, file *os.File, fp *fingerprint. m.telemetryBuilder.FileconsumerOpenFiles.Add(ctx, 1) return r, nil } + +func (m *Manager) instantiateTracker(persister operator.Persister) { + var t tracker.Tracker + if m.noTracking { + t = tracker.NewNoStateTracker(m.set, m.maxBatchFiles) + } else { + t = tracker.NewFileTracker(m.set, m.maxBatchFiles, m.pollsToArchive, persister) + } + m.tracker = t +} diff --git a/pkg/stanza/fileconsumer/internal/checkpoint/checkpoint.go b/pkg/stanza/fileconsumer/internal/checkpoint/checkpoint.go index b75933abcc28..b9476fb3d5e9 100644 --- a/pkg/stanza/fileconsumer/internal/checkpoint/checkpoint.go +++ b/pkg/stanza/fileconsumer/internal/checkpoint/checkpoint.go @@ -18,6 +18,10 @@ const knownFilesKey = "knownFiles" // Save syncs the most recent set of files to the database func Save(ctx context.Context, persister operator.Persister, rmds []*reader.Metadata) error { + return SaveKey(ctx, persister, rmds, knownFilesKey) +} + +func SaveKey(ctx context.Context, persister operator.Persister, rmds []*reader.Metadata, key string) error { var buf bytes.Buffer enc := json.NewEncoder(&buf) @@ -34,7 +38,7 @@ func Save(ctx context.Context, persister operator.Persister, rmds []*reader.Meta } } - if err := persister.Set(ctx, knownFilesKey, buf.Bytes()); err != nil { + if err := persister.Set(ctx, key, buf.Bytes()); err != nil { errs = append(errs, fmt.Errorf("persist known files: %w", err)) } diff --git a/pkg/stanza/fileconsumer/internal/tracker/tracker.go b/pkg/stanza/fileconsumer/internal/tracker/tracker.go index 5039003a36ed..54bf5e9e12c1 100644 --- a/pkg/stanza/fileconsumer/internal/tracker/tracker.go +++ b/pkg/stanza/fileconsumer/internal/tracker/tracker.go @@ -4,12 +4,17 @@ package tracker // import "github.com/open-telemetry/opentelemetry-collector-contrib/pkg/stanza/fileconsumer/internal/tracker" import ( + "context" + "fmt" + "go.opentelemetry.io/collector/component" "go.uber.org/zap" + "github.com/open-telemetry/opentelemetry-collector-contrib/pkg/stanza/fileconsumer/internal/checkpoint" "github.com/open-telemetry/opentelemetry-collector-contrib/pkg/stanza/fileconsumer/internal/fileset" "github.com/open-telemetry/opentelemetry-collector-contrib/pkg/stanza/fileconsumer/internal/fingerprint" "github.com/open-telemetry/opentelemetry-collector-contrib/pkg/stanza/fileconsumer/internal/reader" + "github.com/open-telemetry/opentelemetry-collector-contrib/pkg/stanza/operator" ) // Interface for tracking files that are being consumed. @@ -37,9 +42,16 @@ type fileTracker struct { currentPollFiles *fileset.Fileset[*reader.Reader] previousPollFiles *fileset.Fileset[*reader.Reader] knownFiles []*fileset.Fileset[*reader.Metadata] + + // persister is to be used to store offsets older than 3 poll cycles. + // These offsets will be stored on disk + persister operator.Persister + + pollsToArchive int + archiveIndex int } -func NewFileTracker(set component.TelemetrySettings, maxBatchFiles int) Tracker { +func NewFileTracker(set component.TelemetrySettings, maxBatchFiles int, pollsToArchive int, persister operator.Persister) Tracker { knownFiles := make([]*fileset.Fileset[*reader.Metadata], 3) for i := 0; i < len(knownFiles); i++ { knownFiles[i] = fileset.New[*reader.Metadata](maxBatchFiles) @@ -51,6 +63,9 @@ func NewFileTracker(set component.TelemetrySettings, maxBatchFiles int) Tracker currentPollFiles: fileset.New[*reader.Reader](maxBatchFiles), previousPollFiles: fileset.New[*reader.Reader](maxBatchFiles), knownFiles: knownFiles, + pollsToArchive: pollsToArchive, + persister: persister, + archiveIndex: 0, } } @@ -113,6 +128,9 @@ func (t *fileTracker) ClosePreviousFiles() (filesClosed int) { func (t *fileTracker) EndPoll() { // shift the filesets at end of every poll() call // t.knownFiles[0] -> t.knownFiles[1] -> t.knownFiles[2] + + // Instead of throwing it away, archive it. + t.archive(t.knownFiles[2]) copy(t.knownFiles[1:], t.knownFiles) t.knownFiles[0] = fileset.New[*reader.Metadata](t.maxBatchFiles) } @@ -125,6 +143,34 @@ func (t *fileTracker) TotalReaders() int { return total } +func (t *fileTracker) archive(metadata *fileset.Fileset[*reader.Metadata]) { + // We make use of a ring buffer, where each set of files is stored under a specific index. + // Instead of discarding knownFiles[2], write it to the next index and eventually roll over. + // Separate storage keys knownFilesArchive0, knownFilesArchive1, ..., knownFilesArchiveN, roll over back to knownFilesArchive0 + + // Archiving: ┌─────────────────────on-disk archive─────────────────────────┐ + // | ┌───┐ ┌───┐ ┌──────────────────┐ | + // index | ▶ │ 0 │ ▶ │ 1 │ ▶ ... ▶ │ polls_to_archive │ | + // | ▲ └───┘ └───┘ └──────────────────┘ | + // | ▲ ▲ ▼ | + // | ▲ │ Roll over overriting older offsets, if any ◀ | + // └──────│──────────────────────────────────────────────────────┘ + // │ + // │ + // │ + // start + // index + + if t.pollsToArchive <= 0 || t.persister == nil { + return + } + key := fmt.Sprintf("knownFiles%d", t.archiveIndex) + if err := checkpoint.SaveKey(context.Background(), t.persister, metadata.Get(), key); err != nil { + t.set.Logger.Error("error faced while saving to the archive", zap.Error(err)) + } + t.archiveIndex = (t.archiveIndex + 1) % t.pollsToArchive // increment the index +} + // noStateTracker only tracks the current polled files. Once the poll is // complete and telemetry is consumed, the tracked files are closed. The next // poll will create fresh readers with no previously tracked offsets. diff --git a/pkg/stanza/fileconsumer/util_test.go b/pkg/stanza/fileconsumer/util_test.go index 19d465a6e43b..69bb92ca26cd 100644 --- a/pkg/stanza/fileconsumer/util_test.go +++ b/pkg/stanza/fileconsumer/util_test.go @@ -10,6 +10,8 @@ import ( "go.opentelemetry.io/collector/component/componenttest" "github.com/open-telemetry/opentelemetry-collector-contrib/pkg/stanza/fileconsumer/internal/emittest" + "github.com/open-telemetry/opentelemetry-collector-contrib/pkg/stanza/fileconsumer/internal/tracker" + "github.com/open-telemetry/opentelemetry-collector-contrib/pkg/stanza/testutil" ) func testManager(t *testing.T, cfg *Config, opts ...Option) (*Manager, *emittest.Sink) { @@ -20,6 +22,7 @@ func testManager(t *testing.T, cfg *Config, opts ...Option) (*Manager, *emittest func testManagerWithSink(t *testing.T, cfg *Config, sink *emittest.Sink, opts ...Option) *Manager { set := componenttest.NewNopTelemetrySettings() input, err := cfg.Build(set, sink.Callback, opts...) + input.tracker = tracker.NewFileTracker(set, cfg.MaxBatches, cfg.PollsToArchive, testutil.NewUnscopedMockPersister()) require.NoError(t, err) t.Cleanup(func() { input.tracker.ClosePreviousFiles() }) return input From 27aa54b740557e5c471107767a5f0232cf07d172 Mon Sep 17 00:00:00 2001 From: Christos Markou Date: Wed, 9 Oct 2024 16:35:16 +0300 Subject: [PATCH 002/140] [receiver/nginx] Use NewDefaultClientConfig instead of manually creating struct (#35452) **Description:** Similar to https://github.com/open-telemetry/opentelemetry-collector/pull/11273. This PR makes usage of the `NewDefaultClientConfig` instead of manually creating the `confighttp.ClientConfig` struct as part of https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/35457. **Link to tracking Issue:** https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/35457 **Testing:** **Documentation:** --------- Signed-off-by: ChrsMark --- receiver/nginxreceiver/factory.go | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/receiver/nginxreceiver/factory.go b/receiver/nginxreceiver/factory.go index d04e07ea848c..feb633b7ca38 100644 --- a/receiver/nginxreceiver/factory.go +++ b/receiver/nginxreceiver/factory.go @@ -28,12 +28,13 @@ func createDefaultConfig() component.Config { cfg := scraperhelper.NewDefaultControllerConfig() cfg.CollectionInterval = 10 * time.Second + clientConfig := confighttp.NewDefaultClientConfig() + clientConfig.Endpoint = "http://localhost:80/status" + clientConfig.Timeout = 10 * time.Second + return &Config{ - ControllerConfig: cfg, - ClientConfig: confighttp.ClientConfig{ - Endpoint: "http://localhost:80/status", - Timeout: 10 * time.Second, - }, + ControllerConfig: cfg, + ClientConfig: clientConfig, MetricsBuilderConfig: metadata.DefaultMetricsBuilderConfig(), } } From 5219b85e9beb99173752666e64683b53534f3d48 Mon Sep 17 00:00:00 2001 From: Cole Laven <82364622+colelaven@users.noreply.github.com> Date: Wed, 9 Oct 2024 11:45:39 -0400 Subject: [PATCH 003/140] [chore] Fix: Fix flaky logdedupprocessor tests (#35719) #### Description Fixes flaky tests in logdedupprocessor that were failing due to nondeterministic ordering of log records. Those tests now ignore log record order when comparing logs. #### Testing Ran the fixed tests 200+ times without fail. --- processor/logdedupprocessor/processor_test.go | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/processor/logdedupprocessor/processor_test.go b/processor/logdedupprocessor/processor_test.go index d5d4c1429f33..72aa5919aad7 100644 --- a/processor/logdedupprocessor/processor_test.go +++ b/processor/logdedupprocessor/processor_test.go @@ -251,8 +251,8 @@ func TestProcessorConsumeCondition(t *testing.T) { consumedLogs := allSinkLogs[0] dedupedLogs := allSinkLogs[1] - require.NoError(t, plogtest.CompareLogs(expectedConsumedLogs, consumedLogs, plogtest.IgnoreObservedTimestamp(), plogtest.IgnoreTimestamp(), plogtest.IgnoreLogRecordAttributeValue("first_observed_timestamp"), plogtest.IgnoreLogRecordAttributeValue("last_observed_timestamp"))) - require.NoError(t, plogtest.CompareLogs(expectedDedupedLogs, dedupedLogs, plogtest.IgnoreObservedTimestamp(), plogtest.IgnoreTimestamp(), plogtest.IgnoreLogRecordAttributeValue("first_observed_timestamp"), plogtest.IgnoreLogRecordAttributeValue("last_observed_timestamp"))) + require.NoError(t, plogtest.CompareLogs(expectedConsumedLogs, consumedLogs, plogtest.IgnoreObservedTimestamp(), plogtest.IgnoreTimestamp(), plogtest.IgnoreLogRecordAttributeValue("first_observed_timestamp"), plogtest.IgnoreLogRecordAttributeValue("last_observed_timestamp"), plogtest.IgnoreLogRecordsOrder())) + require.NoError(t, plogtest.CompareLogs(expectedDedupedLogs, dedupedLogs, plogtest.IgnoreObservedTimestamp(), plogtest.IgnoreTimestamp(), plogtest.IgnoreLogRecordAttributeValue("first_observed_timestamp"), plogtest.IgnoreLogRecordAttributeValue("last_observed_timestamp"), plogtest.IgnoreLogRecordsOrder())) // Cleanup err = p.Shutdown(context.Background()) @@ -301,9 +301,8 @@ func TestProcessorConsumeMultipleConditions(t *testing.T) { expectedDedupedLogs, err := golden.ReadLogs(filepath.Join("testdata", "expected", "multipleConditionsDedupedLogs.yaml")) require.NoError(t, err) - err = plogtest.CompareLogs(expectedConsumedLogs, consumedLogs, plogtest.IgnoreObservedTimestamp(), plogtest.IgnoreTimestamp(), plogtest.IgnoreLogRecordAttributeValue("first_observed_timestamp"), plogtest.IgnoreLogRecordAttributeValue("last_observed_timestamp")) - require.NoError(t, err) - require.NoError(t, plogtest.CompareLogs(expectedDedupedLogs, dedupedLogs, plogtest.IgnoreObservedTimestamp(), plogtest.IgnoreTimestamp(), plogtest.IgnoreLogRecordAttributeValue("first_observed_timestamp"), plogtest.IgnoreLogRecordAttributeValue("last_observed_timestamp"))) + require.NoError(t, plogtest.CompareLogs(expectedConsumedLogs, consumedLogs, plogtest.IgnoreObservedTimestamp(), plogtest.IgnoreTimestamp(), plogtest.IgnoreLogRecordAttributeValue("first_observed_timestamp"), plogtest.IgnoreLogRecordAttributeValue("last_observed_timestamp"), plogtest.IgnoreLogRecordsOrder())) + require.NoError(t, plogtest.CompareLogs(expectedDedupedLogs, dedupedLogs, plogtest.IgnoreObservedTimestamp(), plogtest.IgnoreTimestamp(), plogtest.IgnoreLogRecordAttributeValue("first_observed_timestamp"), plogtest.IgnoreLogRecordAttributeValue("last_observed_timestamp"), plogtest.IgnoreLogRecordsOrder())) // Cleanup err = p.Shutdown(context.Background()) From f606a50e1da2e3df2fa20b84fee1bb19c9e9a7b4 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 9 Oct 2024 08:49:15 -0700 Subject: [PATCH 004/140] Update module github.com/tidwall/gjson to v1.18.0 (#35694) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [github.com/tidwall/gjson](https://redirect.github.com/tidwall/gjson) | `v1.17.3` -> `v1.18.0` | [![age](https://developer.mend.io/api/mc/badges/age/go/github.com%2ftidwall%2fgjson/v1.18.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/go/github.com%2ftidwall%2fgjson/v1.18.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/go/github.com%2ftidwall%2fgjson/v1.17.3/v1.18.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/go/github.com%2ftidwall%2fgjson/v1.17.3/v1.18.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | --- > [!WARNING] > Some dependencies could not be looked up. Check the Dependency Dashboard for more information. --- ### Release Notes
tidwall/gjson (github.com/tidwall/gjson) ### [`v1.18.0`](https://redirect.github.com/tidwall/gjson/compare/v1.17.3...v1.18.0) [Compare Source](https://redirect.github.com/tidwall/gjson/compare/v1.17.3...v1.18.0)
--- ### Configuration 📅 **Schedule**: Branch creation - "on tuesday" (UTC), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, check this box --- This PR was generated by [Mend Renovate](https://mend.io/renovate/). View the [repository job log](https://developer.mend.io/github/open-telemetry/opentelemetry-collector-contrib). --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: opentelemetrybot <107717825+opentelemetrybot@users.noreply.github.com> Co-authored-by: Bogdan Drutu --- exporter/elasticsearchexporter/go.mod | 2 +- exporter/elasticsearchexporter/go.sum | 4 ++-- exporter/elasticsearchexporter/integrationtest/go.sum | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/exporter/elasticsearchexporter/go.mod b/exporter/elasticsearchexporter/go.mod index 0f0a94433176..2c17dd8e390d 100644 --- a/exporter/elasticsearchexporter/go.mod +++ b/exporter/elasticsearchexporter/go.mod @@ -11,7 +11,7 @@ require ( github.com/open-telemetry/opentelemetry-collector-contrib/internal/common v0.111.0 github.com/open-telemetry/opentelemetry-collector-contrib/internal/coreinternal v0.111.0 github.com/stretchr/testify v1.9.0 - github.com/tidwall/gjson v1.17.3 + github.com/tidwall/gjson v1.18.0 go.opentelemetry.io/collector/component v0.111.1-0.20241008154146-ea48c09c31ae go.opentelemetry.io/collector/config/configauth v0.111.1-0.20241008154146-ea48c09c31ae go.opentelemetry.io/collector/config/configcompression v1.17.1-0.20241008154146-ea48c09c31ae diff --git a/exporter/elasticsearchexporter/go.sum b/exporter/elasticsearchexporter/go.sum index fde7f9e8d04f..ba2c8aa227da 100644 --- a/exporter/elasticsearchexporter/go.sum +++ b/exporter/elasticsearchexporter/go.sum @@ -92,8 +92,8 @@ github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UV github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= -github.com/tidwall/gjson v1.17.3 h1:bwWLZU7icoKRG+C+0PNwIKC6FCJO/Q3p2pZvuP0jN94= -github.com/tidwall/gjson v1.17.3/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk= +github.com/tidwall/gjson v1.18.0 h1:FIDeeyB800efLX89e5a8Y0BNH+LOngJyGrIWxG2FKQY= +github.com/tidwall/gjson v1.18.0/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk= github.com/tidwall/match v1.1.1 h1:+Ho715JplO36QYgwN9PGYNhgZvoUSc9X2c80KVTi+GA= github.com/tidwall/match v1.1.1/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM= github.com/tidwall/pretty v1.2.0 h1:RWIZEg2iJ8/g6fDDYzMpobmaoGh5OLl4AXtGUGPcqCs= diff --git a/exporter/elasticsearchexporter/integrationtest/go.sum b/exporter/elasticsearchexporter/integrationtest/go.sum index 15d3724d9ba8..7361064f33da 100644 --- a/exporter/elasticsearchexporter/integrationtest/go.sum +++ b/exporter/elasticsearchexporter/integrationtest/go.sum @@ -249,8 +249,8 @@ github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsT github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8= github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU= -github.com/tidwall/gjson v1.17.3 h1:bwWLZU7icoKRG+C+0PNwIKC6FCJO/Q3p2pZvuP0jN94= -github.com/tidwall/gjson v1.17.3/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk= +github.com/tidwall/gjson v1.18.0 h1:FIDeeyB800efLX89e5a8Y0BNH+LOngJyGrIWxG2FKQY= +github.com/tidwall/gjson v1.18.0/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk= github.com/tidwall/match v1.1.1 h1:+Ho715JplO36QYgwN9PGYNhgZvoUSc9X2c80KVTi+GA= github.com/tidwall/match v1.1.1/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM= github.com/tidwall/pretty v1.2.0 h1:RWIZEg2iJ8/g6fDDYzMpobmaoGh5OLl4AXtGUGPcqCs= From d0eb64ebde7228a21cf70d6a08557bf945bd818a Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 9 Oct 2024 10:54:23 -0700 Subject: [PATCH 005/140] Update module github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common to v1.0.1016 (#35708) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common](https://redirect.github.com/tencentcloud/tencentcloud-sdk-go) | `v1.0.1015` -> `v1.0.1016` | [![age](https://developer.mend.io/api/mc/badges/age/go/github.com%2ftencentcloud%2ftencentcloud-sdk-go%2ftencentcloud%2fcommon/v1.0.1016?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/go/github.com%2ftencentcloud%2ftencentcloud-sdk-go%2ftencentcloud%2fcommon/v1.0.1016?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/go/github.com%2ftencentcloud%2ftencentcloud-sdk-go%2ftencentcloud%2fcommon/v1.0.1015/v1.0.1016?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/go/github.com%2ftencentcloud%2ftencentcloud-sdk-go%2ftencentcloud%2fcommon/v1.0.1015/v1.0.1016?slim=true)](https://docs.renovatebot.com/merge-confidence/) | --- > [!WARNING] > Some dependencies could not be looked up. Check the Dependency Dashboard for more information. --- ### Release Notes
tencentcloud/tencentcloud-sdk-go (github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common) ### [`v1.0.1016`](https://redirect.github.com/tencentcloud/tencentcloud-sdk-go/blob/HEAD/CHANGELOG.md#Release-v101016) [Compare Source](https://redirect.github.com/tencentcloud/tencentcloud-sdk-go/compare/v1.0.1015...v1.0.1016) #### 腾讯云数据仓库 TCHouse-D(cdwdoris) 版本:2021-12-28 ##### 第 26 次发布 发布时间:2024-10-09 01:10:49 本次发布包含了以下内容: 改善已有的文档。 修改接口: - [DescribeClusterConfigs](https://cloud.tencent.com/document/api/1387/102619) - 新增出参:ErrorMsg - [DescribeDatabaseAuditRecords](https://cloud.tencent.com/document/api/1387/102617) - 新增出参:ErrorMsg 修改数据结构: - [NodeInfo](https://cloud.tencent.com/document/api/1387/102385#NodeInfo) - 新增成员:Id - [NodeInfos](https://cloud.tencent.com/document/api/1387/102385#NodeInfos) - 新增成员:Id, Zone - [SlowQueryRecord](https://cloud.tencent.com/document/api/1387/102385#SlowQueryRecord) - 新增成员:State, CatalogName - [ZoneInfo](https://cloud.tencent.com/document/api/1387/102385#ZoneInfo) - 新增成员:Main #### 医疗报告结构化(mrs) 版本:2020-09-10 ##### 第 29 次发布 发布时间:2024-10-09 01:25:21 本次发布包含了以下内容: 改善已有的文档。 修改接口: - [ImageToObject](https://cloud.tencent.com/document/api/1314/56228) - **修改入参**:HandleParam, ImageInfoList
--- ### Configuration 📅 **Schedule**: Branch creation - "on tuesday" (UTC), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, check this box --- This PR was generated by [Mend Renovate](https://mend.io/renovate/). View the [repository job log](https://developer.mend.io/github/open-telemetry/opentelemetry-collector-contrib). --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: opentelemetrybot <107717825+opentelemetrybot@users.noreply.github.com> Co-authored-by: Yang Song --- exporter/tencentcloudlogserviceexporter/go.mod | 2 +- exporter/tencentcloudlogserviceexporter/go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/exporter/tencentcloudlogserviceexporter/go.mod b/exporter/tencentcloudlogserviceexporter/go.mod index bcdf9de309da..b66a147e9572 100644 --- a/exporter/tencentcloudlogserviceexporter/go.mod +++ b/exporter/tencentcloudlogserviceexporter/go.mod @@ -6,7 +6,7 @@ require ( github.com/open-telemetry/opentelemetry-collector-contrib/internal/coreinternal v0.111.0 github.com/pierrec/lz4 v2.6.1+incompatible github.com/stretchr/testify v1.9.0 - github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.1015 + github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.1016 go.opentelemetry.io/collector/component v0.111.1-0.20241008154146-ea48c09c31ae go.opentelemetry.io/collector/config/configopaque v1.17.1-0.20241008154146-ea48c09c31ae go.opentelemetry.io/collector/confmap v1.17.1-0.20241008154146-ea48c09c31ae diff --git a/exporter/tencentcloudlogserviceexporter/go.sum b/exporter/tencentcloudlogserviceexporter/go.sum index 04152fb2774a..d4fd3dec47b8 100644 --- a/exporter/tencentcloudlogserviceexporter/go.sum +++ b/exporter/tencentcloudlogserviceexporter/go.sum @@ -56,8 +56,8 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+ github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= -github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.1015 h1:O60uxxfWztVPVUBQjlJaop2Dw/J7CXGK9fSErMdWw+Y= -github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.1015/go.mod h1:r5r4xbfxSaeR04b166HGsBa/R4U3SueirEUpXGuw+Q0= +github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.1016 h1:gFA+fJStsfNwOAfVrgpjej4iq1A/YdWW4GB2D6B8fGk= +github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.1016/go.mod h1:r5r4xbfxSaeR04b166HGsBa/R4U3SueirEUpXGuw+Q0= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= go.opentelemetry.io/collector/component v0.111.1-0.20241008154146-ea48c09c31ae h1:dXAMqXGJp1vWG7qwS/2sjIyJgmyOSfEOm6Gcmkzp1cQ= From 0f09d417c66a86d87fab277759d1f3e3cd20950f Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 9 Oct 2024 12:22:14 -0700 Subject: [PATCH 006/140] Update module github.com/GoogleCloudPlatform/opentelemetry-operations-go/extension/googleclientauthextension to v0.48.2 (#35380) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [github.com/GoogleCloudPlatform/opentelemetry-operations-go/extension/googleclientauthextension](https://redirect.github.com/GoogleCloudPlatform/opentelemetry-operations-go) | `v0.48.1` -> `v0.48.2` | [![age](https://developer.mend.io/api/mc/badges/age/go/github.com%2fGoogleCloudPlatform%2fopentelemetry-operations-go%2fextension%2fgoogleclientauthextension/v0.48.2?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/go/github.com%2fGoogleCloudPlatform%2fopentelemetry-operations-go%2fextension%2fgoogleclientauthextension/v0.48.2?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/go/github.com%2fGoogleCloudPlatform%2fopentelemetry-operations-go%2fextension%2fgoogleclientauthextension/v0.48.1/v0.48.2?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/go/github.com%2fGoogleCloudPlatform%2fopentelemetry-operations-go%2fextension%2fgoogleclientauthextension/v0.48.1/v0.48.2?slim=true)](https://docs.renovatebot.com/merge-confidence/) | --- > [!WARNING] > Some dependencies could not be looked up. Check the Dependency Dashboard for more information. --- ### Release Notes
GoogleCloudPlatform/opentelemetry-operations-go (github.com/GoogleCloudPlatform/opentelemetry-operations-go/extension/googleclientauthextension) ### [`v0.48.2`](https://redirect.github.com/GoogleCloudPlatform/opentelemetry-operations-go/releases/tag/v0.48.2): v1.24.2 and v0.48.2 [Compare Source](https://redirect.github.com/GoogleCloudPlatform/opentelemetry-operations-go/compare/v0.48.1...v0.48.2) #### What's Changed - Support k8s on GCE in resource detector by [@​dashpole](https://redirect.github.com/dashpole) in [https://github.com/GoogleCloudPlatform/opentelemetry-operations-go/pull/875](https://redirect.github.com/GoogleCloudPlatform/opentelemetry-operations-go/pull/875) - Add k8s.cluster.uid fallback for GMP by [@​dashpole](https://redirect.github.com/dashpole) in [https://github.com/GoogleCloudPlatform/opentelemetry-operations-go/pull/877](https://redirect.github.com/GoogleCloudPlatform/opentelemetry-operations-go/pull/877) - Add k8s.container.name to GMP fallbacks when using pod name by [@​dashpole](https://redirect.github.com/dashpole) in [https://github.com/GoogleCloudPlatform/opentelemetry-operations-go/pull/878](https://redirect.github.com/GoogleCloudPlatform/opentelemetry-operations-go/pull/878) - fix presubmit tests by [@​dashpole](https://redirect.github.com/dashpole) in [https://github.com/GoogleCloudPlatform/opentelemetry-operations-go/pull/881](https://redirect.github.com/GoogleCloudPlatform/opentelemetry-operations-go/pull/881) - Ensure config can be marshalled by [@​dashpole](https://redirect.github.com/dashpole) in [https://github.com/GoogleCloudPlatform/opentelemetry-operations-go/pull/880](https://redirect.github.com/GoogleCloudPlatform/opentelemetry-operations-go/pull/880) - Migrate e2e tests Container Registry usage to Artifact Registry by [@​aabmass](https://redirect.github.com/aabmass) in [https://github.com/GoogleCloudPlatform/opentelemetry-operations-go/pull/882](https://redirect.github.com/GoogleCloudPlatform/opentelemetry-operations-go/pull/882) - Add benchmarks for areas of the collector exporter with high memory usage by [@​dashpole](https://redirect.github.com/dashpole) in [https://github.com/GoogleCloudPlatform/opentelemetry-operations-go/pull/884](https://redirect.github.com/GoogleCloudPlatform/opentelemetry-operations-go/pull/884) - Migrate collector self-observability from OpenCensus to OpenTelemetry by [@​dashpole](https://redirect.github.com/dashpole) in [https://github.com/GoogleCloudPlatform/opentelemetry-operations-go/pull/885](https://redirect.github.com/GoogleCloudPlatform/opentelemetry-operations-go/pull/885) - Switch to uint64 hash for identifier by [@​dashpole](https://redirect.github.com/dashpole) in [https://github.com/GoogleCloudPlatform/opentelemetry-operations-go/pull/886](https://redirect.github.com/GoogleCloudPlatform/opentelemetry-operations-go/pull/886) - Update go version used in CI to 1.23.1 by [@​dashpole](https://redirect.github.com/dashpole) in [https://github.com/GoogleCloudPlatform/opentelemetry-operations-go/pull/891](https://redirect.github.com/GoogleCloudPlatform/opentelemetry-operations-go/pull/891) - exporter/collector: avoid using req.String() to check for empty request by [@​ridwanmsharif](https://redirect.github.com/ridwanmsharif) in [https://github.com/GoogleCloudPlatform/opentelemetry-operations-go/pull/889](https://redirect.github.com/GoogleCloudPlatform/opentelemetry-operations-go/pull/889) - Support timeout in Collector Logs exporter by [@​damemi](https://redirect.github.com/damemi) in [https://github.com/GoogleCloudPlatform/opentelemetry-operations-go/pull/894](https://redirect.github.com/GoogleCloudPlatform/opentelemetry-operations-go/pull/894) - Add benchmark for normalization with reset points by [@​dashpole](https://redirect.github.com/dashpole) in [https://github.com/GoogleCloudPlatform/opentelemetry-operations-go/pull/893](https://redirect.github.com/GoogleCloudPlatform/opentelemetry-operations-go/pull/893) - Make the collector exporter mutate data, and remove unnecessary CopyTo by [@​dashpole](https://redirect.github.com/dashpole) in [https://github.com/GoogleCloudPlatform/opentelemetry-operations-go/pull/892](https://redirect.github.com/GoogleCloudPlatform/opentelemetry-operations-go/pull/892) - Optimize normalization caching and copying by [@​dashpole](https://redirect.github.com/dashpole) in [https://github.com/GoogleCloudPlatform/opentelemetry-operations-go/pull/890](https://redirect.github.com/GoogleCloudPlatform/opentelemetry-operations-go/pull/890) - Prepare 1.24.2 and 0.48.2 by [@​damemi](https://redirect.github.com/damemi) in [https://github.com/GoogleCloudPlatform/opentelemetry-operations-go/pull/895](https://redirect.github.com/GoogleCloudPlatform/opentelemetry-operations-go/pull/895) **Full Changelog**: https://github.com/GoogleCloudPlatform/opentelemetry-operations-go/compare/v0.48.1...v0.48.2
--- ### Configuration 📅 **Schedule**: Branch creation - "on tuesday" (UTC), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, check this box --- This PR was generated by [Mend Renovate](https://mend.io/renovate/). View the [repository job log](https://developer.mend.io/github/open-telemetry/opentelemetry-collector-contrib). --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: opentelemetrybot <107717825+opentelemetrybot@users.noreply.github.com> --- extension/googleclientauthextension/go.mod | 4 ++-- extension/googleclientauthextension/go.sum | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/extension/googleclientauthextension/go.mod b/extension/googleclientauthextension/go.mod index a34f02746fb0..7c0a94d75248 100644 --- a/extension/googleclientauthextension/go.mod +++ b/extension/googleclientauthextension/go.mod @@ -5,7 +5,7 @@ go 1.22.0 exclude github.com/knadh/koanf v1.5.0 require ( - github.com/GoogleCloudPlatform/opentelemetry-operations-go/extension/googleclientauthextension v0.48.1 + github.com/GoogleCloudPlatform/opentelemetry-operations-go/extension/googleclientauthextension v0.48.2 github.com/stretchr/testify v1.9.0 go.opentelemetry.io/collector/component v0.111.1-0.20241008154146-ea48c09c31ae go.opentelemetry.io/collector/confmap v1.17.1-0.20241008154146-ea48c09c31ae @@ -35,7 +35,7 @@ require ( go.opencensus.io v0.24.0 // indirect go.opentelemetry.io/collector/config/configtelemetry v0.111.1-0.20241008154146-ea48c09c31ae // indirect go.opentelemetry.io/collector/pdata v1.17.1-0.20241008154146-ea48c09c31ae // indirect - go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.53.0 // indirect + go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.55.0 // indirect go.opentelemetry.io/otel v1.30.0 // indirect go.opentelemetry.io/otel/metric v1.30.0 // indirect go.opentelemetry.io/otel/sdk v1.30.0 // indirect diff --git a/extension/googleclientauthextension/go.sum b/extension/googleclientauthextension/go.sum index c245703e530a..4efcbe6183fd 100644 --- a/extension/googleclientauthextension/go.sum +++ b/extension/googleclientauthextension/go.sum @@ -2,8 +2,8 @@ cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMT cloud.google.com/go/compute/metadata v0.5.0 h1:Zr0eK8JbFv6+Wi4ilXAR8FJ3wyNdpxHKJNPos6LTZOY= cloud.google.com/go/compute/metadata v0.5.0/go.mod h1:aHnloV2TPI38yx4s9+wAZhHykWvVCfu7hQbF+9CWoiY= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/GoogleCloudPlatform/opentelemetry-operations-go/extension/googleclientauthextension v0.48.1 h1:aDHQzMbI6DtBtuWiWsg2oJyzDtpNo5gmVIInub0hCRQ= -github.com/GoogleCloudPlatform/opentelemetry-operations-go/extension/googleclientauthextension v0.48.1/go.mod h1:AiYjjg798z0U8X9g9J93AG7a027QUt7afw1+iYPjhss= +github.com/GoogleCloudPlatform/opentelemetry-operations-go/extension/googleclientauthextension v0.48.2 h1:MDREZloY3uB0eucNRm0csbSpY4v0E6yfz5iIWd/qHv4= +github.com/GoogleCloudPlatform/opentelemetry-operations-go/extension/googleclientauthextension v0.48.2/go.mod h1:fyVcDViWu5XWInTvIXalPmEytNY8vdcXPbT2CGtgDeY= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= @@ -103,8 +103,8 @@ go.opentelemetry.io/collector/pdata v1.17.1-0.20241008154146-ea48c09c31ae h1:Pcw go.opentelemetry.io/collector/pdata v1.17.1-0.20241008154146-ea48c09c31ae/go.mod h1:Ox1YVLe87cZDB/TL30i4SUz1cA5s6AM6SpFMfY61ICs= go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.49.0 h1:4Pp6oUg3+e/6M4C0A/3kJ2VYa++dsWVTtGgLVj5xtHg= go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.49.0/go.mod h1:Mjt1i1INqiaoZOMGR1RIUJN+i3ChKoFRqzrRQhlkbs0= -go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.53.0 h1:4K4tsIXefpVJtvA/8srF4V4y0akAoPHkIslgAkjixJA= -go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.53.0/go.mod h1:jjdQuTGVsXV4vSs+CJ2qYDeDPf9yIJV23qlIzBm73Vg= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.55.0 h1:ZIg3ZT/aQ7AfKqdwp7ECpOK6vHqquXXuyTjIO8ZdmPs= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.55.0/go.mod h1:DQAwmETtZV00skUwgD6+0U89g80NKsJE3DCKeLLPQMI= go.opentelemetry.io/otel v1.30.0 h1:F2t8sK4qf1fAmY9ua4ohFS/K+FUuOPemHUIXHtktrts= go.opentelemetry.io/otel v1.30.0/go.mod h1:tFw4Br9b7fOS+uEao81PJjVMjW/5fvNCbpsDIXqP0pc= go.opentelemetry.io/otel/metric v1.30.0 h1:4xNulvn9gjzo4hjg+wzIKG7iNFEaBMX00Qd4QIZs7+w= From e3c4b3656f22e0be6b8defc9141da5e3ba97cb7f Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 9 Oct 2024 13:32:15 -0700 Subject: [PATCH 007/140] Update All github.com/aws packages (#35702) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [github.com/aws/aws-sdk-go-v2](https://redirect.github.com/aws/aws-sdk-go-v2) | `v1.32.1` -> `v1.32.2` | [![age](https://developer.mend.io/api/mc/badges/age/go/github.com%2faws%2faws-sdk-go-v2/v1.32.2?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/go/github.com%2faws%2faws-sdk-go-v2/v1.32.2?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/go/github.com%2faws%2faws-sdk-go-v2/v1.32.1/v1.32.2?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/go/github.com%2faws%2faws-sdk-go-v2/v1.32.1/v1.32.2?slim=true)](https://docs.renovatebot.com/merge-confidence/) | | [github.com/aws/aws-sdk-go-v2/config](https://redirect.github.com/aws/aws-sdk-go-v2) | `v1.27.42` -> `v1.27.43` | [![age](https://developer.mend.io/api/mc/badges/age/go/github.com%2faws%2faws-sdk-go-v2%2fconfig/v1.27.43?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/go/github.com%2faws%2faws-sdk-go-v2%2fconfig/v1.27.43?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/go/github.com%2faws%2faws-sdk-go-v2%2fconfig/v1.27.42/v1.27.43?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/go/github.com%2faws%2faws-sdk-go-v2%2fconfig/v1.27.42/v1.27.43?slim=true)](https://docs.renovatebot.com/merge-confidence/) | | [github.com/aws/aws-sdk-go-v2/credentials](https://redirect.github.com/aws/aws-sdk-go-v2) | `v1.17.40` -> `v1.17.41` | [![age](https://developer.mend.io/api/mc/badges/age/go/github.com%2faws%2faws-sdk-go-v2%2fcredentials/v1.17.41?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/go/github.com%2faws%2faws-sdk-go-v2%2fcredentials/v1.17.41?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/go/github.com%2faws%2faws-sdk-go-v2%2fcredentials/v1.17.40/v1.17.41?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/go/github.com%2faws%2faws-sdk-go-v2%2fcredentials/v1.17.40/v1.17.41?slim=true)](https://docs.renovatebot.com/merge-confidence/) | | [github.com/aws/aws-sdk-go-v2/feature/s3/manager](https://redirect.github.com/aws/aws-sdk-go-v2) | `v1.17.29` -> `v1.17.30` | [![age](https://developer.mend.io/api/mc/badges/age/go/github.com%2faws%2faws-sdk-go-v2%2ffeature%2fs3%2fmanager/v1.17.30?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/go/github.com%2faws%2faws-sdk-go-v2%2ffeature%2fs3%2fmanager/v1.17.30?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/go/github.com%2faws%2faws-sdk-go-v2%2ffeature%2fs3%2fmanager/v1.17.29/v1.17.30?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/go/github.com%2faws%2faws-sdk-go-v2%2ffeature%2fs3%2fmanager/v1.17.29/v1.17.30?slim=true)](https://docs.renovatebot.com/merge-confidence/) | | [github.com/aws/aws-sdk-go-v2/service/kinesis](https://redirect.github.com/aws/aws-sdk-go-v2) | `v1.32.1` -> `v1.32.2` | [![age](https://developer.mend.io/api/mc/badges/age/go/github.com%2faws%2faws-sdk-go-v2%2fservice%2fkinesis/v1.32.2?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/go/github.com%2faws%2faws-sdk-go-v2%2fservice%2fkinesis/v1.32.2?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/go/github.com%2faws%2faws-sdk-go-v2%2fservice%2fkinesis/v1.32.1/v1.32.2?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/go/github.com%2faws%2faws-sdk-go-v2%2fservice%2fkinesis/v1.32.1/v1.32.2?slim=true)](https://docs.renovatebot.com/merge-confidence/) | | [github.com/aws/aws-sdk-go-v2/service/s3](https://redirect.github.com/aws/aws-sdk-go-v2) | `v1.65.1` -> `v1.65.2` | [![age](https://developer.mend.io/api/mc/badges/age/go/github.com%2faws%2faws-sdk-go-v2%2fservice%2fs3/v1.65.2?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/go/github.com%2faws%2faws-sdk-go-v2%2fservice%2fs3/v1.65.2?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/go/github.com%2faws%2faws-sdk-go-v2%2fservice%2fs3/v1.65.1/v1.65.2?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/go/github.com%2faws%2faws-sdk-go-v2%2fservice%2fs3/v1.65.1/v1.65.2?slim=true)](https://docs.renovatebot.com/merge-confidence/) | | [github.com/aws/aws-sdk-go-v2/service/secretsmanager](https://redirect.github.com/aws/aws-sdk-go-v2) | `v1.34.1` -> `v1.34.2` | [![age](https://developer.mend.io/api/mc/badges/age/go/github.com%2faws%2faws-sdk-go-v2%2fservice%2fsecretsmanager/v1.34.2?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/go/github.com%2faws%2faws-sdk-go-v2%2fservice%2fsecretsmanager/v1.34.2?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/go/github.com%2faws%2faws-sdk-go-v2%2fservice%2fsecretsmanager/v1.34.1/v1.34.2?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/go/github.com%2faws%2faws-sdk-go-v2%2fservice%2fsecretsmanager/v1.34.1/v1.34.2?slim=true)](https://docs.renovatebot.com/merge-confidence/) | | [github.com/aws/aws-sdk-go-v2/service/servicediscovery](https://redirect.github.com/aws/aws-sdk-go-v2) | `v1.33.1` -> `v1.33.2` | [![age](https://developer.mend.io/api/mc/badges/age/go/github.com%2faws%2faws-sdk-go-v2%2fservice%2fservicediscovery/v1.33.2?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/go/github.com%2faws%2faws-sdk-go-v2%2fservice%2fservicediscovery/v1.33.2?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/go/github.com%2faws%2faws-sdk-go-v2%2fservice%2fservicediscovery/v1.33.1/v1.33.2?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/go/github.com%2faws%2faws-sdk-go-v2%2fservice%2fservicediscovery/v1.33.1/v1.33.2?slim=true)](https://docs.renovatebot.com/merge-confidence/) | | [github.com/aws/aws-sdk-go-v2/service/sts](https://redirect.github.com/aws/aws-sdk-go-v2) | `v1.32.1` -> `v1.32.2` | [![age](https://developer.mend.io/api/mc/badges/age/go/github.com%2faws%2faws-sdk-go-v2%2fservice%2fsts/v1.32.2?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/go/github.com%2faws%2faws-sdk-go-v2%2fservice%2fsts/v1.32.2?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/go/github.com%2faws%2faws-sdk-go-v2%2fservice%2fsts/v1.32.1/v1.32.2?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/go/github.com%2faws%2faws-sdk-go-v2%2fservice%2fsts/v1.32.1/v1.32.2?slim=true)](https://docs.renovatebot.com/merge-confidence/) | --- > [!WARNING] > Some dependencies could not be looked up. Check the Dependency Dashboard for more information. --- ### Release Notes
aws/aws-sdk-go-v2 (github.com/aws/aws-sdk-go-v2) ### [`v1.32.2`](https://redirect.github.com/aws/aws-sdk-go-v2/compare/v1.32.1...v1.32.2) [Compare Source](https://redirect.github.com/aws/aws-sdk-go-v2/compare/v1.32.1...v1.32.2)
--- ### Configuration 📅 **Schedule**: Branch creation - "on tuesday" (UTC), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 👻 **Immortal**: This PR will be recreated if closed unmerged. Get [config help](https://redirect.github.com/renovatebot/renovate/discussions) if that's undesired. --- - [ ] If you want to rebase/retry this PR, check this box --- This PR was generated by [Mend Renovate](https://mend.io/renovate/). View the [repository job log](https://developer.mend.io/github/open-telemetry/opentelemetry-collector-contrib). --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: opentelemetrybot <107717825+opentelemetrybot@users.noreply.github.com> --- confmap/provider/s3provider/go.mod | 28 ++++----- confmap/provider/s3provider/go.sum | 56 ++++++++--------- .../provider/secretsmanagerprovider/go.mod | 22 +++---- .../provider/secretsmanagerprovider/go.sum | 44 +++++++------- exporter/awskinesisexporter/go.mod | 22 +++---- exporter/awskinesisexporter/go.sum | 44 +++++++------- exporter/loadbalancingexporter/go.mod | 22 +++---- exporter/loadbalancingexporter/go.sum | 44 +++++++------- extension/sigv4authextension/go.mod | 20 +++---- extension/sigv4authextension/go.sum | 40 ++++++------- receiver/awss3receiver/go.mod | 30 +++++----- receiver/awss3receiver/go.sum | 60 +++++++++---------- 12 files changed, 216 insertions(+), 216 deletions(-) diff --git a/confmap/provider/s3provider/go.mod b/confmap/provider/s3provider/go.mod index 1b7417d252df..5917822dd827 100644 --- a/confmap/provider/s3provider/go.mod +++ b/confmap/provider/s3provider/go.mod @@ -3,9 +3,9 @@ module github.com/open-telemetry/opentelemetry-collector-contrib/confmap/provide go 1.22.0 require ( - github.com/aws/aws-sdk-go-v2 v1.32.1 - github.com/aws/aws-sdk-go-v2/config v1.27.42 - github.com/aws/aws-sdk-go-v2/service/s3 v1.65.1 + github.com/aws/aws-sdk-go-v2 v1.32.2 + github.com/aws/aws-sdk-go-v2/config v1.27.43 + github.com/aws/aws-sdk-go-v2/service/s3 v1.65.2 github.com/stretchr/testify v1.9.0 go.opentelemetry.io/collector/confmap v1.17.1-0.20241008154146-ea48c09c31ae go.uber.org/goleak v1.3.0 @@ -14,19 +14,19 @@ require ( require ( github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.6.6 // indirect - github.com/aws/aws-sdk-go-v2/credentials v1.17.40 // indirect - github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.16 // indirect - github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.20 // indirect - github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.20 // indirect + github.com/aws/aws-sdk-go-v2/credentials v1.17.41 // indirect + github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.17 // indirect + github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.21 // indirect + github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.21 // indirect github.com/aws/aws-sdk-go-v2/internal/ini v1.8.1 // indirect - github.com/aws/aws-sdk-go-v2/internal/v4a v1.3.20 // indirect + github.com/aws/aws-sdk-go-v2/internal/v4a v1.3.21 // indirect github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.12.0 // indirect - github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.4.1 // indirect - github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.12.1 // indirect - github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.18.1 // indirect - github.com/aws/aws-sdk-go-v2/service/sso v1.24.1 // indirect - github.com/aws/aws-sdk-go-v2/service/ssooidc v1.28.1 // indirect - github.com/aws/aws-sdk-go-v2/service/sts v1.32.1 // indirect + github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.4.2 // indirect + github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.12.2 // indirect + github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.18.2 // indirect + github.com/aws/aws-sdk-go-v2/service/sso v1.24.2 // indirect + github.com/aws/aws-sdk-go-v2/service/ssooidc v1.28.2 // indirect + github.com/aws/aws-sdk-go-v2/service/sts v1.32.2 // indirect github.com/aws/smithy-go v1.22.0 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/go-viper/mapstructure/v2 v2.1.0 // indirect diff --git a/confmap/provider/s3provider/go.sum b/confmap/provider/s3provider/go.sum index 5f3f776d194b..8f63ee7d6c86 100644 --- a/confmap/provider/s3provider/go.sum +++ b/confmap/provider/s3provider/go.sum @@ -1,37 +1,37 @@ -github.com/aws/aws-sdk-go-v2 v1.32.1 h1:8WuZ43ytA+TV6QEPT/R23mr7pWyI7bSSiEHdt9BS2Pw= -github.com/aws/aws-sdk-go-v2 v1.32.1/go.mod h1:2SK5n0a2karNTv5tbP1SjsX0uhttou00v/HpXKM1ZUo= +github.com/aws/aws-sdk-go-v2 v1.32.2 h1:AkNLZEyYMLnx/Q/mSKkcMqwNFXMAvFto9bNsHqcTduI= +github.com/aws/aws-sdk-go-v2 v1.32.2/go.mod h1:2SK5n0a2karNTv5tbP1SjsX0uhttou00v/HpXKM1ZUo= github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.6.6 h1:pT3hpW0cOHRJx8Y0DfJUEQuqPild8jRGmSFmBgvydr0= github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.6.6/go.mod h1:j/I2++U0xX+cr44QjHay4Cvxj6FUbnxrgmqN3H1jTZA= -github.com/aws/aws-sdk-go-v2/config v1.27.42 h1:Zsy9coUPuOsCWkjTvHpl2/DB9bptXtv7WeNPxvFr87s= -github.com/aws/aws-sdk-go-v2/config v1.27.42/go.mod h1:FGASs+PuJM2EY+8rt8qyQKLPbbX/S5oY+6WzJ/KE7ko= -github.com/aws/aws-sdk-go-v2/credentials v1.17.40 h1:RjnlA7t0p/IamxAM7FUJ5uS13Vszh4sjVGvsx91tGro= -github.com/aws/aws-sdk-go-v2/credentials v1.17.40/go.mod h1:dgpdnSs1Bp/atS6vLlW83h9xZPP+uSPB/27dFSgC1BM= -github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.16 h1:fwrer1pJeaiia0CcOfWVbZxvj9Adc7rsuaMTwPR0DIA= -github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.16/go.mod h1:XyEwwp8XI4zMar7MTnJ0Sk7qY/9aN8Hp929XhuX5SF8= -github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.20 h1:OErdlGnt+hg3tTwGYAlKvFkKVUo/TXkoHcxDxuhYYU8= -github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.20/go.mod h1:HsPfuL5gs+407ByRXBMgpYoyrV1sgMrzd18yMXQHJpo= -github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.20 h1:822cE1CYSwY/EZnErlF46pyynuxvf1p+VydHRQW+XNs= -github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.20/go.mod h1:79/Tn7H7hYC5Gjz6fbnOV4OeBpkao7E8Tv95RO72pMM= +github.com/aws/aws-sdk-go-v2/config v1.27.43 h1:p33fDDihFC390dhhuv8nOmX419wjOSDQRb+USt20RrU= +github.com/aws/aws-sdk-go-v2/config v1.27.43/go.mod h1:pYhbtvg1siOOg8h5an77rXle9tVG8T+BWLWAo7cOukc= +github.com/aws/aws-sdk-go-v2/credentials v1.17.41 h1:7gXo+Axmp+R4Z+AK8YFQO0ZV3L0gizGINCOWxSLY9W8= +github.com/aws/aws-sdk-go-v2/credentials v1.17.41/go.mod h1:u4Eb8d3394YLubphT4jLEwN1rLNq2wFOlT6OuxFwPzU= +github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.17 h1:TMH3f/SCAWdNtXXVPPu5D6wrr4G5hI1rAxbcocKfC7Q= +github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.17/go.mod h1:1ZRXLdTpzdJb9fwTMXiLipENRxkGMTn1sfKexGllQCw= +github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.21 h1:UAsR3xA31QGf79WzpG/ixT9FZvQlh5HY1NRqSHBNOCk= +github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.21/go.mod h1:JNr43NFf5L9YaG3eKTm7HQzls9J+A9YYcGI5Quh1r2Y= +github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.21 h1:6jZVETqmYCadGFvrYEQfC5fAQmlo80CeL5psbno6r0s= +github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.21/go.mod h1:1SR0GbLlnN3QUmYaflZNiH1ql+1qrSiB2vwcJ+4UM60= github.com/aws/aws-sdk-go-v2/internal/ini v1.8.1 h1:VaRN3TlFdd6KxX1x3ILT5ynH6HvKgqdiXoTxAF4HQcQ= github.com/aws/aws-sdk-go-v2/internal/ini v1.8.1/go.mod h1:FbtygfRFze9usAadmnGJNc8KsP346kEe+y2/oyhGAGc= -github.com/aws/aws-sdk-go-v2/internal/v4a v1.3.20 h1:HO5UCCkLmeWkJZHLvLDfylKv8ca28XLAX3HojZz2shI= -github.com/aws/aws-sdk-go-v2/internal/v4a v1.3.20/go.mod h1:IO0HUM6Ouk/s7Rx3hiLtFU3mc+9OJFFygjsaxFBhAbk= +github.com/aws/aws-sdk-go-v2/internal/v4a v1.3.21 h1:7edmS3VOBDhK00b/MwGtGglCm7hhwNYnjJs/PgFdMQE= +github.com/aws/aws-sdk-go-v2/internal/v4a v1.3.21/go.mod h1:Q9o5h4HoIWG8XfzxqiuK/CGUbepCJ8uTlaE3bAbxytQ= github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.12.0 h1:TToQNkvGguu209puTojY/ozlqy2d/SFNcoLIqTFi42g= github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.12.0/go.mod h1:0jp+ltwkf+SwG2fm/PKo8t4y8pJSgOCO4D8Lz3k0aHQ= -github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.4.1 h1:UeW3Ul28hkKvB3beWImBvO7U62tSmapxaqk8sX9SMCU= -github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.4.1/go.mod h1:TER/1DuTxSN6RFQpk3xfD9hK4A1gQ7ainfkwHV3LPtU= -github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.12.1 h1:5vBMBTakOvtd8aNaicswcrr9qqCYUlasuzyoU6/0g8I= -github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.12.1/go.mod h1:WSUbDa5qdg05Q558KXx2Scb+EDvOPXT9gfET0fyrJSk= -github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.18.1 h1:T6oOYbNQ+iqdtG1/mTJvMBg/YFyHR8Z8URyG3qK+Anc= -github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.18.1/go.mod h1:25CEM6c1e2vyLcr3fPritPsdsoMwNAOc9//M1QAwtDk= -github.com/aws/aws-sdk-go-v2/service/s3 v1.65.1 h1:HQR79P0F0C2YQOaS2Z+90YK9DH22z9D6Neplaj0yuy4= -github.com/aws/aws-sdk-go-v2/service/s3 v1.65.1/go.mod h1:xYVl5BX9Ws7+ZM58b3w0kq36TR1Dgw2OMkjSr6YTWXg= -github.com/aws/aws-sdk-go-v2/service/sso v1.24.1 h1:aAIr0WhAgvKrxZtkBqne87Gjmd7/lJVTFkR2l2yuhL8= -github.com/aws/aws-sdk-go-v2/service/sso v1.24.1/go.mod h1:8XhxGMWUfikJuginPQl5SGZ0LSJuNX3TCEQmFWZwHTM= -github.com/aws/aws-sdk-go-v2/service/ssooidc v1.28.1 h1:J6kIsIkgFOaU6aKjigXJoue1XEHtKIIrpSh4vKdmRTs= -github.com/aws/aws-sdk-go-v2/service/ssooidc v1.28.1/go.mod h1:2V2JLP7tXOmUbL3Hd1ojq+774t2KUAEQ35//shoNEL0= -github.com/aws/aws-sdk-go-v2/service/sts v1.32.1 h1:q76Ig4OaJzVJGNUSGO3wjSTBS94g+EhHIbpY9rPvkxs= -github.com/aws/aws-sdk-go-v2/service/sts v1.32.1/go.mod h1:664dajZ7uS7JMUMUG0R5bWbtN97KECNCVdFDdQ6Ipu8= +github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.4.2 h1:4FMHqLfk0efmTqhXVRL5xYRqlEBNBiRI7N6w4jsEdd4= +github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.4.2/go.mod h1:LWoqeWlK9OZeJxsROW2RqrSPvQHKTpp69r/iDjwsSaw= +github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.12.2 h1:s7NA1SOw8q/5c0wr8477yOPp0z+uBaXBnLE0XYb0POA= +github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.12.2/go.mod h1:fnjjWyAW/Pj5HYOxl9LJqWtEwS7W2qgcRLWP+uWbss0= +github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.18.2 h1:t7iUP9+4wdc5lt3E41huP+GvQZJD38WLsgVp4iOtAjg= +github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.18.2/go.mod h1:/niFCtmuQNxqx9v8WAPq5qh7EH25U4BF6tjoyq9bObM= +github.com/aws/aws-sdk-go-v2/service/s3 v1.65.2 h1:yi8m+jepdp6foK14xXLGkYBenxnlcfJ45ka4Pg7fDSQ= +github.com/aws/aws-sdk-go-v2/service/s3 v1.65.2/go.mod h1:cB6oAuus7YXRZhWCc1wIwPywwZ1XwweNp2TVAEGYeB8= +github.com/aws/aws-sdk-go-v2/service/sso v1.24.2 h1:bSYXVyUzoTHoKalBmwaZxs97HU9DWWI3ehHSAMa7xOk= +github.com/aws/aws-sdk-go-v2/service/sso v1.24.2/go.mod h1:skMqY7JElusiOUjMJMOv1jJsP7YUg7DrhgqZZWuzu1U= +github.com/aws/aws-sdk-go-v2/service/ssooidc v1.28.2 h1:AhmO1fHINP9vFYUE0LHzCWg/LfUWUF+zFPEcY9QXb7o= +github.com/aws/aws-sdk-go-v2/service/ssooidc v1.28.2/go.mod h1:o8aQygT2+MVP0NaV6kbdE1YnnIM8RRVQzoeUH45GOdI= +github.com/aws/aws-sdk-go-v2/service/sts v1.32.2 h1:CiS7i0+FUe+/YY1GvIBLLrR/XNGZ4CtM1Ll0XavNuVo= +github.com/aws/aws-sdk-go-v2/service/sts v1.32.2/go.mod h1:HtaiBI8CjYoNVde8arShXb94UbQQi9L4EMr6D+xGBwo= github.com/aws/smithy-go v1.22.0 h1:uunKnWlcoL3zO7q+gG2Pk53joueEOsnNB28QdMsmiMM= github.com/aws/smithy-go v1.22.0/go.mod h1:irrKGvNn1InZwb2d7fkIRNucdfwR8R+Ts3wxYa/cJHg= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= diff --git a/confmap/provider/secretsmanagerprovider/go.mod b/confmap/provider/secretsmanagerprovider/go.mod index e73090f99279..2b8629d05198 100644 --- a/confmap/provider/secretsmanagerprovider/go.mod +++ b/confmap/provider/secretsmanagerprovider/go.mod @@ -3,24 +3,24 @@ module github.com/open-telemetry/opentelemetry-collector-contrib/confmap/provide go 1.22.0 require ( - github.com/aws/aws-sdk-go-v2/config v1.27.42 - github.com/aws/aws-sdk-go-v2/service/secretsmanager v1.34.1 + github.com/aws/aws-sdk-go-v2/config v1.27.43 + github.com/aws/aws-sdk-go-v2/service/secretsmanager v1.34.2 github.com/stretchr/testify v1.9.0 go.opentelemetry.io/collector/confmap v1.17.1-0.20241008154146-ea48c09c31ae ) require ( - github.com/aws/aws-sdk-go-v2 v1.32.1 // indirect - github.com/aws/aws-sdk-go-v2/credentials v1.17.40 // indirect - github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.16 // indirect - github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.20 // indirect - github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.20 // indirect + github.com/aws/aws-sdk-go-v2 v1.32.2 // indirect + github.com/aws/aws-sdk-go-v2/credentials v1.17.41 // indirect + github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.17 // indirect + github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.21 // indirect + github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.21 // indirect github.com/aws/aws-sdk-go-v2/internal/ini v1.8.1 // indirect github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.12.0 // indirect - github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.12.1 // indirect - github.com/aws/aws-sdk-go-v2/service/sso v1.24.1 // indirect - github.com/aws/aws-sdk-go-v2/service/ssooidc v1.28.1 // indirect - github.com/aws/aws-sdk-go-v2/service/sts v1.32.1 // indirect + github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.12.2 // indirect + github.com/aws/aws-sdk-go-v2/service/sso v1.24.2 // indirect + github.com/aws/aws-sdk-go-v2/service/ssooidc v1.28.2 // indirect + github.com/aws/aws-sdk-go-v2/service/sts v1.32.2 // indirect github.com/aws/smithy-go v1.22.0 // indirect github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/go-viper/mapstructure/v2 v2.1.0 // indirect diff --git a/confmap/provider/secretsmanagerprovider/go.sum b/confmap/provider/secretsmanagerprovider/go.sum index ef305ea95e8b..56dcbf918c54 100644 --- a/confmap/provider/secretsmanagerprovider/go.sum +++ b/confmap/provider/secretsmanagerprovider/go.sum @@ -12,21 +12,21 @@ github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmV github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= github.com/armon/go-radix v1.0.0/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= github.com/aws/aws-sdk-go-v2 v1.9.2/go.mod h1:cK/D0BBs0b/oWPIcX/Z/obahJK1TT7IPVjy53i/mX/4= -github.com/aws/aws-sdk-go-v2 v1.32.1 h1:8WuZ43ytA+TV6QEPT/R23mr7pWyI7bSSiEHdt9BS2Pw= -github.com/aws/aws-sdk-go-v2 v1.32.1/go.mod h1:2SK5n0a2karNTv5tbP1SjsX0uhttou00v/HpXKM1ZUo= +github.com/aws/aws-sdk-go-v2 v1.32.2 h1:AkNLZEyYMLnx/Q/mSKkcMqwNFXMAvFto9bNsHqcTduI= +github.com/aws/aws-sdk-go-v2 v1.32.2/go.mod h1:2SK5n0a2karNTv5tbP1SjsX0uhttou00v/HpXKM1ZUo= github.com/aws/aws-sdk-go-v2/config v1.8.3/go.mod h1:4AEiLtAb8kLs7vgw2ZV3p2VZ1+hBavOc84hqxVNpCyw= -github.com/aws/aws-sdk-go-v2/config v1.27.42 h1:Zsy9coUPuOsCWkjTvHpl2/DB9bptXtv7WeNPxvFr87s= -github.com/aws/aws-sdk-go-v2/config v1.27.42/go.mod h1:FGASs+PuJM2EY+8rt8qyQKLPbbX/S5oY+6WzJ/KE7ko= +github.com/aws/aws-sdk-go-v2/config v1.27.43 h1:p33fDDihFC390dhhuv8nOmX419wjOSDQRb+USt20RrU= +github.com/aws/aws-sdk-go-v2/config v1.27.43/go.mod h1:pYhbtvg1siOOg8h5an77rXle9tVG8T+BWLWAo7cOukc= github.com/aws/aws-sdk-go-v2/credentials v1.4.3/go.mod h1:FNNC6nQZQUuyhq5aE5c7ata8o9e4ECGmS4lAXC7o1mQ= -github.com/aws/aws-sdk-go-v2/credentials v1.17.40 h1:RjnlA7t0p/IamxAM7FUJ5uS13Vszh4sjVGvsx91tGro= -github.com/aws/aws-sdk-go-v2/credentials v1.17.40/go.mod h1:dgpdnSs1Bp/atS6vLlW83h9xZPP+uSPB/27dFSgC1BM= +github.com/aws/aws-sdk-go-v2/credentials v1.17.41 h1:7gXo+Axmp+R4Z+AK8YFQO0ZV3L0gizGINCOWxSLY9W8= +github.com/aws/aws-sdk-go-v2/credentials v1.17.41/go.mod h1:u4Eb8d3394YLubphT4jLEwN1rLNq2wFOlT6OuxFwPzU= github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.6.0/go.mod h1:gqlclDEZp4aqJOancXK6TN24aKhT0W0Ae9MHk3wzTMM= -github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.16 h1:fwrer1pJeaiia0CcOfWVbZxvj9Adc7rsuaMTwPR0DIA= -github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.16/go.mod h1:XyEwwp8XI4zMar7MTnJ0Sk7qY/9aN8Hp929XhuX5SF8= -github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.20 h1:OErdlGnt+hg3tTwGYAlKvFkKVUo/TXkoHcxDxuhYYU8= -github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.20/go.mod h1:HsPfuL5gs+407ByRXBMgpYoyrV1sgMrzd18yMXQHJpo= -github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.20 h1:822cE1CYSwY/EZnErlF46pyynuxvf1p+VydHRQW+XNs= -github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.20/go.mod h1:79/Tn7H7hYC5Gjz6fbnOV4OeBpkao7E8Tv95RO72pMM= +github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.17 h1:TMH3f/SCAWdNtXXVPPu5D6wrr4G5hI1rAxbcocKfC7Q= +github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.17/go.mod h1:1ZRXLdTpzdJb9fwTMXiLipENRxkGMTn1sfKexGllQCw= +github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.21 h1:UAsR3xA31QGf79WzpG/ixT9FZvQlh5HY1NRqSHBNOCk= +github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.21/go.mod h1:JNr43NFf5L9YaG3eKTm7HQzls9J+A9YYcGI5Quh1r2Y= +github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.21 h1:6jZVETqmYCadGFvrYEQfC5fAQmlo80CeL5psbno6r0s= +github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.21/go.mod h1:1SR0GbLlnN3QUmYaflZNiH1ql+1qrSiB2vwcJ+4UM60= github.com/aws/aws-sdk-go-v2/internal/ini v1.2.4/go.mod h1:ZcBrrI3zBKlhGFNYWvju0I3TR93I7YIgAfy82Fh4lcQ= github.com/aws/aws-sdk-go-v2/internal/ini v1.8.1 h1:VaRN3TlFdd6KxX1x3ILT5ynH6HvKgqdiXoTxAF4HQcQ= github.com/aws/aws-sdk-go-v2/internal/ini v1.8.1/go.mod h1:FbtygfRFze9usAadmnGJNc8KsP346kEe+y2/oyhGAGc= @@ -34,18 +34,18 @@ github.com/aws/aws-sdk-go-v2/service/appconfig v1.4.2/go.mod h1:FZ3HkCe+b10uFZZk github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.12.0 h1:TToQNkvGguu209puTojY/ozlqy2d/SFNcoLIqTFi42g= github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.12.0/go.mod h1:0jp+ltwkf+SwG2fm/PKo8t4y8pJSgOCO4D8Lz3k0aHQ= github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.3.2/go.mod h1:72HRZDLMtmVQiLG2tLfQcaWLCssELvGl+Zf2WVxMmR8= -github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.12.1 h1:5vBMBTakOvtd8aNaicswcrr9qqCYUlasuzyoU6/0g8I= -github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.12.1/go.mod h1:WSUbDa5qdg05Q558KXx2Scb+EDvOPXT9gfET0fyrJSk= -github.com/aws/aws-sdk-go-v2/service/secretsmanager v1.34.1 h1:NxhxUnLx7Bexlz0tcM9ikkWDcg9nqOti4ppCrBIP2/o= -github.com/aws/aws-sdk-go-v2/service/secretsmanager v1.34.1/go.mod h1:ZOm+hOpec53Pm14NWBDqg1oSj+FtxphlNIUrFo+fJec= +github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.12.2 h1:s7NA1SOw8q/5c0wr8477yOPp0z+uBaXBnLE0XYb0POA= +github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.12.2/go.mod h1:fnjjWyAW/Pj5HYOxl9LJqWtEwS7W2qgcRLWP+uWbss0= +github.com/aws/aws-sdk-go-v2/service/secretsmanager v1.34.2 h1:Rrqru2wYkKQCS2IM5/JrgKUQIoNTqA6y/iuxkjzxC6M= +github.com/aws/aws-sdk-go-v2/service/secretsmanager v1.34.2/go.mod h1:QuCURO98Sqee2AXmqDNxKXYFm2OEDAVAPApMqO0Vqnc= github.com/aws/aws-sdk-go-v2/service/sso v1.4.2/go.mod h1:NBvT9R1MEF+Ud6ApJKM0G+IkPchKS7p7c2YPKwHmBOk= -github.com/aws/aws-sdk-go-v2/service/sso v1.24.1 h1:aAIr0WhAgvKrxZtkBqne87Gjmd7/lJVTFkR2l2yuhL8= -github.com/aws/aws-sdk-go-v2/service/sso v1.24.1/go.mod h1:8XhxGMWUfikJuginPQl5SGZ0LSJuNX3TCEQmFWZwHTM= -github.com/aws/aws-sdk-go-v2/service/ssooidc v1.28.1 h1:J6kIsIkgFOaU6aKjigXJoue1XEHtKIIrpSh4vKdmRTs= -github.com/aws/aws-sdk-go-v2/service/ssooidc v1.28.1/go.mod h1:2V2JLP7tXOmUbL3Hd1ojq+774t2KUAEQ35//shoNEL0= +github.com/aws/aws-sdk-go-v2/service/sso v1.24.2 h1:bSYXVyUzoTHoKalBmwaZxs97HU9DWWI3ehHSAMa7xOk= +github.com/aws/aws-sdk-go-v2/service/sso v1.24.2/go.mod h1:skMqY7JElusiOUjMJMOv1jJsP7YUg7DrhgqZZWuzu1U= +github.com/aws/aws-sdk-go-v2/service/ssooidc v1.28.2 h1:AhmO1fHINP9vFYUE0LHzCWg/LfUWUF+zFPEcY9QXb7o= +github.com/aws/aws-sdk-go-v2/service/ssooidc v1.28.2/go.mod h1:o8aQygT2+MVP0NaV6kbdE1YnnIM8RRVQzoeUH45GOdI= github.com/aws/aws-sdk-go-v2/service/sts v1.7.2/go.mod h1:8EzeIqfWt2wWT4rJVu3f21TfrhJ8AEMzVybRNSb/b4g= -github.com/aws/aws-sdk-go-v2/service/sts v1.32.1 h1:q76Ig4OaJzVJGNUSGO3wjSTBS94g+EhHIbpY9rPvkxs= -github.com/aws/aws-sdk-go-v2/service/sts v1.32.1/go.mod h1:664dajZ7uS7JMUMUG0R5bWbtN97KECNCVdFDdQ6Ipu8= +github.com/aws/aws-sdk-go-v2/service/sts v1.32.2 h1:CiS7i0+FUe+/YY1GvIBLLrR/XNGZ4CtM1Ll0XavNuVo= +github.com/aws/aws-sdk-go-v2/service/sts v1.32.2/go.mod h1:HtaiBI8CjYoNVde8arShXb94UbQQi9L4EMr6D+xGBwo= github.com/aws/smithy-go v1.8.0/go.mod h1:SObp3lf9smib00L/v3U2eAKG8FyQ7iLrJnQiAmR5n+E= github.com/aws/smithy-go v1.22.0 h1:uunKnWlcoL3zO7q+gG2Pk53joueEOsnNB28QdMsmiMM= github.com/aws/smithy-go v1.22.0/go.mod h1:irrKGvNn1InZwb2d7fkIRNucdfwR8R+Ts3wxYa/cJHg= diff --git a/exporter/awskinesisexporter/go.mod b/exporter/awskinesisexporter/go.mod index d1882acdaca3..ff2e28f735d1 100644 --- a/exporter/awskinesisexporter/go.mod +++ b/exporter/awskinesisexporter/go.mod @@ -3,11 +3,11 @@ module github.com/open-telemetry/opentelemetry-collector-contrib/exporter/awskin go 1.22.0 require ( - github.com/aws/aws-sdk-go-v2 v1.32.1 - github.com/aws/aws-sdk-go-v2/config v1.27.42 - github.com/aws/aws-sdk-go-v2/credentials v1.17.40 - github.com/aws/aws-sdk-go-v2/service/kinesis v1.32.1 - github.com/aws/aws-sdk-go-v2/service/sts v1.32.1 + github.com/aws/aws-sdk-go-v2 v1.32.2 + github.com/aws/aws-sdk-go-v2/config v1.27.43 + github.com/aws/aws-sdk-go-v2/credentials v1.17.41 + github.com/aws/aws-sdk-go-v2/service/kinesis v1.32.2 + github.com/aws/aws-sdk-go-v2/service/sts v1.32.2 github.com/cenkalti/backoff/v4 v4.3.0 github.com/gogo/protobuf v1.3.2 github.com/google/uuid v1.6.0 @@ -29,14 +29,14 @@ require ( require ( github.com/apache/thrift v0.21.0 // indirect github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.6.6 // indirect - github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.16 // indirect - github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.20 // indirect - github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.20 // indirect + github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.17 // indirect + github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.21 // indirect + github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.21 // indirect github.com/aws/aws-sdk-go-v2/internal/ini v1.8.1 // indirect github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.12.0 // indirect - github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.12.1 // indirect - github.com/aws/aws-sdk-go-v2/service/sso v1.24.1 // indirect - github.com/aws/aws-sdk-go-v2/service/ssooidc v1.28.1 // indirect + github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.12.2 // indirect + github.com/aws/aws-sdk-go-v2/service/sso v1.24.2 // indirect + github.com/aws/aws-sdk-go-v2/service/ssooidc v1.28.2 // indirect github.com/aws/smithy-go v1.22.0 // indirect github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/go-logr/logr v1.4.2 // indirect diff --git a/exporter/awskinesisexporter/go.sum b/exporter/awskinesisexporter/go.sum index afa4dacd4a5a..7d9daf94dd18 100644 --- a/exporter/awskinesisexporter/go.sum +++ b/exporter/awskinesisexporter/go.sum @@ -1,33 +1,33 @@ github.com/apache/thrift v0.21.0 h1:tdPmh/ptjE1IJnhbhrcl2++TauVjy242rkV/UzJChnE= github.com/apache/thrift v0.21.0/go.mod h1:W1H8aR/QRtYNvrPeFXBtobyRkd0/YVhTc6i07XIAgDw= -github.com/aws/aws-sdk-go-v2 v1.32.1 h1:8WuZ43ytA+TV6QEPT/R23mr7pWyI7bSSiEHdt9BS2Pw= -github.com/aws/aws-sdk-go-v2 v1.32.1/go.mod h1:2SK5n0a2karNTv5tbP1SjsX0uhttou00v/HpXKM1ZUo= +github.com/aws/aws-sdk-go-v2 v1.32.2 h1:AkNLZEyYMLnx/Q/mSKkcMqwNFXMAvFto9bNsHqcTduI= +github.com/aws/aws-sdk-go-v2 v1.32.2/go.mod h1:2SK5n0a2karNTv5tbP1SjsX0uhttou00v/HpXKM1ZUo= github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.6.6 h1:pT3hpW0cOHRJx8Y0DfJUEQuqPild8jRGmSFmBgvydr0= github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.6.6/go.mod h1:j/I2++U0xX+cr44QjHay4Cvxj6FUbnxrgmqN3H1jTZA= -github.com/aws/aws-sdk-go-v2/config v1.27.42 h1:Zsy9coUPuOsCWkjTvHpl2/DB9bptXtv7WeNPxvFr87s= -github.com/aws/aws-sdk-go-v2/config v1.27.42/go.mod h1:FGASs+PuJM2EY+8rt8qyQKLPbbX/S5oY+6WzJ/KE7ko= -github.com/aws/aws-sdk-go-v2/credentials v1.17.40 h1:RjnlA7t0p/IamxAM7FUJ5uS13Vszh4sjVGvsx91tGro= -github.com/aws/aws-sdk-go-v2/credentials v1.17.40/go.mod h1:dgpdnSs1Bp/atS6vLlW83h9xZPP+uSPB/27dFSgC1BM= -github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.16 h1:fwrer1pJeaiia0CcOfWVbZxvj9Adc7rsuaMTwPR0DIA= -github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.16/go.mod h1:XyEwwp8XI4zMar7MTnJ0Sk7qY/9aN8Hp929XhuX5SF8= -github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.20 h1:OErdlGnt+hg3tTwGYAlKvFkKVUo/TXkoHcxDxuhYYU8= -github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.20/go.mod h1:HsPfuL5gs+407ByRXBMgpYoyrV1sgMrzd18yMXQHJpo= -github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.20 h1:822cE1CYSwY/EZnErlF46pyynuxvf1p+VydHRQW+XNs= -github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.20/go.mod h1:79/Tn7H7hYC5Gjz6fbnOV4OeBpkao7E8Tv95RO72pMM= +github.com/aws/aws-sdk-go-v2/config v1.27.43 h1:p33fDDihFC390dhhuv8nOmX419wjOSDQRb+USt20RrU= +github.com/aws/aws-sdk-go-v2/config v1.27.43/go.mod h1:pYhbtvg1siOOg8h5an77rXle9tVG8T+BWLWAo7cOukc= +github.com/aws/aws-sdk-go-v2/credentials v1.17.41 h1:7gXo+Axmp+R4Z+AK8YFQO0ZV3L0gizGINCOWxSLY9W8= +github.com/aws/aws-sdk-go-v2/credentials v1.17.41/go.mod h1:u4Eb8d3394YLubphT4jLEwN1rLNq2wFOlT6OuxFwPzU= +github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.17 h1:TMH3f/SCAWdNtXXVPPu5D6wrr4G5hI1rAxbcocKfC7Q= +github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.17/go.mod h1:1ZRXLdTpzdJb9fwTMXiLipENRxkGMTn1sfKexGllQCw= +github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.21 h1:UAsR3xA31QGf79WzpG/ixT9FZvQlh5HY1NRqSHBNOCk= +github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.21/go.mod h1:JNr43NFf5L9YaG3eKTm7HQzls9J+A9YYcGI5Quh1r2Y= +github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.21 h1:6jZVETqmYCadGFvrYEQfC5fAQmlo80CeL5psbno6r0s= +github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.21/go.mod h1:1SR0GbLlnN3QUmYaflZNiH1ql+1qrSiB2vwcJ+4UM60= github.com/aws/aws-sdk-go-v2/internal/ini v1.8.1 h1:VaRN3TlFdd6KxX1x3ILT5ynH6HvKgqdiXoTxAF4HQcQ= github.com/aws/aws-sdk-go-v2/internal/ini v1.8.1/go.mod h1:FbtygfRFze9usAadmnGJNc8KsP346kEe+y2/oyhGAGc= github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.12.0 h1:TToQNkvGguu209puTojY/ozlqy2d/SFNcoLIqTFi42g= github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.12.0/go.mod h1:0jp+ltwkf+SwG2fm/PKo8t4y8pJSgOCO4D8Lz3k0aHQ= -github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.12.1 h1:5vBMBTakOvtd8aNaicswcrr9qqCYUlasuzyoU6/0g8I= -github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.12.1/go.mod h1:WSUbDa5qdg05Q558KXx2Scb+EDvOPXT9gfET0fyrJSk= -github.com/aws/aws-sdk-go-v2/service/kinesis v1.32.1 h1:hJrGFoCudBWNlt49Jx6A6SFa1DOLgRFp2qWTY4jl/QA= -github.com/aws/aws-sdk-go-v2/service/kinesis v1.32.1/go.mod h1:2EJjwul5tDMJqaDYTk0MNyWt/kV4eqy0ptXPDKaa9X4= -github.com/aws/aws-sdk-go-v2/service/sso v1.24.1 h1:aAIr0WhAgvKrxZtkBqne87Gjmd7/lJVTFkR2l2yuhL8= -github.com/aws/aws-sdk-go-v2/service/sso v1.24.1/go.mod h1:8XhxGMWUfikJuginPQl5SGZ0LSJuNX3TCEQmFWZwHTM= -github.com/aws/aws-sdk-go-v2/service/ssooidc v1.28.1 h1:J6kIsIkgFOaU6aKjigXJoue1XEHtKIIrpSh4vKdmRTs= -github.com/aws/aws-sdk-go-v2/service/ssooidc v1.28.1/go.mod h1:2V2JLP7tXOmUbL3Hd1ojq+774t2KUAEQ35//shoNEL0= -github.com/aws/aws-sdk-go-v2/service/sts v1.32.1 h1:q76Ig4OaJzVJGNUSGO3wjSTBS94g+EhHIbpY9rPvkxs= -github.com/aws/aws-sdk-go-v2/service/sts v1.32.1/go.mod h1:664dajZ7uS7JMUMUG0R5bWbtN97KECNCVdFDdQ6Ipu8= +github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.12.2 h1:s7NA1SOw8q/5c0wr8477yOPp0z+uBaXBnLE0XYb0POA= +github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.12.2/go.mod h1:fnjjWyAW/Pj5HYOxl9LJqWtEwS7W2qgcRLWP+uWbss0= +github.com/aws/aws-sdk-go-v2/service/kinesis v1.32.2 h1:QtTD6aMYmo87x1rCOZBCtdAWabuoaDrDGGhO+Gw2Vxw= +github.com/aws/aws-sdk-go-v2/service/kinesis v1.32.2/go.mod h1:Yhl9I4DnKvHUnGd/W7xr73ip29jqdQ/hyXgbQkC9sCw= +github.com/aws/aws-sdk-go-v2/service/sso v1.24.2 h1:bSYXVyUzoTHoKalBmwaZxs97HU9DWWI3ehHSAMa7xOk= +github.com/aws/aws-sdk-go-v2/service/sso v1.24.2/go.mod h1:skMqY7JElusiOUjMJMOv1jJsP7YUg7DrhgqZZWuzu1U= +github.com/aws/aws-sdk-go-v2/service/ssooidc v1.28.2 h1:AhmO1fHINP9vFYUE0LHzCWg/LfUWUF+zFPEcY9QXb7o= +github.com/aws/aws-sdk-go-v2/service/ssooidc v1.28.2/go.mod h1:o8aQygT2+MVP0NaV6kbdE1YnnIM8RRVQzoeUH45GOdI= +github.com/aws/aws-sdk-go-v2/service/sts v1.32.2 h1:CiS7i0+FUe+/YY1GvIBLLrR/XNGZ4CtM1Ll0XavNuVo= +github.com/aws/aws-sdk-go-v2/service/sts v1.32.2/go.mod h1:HtaiBI8CjYoNVde8arShXb94UbQQi9L4EMr6D+xGBwo= github.com/aws/smithy-go v1.22.0 h1:uunKnWlcoL3zO7q+gG2Pk53joueEOsnNB28QdMsmiMM= github.com/aws/smithy-go v1.22.0/go.mod h1:irrKGvNn1InZwb2d7fkIRNucdfwR8R+Ts3wxYa/cJHg= github.com/cenkalti/backoff/v4 v4.3.0 h1:MyRJ/UdXutAwSAT+s3wNd7MfTIcy71VQueUuFK343L8= diff --git a/exporter/loadbalancingexporter/go.mod b/exporter/loadbalancingexporter/go.mod index 33ab57430f0c..eabe0ee0c0e3 100644 --- a/exporter/loadbalancingexporter/go.mod +++ b/exporter/loadbalancingexporter/go.mod @@ -3,8 +3,8 @@ module github.com/open-telemetry/opentelemetry-collector-contrib/exporter/loadba go 1.22.0 require ( - github.com/aws/aws-sdk-go-v2/config v1.27.42 - github.com/aws/aws-sdk-go-v2/service/servicediscovery v1.33.1 + github.com/aws/aws-sdk-go-v2/config v1.27.43 + github.com/aws/aws-sdk-go-v2/service/servicediscovery v1.33.2 github.com/aws/smithy-go v1.22.0 github.com/json-iterator/go v1.1.12 github.com/open-telemetry/opentelemetry-collector-contrib/internal/exp/metrics v0.111.0 @@ -38,17 +38,17 @@ require ( ) require ( - github.com/aws/aws-sdk-go-v2 v1.32.1 // indirect - github.com/aws/aws-sdk-go-v2/credentials v1.17.40 // indirect - github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.16 // indirect - github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.20 // indirect - github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.20 // indirect + github.com/aws/aws-sdk-go-v2 v1.32.2 // indirect + github.com/aws/aws-sdk-go-v2/credentials v1.17.41 // indirect + github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.17 // indirect + github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.21 // indirect + github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.21 // indirect github.com/aws/aws-sdk-go-v2/internal/ini v1.8.1 // indirect github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.12.0 // indirect - github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.12.1 // indirect - github.com/aws/aws-sdk-go-v2/service/sso v1.24.1 // indirect - github.com/aws/aws-sdk-go-v2/service/ssooidc v1.28.1 // indirect - github.com/aws/aws-sdk-go-v2/service/sts v1.32.1 // indirect + github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.12.2 // indirect + github.com/aws/aws-sdk-go-v2/service/sso v1.24.2 // indirect + github.com/aws/aws-sdk-go-v2/service/ssooidc v1.28.2 // indirect + github.com/aws/aws-sdk-go-v2/service/sts v1.32.2 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/cenkalti/backoff/v4 v4.3.0 // indirect github.com/cespare/xxhash/v2 v2.3.0 // indirect diff --git a/exporter/loadbalancingexporter/go.sum b/exporter/loadbalancingexporter/go.sum index 4b8ff8f78c77..9d02b3d84676 100644 --- a/exporter/loadbalancingexporter/go.sum +++ b/exporter/loadbalancingexporter/go.sum @@ -1,29 +1,29 @@ -github.com/aws/aws-sdk-go-v2 v1.32.1 h1:8WuZ43ytA+TV6QEPT/R23mr7pWyI7bSSiEHdt9BS2Pw= -github.com/aws/aws-sdk-go-v2 v1.32.1/go.mod h1:2SK5n0a2karNTv5tbP1SjsX0uhttou00v/HpXKM1ZUo= -github.com/aws/aws-sdk-go-v2/config v1.27.42 h1:Zsy9coUPuOsCWkjTvHpl2/DB9bptXtv7WeNPxvFr87s= -github.com/aws/aws-sdk-go-v2/config v1.27.42/go.mod h1:FGASs+PuJM2EY+8rt8qyQKLPbbX/S5oY+6WzJ/KE7ko= -github.com/aws/aws-sdk-go-v2/credentials v1.17.40 h1:RjnlA7t0p/IamxAM7FUJ5uS13Vszh4sjVGvsx91tGro= -github.com/aws/aws-sdk-go-v2/credentials v1.17.40/go.mod h1:dgpdnSs1Bp/atS6vLlW83h9xZPP+uSPB/27dFSgC1BM= -github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.16 h1:fwrer1pJeaiia0CcOfWVbZxvj9Adc7rsuaMTwPR0DIA= -github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.16/go.mod h1:XyEwwp8XI4zMar7MTnJ0Sk7qY/9aN8Hp929XhuX5SF8= -github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.20 h1:OErdlGnt+hg3tTwGYAlKvFkKVUo/TXkoHcxDxuhYYU8= -github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.20/go.mod h1:HsPfuL5gs+407ByRXBMgpYoyrV1sgMrzd18yMXQHJpo= -github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.20 h1:822cE1CYSwY/EZnErlF46pyynuxvf1p+VydHRQW+XNs= -github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.20/go.mod h1:79/Tn7H7hYC5Gjz6fbnOV4OeBpkao7E8Tv95RO72pMM= +github.com/aws/aws-sdk-go-v2 v1.32.2 h1:AkNLZEyYMLnx/Q/mSKkcMqwNFXMAvFto9bNsHqcTduI= +github.com/aws/aws-sdk-go-v2 v1.32.2/go.mod h1:2SK5n0a2karNTv5tbP1SjsX0uhttou00v/HpXKM1ZUo= +github.com/aws/aws-sdk-go-v2/config v1.27.43 h1:p33fDDihFC390dhhuv8nOmX419wjOSDQRb+USt20RrU= +github.com/aws/aws-sdk-go-v2/config v1.27.43/go.mod h1:pYhbtvg1siOOg8h5an77rXle9tVG8T+BWLWAo7cOukc= +github.com/aws/aws-sdk-go-v2/credentials v1.17.41 h1:7gXo+Axmp+R4Z+AK8YFQO0ZV3L0gizGINCOWxSLY9W8= +github.com/aws/aws-sdk-go-v2/credentials v1.17.41/go.mod h1:u4Eb8d3394YLubphT4jLEwN1rLNq2wFOlT6OuxFwPzU= +github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.17 h1:TMH3f/SCAWdNtXXVPPu5D6wrr4G5hI1rAxbcocKfC7Q= +github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.17/go.mod h1:1ZRXLdTpzdJb9fwTMXiLipENRxkGMTn1sfKexGllQCw= +github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.21 h1:UAsR3xA31QGf79WzpG/ixT9FZvQlh5HY1NRqSHBNOCk= +github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.21/go.mod h1:JNr43NFf5L9YaG3eKTm7HQzls9J+A9YYcGI5Quh1r2Y= +github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.21 h1:6jZVETqmYCadGFvrYEQfC5fAQmlo80CeL5psbno6r0s= +github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.21/go.mod h1:1SR0GbLlnN3QUmYaflZNiH1ql+1qrSiB2vwcJ+4UM60= github.com/aws/aws-sdk-go-v2/internal/ini v1.8.1 h1:VaRN3TlFdd6KxX1x3ILT5ynH6HvKgqdiXoTxAF4HQcQ= github.com/aws/aws-sdk-go-v2/internal/ini v1.8.1/go.mod h1:FbtygfRFze9usAadmnGJNc8KsP346kEe+y2/oyhGAGc= github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.12.0 h1:TToQNkvGguu209puTojY/ozlqy2d/SFNcoLIqTFi42g= github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.12.0/go.mod h1:0jp+ltwkf+SwG2fm/PKo8t4y8pJSgOCO4D8Lz3k0aHQ= -github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.12.1 h1:5vBMBTakOvtd8aNaicswcrr9qqCYUlasuzyoU6/0g8I= -github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.12.1/go.mod h1:WSUbDa5qdg05Q558KXx2Scb+EDvOPXT9gfET0fyrJSk= -github.com/aws/aws-sdk-go-v2/service/servicediscovery v1.33.1 h1:QRaE6W0KuU5GUGgklly1YK7Owhw3J7ZpO6wFsXpCMJQ= -github.com/aws/aws-sdk-go-v2/service/servicediscovery v1.33.1/go.mod h1:OZmsLDFkBEij+uekZcbHfYUK9ixD2IKem+mqAqoHSXM= -github.com/aws/aws-sdk-go-v2/service/sso v1.24.1 h1:aAIr0WhAgvKrxZtkBqne87Gjmd7/lJVTFkR2l2yuhL8= -github.com/aws/aws-sdk-go-v2/service/sso v1.24.1/go.mod h1:8XhxGMWUfikJuginPQl5SGZ0LSJuNX3TCEQmFWZwHTM= -github.com/aws/aws-sdk-go-v2/service/ssooidc v1.28.1 h1:J6kIsIkgFOaU6aKjigXJoue1XEHtKIIrpSh4vKdmRTs= -github.com/aws/aws-sdk-go-v2/service/ssooidc v1.28.1/go.mod h1:2V2JLP7tXOmUbL3Hd1ojq+774t2KUAEQ35//shoNEL0= -github.com/aws/aws-sdk-go-v2/service/sts v1.32.1 h1:q76Ig4OaJzVJGNUSGO3wjSTBS94g+EhHIbpY9rPvkxs= -github.com/aws/aws-sdk-go-v2/service/sts v1.32.1/go.mod h1:664dajZ7uS7JMUMUG0R5bWbtN97KECNCVdFDdQ6Ipu8= +github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.12.2 h1:s7NA1SOw8q/5c0wr8477yOPp0z+uBaXBnLE0XYb0POA= +github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.12.2/go.mod h1:fnjjWyAW/Pj5HYOxl9LJqWtEwS7W2qgcRLWP+uWbss0= +github.com/aws/aws-sdk-go-v2/service/servicediscovery v1.33.2 h1:TVfX2jnpYDxgORh5ozbSBpFa/D0B82Iq28a2+bY62uQ= +github.com/aws/aws-sdk-go-v2/service/servicediscovery v1.33.2/go.mod h1:Qy6c/ZAKohV1Ikot1ZOMm9be4bazUs27RLQjnERG4/U= +github.com/aws/aws-sdk-go-v2/service/sso v1.24.2 h1:bSYXVyUzoTHoKalBmwaZxs97HU9DWWI3ehHSAMa7xOk= +github.com/aws/aws-sdk-go-v2/service/sso v1.24.2/go.mod h1:skMqY7JElusiOUjMJMOv1jJsP7YUg7DrhgqZZWuzu1U= +github.com/aws/aws-sdk-go-v2/service/ssooidc v1.28.2 h1:AhmO1fHINP9vFYUE0LHzCWg/LfUWUF+zFPEcY9QXb7o= +github.com/aws/aws-sdk-go-v2/service/ssooidc v1.28.2/go.mod h1:o8aQygT2+MVP0NaV6kbdE1YnnIM8RRVQzoeUH45GOdI= +github.com/aws/aws-sdk-go-v2/service/sts v1.32.2 h1:CiS7i0+FUe+/YY1GvIBLLrR/XNGZ4CtM1Ll0XavNuVo= +github.com/aws/aws-sdk-go-v2/service/sts v1.32.2/go.mod h1:HtaiBI8CjYoNVde8arShXb94UbQQi9L4EMr6D+xGBwo= github.com/aws/smithy-go v1.22.0 h1:uunKnWlcoL3zO7q+gG2Pk53joueEOsnNB28QdMsmiMM= github.com/aws/smithy-go v1.22.0/go.mod h1:irrKGvNn1InZwb2d7fkIRNucdfwR8R+Ts3wxYa/cJHg= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= diff --git a/extension/sigv4authextension/go.mod b/extension/sigv4authextension/go.mod index 01e2ea3b2e0a..df2565f6c7de 100644 --- a/extension/sigv4authextension/go.mod +++ b/extension/sigv4authextension/go.mod @@ -3,10 +3,10 @@ module github.com/open-telemetry/opentelemetry-collector-contrib/extension/sigv4 go 1.22.0 require ( - github.com/aws/aws-sdk-go-v2 v1.32.1 - github.com/aws/aws-sdk-go-v2/config v1.27.42 - github.com/aws/aws-sdk-go-v2/credentials v1.17.40 - github.com/aws/aws-sdk-go-v2/service/sts v1.32.1 + github.com/aws/aws-sdk-go-v2 v1.32.2 + github.com/aws/aws-sdk-go-v2/config v1.27.43 + github.com/aws/aws-sdk-go-v2/credentials v1.17.41 + github.com/aws/aws-sdk-go-v2/service/sts v1.32.2 github.com/stretchr/testify v1.9.0 go.opentelemetry.io/collector/component v0.111.1-0.20241008154146-ea48c09c31ae go.opentelemetry.io/collector/confmap v1.17.1-0.20241008154146-ea48c09c31ae @@ -18,14 +18,14 @@ require ( ) require ( - github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.16 // indirect - github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.20 // indirect - github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.20 // indirect + github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.17 // indirect + github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.21 // indirect + github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.21 // indirect github.com/aws/aws-sdk-go-v2/internal/ini v1.8.1 // indirect github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.12.0 // indirect - github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.12.1 // indirect - github.com/aws/aws-sdk-go-v2/service/sso v1.24.1 // indirect - github.com/aws/aws-sdk-go-v2/service/ssooidc v1.28.1 // indirect + github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.12.2 // indirect + github.com/aws/aws-sdk-go-v2/service/sso v1.24.2 // indirect + github.com/aws/aws-sdk-go-v2/service/ssooidc v1.28.2 // indirect github.com/aws/smithy-go v1.22.0 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/go-logr/logr v1.4.2 // indirect diff --git a/extension/sigv4authextension/go.sum b/extension/sigv4authextension/go.sum index 93180ca45a4e..d54cce6323a8 100644 --- a/extension/sigv4authextension/go.sum +++ b/extension/sigv4authextension/go.sum @@ -1,27 +1,27 @@ -github.com/aws/aws-sdk-go-v2 v1.32.1 h1:8WuZ43ytA+TV6QEPT/R23mr7pWyI7bSSiEHdt9BS2Pw= -github.com/aws/aws-sdk-go-v2 v1.32.1/go.mod h1:2SK5n0a2karNTv5tbP1SjsX0uhttou00v/HpXKM1ZUo= -github.com/aws/aws-sdk-go-v2/config v1.27.42 h1:Zsy9coUPuOsCWkjTvHpl2/DB9bptXtv7WeNPxvFr87s= -github.com/aws/aws-sdk-go-v2/config v1.27.42/go.mod h1:FGASs+PuJM2EY+8rt8qyQKLPbbX/S5oY+6WzJ/KE7ko= -github.com/aws/aws-sdk-go-v2/credentials v1.17.40 h1:RjnlA7t0p/IamxAM7FUJ5uS13Vszh4sjVGvsx91tGro= -github.com/aws/aws-sdk-go-v2/credentials v1.17.40/go.mod h1:dgpdnSs1Bp/atS6vLlW83h9xZPP+uSPB/27dFSgC1BM= -github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.16 h1:fwrer1pJeaiia0CcOfWVbZxvj9Adc7rsuaMTwPR0DIA= -github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.16/go.mod h1:XyEwwp8XI4zMar7MTnJ0Sk7qY/9aN8Hp929XhuX5SF8= -github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.20 h1:OErdlGnt+hg3tTwGYAlKvFkKVUo/TXkoHcxDxuhYYU8= -github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.20/go.mod h1:HsPfuL5gs+407ByRXBMgpYoyrV1sgMrzd18yMXQHJpo= -github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.20 h1:822cE1CYSwY/EZnErlF46pyynuxvf1p+VydHRQW+XNs= -github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.20/go.mod h1:79/Tn7H7hYC5Gjz6fbnOV4OeBpkao7E8Tv95RO72pMM= +github.com/aws/aws-sdk-go-v2 v1.32.2 h1:AkNLZEyYMLnx/Q/mSKkcMqwNFXMAvFto9bNsHqcTduI= +github.com/aws/aws-sdk-go-v2 v1.32.2/go.mod h1:2SK5n0a2karNTv5tbP1SjsX0uhttou00v/HpXKM1ZUo= +github.com/aws/aws-sdk-go-v2/config v1.27.43 h1:p33fDDihFC390dhhuv8nOmX419wjOSDQRb+USt20RrU= +github.com/aws/aws-sdk-go-v2/config v1.27.43/go.mod h1:pYhbtvg1siOOg8h5an77rXle9tVG8T+BWLWAo7cOukc= +github.com/aws/aws-sdk-go-v2/credentials v1.17.41 h1:7gXo+Axmp+R4Z+AK8YFQO0ZV3L0gizGINCOWxSLY9W8= +github.com/aws/aws-sdk-go-v2/credentials v1.17.41/go.mod h1:u4Eb8d3394YLubphT4jLEwN1rLNq2wFOlT6OuxFwPzU= +github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.17 h1:TMH3f/SCAWdNtXXVPPu5D6wrr4G5hI1rAxbcocKfC7Q= +github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.17/go.mod h1:1ZRXLdTpzdJb9fwTMXiLipENRxkGMTn1sfKexGllQCw= +github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.21 h1:UAsR3xA31QGf79WzpG/ixT9FZvQlh5HY1NRqSHBNOCk= +github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.21/go.mod h1:JNr43NFf5L9YaG3eKTm7HQzls9J+A9YYcGI5Quh1r2Y= +github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.21 h1:6jZVETqmYCadGFvrYEQfC5fAQmlo80CeL5psbno6r0s= +github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.21/go.mod h1:1SR0GbLlnN3QUmYaflZNiH1ql+1qrSiB2vwcJ+4UM60= github.com/aws/aws-sdk-go-v2/internal/ini v1.8.1 h1:VaRN3TlFdd6KxX1x3ILT5ynH6HvKgqdiXoTxAF4HQcQ= github.com/aws/aws-sdk-go-v2/internal/ini v1.8.1/go.mod h1:FbtygfRFze9usAadmnGJNc8KsP346kEe+y2/oyhGAGc= github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.12.0 h1:TToQNkvGguu209puTojY/ozlqy2d/SFNcoLIqTFi42g= github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.12.0/go.mod h1:0jp+ltwkf+SwG2fm/PKo8t4y8pJSgOCO4D8Lz3k0aHQ= -github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.12.1 h1:5vBMBTakOvtd8aNaicswcrr9qqCYUlasuzyoU6/0g8I= -github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.12.1/go.mod h1:WSUbDa5qdg05Q558KXx2Scb+EDvOPXT9gfET0fyrJSk= -github.com/aws/aws-sdk-go-v2/service/sso v1.24.1 h1:aAIr0WhAgvKrxZtkBqne87Gjmd7/lJVTFkR2l2yuhL8= -github.com/aws/aws-sdk-go-v2/service/sso v1.24.1/go.mod h1:8XhxGMWUfikJuginPQl5SGZ0LSJuNX3TCEQmFWZwHTM= -github.com/aws/aws-sdk-go-v2/service/ssooidc v1.28.1 h1:J6kIsIkgFOaU6aKjigXJoue1XEHtKIIrpSh4vKdmRTs= -github.com/aws/aws-sdk-go-v2/service/ssooidc v1.28.1/go.mod h1:2V2JLP7tXOmUbL3Hd1ojq+774t2KUAEQ35//shoNEL0= -github.com/aws/aws-sdk-go-v2/service/sts v1.32.1 h1:q76Ig4OaJzVJGNUSGO3wjSTBS94g+EhHIbpY9rPvkxs= -github.com/aws/aws-sdk-go-v2/service/sts v1.32.1/go.mod h1:664dajZ7uS7JMUMUG0R5bWbtN97KECNCVdFDdQ6Ipu8= +github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.12.2 h1:s7NA1SOw8q/5c0wr8477yOPp0z+uBaXBnLE0XYb0POA= +github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.12.2/go.mod h1:fnjjWyAW/Pj5HYOxl9LJqWtEwS7W2qgcRLWP+uWbss0= +github.com/aws/aws-sdk-go-v2/service/sso v1.24.2 h1:bSYXVyUzoTHoKalBmwaZxs97HU9DWWI3ehHSAMa7xOk= +github.com/aws/aws-sdk-go-v2/service/sso v1.24.2/go.mod h1:skMqY7JElusiOUjMJMOv1jJsP7YUg7DrhgqZZWuzu1U= +github.com/aws/aws-sdk-go-v2/service/ssooidc v1.28.2 h1:AhmO1fHINP9vFYUE0LHzCWg/LfUWUF+zFPEcY9QXb7o= +github.com/aws/aws-sdk-go-v2/service/ssooidc v1.28.2/go.mod h1:o8aQygT2+MVP0NaV6kbdE1YnnIM8RRVQzoeUH45GOdI= +github.com/aws/aws-sdk-go-v2/service/sts v1.32.2 h1:CiS7i0+FUe+/YY1GvIBLLrR/XNGZ4CtM1Ll0XavNuVo= +github.com/aws/aws-sdk-go-v2/service/sts v1.32.2/go.mod h1:HtaiBI8CjYoNVde8arShXb94UbQQi9L4EMr6D+xGBwo= github.com/aws/smithy-go v1.22.0 h1:uunKnWlcoL3zO7q+gG2Pk53joueEOsnNB28QdMsmiMM= github.com/aws/smithy-go v1.22.0/go.mod h1:irrKGvNn1InZwb2d7fkIRNucdfwR8R+Ts3wxYa/cJHg= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= diff --git a/receiver/awss3receiver/go.mod b/receiver/awss3receiver/go.mod index 6f2b6c789eb0..367b3da26481 100644 --- a/receiver/awss3receiver/go.mod +++ b/receiver/awss3receiver/go.mod @@ -3,10 +3,10 @@ module github.com/open-telemetry/opentelemetry-collector-contrib/receiver/awss3r go 1.22.0 require ( - github.com/aws/aws-sdk-go-v2 v1.32.1 - github.com/aws/aws-sdk-go-v2/config v1.27.42 - github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.17.29 - github.com/aws/aws-sdk-go-v2/service/s3 v1.65.1 + github.com/aws/aws-sdk-go-v2 v1.32.2 + github.com/aws/aws-sdk-go-v2/config v1.27.43 + github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.17.30 + github.com/aws/aws-sdk-go-v2/service/s3 v1.65.2 github.com/open-telemetry/opamp-go v0.15.0 github.com/open-telemetry/opentelemetry-collector-contrib/extension/opampcustommessages v0.111.0 github.com/stretchr/testify v1.9.0 @@ -25,19 +25,19 @@ require ( require ( github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.6.6 // indirect - github.com/aws/aws-sdk-go-v2/credentials v1.17.40 // indirect - github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.16 // indirect - github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.20 // indirect - github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.20 // indirect + github.com/aws/aws-sdk-go-v2/credentials v1.17.41 // indirect + github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.17 // indirect + github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.21 // indirect + github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.21 // indirect github.com/aws/aws-sdk-go-v2/internal/ini v1.8.1 // indirect - github.com/aws/aws-sdk-go-v2/internal/v4a v1.3.20 // indirect + github.com/aws/aws-sdk-go-v2/internal/v4a v1.3.21 // indirect github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.12.0 // indirect - github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.4.1 // indirect - github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.12.1 // indirect - github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.18.1 // indirect - github.com/aws/aws-sdk-go-v2/service/sso v1.24.1 // indirect - github.com/aws/aws-sdk-go-v2/service/ssooidc v1.28.1 // indirect - github.com/aws/aws-sdk-go-v2/service/sts v1.32.1 // indirect + github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.4.2 // indirect + github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.12.2 // indirect + github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.18.2 // indirect + github.com/aws/aws-sdk-go-v2/service/sso v1.24.2 // indirect + github.com/aws/aws-sdk-go-v2/service/ssooidc v1.28.2 // indirect + github.com/aws/aws-sdk-go-v2/service/sts v1.32.2 // indirect github.com/aws/smithy-go v1.22.0 // indirect github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/go-logr/logr v1.4.2 // indirect diff --git a/receiver/awss3receiver/go.sum b/receiver/awss3receiver/go.sum index 329667f306f8..1212f0661037 100644 --- a/receiver/awss3receiver/go.sum +++ b/receiver/awss3receiver/go.sum @@ -1,39 +1,39 @@ -github.com/aws/aws-sdk-go-v2 v1.32.1 h1:8WuZ43ytA+TV6QEPT/R23mr7pWyI7bSSiEHdt9BS2Pw= -github.com/aws/aws-sdk-go-v2 v1.32.1/go.mod h1:2SK5n0a2karNTv5tbP1SjsX0uhttou00v/HpXKM1ZUo= +github.com/aws/aws-sdk-go-v2 v1.32.2 h1:AkNLZEyYMLnx/Q/mSKkcMqwNFXMAvFto9bNsHqcTduI= +github.com/aws/aws-sdk-go-v2 v1.32.2/go.mod h1:2SK5n0a2karNTv5tbP1SjsX0uhttou00v/HpXKM1ZUo= github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.6.6 h1:pT3hpW0cOHRJx8Y0DfJUEQuqPild8jRGmSFmBgvydr0= github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.6.6/go.mod h1:j/I2++U0xX+cr44QjHay4Cvxj6FUbnxrgmqN3H1jTZA= -github.com/aws/aws-sdk-go-v2/config v1.27.42 h1:Zsy9coUPuOsCWkjTvHpl2/DB9bptXtv7WeNPxvFr87s= -github.com/aws/aws-sdk-go-v2/config v1.27.42/go.mod h1:FGASs+PuJM2EY+8rt8qyQKLPbbX/S5oY+6WzJ/KE7ko= -github.com/aws/aws-sdk-go-v2/credentials v1.17.40 h1:RjnlA7t0p/IamxAM7FUJ5uS13Vszh4sjVGvsx91tGro= -github.com/aws/aws-sdk-go-v2/credentials v1.17.40/go.mod h1:dgpdnSs1Bp/atS6vLlW83h9xZPP+uSPB/27dFSgC1BM= -github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.16 h1:fwrer1pJeaiia0CcOfWVbZxvj9Adc7rsuaMTwPR0DIA= -github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.16/go.mod h1:XyEwwp8XI4zMar7MTnJ0Sk7qY/9aN8Hp929XhuX5SF8= -github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.17.29 h1:eyeHfJ9FAb7sd5ODTkjrfot3gS0Ln4vn/18l7zZMCik= -github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.17.29/go.mod h1:JpzRPe12SjlOmuqgi+/5RmgfbsWzDYdfxe3Abrk2kW8= -github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.20 h1:OErdlGnt+hg3tTwGYAlKvFkKVUo/TXkoHcxDxuhYYU8= -github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.20/go.mod h1:HsPfuL5gs+407ByRXBMgpYoyrV1sgMrzd18yMXQHJpo= -github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.20 h1:822cE1CYSwY/EZnErlF46pyynuxvf1p+VydHRQW+XNs= -github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.20/go.mod h1:79/Tn7H7hYC5Gjz6fbnOV4OeBpkao7E8Tv95RO72pMM= +github.com/aws/aws-sdk-go-v2/config v1.27.43 h1:p33fDDihFC390dhhuv8nOmX419wjOSDQRb+USt20RrU= +github.com/aws/aws-sdk-go-v2/config v1.27.43/go.mod h1:pYhbtvg1siOOg8h5an77rXle9tVG8T+BWLWAo7cOukc= +github.com/aws/aws-sdk-go-v2/credentials v1.17.41 h1:7gXo+Axmp+R4Z+AK8YFQO0ZV3L0gizGINCOWxSLY9W8= +github.com/aws/aws-sdk-go-v2/credentials v1.17.41/go.mod h1:u4Eb8d3394YLubphT4jLEwN1rLNq2wFOlT6OuxFwPzU= +github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.17 h1:TMH3f/SCAWdNtXXVPPu5D6wrr4G5hI1rAxbcocKfC7Q= +github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.17/go.mod h1:1ZRXLdTpzdJb9fwTMXiLipENRxkGMTn1sfKexGllQCw= +github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.17.30 h1:akklue0xJFgXxu7zODXZQ9ZtbFW1JLUPnu4Q4veRYcI= +github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.17.30/go.mod h1:fXzCjRi6r4VHyYiaPEZerTpIgvEOzMGP/lrhrb0EXk4= +github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.21 h1:UAsR3xA31QGf79WzpG/ixT9FZvQlh5HY1NRqSHBNOCk= +github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.21/go.mod h1:JNr43NFf5L9YaG3eKTm7HQzls9J+A9YYcGI5Quh1r2Y= +github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.21 h1:6jZVETqmYCadGFvrYEQfC5fAQmlo80CeL5psbno6r0s= +github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.21/go.mod h1:1SR0GbLlnN3QUmYaflZNiH1ql+1qrSiB2vwcJ+4UM60= github.com/aws/aws-sdk-go-v2/internal/ini v1.8.1 h1:VaRN3TlFdd6KxX1x3ILT5ynH6HvKgqdiXoTxAF4HQcQ= github.com/aws/aws-sdk-go-v2/internal/ini v1.8.1/go.mod h1:FbtygfRFze9usAadmnGJNc8KsP346kEe+y2/oyhGAGc= -github.com/aws/aws-sdk-go-v2/internal/v4a v1.3.20 h1:HO5UCCkLmeWkJZHLvLDfylKv8ca28XLAX3HojZz2shI= -github.com/aws/aws-sdk-go-v2/internal/v4a v1.3.20/go.mod h1:IO0HUM6Ouk/s7Rx3hiLtFU3mc+9OJFFygjsaxFBhAbk= +github.com/aws/aws-sdk-go-v2/internal/v4a v1.3.21 h1:7edmS3VOBDhK00b/MwGtGglCm7hhwNYnjJs/PgFdMQE= +github.com/aws/aws-sdk-go-v2/internal/v4a v1.3.21/go.mod h1:Q9o5h4HoIWG8XfzxqiuK/CGUbepCJ8uTlaE3bAbxytQ= github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.12.0 h1:TToQNkvGguu209puTojY/ozlqy2d/SFNcoLIqTFi42g= github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.12.0/go.mod h1:0jp+ltwkf+SwG2fm/PKo8t4y8pJSgOCO4D8Lz3k0aHQ= -github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.4.1 h1:UeW3Ul28hkKvB3beWImBvO7U62tSmapxaqk8sX9SMCU= -github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.4.1/go.mod h1:TER/1DuTxSN6RFQpk3xfD9hK4A1gQ7ainfkwHV3LPtU= -github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.12.1 h1:5vBMBTakOvtd8aNaicswcrr9qqCYUlasuzyoU6/0g8I= -github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.12.1/go.mod h1:WSUbDa5qdg05Q558KXx2Scb+EDvOPXT9gfET0fyrJSk= -github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.18.1 h1:T6oOYbNQ+iqdtG1/mTJvMBg/YFyHR8Z8URyG3qK+Anc= -github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.18.1/go.mod h1:25CEM6c1e2vyLcr3fPritPsdsoMwNAOc9//M1QAwtDk= -github.com/aws/aws-sdk-go-v2/service/s3 v1.65.1 h1:HQR79P0F0C2YQOaS2Z+90YK9DH22z9D6Neplaj0yuy4= -github.com/aws/aws-sdk-go-v2/service/s3 v1.65.1/go.mod h1:xYVl5BX9Ws7+ZM58b3w0kq36TR1Dgw2OMkjSr6YTWXg= -github.com/aws/aws-sdk-go-v2/service/sso v1.24.1 h1:aAIr0WhAgvKrxZtkBqne87Gjmd7/lJVTFkR2l2yuhL8= -github.com/aws/aws-sdk-go-v2/service/sso v1.24.1/go.mod h1:8XhxGMWUfikJuginPQl5SGZ0LSJuNX3TCEQmFWZwHTM= -github.com/aws/aws-sdk-go-v2/service/ssooidc v1.28.1 h1:J6kIsIkgFOaU6aKjigXJoue1XEHtKIIrpSh4vKdmRTs= -github.com/aws/aws-sdk-go-v2/service/ssooidc v1.28.1/go.mod h1:2V2JLP7tXOmUbL3Hd1ojq+774t2KUAEQ35//shoNEL0= -github.com/aws/aws-sdk-go-v2/service/sts v1.32.1 h1:q76Ig4OaJzVJGNUSGO3wjSTBS94g+EhHIbpY9rPvkxs= -github.com/aws/aws-sdk-go-v2/service/sts v1.32.1/go.mod h1:664dajZ7uS7JMUMUG0R5bWbtN97KECNCVdFDdQ6Ipu8= +github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.4.2 h1:4FMHqLfk0efmTqhXVRL5xYRqlEBNBiRI7N6w4jsEdd4= +github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.4.2/go.mod h1:LWoqeWlK9OZeJxsROW2RqrSPvQHKTpp69r/iDjwsSaw= +github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.12.2 h1:s7NA1SOw8q/5c0wr8477yOPp0z+uBaXBnLE0XYb0POA= +github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.12.2/go.mod h1:fnjjWyAW/Pj5HYOxl9LJqWtEwS7W2qgcRLWP+uWbss0= +github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.18.2 h1:t7iUP9+4wdc5lt3E41huP+GvQZJD38WLsgVp4iOtAjg= +github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.18.2/go.mod h1:/niFCtmuQNxqx9v8WAPq5qh7EH25U4BF6tjoyq9bObM= +github.com/aws/aws-sdk-go-v2/service/s3 v1.65.2 h1:yi8m+jepdp6foK14xXLGkYBenxnlcfJ45ka4Pg7fDSQ= +github.com/aws/aws-sdk-go-v2/service/s3 v1.65.2/go.mod h1:cB6oAuus7YXRZhWCc1wIwPywwZ1XwweNp2TVAEGYeB8= +github.com/aws/aws-sdk-go-v2/service/sso v1.24.2 h1:bSYXVyUzoTHoKalBmwaZxs97HU9DWWI3ehHSAMa7xOk= +github.com/aws/aws-sdk-go-v2/service/sso v1.24.2/go.mod h1:skMqY7JElusiOUjMJMOv1jJsP7YUg7DrhgqZZWuzu1U= +github.com/aws/aws-sdk-go-v2/service/ssooidc v1.28.2 h1:AhmO1fHINP9vFYUE0LHzCWg/LfUWUF+zFPEcY9QXb7o= +github.com/aws/aws-sdk-go-v2/service/ssooidc v1.28.2/go.mod h1:o8aQygT2+MVP0NaV6kbdE1YnnIM8RRVQzoeUH45GOdI= +github.com/aws/aws-sdk-go-v2/service/sts v1.32.2 h1:CiS7i0+FUe+/YY1GvIBLLrR/XNGZ4CtM1Ll0XavNuVo= +github.com/aws/aws-sdk-go-v2/service/sts v1.32.2/go.mod h1:HtaiBI8CjYoNVde8arShXb94UbQQi9L4EMr6D+xGBwo= github.com/aws/smithy-go v1.22.0 h1:uunKnWlcoL3zO7q+gG2Pk53joueEOsnNB28QdMsmiMM= github.com/aws/smithy-go v1.22.0/go.mod h1:irrKGvNn1InZwb2d7fkIRNucdfwR8R+Ts3wxYa/cJHg= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= From a1d7a33d9381d2b530337ccc6572b223373b138c Mon Sep 17 00:00:00 2001 From: Michael Burt Date: Wed, 9 Oct 2024 16:29:52 -0600 Subject: [PATCH 008/140] [receiver/tlscheck] Inital Commit of TLS Check Receiver (#35441) **Description:** Initial commit of TLS Check Receiver, a new component aimed at emitting metrics about the expoiry of x.509 certs. **Link to tracking Issue:** [35423](https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/35423) **Testing:** Test files added **Documentation:** `README.md` & `metadata.yaml` added --- .chloggen/tlscheckreceiver-addition.yaml | 27 +++ .github/CODEOWNERS | 1 + .github/ISSUE_TEMPLATE/bug_report.yaml | 1 + .github/ISSUE_TEMPLATE/feature_request.yaml | 1 + .github/ISSUE_TEMPLATE/other.yaml | 1 + .github/ISSUE_TEMPLATE/unmaintained.yaml | 1 + receiver/tlscheckreceiver/Makefile | 1 + receiver/tlscheckreceiver/README.md | 37 +++ receiver/tlscheckreceiver/config.go | 63 +++++ receiver/tlscheckreceiver/config_test.go | 95 ++++++++ receiver/tlscheckreceiver/doc.go | 6 + receiver/tlscheckreceiver/documentation.md | 34 +++ receiver/tlscheckreceiver/factory.go | 62 +++++ receiver/tlscheckreceiver/factory_test.go | 81 +++++++ .../generated_component_test.go | 69 ++++++ .../generated_package_test.go | 13 + receiver/tlscheckreceiver/go.mod | 55 +++++ receiver/tlscheckreceiver/go.sum | 136 +++++++++++ .../internal/metadata/generated_config.go | 92 +++++++ .../metadata/generated_config_test.go | 109 +++++++++ .../internal/metadata/generated_metrics.go | 227 ++++++++++++++++++ .../metadata/generated_metrics_test.go | 121 ++++++++++ .../internal/metadata/generated_resource.go | 36 +++ .../metadata/generated_resource_test.go | 40 +++ .../internal/metadata/generated_status.go | 16 ++ .../internal/metadata/testdata/config.yaml | 27 +++ receiver/tlscheckreceiver/metadata.yaml | 35 +++ receiver/tlscheckreceiver/scraper.go | 31 +++ reports/distributions/contrib.yaml | 1 + versions.yaml | 1 + 30 files changed, 1420 insertions(+) create mode 100644 .chloggen/tlscheckreceiver-addition.yaml create mode 100644 receiver/tlscheckreceiver/Makefile create mode 100644 receiver/tlscheckreceiver/README.md create mode 100644 receiver/tlscheckreceiver/config.go create mode 100644 receiver/tlscheckreceiver/config_test.go create mode 100644 receiver/tlscheckreceiver/doc.go create mode 100644 receiver/tlscheckreceiver/documentation.md create mode 100644 receiver/tlscheckreceiver/factory.go create mode 100644 receiver/tlscheckreceiver/factory_test.go create mode 100644 receiver/tlscheckreceiver/generated_component_test.go create mode 100644 receiver/tlscheckreceiver/generated_package_test.go create mode 100644 receiver/tlscheckreceiver/go.mod create mode 100644 receiver/tlscheckreceiver/go.sum create mode 100644 receiver/tlscheckreceiver/internal/metadata/generated_config.go create mode 100644 receiver/tlscheckreceiver/internal/metadata/generated_config_test.go create mode 100644 receiver/tlscheckreceiver/internal/metadata/generated_metrics.go create mode 100644 receiver/tlscheckreceiver/internal/metadata/generated_metrics_test.go create mode 100644 receiver/tlscheckreceiver/internal/metadata/generated_resource.go create mode 100644 receiver/tlscheckreceiver/internal/metadata/generated_resource_test.go create mode 100644 receiver/tlscheckreceiver/internal/metadata/generated_status.go create mode 100644 receiver/tlscheckreceiver/internal/metadata/testdata/config.yaml create mode 100644 receiver/tlscheckreceiver/metadata.yaml create mode 100644 receiver/tlscheckreceiver/scraper.go diff --git a/.chloggen/tlscheckreceiver-addition.yaml b/.chloggen/tlscheckreceiver-addition.yaml new file mode 100644 index 000000000000..19ae64d6134d --- /dev/null +++ b/.chloggen/tlscheckreceiver-addition.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: tlscheckreceiver + +# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). +note: Add TLS Check Receiver component to monitor x.509 certificate expiry + +# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists. +issues: [35423] + +# (Optional) One or more lines of additional information to render under the primary note. +# These lines will be padded with 2 spaces and then inserted directly into the document. +# Use pipe (|) for multiline entries. +subtext: + +# If your change doesn't affect end users or the exported elements of any package, +# you should instead start your pull request title with [chore] or use the "Skip Changelog" label. +# Optional: The change log or logs in which this entry should be included. +# e.g. '[user]' or '[user, api]' +# Include 'user' if the change is relevant to end users. +# Include 'api' if there is a change to a library API. +# Default: '[user]' +change_logs: [user] diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index dfc9746f744a..587df26bad20 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -295,6 +295,7 @@ receiver/sshcheckreceiver/ @open-teleme receiver/statsdreceiver/ @open-telemetry/collector-contrib-approvers @jmacd @dmitryax receiver/syslogreceiver/ @open-telemetry/collector-contrib-approvers @djaglowski @andrzej-stencel receiver/tcplogreceiver/ @open-telemetry/collector-contrib-approvers @djaglowski +receiver/tlscheckreceiver/ @open-telemetry/collector-contrib-approvers @atoulme @michael-burt receiver/udplogreceiver/ @open-telemetry/collector-contrib-approvers @djaglowski receiver/vcenterreceiver/ @open-telemetry/collector-contrib-approvers @djaglowski @schmikei @StefanKurek receiver/wavefrontreceiver/ @open-telemetry/collector-contrib-approvers @samiura diff --git a/.github/ISSUE_TEMPLATE/bug_report.yaml b/.github/ISSUE_TEMPLATE/bug_report.yaml index b705cbecfb53..414d3b55dd18 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yaml +++ b/.github/ISSUE_TEMPLATE/bug_report.yaml @@ -290,6 +290,7 @@ body: - receiver/statsd - receiver/syslog - receiver/tcplog + - receiver/tlscheck - receiver/udplog - receiver/vcenter - receiver/wavefront diff --git a/.github/ISSUE_TEMPLATE/feature_request.yaml b/.github/ISSUE_TEMPLATE/feature_request.yaml index 8ec681fa0a67..e7735b4741c0 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.yaml +++ b/.github/ISSUE_TEMPLATE/feature_request.yaml @@ -284,6 +284,7 @@ body: - receiver/statsd - receiver/syslog - receiver/tcplog + - receiver/tlscheck - receiver/udplog - receiver/vcenter - receiver/wavefront diff --git a/.github/ISSUE_TEMPLATE/other.yaml b/.github/ISSUE_TEMPLATE/other.yaml index b0098510b798..cf05bfa8a075 100644 --- a/.github/ISSUE_TEMPLATE/other.yaml +++ b/.github/ISSUE_TEMPLATE/other.yaml @@ -284,6 +284,7 @@ body: - receiver/statsd - receiver/syslog - receiver/tcplog + - receiver/tlscheck - receiver/udplog - receiver/vcenter - receiver/wavefront diff --git a/.github/ISSUE_TEMPLATE/unmaintained.yaml b/.github/ISSUE_TEMPLATE/unmaintained.yaml index df65436ba755..ef8383e2d661 100644 --- a/.github/ISSUE_TEMPLATE/unmaintained.yaml +++ b/.github/ISSUE_TEMPLATE/unmaintained.yaml @@ -289,6 +289,7 @@ body: - receiver/statsd - receiver/syslog - receiver/tcplog + - receiver/tlscheck - receiver/udplog - receiver/vcenter - receiver/wavefront diff --git a/receiver/tlscheckreceiver/Makefile b/receiver/tlscheckreceiver/Makefile new file mode 100644 index 000000000000..c1496226e590 --- /dev/null +++ b/receiver/tlscheckreceiver/Makefile @@ -0,0 +1 @@ +include ../../Makefile.Common \ No newline at end of file diff --git a/receiver/tlscheckreceiver/README.md b/receiver/tlscheckreceiver/README.md new file mode 100644 index 000000000000..1a5a89bf0317 --- /dev/null +++ b/receiver/tlscheckreceiver/README.md @@ -0,0 +1,37 @@ +# TLS Check Receiver + + +| Status | | +| ------------- |-----------| +| Stability | [development]: metrics | +| Distributions | [contrib] | +| Issues | [![Open issues](https://img.shields.io/github/issues-search/open-telemetry/opentelemetry-collector-contrib?query=is%3Aissue%20is%3Aopen%20label%3Areceiver%2Ftlscheck%20&label=open&color=orange&logo=opentelemetry)](https://github.com/open-telemetry/opentelemetry-collector-contrib/issues?q=is%3Aopen+is%3Aissue+label%3Areceiver%2Ftlscheck) [![Closed issues](https://img.shields.io/github/issues-search/open-telemetry/opentelemetry-collector-contrib?query=is%3Aissue%20is%3Aclosed%20label%3Areceiver%2Ftlscheck%20&label=closed&color=blue&logo=opentelemetry)](https://github.com/open-telemetry/opentelemetry-collector-contrib/issues?q=is%3Aclosed+is%3Aissue+label%3Areceiver%2Ftlscheck) | +| [Code Owners](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/CONTRIBUTING.md#becoming-a-code-owner) | [@atoulme](https://www.github.com/atoulme), [@michael-burt](https://www.github.com/michael-burt) | + +[development]: https://github.com/open-telemetry/opentelemetry-collector#development +[contrib]: https://github.com/open-telemetry/opentelemetry-collector-releases/tree/main/distributions/otelcol-contrib + + +Emit metrics about x.509 certificates. + +## Getting Started + +By default, the TLS Check Receiver will emit a single metric, `tlscheck.time_left`, per target. This is measured in seconds until the date and time specified in the `NotAfter` field of the x.509 certificate. After certificate expiration, the metric value will be a negative integer measuring the time in seconds since expiry. + +## Example Configuration + +```yaml +receivers: + tlscheck: + targets: + - url: https://example.com + - url: https://foobar.com:8080 +``` + +## Certificate Verification + +This component does not provide hostname, validity period, path, or CRL / OCSP verification on the certificate. + +## Metrics + +Details about the metrics produced by this receiver can be found in [metadata.yaml](./metadata.yaml). diff --git a/receiver/tlscheckreceiver/config.go b/receiver/tlscheckreceiver/config.go new file mode 100644 index 000000000000..d20c7b2e091d --- /dev/null +++ b/receiver/tlscheckreceiver/config.go @@ -0,0 +1,63 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package tlscheckreceiver // import "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/tlscheckreceiver" + +import ( + "errors" + "fmt" + "net/url" + + "go.opentelemetry.io/collector/receiver/scraperhelper" + "go.uber.org/multierr" + + "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/tlscheckreceiver/internal/metadata" +) + +// Predefined error responses for configuration validation failures +var ( + errMissingURL = errors.New(`"url" must be specified`) + errInvalidURL = errors.New(`"url" must be in the form of ://[:]`) +) + +// Config defines the configuration for the various elements of the receiver agent. +type Config struct { + scraperhelper.ControllerConfig `mapstructure:",squash"` + metadata.MetricsBuilderConfig `mapstructure:",squash"` + Targets []*targetConfig `mapstructure:"targets"` +} + +type targetConfig struct { + URL string `mapstructure:"url"` +} + +// Validate validates the configuration by checking for missing or invalid fields +func (cfg *targetConfig) Validate() error { + var err error + + if cfg.URL == "" { + err = multierr.Append(err, errMissingURL) + } else { + _, parseErr := url.ParseRequestURI(cfg.URL) + if parseErr != nil { + err = multierr.Append(err, fmt.Errorf("%s: %w", errInvalidURL.Error(), parseErr)) + } + } + + return err +} + +// Validate validates the configuration by checking for missing or invalid fields +func (cfg *Config) Validate() error { + var err error + + if len(cfg.Targets) == 0 { + err = multierr.Append(err, errMissingURL) + } + + for _, target := range cfg.Targets { + err = multierr.Append(err, target.Validate()) + } + + return err +} diff --git a/receiver/tlscheckreceiver/config_test.go b/receiver/tlscheckreceiver/config_test.go new file mode 100644 index 000000000000..54e1748352c9 --- /dev/null +++ b/receiver/tlscheckreceiver/config_test.go @@ -0,0 +1,95 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package tlscheckreceiver // import "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/tlscheckreceiver" + +import ( + "fmt" + "testing" + + "github.com/stretchr/testify/require" + "go.opentelemetry.io/collector/receiver/scraperhelper" +) + +func TestValidate(t *testing.T) { + testCases := []struct { + desc string + cfg *Config + expectedErr error + }{ + { + desc: "missing url", + cfg: &Config{ + Targets: []*targetConfig{}, + ControllerConfig: scraperhelper.NewDefaultControllerConfig(), + }, + expectedErr: errMissingURL, + }, + { + desc: "invalid url", + cfg: &Config{ + Targets: []*targetConfig{ + { + URL: "invalid://endpoint: 12efg", + }, + }, + ControllerConfig: scraperhelper.NewDefaultControllerConfig(), + }, + expectedErr: fmt.Errorf("%w: %s", errInvalidURL, `parse "invalid://endpoint: 12efg": invalid port ": 12efg" after host`), + }, + { + desc: "invalid config with multiple targets", + cfg: &Config{ + Targets: []*targetConfig{ + { + URL: "invalid://endpoint: 12efg", + }, + { + URL: "https://example.com", + }, + }, + ControllerConfig: scraperhelper.NewDefaultControllerConfig(), + }, + expectedErr: fmt.Errorf("%w: %s", errInvalidURL, `parse "invalid://endpoint: 12efg": invalid port ": 12efg" after host`), + }, + { + desc: "missing scheme", + cfg: &Config{ + Targets: []*targetConfig{ + { + URL: "www.opentelemetry.io/docs", + }, + }, + ControllerConfig: scraperhelper.NewDefaultControllerConfig(), + }, + expectedErr: fmt.Errorf("%w: %s", errInvalidURL, `parse "www.opentelemetry.io/docs": invalid URI for request`), + }, + { + desc: "valid config", + cfg: &Config{ + Targets: []*targetConfig{ + { + URL: "https://opentelemetry.io", + }, + { + URL: "https://opentelemetry.io:80/docs", + }, + }, + ControllerConfig: scraperhelper.NewDefaultControllerConfig(), + }, + expectedErr: nil, + }, + } + + for _, tc := range testCases { + t.Run(tc.desc, func(t *testing.T) { + actualErr := tc.cfg.Validate() + if tc.expectedErr != nil { + require.EqualError(t, actualErr, tc.expectedErr.Error()) + } else { + require.NoError(t, actualErr) + } + + }) + } +} diff --git a/receiver/tlscheckreceiver/doc.go b/receiver/tlscheckreceiver/doc.go new file mode 100644 index 000000000000..3ff042cd07f6 --- /dev/null +++ b/receiver/tlscheckreceiver/doc.go @@ -0,0 +1,6 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +//go:generate mdatagen metadata.yaml + +package tlscheckreceiver // import "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/tlscheckreceiver" diff --git a/receiver/tlscheckreceiver/documentation.md b/receiver/tlscheckreceiver/documentation.md new file mode 100644 index 000000000000..1b0d5e7e5cf6 --- /dev/null +++ b/receiver/tlscheckreceiver/documentation.md @@ -0,0 +1,34 @@ +[comment]: <> (Code generated by mdatagen. DO NOT EDIT.) + +# tlscheck + +## Default Metrics + +The following metrics are emitted by default. Each of them can be disabled by applying the following configuration: + +```yaml +metrics: + : + enabled: false +``` + +### tlscheck.time_left + +Time in seconds until certificate expiry, as specified by `NotAfter` field in the x.509 certificate. Negative values represent time in seconds since expiration. + +| Unit | Metric Type | Value Type | +| ---- | ----------- | ---------- | +| s | Gauge | Int | + +#### Attributes + +| Name | Description | Values | +| ---- | ----------- | ------ | +| tlscheck.x509.issuer | The entity that issued the certificate. | Any Str | +| tlscheck.x509.cn | The commonName in the subject of the certificate. | Any Str | + +## Resource Attributes + +| Name | Description | Values | Enabled | +| ---- | ----------- | ------ | ------- | +| tlscheck.url | Url at which the certificate was accessed. | Any Str | true | diff --git a/receiver/tlscheckreceiver/factory.go b/receiver/tlscheckreceiver/factory.go new file mode 100644 index 000000000000..bc99c145abf7 --- /dev/null +++ b/receiver/tlscheckreceiver/factory.go @@ -0,0 +1,62 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package tlscheckreceiver // import "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/tlscheckreceiver" + +import ( + "context" + "errors" + + "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/consumer" + "go.opentelemetry.io/collector/receiver" + "go.opentelemetry.io/collector/receiver/scraperhelper" + + "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/tlscheckreceiver/internal/metadata" +) + +var ( + errConfigNotTLSCheck = errors.New(`invalid config`) +) + +// NewFactory creates a new filestats receiver factory. +func NewFactory() receiver.Factory { + return receiver.NewFactory( + metadata.Type, + newDefaultConfig, + receiver.WithMetrics(newReceiver, metadata.MetricsStability)) +} + +func newDefaultConfig() component.Config { + return &Config{ + ControllerConfig: scraperhelper.NewDefaultControllerConfig(), + MetricsBuilderConfig: metadata.DefaultMetricsBuilderConfig(), + Targets: []*targetConfig{}, + } +} + +func newReceiver( + _ context.Context, + settings receiver.Settings, + cfg component.Config, + consumer consumer.Metrics, +) (receiver.Metrics, error) { + tlsCheckConfig, ok := cfg.(*Config) + if !ok { + return nil, errConfigNotTLSCheck + } + + mp := newScraper(tlsCheckConfig, settings) + s, err := scraperhelper.NewScraper(metadata.Type, mp.scrape) + if err != nil { + return nil, err + } + opt := scraperhelper.AddScraper(s) + + return scraperhelper.NewScraperControllerReceiver( + &tlsCheckConfig.ControllerConfig, + settings, + consumer, + opt, + ) +} diff --git a/receiver/tlscheckreceiver/factory_test.go b/receiver/tlscheckreceiver/factory_test.go new file mode 100644 index 000000000000..2ca0e3d0ff0c --- /dev/null +++ b/receiver/tlscheckreceiver/factory_test.go @@ -0,0 +1,81 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package tlscheckreceiver // import "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/tlscheckreceiver" + +import ( + "context" + "testing" + "time" + + "github.com/stretchr/testify/require" + "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/consumer/consumertest" + "go.opentelemetry.io/collector/receiver/receivertest" + "go.opentelemetry.io/collector/receiver/scraperhelper" + + "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/tlscheckreceiver/internal/metadata" +) + +func TestNewFactory(t *testing.T) { + testCases := []struct { + desc string + testFunc func(*testing.T) + }{ + { + desc: "creates a new factory with correct type", + testFunc: func(t *testing.T) { + factory := NewFactory() + require.EqualValues(t, metadata.Type, factory.Type()) + }, + }, + { + desc: "creates a new factory with default config", + testFunc: func(t *testing.T) { + factory := NewFactory() + + var expectedCfg component.Config = &Config{ + ControllerConfig: scraperhelper.ControllerConfig{ + CollectionInterval: 60 * time.Second, + InitialDelay: time.Second, + }, + MetricsBuilderConfig: metadata.DefaultMetricsBuilderConfig(), + Targets: []*targetConfig{}, + } + + require.Equal(t, expectedCfg, factory.CreateDefaultConfig()) + }, + }, + { + desc: "creates a new factory and CreateMetrics returns no error", + testFunc: func(t *testing.T) { + factory := NewFactory() + cfg := factory.CreateDefaultConfig() + _, err := factory.CreateMetrics( + context.Background(), + receivertest.NewNopSettings(), + cfg, + consumertest.NewNop(), + ) + require.NoError(t, err) + }, + }, + { + desc: "creates a new factory and CreateMetrics returns error with incorrect config", + testFunc: func(t *testing.T) { + factory := NewFactory() + _, err := factory.CreateMetrics( + context.Background(), + receivertest.NewNopSettings(), + nil, + consumertest.NewNop(), + ) + require.ErrorIs(t, err, errConfigNotTLSCheck) + }, + }, + } + + for _, tc := range testCases { + t.Run(tc.desc, tc.testFunc) + } +} diff --git a/receiver/tlscheckreceiver/generated_component_test.go b/receiver/tlscheckreceiver/generated_component_test.go new file mode 100644 index 000000000000..87b5a4f979fd --- /dev/null +++ b/receiver/tlscheckreceiver/generated_component_test.go @@ -0,0 +1,69 @@ +// Code generated by mdatagen. DO NOT EDIT. + +package tlscheckreceiver + +import ( + "context" + "testing" + + "github.com/stretchr/testify/require" + "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/component/componenttest" + "go.opentelemetry.io/collector/confmap/confmaptest" + "go.opentelemetry.io/collector/consumer/consumertest" + "go.opentelemetry.io/collector/receiver" + "go.opentelemetry.io/collector/receiver/receivertest" +) + +func TestComponentFactoryType(t *testing.T) { + require.Equal(t, "tlscheck", NewFactory().Type().String()) +} + +func TestComponentConfigStruct(t *testing.T) { + require.NoError(t, componenttest.CheckConfigStruct(NewFactory().CreateDefaultConfig())) +} + +func TestComponentLifecycle(t *testing.T) { + factory := NewFactory() + + tests := []struct { + name string + createFn func(ctx context.Context, set receiver.Settings, cfg component.Config) (component.Component, error) + }{ + + { + name: "metrics", + createFn: func(ctx context.Context, set receiver.Settings, cfg component.Config) (component.Component, error) { + return factory.CreateMetrics(ctx, set, cfg, consumertest.NewNop()) + }, + }, + } + + cm, err := confmaptest.LoadConf("metadata.yaml") + require.NoError(t, err) + cfg := factory.CreateDefaultConfig() + sub, err := cm.Sub("tests::config") + require.NoError(t, err) + require.NoError(t, sub.Unmarshal(&cfg)) + + for _, tt := range tests { + t.Run(tt.name+"-shutdown", func(t *testing.T) { + c, err := tt.createFn(context.Background(), receivertest.NewNopSettings(), cfg) + require.NoError(t, err) + err = c.Shutdown(context.Background()) + require.NoError(t, err) + }) + t.Run(tt.name+"-lifecycle", func(t *testing.T) { + firstRcvr, err := tt.createFn(context.Background(), receivertest.NewNopSettings(), cfg) + require.NoError(t, err) + host := componenttest.NewNopHost() + require.NoError(t, err) + require.NoError(t, firstRcvr.Start(context.Background(), host)) + require.NoError(t, firstRcvr.Shutdown(context.Background())) + secondRcvr, err := tt.createFn(context.Background(), receivertest.NewNopSettings(), cfg) + require.NoError(t, err) + require.NoError(t, secondRcvr.Start(context.Background(), host)) + require.NoError(t, secondRcvr.Shutdown(context.Background())) + }) + } +} diff --git a/receiver/tlscheckreceiver/generated_package_test.go b/receiver/tlscheckreceiver/generated_package_test.go new file mode 100644 index 000000000000..98a559a58039 --- /dev/null +++ b/receiver/tlscheckreceiver/generated_package_test.go @@ -0,0 +1,13 @@ +// Code generated by mdatagen. DO NOT EDIT. + +package tlscheckreceiver + +import ( + "testing" + + "go.uber.org/goleak" +) + +func TestMain(m *testing.M) { + goleak.VerifyTestMain(m) +} diff --git a/receiver/tlscheckreceiver/go.mod b/receiver/tlscheckreceiver/go.mod new file mode 100644 index 000000000000..30e7601ee72a --- /dev/null +++ b/receiver/tlscheckreceiver/go.mod @@ -0,0 +1,55 @@ +module github.com/open-telemetry/opentelemetry-collector-contrib/receiver/tlscheckreceiver + +go 1.22.0 + +require ( + github.com/google/go-cmp v0.6.0 + github.com/stretchr/testify v1.9.0 + go.opentelemetry.io/collector/component v0.111.1-0.20241008154146-ea48c09c31ae + go.opentelemetry.io/collector/confmap v1.17.1-0.20241008154146-ea48c09c31ae + go.opentelemetry.io/collector/consumer v0.111.1-0.20241008154146-ea48c09c31ae + go.opentelemetry.io/collector/consumer/consumertest v0.111.1-0.20241008154146-ea48c09c31ae + go.opentelemetry.io/collector/filter v0.111.1-0.20241008154146-ea48c09c31ae + go.opentelemetry.io/collector/pdata v1.17.1-0.20241008154146-ea48c09c31ae + go.opentelemetry.io/collector/receiver v0.111.1-0.20241008154146-ea48c09c31ae + go.uber.org/goleak v1.3.0 + go.uber.org/multierr v1.11.0 + go.uber.org/zap v1.27.0 +) + +require ( + github.com/davecgh/go-spew v1.1.1 // indirect + github.com/go-logr/logr v1.4.2 // indirect + github.com/go-logr/stdr v1.2.2 // indirect + github.com/go-viper/mapstructure/v2 v2.1.0 // indirect + github.com/gogo/protobuf v1.3.2 // indirect + github.com/google/uuid v1.6.0 // indirect + github.com/json-iterator/go v1.1.12 // indirect + github.com/knadh/koanf/maps v0.1.1 // indirect + github.com/knadh/koanf/providers/confmap v0.1.0 // indirect + github.com/knadh/koanf/v2 v2.1.1 // indirect + github.com/mitchellh/copystructure v1.2.0 // indirect + github.com/mitchellh/reflectwalk v1.0.2 // indirect + github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect + github.com/modern-go/reflect2 v1.0.2 // indirect + github.com/pmezard/go-difflib v1.0.0 // indirect + github.com/rogpeppe/go-internal v1.12.0 // indirect + go.opentelemetry.io/collector/config/configtelemetry v0.111.1-0.20241008154146-ea48c09c31ae // indirect + go.opentelemetry.io/collector/consumer/consumerprofiles v0.111.1-0.20241008154146-ea48c09c31ae // indirect + go.opentelemetry.io/collector/internal/globalsignal v0.111.0 // indirect + go.opentelemetry.io/collector/pdata/pprofile v0.111.1-0.20241008154146-ea48c09c31ae // indirect + go.opentelemetry.io/collector/pipeline v0.111.1-0.20241008154146-ea48c09c31ae // indirect + go.opentelemetry.io/collector/receiver/receiverprofiles v0.111.1-0.20241008154146-ea48c09c31ae // indirect + go.opentelemetry.io/otel v1.30.0 // indirect + go.opentelemetry.io/otel/metric v1.30.0 // indirect + go.opentelemetry.io/otel/sdk v1.30.0 // indirect + go.opentelemetry.io/otel/sdk/metric v1.30.0 // indirect + go.opentelemetry.io/otel/trace v1.30.0 // indirect + golang.org/x/net v0.29.0 // indirect + golang.org/x/sys v0.25.0 // indirect + golang.org/x/text v0.18.0 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240822170219-fc7c04adadcd // indirect + google.golang.org/grpc v1.67.1 // indirect + google.golang.org/protobuf v1.35.1 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect +) diff --git a/receiver/tlscheckreceiver/go.sum b/receiver/tlscheckreceiver/go.sum new file mode 100644 index 000000000000..968b2bb483d2 --- /dev/null +++ b/receiver/tlscheckreceiver/go.sum @@ -0,0 +1,136 @@ +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY= +github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= +github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= +github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= +github.com/go-viper/mapstructure/v2 v2.1.0 h1:gHnMa2Y/pIxElCH2GlZZ1lZSsn6XMtufpGyP1XxdC/w= +github.com/go-viper/mapstructure/v2 v2.1.0/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM= +github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= +github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= +github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= +github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= +github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= +github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= +github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= +github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= +github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= +github.com/knadh/koanf/maps v0.1.1 h1:G5TjmUh2D7G2YWf5SQQqSiHRJEjaicvU0KpypqB3NIs= +github.com/knadh/koanf/maps v0.1.1/go.mod h1:npD/QZY3V6ghQDdcQzl1W4ICNVTkohC8E73eI2xW4yI= +github.com/knadh/koanf/providers/confmap v0.1.0 h1:gOkxhHkemwG4LezxxN8DMOFopOPghxRVp7JbIvdvqzU= +github.com/knadh/koanf/providers/confmap v0.1.0/go.mod h1:2uLhxQzJnyHKfxG927awZC7+fyHFdQkd697K4MdLnIU= +github.com/knadh/koanf/v2 v2.1.1 h1:/R8eXqasSTsmDCsAyYj+81Wteg8AqrV9CP6gvsTsOmM= +github.com/knadh/koanf/v2 v2.1.1/go.mod h1:4mnTRbZCK+ALuBXHZMjDfG9y714L7TykVnZkXbMU3Es= +github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= +github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= +github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= +github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/mitchellh/copystructure v1.2.0 h1:vpKXTN4ewci03Vljg/q9QvCGUDttBOGBIa15WveJJGw= +github.com/mitchellh/copystructure v1.2.0/go.mod h1:qLl+cE2AmVv+CoeAwDPye/v+N2HKCj9FbZEVFJRxO9s= +github.com/mitchellh/reflectwalk v1.0.2 h1:G2LzWKi524PWgd3mLHV8Y5k7s6XUvT0Gef6zxSIeXaQ= +github.com/mitchellh/reflectwalk v1.0.2/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= +github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= +github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= +github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8= +github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= +github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= +github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +go.opentelemetry.io/collector/component v0.111.1-0.20241008154146-ea48c09c31ae h1:dXAMqXGJp1vWG7qwS/2sjIyJgmyOSfEOm6Gcmkzp1cQ= +go.opentelemetry.io/collector/component v0.111.1-0.20241008154146-ea48c09c31ae/go.mod h1:iWUfPxpVwZhkI4v3/Gh5wt4iKyJn4lriPFAug8iLXno= +go.opentelemetry.io/collector/config/configtelemetry v0.111.1-0.20241008154146-ea48c09c31ae h1:NmNYRBSP+IUK9CsU1Q/1eS/tXmYTPMYxmGQsxEprq/s= +go.opentelemetry.io/collector/config/configtelemetry v0.111.1-0.20241008154146-ea48c09c31ae/go.mod h1:R0MBUxjSMVMIhljuDHWIygzzJWQyZHXXWIgQNxcFwhc= +go.opentelemetry.io/collector/confmap v1.17.1-0.20241008154146-ea48c09c31ae h1:mYgomPNE0dq1SU1OVnMb/Z8Xbj89jBXnjJexz9M71t0= +go.opentelemetry.io/collector/confmap v1.17.1-0.20241008154146-ea48c09c31ae/go.mod h1:GrIZ12P/9DPOuTpe2PIS51a0P/ZM6iKtByVee1Uf3+k= +go.opentelemetry.io/collector/consumer v0.111.1-0.20241008154146-ea48c09c31ae h1:ps86XqQ6kviggnQ7OnJIHDIoaYYinRGtfKKzcvSuplc= +go.opentelemetry.io/collector/consumer v0.111.1-0.20241008154146-ea48c09c31ae/go.mod h1:G6pdEDo5A92RY9sBTVbdbuv/nFrVJbDKSO6uRzzgaP8= +go.opentelemetry.io/collector/consumer/consumerprofiles v0.111.1-0.20241008154146-ea48c09c31ae h1:wQHN+NHZ7RwBDy3nSR52LTwLLLVvu116XdXA4KYjqHA= +go.opentelemetry.io/collector/consumer/consumerprofiles v0.111.1-0.20241008154146-ea48c09c31ae/go.mod h1:GK0QMMiRBWl4IhIF/7ZKgzBlR9SdRSpRlqyNInN4ZoU= +go.opentelemetry.io/collector/consumer/consumertest v0.111.1-0.20241008154146-ea48c09c31ae h1:HFj6D19fJYm3KV8QidQmMApmLjzoNkzh8El5OkTGySo= +go.opentelemetry.io/collector/consumer/consumertest v0.111.1-0.20241008154146-ea48c09c31ae/go.mod h1:UDZRrSgaFAwWO6I34fj0KjabVAuBCAnmizsleyIe3I4= +go.opentelemetry.io/collector/filter v0.111.1-0.20241008154146-ea48c09c31ae h1:fLRV9bU33PJWQ/eZCwzfKdV0I9ljhP84Zoq9+tBhcLU= +go.opentelemetry.io/collector/filter v0.111.1-0.20241008154146-ea48c09c31ae/go.mod h1:74Acew42eexKiuLu3tVehyMK4b5XJPWXoJyNjK2FM+U= +go.opentelemetry.io/collector/internal/globalsignal v0.111.0 h1:oq0nSD+7K2Q1Fx5d3s6lPRdKZeTL0FEg4sIaR7ZJzIc= +go.opentelemetry.io/collector/internal/globalsignal v0.111.0/go.mod h1:GqMXodPWOxK5uqpX8MaMXC2389y2XJTa5nPwf8FYDK8= +go.opentelemetry.io/collector/pdata v1.17.1-0.20241008154146-ea48c09c31ae h1:PcwZe1RD8tC4SZExhf0f5HqK+ZuWGsowHaBBU4PiUv0= +go.opentelemetry.io/collector/pdata v1.17.1-0.20241008154146-ea48c09c31ae/go.mod h1:Ox1YVLe87cZDB/TL30i4SUz1cA5s6AM6SpFMfY61ICs= +go.opentelemetry.io/collector/pdata/pprofile v0.111.1-0.20241008154146-ea48c09c31ae h1:V6Lp/+A2pei61vmZy8Fwa6j22+wyMQNTFDSe1OVqwWc= +go.opentelemetry.io/collector/pdata/pprofile v0.111.1-0.20241008154146-ea48c09c31ae/go.mod h1:GRY9BmyYV9myczdT6Q9r+6sK2ICinvzXnrM8+46qpMs= +go.opentelemetry.io/collector/pdata/testdata v0.111.0 h1:Fqyf1NJ0az+HbsvKSCNw8pfa1Y6c4FhZwlMK4ZulG0s= +go.opentelemetry.io/collector/pdata/testdata v0.111.0/go.mod h1:7SypOzbVtRsCkns6Yxa4GztnkVGkk7b9fW24Ow75q5s= +go.opentelemetry.io/collector/pipeline v0.111.1-0.20241008154146-ea48c09c31ae h1:/NNb1rBd/Y42FzIjpLjlRSb7bPANHyI3/3DnPg5p50U= +go.opentelemetry.io/collector/pipeline v0.111.1-0.20241008154146-ea48c09c31ae/go.mod h1:ZZMU3019geEU283rTW5M/LkcqLqHp/YI2Nl6/Vp68PQ= +go.opentelemetry.io/collector/receiver v0.111.1-0.20241008154146-ea48c09c31ae h1:/CdVIXj9tjTU+5U2D2O/w5T7vYbWF+D6mW9J09GWqis= +go.opentelemetry.io/collector/receiver v0.111.1-0.20241008154146-ea48c09c31ae/go.mod h1:IB7XEWVIprzSO5Y5RoyPLx3I4ntVGvhOWvoHN1n24IY= +go.opentelemetry.io/collector/receiver/receiverprofiles v0.111.1-0.20241008154146-ea48c09c31ae h1:zJAd63i80I+8wGgK1OB49hX/MJ5GEeS0aNbxxvr7aks= +go.opentelemetry.io/collector/receiver/receiverprofiles v0.111.1-0.20241008154146-ea48c09c31ae/go.mod h1:cwpkRCGssE2AxydEzkFC3l611d8+csaDH/7BjKC7nHI= +go.opentelemetry.io/otel v1.30.0 h1:F2t8sK4qf1fAmY9ua4ohFS/K+FUuOPemHUIXHtktrts= +go.opentelemetry.io/otel v1.30.0/go.mod h1:tFw4Br9b7fOS+uEao81PJjVMjW/5fvNCbpsDIXqP0pc= +go.opentelemetry.io/otel/metric v1.30.0 h1:4xNulvn9gjzo4hjg+wzIKG7iNFEaBMX00Qd4QIZs7+w= +go.opentelemetry.io/otel/metric v1.30.0/go.mod h1:aXTfST94tswhWEb+5QjlSqG+cZlmyXy/u8jFpor3WqQ= +go.opentelemetry.io/otel/sdk v1.30.0 h1:cHdik6irO49R5IysVhdn8oaiR9m8XluDaJAs4DfOrYE= +go.opentelemetry.io/otel/sdk v1.30.0/go.mod h1:p14X4Ok8S+sygzblytT1nqG98QG2KYKv++HE0LY/mhg= +go.opentelemetry.io/otel/sdk/metric v1.30.0 h1:QJLT8Pe11jyHBHfSAgYH7kEmT24eX792jZO1bo4BXkM= +go.opentelemetry.io/otel/sdk/metric v1.30.0/go.mod h1:waS6P3YqFNzeP01kuo/MBBYqaoBJl7efRQHOaydhy1Y= +go.opentelemetry.io/otel/trace v1.30.0 h1:7UBkkYzeg3C7kQX8VAidWh2biiQbtAKjyIML8dQ9wmc= +go.opentelemetry.io/otel/trace v1.30.0/go.mod h1:5EyKqTzzmyqB9bwtCCq6pDLktPK6fmGf/Dph+8VI02o= +go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= +go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= +go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= +go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= +go.uber.org/zap v1.27.0 h1:aJMhYGrd5QSmlpLMr2MftRKl7t8J8PTZPA732ud/XR8= +go.uber.org/zap v1.27.0/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.29.0 h1:5ORfpBpCs4HzDYoodCDBbwHzdR5UrLBZ3sOnUJmFoHo= +golang.org/x/net v0.29.0/go.mod h1:gLkgy8jTGERgjzMic6DS9+SP0ajcu6Xu3Orq/SpETg0= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34= +golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.18.0 h1:XvMDiNzPAl0jr17s6W9lcaIhGUfUORdGCNsuLmPG224= +golang.org/x/text v0.18.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240822170219-fc7c04adadcd h1:6TEm2ZxXoQmFWFlt1vNxvVOa1Q0dXFQD1m/rYjXmS0E= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240822170219-fc7c04adadcd/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU= +google.golang.org/grpc v1.67.1 h1:zWnc1Vrcno+lHZCOofnIMvycFcc0QRGIzm9dhnDX68E= +google.golang.org/grpc v1.67.1/go.mod h1:1gLDyUQU7CTLJI90u3nXZ9ekeghjeM7pTDZlqFNg2AA= +google.golang.org/protobuf v1.35.1 h1:m3LfL6/Ca+fqnjnlqQXNpFPABW1UD7mjh8KO2mKFytA= +google.golang.org/protobuf v1.35.1/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/receiver/tlscheckreceiver/internal/metadata/generated_config.go b/receiver/tlscheckreceiver/internal/metadata/generated_config.go new file mode 100644 index 000000000000..96e738301b15 --- /dev/null +++ b/receiver/tlscheckreceiver/internal/metadata/generated_config.go @@ -0,0 +1,92 @@ +// Code generated by mdatagen. DO NOT EDIT. + +package metadata + +import ( + "go.opentelemetry.io/collector/confmap" + "go.opentelemetry.io/collector/filter" +) + +// MetricConfig provides common config for a particular metric. +type MetricConfig struct { + Enabled bool `mapstructure:"enabled"` + + enabledSetByUser bool +} + +func (ms *MetricConfig) Unmarshal(parser *confmap.Conf) error { + if parser == nil { + return nil + } + err := parser.Unmarshal(ms) + if err != nil { + return err + } + ms.enabledSetByUser = parser.IsSet("enabled") + return nil +} + +// MetricsConfig provides config for tlscheck metrics. +type MetricsConfig struct { + TlscheckTimeLeft MetricConfig `mapstructure:"tlscheck.time_left"` +} + +func DefaultMetricsConfig() MetricsConfig { + return MetricsConfig{ + TlscheckTimeLeft: MetricConfig{ + Enabled: true, + }, + } +} + +// ResourceAttributeConfig provides common config for a particular resource attribute. +type ResourceAttributeConfig struct { + Enabled bool `mapstructure:"enabled"` + // Experimental: MetricsInclude defines a list of filters for attribute values. + // If the list is not empty, only metrics with matching resource attribute values will be emitted. + MetricsInclude []filter.Config `mapstructure:"metrics_include"` + // Experimental: MetricsExclude defines a list of filters for attribute values. + // If the list is not empty, metrics with matching resource attribute values will not be emitted. + // MetricsInclude has higher priority than MetricsExclude. + MetricsExclude []filter.Config `mapstructure:"metrics_exclude"` + + enabledSetByUser bool +} + +func (rac *ResourceAttributeConfig) Unmarshal(parser *confmap.Conf) error { + if parser == nil { + return nil + } + err := parser.Unmarshal(rac) + if err != nil { + return err + } + rac.enabledSetByUser = parser.IsSet("enabled") + return nil +} + +// ResourceAttributesConfig provides config for tlscheck resource attributes. +type ResourceAttributesConfig struct { + TlscheckURL ResourceAttributeConfig `mapstructure:"tlscheck.url"` +} + +func DefaultResourceAttributesConfig() ResourceAttributesConfig { + return ResourceAttributesConfig{ + TlscheckURL: ResourceAttributeConfig{ + Enabled: true, + }, + } +} + +// MetricsBuilderConfig is a configuration for tlscheck metrics builder. +type MetricsBuilderConfig struct { + Metrics MetricsConfig `mapstructure:"metrics"` + ResourceAttributes ResourceAttributesConfig `mapstructure:"resource_attributes"` +} + +func DefaultMetricsBuilderConfig() MetricsBuilderConfig { + return MetricsBuilderConfig{ + Metrics: DefaultMetricsConfig(), + ResourceAttributes: DefaultResourceAttributesConfig(), + } +} diff --git a/receiver/tlscheckreceiver/internal/metadata/generated_config_test.go b/receiver/tlscheckreceiver/internal/metadata/generated_config_test.go new file mode 100644 index 000000000000..7c84015ab981 --- /dev/null +++ b/receiver/tlscheckreceiver/internal/metadata/generated_config_test.go @@ -0,0 +1,109 @@ +// Code generated by mdatagen. DO NOT EDIT. + +package metadata + +import ( + "path/filepath" + "testing" + + "github.com/google/go-cmp/cmp" + "github.com/google/go-cmp/cmp/cmpopts" + "github.com/stretchr/testify/require" + "go.opentelemetry.io/collector/confmap/confmaptest" +) + +func TestMetricsBuilderConfig(t *testing.T) { + tests := []struct { + name string + want MetricsBuilderConfig + }{ + { + name: "default", + want: DefaultMetricsBuilderConfig(), + }, + { + name: "all_set", + want: MetricsBuilderConfig{ + Metrics: MetricsConfig{ + TlscheckTimeLeft: MetricConfig{Enabled: true}, + }, + ResourceAttributes: ResourceAttributesConfig{ + TlscheckURL: ResourceAttributeConfig{Enabled: true}, + }, + }, + }, + { + name: "none_set", + want: MetricsBuilderConfig{ + Metrics: MetricsConfig{ + TlscheckTimeLeft: MetricConfig{Enabled: false}, + }, + ResourceAttributes: ResourceAttributesConfig{ + TlscheckURL: ResourceAttributeConfig{Enabled: false}, + }, + }, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + cfg := loadMetricsBuilderConfig(t, tt.name) + if diff := cmp.Diff(tt.want, cfg, cmpopts.IgnoreUnexported(MetricConfig{}, ResourceAttributeConfig{})); diff != "" { + t.Errorf("Config mismatch (-expected +actual):\n%s", diff) + } + }) + } +} + +func loadMetricsBuilderConfig(t *testing.T, name string) MetricsBuilderConfig { + cm, err := confmaptest.LoadConf(filepath.Join("testdata", "config.yaml")) + require.NoError(t, err) + sub, err := cm.Sub(name) + require.NoError(t, err) + cfg := DefaultMetricsBuilderConfig() + require.NoError(t, sub.Unmarshal(&cfg)) + return cfg +} + +func TestResourceAttributesConfig(t *testing.T) { + tests := []struct { + name string + want ResourceAttributesConfig + }{ + { + name: "default", + want: DefaultResourceAttributesConfig(), + }, + { + name: "all_set", + want: ResourceAttributesConfig{ + TlscheckURL: ResourceAttributeConfig{Enabled: true}, + }, + }, + { + name: "none_set", + want: ResourceAttributesConfig{ + TlscheckURL: ResourceAttributeConfig{Enabled: false}, + }, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + cfg := loadResourceAttributesConfig(t, tt.name) + if diff := cmp.Diff(tt.want, cfg, cmpopts.IgnoreUnexported(ResourceAttributeConfig{})); diff != "" { + t.Errorf("Config mismatch (-expected +actual):\n%s", diff) + } + }) + } +} + +func loadResourceAttributesConfig(t *testing.T, name string) ResourceAttributesConfig { + cm, err := confmaptest.LoadConf(filepath.Join("testdata", "config.yaml")) + require.NoError(t, err) + sub, err := cm.Sub(name) + require.NoError(t, err) + sub, err = sub.Sub("resource_attributes") + require.NoError(t, err) + cfg := DefaultResourceAttributesConfig() + require.NoError(t, sub.Unmarshal(&cfg)) + return cfg +} diff --git a/receiver/tlscheckreceiver/internal/metadata/generated_metrics.go b/receiver/tlscheckreceiver/internal/metadata/generated_metrics.go new file mode 100644 index 000000000000..988cf4f1cdcb --- /dev/null +++ b/receiver/tlscheckreceiver/internal/metadata/generated_metrics.go @@ -0,0 +1,227 @@ +// Code generated by mdatagen. DO NOT EDIT. + +package metadata + +import ( + "time" + + "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/filter" + "go.opentelemetry.io/collector/pdata/pcommon" + "go.opentelemetry.io/collector/pdata/pmetric" + "go.opentelemetry.io/collector/receiver" +) + +type metricTlscheckTimeLeft struct { + data pmetric.Metric // data buffer for generated metric. + config MetricConfig // metric config provided by user. + capacity int // max observed number of data points added to the metric. +} + +// init fills tlscheck.time_left metric with initial data. +func (m *metricTlscheckTimeLeft) init() { + m.data.SetName("tlscheck.time_left") + m.data.SetDescription("Time in seconds until certificate expiry, as specified by `NotAfter` field in the x.509 certificate. Negative values represent time in seconds since expiration.") + m.data.SetUnit("s") + m.data.SetEmptyGauge() + m.data.Gauge().DataPoints().EnsureCapacity(m.capacity) +} + +func (m *metricTlscheckTimeLeft) recordDataPoint(start pcommon.Timestamp, ts pcommon.Timestamp, val int64, tlscheckX509IssuerAttributeValue string, tlscheckX509CnAttributeValue string) { + if !m.config.Enabled { + return + } + dp := m.data.Gauge().DataPoints().AppendEmpty() + dp.SetStartTimestamp(start) + dp.SetTimestamp(ts) + dp.SetIntValue(val) + dp.Attributes().PutStr("tlscheck.x509.issuer", tlscheckX509IssuerAttributeValue) + dp.Attributes().PutStr("tlscheck.x509.cn", tlscheckX509CnAttributeValue) +} + +// updateCapacity saves max length of data point slices that will be used for the slice capacity. +func (m *metricTlscheckTimeLeft) updateCapacity() { + if m.data.Gauge().DataPoints().Len() > m.capacity { + m.capacity = m.data.Gauge().DataPoints().Len() + } +} + +// emit appends recorded metric data to a metrics slice and prepares it for recording another set of data points. +func (m *metricTlscheckTimeLeft) emit(metrics pmetric.MetricSlice) { + if m.config.Enabled && m.data.Gauge().DataPoints().Len() > 0 { + m.updateCapacity() + m.data.MoveTo(metrics.AppendEmpty()) + m.init() + } +} + +func newMetricTlscheckTimeLeft(cfg MetricConfig) metricTlscheckTimeLeft { + m := metricTlscheckTimeLeft{config: cfg} + if cfg.Enabled { + m.data = pmetric.NewMetric() + m.init() + } + return m +} + +// MetricsBuilder provides an interface for scrapers to report metrics while taking care of all the transformations +// required to produce metric representation defined in metadata and user config. +type MetricsBuilder struct { + config MetricsBuilderConfig // config of the metrics builder. + startTime pcommon.Timestamp // start time that will be applied to all recorded data points. + metricsCapacity int // maximum observed number of metrics per resource. + metricsBuffer pmetric.Metrics // accumulates metrics data before emitting. + buildInfo component.BuildInfo // contains version information. + resourceAttributeIncludeFilter map[string]filter.Filter + resourceAttributeExcludeFilter map[string]filter.Filter + metricTlscheckTimeLeft metricTlscheckTimeLeft +} + +// MetricBuilderOption applies changes to default metrics builder. +type MetricBuilderOption interface { + apply(*MetricsBuilder) +} + +type metricBuilderOptionFunc func(mb *MetricsBuilder) + +func (mbof metricBuilderOptionFunc) apply(mb *MetricsBuilder) { + mbof(mb) +} + +// WithStartTime sets startTime on the metrics builder. +func WithStartTime(startTime pcommon.Timestamp) MetricBuilderOption { + return metricBuilderOptionFunc(func(mb *MetricsBuilder) { + mb.startTime = startTime + }) +} + +func NewMetricsBuilder(mbc MetricsBuilderConfig, settings receiver.Settings, options ...MetricBuilderOption) *MetricsBuilder { + mb := &MetricsBuilder{ + config: mbc, + startTime: pcommon.NewTimestampFromTime(time.Now()), + metricsBuffer: pmetric.NewMetrics(), + buildInfo: settings.BuildInfo, + metricTlscheckTimeLeft: newMetricTlscheckTimeLeft(mbc.Metrics.TlscheckTimeLeft), + resourceAttributeIncludeFilter: make(map[string]filter.Filter), + resourceAttributeExcludeFilter: make(map[string]filter.Filter), + } + if mbc.ResourceAttributes.TlscheckURL.MetricsInclude != nil { + mb.resourceAttributeIncludeFilter["tlscheck.url"] = filter.CreateFilter(mbc.ResourceAttributes.TlscheckURL.MetricsInclude) + } + if mbc.ResourceAttributes.TlscheckURL.MetricsExclude != nil { + mb.resourceAttributeExcludeFilter["tlscheck.url"] = filter.CreateFilter(mbc.ResourceAttributes.TlscheckURL.MetricsExclude) + } + + for _, op := range options { + op.apply(mb) + } + return mb +} + +// NewResourceBuilder returns a new resource builder that should be used to build a resource associated with for the emitted metrics. +func (mb *MetricsBuilder) NewResourceBuilder() *ResourceBuilder { + return NewResourceBuilder(mb.config.ResourceAttributes) +} + +// updateCapacity updates max length of metrics and resource attributes that will be used for the slice capacity. +func (mb *MetricsBuilder) updateCapacity(rm pmetric.ResourceMetrics) { + if mb.metricsCapacity < rm.ScopeMetrics().At(0).Metrics().Len() { + mb.metricsCapacity = rm.ScopeMetrics().At(0).Metrics().Len() + } +} + +// ResourceMetricsOption applies changes to provided resource metrics. +type ResourceMetricsOption interface { + apply(pmetric.ResourceMetrics) +} + +type resourceMetricsOptionFunc func(pmetric.ResourceMetrics) + +func (rmof resourceMetricsOptionFunc) apply(rm pmetric.ResourceMetrics) { + rmof(rm) +} + +// WithResource sets the provided resource on the emitted ResourceMetrics. +// It's recommended to use ResourceBuilder to create the resource. +func WithResource(res pcommon.Resource) ResourceMetricsOption { + return resourceMetricsOptionFunc(func(rm pmetric.ResourceMetrics) { + res.CopyTo(rm.Resource()) + }) +} + +// WithStartTimeOverride overrides start time for all the resource metrics data points. +// This option should be only used if different start time has to be set on metrics coming from different resources. +func WithStartTimeOverride(start pcommon.Timestamp) ResourceMetricsOption { + return resourceMetricsOptionFunc(func(rm pmetric.ResourceMetrics) { + var dps pmetric.NumberDataPointSlice + metrics := rm.ScopeMetrics().At(0).Metrics() + for i := 0; i < metrics.Len(); i++ { + switch metrics.At(i).Type() { + case pmetric.MetricTypeGauge: + dps = metrics.At(i).Gauge().DataPoints() + case pmetric.MetricTypeSum: + dps = metrics.At(i).Sum().DataPoints() + } + for j := 0; j < dps.Len(); j++ { + dps.At(j).SetStartTimestamp(start) + } + } + }) +} + +// EmitForResource saves all the generated metrics under a new resource and updates the internal state to be ready for +// recording another set of data points as part of another resource. This function can be helpful when one scraper +// needs to emit metrics from several resources. Otherwise calling this function is not required, +// just `Emit` function can be called instead. +// Resource attributes should be provided as ResourceMetricsOption arguments. +func (mb *MetricsBuilder) EmitForResource(options ...ResourceMetricsOption) { + rm := pmetric.NewResourceMetrics() + ils := rm.ScopeMetrics().AppendEmpty() + ils.Scope().SetName("github.com/open-telemetry/opentelemetry-collector-contrib/receiver/tlscheckreceiver") + ils.Scope().SetVersion(mb.buildInfo.Version) + ils.Metrics().EnsureCapacity(mb.metricsCapacity) + mb.metricTlscheckTimeLeft.emit(ils.Metrics()) + + for _, op := range options { + op.apply(rm) + } + for attr, filter := range mb.resourceAttributeIncludeFilter { + if val, ok := rm.Resource().Attributes().Get(attr); ok && !filter.Matches(val.AsString()) { + return + } + } + for attr, filter := range mb.resourceAttributeExcludeFilter { + if val, ok := rm.Resource().Attributes().Get(attr); ok && filter.Matches(val.AsString()) { + return + } + } + + if ils.Metrics().Len() > 0 { + mb.updateCapacity(rm) + rm.MoveTo(mb.metricsBuffer.ResourceMetrics().AppendEmpty()) + } +} + +// Emit returns all the metrics accumulated by the metrics builder and updates the internal state to be ready for +// recording another set of metrics. This function will be responsible for applying all the transformations required to +// produce metric representation defined in metadata and user config, e.g. delta or cumulative. +func (mb *MetricsBuilder) Emit(options ...ResourceMetricsOption) pmetric.Metrics { + mb.EmitForResource(options...) + metrics := mb.metricsBuffer + mb.metricsBuffer = pmetric.NewMetrics() + return metrics +} + +// RecordTlscheckTimeLeftDataPoint adds a data point to tlscheck.time_left metric. +func (mb *MetricsBuilder) RecordTlscheckTimeLeftDataPoint(ts pcommon.Timestamp, val int64, tlscheckX509IssuerAttributeValue string, tlscheckX509CnAttributeValue string) { + mb.metricTlscheckTimeLeft.recordDataPoint(mb.startTime, ts, val, tlscheckX509IssuerAttributeValue, tlscheckX509CnAttributeValue) +} + +// Reset resets metrics builder to its initial state. It should be used when external metrics source is restarted, +// and metrics builder should update its startTime and reset it's internal state accordingly. +func (mb *MetricsBuilder) Reset(options ...MetricBuilderOption) { + mb.startTime = pcommon.NewTimestampFromTime(time.Now()) + for _, op := range options { + op.apply(mb) + } +} diff --git a/receiver/tlscheckreceiver/internal/metadata/generated_metrics_test.go b/receiver/tlscheckreceiver/internal/metadata/generated_metrics_test.go new file mode 100644 index 000000000000..b81713f24b82 --- /dev/null +++ b/receiver/tlscheckreceiver/internal/metadata/generated_metrics_test.go @@ -0,0 +1,121 @@ +// Code generated by mdatagen. DO NOT EDIT. + +package metadata + +import ( + "testing" + + "github.com/stretchr/testify/assert" + "go.opentelemetry.io/collector/pdata/pcommon" + "go.opentelemetry.io/collector/pdata/pmetric" + "go.opentelemetry.io/collector/receiver/receivertest" + "go.uber.org/zap" + "go.uber.org/zap/zaptest/observer" +) + +type testDataSet int + +const ( + testDataSetDefault testDataSet = iota + testDataSetAll + testDataSetNone +) + +func TestMetricsBuilder(t *testing.T) { + tests := []struct { + name string + metricsSet testDataSet + resAttrsSet testDataSet + expectEmpty bool + }{ + { + name: "default", + }, + { + name: "all_set", + metricsSet: testDataSetAll, + resAttrsSet: testDataSetAll, + }, + { + name: "none_set", + metricsSet: testDataSetNone, + resAttrsSet: testDataSetNone, + expectEmpty: true, + }, + { + name: "filter_set_include", + resAttrsSet: testDataSetAll, + }, + { + name: "filter_set_exclude", + resAttrsSet: testDataSetAll, + expectEmpty: true, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + start := pcommon.Timestamp(1_000_000_000) + ts := pcommon.Timestamp(1_000_001_000) + observedZapCore, observedLogs := observer.New(zap.WarnLevel) + settings := receivertest.NewNopSettings() + settings.Logger = zap.New(observedZapCore) + mb := NewMetricsBuilder(loadMetricsBuilderConfig(t, tt.name), settings, WithStartTime(start)) + + expectedWarnings := 0 + + assert.Equal(t, expectedWarnings, observedLogs.Len()) + + defaultMetricsCount := 0 + allMetricsCount := 0 + + defaultMetricsCount++ + allMetricsCount++ + mb.RecordTlscheckTimeLeftDataPoint(ts, 1, "tlscheck.x509.issuer-val", "tlscheck.x509.cn-val") + + rb := mb.NewResourceBuilder() + rb.SetTlscheckURL("tlscheck.url-val") + res := rb.Emit() + metrics := mb.Emit(WithResource(res)) + + if tt.expectEmpty { + assert.Equal(t, 0, metrics.ResourceMetrics().Len()) + return + } + + assert.Equal(t, 1, metrics.ResourceMetrics().Len()) + rm := metrics.ResourceMetrics().At(0) + assert.Equal(t, res, rm.Resource()) + assert.Equal(t, 1, rm.ScopeMetrics().Len()) + ms := rm.ScopeMetrics().At(0).Metrics() + if tt.metricsSet == testDataSetDefault { + assert.Equal(t, defaultMetricsCount, ms.Len()) + } + if tt.metricsSet == testDataSetAll { + assert.Equal(t, allMetricsCount, ms.Len()) + } + validatedMetrics := make(map[string]bool) + for i := 0; i < ms.Len(); i++ { + switch ms.At(i).Name() { + case "tlscheck.time_left": + assert.False(t, validatedMetrics["tlscheck.time_left"], "Found a duplicate in the metrics slice: tlscheck.time_left") + validatedMetrics["tlscheck.time_left"] = true + assert.Equal(t, pmetric.MetricTypeGauge, ms.At(i).Type()) + assert.Equal(t, 1, ms.At(i).Gauge().DataPoints().Len()) + assert.Equal(t, "Time in seconds until certificate expiry, as specified by `NotAfter` field in the x.509 certificate. Negative values represent time in seconds since expiration.", ms.At(i).Description()) + assert.Equal(t, "s", ms.At(i).Unit()) + dp := ms.At(i).Gauge().DataPoints().At(0) + assert.Equal(t, start, dp.StartTimestamp()) + assert.Equal(t, ts, dp.Timestamp()) + assert.Equal(t, pmetric.NumberDataPointValueTypeInt, dp.ValueType()) + assert.Equal(t, int64(1), dp.IntValue()) + attrVal, ok := dp.Attributes().Get("tlscheck.x509.issuer") + assert.True(t, ok) + assert.EqualValues(t, "tlscheck.x509.issuer-val", attrVal.Str()) + attrVal, ok = dp.Attributes().Get("tlscheck.x509.cn") + assert.True(t, ok) + assert.EqualValues(t, "tlscheck.x509.cn-val", attrVal.Str()) + } + } + }) + } +} diff --git a/receiver/tlscheckreceiver/internal/metadata/generated_resource.go b/receiver/tlscheckreceiver/internal/metadata/generated_resource.go new file mode 100644 index 000000000000..e51961b1db39 --- /dev/null +++ b/receiver/tlscheckreceiver/internal/metadata/generated_resource.go @@ -0,0 +1,36 @@ +// Code generated by mdatagen. DO NOT EDIT. + +package metadata + +import ( + "go.opentelemetry.io/collector/pdata/pcommon" +) + +// ResourceBuilder is a helper struct to build resources predefined in metadata.yaml. +// The ResourceBuilder is not thread-safe and must not to be used in multiple goroutines. +type ResourceBuilder struct { + config ResourceAttributesConfig + res pcommon.Resource +} + +// NewResourceBuilder creates a new ResourceBuilder. This method should be called on the start of the application. +func NewResourceBuilder(rac ResourceAttributesConfig) *ResourceBuilder { + return &ResourceBuilder{ + config: rac, + res: pcommon.NewResource(), + } +} + +// SetTlscheckURL sets provided value as "tlscheck.url" attribute. +func (rb *ResourceBuilder) SetTlscheckURL(val string) { + if rb.config.TlscheckURL.Enabled { + rb.res.Attributes().PutStr("tlscheck.url", val) + } +} + +// Emit returns the built resource and resets the internal builder state. +func (rb *ResourceBuilder) Emit() pcommon.Resource { + r := rb.res + rb.res = pcommon.NewResource() + return r +} diff --git a/receiver/tlscheckreceiver/internal/metadata/generated_resource_test.go b/receiver/tlscheckreceiver/internal/metadata/generated_resource_test.go new file mode 100644 index 000000000000..4a67d0fd5ad5 --- /dev/null +++ b/receiver/tlscheckreceiver/internal/metadata/generated_resource_test.go @@ -0,0 +1,40 @@ +// Code generated by mdatagen. DO NOT EDIT. + +package metadata + +import ( + "testing" + + "github.com/stretchr/testify/assert" +) + +func TestResourceBuilder(t *testing.T) { + for _, tt := range []string{"default", "all_set", "none_set"} { + t.Run(tt, func(t *testing.T) { + cfg := loadResourceAttributesConfig(t, tt) + rb := NewResourceBuilder(cfg) + rb.SetTlscheckURL("tlscheck.url-val") + + res := rb.Emit() + assert.Equal(t, 0, rb.Emit().Attributes().Len()) // Second call should return empty Resource + + switch tt { + case "default": + assert.Equal(t, 1, res.Attributes().Len()) + case "all_set": + assert.Equal(t, 1, res.Attributes().Len()) + case "none_set": + assert.Equal(t, 0, res.Attributes().Len()) + return + default: + assert.Failf(t, "unexpected test case: %s", tt) + } + + val, ok := res.Attributes().Get("tlscheck.url") + assert.True(t, ok) + if ok { + assert.EqualValues(t, "tlscheck.url-val", val.Str()) + } + }) + } +} diff --git a/receiver/tlscheckreceiver/internal/metadata/generated_status.go b/receiver/tlscheckreceiver/internal/metadata/generated_status.go new file mode 100644 index 000000000000..5a9e7e63556d --- /dev/null +++ b/receiver/tlscheckreceiver/internal/metadata/generated_status.go @@ -0,0 +1,16 @@ +// Code generated by mdatagen. DO NOT EDIT. + +package metadata + +import ( + "go.opentelemetry.io/collector/component" +) + +var ( + Type = component.MustNewType("tlscheck") + ScopeName = "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/tlscheckreceiver" +) + +const ( + MetricsStability = component.StabilityLevelDevelopment +) diff --git a/receiver/tlscheckreceiver/internal/metadata/testdata/config.yaml b/receiver/tlscheckreceiver/internal/metadata/testdata/config.yaml new file mode 100644 index 000000000000..7dc13e51f71c --- /dev/null +++ b/receiver/tlscheckreceiver/internal/metadata/testdata/config.yaml @@ -0,0 +1,27 @@ +default: +all_set: + metrics: + tlscheck.time_left: + enabled: true + resource_attributes: + tlscheck.url: + enabled: true +none_set: + metrics: + tlscheck.time_left: + enabled: false + resource_attributes: + tlscheck.url: + enabled: false +filter_set_include: + resource_attributes: + tlscheck.url: + enabled: true + metrics_include: + - regexp: ".*" +filter_set_exclude: + resource_attributes: + tlscheck.url: + enabled: true + metrics_exclude: + - strict: "tlscheck.url-val" diff --git a/receiver/tlscheckreceiver/metadata.yaml b/receiver/tlscheckreceiver/metadata.yaml new file mode 100644 index 000000000000..843444b4c35f --- /dev/null +++ b/receiver/tlscheckreceiver/metadata.yaml @@ -0,0 +1,35 @@ +type: tlscheck + +status: + class: receiver + stability: + development: [metrics] + distributions: [contrib] + codeowners: + active: [atoulme, michael-burt] + + +resource_attributes: + tlscheck.url: + enabled: true + description: Url at which the certificate was accessed. + type: string + +attributes: + tlscheck.x509.issuer: + enabled: true + description: The entity that issued the certificate. + type: string + tlscheck.x509.cn: + enabled: true + description: The commonName in the subject of the certificate. + type: string + +metrics: + tlscheck.time_left: + description: Time in seconds until certificate expiry, as specified by `NotAfter` field in the x.509 certificate. Negative values represent time in seconds since expiration. + enabled: true + gauge: + value_type: int + unit: "s" + attributes: [tlscheck.x509.issuer, tlscheck.x509.cn] \ No newline at end of file diff --git a/receiver/tlscheckreceiver/scraper.go b/receiver/tlscheckreceiver/scraper.go new file mode 100644 index 000000000000..c4807cc78eff --- /dev/null +++ b/receiver/tlscheckreceiver/scraper.go @@ -0,0 +1,31 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package tlscheckreceiver // import "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/tlscheckreceiver" + +import ( + "context" + + "go.opentelemetry.io/collector/pdata/pmetric" + "go.opentelemetry.io/collector/receiver" + "go.uber.org/zap" + + "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/tlscheckreceiver/internal/metadata" +) + +type scraper struct { + // include string + logger *zap.Logger + mb *metadata.MetricsBuilder +} + +func (s *scraper) scrape(_ context.Context) (pmetric.Metrics, error) { + return pmetric.NewMetrics(), nil +} + +func newScraper(cfg *Config, settings receiver.Settings) *scraper { + return &scraper{ + logger: settings.TelemetrySettings.Logger, + mb: metadata.NewMetricsBuilder(cfg.MetricsBuilderConfig, settings), + } +} diff --git a/reports/distributions/contrib.yaml b/reports/distributions/contrib.yaml index a915a45f43fa..32d24599ba99 100644 --- a/reports/distributions/contrib.yaml +++ b/reports/distributions/contrib.yaml @@ -179,6 +179,7 @@ components: - statsd - syslog - tcplog + - tlscheck - udplog - vcenter - wavefront diff --git a/versions.yaml b/versions.yaml index 974edb7119d5..e6fee73f2ea2 100644 --- a/versions.yaml +++ b/versions.yaml @@ -274,6 +274,7 @@ module-sets: - github.com/open-telemetry/opentelemetry-collector-contrib/receiver/statsdreceiver - github.com/open-telemetry/opentelemetry-collector-contrib/receiver/syslogreceiver - github.com/open-telemetry/opentelemetry-collector-contrib/receiver/tcplogreceiver + - github.com/open-telemetry/opentelemetry-collector-contrib/receiver/tlscheckreceiver - github.com/open-telemetry/opentelemetry-collector-contrib/receiver/udplogreceiver - github.com/open-telemetry/opentelemetry-collector-contrib/receiver/vcenterreceiver - github.com/open-telemetry/opentelemetry-collector-contrib/receiver/wavefrontreceiver From aa89dc77fe01e05885fed940d36246a9cd175a88 Mon Sep 17 00:00:00 2001 From: Israel Blancas Date: Thu, 10 Oct 2024 01:06:42 +0200 Subject: [PATCH 009/140] [chore] Enable goleak oidcauthextension (#35282) Related to #30438 --------- Signed-off-by: Israel Blancas Co-authored-by: Curtis Robert --- .../enable-goleak-oidcauthextension.yaml | 28 +++++ extension/oidcauthextension/extension.go | 104 ++++++++++-------- extension/oidcauthextension/extension_test.go | 17 ++- .../generated_package_test.go | 6 +- extension/oidcauthextension/go.mod | 1 + extension/oidcauthextension/metadata.yaml | 2 - 6 files changed, 105 insertions(+), 53 deletions(-) create mode 100644 .chloggen/enable-goleak-oidcauthextension.yaml diff --git a/.chloggen/enable-goleak-oidcauthextension.yaml b/.chloggen/enable-goleak-oidcauthextension.yaml new file mode 100644 index 000000000000..9c389aff7e7c --- /dev/null +++ b/.chloggen/enable-goleak-oidcauthextension.yaml @@ -0,0 +1,28 @@ +# Use this changelog template to create an entry for release notes. + +# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' +change_type: bug_fix + +# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver) +component: oidcauthextension + +# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). +note: Fix a goroutine leak during shutdown. + +# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists. +issues: [30438] + +# (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: | + A goroutine leak was found in oidcauthextension. The goroutine leak was caused by the oidcauthextension not closing the idle connections in the client and transport. + +# 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/extension/oidcauthextension/extension.go b/extension/oidcauthextension/extension.go index 52ce78b29154..c79e3231ef3a 100644 --- a/extension/oidcauthextension/extension.go +++ b/extension/oidcauthextension/extension.go @@ -27,10 +27,11 @@ import ( type oidcExtension struct { cfg *Config - provider *oidc.Provider - verifier *oidc.IDTokenVerifier - - logger *zap.Logger + provider *oidc.Provider + verifier *oidc.IDTokenVerifier + client *http.Client + logger *zap.Logger + transport *http.Transport } var ( @@ -53,19 +54,31 @@ func newExtension(cfg *Config, logger *zap.Logger) auth.Server { cfg: cfg, logger: logger, } - return auth.NewServer(auth.WithServerStart(oe.start), auth.WithServerAuthenticate(oe.authenticate)) + return auth.NewServer( + auth.WithServerStart(oe.start), + auth.WithServerAuthenticate(oe.authenticate), + auth.WithServerShutdown(oe.shutdown), + ) } -func (e *oidcExtension) start(context.Context, component.Host) error { - provider, err := getProviderForConfig(e.cfg) +func (e *oidcExtension) start(ctx context.Context, _ component.Host) error { + err := e.setProviderConfig(ctx, e.cfg) if err != nil { return fmt.Errorf("failed to get configuration from the auth server: %w", err) } - e.provider = provider - e.verifier = e.provider.Verifier(&oidc.Config{ ClientID: e.cfg.Audience, }) + return nil +} + +func (e *oidcExtension) shutdown(context.Context) error { + if e.client != nil { + e.client.CloseIdleConnections() + } + if e.transport != nil { + e.transport.CloseIdleConnections() + } return nil } @@ -124,6 +137,44 @@ func (e *oidcExtension) authenticate(ctx context.Context, headers map[string][]s return client.NewContext(ctx, cl), nil } +func (e *oidcExtension) setProviderConfig(ctx context.Context, config *Config) error { + e.transport = &http.Transport{ + Proxy: http.ProxyFromEnvironment, + DialContext: (&net.Dialer{ + Timeout: 5 * time.Second, + KeepAlive: 10 * time.Second, + DualStack: true, + }).DialContext, + ForceAttemptHTTP2: true, + MaxIdleConns: 100, + IdleConnTimeout: 90 * time.Second, + TLSHandshakeTimeout: 5 * time.Second, + ExpectContinueTimeout: 1 * time.Second, + } + + cert, err := getIssuerCACertFromPath(config.IssuerCAPath) + if err != nil { + return err // the errors from this path have enough context already + } + + if cert != nil { + e.transport.TLSClientConfig = &tls.Config{ + RootCAs: x509.NewCertPool(), + } + e.transport.TLSClientConfig.RootCAs.AddCert(cert) + } + + e.client = &http.Client{ + Timeout: 5 * time.Second, + Transport: e.transport, + } + oidcContext := oidc.ClientContext(ctx, e.client) + provider, err := oidc.NewProvider(oidcContext, config.IssuerURL) + e.provider = provider + + return err +} + func getSubjectFromClaims(claims map[string]any, usernameClaim string, fallback string) (string, error) { if len(usernameClaim) > 0 { username, found := claims[usernameClaim] @@ -167,41 +218,6 @@ func getGroupsFromClaims(claims map[string]any, groupsClaim string) ([]string, e return []string{}, nil } -func getProviderForConfig(config *Config) (*oidc.Provider, error) { - t := &http.Transport{ - Proxy: http.ProxyFromEnvironment, - DialContext: (&net.Dialer{ - Timeout: 5 * time.Second, - KeepAlive: 10 * time.Second, - DualStack: true, - }).DialContext, - ForceAttemptHTTP2: true, - MaxIdleConns: 100, - IdleConnTimeout: 90 * time.Second, - TLSHandshakeTimeout: 5 * time.Second, - ExpectContinueTimeout: 1 * time.Second, - } - - cert, err := getIssuerCACertFromPath(config.IssuerCAPath) - if err != nil { - return nil, err // the errors from this path have enough context already - } - - if cert != nil { - t.TLSClientConfig = &tls.Config{ - RootCAs: x509.NewCertPool(), - } - t.TLSClientConfig.RootCAs.AddCert(cert) - } - - client := &http.Client{ - Timeout: 5 * time.Second, - Transport: t, - } - oidcContext := oidc.ClientContext(context.Background(), client) - return oidc.NewProvider(oidcContext, config.IssuerURL) -} - func getIssuerCACertFromPath(path string) (*x509.Certificate, error) { if path == "" { return nil, nil diff --git a/extension/oidcauthextension/extension_test.go b/extension/oidcauthextension/extension_test.go index 72931882a19a..92b72d15fa14 100644 --- a/extension/oidcauthextension/extension_test.go +++ b/extension/oidcauthextension/extension_test.go @@ -112,11 +112,14 @@ func TestOIDCProviderForConfigWithTLS(t *testing.T) { } // test - provider, err := getProviderForConfig(config) + e := &oidcExtension{} + err = e.setProviderConfig(context.Background(), config) // verify assert.NoError(t, err) - assert.NotNil(t, provider) + assert.NotNil(t, e.provider) + assert.NotNil(t, e.client) + assert.NotNil(t, e.transport) } func TestOIDCLoadIssuerCAFromPath(t *testing.T) { @@ -185,11 +188,14 @@ func TestOIDCFailedToLoadIssuerCAFromPathInvalidContent(t *testing.T) { } // test - provider, err := getProviderForConfig(config) // cross test with getIssuerCACertFromPath + e := &oidcExtension{} + err = e.setProviderConfig(context.Background(), config) // verify assert.Error(t, err) - assert.Nil(t, provider) + assert.Nil(t, e.provider) + assert.Nil(t, e.client) + assert.NotNil(t, e.transport) } func TestOIDCInvalidAuthHeader(t *testing.T) { @@ -234,6 +240,9 @@ func TestProviderNotReacheable(t *testing.T) { // verify assert.Error(t, err) + + err = p.Shutdown(context.Background()) + assert.NoError(t, err) } func TestFailedToVerifyToken(t *testing.T) { diff --git a/extension/oidcauthextension/generated_package_test.go b/extension/oidcauthextension/generated_package_test.go index 322491bcffe1..195328a56d6e 100644 --- a/extension/oidcauthextension/generated_package_test.go +++ b/extension/oidcauthextension/generated_package_test.go @@ -3,11 +3,11 @@ package oidcauthextension import ( - "os" "testing" + + "go.uber.org/goleak" ) func TestMain(m *testing.M) { - // skipping goleak test as per metadata.yml configuration - os.Exit(m.Run()) + goleak.VerifyTestMain(m) } diff --git a/extension/oidcauthextension/go.mod b/extension/oidcauthextension/go.mod index a644b28257ff..174261e84750 100644 --- a/extension/oidcauthextension/go.mod +++ b/extension/oidcauthextension/go.mod @@ -10,6 +10,7 @@ require ( go.opentelemetry.io/collector/confmap v1.17.1-0.20241008154146-ea48c09c31ae go.opentelemetry.io/collector/extension v0.111.1-0.20241008154146-ea48c09c31ae go.opentelemetry.io/collector/extension/auth v0.111.1-0.20241008154146-ea48c09c31ae + go.uber.org/goleak v1.3.0 go.uber.org/zap v1.27.0 ) diff --git a/extension/oidcauthextension/metadata.yaml b/extension/oidcauthextension/metadata.yaml index 678dd3e58790..a4720591e476 100644 --- a/extension/oidcauthextension/metadata.yaml +++ b/extension/oidcauthextension/metadata.yaml @@ -11,5 +11,3 @@ status: tests: config: skip_lifecycle: true - goleak: - skip: true From 9dbe5e07522e642a4ce3d8bc94f1a9d5f7881962 Mon Sep 17 00:00:00 2001 From: Gavin Cabbage Date: Wed, 9 Oct 2024 19:39:52 -0400 Subject: [PATCH 010/140] [receiver/awsfirehosereceiver] Add support for CloudWatch logs (#35077) **Description:** Add support for CloudWatch logs in JSON format. The receiver can now be configured to receiver either `cwmetrics` or `cwlogs` record type for CloudWatch metrics logs, respectively. The former is only valid for metrics receivers and the latter for logs receivers. Some changes were necessary to the default record type handling to conform to the contracts required by the generated tests and ensure the default config returned by the factory was usable. Previously the default record type was `cwmetrics` but this is not sensible for logs receivers. To accommodate this, the default record type is now telemetry-type-specific. That is, for metrics it is `cwmetrics` and for logs it is `cwlogs`. Each receiver makes this determination on its own. Therefore an empty string is now the default returned by the factory and an empty string is also acceptable in the users config. It is no longer required to specify a record type, although it is still supported, so this is not a breaking change. **Link to tracking Issue:** n/a **Testing:** Unit tests covering new code as well as manual smoke testing against AWS Firehose and CloudWatch themselves. **Documentation:** Component README update. --- .chloggen/awsfirehosereceiver-cwlogs.yaml | 27 ++++ receiver/awsfirehosereceiver/README.md | 23 +++- receiver/awsfirehosereceiver/config.go | 8 +- receiver/awsfirehosereceiver/config_test.go | 62 +++++---- receiver/awsfirehosereceiver/factory.go | 29 ++++- receiver/awsfirehosereceiver/factory_test.go | 14 +- .../generated_component_test.go | 7 + .../internal/metadata/generated_status.go | 1 + .../cwlog/compression/compression.go | 48 +++++++ .../internal/unmarshaler/cwlog/cwlog.go | 17 +++ .../internal/unmarshaler/cwlog/logsbuilder.go | 50 ++++++++ .../cwlog/testdata/invalid_records | 4 + .../cwlog/testdata/multiple_records | 2 + .../cwlog/testdata/multiple_resources | 6 + .../unmarshaler/cwlog/testdata/single_record | 1 + .../cwlog/testdata/some_invalid_records | 3 + .../internal/unmarshaler/cwlog/unmarshaler.go | 107 ++++++++++++++++ .../unmarshaler/cwlog/unmarshaler_test.go | 83 ++++++++++++ .../internal/unmarshaler/unmarshaler.go | 10 ++ .../unmarshalertest/nop_logs_unmarshaler.go | 47 +++++++ .../nop_logs_unmarshaler_test.go | 41 ++++++ ...arshaler.go => nop_metrics_unmarshaler.go} | 0 ...est.go => nop_metrics_unmarshaler_test.go} | 0 receiver/awsfirehosereceiver/logs_receiver.go | 87 +++++++++++++ .../awsfirehosereceiver/logs_receiver_test.go | 121 ++++++++++++++++++ receiver/awsfirehosereceiver/metadata.yaml | 2 +- .../awsfirehosereceiver/metrics_receiver.go | 9 +- receiver/awsfirehosereceiver/receiver_test.go | 8 +- .../testdata/cwlogs_config.yaml | 7 + .../{config.yaml => cwmetrics_config.yaml} | 0 .../testdata/invalid_config.yaml | 3 + 31 files changed, 784 insertions(+), 43 deletions(-) create mode 100644 .chloggen/awsfirehosereceiver-cwlogs.yaml create mode 100644 receiver/awsfirehosereceiver/internal/unmarshaler/cwlog/compression/compression.go create mode 100644 receiver/awsfirehosereceiver/internal/unmarshaler/cwlog/cwlog.go create mode 100644 receiver/awsfirehosereceiver/internal/unmarshaler/cwlog/logsbuilder.go create mode 100644 receiver/awsfirehosereceiver/internal/unmarshaler/cwlog/testdata/invalid_records create mode 100644 receiver/awsfirehosereceiver/internal/unmarshaler/cwlog/testdata/multiple_records create mode 100644 receiver/awsfirehosereceiver/internal/unmarshaler/cwlog/testdata/multiple_resources create mode 100644 receiver/awsfirehosereceiver/internal/unmarshaler/cwlog/testdata/single_record create mode 100644 receiver/awsfirehosereceiver/internal/unmarshaler/cwlog/testdata/some_invalid_records create mode 100644 receiver/awsfirehosereceiver/internal/unmarshaler/cwlog/unmarshaler.go create mode 100644 receiver/awsfirehosereceiver/internal/unmarshaler/cwlog/unmarshaler_test.go create mode 100644 receiver/awsfirehosereceiver/internal/unmarshaler/unmarshalertest/nop_logs_unmarshaler.go create mode 100644 receiver/awsfirehosereceiver/internal/unmarshaler/unmarshalertest/nop_logs_unmarshaler_test.go rename receiver/awsfirehosereceiver/internal/unmarshaler/unmarshalertest/{nop_unmarshaler.go => nop_metrics_unmarshaler.go} (100%) rename receiver/awsfirehosereceiver/internal/unmarshaler/unmarshalertest/{nop_unmarshaler_test.go => nop_metrics_unmarshaler_test.go} (100%) create mode 100644 receiver/awsfirehosereceiver/logs_receiver.go create mode 100644 receiver/awsfirehosereceiver/logs_receiver_test.go create mode 100644 receiver/awsfirehosereceiver/testdata/cwlogs_config.yaml rename receiver/awsfirehosereceiver/testdata/{config.yaml => cwmetrics_config.yaml} (100%) create mode 100644 receiver/awsfirehosereceiver/testdata/invalid_config.yaml diff --git a/.chloggen/awsfirehosereceiver-cwlogs.yaml b/.chloggen/awsfirehosereceiver-cwlogs.yaml new file mode 100644 index 000000000000..14345b8a1bc7 --- /dev/null +++ b/.chloggen/awsfirehosereceiver-cwlogs.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: enhancement + +# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver) +component: awsfirehosereceiver + +# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). +note: Add support for CloudWatch logs + +# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists. +issues: [35077] + +# (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/awsfirehosereceiver/README.md b/receiver/awsfirehosereceiver/README.md index eb4041c833d0..a8e6d242775d 100644 --- a/receiver/awsfirehosereceiver/README.md +++ b/receiver/awsfirehosereceiver/README.md @@ -3,7 +3,7 @@ | Status | | | ------------- |-----------| -| Stability | [alpha]: metrics | +| Stability | [alpha]: metrics, 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%2Fawsfirehose%20&label=open&color=orange&logo=opentelemetry)](https://github.com/open-telemetry/opentelemetry-collector-contrib/issues?q=is%3Aopen+is%3Aissue+label%3Areceiver%2Fawsfirehose) [![Closed issues](https://img.shields.io/github/issues-search/open-telemetry/opentelemetry-collector-contrib?query=is%3Aissue%20is%3Aclosed%20label%3Areceiver%2Fawsfirehose%20&label=closed&color=blue&logo=opentelemetry)](https://github.com/open-telemetry/opentelemetry-collector-contrib/issues?q=is%3Aclosed+is%3Aissue+label%3Areceiver%2Fawsfirehose) | | [Code Owners](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/CONTRIBUTING.md#becoming-a-code-owner) | [@Aneurysm9](https://www.github.com/Aneurysm9) | @@ -62,3 +62,24 @@ See [documentation](https://docs.aws.amazon.com/firehose/latest/dev/create-desti The record type for the CloudWatch metric stream. Expects the format for the records to be JSON. See [documentation](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch-Metric-Streams.html) for details. +### cwlogs +The record type for the CloudWatch log stream. Expects the format for the records to be JSON. +For example: + +```json +{ + "messageType": "DATA_MESSAGE", + "owner": "111122223333", + "logGroup": "my-log-group", + "logStream": "my-log-stream", + "subscriptionFilters": ["my-subscription-filter"], + "logEvents": [ + { + "id": "123", + "timestamp": 1725544035523, + "message": "My log message." + } + ] +} +``` + diff --git a/receiver/awsfirehosereceiver/config.go b/receiver/awsfirehosereceiver/config.go index e6de4c2e50ba..784e0af2501b 100644 --- a/receiver/awsfirehosereceiver/config.go +++ b/receiver/awsfirehosereceiver/config.go @@ -30,8 +30,10 @@ func (c *Config) Validate() error { if c.Endpoint == "" { return errors.New("must specify endpoint") } - if c.RecordType == "" { - return errors.New("must specify record type") + // If a record type is specified, it must be valid. + // An empty string is acceptable, however, because it will use a telemetry-type-specific default. + if c.RecordType != "" { + return validateRecordType(c.RecordType) } - return validateRecordType(c.RecordType) + return nil } diff --git a/receiver/awsfirehosereceiver/config_test.go b/receiver/awsfirehosereceiver/config_test.go index d7ec5c71bb04..77f5ef1fb7bb 100644 --- a/receiver/awsfirehosereceiver/config_test.go +++ b/receiver/awsfirehosereceiver/config_test.go @@ -4,6 +4,7 @@ package awsfirehosereceiver import ( + "fmt" "path/filepath" "testing" @@ -18,29 +19,40 @@ import ( ) func TestLoadConfig(t *testing.T) { - cm, err := confmaptest.LoadConf(filepath.Join("testdata", "config.yaml")) - require.NoError(t, err) - - factory := NewFactory() - cfg := factory.CreateDefaultConfig() - - sub, err := cm.Sub(component.NewIDWithName(metadata.Type, "").String()) - require.NoError(t, err) - require.NoError(t, sub.Unmarshal(cfg)) - - assert.NoError(t, component.ValidateConfig(cfg)) - - require.Equal(t, &Config{ - RecordType: "cwmetrics", - AccessKey: "some_access_key", - ServerConfig: confighttp.ServerConfig{ - Endpoint: "0.0.0.0:4433", - TLSSetting: &configtls.ServerConfig{ - Config: configtls.Config{ - CertFile: "server.crt", - KeyFile: "server.key", - }, - }, - }, - }, cfg) + for _, configType := range []string{ + "cwmetrics", "cwlogs", "invalid", + } { + t.Run(configType, func(t *testing.T) { + fileName := fmt.Sprintf("%s_config.yaml", configType) + cm, err := confmaptest.LoadConf(filepath.Join("testdata", fileName)) + require.NoError(t, err) + + factory := NewFactory() + cfg := factory.CreateDefaultConfig() + + sub, err := cm.Sub(component.NewIDWithName(metadata.Type, "").String()) + require.NoError(t, err) + require.NoError(t, sub.Unmarshal(cfg)) + + err = component.ValidateConfig(cfg) + if configType == "invalid" { + assert.Error(t, err) + } else { + assert.NoError(t, err) + require.Equal(t, &Config{ + RecordType: configType, + AccessKey: "some_access_key", + ServerConfig: confighttp.ServerConfig{ + Endpoint: "0.0.0.0:4433", + TLSSetting: &configtls.ServerConfig{ + Config: configtls.Config{ + CertFile: "server.crt", + KeyFile: "server.key", + }, + }, + }, + }, cfg) + } + }) + } } diff --git a/receiver/awsfirehosereceiver/factory.go b/receiver/awsfirehosereceiver/factory.go index 2e7a8d558027..7ba2149539c2 100644 --- a/receiver/awsfirehosereceiver/factory.go +++ b/receiver/awsfirehosereceiver/factory.go @@ -16,19 +16,20 @@ import ( "github.com/open-telemetry/opentelemetry-collector-contrib/internal/common/testutil" "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/awsfirehosereceiver/internal/metadata" "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/awsfirehosereceiver/internal/unmarshaler" + "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/awsfirehosereceiver/internal/unmarshaler/cwlog" "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/awsfirehosereceiver/internal/unmarshaler/cwmetricstream" ) const ( - defaultRecordType = cwmetricstream.TypeStr - defaultEndpoint = "0.0.0.0:4433" - defaultPort = 4433 + defaultEndpoint = "0.0.0.0:4433" + defaultPort = 4433 ) var ( errUnrecognizedRecordType = errors.New("unrecognized record type") availableRecordTypes = map[string]bool{ cwmetricstream.TypeStr: true, + cwlog.TypeStr: true, } ) @@ -38,7 +39,8 @@ func NewFactory() receiver.Factory { return receiver.NewFactory( metadata.Type, createDefaultConfig, - receiver.WithMetrics(createMetricsReceiver, metadata.MetricsStability)) + receiver.WithMetrics(createMetricsReceiver, metadata.MetricsStability), + receiver.WithLogs(createLogsReceiver, metadata.LogsStability)) } // validateRecordType checks the available record types for the @@ -59,11 +61,18 @@ func defaultMetricsUnmarshalers(logger *zap.Logger) map[string]unmarshaler.Metri } } +// defaultLogsUnmarshalers creates a map of the available logs unmarshalers. +func defaultLogsUnmarshalers(logger *zap.Logger) map[string]unmarshaler.LogsUnmarshaler { + u := cwlog.NewUnmarshaler(logger) + return map[string]unmarshaler.LogsUnmarshaler{ + u.Type(): u, + } +} + // createDefaultConfig creates a default config with the endpoint set // to port 8443 and the record type set to the CloudWatch metric stream. func createDefaultConfig() component.Config { return &Config{ - RecordType: defaultRecordType, ServerConfig: confighttp.ServerConfig{ Endpoint: testutil.EndpointForPort(defaultPort), }, @@ -79,3 +88,13 @@ func createMetricsReceiver( ) (receiver.Metrics, error) { return newMetricsReceiver(cfg.(*Config), set, defaultMetricsUnmarshalers(set.Logger), nextConsumer) } + +// createMetricsReceiver implements the CreateMetricsReceiver function type. +func createLogsReceiver( + _ context.Context, + set receiver.Settings, + cfg component.Config, + nextConsumer consumer.Logs, +) (receiver.Logs, error) { + return newLogsReceiver(cfg.(*Config), set, defaultLogsUnmarshalers(set.Logger), nextConsumer) +} diff --git a/receiver/awsfirehosereceiver/factory_test.go b/receiver/awsfirehosereceiver/factory_test.go index ce3433e6993b..4beca7a7eeec 100644 --- a/receiver/awsfirehosereceiver/factory_test.go +++ b/receiver/awsfirehosereceiver/factory_test.go @@ -29,7 +29,19 @@ func TestCreateMetrics(t *testing.T) { require.NotNil(t, r) } +func TestCreateLogsReceiver(t *testing.T) { + r, err := createLogsReceiver( + context.Background(), + receivertest.NewNopSettings(), + createDefaultConfig(), + consumertest.NewNop(), + ) + require.NoError(t, err) + require.NotNil(t, r) +} + func TestValidateRecordType(t *testing.T) { - require.NoError(t, validateRecordType(defaultRecordType)) + require.NoError(t, validateRecordType(defaultMetricsRecordType)) + require.NoError(t, validateRecordType(defaultLogsRecordType)) require.Error(t, validateRecordType("nop")) } diff --git a/receiver/awsfirehosereceiver/generated_component_test.go b/receiver/awsfirehosereceiver/generated_component_test.go index b9c335cf74f4..54a22c25a689 100644 --- a/receiver/awsfirehosereceiver/generated_component_test.go +++ b/receiver/awsfirehosereceiver/generated_component_test.go @@ -31,6 +31,13 @@ func TestComponentLifecycle(t *testing.T) { createFn func(ctx context.Context, set receiver.Settings, cfg component.Config) (component.Component, error) }{ + { + name: "logs", + createFn: func(ctx context.Context, set receiver.Settings, cfg component.Config) (component.Component, error) { + return factory.CreateLogsReceiver(ctx, set, cfg, consumertest.NewNop()) + }, + }, + { name: "metrics", createFn: func(ctx context.Context, set receiver.Settings, cfg component.Config) (component.Component, error) { diff --git a/receiver/awsfirehosereceiver/internal/metadata/generated_status.go b/receiver/awsfirehosereceiver/internal/metadata/generated_status.go index 97a9e06c34f5..447dc3186c20 100644 --- a/receiver/awsfirehosereceiver/internal/metadata/generated_status.go +++ b/receiver/awsfirehosereceiver/internal/metadata/generated_status.go @@ -13,4 +13,5 @@ var ( const ( MetricsStability = component.StabilityLevelAlpha + LogsStability = component.StabilityLevelAlpha ) diff --git a/receiver/awsfirehosereceiver/internal/unmarshaler/cwlog/compression/compression.go b/receiver/awsfirehosereceiver/internal/unmarshaler/cwlog/compression/compression.go new file mode 100644 index 000000000000..2ebca77861dd --- /dev/null +++ b/receiver/awsfirehosereceiver/internal/unmarshaler/cwlog/compression/compression.go @@ -0,0 +1,48 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package compression // import "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/awsfirehosereceiver/internal/unmarshaler/cwlog/compression" + +import ( + "bytes" + "compress/gzip" +) + +// Zip returns a gzip-compressed representation of the input bytes. +func Zip(data []byte) ([]byte, error) { + var b bytes.Buffer + w := gzip.NewWriter(&b) + + _, err := w.Write(data) + if err != nil { + return nil, err + } + + if err = w.Flush(); err != nil { + return nil, err + } + + if err = w.Close(); err != nil { + return nil, err + } + + return b.Bytes(), nil +} + +// Unzip expects gzip-compressed input bytes and returns their uncompressed form. +func Unzip(data []byte) ([]byte, error) { + b := bytes.NewBuffer(data) + + r, err := gzip.NewReader(b) + if err != nil { + return nil, err + } + + var rv bytes.Buffer + _, err = rv.ReadFrom(r) + if err != nil { + return nil, err + } + + return rv.Bytes(), nil +} diff --git a/receiver/awsfirehosereceiver/internal/unmarshaler/cwlog/cwlog.go b/receiver/awsfirehosereceiver/internal/unmarshaler/cwlog/cwlog.go new file mode 100644 index 000000000000..1ab85509873a --- /dev/null +++ b/receiver/awsfirehosereceiver/internal/unmarshaler/cwlog/cwlog.go @@ -0,0 +1,17 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package cwlog // import "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/awsfirehosereceiver/internal/unmarshaler/cwlog" + +type cWLog struct { + MessageType string `json:"messageType"` + Owner string `json:"owner"` + LogGroup string `json:"logGroup"` + LogStream string `json:"logStream"` + SubscriptionFilters []string `json:"subscriptionFilters"` + LogEvents []struct { + ID string `json:"id"` + Timestamp int64 `json:"timestamp"` + Message string `json:"message"` + } `json:"logEvents"` +} diff --git a/receiver/awsfirehosereceiver/internal/unmarshaler/cwlog/logsbuilder.go b/receiver/awsfirehosereceiver/internal/unmarshaler/cwlog/logsbuilder.go new file mode 100644 index 000000000000..eae5902b5ea1 --- /dev/null +++ b/receiver/awsfirehosereceiver/internal/unmarshaler/cwlog/logsbuilder.go @@ -0,0 +1,50 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package cwlog // import "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/awsfirehosereceiver/internal/unmarshaler/cwlog" + +import ( + "go.opentelemetry.io/collector/pdata/pcommon" + "go.opentelemetry.io/collector/pdata/plog" + conventions "go.opentelemetry.io/collector/semconv/v1.6.1" +) + +const ( + attributeAWSCloudWatchLogGroupName = "aws.cloudwatch.log_group_name" + attributeAWSCloudWatchLogStreamName = "aws.cloudwatch.log_stream_name" +) + +// resourceAttributes are the CloudWatch log attributes that define a unique resource. +type resourceAttributes struct { + owner, logGroup, logStream string +} + +// resourceLogsBuilder provides convenient access to the a Resource's LogRecordSlice. +type resourceLogsBuilder struct { + rls plog.LogRecordSlice +} + +// setAttributes applies the resourceAttributes to the provided Resource. +func (ra *resourceAttributes) setAttributes(resource pcommon.Resource) { + attrs := resource.Attributes() + attrs.PutStr(conventions.AttributeCloudAccountID, ra.owner) + attrs.PutStr(attributeAWSCloudWatchLogGroupName, ra.logGroup) + attrs.PutStr(attributeAWSCloudWatchLogStreamName, ra.logStream) +} + +// newResourceLogsBuilder to capture logs for the Resource defined by the provided attributes. +func newResourceLogsBuilder(logs plog.Logs, attrs resourceAttributes) *resourceLogsBuilder { + rls := logs.ResourceLogs().AppendEmpty() + attrs.setAttributes(rls.Resource()) + return &resourceLogsBuilder{rls.ScopeLogs().AppendEmpty().LogRecords()} +} + +// AddLog events to the LogRecordSlice. Resource attributes are captured when creating +// the resourceLogsBuilder, so we only need to consider the LogEvents themselves. +func (rlb *resourceLogsBuilder) AddLog(log cWLog) { + for _, event := range log.LogEvents { + logLine := rlb.rls.AppendEmpty() + logLine.SetTimestamp(pcommon.Timestamp(event.Timestamp)) + logLine.Body().SetStr(event.Message) + } +} diff --git a/receiver/awsfirehosereceiver/internal/unmarshaler/cwlog/testdata/invalid_records b/receiver/awsfirehosereceiver/internal/unmarshaler/cwlog/testdata/invalid_records new file mode 100644 index 000000000000..d2672dbd26d3 --- /dev/null +++ b/receiver/awsfirehosereceiver/internal/unmarshaler/cwlog/testdata/invalid_records @@ -0,0 +1,4 @@ +{"CHANGE":-0.09,"PRICE":4.96,"TICKER_SYMBOL":"KIN","SECTOR":"ENERGY"} +{"CHANGE":-1.47,"PRICE":134.74,"TICKER_SYMBOL":"DFG","SECTOR":"TECHNOLOGY"} +{"CHANGE":1.96,"PRICE":57.53,"TICKER_SYMBOL":"SAC","SECTOR":"ENERGY"} +{"CHANGE":0.04,"PRICE":32.84,"TICKER_SYMBOL":"PJN","SECTOR":"RETAIL"} \ No newline at end of file diff --git a/receiver/awsfirehosereceiver/internal/unmarshaler/cwlog/testdata/multiple_records b/receiver/awsfirehosereceiver/internal/unmarshaler/cwlog/testdata/multiple_records new file mode 100644 index 000000000000..18a1888d99a8 --- /dev/null +++ b/receiver/awsfirehosereceiver/internal/unmarshaler/cwlog/testdata/multiple_records @@ -0,0 +1,2 @@ +{"messageType":"DATA_MESSAGE","owner":"123","logGroup":"test","logStream":"test","subscriptionFilters":["test"],"logEvents":[{"id":"38480917865042697267627490045603633139480491071049695232","timestamp":1725544035523,"message":"Hello world, here is our first log message!"}]} +{"messageType":"DATA_MESSAGE","owner":"123","logGroup":"test","logStream":"test","subscriptionFilters":["test"],"logEvents":[{"id":"38480917865042697267627490045603633139480491071049695233","timestamp":1725554035523,"message":"Hello world, here is our second log message!"}]} \ No newline at end of file diff --git a/receiver/awsfirehosereceiver/internal/unmarshaler/cwlog/testdata/multiple_resources b/receiver/awsfirehosereceiver/internal/unmarshaler/cwlog/testdata/multiple_resources new file mode 100644 index 000000000000..0115614f1b9b --- /dev/null +++ b/receiver/awsfirehosereceiver/internal/unmarshaler/cwlog/testdata/multiple_resources @@ -0,0 +1,6 @@ +{"messageType":"DATA_MESSAGE","owner":"123","logGroup":"test","logStream":"test","subscriptionFilters":["test"],"logEvents":[{"id":"38480917865042697267627490045603633139480491071049695232","timestamp":1725544035523,"message":"Hello world, here is our first log message!"}]} +{"messageType":"DATA_MESSAGE","owner":"123","logGroup":"test","logStream":"test","subscriptionFilters":["test"],"logEvents":[{"id":"38480917865042697267627490045603633139480491071049695233","timestamp":1725554035523,"message":"Hello world, here is our second log message!"}]} +{"messageType":"DATA_MESSAGE","owner":"123","logGroup":"test2","logStream":"test1","subscriptionFilters":["test"],"logEvents":[{"id":"38480917865042697267627490045603633139480491071049695234","timestamp":1725564035523,"message":"Hello world, here is our third log message!"}]} +{"messageType":"DATA_MESSAGE","owner":"123","logGroup":"test2","logStream":"test2","subscriptionFilters":["test"],"logEvents":[{"id":"38480917865042697267627490045603633139480491071049695235","timestamp":1725574035523,"message":"Hello world, here is our fourth log message!"}]} +{"messageType":"DATA_MESSAGE","owner":"123","logGroup":"test2","logStream":"test1","subscriptionFilters":["test"],"logEvents":[{"id":"38480917865042697267627490045603633139480491071049695236","timestamp":1725584035523,"message":"Hello world, here is our fifth log message!"}]} +{"messageType":"DATA_MESSAGE","owner":"123","logGroup":"test2","logStream":"test2","subscriptionFilters":["test"],"logEvents":[{"id":"38480917865042697267627490045603633139480491071049695237","timestamp":1725594035523,"message":"Hello world, here is our sixth log message!"}]} \ No newline at end of file diff --git a/receiver/awsfirehosereceiver/internal/unmarshaler/cwlog/testdata/single_record b/receiver/awsfirehosereceiver/internal/unmarshaler/cwlog/testdata/single_record new file mode 100644 index 000000000000..b35e166e47da --- /dev/null +++ b/receiver/awsfirehosereceiver/internal/unmarshaler/cwlog/testdata/single_record @@ -0,0 +1 @@ +{"messageType":"DATA_MESSAGE","owner":"123","logGroup":"test","logStream":"test","subscriptionFilters":["test"],"logEvents":[{"id":"38480917865042697267627490045603633139480491071049695232","timestamp":1725544035523,"message":"Hello world, here is our first log message!"}]} diff --git a/receiver/awsfirehosereceiver/internal/unmarshaler/cwlog/testdata/some_invalid_records b/receiver/awsfirehosereceiver/internal/unmarshaler/cwlog/testdata/some_invalid_records new file mode 100644 index 000000000000..4026ad877a43 --- /dev/null +++ b/receiver/awsfirehosereceiver/internal/unmarshaler/cwlog/testdata/some_invalid_records @@ -0,0 +1,3 @@ +{"messageType":"DATA_MESSAGE","owner":"123","logGroup":"test","logStream":"test","subscriptionFilters":["test"],"logEvents":[{"id":"38480917865042697267627490045603633139480491071049695232","timestamp":1725544035523,"message":"Hello world, here is our first log message!"}]} +{"CHANGE":1.96,"PRICE":57.53,"TICKER_SYMBOL":"SAC","SECTOR":"ENERGY"} +{"messageType":"DATA_MESSAGE","owner":"123","logGroup":"test","logStream":"test","subscriptionFilters":["test"],"logEvents":[{"id":"38480917865042697267627490045603633139480491071049695233","timestamp":1725554035523,"message":"Hello world, here is our second log message!"}]} \ No newline at end of file diff --git a/receiver/awsfirehosereceiver/internal/unmarshaler/cwlog/unmarshaler.go b/receiver/awsfirehosereceiver/internal/unmarshaler/cwlog/unmarshaler.go new file mode 100644 index 000000000000..43b5568e7854 --- /dev/null +++ b/receiver/awsfirehosereceiver/internal/unmarshaler/cwlog/unmarshaler.go @@ -0,0 +1,107 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package cwlog // import "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/awsfirehosereceiver/internal/unmarshaler/cwlog" + +import ( + "bytes" + "encoding/json" + "errors" + + "go.opentelemetry.io/collector/pdata/plog" + "go.uber.org/zap" + + "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/awsfirehosereceiver/internal/unmarshaler" + "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/awsfirehosereceiver/internal/unmarshaler/cwlog/compression" +) + +const ( + TypeStr = "cwlogs" + recordDelimiter = "\n" +) + +var ( + errInvalidRecords = errors.New("record format invalid") +) + +// Unmarshaler for the CloudWatch Log JSON record format. +type Unmarshaler struct { + logger *zap.Logger +} + +var _ unmarshaler.LogsUnmarshaler = (*Unmarshaler)(nil) + +// NewUnmarshaler creates a new instance of the Unmarshaler. +func NewUnmarshaler(logger *zap.Logger) *Unmarshaler { + return &Unmarshaler{logger} +} + +// Unmarshal deserializes the records into cWLogs and uses the +// resourceLogsBuilder to group them into a single plog.Logs. +// Skips invalid cWLogs received in the record and +func (u Unmarshaler) Unmarshal(records [][]byte) (plog.Logs, error) { + md := plog.NewLogs() + builders := make(map[resourceAttributes]*resourceLogsBuilder) + for recordIndex, compressedRecord := range records { + record, err := compression.Unzip(compressedRecord) + if err != nil { + u.logger.Error("Failed to unzip record", + zap.Error(err), + zap.Int("record_index", recordIndex), + ) + continue + } + // Multiple logs in each record separated by newline character + for datumIndex, datum := range bytes.Split(record, []byte(recordDelimiter)) { + if len(datum) > 0 { + var log cWLog + err := json.Unmarshal(datum, &log) + if err != nil { + u.logger.Error( + "Unable to unmarshal input", + zap.Error(err), + zap.Int("datum_index", datumIndex), + zap.Int("record_index", recordIndex), + ) + continue + } + if !u.isValid(log) { + u.logger.Error( + "Invalid log", + zap.Int("datum_index", datumIndex), + zap.Int("record_index", recordIndex), + ) + continue + } + attrs := resourceAttributes{ + owner: log.Owner, + logGroup: log.LogGroup, + logStream: log.LogStream, + } + lb, ok := builders[attrs] + if !ok { + lb = newResourceLogsBuilder(md, attrs) + builders[attrs] = lb + } + lb.AddLog(log) + + } + } + } + + if len(builders) == 0 { + return plog.NewLogs(), errInvalidRecords + } + + return md, nil +} + +// isValid validates that the cWLog has been unmarshalled correctly. +func (u Unmarshaler) isValid(log cWLog) bool { + return log.Owner != "" && log.LogGroup != "" && log.LogStream != "" +} + +// Type of the serialized messages. +func (u Unmarshaler) Type() string { + return TypeStr +} diff --git a/receiver/awsfirehosereceiver/internal/unmarshaler/cwlog/unmarshaler_test.go b/receiver/awsfirehosereceiver/internal/unmarshaler/cwlog/unmarshaler_test.go new file mode 100644 index 000000000000..fbd683939aa5 --- /dev/null +++ b/receiver/awsfirehosereceiver/internal/unmarshaler/cwlog/unmarshaler_test.go @@ -0,0 +1,83 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package cwlog + +import ( + "os" + "path/filepath" + "testing" + + "github.com/stretchr/testify/require" + "go.uber.org/zap" + + "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/awsfirehosereceiver/internal/unmarshaler/cwlog/compression" +) + +func TestType(t *testing.T) { + unmarshaler := NewUnmarshaler(zap.NewNop()) + require.Equal(t, TypeStr, unmarshaler.Type()) +} + +func TestUnmarshal(t *testing.T) { + unmarshaler := NewUnmarshaler(zap.NewNop()) + testCases := map[string]struct { + filename string + wantResourceCount int + wantLogCount int + wantErr error + }{ + "WithMultipleRecords": { + filename: "multiple_records", + wantResourceCount: 1, + wantLogCount: 2, + }, + "WithSingleRecord": { + filename: "single_record", + wantResourceCount: 1, + wantLogCount: 1, + }, + "WithInvalidRecords": { + filename: "invalid_records", + wantErr: errInvalidRecords, + }, + "WithSomeInvalidRecords": { + filename: "some_invalid_records", + wantResourceCount: 1, + wantLogCount: 2, + }, + "WithMultipleResources": { + filename: "multiple_resources", + wantResourceCount: 3, + wantLogCount: 6, + }, + } + for name, testCase := range testCases { + t.Run(name, func(t *testing.T) { + record, err := os.ReadFile(filepath.Join(".", "testdata", testCase.filename)) + require.NoError(t, err) + + compressedRecord, err := compression.Zip(record) + require.NoError(t, err) + records := [][]byte{compressedRecord} + + got, err := unmarshaler.Unmarshal(records) + if testCase.wantErr != nil { + require.Error(t, err) + require.Equal(t, testCase.wantErr, err) + } else { + require.NoError(t, err) + require.NotNil(t, got) + require.Equal(t, testCase.wantResourceCount, got.ResourceLogs().Len()) + gotLogCount := 0 + for i := 0; i < got.ResourceLogs().Len(); i++ { + rm := got.ResourceLogs().At(i) + require.Equal(t, 1, rm.ScopeLogs().Len()) + ilm := rm.ScopeLogs().At(0) + gotLogCount += ilm.LogRecords().Len() + } + require.Equal(t, testCase.wantLogCount, gotLogCount) + } + }) + } +} diff --git a/receiver/awsfirehosereceiver/internal/unmarshaler/unmarshaler.go b/receiver/awsfirehosereceiver/internal/unmarshaler/unmarshaler.go index 8a61bb1934a5..0ffb4b0a80e8 100644 --- a/receiver/awsfirehosereceiver/internal/unmarshaler/unmarshaler.go +++ b/receiver/awsfirehosereceiver/internal/unmarshaler/unmarshaler.go @@ -4,6 +4,7 @@ package unmarshaler // import "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/awsfirehosereceiver/internal/unmarshaler" import ( + "go.opentelemetry.io/collector/pdata/plog" "go.opentelemetry.io/collector/pdata/pmetric" ) @@ -15,3 +16,12 @@ type MetricsUnmarshaler interface { // Type of the serialized messages. Type() string } + +// LogsUnmarshaler deserializes the message body +type LogsUnmarshaler interface { + // Unmarshal deserializes the records into logs. + Unmarshal(records [][]byte) (plog.Logs, error) + + // Type of the serialized messages. + Type() string +} diff --git a/receiver/awsfirehosereceiver/internal/unmarshaler/unmarshalertest/nop_logs_unmarshaler.go b/receiver/awsfirehosereceiver/internal/unmarshaler/unmarshalertest/nop_logs_unmarshaler.go new file mode 100644 index 000000000000..79f29caecfdb --- /dev/null +++ b/receiver/awsfirehosereceiver/internal/unmarshaler/unmarshalertest/nop_logs_unmarshaler.go @@ -0,0 +1,47 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package unmarshalertest // import "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/awsfirehosereceiver/internal/unmarshaler/unmarshalertest" + +import ( + "go.opentelemetry.io/collector/pdata/plog" + + "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/awsfirehosereceiver/internal/unmarshaler" +) + +// NopLogsUnmarshaler is a LogsUnmarshaler that doesn't do anything +// with the inputs and just returns the logs and error passed in. +type NopLogsUnmarshaler struct { + logs plog.Logs + err error +} + +var _ unmarshaler.LogsUnmarshaler = (*NopLogsUnmarshaler)(nil) + +// NewNopLogs provides a nop logs unmarshaler with the default +// plog.Logs and no error. +func NewNopLogs() *NopLogsUnmarshaler { + return &NopLogsUnmarshaler{} +} + +// NewWithLogs provides a nop logs unmarshaler with the passed +// in logs as the result of the Unmarshal and no error. +func NewWithLogs(logs plog.Logs) *NopLogsUnmarshaler { + return &NopLogsUnmarshaler{logs: logs} +} + +// NewErrLogs provides a nop logs unmarshaler with the passed +// in error as the Unmarshal error. +func NewErrLogs(err error) *NopLogsUnmarshaler { + return &NopLogsUnmarshaler{err: err} +} + +// Unmarshal deserializes the records into logs. +func (u *NopLogsUnmarshaler) Unmarshal([][]byte) (plog.Logs, error) { + return u.logs, u.err +} + +// Type of the serialized messages. +func (u *NopLogsUnmarshaler) Type() string { + return typeStr +} diff --git a/receiver/awsfirehosereceiver/internal/unmarshaler/unmarshalertest/nop_logs_unmarshaler_test.go b/receiver/awsfirehosereceiver/internal/unmarshaler/unmarshalertest/nop_logs_unmarshaler_test.go new file mode 100644 index 000000000000..69be0c74f224 --- /dev/null +++ b/receiver/awsfirehosereceiver/internal/unmarshaler/unmarshalertest/nop_logs_unmarshaler_test.go @@ -0,0 +1,41 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package unmarshalertest + +import ( + "fmt" + "testing" + + "github.com/stretchr/testify/require" + "go.opentelemetry.io/collector/pdata/plog" +) + +func TestNewNopLogs(t *testing.T) { + unmarshaler := NewNopLogs() + got, err := unmarshaler.Unmarshal(nil) + require.NoError(t, err) + require.NotNil(t, got) + require.Equal(t, typeStr, unmarshaler.Type()) +} + +func TestNewWithLogs(t *testing.T) { + logs := plog.NewLogs() + logs.ResourceLogs().AppendEmpty() + unmarshaler := NewWithLogs(logs) + got, err := unmarshaler.Unmarshal(nil) + require.NoError(t, err) + require.NotNil(t, got) + require.Equal(t, logs, got) + require.Equal(t, typeStr, unmarshaler.Type()) +} + +func TestNewErrLogs(t *testing.T) { + wantErr := fmt.Errorf("test error") + unmarshaler := NewErrLogs(wantErr) + got, err := unmarshaler.Unmarshal(nil) + require.Error(t, err) + require.Equal(t, wantErr, err) + require.NotNil(t, got) + require.Equal(t, typeStr, unmarshaler.Type()) +} diff --git a/receiver/awsfirehosereceiver/internal/unmarshaler/unmarshalertest/nop_unmarshaler.go b/receiver/awsfirehosereceiver/internal/unmarshaler/unmarshalertest/nop_metrics_unmarshaler.go similarity index 100% rename from receiver/awsfirehosereceiver/internal/unmarshaler/unmarshalertest/nop_unmarshaler.go rename to receiver/awsfirehosereceiver/internal/unmarshaler/unmarshalertest/nop_metrics_unmarshaler.go diff --git a/receiver/awsfirehosereceiver/internal/unmarshaler/unmarshalertest/nop_unmarshaler_test.go b/receiver/awsfirehosereceiver/internal/unmarshaler/unmarshalertest/nop_metrics_unmarshaler_test.go similarity index 100% rename from receiver/awsfirehosereceiver/internal/unmarshaler/unmarshalertest/nop_unmarshaler_test.go rename to receiver/awsfirehosereceiver/internal/unmarshaler/unmarshalertest/nop_metrics_unmarshaler_test.go diff --git a/receiver/awsfirehosereceiver/logs_receiver.go b/receiver/awsfirehosereceiver/logs_receiver.go new file mode 100644 index 000000000000..a7b8c0628525 --- /dev/null +++ b/receiver/awsfirehosereceiver/logs_receiver.go @@ -0,0 +1,87 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package awsfirehosereceiver // import "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/awsfirehosereceiver" + +import ( + "context" + "net/http" + + "go.opentelemetry.io/collector/consumer" + "go.opentelemetry.io/collector/receiver" + + "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/awsfirehosereceiver/internal/unmarshaler" + "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/awsfirehosereceiver/internal/unmarshaler/cwlog" +) + +const defaultLogsRecordType = cwlog.TypeStr + +// logsConsumer implements the firehoseConsumer +// to use a logs consumer and unmarshaler. +type logsConsumer struct { + // consumer passes the translated logs on to the + // next consumer. + consumer consumer.Logs + // unmarshaler is the configured LogsUnmarshaler + // to use when processing the records. + unmarshaler unmarshaler.LogsUnmarshaler +} + +var _ firehoseConsumer = (*logsConsumer)(nil) + +// newLogsReceiver creates a new instance of the receiver +// with a logsConsumer. +func newLogsReceiver( + config *Config, + set receiver.Settings, + unmarshalers map[string]unmarshaler.LogsUnmarshaler, + nextConsumer consumer.Logs, +) (receiver.Logs, error) { + + recordType := config.RecordType + if recordType == "" { + recordType = defaultLogsRecordType + } + configuredUnmarshaler := unmarshalers[recordType] + if configuredUnmarshaler == nil { + return nil, errUnrecognizedRecordType + } + + mc := &logsConsumer{ + consumer: nextConsumer, + unmarshaler: configuredUnmarshaler, + } + + return &firehoseReceiver{ + settings: set, + config: config, + consumer: mc, + }, nil +} + +// Consume uses the configured unmarshaler to deserialize the records into a +// single plog.Logs. It will send the final result +// to the next consumer. +func (mc *logsConsumer) Consume(ctx context.Context, records [][]byte, commonAttributes map[string]string) (int, error) { + md, err := mc.unmarshaler.Unmarshal(records) + if err != nil { + return http.StatusBadRequest, err + } + + if commonAttributes != nil { + for i := 0; i < md.ResourceLogs().Len(); i++ { + rm := md.ResourceLogs().At(i) + for k, v := range commonAttributes { + if _, found := rm.Resource().Attributes().Get(k); !found { + rm.Resource().Attributes().PutStr(k, v) + } + } + } + } + + err = mc.consumer.ConsumeLogs(ctx, md) + if err != nil { + return http.StatusInternalServerError, err + } + return http.StatusOK, nil +} diff --git a/receiver/awsfirehosereceiver/logs_receiver_test.go b/receiver/awsfirehosereceiver/logs_receiver_test.go new file mode 100644 index 000000000000..da448640ddb4 --- /dev/null +++ b/receiver/awsfirehosereceiver/logs_receiver_test.go @@ -0,0 +1,121 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package awsfirehosereceiver + +import ( + "context" + "errors" + "net/http" + "testing" + + "github.com/stretchr/testify/require" + "go.opentelemetry.io/collector/consumer" + "go.opentelemetry.io/collector/consumer/consumertest" + "go.opentelemetry.io/collector/pdata/plog" + "go.opentelemetry.io/collector/receiver/receivertest" + "go.uber.org/zap" + + "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/awsfirehosereceiver/internal/unmarshaler/unmarshalertest" +) + +type logsRecordConsumer struct { + result plog.Logs +} + +var _ consumer.Logs = (*logsRecordConsumer)(nil) + +func (rc *logsRecordConsumer) ConsumeLogs(_ context.Context, logs plog.Logs) error { + rc.result = logs + return nil +} + +func (rc *logsRecordConsumer) Capabilities() consumer.Capabilities { + return consumer.Capabilities{MutatesData: false} +} + +func TestNewLogsReceiver(t *testing.T) { + testCases := map[string]struct { + consumer consumer.Logs + recordType string + wantErr error + }{ + "WithInvalidRecordType": { + consumer: consumertest.NewNop(), + recordType: "test", + wantErr: errUnrecognizedRecordType, + }, + } + for name, testCase := range testCases { + t.Run(name, func(t *testing.T) { + cfg := createDefaultConfig().(*Config) + cfg.RecordType = testCase.recordType + got, err := newLogsReceiver( + cfg, + receivertest.NewNopSettings(), + defaultLogsUnmarshalers(zap.NewNop()), + testCase.consumer, + ) + require.Equal(t, testCase.wantErr, err) + if testCase.wantErr == nil { + require.NotNil(t, got) + } else { + require.Nil(t, got) + } + }) + } +} + +func TestLogsConsumer(t *testing.T) { + testErr := errors.New("test error") + testCases := map[string]struct { + unmarshalerErr error + consumerErr error + wantStatus int + wantErr error + }{ + "WithUnmarshalerError": { + unmarshalerErr: testErr, + wantStatus: http.StatusBadRequest, + wantErr: testErr, + }, + "WithConsumerError": { + consumerErr: testErr, + wantStatus: http.StatusInternalServerError, + wantErr: testErr, + }, + "WithNoError": { + wantStatus: http.StatusOK, + }, + } + for name, testCase := range testCases { + t.Run(name, func(t *testing.T) { + mc := &logsConsumer{ + unmarshaler: unmarshalertest.NewErrLogs(testCase.unmarshalerErr), + consumer: consumertest.NewErr(testCase.consumerErr), + } + gotStatus, gotErr := mc.Consume(context.TODO(), nil, nil) + require.Equal(t, testCase.wantStatus, gotStatus) + require.Equal(t, testCase.wantErr, gotErr) + }) + } + + t.Run("WithCommonAttributes", func(t *testing.T) { + base := plog.NewLogs() + base.ResourceLogs().AppendEmpty() + rc := logsRecordConsumer{} + mc := &logsConsumer{ + unmarshaler: unmarshalertest.NewWithLogs(base), + consumer: &rc, + } + gotStatus, gotErr := mc.Consume(context.TODO(), nil, map[string]string{ + "CommonAttributes": "Test", + }) + require.Equal(t, http.StatusOK, gotStatus) + require.NoError(t, gotErr) + gotRms := rc.result.ResourceLogs() + require.Equal(t, 1, gotRms.Len()) + gotRm := gotRms.At(0) + require.Equal(t, 1, gotRm.Resource().Attributes().Len()) + }) +} diff --git a/receiver/awsfirehosereceiver/metadata.yaml b/receiver/awsfirehosereceiver/metadata.yaml index 46944e8af8f4..b712ca7e25fd 100644 --- a/receiver/awsfirehosereceiver/metadata.yaml +++ b/receiver/awsfirehosereceiver/metadata.yaml @@ -3,7 +3,7 @@ type: awsfirehose status: class: receiver stability: - alpha: [metrics] + alpha: [metrics, logs] distributions: [contrib] codeowners: active: [Aneurysm9] diff --git a/receiver/awsfirehosereceiver/metrics_receiver.go b/receiver/awsfirehosereceiver/metrics_receiver.go index 86626b803dcf..db24595ccc48 100644 --- a/receiver/awsfirehosereceiver/metrics_receiver.go +++ b/receiver/awsfirehosereceiver/metrics_receiver.go @@ -11,8 +11,11 @@ import ( "go.opentelemetry.io/collector/receiver" "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/awsfirehosereceiver/internal/unmarshaler" + "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/awsfirehosereceiver/internal/unmarshaler/cwmetricstream" ) +const defaultMetricsRecordType = cwmetricstream.TypeStr + // The metricsConsumer implements the firehoseConsumer // to use a metrics consumer and unmarshaler. type metricsConsumer struct { @@ -35,7 +38,11 @@ func newMetricsReceiver( nextConsumer consumer.Metrics, ) (receiver.Metrics, error) { - configuredUnmarshaler := unmarshalers[config.RecordType] + recordType := config.RecordType + if recordType == "" { + recordType = defaultMetricsRecordType + } + configuredUnmarshaler := unmarshalers[recordType] if configuredUnmarshaler == nil { return nil, errUnrecognizedRecordType } diff --git a/receiver/awsfirehosereceiver/receiver_test.go b/receiver/awsfirehosereceiver/receiver_test.go index 1ef5bdf4d354..80f4244ffbe3 100644 --- a/receiver/awsfirehosereceiver/receiver_test.go +++ b/receiver/awsfirehosereceiver/receiver_test.go @@ -57,9 +57,7 @@ func TestStart(t *testing.T) { } for name, testCase := range testCases { t.Run(name, func(t *testing.T) { - cfg := &Config{ - RecordType: defaultRecordType, - } + cfg := &Config{} ctx := context.TODO() r := testFirehoseReceiver(cfg, nil) got := r.Start(ctx, testCase.host) @@ -76,7 +74,6 @@ func TestStart(t *testing.T) { require.NoError(t, listener.Close()) }) cfg := &Config{ - RecordType: defaultRecordType, ServerConfig: confighttp.ServerConfig{ Endpoint: listener.Addr().String(), }, @@ -95,8 +92,7 @@ func TestFirehoseRequest(t *testing.T) { defaultConsumer := newNopFirehoseConsumer(http.StatusOK, nil) firehoseConsumerErr := errors.New("firehose consumer error") cfg := &Config{ - RecordType: defaultRecordType, - AccessKey: testFirehoseAccessKey, + AccessKey: testFirehoseAccessKey, } var noRecords []firehoseRecord testCases := map[string]struct { diff --git a/receiver/awsfirehosereceiver/testdata/cwlogs_config.yaml b/receiver/awsfirehosereceiver/testdata/cwlogs_config.yaml new file mode 100644 index 000000000000..9ec04ad0a171 --- /dev/null +++ b/receiver/awsfirehosereceiver/testdata/cwlogs_config.yaml @@ -0,0 +1,7 @@ +awsfirehose: + endpoint: 0.0.0.0:4433 + record_type: cwlogs + access_key: "some_access_key" + tls: + cert_file: server.crt + key_file: server.key diff --git a/receiver/awsfirehosereceiver/testdata/config.yaml b/receiver/awsfirehosereceiver/testdata/cwmetrics_config.yaml similarity index 100% rename from receiver/awsfirehosereceiver/testdata/config.yaml rename to receiver/awsfirehosereceiver/testdata/cwmetrics_config.yaml diff --git a/receiver/awsfirehosereceiver/testdata/invalid_config.yaml b/receiver/awsfirehosereceiver/testdata/invalid_config.yaml new file mode 100644 index 000000000000..17ad1316b7cd --- /dev/null +++ b/receiver/awsfirehosereceiver/testdata/invalid_config.yaml @@ -0,0 +1,3 @@ +awsfirehose: + endpoint: 0.0.0.0:4433 + record_type: invalid \ No newline at end of file From f4a42067a2c0f9c55742c3580517064abbf35f2e Mon Sep 17 00:00:00 2001 From: Antoine Toulme Date: Wed, 9 Oct 2024 17:55:48 -0700 Subject: [PATCH 011/140] [receiver/hostmetrics] Make HOST_PROC_MOUNTINFO part of envMap (#35504) **Description:** Make HOST_PROC_MOUNTINFO part of envMap instead of environment variable --- .chloggen/use_HOST_PROC_MOUNTINFO.yaml | 27 +++++++++++++++++++ .../hostmetricsreceiver/hostmetrics_linux.go | 13 ++++----- .../hostmetrics_linux_test.go | 11 ++++---- .../filesystemscraper/filesystem_scraper.go | 12 +++++---- .../filesystem_scraper_test.go | 11 +++++--- .../processscraper/process_scraper_test.go | 13 ++++++++- 6 files changed, 66 insertions(+), 21 deletions(-) create mode 100644 .chloggen/use_HOST_PROC_MOUNTINFO.yaml diff --git a/.chloggen/use_HOST_PROC_MOUNTINFO.yaml b/.chloggen/use_HOST_PROC_MOUNTINFO.yaml new file mode 100644 index 000000000000..06bd4b785e42 --- /dev/null +++ b/.chloggen/use_HOST_PROC_MOUNTINFO.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: enhancement + +# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver) +component: hostmetricsreceiver + +# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). +note: Use HOST_PROC_MOUNTINFO as part of configuration instead of environment variable + +# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists. +issues: [35504] + +# (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/hostmetricsreceiver/hostmetrics_linux.go b/receiver/hostmetricsreceiver/hostmetrics_linux.go index 43b83fcea692..132eb3978d08 100644 --- a/receiver/hostmetricsreceiver/hostmetrics_linux.go +++ b/receiver/hostmetricsreceiver/hostmetrics_linux.go @@ -14,12 +14,13 @@ import ( ) var gopsutilEnvVars = map[common.EnvKeyType]string{ - common.HostProcEnvKey: "/proc", - common.HostSysEnvKey: "/sys", - common.HostEtcEnvKey: "/etc", - common.HostVarEnvKey: "/var", - common.HostRunEnvKey: "/run", - common.HostDevEnvKey: "/dev", + common.HostProcEnvKey: "/proc", + common.HostSysEnvKey: "/sys", + common.HostEtcEnvKey: "/etc", + common.HostVarEnvKey: "/var", + common.HostRunEnvKey: "/run", + common.HostDevEnvKey: "/dev", + common.HostProcMountinfo: "", } // This exists to validate that different instances of the hostmetricsreceiver do not diff --git a/receiver/hostmetricsreceiver/hostmetrics_linux_test.go b/receiver/hostmetricsreceiver/hostmetrics_linux_test.go index 3876c4444cda..d6c3cd7f1ad3 100644 --- a/receiver/hostmetricsreceiver/hostmetrics_linux_test.go +++ b/receiver/hostmetricsreceiver/hostmetrics_linux_test.go @@ -50,11 +50,12 @@ func TestLoadConfigRootPath(t *testing.T) { cpuScraperCfg := (&cpuscraper.Factory{}).CreateDefaultConfig() cpuScraperCfg.SetRootPath("testdata") cpuScraperCfg.SetEnvMap(common.EnvMap{ - common.HostDevEnvKey: "testdata/dev", - common.HostEtcEnvKey: "testdata/etc", - common.HostRunEnvKey: "testdata/run", - common.HostSysEnvKey: "testdata/sys", - common.HostVarEnvKey: "testdata/var", + common.HostDevEnvKey: "testdata/dev", + common.HostEtcEnvKey: "testdata/etc", + common.HostProcMountinfo: "testdata", + common.HostRunEnvKey: "testdata/run", + common.HostSysEnvKey: "testdata/sys", + common.HostVarEnvKey: "testdata/var", }) expectedConfig.Scrapers = map[string]internal.Config{cpuscraper.TypeStr: cpuScraperCfg} diff --git a/receiver/hostmetricsreceiver/internal/scraper/filesystemscraper/filesystem_scraper.go b/receiver/hostmetricsreceiver/internal/scraper/filesystemscraper/filesystem_scraper.go index 005a506befe5..305f62797f63 100644 --- a/receiver/hostmetricsreceiver/internal/scraper/filesystemscraper/filesystem_scraper.go +++ b/receiver/hostmetricsreceiver/internal/scraper/filesystemscraper/filesystem_scraper.go @@ -6,7 +6,6 @@ package filesystemscraper // import "github.com/open-telemetry/opentelemetry-col import ( "context" "fmt" - "os" "path/filepath" "strings" "time" @@ -111,7 +110,7 @@ func (s *scraper) scrape(ctx context.Context) (pmetric.Metrics, error) { if !s.fsFilter.includePartition(partition) { continue } - translatedMountpoint := translateMountpoint(s.config.RootPath, partition.Mountpoint) + translatedMountpoint := translateMountpoint(ctx, s.config.RootPath, partition.Mountpoint) usage, usageErr := s.usage(ctx, translatedMountpoint) if usageErr != nil { errors.AddPartial(0, fmt.Errorf("failed to read usage at %s: %w", translatedMountpoint, usageErr)) @@ -178,9 +177,12 @@ func (f *fsFilter) includeMountPoint(mountPoint string) bool { } // translateMountsRootPath translates a mountpoint from the host perspective to the chrooted perspective. -func translateMountpoint(rootPath, mountpoint string) string { - if mountInfo := os.Getenv("HOST_PROC_MOUNTINFO"); mountInfo != "" { - return mountpoint +func translateMountpoint(ctx context.Context, rootPath string, mountpoint string) string { + if env, ok := ctx.Value(common.EnvKey).(common.EnvMap); ok { + mountInfo := env[common.EnvKeyType("HOST_PROC_MOUNTINFO")] + if mountInfo != "" { + return mountpoint + } } return filepath.Join(rootPath, mountpoint) } diff --git a/receiver/hostmetricsreceiver/internal/scraper/filesystemscraper/filesystem_scraper_test.go b/receiver/hostmetricsreceiver/internal/scraper/filesystemscraper/filesystem_scraper_test.go index 250ec060ec2e..7406b6e5592a 100644 --- a/receiver/hostmetricsreceiver/internal/scraper/filesystemscraper/filesystem_scraper_test.go +++ b/receiver/hostmetricsreceiver/internal/scraper/filesystemscraper/filesystem_scraper_test.go @@ -11,6 +11,7 @@ import ( "runtime" "testing" + "github.com/shirou/gopsutil/v4/common" "github.com/shirou/gopsutil/v4/disk" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" @@ -30,7 +31,7 @@ func TestScrape(t *testing.T) { name string config Config rootPath string - osEnv map[string]string + osEnv map[common.EnvKeyType]string bootTimeFunc func(context.Context) (uint64, error) partitionsFunc func(context.Context, bool) ([]disk.PartitionStat, error) usageFunc func(context.Context, string) (*disk.UsageStat, error) @@ -198,8 +199,8 @@ func TestScrape(t *testing.T) { }, { name: "RootPath at /hostfs but HOST_PROC_MOUNTINFO is set", - osEnv: map[string]string{ - "HOST_PROC_MOUNTINFO": "/proc/1/self", + osEnv: map[common.EnvKeyType]string{ + common.HostProcMountinfo: "/proc/1/self", }, config: Config{ MetricsBuilderConfig: metadata.DefaultMetricsBuilderConfig(), @@ -387,9 +388,11 @@ 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 { - t.Setenv(k, v) + envMap[k] = v } + test.config.EnvMap = envMap test.config.SetRootPath(test.rootPath) scraper, err := newFileSystemScraper(context.Background(), receivertest.NewNopSettings(), &test.config) if test.newErrRegex != "" { diff --git a/receiver/hostmetricsreceiver/internal/scraper/processscraper/process_scraper_test.go b/receiver/hostmetricsreceiver/internal/scraper/processscraper/process_scraper_test.go index 4d983b8a664e..c937b58558d7 100644 --- a/receiver/hostmetricsreceiver/internal/scraper/processscraper/process_scraper_test.go +++ b/receiver/hostmetricsreceiver/internal/scraper/processscraper/process_scraper_test.go @@ -11,6 +11,7 @@ import ( "testing" "time" + "github.com/shirou/gopsutil/v4/common" "github.com/shirou/gopsutil/v4/cpu" "github.com/shirou/gopsutil/v4/process" "github.com/stretchr/testify/assert" @@ -88,7 +89,17 @@ func TestScrape(t *testing.T) { if test.mutateMetricsConfig != nil { test.mutateMetricsConfig(t, &metricsBuilderConfig.Metrics) } - scraper, err := newProcessScraper(receivertest.NewNopSettings(), &Config{MetricsBuilderConfig: metricsBuilderConfig}) + cfg := &Config{MetricsBuilderConfig: metricsBuilderConfig} + cfg.EnvMap = common.EnvMap{ + common.HostProcEnvKey: "/proc", + common.HostSysEnvKey: "/sys", + common.HostEtcEnvKey: "/etc", + common.HostVarEnvKey: "/var", + common.HostRunEnvKey: "/run", + common.HostDevEnvKey: "/dev", + common.HostProcMountinfo: "", + } + scraper, err := newProcessScraper(receivertest.NewNopSettings(), cfg) if test.mutateScraper != nil { test.mutateScraper(scraper) } From 8786312aa70cbaa4848ae83385b5dca343b4e7c1 Mon Sep 17 00:00:00 2001 From: YUANFAN PENG Date: Wed, 9 Oct 2024 18:09:28 -0700 Subject: [PATCH 012/140] [Chore] add cgo test for macos-12 and macos-13 (#34741) **Description:** In order to add CGO support, add compatibility test for old macos versions. Due macos-12 and macos-13 are using amd64 instead of arm64, cross compiling is used. **Link to tracking Issue:** #33393 **Testing:** Added tests for hostmetrics receiver for macos-12 and macos-13 **Documentation:** --------- Co-authored-by: Sean Marciniak <30928402+MovieStoreGuy@users.noreply.github.com> --- .github/workflows/build-and-test-darwin.yaml | 101 +++++++++++++++++++ Makefile | 14 +++ Makefile.Common | 13 +++ 3 files changed, 128 insertions(+) create mode 100644 .github/workflows/build-and-test-darwin.yaml diff --git a/.github/workflows/build-and-test-darwin.yaml b/.github/workflows/build-and-test-darwin.yaml new file mode 100644 index 000000000000..02aea07e37a0 --- /dev/null +++ b/.github/workflows/build-and-test-darwin.yaml @@ -0,0 +1,101 @@ +name: build-and-test-darwin +on: + push: + branches: [main] + tags: + - "v[0-9]+.[0-9]+.[0-9]+*" + merge_group: + pull_request: + types: [opened, synchronize, reopened, labeled, unlabeled] + branches: + - main +env: + TEST_RESULTS: testbed/tests/results/junit/results.xml + # Make sure to exit early if cache segment download times out after 2 minutes. + # We limit cache download as a whole to 5 minutes. + SEGMENT_DOWNLOAD_TIMEOUT_MINS: 2 + GOPROXY: https://goproxy1.cncf.selfactuated.dev,direct + +# Do not cancel this workflow on main. See https://github.com/open-telemetry/opentelemetry-collector-contrib/pull/16616 +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +jobs: + darwin-build-unittest-binary: + if: ${{ github.actor != 'dependabot[bot]' && (contains(github.event.pull_request.labels.*.name, 'Run Darwin') || github.event_name == 'push' || github.event_name == 'merge_group') }} + runs-on: macos-14 + timeout-minutes: 120 + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-go@v5 + with: + go-version: "~1.22.5" + cache: false + - name: Cache Go + id: go-cache + timeout-minutes: 5 + uses: actions/cache@v4 + with: + path: | + ~/go/bin + ~/go/pkg/mod + key: go-build-cache-${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} + - name: Install dependencies + if: steps.go-cache.outputs.cache-hit != 'true' + run: make -j2 gomoddownload + - name: Install Tools + if: steps.go-cache.outputs.cache-hit != 'true' + run: make install-tools + - name: Build test binaries + env: + GOTESTARCH: amd64 + run: make gobuildtest GROUP=cgo + - name: Zip test binaries + run: zip -r testbinaries.zip . --include \*builtunitetest.test + - uses: actions/upload-artifact@v4 + with: + name: testbinaries + path: ./testbinaries.zip + retention-days: 1 + darwin-unittest-matrix: + if: ${{ github.actor != 'dependabot[bot]' && (contains(github.event.pull_request.labels.*.name, 'Run Darwin') || github.event_name == 'push' || github.event_name == 'merge_group') }} + needs: [darwin-build-unittest-binary] + strategy: + fail-fast: false + matrix: + os: [macos-12, macos-13] + timeout-minutes: 30 + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-go@v5 + with: + go-version: "~1.22.5" + cache: false + - name: Install Tools + if: steps.go-cache.outputs.cache-hit != 'true' + run: make install-tools + - uses: actions/download-artifact@v4 + with: + name: testbinaries + - name: Unzip binaries to each module + run: unzip testbinaries.zip + - name: Run Unit Tests + run: make -j2 gorunbuilttest GROUP=cgo + darwin-unittest: + if: ${{ github.actor != 'dependabot[bot]' && (contains(github.event.pull_request.labels.*.name, 'Run Darwin') || github.event_name == 'push' || github.event_name == 'merge_group') }} + runs-on: macos-latest + needs: [darwin-unittest-matrix] + steps: + - name: Print result + run: echo ${{ needs.darwin-unittest-matrix.result }} + - name: Interpret result + run: | + if [[ success == ${{ needs.darwin-unittest-matrix.result }} ]] + then + echo "All matrix jobs passed!" + else + echo "One or more matrix jobs failed." + false + fi diff --git a/Makefile b/Makefile index 75591a0042b3..1e087f09fea2 100644 --- a/Makefile +++ b/Makefile @@ -51,6 +51,7 @@ CMD_MODS_1 := $(shell find ./cmd/[n-z]* $(FIND_MOD_ARGS) -not -path "./cmd/otel* CMD_MODS := $(CMD_MODS_0) $(CMD_MODS_1) OTHER_MODS := $(shell find . $(EX_COMPONENTS) $(EX_INTERNAL) $(EX_PKG) $(EX_CMD) $(FIND_MOD_ARGS) -exec $(TO_MOD_DIR) ) $(PWD) ALL_MODS := $(RECEIVER_MODS) $(PROCESSOR_MODS) $(EXPORTER_MODS) $(EXTENSION_MODS) $(CONNECTOR_MODS) $(INTERNAL_MODS) $(PKG_MODS) $(CMD_MODS) $(OTHER_MODS) +CGO_MODS := ./receiver/hostmetricsreceiver FIND_INTEGRATION_TEST_MODS={ find . -type f -name "*integration_test.go" & find . -type f -name "*e2e_test.go" -not -path "./testbed/*"; } INTEGRATION_MODS := $(shell $(FIND_INTEGRATION_TEST_MODS) | xargs $(TO_MOD_DIR) | uniq) @@ -135,6 +136,14 @@ gotest-with-cover: @$(MAKE) $(FOR_GROUP_TARGET) TARGET="test-with-cover" $(GOCMD) tool covdata textfmt -i=./coverage/unit -o ./$(GROUP)-coverage.txt +.PHONY: gobuildtest +gobuildtest: + $(MAKE) $(FOR_GROUP_TARGET) TARGET="buildtest" + +.PHONY: gorunbuilttest +gorunbuilttest: + $(MAKE) $(FOR_GROUP_TARGET) TARGET="runbuilttest" + .PHONY: gointegration-test gointegration-test: $(MAKE) $(FOR_GROUP_TARGET) TARGET="mod-integration-test" @@ -260,6 +269,9 @@ for-other-target: $(OTHER_MODS) .PHONY: for-integration-target for-integration-target: $(INTEGRATION_MODS) +.PHONY: for-cgo-target +for-cgo-target: $(CGO_MODS) + # Debugging target, which helps to quickly determine whether for-all-target is working or not. .PHONY: all-pwd all-pwd: @@ -539,6 +551,8 @@ clean: find . -type f -name 'coverage.out' -delete find . -type f -name 'integration-coverage.txt' -delete find . -type f -name 'integration-coverage.html' -delete + @echo "Removing built binary files" + find . -type f -name 'builtunitetest.test' -delete .PHONY: generate-gh-issue-templates generate-gh-issue-templates: diff --git a/Makefile.Common b/Makefile.Common index 9d94e590e1f1..f73df4c03097 100644 --- a/Makefile.Common +++ b/Makefile.Common @@ -36,6 +36,7 @@ GOTEST_OPT_WITH_INTEGRATION_COVERAGE=$(GOTEST_OPT_WITH_INTEGRATION) -coverprofil GOCMD?= go GOOS=$(shell $(GOCMD) env GOOS) GOARCH=$(shell $(GOCMD) env GOARCH) +GOTESTARCH?=$(GOARCH) # In order to help reduce toil related to managing tooling for the open telemetry collector # this section of the makefile looks at only requiring command definitions to be defined @@ -140,6 +141,18 @@ do-unit-tests-with-cover: $(GOTESTSUM) $(GOTESTSUM) $(GOTESTSUM_OPT) --packages="./..." -- $(GOTEST_OPT_WITH_COVERAGE) $(GOCMD) tool cover -html=coverage.txt -o coverage.html +.PHONY: buildtest +buildtest: +ifneq (,$(wildcard ./*.go)) + GOARCH=$(GOTESTARCH) CGO_ENABLED=1 $(GOCMD) test -c -o builtunitetest.test +endif + +.PHONY: runbuilttest +runbuilttest: $(GOTESTSUM) +ifneq (,$(wildcard ./builtunitetest.test)) + $(GOTESTSUM) --raw-command -- $(GOCMD) tool test2json -p "./..." -t ./builtunitetest.test -test.v -test.failfast -test.timeout $(GOTEST_TIMEOUT) +endif + .PHONY: mod-integration-test mod-integration-test: $(GOTESTSUM) @echo "running $(GOCMD) integration test ./... in `pwd`" From afe87cd35831e5a47b154d3a07d32c50372d3f2a Mon Sep 17 00:00:00 2001 From: Alex Greenbank Date: Thu, 10 Oct 2024 09:06:40 +0100 Subject: [PATCH 013/140] [receiver/datadog] Fix service_check name conversion (#35718) #### Description Use the `Check` name supplied in the Service Check structure rather than hard-coding the resulting metric as `service_check`. Unit tests and e2e test updated accordingly. --------- Signed-off-by: alexgreenbank --- .../alexg_fix-service-check-metric-name.yaml | 27 +++++++++++++++++++ .../translator/service_check_translator.go | 2 +- .../service_check_translator_test.go | 4 +-- receiver/datadogreceiver/receiver_test.go | 1 + 4 files changed, 31 insertions(+), 3 deletions(-) create mode 100644 .chloggen/alexg_fix-service-check-metric-name.yaml diff --git a/.chloggen/alexg_fix-service-check-metric-name.yaml b/.chloggen/alexg_fix-service-check-metric-name.yaml new file mode 100644 index 000000000000..cf1c4628a78b --- /dev/null +++ b/.chloggen/alexg_fix-service-check-metric-name.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: bug_fix + +# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver) +component: datadogreceiver + +# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). +note: "Use `Check` name from Service Check structure as metric name rather than hardcoded string `service_check`" + +# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists. +issues: [35718] + +# (Optional) One or more lines of additional information to render under the primary note. +# These lines will be padded with 2 spaces and then inserted directly into the document. +# Use pipe (|) for multiline entries. +subtext: + +# If your change doesn't affect end users or the exported elements of any package, +# you should instead start your pull request title with [chore] or use the "Skip Changelog" label. +# Optional: The change log or logs in which this entry should be included. +# e.g. '[user]' or '[user, api]' +# Include 'user' if the change is relevant to end users. +# Include 'api' if there is a change to a library API. +# Default: '[user]' +change_logs: [user] diff --git a/receiver/datadogreceiver/internal/translator/service_check_translator.go b/receiver/datadogreceiver/internal/translator/service_check_translator.go index 4cbd20a0ba6b..b1191049ead9 100644 --- a/receiver/datadogreceiver/internal/translator/service_check_translator.go +++ b/receiver/datadogreceiver/internal/translator/service_check_translator.go @@ -27,7 +27,7 @@ func (mt *MetricsTranslator) TranslateServices(services []ServiceCheck) pmetric. bt.Metrics = pmetric.NewMetrics() for _, service := range services { - metricProperties := parseSeriesProperties("service_check", "service_check", service.Tags, service.HostName, mt.buildInfo.Version, mt.stringPool) + metricProperties := parseSeriesProperties(service.Check, "service_check", service.Tags, service.HostName, mt.buildInfo.Version, mt.stringPool) metric, metricID := bt.Lookup(metricProperties) // TODO(alexg): proper name dps := metric.Gauge().DataPoints() diff --git a/receiver/datadogreceiver/internal/translator/service_check_translator_test.go b/receiver/datadogreceiver/internal/translator/service_check_translator_test.go index 66abea5d1fbc..1f0dc69b3132 100644 --- a/receiver/datadogreceiver/internal/translator/service_check_translator_test.go +++ b/receiver/datadogreceiver/internal/translator/service_check_translator_test.go @@ -187,7 +187,7 @@ func TestTranslateCheckRun(t *testing.T) { requireScope(t, result, expectedAttrs.scope, component.NewDefaultBuildInfo().Version) metric := result.ResourceMetrics().At(0).ScopeMetrics().At(0).Metrics().At(0) - requireGauge(t, metric, "service_check", 1) + requireGauge(t, metric, "app.working", 1) dp := metric.Gauge().DataPoints().At(0) requireDp(t, dp, expectedAttrs.dp, 1700000000, 0) @@ -213,7 +213,7 @@ func TestTranslateCheckRun(t *testing.T) { requireScope(t, result, expectedAttrs.scope, component.NewDefaultBuildInfo().Version) metric := result.ResourceMetrics().At(0).ScopeMetrics().At(0).Metrics().At(0) - requireGauge(t, metric, "service_check", 1) + requireGauge(t, metric, "app.working", 1) dp := metric.Gauge().DataPoints().At(0) requireDp(t, dp, expectedAttrs.dp, 0, 0) diff --git a/receiver/datadogreceiver/receiver_test.go b/receiver/datadogreceiver/receiver_test.go index 46051be1a845..9e53fcf43e8f 100644 --- a/receiver/datadogreceiver/receiver_test.go +++ b/receiver/datadogreceiver/receiver_test.go @@ -619,6 +619,7 @@ func TestDatadogServices_EndToEnd(t *testing.T) { metrics := got.ResourceMetrics().At(0).ScopeMetrics().At(0).Metrics() assert.Equal(t, 1, metrics.Len()) metric := metrics.At(0) + assert.Equal(t, "app.working", metric.Name()) assert.Equal(t, pmetric.MetricTypeGauge, metric.Type()) dps := metric.Gauge().DataPoints() assert.Equal(t, 1, dps.Len()) From cc953894e849a49fe4acc9023c66b0be5aed96df Mon Sep 17 00:00:00 2001 From: Vihang <19466830+vihangvk@users.noreply.github.com> Date: Thu, 10 Oct 2024 16:57:15 +0200 Subject: [PATCH 014/140] [receiver:awsfirehosereceiver] added support for OTLP v1.0.0 format (#34982) **Description:** Added support for OpenTelemetry 1.0.0 format Current implementation for `awsfirehosereceiver` supports only JSON format. Added support to handle OpenTelemetry 1.0.0 format. Standard OpenTelemetry receiver does not work as AWS Cloudwatch metrics are streamed via AWS Firehose stream. So the actual OpenTelemetry data is embedded in AWS Firehose records. This can be enabled in configuration by setting `record_type` to `otlp_v1`. (Added suffix v1 as AWS CloudWatch metrics streaming also supports OpenTelemetry 0.7.0 format). - Added new `Unmarshaler` under new package `otlpmetricstream`. - Updated `defaultMetricsUnmarshalers` in `factory.go` to create instance of new Unmarshaler. - Added new record type in `availableRecordTypes` to support the OpenTelemetry 1.0.0 format. **Testing:** Added test cases to test new Unmarshler to test record unmarshaling. **Documentation:** Updated readme to document new `record_type`. --- .../awsfirehosereceiver_otlp_support.yaml | 27 ++++ receiver/awsfirehosereceiver/README.md | 3 + .../generated_component_test.go | 2 +- receiver/awsfirehosereceiver/go.mod | 2 +- .../otlpmetricstream/unmarshaler.go | 73 ++++++++++ .../otlpmetricstream/unmarshaler_test.go | 126 ++++++++++++++++++ 6 files changed, 231 insertions(+), 2 deletions(-) create mode 100644 .chloggen/awsfirehosereceiver_otlp_support.yaml create mode 100644 receiver/awsfirehosereceiver/internal/unmarshaler/otlpmetricstream/unmarshaler.go create mode 100644 receiver/awsfirehosereceiver/internal/unmarshaler/otlpmetricstream/unmarshaler_test.go diff --git a/.chloggen/awsfirehosereceiver_otlp_support.yaml b/.chloggen/awsfirehosereceiver_otlp_support.yaml new file mode 100644 index 000000000000..44d764934dbd --- /dev/null +++ b/.chloggen/awsfirehosereceiver_otlp_support.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: enhancement + +# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver) +component: awsfirehosereceiver + +# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). +note: added OTLP v1 support to Firehose receiver + +# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists. +issues: [34982] + +# (Optional) One or more lines of additional information to render under the primary note. +# These lines will be padded with 2 spaces and then inserted directly into the document. +# Use pipe (|) for multiline entries. +subtext: + +# If your change doesn't affect end users or the exported elements of any package, +# you should instead start your pull request title with [chore] or use the "Skip Changelog" label. +# Optional: The change log or logs in which this entry should be included. +# e.g. '[user]' or '[user, api]' +# Include 'user' if the change is relevant to end users. +# Include 'api' if there is a change to a library API. +# Default: '[user]' +change_logs: [user] diff --git a/receiver/awsfirehosereceiver/README.md b/receiver/awsfirehosereceiver/README.md index a8e6d242775d..6fab04fd95bc 100644 --- a/receiver/awsfirehosereceiver/README.md +++ b/receiver/awsfirehosereceiver/README.md @@ -83,3 +83,6 @@ For example: } ``` +### otlp_v1 +The OTLP v1 format as produced by CloudWatch metric streams. +See [documentation](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch-metric-streams-formats-opentelemetry-100.html) for details. diff --git a/receiver/awsfirehosereceiver/generated_component_test.go b/receiver/awsfirehosereceiver/generated_component_test.go index 54a22c25a689..64626eb54322 100644 --- a/receiver/awsfirehosereceiver/generated_component_test.go +++ b/receiver/awsfirehosereceiver/generated_component_test.go @@ -34,7 +34,7 @@ func TestComponentLifecycle(t *testing.T) { { name: "logs", createFn: func(ctx context.Context, set receiver.Settings, cfg component.Config) (component.Component, error) { - return factory.CreateLogsReceiver(ctx, set, cfg, consumertest.NewNop()) + return factory.CreateLogs(ctx, set, cfg, consumertest.NewNop()) }, }, diff --git a/receiver/awsfirehosereceiver/go.mod b/receiver/awsfirehosereceiver/go.mod index eaaa109ca040..11b4cfc865a8 100644 --- a/receiver/awsfirehosereceiver/go.mod +++ b/receiver/awsfirehosereceiver/go.mod @@ -3,6 +3,7 @@ module github.com/open-telemetry/opentelemetry-collector-contrib/receiver/awsfir go 1.22.0 require ( + github.com/gogo/protobuf v1.3.2 github.com/open-telemetry/opentelemetry-collector-contrib/internal/common v0.111.0 github.com/stretchr/testify v1.9.0 go.opentelemetry.io/collector/component v0.111.1-0.20241008154146-ea48c09c31ae @@ -27,7 +28,6 @@ require ( github.com/go-logr/logr v1.4.2 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/go-viper/mapstructure/v2 v2.1.0 // indirect - github.com/gogo/protobuf v1.3.2 // 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 diff --git a/receiver/awsfirehosereceiver/internal/unmarshaler/otlpmetricstream/unmarshaler.go b/receiver/awsfirehosereceiver/internal/unmarshaler/otlpmetricstream/unmarshaler.go new file mode 100644 index 000000000000..af10aedc0c78 --- /dev/null +++ b/receiver/awsfirehosereceiver/internal/unmarshaler/otlpmetricstream/unmarshaler.go @@ -0,0 +1,73 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package otlpmetricstream // import "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/awsfirehosereceiver/internal/unmarshaler/otlpmetricstream" + +import ( + "errors" + + "github.com/gogo/protobuf/proto" + "go.opentelemetry.io/collector/pdata/pmetric" + "go.opentelemetry.io/collector/pdata/pmetric/pmetricotlp" + "go.uber.org/zap" + + "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/awsfirehosereceiver/internal/unmarshaler" +) + +const ( + // Supported version depends on version of go.opentelemetry.io/collector/pdata/pmetric/pmetricotlp dependency + TypeStr = "otlp_v1" +) + +var ( + errInvalidOTLPFormatStart = errors.New("unable to decode data length from message") +) + +// Unmarshaler for the CloudWatch Metric Stream OpenTelemetry record format. +// +// More details can be found at: +// https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch-metric-streams-formats-opentelemetry-100.html +type Unmarshaler struct { + logger *zap.Logger +} + +var _ unmarshaler.MetricsUnmarshaler = (*Unmarshaler)(nil) + +// NewUnmarshaler creates a new instance of the Unmarshaler. +func NewUnmarshaler(logger *zap.Logger) *Unmarshaler { + return &Unmarshaler{logger} +} + +// Unmarshal deserializes the records into pmetric.Metrics +func (u Unmarshaler) Unmarshal(records [][]byte) (pmetric.Metrics, error) { + md := pmetric.NewMetrics() + for recordIndex, record := range records { + var dataLen, pos = len(record), 0 + for pos < dataLen { + n, nLen := proto.DecodeVarint(record) + if nLen == 0 && n == 0 { + return md, errInvalidOTLPFormatStart + } + req := pmetricotlp.NewExportRequest() + pos += nLen + err := req.UnmarshalProto(record[pos : pos+int(n)]) + pos += int(n) + if err != nil { + u.logger.Error( + "Unable to unmarshal input", + zap.Error(err), + zap.Int("record_index", recordIndex), + ) + continue + } + req.Metrics().ResourceMetrics().MoveAndAppendTo(md.ResourceMetrics()) + } + } + + return md, nil +} + +// Type of the serialized messages. +func (u Unmarshaler) Type() string { + return TypeStr +} diff --git a/receiver/awsfirehosereceiver/internal/unmarshaler/otlpmetricstream/unmarshaler_test.go b/receiver/awsfirehosereceiver/internal/unmarshaler/otlpmetricstream/unmarshaler_test.go new file mode 100644 index 000000000000..a35361d6bf64 --- /dev/null +++ b/receiver/awsfirehosereceiver/internal/unmarshaler/otlpmetricstream/unmarshaler_test.go @@ -0,0 +1,126 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package otlpmetricstream + +import ( + "testing" + "time" + + "github.com/gogo/protobuf/proto" + "github.com/stretchr/testify/require" + "go.opentelemetry.io/collector/pdata/pcommon" + "go.opentelemetry.io/collector/pdata/pmetric/pmetricotlp" + "go.uber.org/zap" +) + +func TestType(t *testing.T) { + unmarshaler := NewUnmarshaler(zap.NewNop()) + require.Equal(t, TypeStr, unmarshaler.Type()) +} + +func createMetricRecord() []byte { + var er = pmetricotlp.NewExportRequest() + var rsm = er.Metrics().ResourceMetrics().AppendEmpty() + var sm = rsm.ScopeMetrics().AppendEmpty().Metrics().AppendEmpty() + sm.SetName("TestMetric") + var dp = sm.SetEmptySummary().DataPoints().AppendEmpty() + dp.SetCount(1) + dp.SetSum(1) + qv := dp.QuantileValues() + min := qv.AppendEmpty() + min.SetQuantile(0) + min.SetValue(0) + max := qv.AppendEmpty() + max.SetQuantile(1) + max.SetValue(1) + dp.SetTimestamp(pcommon.NewTimestampFromTime(time.Now())) + + temp, _ := er.MarshalProto() + var record = proto.EncodeVarint(uint64(len(temp))) + record = append(record, temp...) + return record +} + +func TestUnmarshal(t *testing.T) { + unmarshaler := NewUnmarshaler(zap.NewNop()) + testCases := map[string]struct { + records [][]byte + wantResourceCount int + wantMetricCount int + wantDatapointCount int + wantErr error + }{ + "WithSingleRecord": { + records: [][]byte{ + createMetricRecord(), + }, + wantResourceCount: 1, + wantMetricCount: 1, + wantDatapointCount: 1, + }, + "WithMultipleRecords": { + records: [][]byte{ + createMetricRecord(), + createMetricRecord(), + createMetricRecord(), + createMetricRecord(), + createMetricRecord(), + createMetricRecord(), + }, + wantResourceCount: 6, + wantMetricCount: 6, + wantDatapointCount: 6, + }, + "WithEmptyRecord": { + records: make([][]byte, 0), + wantResourceCount: 0, + wantMetricCount: 0, + wantDatapointCount: 0, + }, + "WithInvalidRecords": { + records: [][]byte{{1, 2}}, + wantResourceCount: 0, + wantMetricCount: 0, + wantDatapointCount: 0, + }, + "WithSomeInvalidRecords": { + records: [][]byte{ + createMetricRecord(), + {1, 2}, + createMetricRecord(), + }, + wantResourceCount: 2, + wantMetricCount: 2, + wantDatapointCount: 2, + }, + } + for name, testCase := range testCases { + t.Run(name, func(t *testing.T) { + + got, err := unmarshaler.Unmarshal(testCase.records) + if testCase.wantErr != nil { + require.Error(t, err) + require.Equal(t, testCase.wantErr, err) + } else { + require.NoError(t, err) + require.NotNil(t, got) + require.Equal(t, testCase.wantResourceCount, got.ResourceMetrics().Len()) + gotMetricCount := 0 + gotDatapointCount := 0 + for i := 0; i < got.ResourceMetrics().Len(); i++ { + rm := got.ResourceMetrics().At(i) + require.Equal(t, 1, rm.ScopeMetrics().Len()) + ilm := rm.ScopeMetrics().At(0) + gotMetricCount += ilm.Metrics().Len() + for j := 0; j < ilm.Metrics().Len(); j++ { + metric := ilm.Metrics().At(j) + gotDatapointCount += metric.Summary().DataPoints().Len() + } + } + require.Equal(t, testCase.wantMetricCount, gotMetricCount) + require.Equal(t, testCase.wantDatapointCount, gotDatapointCount) + } + }) + } +} From 2d2aae441ba4133f91c8b94d81c049b1074986ac Mon Sep 17 00:00:00 2001 From: Daniel Jaglowski Date: Thu, 10 Oct 2024 11:07:22 -0400 Subject: [PATCH 015/140] [chore] Fix problem where generated code was out of date (#35729) This was apparently caused by a merge order issue. From d7e5154cbc1e47c093258484b8fa1c1134894bce Mon Sep 17 00:00:00 2001 From: Daniel Jaglowski Date: Thu, 10 Oct 2024 11:27:47 -0400 Subject: [PATCH 016/140] [pkg/ottl] Add ConvertAttributesToElementsXML Converter (#35328) This adds a converter called `ElementizeAttributesXML`. This serves as one of the granular transformations described in #35281 which will allow users to migrate any arbitrary XML document into a JSON-equivalent state. Also see #35364 --- .chloggen/elementize-attributes-xml.yaml | 27 ++++ pkg/ottl/e2e/e2e_test.go | 6 + pkg/ottl/ottlfuncs/README.md | 26 ++++ ...func_convert_attributes_to_elements_xml.go | 69 ++++++++++ ...convert_attributes_to_elements_xml_test.go | 126 ++++++++++++++++++ pkg/ottl/ottlfuncs/functions.go | 1 + 6 files changed, 255 insertions(+) create mode 100644 .chloggen/elementize-attributes-xml.yaml create mode 100644 pkg/ottl/ottlfuncs/func_convert_attributes_to_elements_xml.go create mode 100644 pkg/ottl/ottlfuncs/func_convert_attributes_to_elements_xml_test.go diff --git a/.chloggen/elementize-attributes-xml.yaml b/.chloggen/elementize-attributes-xml.yaml new file mode 100644 index 000000000000..e46c4221ff35 --- /dev/null +++ b/.chloggen/elementize-attributes-xml.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: enhancement + +# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver) +component: pkg/ottl + +# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). +note: Add ConvertAttributesToElementsXML Converter + +# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists. +issues: [35328] + +# (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/pkg/ottl/e2e/e2e_test.go b/pkg/ottl/e2e/e2e_test.go index ede1e329bdb1..f7c3fe7324fe 100644 --- a/pkg/ottl/e2e/e2e_test.go +++ b/pkg/ottl/e2e/e2e_test.go @@ -347,6 +347,12 @@ func Test_e2e_converters(t *testing.T) { tCtx.GetLogRecord().Attributes().PutStr("test", "FooBar") }, }, + { + statement: `set(attributes["test"], ConvertAttributesToElementsXML("This is a log message!"))`, + want: func(tCtx ottllog.TransformContext) { + tCtx.GetLogRecord().Attributes().PutStr("test", `This is a log message!1`) + }, + }, { statement: `set(attributes["test"], Double(1.0))`, want: func(tCtx ottllog.TransformContext) { diff --git a/pkg/ottl/ottlfuncs/README.md b/pkg/ottl/ottlfuncs/README.md index 380cb41d8c50..11a61d101691 100644 --- a/pkg/ottl/ottlfuncs/README.md +++ b/pkg/ottl/ottlfuncs/README.md @@ -413,6 +413,7 @@ Available Converters: - [Decode](#decode) - [Concat](#concat) - [ConvertCase](#convertcase) +- [ConvertAttributesToElementsXML](#convertattributestoelementsxml) - [Day](#day) - [Double](#double) - [Duration](#duration) @@ -547,6 +548,31 @@ Examples: - `ConvertCase(metric.name, "snake")` +### ConvertAttributesToElementsXML + +`ConvertAttributesToElementsXML(target, Optional[xpath])` + +The `ConvertAttributesToElementsXML` Converter returns an edited version of an XML string where attributes are converted into child elements. + +`target` is a Getter that returns a string. This string should be in XML format. +If `target` is not a string, nil, or cannot be parsed as XML, `ConvertAttributesToElementsXML` will return an error. + +`xpath` (optional) is a string that specifies an [XPath](https://www.w3.org/TR/1999/REC-xpath-19991116/) expression that +selects one or more elements. Attributes will only be converted within the result(s) of the xpath. + +For example, `baz` will be converted to `bazbar`. + +Examples: + +Convert all attributes in a document + +- `ConvertAttributesToElementsXML(body)` + +Convert only attributes within "Record" elements + +- `ConvertAttributesToElementsXML(body, "/Log/Record")` + + ### Day `Day(value)` diff --git a/pkg/ottl/ottlfuncs/func_convert_attributes_to_elements_xml.go b/pkg/ottl/ottlfuncs/func_convert_attributes_to_elements_xml.go new file mode 100644 index 000000000000..64d4ecc5fde5 --- /dev/null +++ b/pkg/ottl/ottlfuncs/func_convert_attributes_to_elements_xml.go @@ -0,0 +1,69 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package ottlfuncs // import "github.com/open-telemetry/opentelemetry-collector-contrib/pkg/ottl/ottlfuncs" + +import ( + "context" + "fmt" + + "github.com/antchfx/xmlquery" + + "github.com/open-telemetry/opentelemetry-collector-contrib/pkg/ottl" +) + +type ConvertAttributesToElementsXMLArguments[K any] struct { + Target ottl.StringGetter[K] + XPath ottl.Optional[string] +} + +func NewConvertAttributesToElementsXMLFactory[K any]() ottl.Factory[K] { + return ottl.NewFactory("ConvertAttributesToElementsXML", &ConvertAttributesToElementsXMLArguments[K]{}, createConvertAttributesToElementsXMLFunction[K]) +} + +func createConvertAttributesToElementsXMLFunction[K any](_ ottl.FunctionContext, oArgs ottl.Arguments) (ottl.ExprFunc[K], error) { + args, ok := oArgs.(*ConvertAttributesToElementsXMLArguments[K]) + + if !ok { + return nil, fmt.Errorf("ConvertAttributesToElementsXML args must be of type *ConvertAttributesToElementsXMLAguments[K]") + } + + xPath := args.XPath.Get() + if xPath == "" { + xPath = "//@*" // All attributes in the document + } + if err := validateXPath(xPath); err != nil { + return nil, err + } + + return convertAttributesToElementsXML(args.Target, xPath), nil +} + +// convertAttributesToElementsXML returns a string that is a result of converting all attributes of the +// target XML into child elements. These new elements are added as the last child elements of the parent. +// e.g. -> worldbar +func convertAttributesToElementsXML[K any](target ottl.StringGetter[K], xPath string) ottl.ExprFunc[K] { + return func(ctx context.Context, tCtx K) (any, error) { + var doc *xmlquery.Node + if targetVal, err := target.Get(ctx, tCtx); err != nil { + return nil, err + } else if doc, err = parseNodesXML(targetVal); err != nil { + return nil, err + } + for _, n := range xmlquery.Find(doc, xPath) { + if n.Type != xmlquery.AttributeNode { + continue + } + xmlquery.AddChild(n.Parent, &xmlquery.Node{ + Type: xmlquery.ElementNode, + Data: n.Data, + FirstChild: &xmlquery.Node{ + Type: xmlquery.TextNode, + Data: n.InnerText(), + }, + }) + n.Parent.RemoveAttr(n.Data) + } + return doc.OutputXML(false), nil + } +} diff --git a/pkg/ottl/ottlfuncs/func_convert_attributes_to_elements_xml_test.go b/pkg/ottl/ottlfuncs/func_convert_attributes_to_elements_xml_test.go new file mode 100644 index 000000000000..11bc2c5a29bd --- /dev/null +++ b/pkg/ottl/ottlfuncs/func_convert_attributes_to_elements_xml_test.go @@ -0,0 +1,126 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package ottlfuncs // import "github.com/open-telemetry/opentelemetry-collector-contrib/pkg/ottl/ottlfuncs" + +import ( + "context" + "testing" + + "github.com/stretchr/testify/assert" + + "github.com/open-telemetry/opentelemetry-collector-contrib/pkg/ottl" +) + +func Test_ConvertAttributesToElementsXML(t *testing.T) { + tests := []struct { + name string + document string + xPath string + want string + }{ + { + name: "nop", + document: ``, + want: ``, + }, + { + name: "nop declaration", + document: ``, + want: ``, + }, + { + name: "single attribute", + document: ``, + want: `bar`, + }, + { + name: "multiple attributes - order 1", + document: ``, + want: `barworld`, + }, + { + name: "multiple attributes - order 2", + document: ``, + want: `worldbar`, + }, + { + name: "with child elements", + document: ``, + want: `worldbar`, + }, + { + name: "with child value", + document: `free value`, + want: `free valueworldbar`, + }, + { + name: "with child elements and values", + document: `free value2`, + want: `free value2worldbar`, + }, + { + name: "multiple levels", + document: ``, + want: `www.example.comworldbar`, + }, + { + name: "xpath filtered", + document: ``, + xPath: "/a/b/@*", // only convert attributes of b + want: `www.example.com`, + }, + { + name: "attributes found with non-attributes xpath", + document: ``, + xPath: "/a/b", // convert b (the attributes of b, even though the element b was selected) + want: ``, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + args := &ConvertAttributesToElementsXMLArguments[any]{ + Target: ottl.StandardStringGetter[any]{ + Getter: func(_ context.Context, _ any) (any, error) { + return tt.document, nil + }, + }, + XPath: ottl.NewTestingOptional(tt.xPath), + } + exprFunc, err := createConvertAttributesToElementsXMLFunction[any](ottl.FunctionContext{}, args) + assert.NoError(t, err) + + result, err := exprFunc(context.Background(), nil) + assert.NoError(t, err) + assert.Equal(t, tt.want, result) + }) + } +} + +func TestCreateConvertAttributesToElementsXMLFunc(t *testing.T) { + factory := NewConvertAttributesToElementsXMLFactory[any]() + fCtx := ottl.FunctionContext{} + + // Invalid arg type + exprFunc, err := factory.CreateFunction(fCtx, nil) + assert.Error(t, err) + assert.Nil(t, exprFunc) + + // Invalid XPath should error on function creation + exprFunc, err = factory.CreateFunction( + fCtx, &ConvertAttributesToElementsXMLArguments[any]{ + XPath: ottl.NewTestingOptional("!"), + }) + assert.Error(t, err) + assert.Nil(t, exprFunc) + + // Invalid XML should error on function execution + exprFunc, err = factory.CreateFunction( + fCtx, &ConvertAttributesToElementsXMLArguments[any]{ + Target: invalidXMLGetter(), + }) + assert.NoError(t, err) + assert.NotNil(t, exprFunc) + _, err = exprFunc(context.Background(), nil) + assert.Error(t, err) +} diff --git a/pkg/ottl/ottlfuncs/functions.go b/pkg/ottl/ottlfuncs/functions.go index 5e3aa6741cad..b30c950ed947 100644 --- a/pkg/ottl/ottlfuncs/functions.go +++ b/pkg/ottl/ottlfuncs/functions.go @@ -40,6 +40,7 @@ func converters[K any]() []ottl.Factory[K] { NewDecodeFactory[K](), NewConcatFactory[K](), NewConvertCaseFactory[K](), + NewConvertAttributesToElementsXMLFactory[K](), NewDayFactory[K](), NewDoubleFactory[K](), NewDurationFactory[K](), From db7020c95b94a4512eb0a1ca851f7b737f43ddd6 Mon Sep 17 00:00:00 2001 From: Daniel Jaglowski Date: Thu, 10 Oct 2024 13:36:18 -0400 Subject: [PATCH 017/140] [pkg/ottl] Add ConvertTextToElementsXML Converter (#35364) This adds a converter called `ConvertTextToElementsXML `. This serves as one of the granular transformations described in https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/35281 which will allow users to migrate any arbitrary XML document into a JSON-equivalent state. Also see #35328 --- .chloggen/wrap-hanging-values-xml.yaml | 27 ++++ pkg/ottl/e2e/e2e_test.go | 12 ++ pkg/ottl/ottlfuncs/README.md | 31 +++++ .../func_convert_text_to_elements_xml.go | 107 +++++++++++++++ .../func_convert_text_to_elements_xml_test.go | 127 ++++++++++++++++++ pkg/ottl/ottlfuncs/functions.go | 1 + 6 files changed, 305 insertions(+) create mode 100644 .chloggen/wrap-hanging-values-xml.yaml create mode 100644 pkg/ottl/ottlfuncs/func_convert_text_to_elements_xml.go create mode 100644 pkg/ottl/ottlfuncs/func_convert_text_to_elements_xml_test.go diff --git a/.chloggen/wrap-hanging-values-xml.yaml b/.chloggen/wrap-hanging-values-xml.yaml new file mode 100644 index 000000000000..3b0c86fdf865 --- /dev/null +++ b/.chloggen/wrap-hanging-values-xml.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: enhancement + +# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver) +component: pkg/ottl + +# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). +note: Add ConvertTextToElements Converter + +# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists. +issues: [35364] + +# (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/pkg/ottl/e2e/e2e_test.go b/pkg/ottl/e2e/e2e_test.go index f7c3fe7324fe..dcf89bd0c5e2 100644 --- a/pkg/ottl/e2e/e2e_test.go +++ b/pkg/ottl/e2e/e2e_test.go @@ -353,6 +353,18 @@ func Test_e2e_converters(t *testing.T) { tCtx.GetLogRecord().Attributes().PutStr("test", `This is a log message!1`) }, }, + { + statement: `set(body, ConvertTextToElementsXML("foo"))`, + want: func(tCtx ottllog.TransformContext) { + tCtx.GetLogRecord().Body().SetStr("foo") + }, + }, + { + statement: `set(body, ConvertTextToElementsXML("foobar", "/a", "custom"))`, + want: func(tCtx ottllog.TransformContext) { + tCtx.GetLogRecord().Body().SetStr("foobar") + }, + }, { statement: `set(attributes["test"], Double(1.0))`, want: func(tCtx ottllog.TransformContext) { diff --git a/pkg/ottl/ottlfuncs/README.md b/pkg/ottl/ottlfuncs/README.md index 11a61d101691..6df4154bd9a9 100644 --- a/pkg/ottl/ottlfuncs/README.md +++ b/pkg/ottl/ottlfuncs/README.md @@ -414,6 +414,7 @@ Available Converters: - [Concat](#concat) - [ConvertCase](#convertcase) - [ConvertAttributesToElementsXML](#convertattributestoelementsxml) +- [ConvertTextToElementsXML](#converttexttoelementsxml) - [Day](#day) - [Double](#double) - [Duration](#duration) @@ -572,6 +573,36 @@ Convert only attributes within "Record" elements - `ConvertAttributesToElementsXML(body, "/Log/Record")` +### ConvertTextToElementsXML + +`ConvertTextToElementsXML(target, Optional[xpath], Optional[elementName])` + +The `ConvertTextToElementsXML` Converter returns an edited version of an XML string where all text belongs to a dedicated element. + +`target` is a Getter that returns a string. This string should be in XML format. +If `target` is not a string, nil, or cannot be parsed as XML, `ConvertTextToElementsXML` will return an error. + +`xpath` (optional) is a string that specifies an [XPath](https://www.w3.org/TR/1999/REC-xpath-19991116/) expression that +selects one or more elements. Content will only be converted within the result(s) of the xpath. The default is `/`. + +`elementName` (optional) is a string that is used for any element tags that are created to wrap content. +The default is `"value"`. + +For example, `foobar` will be converted to `foobar`. + +Examples: + +Ensure all text content in a document is wrapped in a dedicated element + +- `ConvertTextToElementsXML(body)` + +Use a custom name for any new elements + +- `ConvertTextToElementsXML(body, elementName = "custom")` + +Convert only part of the document + +- `ConvertTextToElementsXML(body, "/some/part/", "value")` ### Day diff --git a/pkg/ottl/ottlfuncs/func_convert_text_to_elements_xml.go b/pkg/ottl/ottlfuncs/func_convert_text_to_elements_xml.go new file mode 100644 index 000000000000..a0fb108c4069 --- /dev/null +++ b/pkg/ottl/ottlfuncs/func_convert_text_to_elements_xml.go @@ -0,0 +1,107 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package ottlfuncs // import "github.com/open-telemetry/opentelemetry-collector-contrib/pkg/ottl/ottlfuncs" + +import ( + "context" + "fmt" + + "github.com/antchfx/xmlquery" + + "github.com/open-telemetry/opentelemetry-collector-contrib/pkg/ottl" +) + +type ConvertTextToElementsXMLArguments[K any] struct { + Target ottl.StringGetter[K] + XPath ottl.Optional[string] + ElementName ottl.Optional[string] +} + +func NewConvertTextToElementsXMLFactory[K any]() ottl.Factory[K] { + return ottl.NewFactory("ConvertTextToElementsXML", &ConvertTextToElementsXMLArguments[K]{}, createConvertTextToElementsXMLFunction[K]) +} + +func createConvertTextToElementsXMLFunction[K any](_ ottl.FunctionContext, oArgs ottl.Arguments) (ottl.ExprFunc[K], error) { + args, ok := oArgs.(*ConvertTextToElementsXMLArguments[K]) + + if !ok { + return nil, fmt.Errorf("ConvertTextToElementsXML args must be of type *ConvertTextToElementsXMLAguments[K]") + } + + xPath := args.XPath.Get() + if xPath == "" { + xPath = "/" + } else if err := validateXPath(xPath); err != nil { + return nil, err + } + + elementName := args.ElementName.Get() + if elementName == "" { + elementName = "value" + } + + return convertTextToElementsXML(args.Target, xPath, elementName), nil +} + +// convertTextToElementsXML returns a string that is a result of wrapping any extraneous text nodes with a dedicated element. +func convertTextToElementsXML[K any](target ottl.StringGetter[K], xPath string, elementName string) ottl.ExprFunc[K] { + return func(ctx context.Context, tCtx K) (any, error) { + var doc *xmlquery.Node + if targetVal, err := target.Get(ctx, tCtx); err != nil { + return nil, err + } else if doc, err = parseNodesXML(targetVal); err != nil { + return nil, err + } + for _, n := range xmlquery.Find(doc, xPath) { + convertTextToElementsForNode(n, elementName) + } + return doc.OutputXML(false), nil + } +} + +func convertTextToElementsForNode(parent *xmlquery.Node, elementName string) { + switch parent.Type { + case xmlquery.ElementNode: // ok + case xmlquery.DocumentNode: // ok + default: + return + } + + if parent.FirstChild == nil { + return + } + + // Convert any child nodes and count text and element nodes. + var valueCount, elementCount int + for child := parent.FirstChild; child != nil; child = child.NextSibling { + if child.Type == xmlquery.ElementNode { + convertTextToElementsForNode(child, elementName) + elementCount++ + } else if child.Type == xmlquery.TextNode { + valueCount++ + } + } + + // If there are no values to wrap, or if there is exactly one value OR one element, this node is all set. + if valueCount == 0 || elementCount+valueCount <= 1 { + return + } + + // At this point, we either have multiple values, or a mix of values and elements. + // Either way, we need to wrap the values. + for child := parent.FirstChild; child != nil; child = child.NextSibling { + if child.Type != xmlquery.TextNode { + continue + } + newTextNode := &xmlquery.Node{ + Type: xmlquery.TextNode, + Data: child.Data, + } + // Change this node into an element + child.Type = xmlquery.ElementNode + child.Data = elementName + child.FirstChild = newTextNode + child.LastChild = newTextNode + } +} diff --git a/pkg/ottl/ottlfuncs/func_convert_text_to_elements_xml_test.go b/pkg/ottl/ottlfuncs/func_convert_text_to_elements_xml_test.go new file mode 100644 index 000000000000..7e3b10bcdf12 --- /dev/null +++ b/pkg/ottl/ottlfuncs/func_convert_text_to_elements_xml_test.go @@ -0,0 +1,127 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package ottlfuncs // import "github.com/open-telemetry/opentelemetry-collector-contrib/pkg/ottl/ottlfuncs" + +import ( + "context" + "testing" + + "github.com/stretchr/testify/assert" + + "github.com/open-telemetry/opentelemetry-collector-contrib/pkg/ottl" +) + +func Test_ConvertTextToElementsXML(t *testing.T) { + tests := []struct { + name string + document string + xPath string + elementName string + want string + }{ + { + name: "nop", + document: ``, + want: ``, + }, + { + name: "nop declaration", + document: ``, + want: ``, + }, + { + name: "nop attributes", + document: ``, + want: ``, + }, + { + name: "nop wrapped text", + document: `hello world`, + want: `hello world`, + }, + { + name: "simple hanging", + document: `foo`, + want: `foo`, + }, + { + name: "simple hanging with tag name", + elementName: "bar", + document: `foo`, + want: `foo`, + }, + { + name: "multiple hanging same level", + document: `foobar`, + want: `foobar`, + }, + { + name: "multiple hanging multiple levels", + document: `foobar1not2`, + elementName: "v", + want: `foobar1not2`, + }, + { + name: "xpath select some", + document: `foobarbaz`, + xPath: "/a/b", + want: `foobarbaz`, + }, + { + name: "xpath with element name", + document: `foobarbaz`, + xPath: "/a/b", + elementName: "V", + want: `foobarbaz`, + }, + } + factory := NewConvertTextToElementsXMLFactory[any]() + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + args := &ConvertTextToElementsXMLArguments[any]{ + Target: ottl.StandardStringGetter[any]{ + Getter: func(_ context.Context, _ any) (any, error) { + return tt.document, nil + }, + }, + XPath: ottl.NewTestingOptional(tt.xPath), + ElementName: ottl.NewTestingOptional(tt.elementName), + } + exprFunc, err := factory.CreateFunction(ottl.FunctionContext{}, args) + assert.NoError(t, err) + + result, err := exprFunc(context.Background(), nil) + assert.NoError(t, err) + assert.Equal(t, tt.want, result) + }) + } +} + +func TestCreateConvertTextToElementsXMLFunc(t *testing.T) { + factory := NewConvertTextToElementsXMLFactory[any]() + fCtx := ottl.FunctionContext{} + + // Invalid arg type + exprFunc, err := factory.CreateFunction(fCtx, nil) + assert.Error(t, err) + assert.Nil(t, exprFunc) + + // Invalid XPath should error on function creation + exprFunc, err = factory.CreateFunction( + fCtx, &ConvertTextToElementsXMLArguments[any]{ + XPath: ottl.NewTestingOptional("!"), + }) + assert.Error(t, err) + assert.Nil(t, exprFunc) + + // Invalid XML should error on function execution + exprFunc, err = factory.CreateFunction( + fCtx, &ConvertTextToElementsXMLArguments[any]{ + Target: invalidXMLGetter(), + }) + assert.NoError(t, err) + assert.NotNil(t, exprFunc) + _, err = exprFunc(context.Background(), nil) + assert.Error(t, err) +} diff --git a/pkg/ottl/ottlfuncs/functions.go b/pkg/ottl/ottlfuncs/functions.go index b30c950ed947..1e5086be59a8 100644 --- a/pkg/ottl/ottlfuncs/functions.go +++ b/pkg/ottl/ottlfuncs/functions.go @@ -41,6 +41,7 @@ func converters[K any]() []ottl.Factory[K] { NewConcatFactory[K](), NewConvertCaseFactory[K](), NewConvertAttributesToElementsXMLFactory[K](), + NewConvertTextToElementsXMLFactory[K](), NewDayFactory[K](), NewDoubleFactory[K](), NewDurationFactory[K](), From 83aa8bf38f4ab3f6e3dacffb1b49ae8e4be3f7c2 Mon Sep 17 00:00:00 2001 From: Sameer Magan Date: Thu, 10 Oct 2024 18:59:53 +0100 Subject: [PATCH 018/140] fix: update regex parsing for container logs to support windows file (#35559) seperator **Description:** This PR updates add support to parse container filepaths on windows hosts **Link to tracking Issue:** #35558 **Testing:** Additional unit test to test regex parsing for windows filepaths **Documentation:** N/A --- .chloggen/error-filelog-windows-operator.yaml | 27 ++++++++++++ .../operator/parser/container/parser.go | 2 +- .../operator/parser/container/parser_test.go | 41 +++++++++++++++++++ 3 files changed, 69 insertions(+), 1 deletion(-) create mode 100644 .chloggen/error-filelog-windows-operator.yaml diff --git a/.chloggen/error-filelog-windows-operator.yaml b/.chloggen/error-filelog-windows-operator.yaml new file mode 100644 index 000000000000..8eb79a9b6abf --- /dev/null +++ b/.chloggen/error-filelog-windows-operator.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: bug_fix + +# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver) +component: filelogreceiver + +# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). +note: Supports `add_metadata_from_filepath` for Windows filepaths + +# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists. +issues: [35558] + +# (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/pkg/stanza/operator/parser/container/parser.go b/pkg/stanza/operator/parser/container/parser.go index ebeb18644005..5c33005435f4 100644 --- a/pkg/stanza/operator/parser/container/parser.go +++ b/pkg/stanza/operator/parser/container/parser.go @@ -28,7 +28,7 @@ const recombineInternalID = "recombine_container_internal" const dockerPattern = "^\\{" const crioPattern = "^(?P