diff --git a/.chloggen/codeboten_more-scope-5.yaml b/.chloggen/codeboten_more-scope-5.yaml new file mode 100644 index 000000000000..2e8de4768bd1 --- /dev/null +++ b/.chloggen/codeboten_more-scope-5.yaml @@ -0,0 +1,27 @@ +# Use this changelog template to create an entry for release notes. + +# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' +change_type: breaking + +# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver) +component: azureeventhubreceiver + +# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). +note: "Update the scope name for telemetry produced by the azureeventhubreceiver from `otelcol/azureeventhubreceiver` to `github.com/open-telemetry/opentelemetry-collector-contrib/receiver/azureeventhubreceiver`" + +# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists. +issues: [34611] + +# (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/.chloggen/codeboten_more-scope-6.yaml b/.chloggen/codeboten_more-scope-6.yaml new file mode 100644 index 000000000000..de018774b428 --- /dev/null +++ b/.chloggen/codeboten_more-scope-6.yaml @@ -0,0 +1,27 @@ +# Use this changelog template to create an entry for release notes. + +# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' +change_type: breaking + +# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver) +component: cloudfoundryreceiver + +# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). +note: "Update the scope name for telemetry produced by the cloudfoundryreceiver from `otelcol/cloudfoundry` to `github.com/open-telemetry/opentelemetry-collector-contrib/receiver/cloudfoundryreceiver`" + +# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists. +issues: [34612] + +# (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/.chloggen/codeboten_more-scope-7.yaml b/.chloggen/codeboten_more-scope-7.yaml new file mode 100644 index 000000000000..bb0842db8cf1 --- /dev/null +++ b/.chloggen/codeboten_more-scope-7.yaml @@ -0,0 +1,27 @@ +# Use this changelog template to create an entry for release notes. + +# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' +change_type: breaking + +# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver) +component: cloudflarereceiver + +# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). +note: "Update the scope name for telemetry produced by the cloudflarereceiver from `otelcol/cloudflare` to `github.com/open-telemetry/opentelemetry-collector-contrib/receiver/cloudflarereceiver`" + +# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists. +issues: [34613] + +# (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/.chloggen/codeboten_more-scope-8.yaml b/.chloggen/codeboten_more-scope-8.yaml new file mode 100644 index 000000000000..f28120cd6aaf --- /dev/null +++ b/.chloggen/codeboten_more-scope-8.yaml @@ -0,0 +1,27 @@ +# Use this changelog template to create an entry for release notes. + +# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' +change_type: breaking + +# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver) +component: azuremonitorreceiver + +# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). +note: "Update the scope name for telemetry produced by the azuremonitorreceiver from `otelcol/azuremonitorreceiver` to `github.com/open-telemetry/opentelemetry-collector-contrib/receiver/azuremonitorreceiver`" + +# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists. +issues: [34618] + +# (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/.chloggen/codeboten_more-scope-9.yaml b/.chloggen/codeboten_more-scope-9.yaml new file mode 100644 index 000000000000..6012668b97c3 --- /dev/null +++ b/.chloggen/codeboten_more-scope-9.yaml @@ -0,0 +1,27 @@ +# Use this changelog template to create an entry for release notes. + +# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' +change_type: breaking + +# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver) +component: fileconsumer + +# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). +note: "Update the scope name for telemetry produced by pkg/stanza/fileconsumer from `otelcol/fileconsumer` to `github.com/open-telemetry/opentelemetry-collector-contrib/pkg/stanza/fileconsumer`" + +# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists. +issues: [34619] + +# (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/.chloggen/codeboten_update-scope-prometheusreceiver.yaml b/.chloggen/codeboten_update-scope-prometheusreceiver.yaml new file mode 100644 index 000000000000..2336dee9112c --- /dev/null +++ b/.chloggen/codeboten_update-scope-prometheusreceiver.yaml @@ -0,0 +1,27 @@ +# Use this changelog template to create an entry for release notes. + +# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' +change_type: breaking + +# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver) +component: prometheusreceiver + +# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). +note: "Update the scope name for telemetry produced by the prometheusreceiver from `otelcol/prometheusreceiver` to `github.com/open-telemetry/opentelemetry-collector-contrib/receiver/prometheusreceiver" + +# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists. +issues: [34589] + +# (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/.chloggen/codeboten_update-scope-snmpreceiver.yaml b/.chloggen/codeboten_update-scope-snmpreceiver.yaml new file mode 100644 index 000000000000..f98a9f3b52ad --- /dev/null +++ b/.chloggen/codeboten_update-scope-snmpreceiver.yaml @@ -0,0 +1,27 @@ +# Use this changelog template to create an entry for release notes. + +# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' +change_type: breaking + +# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver) +component: snmpreceiver + +# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). +note: "Update the scope name for telemetry produced by the snmpreceiver from `otelcol/snmpreceiver` to `github.com/open-telemetry/opentelemetry-collector-contrib/receiver/snmpreceiver" + +# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists. +issues: [34592] + +# (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/.chloggen/elasticsearchexporter_summary-support.yaml b/.chloggen/elasticsearchexporter_summary-support.yaml new file mode 100644 index 000000000000..de154f035c14 --- /dev/null +++ b/.chloggen/elasticsearchexporter_summary-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: elasticsearchexporter + +# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). +note: Add summary support for metrics + +# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists. +issues: [34560] + +# (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/.chloggen/googlecloudmonitoringreceiver-phase1.yaml b/.chloggen/googlecloudmonitoringreceiver-phase1.yaml new file mode 100644 index 000000000000..98e037e8db90 --- /dev/null +++ b/.chloggen/googlecloudmonitoringreceiver-phase1.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: googlecloudmonitoringreceiver + +# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). +note: Adding new component - [Google Cloud monitoring](https://cloud.google.com/monitoring/api/metrics_gcp) receiver to fetch GCP Cloud Metrics and transform to OpenTelemetry compatible format. + +# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists. +issues: [33762] + +# (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, api] diff --git a/.chloggen/logdedup-process-on-shutdown.yaml b/.chloggen/logdedup-process-on-shutdown.yaml new file mode 100644 index 000000000000..0b3df077bf63 --- /dev/null +++ b/.chloggen/logdedup-process-on-shutdown.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: logdedupprocessor + +# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). +note: Ensures any pending aggregated logs are processed and sent to the next consumer before shutting down. + +# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists. +issues: [34615] + +# (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/.chloggen/logdedup-scope-aggregator.yaml b/.chloggen/logdedup-scope-aggregator.yaml new file mode 100644 index 000000000000..3ec96e381a4b --- /dev/null +++ b/.chloggen/logdedup-scope-aggregator.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: logdedupprocessor + +# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). +note: Adds a scope aggregator to the logdedup processor enabling the aggregation of logs per scope. + +# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists. +issues: [34606] + +# (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/.chloggen/mo-silent_fix-34315.yaml b/.chloggen/mo-silent_fix-34315.yaml new file mode 100644 index 000000000000..bf8146fa1f3a --- /dev/null +++ b/.chloggen/mo-silent_fix-34315.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: azuremonitorreceiver + +# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). +note: Add Azure China as a `cloud` option. + +# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists. +issues: [34315] + +# (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/.chloggen/time-format-validation.yaml b/.chloggen/time-format-validation.yaml new file mode 100644 index 000000000000..a865e41754ba --- /dev/null +++ b/.chloggen/time-format-validation.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: filelogreceiver + +# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). +note: Check for unsupported fractional seconds directive when converting strptime time layout to native format + +# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists. +issues: [34390] + +# (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/.github/CODEOWNERS b/.github/CODEOWNERS index cda2bc45426d..3e7da3edf954 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -297,6 +297,7 @@ receiver/windowseventlogreceiver/ @open-teleme receiver/windowsperfcountersreceiver/ @open-telemetry/collector-contrib-approvers @dashpole @alxbl @pjanotti receiver/zipkinreceiver/ @open-telemetry/collector-contrib-approvers @MovieStoreGuy @andrzej-stencel @crobert-1 receiver/zookeeperreceiver/ @open-telemetry/collector-contrib-approvers @djaglowski +receiver/googlecloudmonitoringreceiver/ @open-telemetry/collector-contrib-approvers @dashpole @TylerHelmuth @abhishek-at-cloudwerx testbed/ @open-telemetry/collector-contrib-approvers @open-telemetry/collector-approvers testbed/mockdatasenders/mockdatadogagentexporter/ @open-telemetry/collector-contrib-approvers @boostchicken diff --git a/.github/ISSUE_TEMPLATE/bug_report.yaml b/.github/ISSUE_TEMPLATE/bug_report.yaml index 0b330f2fbae7..64313e37a7b3 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yaml +++ b/.github/ISSUE_TEMPLATE/bug_report.yaml @@ -229,6 +229,7 @@ body: - receiver/flinkmetrics - receiver/fluentforward - receiver/gitprovider + - receiver/googlecloudmonitoring - receiver/googlecloudpubsub - receiver/googlecloudspanner - receiver/haproxy diff --git a/.github/ISSUE_TEMPLATE/feature_request.yaml b/.github/ISSUE_TEMPLATE/feature_request.yaml index 289645e9eeb8..3f7041dab759 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.yaml +++ b/.github/ISSUE_TEMPLATE/feature_request.yaml @@ -223,6 +223,7 @@ body: - receiver/flinkmetrics - receiver/fluentforward - receiver/gitprovider + - receiver/googlecloudmonitoring - receiver/googlecloudpubsub - receiver/googlecloudspanner - receiver/haproxy diff --git a/.github/ISSUE_TEMPLATE/other.yaml b/.github/ISSUE_TEMPLATE/other.yaml index 58198b54296b..453af8486fb5 100644 --- a/.github/ISSUE_TEMPLATE/other.yaml +++ b/.github/ISSUE_TEMPLATE/other.yaml @@ -223,6 +223,7 @@ body: - receiver/flinkmetrics - receiver/fluentforward - receiver/gitprovider + - receiver/googlecloudmonitoring - receiver/googlecloudpubsub - receiver/googlecloudspanner - receiver/haproxy diff --git a/.github/ISSUE_TEMPLATE/unmaintained.yaml b/.github/ISSUE_TEMPLATE/unmaintained.yaml index 2d812b2c9f51..d89b2119d78e 100644 --- a/.github/ISSUE_TEMPLATE/unmaintained.yaml +++ b/.github/ISSUE_TEMPLATE/unmaintained.yaml @@ -228,6 +228,7 @@ body: - receiver/flinkmetrics - receiver/fluentforward - receiver/gitprovider + - receiver/googlecloudmonitoring - receiver/googlecloudpubsub - receiver/googlecloudspanner - receiver/haproxy diff --git a/exporter/elasticsearchexporter/exporter.go b/exporter/elasticsearchexporter/exporter.go index 49a025d6223f..bff526042b94 100644 --- a/exporter/elasticsearchexporter/exporter.go +++ b/exporter/elasticsearchexporter/exporter.go @@ -265,6 +265,16 @@ func (e *elasticsearchExporter) pushMetricsData( continue } } + case pmetric.MetricTypeSummary: + dps := metric.Summary().DataPoints() + for l := 0; l < dps.Len(); l++ { + dp := dps.At(l) + val := summaryToValue(dp) + if err := upsertDataPoint(dp, val); err != nil { + errs = append(errs, err) + continue + } + } } } } diff --git a/exporter/elasticsearchexporter/exporter_test.go b/exporter/elasticsearchexporter/exporter_test.go index 72cb2a3741e6..da922d9b39cd 100644 --- a/exporter/elasticsearchexporter/exporter_test.go +++ b/exporter/elasticsearchexporter/exporter_test.go @@ -285,6 +285,40 @@ func TestExporterLogs(t *testing.T) { rec.WaitItems(1) }) + t.Run("publish otel mapping mode", func(t *testing.T) { + rec := newBulkRecorder() + server := newESTestServer(t, func(docs []itemRequest) ([]itemResponse, error) { + rec.Record(docs) + return itemsAllOK(docs) + }) + + exporter := newTestLogsExporter(t, server.URL, func(cfg *Config) { + cfg.LogsDynamicIndex.Enabled = true + cfg.Mapping.Mode = "otel" + }) + mustSendLogs(t, exporter, newLogsWithAttributeAndResourceMap( + map[string]string{ + "data_stream.dataset": "attr.dataset", + "attr.foo": "attr.foo.value", + }, + map[string]string{ + "data_stream.dataset": "resource.attribute.dataset", + "data_stream.namespace": "resource.attribute.namespace", + "resource.attr.foo": "resource.attr.foo.value", + }, + )) + rec.WaitItems(1) + + expected := []itemRequest{ + { + Action: []byte(`{"create":{"_index":"logs-attr.dataset.otel-resource.attribute.namespace"}}`), + Document: []byte(`{"@timestamp":"1970-01-01T00:00:00.000000000Z","attributes":{"attr.foo":"attr.foo.value"},"data_stream":{"dataset":"attr.dataset.otel","namespace":"resource.attribute.namespace","type":"logs"},"dropped_attributes_count":0,"observed_timestamp":"1970-01-01T00:00:00.000000000Z","resource":{"attributes":{"resource.attr.foo":"resource.attr.foo.value"},"dropped_attributes_count":0,"schema_url":""},"severity_number":0,"trace_flags":0}`), + }, + } + + assertItemsEqual(t, expected, rec.Items(), false) + }) + t.Run("retry http request", func(t *testing.T) { failures := 0 rec := newBulkRecorder() @@ -732,6 +766,50 @@ func TestExporterMetrics(t *testing.T) { assertItemsEqual(t, expected, rec.Items(), false) }) + + t.Run("publish summary", func(t *testing.T) { + rec := newBulkRecorder() + server := newESTestServer(t, func(docs []itemRequest) ([]itemResponse, error) { + rec.Record(docs) + return itemsAllOK(docs) + }) + + exporter := newTestMetricsExporter(t, server.URL, func(cfg *Config) { + cfg.Mapping.Mode = "ecs" + }) + + metrics := pmetric.NewMetrics() + resourceMetrics := metrics.ResourceMetrics().AppendEmpty() + scopeA := resourceMetrics.ScopeMetrics().AppendEmpty() + metricSlice := scopeA.Metrics() + fooMetric := metricSlice.AppendEmpty() + fooMetric.SetName("metric.foo") + fooDps := fooMetric.SetEmptySummary().DataPoints() + fooDp := fooDps.AppendEmpty() + fooDp.SetSum(1.5) + fooDp.SetCount(1) + fooOtherDp := fooDps.AppendEmpty() + fooOtherDp.SetTimestamp(pcommon.NewTimestampFromTime(time.Unix(3600, 0))) + fooOtherDp.SetSum(2) + fooOtherDp.SetCount(3) + + mustSendMetrics(t, exporter, metrics) + + rec.WaitItems(2) + + expected := []itemRequest{ + { + Action: []byte(`{"create":{"_index":"metrics-generic-default"}}`), + Document: []byte(`{"@timestamp":"1970-01-01T00:00:00.000000000Z","data_stream":{"dataset":"generic","namespace":"default","type":"metrics"},"metric":{"foo":{"sum":1.5,"value_count":1}}}`), + }, + { + Action: []byte(`{"create":{"_index":"metrics-generic-default"}}`), + Document: []byte(`{"@timestamp":"1970-01-01T01:00:00.000000000Z","data_stream":{"dataset":"generic","namespace":"default","type":"metrics"},"metric":{"foo":{"sum":2,"value_count":3}}}`), + }, + } + + assertItemsEqual(t, expected, rec.Items(), false) + }) } func TestExporterTraces(t *testing.T) { diff --git a/exporter/elasticsearchexporter/internal/objmodel/objmodel.go b/exporter/elasticsearchexporter/internal/objmodel/objmodel.go index dda38a0fe84c..1aa67c2d78e6 100644 --- a/exporter/elasticsearchexporter/internal/objmodel/objmodel.go +++ b/exporter/elasticsearchexporter/internal/objmodel/objmodel.go @@ -283,11 +283,16 @@ func (doc *Document) iterJSONFlat(w *json.Visitor, otel bool) error { return nil } -// Set of prefixes for the OTel attributes that needs to stay flattened +// Under OTel mode, set of key prefixes where keys should be flattened from that level, +// such that a document (root or not) with fields {"attributes.a.b": 1} will be serialized as {"attributes": {"a.b": 1}} +// It is not aware of whether it is a root document or sub-document. +// NOTE: This works very delicately with the implementation of OTel mode that +// e.g. resource.attributes is a "resource" objmodel.Document under the root document that contains attributes +// added using AddAttributes func as flattened keys. +// Therefore, there will be correctness issues when attributes are added / used in other ways, but it is working +// for current use cases and the proper fix will be slightly too complex. YAGNI. var otelPrefixSet = map[string]struct{}{ - "attributes.": {}, - "resource.attributes.": {}, - "scope.attributes.": {}, + "attributes.": {}, } func (doc *Document) iterJSONDedot(w *json.Visitor, otel bool) error { diff --git a/exporter/elasticsearchexporter/internal/objmodel/objmodel_test.go b/exporter/elasticsearchexporter/internal/objmodel/objmodel_test.go index e67dfa43cf56..50a7064d8fe2 100644 --- a/exporter/elasticsearchexporter/internal/objmodel/objmodel_test.go +++ b/exporter/elasticsearchexporter/internal/objmodel/objmodel_test.go @@ -353,42 +353,6 @@ func TestDocument_Serialize_Dedot(t *testing.T) { } } -func TestDocument_Serialize_Otel(t *testing.T) { - tests := map[string]struct { - attrs map[string]any - want string - }{ - "otel": { - attrs: map[string]any{ - "@timestamp": "2024-03-18T21:09:53.645578000Z", - "attributes.auditd.log.op": "PAM:session_open", - "attributes.auditd.log.record_type": "USER_START", - "attributes.auditd.log.sequence": 6082, - "attributes.auditd.log.subj": "unconfined", - "attributes.auditd.log.uid": "1000", - "scope.attributes.bar.one": "boo", - "scope.attributes.foo.two": "bar", - "resource.attributes.blah.num": 234, - "resource.attributes.blah.str": "something", - }, - want: `{"@timestamp":"2024-03-18T21:09:53.645578000Z","attributes":{"auditd.log.op":"PAM:session_open","auditd.log.record_type":"USER_START","auditd.log.sequence":6082,"auditd.log.subj":"unconfined","auditd.log.uid":"1000"},"resource":{"attributes":{"blah.num":234,"blah.str":"something"}},"scope":{"attributes":{"bar.one":"boo","foo.two":"bar"}}}`, - }, - } - - for name, test := range tests { - t.Run(name, func(t *testing.T) { - var buf strings.Builder - m := pcommon.NewMap() - assert.NoError(t, m.FromRaw(test.attrs)) - doc := DocumentFromAttributes(m) - doc.Dedup() // Call Dedup for predictable order - err := doc.Serialize(&buf, true, true) - require.NoError(t, err) - assert.Equal(t, test.want, buf.String()) - }) - } -} - func TestValue_Serialize(t *testing.T) { tests := map[string]struct { value Value diff --git a/exporter/elasticsearchexporter/model.go b/exporter/elasticsearchexporter/model.go index 3eb7ee934b10..ebb44d7850d0 100644 --- a/exporter/elasticsearchexporter/model.go +++ b/exporter/elasticsearchexporter/model.go @@ -321,6 +321,16 @@ func (m *encodeModel) upsertMetricDataPointValue(documents map[uint32]objmodel.D return nil } +func summaryToValue(dp pmetric.SummaryDataPoint) pcommon.Value { + // TODO: Add support for quantiles + // https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/34561 + vm := pcommon.NewValueMap() + m := vm.Map() + m.PutDouble("sum", dp.Sum()) + m.PutInt("value_count", int64(dp.Count())) + return vm +} + func histogramToValue(dp pmetric.HistogramDataPoint) (pcommon.Value, error) { // Histogram conversion function is from // https://github.com/elastic/apm-data/blob/3b28495c3cbdc0902983134276eb114231730249/input/otlp/metrics.go#L277 diff --git a/exporter/elasticsearchexporter/utils_test.go b/exporter/elasticsearchexporter/utils_test.go index e2c55a47609a..ca73aaddf844 100644 --- a/exporter/elasticsearchexporter/utils_test.go +++ b/exporter/elasticsearchexporter/utils_test.go @@ -36,7 +36,7 @@ func itemRequestsSortFunc(a, b itemRequest) int { return comp } -func assertItemsEqual(t *testing.T, expected, actual []itemRequest, assertOrder bool) { +func assertItemsEqual(t *testing.T, expected, actual []itemRequest, assertOrder bool) { // nolint:unparam expectedItems := expected actualItems := actual if !assertOrder { diff --git a/internal/coreinternal/timeutils/internal/ctimefmt/ctimefmt.go b/internal/coreinternal/timeutils/internal/ctimefmt/ctimefmt.go index 52170879a57b..921ebdc8c3c1 100644 --- a/internal/coreinternal/timeutils/internal/ctimefmt/ctimefmt.go +++ b/internal/coreinternal/timeutils/internal/ctimefmt/ctimefmt.go @@ -17,6 +17,7 @@ import ( ) var ctimeRegexp = regexp.MustCompile(`%.`) +var invalidFractionalSecondsStrptime = regexp.MustCompile(`[^.,]%[Lfs]`) var decimalsRegexp = regexp.MustCompile(`\d`) var ctimeSubstitutes = map[string]string{ @@ -121,10 +122,6 @@ func Parse(format, value string) (time.Time, error) { // ToNative converts ctime-like format string to Go native layout // (which is used by time.Time.Format() and time.Parse() functions). func ToNative(format string) (string, error) { - if match := decimalsRegexp.FindString(format); match != "" { - return "", errors.New("format string should not contain decimals") - } - var errs []error replaceFunc := func(directive string) string { if subst, ok := ctimeSubstitutes[directive]; ok { @@ -141,3 +138,26 @@ func ToNative(format string) (string, error) { return replaced, nil } + +func Validate(format string) error { + if match := decimalsRegexp.FindString(format); match != "" { + return errors.New("format string should not contain decimals") + } + + if match := invalidFractionalSecondsStrptime.FindString(format); match != "" { + return fmt.Errorf("invalid fractional seconds directive: '%s'. must be preceded with '.' or ','", match) + } + + directives := ctimeRegexp.FindAllString(format, -1) + + var errs []error + for _, directive := range directives { + if _, ok := ctimeSubstitutes[directive]; !ok { + errs = append(errs, errors.New("unsupported ctimefmt.ToNative() directive: "+directive)) + } + } + if len(errs) != 0 { + return fmt.Errorf("invalid strptime format: %v", errs) + } + return nil +} diff --git a/internal/coreinternal/timeutils/internal/ctimefmt/ctimefmt_test.go b/internal/coreinternal/timeutils/internal/ctimefmt/ctimefmt_test.go index 182b1dd4a9e1..6605ec424d24 100644 --- a/internal/coreinternal/timeutils/internal/ctimefmt/ctimefmt_test.go +++ b/internal/coreinternal/timeutils/internal/ctimefmt/ctimefmt_test.go @@ -12,6 +12,8 @@ package ctimefmt import ( "testing" "time" + + "github.com/stretchr/testify/require" ) var format1 = "%Y-%m-%d %H:%M:%S.%f" @@ -76,3 +78,54 @@ func TestZulu(t *testing.T) { }) } } + +func TestValidate(t *testing.T) { + type args struct { + layout string + } + tests := []struct { + name string + args args + wantErr string + }{ + { + name: "valid format", + args: args{ + layout: "%Y-%m-%d %H:%M:%S.%f", + }, + wantErr: "", + }, + { + name: "invalid fractional second", + args: args{ + layout: "%Y-%m-%d-%H-%M-%S:%L", + }, + wantErr: "invalid fractional seconds directive: ':%L'. must be preceded with '.' or ','", + }, + { + name: "format including decimal", + args: args{ + layout: "2006-%m-%d-%H-%M-%S:%L", + }, + wantErr: "format string should not contain decimals", + }, + { + name: "unsupported directive", + args: args{ + layout: "%C-%m-%d-%H-%M-%S.%L", + }, + wantErr: "invalid strptime format: [unsupported ctimefmt.ToNative() directive: %C]", + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + err := Validate(tt.args.layout) + + if tt.wantErr != "" { + require.ErrorContains(t, err, tt.wantErr) + } else { + require.NoError(t, err) + } + }) + } +} diff --git a/internal/coreinternal/timeutils/parser.go b/internal/coreinternal/timeutils/parser.go index 8af480096f2d..f518f307e515 100644 --- a/internal/coreinternal/timeutils/parser.go +++ b/internal/coreinternal/timeutils/parser.go @@ -5,12 +5,15 @@ package timeutils // import "github.com/open-telemetry/opentelemetry-collector-c import ( "fmt" + "regexp" "strings" "time" strptime "github.com/open-telemetry/opentelemetry-collector-contrib/internal/coreinternal/timeutils/internal/ctimefmt" ) +var invalidFractionalSecondsGoTime = regexp.MustCompile(`[^.,9]9+`) + func StrptimeToGotime(layout string) (string, error) { return strptime.ToNative(layout) } @@ -104,5 +107,19 @@ func SetTimestampYear(t time.Time) time.Time { return d } +// ValidateStrptime checks the given strptime layout and returns an error if it detects any known issues +// that prevent it from being parsed. +func ValidateStrptime(layout string) error { + return strptime.Validate(layout) +} + +func ValidateGotime(layout string) error { + if match := invalidFractionalSecondsGoTime.FindString(layout); match != "" { + return fmt.Errorf("invalid fractional seconds directive: '%s'. must be preceded with '.' or ','", match) + } + + return nil +} + // Allows tests to override with deterministic value var Now = time.Now diff --git a/internal/coreinternal/timeutils/parser_test.go b/internal/coreinternal/timeutils/parser_test.go index 7427a2e34d65..77333ff22afb 100644 --- a/internal/coreinternal/timeutils/parser_test.go +++ b/internal/coreinternal/timeutils/parser_test.go @@ -61,3 +61,47 @@ func Test_setTimestampYear(t *testing.T) { require.Equal(t, expected, yearAdded) }) } + +func TestValidateGotime(t *testing.T) { + type args struct { + layout string + } + tests := []struct { + name string + args args + wantErr string + }{ + { + name: "valid format", + args: args{ + layout: "2006-01-02 15:04:05.999999", + }, + wantErr: "", + }, + { + name: "valid format 2", + args: args{ + layout: "2006-01-02 15:04:05,999999", + }, + wantErr: "", + }, + { + name: "invalid fractional second", + args: args{ + layout: "2006-01-02 15:04:05:999999", + }, + wantErr: "invalid fractional seconds directive: ':999999'. must be preceded with '.' or ','", + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + err := ValidateGotime(tt.args.layout) + + if tt.wantErr != "" { + require.ErrorContains(t, err, tt.wantErr) + } else { + require.NoError(t, err) + } + }) + } +} diff --git a/pkg/pdatautil/hash.go b/pkg/pdatautil/hash.go index 6826de769b89..172789c607bf 100644 --- a/pkg/pdatautil/hash.go +++ b/pkg/pdatautil/hash.go @@ -31,6 +31,31 @@ var ( emptyHash = [16]byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} ) +// HashOption is a function that sets an option on the hash calculation. +type HashOption func(*hashWriter) + +// WithMap adds a map to the hash calculation. +func WithMap(m pcommon.Map) HashOption { + return func(hw *hashWriter) { + hw.writeMapHash(m) + } +} + +// WithValue adds a value to the hash calculation. +func WithValue(v pcommon.Value) HashOption { + return func(hw *hashWriter) { + hw.writeValueHash(v) + } +} + +// WithString adds a string to the hash calculation. +func WithString(s string) HashOption { + return func(hw *hashWriter) { + hw.byteBuf = append(hw.byteBuf, valStrPrefix...) + hw.byteBuf = append(hw.byteBuf, s...) + } +} + type hashWriter struct { byteBuf []byte keysBuf []string @@ -47,6 +72,29 @@ var hashWriterPool = &sync.Pool{ New: func() any { return newHashWriter() }, } +// Hash generates a hash for the provided options and returns the computed hash as a [16]byte. +func Hash(opts ...HashOption) [16]byte { + if len(opts) == 0 { + return emptyHash + } + + hw := hashWriterPool.Get().(*hashWriter) + defer hashWriterPool.Put(hw) + hw.byteBuf = hw.byteBuf[:0] + + for _, o := range opts { + o(hw) + } + + return hw.hashSum128() +} + +// Hash64 generates a hash for the provided options and returns the computed hash as a uint64. +func Hash64(opts ...HashOption) uint64 { + hash := Hash(opts...) + return xxhash.Sum64(hash[:]) +} + // MapHash return a hash for the provided map. // Maps with the same underlying key/value pairs in different order produce the same deterministic hash value. func MapHash(m pcommon.Map) [16]byte { @@ -105,8 +153,7 @@ func (hw *hashWriter) writeMapHash(m pcommon.Map) { func (hw *hashWriter) writeValueHash(v pcommon.Value) { switch v.Type() { case pcommon.ValueTypeStr: - hw.byteBuf = append(hw.byteBuf, valStrPrefix...) - hw.byteBuf = append(hw.byteBuf, v.Str()...) + hw.writeString(v.Str()) case pcommon.ValueTypeBool: if v.Bool() { hw.byteBuf = append(hw.byteBuf, valBoolTrue...) @@ -138,6 +185,11 @@ func (hw *hashWriter) writeValueHash(v pcommon.Value) { } } +func (hw *hashWriter) writeString(s string) { + hw.byteBuf = append(hw.byteBuf, valStrPrefix...) + hw.byteBuf = append(hw.byteBuf, s...) +} + // hashSum128 returns a [16]byte hash sum. func (hw *hashWriter) hashSum128() [16]byte { r := [16]byte{} diff --git a/pkg/stanza/fileconsumer/internal/metadata/generated_telemetry.go b/pkg/stanza/fileconsumer/internal/metadata/generated_telemetry.go index 94d0af873337..e30a191336ae 100644 --- a/pkg/stanza/fileconsumer/internal/metadata/generated_telemetry.go +++ b/pkg/stanza/fileconsumer/internal/metadata/generated_telemetry.go @@ -14,11 +14,11 @@ import ( ) func Meter(settings component.TelemetrySettings) metric.Meter { - return settings.MeterProvider.Meter("otelcol/fileconsumer") + return settings.MeterProvider.Meter("github.com/open-telemetry/opentelemetry-collector-contrib/pkg/stanza/fileconsumer") } func Tracer(settings component.TelemetrySettings) trace.Tracer { - return settings.TracerProvider.Tracer("otelcol/fileconsumer") + return settings.TracerProvider.Tracer("github.com/open-telemetry/opentelemetry-collector-contrib/pkg/stanza/fileconsumer") } // TelemetryBuilder provides an interface for components to report telemetry diff --git a/pkg/stanza/fileconsumer/internal/metadata/generated_telemetry_test.go b/pkg/stanza/fileconsumer/internal/metadata/generated_telemetry_test.go index 1517f672ddd7..26a05ef91d8b 100644 --- a/pkg/stanza/fileconsumer/internal/metadata/generated_telemetry_test.go +++ b/pkg/stanza/fileconsumer/internal/metadata/generated_telemetry_test.go @@ -49,14 +49,14 @@ func TestProviders(t *testing.T) { meter := Meter(set) if m, ok := meter.(mockMeter); ok { - require.Equal(t, "otelcol/fileconsumer", m.name) + require.Equal(t, "github.com/open-telemetry/opentelemetry-collector-contrib/pkg/stanza/fileconsumer", m.name) } else { require.Fail(t, "returned Meter not mockMeter") } tracer := Tracer(set) if m, ok := tracer.(mockTracer); ok { - require.Equal(t, "otelcol/fileconsumer", m.name) + require.Equal(t, "github.com/open-telemetry/opentelemetry-collector-contrib/pkg/stanza/fileconsumer", m.name) } else { require.Fail(t, "returned Meter not mockTracer") } diff --git a/pkg/stanza/fileconsumer/metadata.yaml b/pkg/stanza/fileconsumer/metadata.yaml index d17aa17c4008..0f02e2f9e387 100644 --- a/pkg/stanza/fileconsumer/metadata.yaml +++ b/pkg/stanza/fileconsumer/metadata.yaml @@ -1,5 +1,4 @@ type: fileconsumer -scope_name: otelcol/fileconsumer status: class: pkg diff --git a/pkg/stanza/operator/helper/time.go b/pkg/stanza/operator/helper/time.go index bee6adbc29be..753eb79159b4 100644 --- a/pkg/stanza/operator/helper/time.go +++ b/pkg/stanza/operator/helper/time.go @@ -73,8 +73,15 @@ func (t *TimeParser) Validate() error { } switch t.LayoutType { - case NativeKey, GotimeKey: // ok + case NativeKey: // ok + case GotimeKey: + if err := timeutils.ValidateGotime(t.Layout); err != nil { + return errors.Wrap(err, "invalid gotime layout") + } case StrptimeKey: + if err := timeutils.ValidateStrptime(t.Layout); err != nil { + return errors.Wrap(err, "invalid strptime layout") + } var err error t.Layout, err = timeutils.StrptimeToGotime(t.Layout) if err != nil { diff --git a/processor/logdedupprocessor/counter.go b/processor/logdedupprocessor/counter.go index c3a26baa789e..d69723e8fac0 100644 --- a/processor/logdedupprocessor/counter.go +++ b/processor/logdedupprocessor/counter.go @@ -4,7 +4,6 @@ package logdedupprocessor // import "github.com/open-telemetry/opentelemetry-collector-contrib/processor/logdedupprocessor" import ( - "hash/fnv" "time" "go.opentelemetry.io/collector/pdata/pcommon" @@ -24,16 +23,15 @@ var timeNow = time.Now // logAggregator tracks the number of times a specific logRecord has been seen. type logAggregator struct { - resources map[[16]byte]*resourceAggregator + resources map[uint64]*resourceAggregator logCountAttribute string timezone *time.Location } // newLogAggregator creates a new LogCounter. func newLogAggregator(logCountAttribute string, timezone *time.Location) *logAggregator { - return &logAggregator{ - resources: make(map[[16]byte]*resourceAggregator), + resources: make(map[uint64]*resourceAggregator), logCountAttribute: logCountAttribute, timezone: timezone, } @@ -43,37 +41,30 @@ func newLogAggregator(logCountAttribute string, timezone *time.Location) *logAgg func (l *logAggregator) Export() plog.Logs { logs := plog.NewLogs() - for _, resource := range l.resources { - resourceLogs := logs.ResourceLogs().AppendEmpty() - resourceAttrs := resourceLogs.Resource().Attributes() - resourceAttrs.EnsureCapacity(resourceAttrs.Len()) - resource.attributes.CopyTo(resourceAttrs) - - scopeLogs := resourceLogs.ScopeLogs().AppendEmpty() - for _, lc := range resource.logCounters { - lr := scopeLogs.LogRecords().AppendEmpty() - - baseRecord := lc.logRecord - - // Copy contents of base record - baseRecord.SetObservedTimestamp(pcommon.NewTimestampFromTime(lc.firstObservedTimestamp)) - baseRecord.Body().CopyTo(lr.Body()) - - lr.Attributes().EnsureCapacity(baseRecord.Attributes().Len()) - baseRecord.Attributes().CopyTo(lr.Attributes()) - - lr.SetSeverityNumber(baseRecord.SeverityNumber()) - lr.SetSeverityText(baseRecord.SeverityText()) - - // Add attributes for log count and timestamps - lr.SetObservedTimestamp(pcommon.NewTimestampFromTime(lc.firstObservedTimestamp)) - lr.SetTimestamp(pcommon.NewTimestampFromTime(timeNow())) - lr.Attributes().PutInt(l.logCountAttribute, lc.count) - - firstTimestampStr := lc.firstObservedTimestamp.In(l.timezone).Format(time.RFC3339) - lastTimestampStr := lc.lastObservedTimestamp.In(l.timezone).Format(time.RFC3339) - lr.Attributes().PutStr(firstObservedTSAttr, firstTimestampStr) - lr.Attributes().PutStr(lastObservedTSAttr, lastTimestampStr) + for _, resourceAggregator := range l.resources { + rl := logs.ResourceLogs().AppendEmpty() + resourceAggregator.resource.CopyTo(rl.Resource()) + + for _, scopeAggregator := range resourceAggregator.scopeCounters { + sl := rl.ScopeLogs().AppendEmpty() + scopeAggregator.scope.CopyTo(sl.Scope()) + + for _, logAggregator := range scopeAggregator.logCounters { + lr := sl.LogRecords().AppendEmpty() + logAggregator.logRecord.CopyTo(lr) + + // Set log record timestamps + lr.SetTimestamp(pcommon.NewTimestampFromTime(timeNow())) + lr.SetObservedTimestamp(pcommon.NewTimestampFromTime(logAggregator.firstObservedTimestamp)) + + // Add attributes for log count and first/last observed timestamps + lr.Attributes().EnsureCapacity(lr.Attributes().Len() + 3) + lr.Attributes().PutInt(l.logCountAttribute, logAggregator.count) + firstTimestampStr := logAggregator.firstObservedTimestamp.In(l.timezone).Format(time.RFC3339) + lr.Attributes().PutStr(firstObservedTSAttr, firstTimestampStr) + lastTimestampStr := logAggregator.lastObservedTimestamp.In(l.timezone).Format(time.RFC3339) + lr.Attributes().PutStr(lastObservedTSAttr, lastTimestampStr) + } } } @@ -81,42 +72,67 @@ func (l *logAggregator) Export() plog.Logs { } // Add adds the logRecord to the resource aggregator that is identified by the resource attributes -func (l *logAggregator) Add(resourceKey [16]byte, resourceAttrs pcommon.Map, logRecord plog.LogRecord) { - resourceCounter, ok := l.resources[resourceKey] +func (l *logAggregator) Add(resource pcommon.Resource, scope pcommon.InstrumentationScope, logRecord plog.LogRecord) { + key := getResourceKey(resource) + resourceAggregator, ok := l.resources[key] if !ok { - resourceCounter = newResourceAggregator(resourceAttrs) - l.resources[resourceKey] = resourceCounter + resourceAggregator = newResourceAggregator(resource) + l.resources[key] = resourceAggregator } - - resourceCounter.Add(logRecord) + resourceAggregator.Add(scope, logRecord) } // Reset resets the counter. func (l *logAggregator) Reset() { - l.resources = make(map[[16]byte]*resourceAggregator) + l.resources = make(map[uint64]*resourceAggregator) } // resourceAggregator dimensions the counter by resource. type resourceAggregator struct { - attributes pcommon.Map - logCounters map[[8]byte]*logCounter + resource pcommon.Resource + scopeCounters map[uint64]*scopeAggregator } // newResourceAggregator creates a new ResourceCounter. -func newResourceAggregator(attributes pcommon.Map) *resourceAggregator { +func newResourceAggregator(resource pcommon.Resource) *resourceAggregator { return &resourceAggregator{ - attributes: attributes, - logCounters: make(map[[8]byte]*logCounter), + resource: resource, + scopeCounters: make(map[uint64]*scopeAggregator), } } // Add increments the counter that the logRecord matches. -func (r *resourceAggregator) Add(logRecord plog.LogRecord) { +func (r *resourceAggregator) Add(scope pcommon.InstrumentationScope, logRecord plog.LogRecord) { + key := getScopeKey(scope) + scopeAggregator, ok := r.scopeCounters[key] + if !ok { + scopeAggregator = newScopeAggregator(scope) + r.scopeCounters[key] = scopeAggregator + } + scopeAggregator.Add(logRecord) +} + +// scopeAggregator dimensions the counter by scope. +type scopeAggregator struct { + scope pcommon.InstrumentationScope + logCounters map[uint64]*logCounter +} + +// newScopeAggregator creates a new ScopeCounter. +func newScopeAggregator(scope pcommon.InstrumentationScope) *scopeAggregator { + return &scopeAggregator{ + scope: scope, + logCounters: make(map[uint64]*logCounter), + } +} + +// Add increments the counter that the logRecord matches. +func (s *scopeAggregator) Add(logRecord plog.LogRecord) { key := getLogKey(logRecord) - lc, ok := r.logCounters[key] + lc, ok := s.logCounters[key] if !ok { lc = newLogCounter(logRecord) - r.logCounters[key] = lc + s.logCounters[key] = lc } lc.Increment() } @@ -135,6 +151,7 @@ func newLogCounter(logRecord plog.LogRecord) *logCounter { logRecord: logRecord, count: 0, firstObservedTimestamp: timeNow().UTC(), + lastObservedTimestamp: timeNow().UTC(), } } @@ -144,21 +161,28 @@ func (a *logCounter) Increment() { a.count++ } +// getResourceKey creates a unique hash for the resource to use as a map key +func getResourceKey(resource pcommon.Resource) uint64 { + return pdatautil.Hash64( + pdatautil.WithMap(resource.Attributes()), + ) +} + +// getScopeKey creates a unique hash for the scope to use as a map key +func getScopeKey(scope pcommon.InstrumentationScope) uint64 { + return pdatautil.Hash64( + pdatautil.WithMap(scope.Attributes()), + pdatautil.WithString(scope.Name()), + pdatautil.WithString(scope.Version()), + ) +} + // getLogKey creates a unique hash for the log record to use as a map key -/* #nosec G104 -- According to Hash interface write can never return an error */ -func getLogKey(logRecord plog.LogRecord) [8]byte { - hasher := fnv.New64() - attrHash := pdatautil.MapHash(logRecord.Attributes()) - - hasher.Write(attrHash[:]) - bodyHash := pdatautil.ValueHash(logRecord.Body()) - hasher.Write(bodyHash[:]) - hasher.Write([]byte(logRecord.SeverityNumber().String())) - hasher.Write([]byte(logRecord.SeverityText())) - hash := hasher.Sum(nil) - - // convert from slice to fixed size array to use as key - var key [8]byte - copy(key[:], hash) - return key +func getLogKey(logRecord plog.LogRecord) uint64 { + return pdatautil.Hash64( + pdatautil.WithMap(logRecord.Attributes()), + pdatautil.WithValue(logRecord.Body()), + pdatautil.WithString(logRecord.SeverityNumber().String()), + pdatautil.WithString(logRecord.SeverityText()), + ) } diff --git a/processor/logdedupprocessor/counter_test.go b/processor/logdedupprocessor/counter_test.go index 9e59fb50849f..c7e0438584c6 100644 --- a/processor/logdedupprocessor/counter_test.go +++ b/processor/logdedupprocessor/counter_test.go @@ -37,23 +37,31 @@ func Test_logAggregatorAdd(t *testing.T) { // Setup aggregator aggregator := newLogAggregator("log_count", time.UTC) logRecord := plog.NewLogRecord() - resourceAttrs := pcommon.NewMap() - resourceAttrs.PutStr("one", "two") - expectedResourceKey := pdatautil.MapHash(resourceAttrs) + resource := pcommon.NewResource() + resource.Attributes().PutStr("one", "two") + + scope := pcommon.NewInstrumentationScope() + + expectedResourceKey := getResourceKey(resource) + expectedScopeKey := getScopeKey(scope) expectedLogKey := getLogKey(logRecord) // Add logRecord - resourceKey := pdatautil.MapHash(resourceAttrs) - aggregator.Add(resourceKey, resourceAttrs, logRecord) + aggregator.Add(resource, scope, logRecord) // Check resourceCounter was set resourceCounter, ok := aggregator.resources[expectedResourceKey] require.True(t, ok) - require.Equal(t, resourceAttrs, resourceCounter.attributes) + require.Equal(t, resource, resourceCounter.resource) + + // check scopeCounter was set + scopeCounter, ok := resourceCounter.scopeCounters[expectedScopeKey] + require.True(t, ok) + require.Equal(t, scope, scopeCounter.scope) // Check logCounter was set - lc, ok := resourceCounter.logCounters[expectedLogKey] + lc, ok := scopeCounter.logCounters[expectedLogKey] require.True(t, ok) // Check fields on logCounter @@ -68,7 +76,7 @@ func Test_logAggregatorAdd(t *testing.T) { return secondExpectedTimestamp } - aggregator.Add(resourceKey, resourceAttrs, logRecord) + aggregator.Add(resource, scope, logRecord) require.Equal(t, int64(2), lc.count) require.Equal(t, secondExpectedTimestamp, lc.lastObservedTimestamp) } @@ -76,10 +84,10 @@ func Test_logAggregatorAdd(t *testing.T) { func Test_logAggregatorReset(t *testing.T) { aggregator := newLogAggregator("log_count", time.UTC) for i := 0; i < 2; i++ { - resourceAttrs := pcommon.NewMap() - resourceAttrs.PutInt("i", int64(i)) - key := pdatautil.MapHash(resourceAttrs) - aggregator.resources[key] = newResourceAggregator(resourceAttrs) + resource := pcommon.NewResource() + resource.Attributes().PutInt("i", int64(i)) + key := getResourceKey(resource) + aggregator.resources[key] = newResourceAggregator(resource) } require.Len(t, aggregator.resources, 2) @@ -108,15 +116,16 @@ func Test_logAggregatorExport(t *testing.T) { // Setup aggregator aggregator := newLogAggregator(defaultLogCountAttribute, location) - resourceAttrs := pcommon.NewMap() - resourceAttrs.PutStr("one", "two") - expectedHash := pdatautil.MapHash(resourceAttrs) + resource := pcommon.NewResource() + resource.Attributes().PutStr("one", "two") + expectedHash := pdatautil.MapHash(resource.Attributes()) + + scope := pcommon.NewInstrumentationScope() logRecord := generateTestLogRecord(t, "body string") // Add logRecord - resourceKey := pdatautil.MapHash(resourceAttrs) - aggregator.Add(resourceKey, resourceAttrs, logRecord) + aggregator.Add(resource, scope, logRecord) exportedLogs := aggregator.Export() require.Equal(t, 1, exportedLogs.LogRecordCount()) @@ -163,18 +172,57 @@ func Test_logAggregatorExport(t *testing.T) { } func Test_newResourceAggregator(t *testing.T) { - attributes := pcommon.NewMap() - attributes.PutStr("one", "two") - aggregator := newResourceAggregator(attributes) - require.NotNil(t, aggregator.logCounters) - require.Equal(t, attributes, aggregator.attributes) + resource := pcommon.NewResource() + resource.Attributes().PutStr("one", "two") + aggregator := newResourceAggregator(resource) + require.NotNil(t, aggregator.scopeCounters) + require.Equal(t, resource, aggregator.resource) +} + +func Test_newScopeCounter(t *testing.T) { + scope := pcommon.NewInstrumentationScope() + scope.Attributes().PutStr("one", "two") + sc := newScopeAggregator(scope) + require.Equal(t, scope, sc.scope) + require.NotNil(t, sc.logCounters) } func Test_newLogCounter(t *testing.T) { + oldTimeNow := timeNow + defer func() { + timeNow = oldTimeNow + }() + + now := time.Now().UTC() + timeNow = func() time.Time { return now } logRecord := plog.NewLogRecord() lc := newLogCounter(logRecord) require.Equal(t, logRecord, lc.logRecord) require.Equal(t, int64(0), lc.count) + require.Equal(t, now, lc.firstObservedTimestamp) + require.Equal(t, now, lc.lastObservedTimestamp) +} + +func Test_logCounterIncrement(t *testing.T) { + oldTimeNow := timeNow + defer func() { + timeNow = oldTimeNow + }() + + first := time.Now().UTC() + timeNow = func() time.Time { return first } + logRecord := plog.NewLogRecord() + lc := newLogCounter(logRecord) + require.Equal(t, logRecord, lc.logRecord) + require.Equal(t, int64(0), lc.count) + require.Equal(t, first, lc.firstObservedTimestamp) + + last := time.Now().UTC() + timeNow = func() time.Time { return last } + lc.Increment() + require.Equal(t, int64(1), lc.count) + require.Equal(t, first, lc.firstObservedTimestamp) + require.Equal(t, last, lc.lastObservedTimestamp) } func Test_getLogKey(t *testing.T) { diff --git a/processor/logdedupprocessor/processor.go b/processor/logdedupprocessor/processor.go index 03bf94bd3e95..320bef235aef 100644 --- a/processor/logdedupprocessor/processor.go +++ b/processor/logdedupprocessor/processor.go @@ -13,8 +13,6 @@ import ( "go.opentelemetry.io/collector/consumer" "go.opentelemetry.io/collector/pdata/plog" "go.uber.org/zap" - - "github.com/open-telemetry/opentelemetry-collector-contrib/pkg/pdatautil" ) // logDedupProcessor is a logDedupProcessor that counts duplicate instances of logs. @@ -77,19 +75,20 @@ func (p *logDedupProcessor) ConsumeLogs(_ context.Context, pl plog.Logs) error { defer p.mux.Unlock() for i := 0; i < pl.ResourceLogs().Len(); i++ { - resourceLogs := pl.ResourceLogs().At(i) - resourceAttrs := resourceLogs.Resource().Attributes() - resourceKey := pdatautil.MapHash(resourceAttrs) - for j := 0; j < resourceLogs.ScopeLogs().Len(); j++ { - scope := resourceLogs.ScopeLogs().At(j) - logs := scope.LogRecords() - for k := 0; k < logs.Len(); k++ { - logRecord := logs.At(k) + rl := pl.ResourceLogs().At(i) + resource := rl.Resource() + + for j := 0; j < rl.ScopeLogs().Len(); j++ { + sl := rl.ScopeLogs().At(j) + scope := sl.Scope() + + for k := 0; k < sl.LogRecords().Len(); k++ { + logRecord := sl.LogRecords().At(k) // Remove excluded fields if any p.remover.RemoveFields(logRecord) // Add the log to the aggregator - p.aggregator.Add(resourceKey, resourceAttrs, logRecord) + p.aggregator.Add(resource, scope, logRecord) } } } @@ -107,23 +106,30 @@ func (p *logDedupProcessor) handleExportInterval(ctx context.Context) { for { select { case <-ctx.Done(): + // Export any remaining logs + p.exportLogs(ctx) if err := ctx.Err(); err != context.Canceled { p.logger.Error("context error", zap.Error(err)) } return case <-ticker.C: - p.mux.Lock() - - logs := p.aggregator.Export() - // Only send logs if we have some - if logs.LogRecordCount() > 0 { - err := p.consumer.ConsumeLogs(ctx, logs) - if err != nil { - p.logger.Error("failed to consume logs", zap.Error(err)) - } - } - p.aggregator.Reset() - p.mux.Unlock() + p.exportLogs(ctx) + } + } +} + +// exportLogs exports the logs to the next consumer. +func (p *logDedupProcessor) exportLogs(ctx context.Context) { + p.mux.Lock() + defer p.mux.Unlock() + + logs := p.aggregator.Export() + // Only send logs if we have some + if logs.LogRecordCount() > 0 { + err := p.consumer.ConsumeLogs(ctx, logs) + if err != nil { + p.logger.Error("failed to consume logs", zap.Error(err)) } } + p.aggregator.Reset() } diff --git a/processor/logdedupprocessor/processor_test.go b/processor/logdedupprocessor/processor_test.go index fa4502d265ac..08b6070f41fe 100644 --- a/processor/logdedupprocessor/processor_test.go +++ b/processor/logdedupprocessor/processor_test.go @@ -190,3 +190,37 @@ func TestProcessorConsume(t *testing.T) { err = p.Shutdown(context.Background()) require.NoError(t, err) } + +func Test_unsetLogsAreExportedOnShutdown(t *testing.T) { + logsSink := &consumertest.LogsSink{} + logger := zap.NewNop() + cfg := &Config{ + LogCountAttribute: defaultLogCountAttribute, + Interval: 1 * time.Second, + Timezone: defaultTimezone, + } + + // Create & start a processor + p, err := newProcessor(cfg, logsSink, logger) + require.NoError(t, err) + err = p.Start(context.Background(), componenttest.NewNopHost()) + require.NoError(t, err) + + // Create logs payload + logs := plog.NewLogs() + rl := logs.ResourceLogs().AppendEmpty() + sl := rl.ScopeLogs().AppendEmpty() + sl.LogRecords().AppendEmpty() + + // Consume the logs + err = p.ConsumeLogs(context.Background(), logs) + require.NoError(t, err) + + // Shutdown the processor before it exports the logs + err = p.Shutdown(context.Background()) + require.NoError(t, err) + + // Ensure the logs are exported + exportedLogs := logsSink.AllLogs() + require.Len(t, exportedLogs, 1) +} diff --git a/receiver/azureeventhubreceiver/azureresourcemetrics_unmarshaler.go b/receiver/azureeventhubreceiver/azureresourcemetrics_unmarshaler.go index 16614c680a99..6fe65c24d0ca 100644 --- a/receiver/azureeventhubreceiver/azureresourcemetrics_unmarshaler.go +++ b/receiver/azureeventhubreceiver/azureresourcemetrics_unmarshaler.go @@ -17,11 +17,12 @@ import ( "go.opentelemetry.io/collector/pdata/pmetric" conventions "go.opentelemetry.io/collector/semconv/v1.13.0" "go.uber.org/zap" + + "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/azureeventhubreceiver/internal/metadata" ) const ( azureResourceID = "azure.resource.id" - scopeName = "otelcol/azureresourcemetrics" ) type azureResourceMetricsUnmarshaler struct { @@ -75,7 +76,7 @@ func (r azureResourceMetricsUnmarshaler) UnmarshalMetrics(event *eventhub.Event) resourceMetrics := md.ResourceMetrics().AppendEmpty() resource := resourceMetrics.Resource() - resource.Attributes().PutStr(conventions.AttributeTelemetrySDKName, receiverScopeName) + resource.Attributes().PutStr(conventions.AttributeTelemetrySDKName, metadata.ScopeName) resource.Attributes().PutStr(conventions.AttributeTelemetrySDKLanguage, conventions.AttributeTelemetrySDKLanguageGo) resource.Attributes().PutStr(conventions.AttributeTelemetrySDKVersion, r.buildInfo.Version) resource.Attributes().PutStr(conventions.AttributeCloudProvider, conventions.AttributeCloudProviderAzure) diff --git a/receiver/azureeventhubreceiver/factory.go b/receiver/azureeventhubreceiver/factory.go index ae857545cede..c955f023de33 100644 --- a/receiver/azureeventhubreceiver/factory.go +++ b/receiver/azureeventhubreceiver/factory.go @@ -15,11 +15,6 @@ import ( "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/azureeventhubreceiver/internal/metadata" ) -var ( - // The receiver scope name - receiverScopeName = "otelcol/" + metadata.Type.String() + "receiver" -) - var ( errUnexpectedConfigurationType = errors.New("failed to cast configuration to azure event hub config") ) diff --git a/receiver/azuremonitorreceiver/README.md b/receiver/azuremonitorreceiver/README.md index c973cc1f1d23..709f73753676 100644 --- a/receiver/azuremonitorreceiver/README.md +++ b/receiver/azuremonitorreceiver/README.md @@ -30,7 +30,7 @@ The following settings are optional: - `maximum_number_of_metrics_in_a_call` (default = 20): Maximum number of metrics to fetch in per API call, current limit in Azure is 20 (as of 03/27/2023). - `maximum_number_of_records_per_resource` (default = 10): Maximum number of records to fetch per resource. - `initial_delay` (default = `1s`): defines how long this receiver waits before starting. -- `cloud` (default = `AzureCloud`): defines which Azure cloud to use. Either `AzureCloud` or `AzureUSGovernment` +- `cloud` (default = `AzureCloud`): defines which Azure cloud to use. Valid values: `AzureCloud`, `AzureUSGovernment`, `AzureChinaCloud`. Authenticating using service principal requires following additional settings: diff --git a/receiver/azuremonitorreceiver/config.go b/receiver/azuremonitorreceiver/config.go index 90f7d7ef6292..6e835003e781 100644 --- a/receiver/azuremonitorreceiver/config.go +++ b/receiver/azuremonitorreceiver/config.go @@ -16,6 +16,7 @@ import ( const ( azureCloud = "AzureCloud" azureGovernmentCloud = "AzureUSGovernment" + azureChinaCloud = "AzureChinaCloud" ) var ( @@ -292,7 +293,7 @@ func (c Config) Validate() (err error) { return fmt.Errorf("authentication %v is not supported. supported authentications include [%v,%v,%v,%v]", c.Authentication, servicePrincipal, workloadIdentity, managedIdentity, defaultCredentials) } - if c.Cloud != azureCloud && c.Cloud != azureGovernmentCloud { + if c.Cloud != azureCloud && c.Cloud != azureGovernmentCloud && c.Cloud != azureChinaCloud { err = multierr.Append(err, errInvalidCloud) } diff --git a/receiver/azuremonitorreceiver/internal/metadata/metrics.go b/receiver/azuremonitorreceiver/internal/metadata/metrics.go index 6f23404560d5..75af602be1c2 100644 --- a/receiver/azuremonitorreceiver/internal/metadata/metrics.go +++ b/receiver/azuremonitorreceiver/internal/metadata/metrics.go @@ -135,7 +135,7 @@ func (mb *MetricsBuilder) EmitForResource(rmo ...ResourceMetricsOption) { rm := pmetric.NewResourceMetrics() rm.Resource().Attributes().EnsureCapacity(mb.resourceCapacity) ils := rm.ScopeMetrics().AppendEmpty() - ils.Scope().SetName("otelcol/azuremonitorreceiver") + ils.Scope().SetName(ScopeName) ils.Scope().SetVersion(mb.buildInfo.Version) ils.Metrics().EnsureCapacity(mb.metricsCapacity) mb.EmitAllMetrics(ils) diff --git a/receiver/azuremonitorreceiver/scraper.go b/receiver/azuremonitorreceiver/scraper.go index 8e5440dae0cd..1e4449016647 100644 --- a/receiver/azuremonitorreceiver/scraper.go +++ b/receiver/azuremonitorreceiver/scraper.go @@ -126,6 +126,8 @@ func (s *azureScraper) getArmClientOptions() *arm.ClientOptions { switch s.cfg.Cloud { case azureGovernmentCloud: cloudToUse = cloud.AzureGovernment + case azureChinaCloud: + cloudToUse = cloud.AzureChina default: cloudToUse = cloud.AzurePublic } diff --git a/receiver/azuremonitorreceiver/scraper_test.go b/receiver/azuremonitorreceiver/scraper_test.go index 68e643884b6b..b915b4bdc4dc 100644 --- a/receiver/azuremonitorreceiver/scraper_test.go +++ b/receiver/azuremonitorreceiver/scraper_test.go @@ -6,12 +6,14 @@ package azuremonitorreceiver // import "github.com/open-telemetry/opentelemetry- import ( "context" "path/filepath" + "reflect" "strings" "sync" "testing" "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" @@ -722,3 +724,64 @@ func getMetricsValuesMockData() map[string]map[string]armmonitor.MetricsClientLi }, } } + +func TestAzureScraperClientOptions(t *testing.T) { + type fields struct { + cfg *Config + } + tests := []struct { + name string + fields fields + want *arm.ClientOptions + }{ + { + name: "AzureCloud_options", + fields: fields{ + cfg: &Config{ + Cloud: azureCloud, + }, + }, + want: &arm.ClientOptions{ + ClientOptions: azcore.ClientOptions{ + Cloud: cloud.AzurePublic, + }, + }, + }, + { + name: "AzureGovernmentCloud_options", + fields: fields{ + cfg: &Config{ + Cloud: azureGovernmentCloud, + }, + }, + want: &arm.ClientOptions{ + ClientOptions: azcore.ClientOptions{ + Cloud: cloud.AzureGovernment, + }, + }, + }, + { + name: "AzureChinaCloud_options", + fields: fields{ + cfg: &Config{ + Cloud: azureChinaCloud, + }, + }, + want: &arm.ClientOptions{ + ClientOptions: azcore.ClientOptions{ + Cloud: cloud.AzureChina, + }, + }, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + s := &azureScraper{ + cfg: tt.fields.cfg, + } + if got := s.getArmClientOptions(); !reflect.DeepEqual(got, tt.want) { + t.Errorf("getArmClientOptions() = %v, want %v", got, tt.want) + } + }) + } +} diff --git a/receiver/azuremonitorreceiver/testdata/expected_metrics/metrics_golden.yaml b/receiver/azuremonitorreceiver/testdata/expected_metrics/metrics_golden.yaml index a61f847c1e94..9aebbdd5a49e 100644 --- a/receiver/azuremonitorreceiver/testdata/expected_metrics/metrics_golden.yaml +++ b/receiver/azuremonitorreceiver/testdata/expected_metrics/metrics_golden.yaml @@ -771,5 +771,5 @@ resourceMetrics: name: azure_metric6_count unit: unit1 scope: - name: otelcol/azuremonitorreceiver + name: github.com/open-telemetry/opentelemetry-collector-contrib/receiver/azuremonitorreceiver version: latest diff --git a/receiver/azuremonitorreceiver/testdata/expected_metrics/metrics_tags_golden.yaml b/receiver/azuremonitorreceiver/testdata/expected_metrics/metrics_tags_golden.yaml index 3b3b38e92e54..a00a60aa3c09 100644 --- a/receiver/azuremonitorreceiver/testdata/expected_metrics/metrics_tags_golden.yaml +++ b/receiver/azuremonitorreceiver/testdata/expected_metrics/metrics_tags_golden.yaml @@ -816,5 +816,5 @@ resourceMetrics: name: azure_metric4_maximum unit: unit1 scope: - name: otelcol/azuremonitorreceiver + name: github.com/open-telemetry/opentelemetry-collector-contrib/receiver/azuremonitorreceiver version: latest diff --git a/receiver/cloudflarereceiver/logs.go b/receiver/cloudflarereceiver/logs.go index 051acbcfb903..3c690dd5ec98 100644 --- a/receiver/cloudflarereceiver/logs.go +++ b/receiver/cloudflarereceiver/logs.go @@ -39,8 +39,6 @@ type logsReceiver struct { const secretHeaderName = "X-CF-Secret" -var receiverScopeName = "otelcol/" + metadata.Type.String() - func newLogsReceiver(params rcvr.Settings, cfg *Config, consumer consumer.Logs) (*logsReceiver, error) { recv := &logsReceiver{ cfg: &cfg.Logs, @@ -233,7 +231,7 @@ func (l *logsReceiver) processLogs(now pcommon.Timestamp, logs []map[string]any) resource.Attributes().PutStr("cloudflare.zone", zone) } scopeLogs := resourceLogs.ScopeLogs().AppendEmpty() - scopeLogs.Scope().SetName(receiverScopeName) + scopeLogs.Scope().SetName(metadata.ScopeName) for _, log := range logGroup { logRecord := scopeLogs.LogRecords().AppendEmpty() diff --git a/receiver/cloudflarereceiver/logs_test.go b/receiver/cloudflarereceiver/logs_test.go index b1c759f760e0..696a6b5f645b 100644 --- a/receiver/cloudflarereceiver/logs_test.go +++ b/receiver/cloudflarereceiver/logs_test.go @@ -48,7 +48,7 @@ func TestPayloadToLogRecord(t *testing.T) { logs := plog.NewLogs() rl := logs.ResourceLogs().AppendEmpty() sl := rl.ScopeLogs().AppendEmpty() - sl.Scope().SetName(receiverScopeName) + sl.Scope().SetName("github.com/open-telemetry/opentelemetry-collector-contrib/receiver/cloudflarereceiver") for idx, line := range strings.Split(payload, "\n") { lr := sl.LogRecords().AppendEmpty() @@ -86,7 +86,7 @@ func TestPayloadToLogRecord(t *testing.T) { })) sl := rl.ScopeLogs().AppendEmpty() - sl.Scope().SetName(receiverScopeName) + sl.Scope().SetName("github.com/open-telemetry/opentelemetry-collector-contrib/receiver/cloudflarereceiver") lr := sl.LogRecords().AppendEmpty() require.NoError(t, lr.Attributes().FromRaw(map[string]any{ diff --git a/receiver/cloudflarereceiver/testdata/processed/all_fields.yaml b/receiver/cloudflarereceiver/testdata/processed/all_fields.yaml index dea4d0d1e3c7..8b0701a92a5e 100644 --- a/receiver/cloudflarereceiver/testdata/processed/all_fields.yaml +++ b/receiver/cloudflarereceiver/testdata/processed/all_fields.yaml @@ -284,4 +284,4 @@ resourceLogs: timeUnixNano: "1677821346000000000" traceId: "" scope: - name: otelcol/cloudflare + name: github.com/open-telemetry/opentelemetry-collector-contrib/receiver/cloudflarereceiver diff --git a/receiver/cloudflarereceiver/testdata/processed/multiple_log_payload.yaml b/receiver/cloudflarereceiver/testdata/processed/multiple_log_payload.yaml index 25014da16909..94f14c7b9862 100644 --- a/receiver/cloudflarereceiver/testdata/processed/multiple_log_payload.yaml +++ b/receiver/cloudflarereceiver/testdata/processed/multiple_log_payload.yaml @@ -83,7 +83,7 @@ resourceLogs: timeUnixNano: "1677821345000000000" traceId: "" scope: - name: otelcol/cloudflare + name: github.com/open-telemetry/opentelemetry-collector-contrib/receiver/cloudflarereceiver - resource: attributes: - key: cloudflare.zone @@ -178,7 +178,7 @@ resourceLogs: timeUnixNano: "1677821345000000000" traceId: "" scope: - name: otelcol/cloudflare + name: github.com/open-telemetry/opentelemetry-collector-contrib/receiver/cloudflarereceiver - resource: attributes: - key: cloudflare.zone @@ -230,4 +230,4 @@ resourceLogs: timeUnixNano: "1677821345000000000" traceId: "" scope: - name: otelcol/cloudflare + name: github.com/open-telemetry/opentelemetry-collector-contrib/receiver/cloudflarereceiver diff --git a/receiver/cloudfoundryreceiver/receiver.go b/receiver/cloudfoundryreceiver/receiver.go index 0ef8e1fe85a9..a1d77fd833f7 100644 --- a/receiver/cloudfoundryreceiver/receiver.go +++ b/receiver/cloudfoundryreceiver/receiver.go @@ -17,12 +17,13 @@ import ( "go.opentelemetry.io/collector/pdata/pmetric" "go.opentelemetry.io/collector/receiver" "go.opentelemetry.io/collector/receiver/receiverhelper" + + "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/cloudfoundryreceiver/internal/metadata" ) const ( - transport = "http" - dataFormat = "cloudfoundry" - instrumentationLibName = "otelcol/cloudfoundry" + transport = "http" + dataFormat = "cloudfoundry" ) var _ receiver.Metrics = (*cloudFoundryReceiver)(nil) @@ -214,13 +215,13 @@ func (cfr *cloudFoundryReceiver) streamLogs( func createLibraryMetricsSlice(metrics pmetric.Metrics) pmetric.MetricSlice { resourceMetric := metrics.ResourceMetrics().AppendEmpty() libraryMetrics := resourceMetric.ScopeMetrics().AppendEmpty() - libraryMetrics.Scope().SetName(instrumentationLibName) + libraryMetrics.Scope().SetName(metadata.ScopeName) return libraryMetrics.Metrics() } func createLibraryLogsSlice(logs plog.Logs) plog.LogRecordSlice { resourceLog := logs.ResourceLogs().AppendEmpty() libraryLogs := resourceLog.ScopeLogs().AppendEmpty() - libraryLogs.Scope().SetName(instrumentationLibName) + libraryLogs.Scope().SetName(metadata.ScopeName) return libraryLogs.LogRecords() } diff --git a/receiver/elasticsearchreceiver/README.md b/receiver/elasticsearchreceiver/README.md index d1eeda097843..ed1cdd3eedd5 100644 --- a/receiver/elasticsearchreceiver/README.md +++ b/receiver/elasticsearchreceiver/README.md @@ -25,7 +25,6 @@ See the [Elasticsearch docs](https://www.elastic.co/guide/en/elasticsearch/refer The following settings are optional: -- `metrics` (default: see `DefaultMetricsSettings` [here](./internal/metadata/generated_metrics.go): Allows enabling and disabling specific metrics from being collected in this receiver. - `nodes` (default: `["_all"]`): Allows specifying node filters that define which nodes are scraped for node-level and cluster-level metrics. See [the Elasticsearch documentation](https://www.elastic.co/guide/en/elasticsearch/reference/7.9/cluster.html#cluster-nodes) for allowed filters. If this option is left explicitly empty, then no node-level metrics will be scraped and cluster-level metrics will scrape only metrics related to cluster's health. - `skip_cluster_metrics` (default: `false`): If true, cluster-level metrics will not be scraped. - `indices` (default: `["_all"]`): Allows specifying index filters that define which indices are scraped for index-level metrics. See [the Elasticsearch documentation](https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-stats.html#index-stats-api-path-params) for allowed filters. If this option is left explicitly empty, then no index-level metrics will be scraped. @@ -63,4 +62,6 @@ The following metric are available with versions: - `elasticsearch.cluster.state_update.count` >= [7.16.0](https://www.elastic.co/guide/en/elasticsearch/reference/7.16/release-notes-7.16.0.html) - `elasticsearch.cluster.state_update.time` >= [7.16.0](https://www.elastic.co/guide/en/elasticsearch/reference/7.16/release-notes-7.16.0.html) -Details about the metrics produced by this receiver can be found in [metadata.yaml](./metadata.yaml) +Details about the metrics produced by this receiver can be found in [metadata.yaml](./metadata.yaml). +Refer to [documentation.md](./documentation.md) for information on how to enable and disable metrics produced by this +receiver. diff --git a/receiver/googlecloudmonitoringreceiver/Makefile b/receiver/googlecloudmonitoringreceiver/Makefile new file mode 100644 index 000000000000..ded7a36092dc --- /dev/null +++ b/receiver/googlecloudmonitoringreceiver/Makefile @@ -0,0 +1 @@ +include ../../Makefile.Common diff --git a/receiver/googlecloudmonitoringreceiver/README.md b/receiver/googlecloudmonitoringreceiver/README.md new file mode 100644 index 000000000000..dfb718252d86 --- /dev/null +++ b/receiver/googlecloudmonitoringreceiver/README.md @@ -0,0 +1,58 @@ +# Google Cloud Monitoring 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%2Fgooglecloudmonitoring%20&label=open&color=orange&logo=opentelemetry)](https://github.com/open-telemetry/opentelemetry-collector-contrib/issues?q=is%3Aopen+is%3Aissue+label%3Areceiver%2Fgooglecloudmonitoring) [![Closed issues](https://img.shields.io/github/issues-search/open-telemetry/opentelemetry-collector-contrib?query=is%3Aissue%20is%3Aclosed%20label%3Areceiver%2Fgooglecloudmonitoring%20&label=closed&color=blue&logo=opentelemetry)](https://github.com/open-telemetry/opentelemetry-collector-contrib/issues?q=is%3Aclosed+is%3Aissue+label%3Areceiver%2Fgooglecloudmonitoring) | +| [Code Owners](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/CONTRIBUTING.md#becoming-a-code-owner) | [@dashpole](https://www.github.com/dashpole), [@TylerHelmuth](https://www.github.com/TylerHelmuth), [@abhishek-at-cloudwerx](https://www.github.com/abhishek-at-cloudwerx) | + +[development]: https://github.com/open-telemetry/opentelemetry-collector#development +[contrib]: https://github.com/open-telemetry/opentelemetry-collector-releases/tree/main/distributions/otelcol-contrib + + +The primary objective of the Google Cloud Monitoring Receiver is to gather time series metrics data from all Google services and convert this data into a pipeline format that facilitates further use. + +This receiver gets GCP (Google Cloud Platform) metrics from [GCP Monitoring REST API] via the [Google SDK for GCP Metrics] and then convert those timeseries data into OTel Format [Pipeline Data]. + +[GCP Monitoring REST API]: https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list +[Google SDK for GCP Metrics]: https://pkg.go.dev/cloud.google.com/go/monitoring/apiv3 +[Pipeline Data]: https://pkg.go.dev/go.opentelemetry.io/collector/pdata + +## Configuration +The following configuration options are supported: + +```yaml +receivers: + googlecloudmonitoring: + collection_interval: 120s + project_id: my-project-id + metrics_list: + - metric_name: "compute.googleapis.com/instance/cpu/usage_time" + delay: 60s + - metric_name: "connectors.googleapis.com/flex/instance/cpu/usage_time" + delay: 60s +``` + +- `collection_interval` (Optional): The interval at which metrics are collected. Default is 60s. +- `initial_delay` (default = `1s`): defines how long this receiver waits before starting. +- `timeout`: (default = `1m`) The timeout of running commands against the GCP Monitoring REST API. +- `project_id` (Required): The GCP project ID. +- `metrics_list` (Required): A list of services metrics to monitor. + +Each single metric can have the following configuration: + +- `metric_name` (Required): The specific metric name to collect. +- `delay` (Optional): The delay before starting the collection of metrics for this service. Default is 0s. + + +## Authentication with Google Cloud + +For more details on authentication, refer to the Google Cloud [Application Default Credentials documentation](https://cloud.google.com/docs/authentication/application-default-credentials). Note that if your workload is running on Google Cloud Platform (GCP), the service account credentials will be used automatically without needing to set the environment variable manually. + +### Filtering + +**Metrics Parameters** : + +- A monitoring filter that specifies which time series should be returned. The filter must specify a single metric type. For example: `metric_name: "compute.googleapis.com/instance/cpu/usage_time"` diff --git a/receiver/googlecloudmonitoringreceiver/config.go b/receiver/googlecloudmonitoringreceiver/config.go new file mode 100644 index 000000000000..75594dfb68eb --- /dev/null +++ b/receiver/googlecloudmonitoringreceiver/config.go @@ -0,0 +1,56 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package googlecloudmonitoringreceiver // import "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/googlecloudmonitoringreceiver" + +import ( + "errors" + "fmt" + "time" + + "go.opentelemetry.io/collector/receiver/scraperhelper" +) + +const minCollectionIntervalSeconds = 60 + +type Config struct { + scraperhelper.ControllerConfig `mapstructure:",squash"` + + ProjectID string `mapstructure:"project_id"` + MetricsList []MetricConfig `mapstructure:"metrics_list"` +} + +type MetricConfig struct { + MetricName string `mapstructure:"metric_name"` + Delay time.Duration `mapstructure:"delay"` +} + +func (config *Config) Validate() error { + if config.CollectionInterval.Seconds() < minCollectionIntervalSeconds { + return fmt.Errorf("\"collection_interval\" must be not lower than %v seconds, current value is %v seconds", minCollectionIntervalSeconds, config.CollectionInterval.Seconds()) + } + + if len(config.MetricsList) == 0 { + return errors.New("missing required field \"metrics_list\" or its value is empty") + } + + for _, metric := range config.MetricsList { + if err := metric.Validate(); err != nil { + return err + } + } + + return nil +} + +func (metric MetricConfig) Validate() error { + if metric.MetricName == "" { + return errors.New("field \"metric_name\" is required and cannot be empty for metric configuration") + } + + if metric.Delay < 0 { + return errors.New("field \"delay\" cannot be negative for metric configuration") + } + + return nil +} diff --git a/receiver/googlecloudmonitoringreceiver/config_test.go b/receiver/googlecloudmonitoringreceiver/config_test.go new file mode 100644 index 000000000000..47a26c97c452 --- /dev/null +++ b/receiver/googlecloudmonitoringreceiver/config_test.go @@ -0,0 +1,120 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package googlecloudmonitoringreceiver + +import ( + "path/filepath" + "testing" + "time" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/confmap/confmaptest" + "go.opentelemetry.io/collector/receiver/scraperhelper" + + "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/googlecloudmonitoringreceiver/internal/metadata" +) + +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.Equal(t, + &Config{ + ControllerConfig: scraperhelper.ControllerConfig{ + CollectionInterval: 120 * time.Second, + InitialDelay: 1 * time.Second, + }, + ProjectID: "my-project-id", + MetricsList: []MetricConfig{ + { + MetricName: "compute.googleapis.com/instance/cpu/usage_time", + Delay: 60 * time.Second, + }, + { + MetricName: "connectors.googleapis.com/flex/instance/cpu/usage_time", + Delay: 60 * time.Second, + }, + }, + }, + cfg, + ) +} + +func TestValidateService(t *testing.T) { + testCases := map[string]struct { + metric MetricConfig + requireError bool + }{ + "Valid Service": { + MetricConfig{ + MetricName: "metric_name", + Delay: 0 * time.Second, + }, false}, + "Empty MetricName": { + MetricConfig{ + MetricName: "", + Delay: 0, + }, true}, + "Negative Delay": { + MetricConfig{ + MetricName: "metric_name", + Delay: -1 * time.Second, + }, true}, + } + + for name, testCase := range testCases { + t.Run(name, func(t *testing.T) { + err := testCase.metric.Validate() + if testCase.requireError { + require.Error(t, err) + } else { + require.NoError(t, err) + } + }) + } +} + +func TestValidateConfig(t *testing.T) { + validMetric := MetricConfig{ + MetricName: "metric_name", + Delay: 0 * time.Second, + } + + testCases := map[string]struct { + metricsList []MetricConfig + collectionInterval time.Duration + requireError bool + }{ + "Valid Config": {[]MetricConfig{validMetric}, 60 * time.Second, false}, + "Empty Services": {nil, 60 * time.Second, true}, + "Invalid Service in Services": {[]MetricConfig{{}}, 60 * time.Second, true}, + "Invalid Collection Interval": {[]MetricConfig{validMetric}, 0 * time.Second, true}, + } + + for name, testCase := range testCases { + t.Run(name, func(t *testing.T) { + cfg := &Config{ + ControllerConfig: scraperhelper.ControllerConfig{ + CollectionInterval: testCase.collectionInterval, + }, + MetricsList: testCase.metricsList, + } + + err := cfg.Validate() + if testCase.requireError { + require.Error(t, err) + } else { + require.NoError(t, err) + } + }) + } +} diff --git a/receiver/googlecloudmonitoringreceiver/doc.go b/receiver/googlecloudmonitoringreceiver/doc.go new file mode 100644 index 000000000000..9636dda89101 --- /dev/null +++ b/receiver/googlecloudmonitoringreceiver/doc.go @@ -0,0 +1,6 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +//go:generate mdatagen metadata.yaml + +package googlecloudmonitoringreceiver // import "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/googlecloudmonitoringreceiver" diff --git a/receiver/googlecloudmonitoringreceiver/factory.go b/receiver/googlecloudmonitoringreceiver/factory.go new file mode 100644 index 000000000000..3b6a923ad71a --- /dev/null +++ b/receiver/googlecloudmonitoringreceiver/factory.go @@ -0,0 +1,49 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package googlecloudmonitoringreceiver // import "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/googlecloudmonitoringreceiver" + +import ( + "context" + + "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/googlecloudmonitoringreceiver/internal/metadata" +) + +func NewFactory() receiver.Factory { + return receiver.NewFactory( + metadata.Type, + createDefaultConfig, + receiver.WithMetrics(createMetricsReceiver, metadata.MetricsStability)) +} + +// createDefaultConfig creates the default exporter configuration +func createDefaultConfig() component.Config { + return &Config{ + ControllerConfig: scraperhelper.NewDefaultControllerConfig(), + } +} + +func createMetricsReceiver( + _ context.Context, + settings receiver.Settings, + baseCfg component.Config, + consumer consumer.Metrics, +) (receiver.Metrics, error) { + + rCfg := baseCfg.(*Config) + r := newGoogleCloudMonitoringReceiver(rCfg, settings.Logger) + + scraper, err := scraperhelper.NewScraper(metadata.Type.String(), r.Scrape, scraperhelper.WithStart(r.Start), + scraperhelper.WithShutdown(r.Shutdown)) + if err != nil { + return nil, err + } + + return scraperhelper.NewScraperControllerReceiver(&rCfg.ControllerConfig, settings, consumer, + scraperhelper.AddScraper(scraper)) +} diff --git a/receiver/googlecloudmonitoringreceiver/generated_component_test.go b/receiver/googlecloudmonitoringreceiver/generated_component_test.go new file mode 100644 index 000000000000..bc599fefe415 --- /dev/null +++ b/receiver/googlecloudmonitoringreceiver/generated_component_test.go @@ -0,0 +1,69 @@ +// Code generated by mdatagen. DO NOT EDIT. + +package googlecloudmonitoringreceiver + +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, "googlecloudmonitoring", 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.CreateMetricsReceiver(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 _, test := range tests { + t.Run(test.name+"-shutdown", func(t *testing.T) { + c, err := test.createFn(context.Background(), receivertest.NewNopSettings(), cfg) + require.NoError(t, err) + err = c.Shutdown(context.Background()) + require.NoError(t, err) + }) + t.Run(test.name+"-lifecycle", func(t *testing.T) { + firstRcvr, err := test.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 := test.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/googlecloudmonitoringreceiver/generated_package_test.go b/receiver/googlecloudmonitoringreceiver/generated_package_test.go new file mode 100644 index 000000000000..3019661bfd33 --- /dev/null +++ b/receiver/googlecloudmonitoringreceiver/generated_package_test.go @@ -0,0 +1,13 @@ +// Code generated by mdatagen. DO NOT EDIT. + +package googlecloudmonitoringreceiver + +import ( + "os" + "testing" +) + +func TestMain(m *testing.M) { + // skipping goleak test as per metadata.yml configuration + os.Exit(m.Run()) +} diff --git a/receiver/googlecloudmonitoringreceiver/go.mod b/receiver/googlecloudmonitoringreceiver/go.mod new file mode 100644 index 000000000000..168a4d1f0835 --- /dev/null +++ b/receiver/googlecloudmonitoringreceiver/go.mod @@ -0,0 +1,60 @@ +module github.com/open-telemetry/opentelemetry-collector-contrib/receiver/googlecloudmonitoringreceiver + +go 1.21.12 + +require ( + github.com/stretchr/testify v1.9.0 + go.opentelemetry.io/collector/component v0.106.2-0.20240809191011-ef07ea073562 + go.opentelemetry.io/collector/confmap v0.106.2-0.20240809191011-ef07ea073562 + go.opentelemetry.io/collector/consumer v0.106.2-0.20240809191011-ef07ea073562 + go.opentelemetry.io/collector/consumer/consumertest v0.106.1 + go.opentelemetry.io/collector/pdata v1.12.1-0.20240809191011-ef07ea073562 + go.opentelemetry.io/collector/receiver v0.106.2-0.20240809191011-ef07ea073562 + go.uber.org/zap v1.27.0 +) + +require ( + github.com/beorn7/perks v1.0.1 // indirect + github.com/cespare/xxhash/v2 v2.3.0 // indirect + 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.0.0 // indirect + github.com/gogo/protobuf v1.3.2 // indirect + github.com/google/uuid v1.6.0 // indirect + github.com/hashicorp/go-version v1.7.0 // indirect + github.com/json-iterator/go v1.1.12 // indirect + github.com/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/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect + github.com/pmezard/go-difflib v1.0.0 // indirect + github.com/prometheus/client_golang v1.19.1 // indirect + github.com/prometheus/client_model v0.6.1 // indirect + github.com/prometheus/common v0.55.0 // indirect + github.com/prometheus/procfs v0.15.1 // indirect + go.opentelemetry.io/collector v0.106.2-0.20240809191011-ef07ea073562 // indirect + go.opentelemetry.io/collector/config/configtelemetry v0.106.2-0.20240809191011-ef07ea073562 // indirect + go.opentelemetry.io/collector/consumer/consumerprofiles v0.106.1 // indirect + go.opentelemetry.io/collector/featuregate v1.12.1-0.20240809191011-ef07ea073562 // indirect + go.opentelemetry.io/collector/internal/globalgates v0.106.1 // indirect + go.opentelemetry.io/collector/pdata/pprofile v0.106.1 // indirect + go.opentelemetry.io/otel v1.28.0 // indirect + go.opentelemetry.io/otel/exporters/prometheus v0.50.0 // indirect + go.opentelemetry.io/otel/metric v1.28.0 // indirect + go.opentelemetry.io/otel/sdk v1.28.0 // indirect + go.opentelemetry.io/otel/sdk/metric v1.28.0 // indirect + go.opentelemetry.io/otel/trace v1.28.0 // indirect + go.uber.org/multierr v1.11.0 // indirect + golang.org/x/net v0.26.0 // indirect + golang.org/x/sys v0.22.0 // indirect + golang.org/x/text v0.16.0 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240701130421-f6361c86f094 // indirect + google.golang.org/grpc v1.65.0 // indirect + google.golang.org/protobuf v1.34.2 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect +) diff --git a/receiver/googlecloudmonitoringreceiver/go.sum b/receiver/googlecloudmonitoringreceiver/go.sum new file mode 100644 index 000000000000..cb2b07c313e9 --- /dev/null +++ b/receiver/googlecloudmonitoringreceiver/go.sum @@ -0,0 +1,152 @@ +github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= +github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= +github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= +github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +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.0.0 h1:dhn8MZ1gZ0mzeodTG3jt5Vj/o87xZKuNAprG2mQfMfc= +github.com/go-viper/mapstructure/v2 v2.0.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/hashicorp/go-version v1.7.0 h1:5tqGy27NaOTB8yJKUZELlFAS/LTKJkrmONwQKeRZfjY= +github.com/hashicorp/go-version v1.7.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= +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/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA= +github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= +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/prometheus/client_golang v1.19.1 h1:wZWJDwK+NameRJuPGDhlnFgx8e8HN3XHQeLaYJFJBOE= +github.com/prometheus/client_golang v1.19.1/go.mod h1:mP78NwGzrVks5S2H6ab8+ZZGJLZUq1hoULYBAYBw1Ho= +github.com/prometheus/client_model v0.6.1 h1:ZKSh/rekM+n3CeS952MLRAdFwIKqeY8b62p8ais2e9E= +github.com/prometheus/client_model v0.6.1/go.mod h1:OrxVMOVHjw3lKMa8+x6HeMGkHMQyHDk9E3jmP2AmGiY= +github.com/prometheus/common v0.55.0 h1:KEi6DK7lXW/m7Ig5i47x0vRzuBsHuvJdi5ee6Y3G1dc= +github.com/prometheus/common v0.55.0/go.mod h1:2SECS4xJG1kd8XF9IcM1gMX6510RAEL65zxzNImwdc8= +github.com/prometheus/procfs v0.15.1 h1:YagwOFzUgYfKKHX6Dr+sHT7km/hxC76UB0learggepc= +github.com/prometheus/procfs v0.15.1/go.mod h1:fB45yRUv8NstnjriLhBQLuOUt+WW4BsoGhij/e3PBqk= +github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= +github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog= +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 v0.106.2-0.20240809191011-ef07ea073562 h1:XSemt/zUFKY4Xh8ZZUY2k5HYo3juJAE1l2EnxU3F/0c= +go.opentelemetry.io/collector v0.106.2-0.20240809191011-ef07ea073562/go.mod h1:BPBPZO+r4GdcF4xu+qR2pweusp/ZTM4t0tGVsMQDXrI= +go.opentelemetry.io/collector/component v0.106.2-0.20240809191011-ef07ea073562 h1:myjn1RkKrZ0//4Tb4kOWKUboFzVEo2LNAcbVKOsqcnY= +go.opentelemetry.io/collector/component v0.106.2-0.20240809191011-ef07ea073562/go.mod h1:KiVE/5ZayuLlDJTe7mHqHRCn/5LrmF99C7/mKe54mWA= +go.opentelemetry.io/collector/config/configtelemetry v0.106.2-0.20240809191011-ef07ea073562 h1:76U+ZAoRnp04x5zS2E0Cf1QQD+lAVHuKImNWe6RfY3I= +go.opentelemetry.io/collector/config/configtelemetry v0.106.2-0.20240809191011-ef07ea073562/go.mod h1:WxWKNVAQJg/Io1nA3xLgn/DWLE/W1QOB2+/Js3ACi40= +go.opentelemetry.io/collector/confmap v0.106.2-0.20240809191011-ef07ea073562 h1:wzgUr39AtHb77uLju8ArOflFvSfRwMvkY4pDv6MZ0H0= +go.opentelemetry.io/collector/confmap v0.106.2-0.20240809191011-ef07ea073562/go.mod h1:iWdWgvxRYSHdAt5ySgPJq/i6fQMKGNnP5Pt7jOfTXno= +go.opentelemetry.io/collector/consumer v0.106.2-0.20240809191011-ef07ea073562 h1:AD9nE4H0qLVZknWPR7euqUKrcGzrmP6bHn+3zoj0DTw= +go.opentelemetry.io/collector/consumer v0.106.2-0.20240809191011-ef07ea073562/go.mod h1:oy6pR/v5o/N9cxsICskyt//bU8k8EG0JeOO1MTDfs5A= +go.opentelemetry.io/collector/consumer/consumerprofiles v0.106.1 h1:uxQjWm2XE7d1OncQDM9tL1ha+otGt1HjoRYIcQRMOfQ= +go.opentelemetry.io/collector/consumer/consumerprofiles v0.106.1/go.mod h1:xQScBf9/PORFaYM6JVPOr7/TcRVEuKcW5XbAXfJByRs= +go.opentelemetry.io/collector/consumer/consumertest v0.106.1 h1:hDdFeVjCLIJ6iLfbiYcV9s+4iboFXbkJ/k3h09qusPw= +go.opentelemetry.io/collector/consumer/consumertest v0.106.1/go.mod h1:WRTYnQ8bYHQrEN6eJZ80oC4pNI7VeDRdsTZI6xs9o5M= +go.opentelemetry.io/collector/featuregate v1.12.1-0.20240809191011-ef07ea073562 h1:jBKXaLF71yH9jXZH3OhwMr6sUxXX5vVafUNg3EnRJbk= +go.opentelemetry.io/collector/featuregate v1.12.1-0.20240809191011-ef07ea073562/go.mod h1:PsOINaGgTiFc+Tzu2K/X2jP+Ngmlp7YKGV1XrnBkH7U= +go.opentelemetry.io/collector/internal/globalgates v0.106.1 h1:0NQHTcykmYNDsNKObJ2XocGCv3WUAQZppfP3o6hZUIA= +go.opentelemetry.io/collector/internal/globalgates v0.106.1/go.mod h1:Z5US6O2xkZAtxVSSBnHAPFZwPhFoxlyKLUvS67Vx4gc= +go.opentelemetry.io/collector/pdata v1.12.1-0.20240809191011-ef07ea073562 h1:8EP6Grp5VFUxwlvXvamAVgL6bY6wayCC3xg0HadAnkU= +go.opentelemetry.io/collector/pdata v1.12.1-0.20240809191011-ef07ea073562/go.mod h1:MYeB0MmMAxeM0hstCFrCqWLzdyeYySim2dG6pDT6nYI= +go.opentelemetry.io/collector/pdata/pprofile v0.106.1 h1:nOLo25YnluNi+zAbU7G24RN86cJ1/EZJc6VEayBlOPo= +go.opentelemetry.io/collector/pdata/pprofile v0.106.1/go.mod h1:chr7lMJIzyXkccnPRkIPhyXtqLZLSReZYhwsggOGEfg= +go.opentelemetry.io/collector/pdata/testdata v0.106.1 h1:JUyLAwKD8o/9jgkBi16zOClxOyY028A7XIXHPV4mNmM= +go.opentelemetry.io/collector/pdata/testdata v0.106.1/go.mod h1:ghdz2RDEzsfigW0J+9oqA4fGmQJ/DJYUhE3vYU6JfhM= +go.opentelemetry.io/collector/receiver v0.106.2-0.20240809191011-ef07ea073562 h1:EqpFfqlV8OfFkvq48HpG/hyKCZ9r9IewVKFNoD5DPHY= +go.opentelemetry.io/collector/receiver v0.106.2-0.20240809191011-ef07ea073562/go.mod h1:+J2FEg4eDYdUuaDW8Cn41SeqFiuKdvnZOZlXvbVdVaw= +go.opentelemetry.io/otel v1.28.0 h1:/SqNcYk+idO0CxKEUOtKQClMK/MimZihKYMruSMViUo= +go.opentelemetry.io/otel v1.28.0/go.mod h1:q68ijF8Fc8CnMHKyzqL6akLO46ePnjkgfIMIjUIX9z4= +go.opentelemetry.io/otel/exporters/prometheus v0.50.0 h1:2Ewsda6hejmbhGFyUvWZjUThC98Cf8Zy6g0zkIimOng= +go.opentelemetry.io/otel/exporters/prometheus v0.50.0/go.mod h1:pMm5PkUo5YwbLiuEf7t2xg4wbP0/eSJrMxIMxKosynY= +go.opentelemetry.io/otel/metric v1.28.0 h1:f0HGvSl1KRAU1DLgLGFjrwVyismPlnuU6JD6bOeuA5Q= +go.opentelemetry.io/otel/metric v1.28.0/go.mod h1:Fb1eVBFZmLVTMb6PPohq3TO9IIhUisDsbJoL/+uQW4s= +go.opentelemetry.io/otel/sdk v1.28.0 h1:b9d7hIry8yZsgtbmM0DKyPWMMUMlK9NEKuIG4aBqWyE= +go.opentelemetry.io/otel/sdk v1.28.0/go.mod h1:oYj7ClPUA7Iw3m+r7GeEjz0qckQRJK2B8zjcZEfu7Pg= +go.opentelemetry.io/otel/sdk/metric v1.28.0 h1:OkuaKgKrgAbYrrY0t92c+cC+2F6hsFNnCQArXCKlg08= +go.opentelemetry.io/otel/sdk/metric v1.28.0/go.mod h1:cWPjykihLAPvXKi4iZc1dpER3Jdq2Z0YLse3moQUCpg= +go.opentelemetry.io/otel/trace v1.28.0 h1:GhQ9cUuQGmNDd5BTCP2dAvv75RdMxEfTmYejp+lkx9g= +go.opentelemetry.io/otel/trace v1.28.0/go.mod h1:jPyXzNPg6da9+38HEwElrQiHlVMTnVfM3/yv2OlIHaI= +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.26.0 h1:soB7SVo0PWrY4vPW/+ay0jKDNScG2X9wFeYlXIvJsOQ= +golang.org/x/net v0.26.0/go.mod h1:5YKkiSynbBIh3p6iOc/vibscux0x38BZDkn8sCUPxHE= +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.22.0 h1:RI27ohtqKCnwULzJLqkv897zojh5/DwS/ENaMzUOaWI= +golang.org/x/sys v0.22.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.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4= +golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI= +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-20240701130421-f6361c86f094 h1:BwIjyKYGsK9dMCBOorzRri8MQwmi7mT9rGHsCEinZkA= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240701130421-f6361c86f094/go.mod h1:Ue6ibwXGpU+dqIcODieyLOcgj7z8+IcskoNIgZxtrFY= +google.golang.org/grpc v1.65.0 h1:bs/cUb4lp1G5iImFFd3u5ixQzweKizoZJAwBNLR42lc= +google.golang.org/grpc v1.65.0/go.mod h1:WgYC2ypjlB0EiQi6wdKixMqukr6lBc0Vo+oOgjrM5ZQ= +google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= +google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= +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/googlecloudmonitoringreceiver/internal/metadata/generated_status.go b/receiver/googlecloudmonitoringreceiver/internal/metadata/generated_status.go new file mode 100644 index 000000000000..c295c4105d31 --- /dev/null +++ b/receiver/googlecloudmonitoringreceiver/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("googlecloudmonitoring") + ScopeName = "otelcol/googlecloudmonitoringreceiver" +) + +const ( + MetricsStability = component.StabilityLevelDevelopment +) diff --git a/receiver/googlecloudmonitoringreceiver/metadata.yaml b/receiver/googlecloudmonitoringreceiver/metadata.yaml new file mode 100644 index 000000000000..4ae0478b3839 --- /dev/null +++ b/receiver/googlecloudmonitoringreceiver/metadata.yaml @@ -0,0 +1,15 @@ +type: googlecloudmonitoring +scope_name: otelcol/googlecloudmonitoringreceiver + +status: + class: receiver + stability: + development: [metrics] + distributions: [contrib] + codeowners: + active: [dashpole, TylerHelmuth, abhishek-at-cloudwerx] + +tests: + config: + goleak: + skip: true diff --git a/receiver/googlecloudmonitoringreceiver/receiver.go b/receiver/googlecloudmonitoringreceiver/receiver.go new file mode 100644 index 000000000000..e44708937578 --- /dev/null +++ b/receiver/googlecloudmonitoringreceiver/receiver.go @@ -0,0 +1,55 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package googlecloudmonitoringreceiver // import "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/googlecloudmonitoringreceiver" + +import ( + "context" + + "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/pdata/pmetric" + "go.uber.org/zap" +) + +type monitoringReceiver struct { + config *Config + logger *zap.Logger + cancel context.CancelFunc +} + +func newGoogleCloudMonitoringReceiver(cfg *Config, logger *zap.Logger) *monitoringReceiver { + return &monitoringReceiver{ + config: cfg, + logger: logger, + } +} + +func (m *monitoringReceiver) Scrape(ctx context.Context) (pmetric.Metrics, error) { + // Dummy use to fix lint errors + ctx.Deadline() + metrics := pmetric.NewMetrics() + m.logger.Debug("Scrape metrics ") + + return metrics, nil +} + +func (m *monitoringReceiver) Start(ctx context.Context, _ component.Host) error { + ctx, m.cancel = context.WithCancel(ctx) + err := m.initialize(ctx) + if err != nil { + return err + } + return nil +} + +func (m *monitoringReceiver) Shutdown(context.Context) error { + m.logger.Debug("shutting down googlecloudmonitoringreceiver receiver") + return nil +} + +func (m *monitoringReceiver) initialize(ctx context.Context) error { + // TODO: Implement the logic for handling metrics here. + // Dummy use to fix lint errors + ctx.Deadline() + return nil +} diff --git a/receiver/googlecloudmonitoringreceiver/testdata/config.yaml b/receiver/googlecloudmonitoringreceiver/testdata/config.yaml new file mode 100644 index 000000000000..d5b85c8f946c --- /dev/null +++ b/receiver/googlecloudmonitoringreceiver/testdata/config.yaml @@ -0,0 +1,8 @@ +googlecloudmonitoring: + collection_interval: 120s + project_id: my-project-id + metrics_list: + - metric_name: "compute.googleapis.com/instance/cpu/usage_time" + delay: 60s # Second + - metric_name: "connectors.googleapis.com/flex/instance/cpu/usage_time" + delay: 60s # Second diff --git a/receiver/k8seventsreceiver/README.md b/receiver/k8seventsreceiver/README.md index c3972244f14e..1fe4d3772e06 100644 --- a/receiver/k8seventsreceiver/README.md +++ b/receiver/k8seventsreceiver/README.md @@ -212,7 +212,9 @@ spec: serviceAccountName: otelcontribcol containers: - name: otelcontribcol - image: otelcontribcol:latest # specify image + # This image is created by running `make docker-otelcontribcol`. + # If you are not building the collector locally, specify a published image: `otel/opentelemetry-collector-contrib` + image: otelcontribcol:latest args: ["--config", "/etc/config/config.yaml"] volumeMounts: - name: config diff --git a/receiver/k8sobjectsreceiver/README.md b/receiver/k8sobjectsreceiver/README.md index e06d23db6ef6..d4b10d165d4e 100644 --- a/receiver/k8sobjectsreceiver/README.md +++ b/receiver/k8sobjectsreceiver/README.md @@ -196,7 +196,9 @@ spec: serviceAccountName: otelcontribcol containers: - name: otelcontribcol - image: otelcontribcol:latest # specify image + # This image is created by running `make docker-otelcontribcol`. + # If you are not building the collector locally, specify a published image: `otel/opentelemetry-collector-contrib` + image: otelcontribcol:latest args: ["--config", "/etc/config/config.yaml"] volumeMounts: - name: config diff --git a/receiver/prometheusreceiver/internal/transaction.go b/receiver/prometheusreceiver/internal/transaction.go index 788f053b464a..7d40e8a76fb9 100644 --- a/receiver/prometheusreceiver/internal/transaction.go +++ b/receiver/prometheusreceiver/internal/transaction.go @@ -26,10 +26,9 @@ import ( "go.uber.org/zap" "github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/prometheus" + mdata "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/prometheusreceiver/internal/metadata" ) -const receiverName = "otelcol/prometheusreceiver" - type transaction struct { isNew bool trimSuffixes bool @@ -320,7 +319,7 @@ func (t *transaction) getMetrics(resource pcommon.Resource) (pmetric.Metrics, er // If metrics don't include otel_scope_name or otel_scope_version // labels, use the receiver name and version. if scope == emptyScopeID { - ils.Scope().SetName(receiverName) + ils.Scope().SetName(mdata.ScopeName) ils.Scope().SetVersion(t.buildInfo.Version) } else { // Otherwise, use the scope that was provided with the metrics. diff --git a/receiver/prometheusreceiver/internal/transaction_test.go b/receiver/prometheusreceiver/internal/transaction_test.go index 036ce9339a13..17f21313cd16 100644 --- a/receiver/prometheusreceiver/internal/transaction_test.go +++ b/receiver/prometheusreceiver/internal/transaction_test.go @@ -204,7 +204,7 @@ func testReceiverVersionAndNameAreAttached(t *testing.T, enableNativeHistograms require.Equal(t, expectedResource, gotResource) gotScope := mds[0].ResourceMetrics().At(0).ScopeMetrics().At(0).Scope() - require.Equal(t, receiverName, gotScope.Name()) + require.Equal(t, "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/prometheusreceiver", gotScope.Name()) require.Equal(t, component.NewDefaultBuildInfo().Version, gotScope.Version()) } diff --git a/receiver/prometheusreceiver/metrics_receiver_labels_test.go b/receiver/prometheusreceiver/metrics_receiver_labels_test.go index cd8d115bd79d..27d4a3a54075 100644 --- a/receiver/prometheusreceiver/metrics_receiver_labels_test.go +++ b/receiver/prometheusreceiver/metrics_receiver_labels_test.go @@ -777,7 +777,7 @@ func verifyMultipleScopes(t *testing.T, td *testData, rms []pmetric.ResourceMetr require.Equal(t, sms.At(0).Scope().Name(), "fake.scope.name") require.Equal(t, sms.At(0).Scope().Version(), "v0.1.0") require.Equal(t, sms.At(0).Scope().Attributes().Len(), 0) - require.Equal(t, sms.At(1).Scope().Name(), "otelcol/prometheusreceiver") + require.Equal(t, sms.At(1).Scope().Name(), "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/prometheusreceiver") require.Equal(t, sms.At(1).Scope().Attributes().Len(), 0) require.Equal(t, sms.At(2).Scope().Name(), "scope.with.attributes") require.Equal(t, sms.At(2).Scope().Version(), "v1.5.0") diff --git a/receiver/snmpreceiver/otel_metric_helper.go b/receiver/snmpreceiver/otel_metric_helper.go index 6fa60aa79053..6dca52895875 100644 --- a/receiver/snmpreceiver/otel_metric_helper.go +++ b/receiver/snmpreceiver/otel_metric_helper.go @@ -12,6 +12,8 @@ import ( "go.opentelemetry.io/collector/pdata/pcommon" "go.opentelemetry.io/collector/pdata/pmetric" "go.opentelemetry.io/collector/receiver" + + "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/snmpreceiver/internal/metadata" ) // generalResourceKey is the resource key for the no general "no attribute" resource @@ -111,7 +113,7 @@ func (h *otelMetricHelper) createResource(resourceKey string, resourceAttributes resourceMetrics.Resource().Attributes().PutStr(key, value) } scopeMetrics := resourceMetrics.ScopeMetrics().AppendEmpty() - scopeMetrics.Scope().SetName("otelcol/snmpreceiver") + scopeMetrics.Scope().SetName(metadata.ScopeName) scopeMetrics.Scope().SetVersion(h.settings.BuildInfo.Version) h.resourcesByKey[resourceKey] = &resourceMetrics h.metricsByResource[resourceKey] = map[string]*pmetric.Metric{} diff --git a/receiver/snmpreceiver/testdata/expected_metrics/10_indexed_scalar_metrics_same_resource_golden.yaml b/receiver/snmpreceiver/testdata/expected_metrics/10_indexed_scalar_metrics_same_resource_golden.yaml index 6e5581db4c7f..922fb112292e 100644 --- a/receiver/snmpreceiver/testdata/expected_metrics/10_indexed_scalar_metrics_same_resource_golden.yaml +++ b/receiver/snmpreceiver/testdata/expected_metrics/10_indexed_scalar_metrics_same_resource_golden.yaml @@ -27,5 +27,5 @@ resourceMetrics: name: metric1 unit: By scope: - name: otelcol/snmpreceiver + name: github.com/open-telemetry/opentelemetry-collector-contrib/receiver/snmpreceiver version: latest diff --git a/receiver/snmpreceiver/testdata/expected_metrics/11_indexed_multiple_metrics_same_resource_golden.yaml b/receiver/snmpreceiver/testdata/expected_metrics/11_indexed_multiple_metrics_same_resource_golden.yaml index ce2fa42f9d21..75a71eec98e2 100644 --- a/receiver/snmpreceiver/testdata/expected_metrics/11_indexed_multiple_metrics_same_resource_golden.yaml +++ b/receiver/snmpreceiver/testdata/expected_metrics/11_indexed_multiple_metrics_same_resource_golden.yaml @@ -37,5 +37,5 @@ resourceMetrics: name: metric1 unit: By scope: - name: otelcol/snmpreceiver + name: github.com/open-telemetry/opentelemetry-collector-contrib/receiver/snmpreceiver version: latest diff --git a/receiver/snmpreceiver/testdata/expected_metrics/12_indexed_metrics_w_all_attrs_golden.yaml b/receiver/snmpreceiver/testdata/expected_metrics/12_indexed_metrics_w_all_attrs_golden.yaml index 70475becfaf4..3ad082294c9c 100644 --- a/receiver/snmpreceiver/testdata/expected_metrics/12_indexed_metrics_w_all_attrs_golden.yaml +++ b/receiver/snmpreceiver/testdata/expected_metrics/12_indexed_metrics_w_all_attrs_golden.yaml @@ -32,5 +32,5 @@ resourceMetrics: name: metric1 unit: By scope: - name: otelcol/snmpreceiver + name: github.com/open-telemetry/opentelemetry-collector-contrib/receiver/snmpreceiver version: latest diff --git a/receiver/snmpreceiver/testdata/expected_metrics/13_indexed_metrics_w_column_oid_attr_golden.yaml b/receiver/snmpreceiver/testdata/expected_metrics/13_indexed_metrics_w_column_oid_attr_golden.yaml index 530cc1adb99a..a739428719f0 100644 --- a/receiver/snmpreceiver/testdata/expected_metrics/13_indexed_metrics_w_column_oid_attr_golden.yaml +++ b/receiver/snmpreceiver/testdata/expected_metrics/13_indexed_metrics_w_column_oid_attr_golden.yaml @@ -20,5 +20,5 @@ resourceMetrics: name: metric1 unit: By scope: - name: otelcol/snmpreceiver + name: github.com/open-telemetry/opentelemetry-collector-contrib/receiver/snmpreceiver version: latest diff --git a/receiver/snmpreceiver/testdata/expected_metrics/14_indexed_column_oid_float_attr_golden.yaml b/receiver/snmpreceiver/testdata/expected_metrics/14_indexed_column_oid_float_attr_golden.yaml index 1eab818df6cf..23876fabea31 100644 --- a/receiver/snmpreceiver/testdata/expected_metrics/14_indexed_column_oid_float_attr_golden.yaml +++ b/receiver/snmpreceiver/testdata/expected_metrics/14_indexed_column_oid_float_attr_golden.yaml @@ -20,5 +20,5 @@ resourceMetrics: name: metric1 unit: By scope: - name: otelcol/snmpreceiver + name: github.com/open-telemetry/opentelemetry-collector-contrib/receiver/snmpreceiver version: latest diff --git a/receiver/snmpreceiver/testdata/expected_metrics/15_indexed_column_oid_int_attr_golden.yaml b/receiver/snmpreceiver/testdata/expected_metrics/15_indexed_column_oid_int_attr_golden.yaml index b900dfd3aea6..e6cd4610a10c 100644 --- a/receiver/snmpreceiver/testdata/expected_metrics/15_indexed_column_oid_int_attr_golden.yaml +++ b/receiver/snmpreceiver/testdata/expected_metrics/15_indexed_column_oid_int_attr_golden.yaml @@ -20,5 +20,5 @@ resourceMetrics: name: metric1 unit: By scope: - name: otelcol/snmpreceiver + name: github.com/open-telemetry/opentelemetry-collector-contrib/receiver/snmpreceiver version: latest diff --git a/receiver/snmpreceiver/testdata/expected_metrics/16_indexed_prefix_res_attr_golden.yaml b/receiver/snmpreceiver/testdata/expected_metrics/16_indexed_prefix_res_attr_golden.yaml index fac26d753d38..2b59449e769c 100644 --- a/receiver/snmpreceiver/testdata/expected_metrics/16_indexed_prefix_res_attr_golden.yaml +++ b/receiver/snmpreceiver/testdata/expected_metrics/16_indexed_prefix_res_attr_golden.yaml @@ -21,7 +21,7 @@ resourceMetrics: name: metric2 unit: '{units}' scope: - name: otelcol/snmpreceiver + name: github.com/open-telemetry/opentelemetry-collector-contrib/receiver/snmpreceiver version: latest - resource: attributes: @@ -45,5 +45,5 @@ resourceMetrics: name: metric2 unit: '{units}' scope: - name: otelcol/snmpreceiver + name: github.com/open-telemetry/opentelemetry-collector-contrib/receiver/snmpreceiver version: latest diff --git a/receiver/snmpreceiver/testdata/expected_metrics/17_indexed_oid_res_attr_golden.yaml b/receiver/snmpreceiver/testdata/expected_metrics/17_indexed_oid_res_attr_golden.yaml index cabd24ec5a60..5433cd713498 100644 --- a/receiver/snmpreceiver/testdata/expected_metrics/17_indexed_oid_res_attr_golden.yaml +++ b/receiver/snmpreceiver/testdata/expected_metrics/17_indexed_oid_res_attr_golden.yaml @@ -21,7 +21,7 @@ resourceMetrics: name: metric2 unit: '{units}' scope: - name: otelcol/snmpreceiver + name: github.com/open-telemetry/opentelemetry-collector-contrib/receiver/snmpreceiver version: latest - resource: attributes: @@ -45,5 +45,5 @@ resourceMetrics: name: metric2 unit: '{units}' scope: - name: otelcol/snmpreceiver + name: github.com/open-telemetry/opentelemetry-collector-contrib/receiver/snmpreceiver version: latest diff --git a/receiver/snmpreceiver/testdata/expected_metrics/18_indexed_oid_and_prefix_res_attr_golden.yaml b/receiver/snmpreceiver/testdata/expected_metrics/18_indexed_oid_and_prefix_res_attr_golden.yaml index 5a72ea49e5d0..24f49987a0de 100644 --- a/receiver/snmpreceiver/testdata/expected_metrics/18_indexed_oid_and_prefix_res_attr_golden.yaml +++ b/receiver/snmpreceiver/testdata/expected_metrics/18_indexed_oid_and_prefix_res_attr_golden.yaml @@ -17,7 +17,7 @@ resourceMetrics: name: metric1 unit: By scope: - name: otelcol/snmpreceiver + name: github.com/open-telemetry/opentelemetry-collector-contrib/receiver/snmpreceiver version: latest - resource: attributes: @@ -37,5 +37,5 @@ resourceMetrics: name: metric1 unit: By scope: - name: otelcol/snmpreceiver + name: github.com/open-telemetry/opentelemetry-collector-contrib/receiver/snmpreceiver version: latest diff --git a/receiver/snmpreceiver/testdata/expected_metrics/19_scalar_ra_string_and_coid_ra_string_on_coid_metric_golden.yaml b/receiver/snmpreceiver/testdata/expected_metrics/19_scalar_ra_string_and_coid_ra_string_on_coid_metric_golden.yaml index 8976ae9f615d..1dcfa84e276a 100644 --- a/receiver/snmpreceiver/testdata/expected_metrics/19_scalar_ra_string_and_coid_ra_string_on_coid_metric_golden.yaml +++ b/receiver/snmpreceiver/testdata/expected_metrics/19_scalar_ra_string_and_coid_ra_string_on_coid_metric_golden.yaml @@ -17,7 +17,7 @@ resourceMetrics: name: metric1 unit: By scope: - name: otelcol/snmpreceiver + name: github.com/open-telemetry/opentelemetry-collector-contrib/receiver/snmpreceiver version: latest - resource: attributes: @@ -37,5 +37,5 @@ resourceMetrics: name: metric1 unit: By scope: - name: otelcol/snmpreceiver + name: github.com/open-telemetry/opentelemetry-collector-contrib/receiver/snmpreceiver version: latest diff --git a/receiver/snmpreceiver/testdata/expected_metrics/1_scalar_metrics_golden.yaml b/receiver/snmpreceiver/testdata/expected_metrics/1_scalar_metrics_golden.yaml index 5ac6a13ce383..fa950a9d5d11 100644 --- a/receiver/snmpreceiver/testdata/expected_metrics/1_scalar_metrics_golden.yaml +++ b/receiver/snmpreceiver/testdata/expected_metrics/1_scalar_metrics_golden.yaml @@ -10,5 +10,5 @@ resourceMetrics: name: metric1 unit: By scope: - name: otelcol/snmpreceiver + name: github.com/open-telemetry/opentelemetry-collector-contrib/receiver/snmpreceiver version: latest diff --git a/receiver/snmpreceiver/testdata/expected_metrics/20_scalar_ra_int_and_coid_ra_int_on_coid_metric_golden.yaml b/receiver/snmpreceiver/testdata/expected_metrics/20_scalar_ra_int_and_coid_ra_int_on_coid_metric_golden.yaml index 87eaf08ae04a..ce8d31efe2a8 100644 --- a/receiver/snmpreceiver/testdata/expected_metrics/20_scalar_ra_int_and_coid_ra_int_on_coid_metric_golden.yaml +++ b/receiver/snmpreceiver/testdata/expected_metrics/20_scalar_ra_int_and_coid_ra_int_on_coid_metric_golden.yaml @@ -17,7 +17,7 @@ resourceMetrics: name: metric1 unit: By scope: - name: otelcol/snmpreceiver + name: github.com/open-telemetry/opentelemetry-collector-contrib/receiver/snmpreceiver version: latest - resource: attributes: @@ -37,5 +37,5 @@ resourceMetrics: name: metric1 unit: By scope: - name: otelcol/snmpreceiver + name: github.com/open-telemetry/opentelemetry-collector-contrib/receiver/snmpreceiver version: latest diff --git a/receiver/snmpreceiver/testdata/expected_metrics/21_scalar_ra_float_and_coid_ra_float_on_coid_metric_golden.yaml b/receiver/snmpreceiver/testdata/expected_metrics/21_scalar_ra_float_and_coid_ra_float_on_coid_metric_golden.yaml index 5e75c87459ba..42c9f5114c56 100644 --- a/receiver/snmpreceiver/testdata/expected_metrics/21_scalar_ra_float_and_coid_ra_float_on_coid_metric_golden.yaml +++ b/receiver/snmpreceiver/testdata/expected_metrics/21_scalar_ra_float_and_coid_ra_float_on_coid_metric_golden.yaml @@ -17,7 +17,7 @@ resourceMetrics: name: metric1 unit: By scope: - name: otelcol/snmpreceiver + name: github.com/open-telemetry/opentelemetry-collector-contrib/receiver/snmpreceiver version: latest - resource: attributes: @@ -37,5 +37,5 @@ resourceMetrics: name: metric1 unit: By scope: - name: otelcol/snmpreceiver + name: github.com/open-telemetry/opentelemetry-collector-contrib/receiver/snmpreceiver version: latest diff --git a/receiver/snmpreceiver/testdata/expected_metrics/22_scalar_ra_string_and_prefix_ra_on_coid_metric_golden.yaml b/receiver/snmpreceiver/testdata/expected_metrics/22_scalar_ra_string_and_prefix_ra_on_coid_metric_golden.yaml index f4158eb1937e..93cd4715be38 100644 --- a/receiver/snmpreceiver/testdata/expected_metrics/22_scalar_ra_string_and_prefix_ra_on_coid_metric_golden.yaml +++ b/receiver/snmpreceiver/testdata/expected_metrics/22_scalar_ra_string_and_prefix_ra_on_coid_metric_golden.yaml @@ -17,7 +17,7 @@ resourceMetrics: name: metric1 unit: By scope: - name: otelcol/snmpreceiver + name: github.com/open-telemetry/opentelemetry-collector-contrib/receiver/snmpreceiver version: latest - resource: attributes: @@ -37,5 +37,5 @@ resourceMetrics: name: metric1 unit: By scope: - name: otelcol/snmpreceiver + name: github.com/open-telemetry/opentelemetry-collector-contrib/receiver/snmpreceiver version: latest diff --git a/receiver/snmpreceiver/testdata/expected_metrics/23_multiple_scalar_oid_string_with_multiple_coid_ra_string_on_coid_metric_golden.yaml b/receiver/snmpreceiver/testdata/expected_metrics/23_multiple_scalar_oid_string_with_multiple_coid_ra_string_on_coid_metric_golden.yaml index 63c91225a936..15cd178e35cd 100644 --- a/receiver/snmpreceiver/testdata/expected_metrics/23_multiple_scalar_oid_string_with_multiple_coid_ra_string_on_coid_metric_golden.yaml +++ b/receiver/snmpreceiver/testdata/expected_metrics/23_multiple_scalar_oid_string_with_multiple_coid_ra_string_on_coid_metric_golden.yaml @@ -23,7 +23,7 @@ resourceMetrics: name: metric1 unit: By scope: - name: otelcol/snmpreceiver + name: github.com/open-telemetry/opentelemetry-collector-contrib/receiver/snmpreceiver version: latest - resource: attributes: @@ -49,5 +49,5 @@ resourceMetrics: name: metric1 unit: By scope: - name: otelcol/snmpreceiver + name: github.com/open-telemetry/opentelemetry-collector-contrib/receiver/snmpreceiver version: latest diff --git a/receiver/snmpreceiver/testdata/expected_metrics/24_scalar_ra_string_and_coid_attr_string_on_coid_metric_golden.yaml b/receiver/snmpreceiver/testdata/expected_metrics/24_scalar_ra_string_and_coid_attr_string_on_coid_metric_golden.yaml index ad68c4e4cd3e..1c9246ad5b38 100644 --- a/receiver/snmpreceiver/testdata/expected_metrics/24_scalar_ra_string_and_coid_attr_string_on_coid_metric_golden.yaml +++ b/receiver/snmpreceiver/testdata/expected_metrics/24_scalar_ra_string_and_coid_attr_string_on_coid_metric_golden.yaml @@ -24,5 +24,5 @@ resourceMetrics: name: metric1 unit: By scope: - name: otelcol/snmpreceiver + name: github.com/open-telemetry/opentelemetry-collector-contrib/receiver/snmpreceiver version: latest diff --git a/receiver/snmpreceiver/testdata/expected_metrics/25_scalar_ra_string_and_ivp_attr_on_coid_metric_golden.yaml b/receiver/snmpreceiver/testdata/expected_metrics/25_scalar_ra_string_and_ivp_attr_on_coid_metric_golden.yaml index 90ada758d879..8328ee4de0c3 100644 --- a/receiver/snmpreceiver/testdata/expected_metrics/25_scalar_ra_string_and_ivp_attr_on_coid_metric_golden.yaml +++ b/receiver/snmpreceiver/testdata/expected_metrics/25_scalar_ra_string_and_ivp_attr_on_coid_metric_golden.yaml @@ -24,5 +24,5 @@ resourceMetrics: name: metric1 unit: By scope: - name: otelcol/snmpreceiver + name: github.com/open-telemetry/opentelemetry-collector-contrib/receiver/snmpreceiver version: latest diff --git a/receiver/snmpreceiver/testdata/expected_metrics/26_scalar_ra_string_on_scalar_metric_golden.yaml b/receiver/snmpreceiver/testdata/expected_metrics/26_scalar_ra_string_on_scalar_metric_golden.yaml index 8121fd4a39ba..e72c5546d805 100644 --- a/receiver/snmpreceiver/testdata/expected_metrics/26_scalar_ra_string_on_scalar_metric_golden.yaml +++ b/receiver/snmpreceiver/testdata/expected_metrics/26_scalar_ra_string_on_scalar_metric_golden.yaml @@ -14,5 +14,5 @@ resourceMetrics: name: metric1 unit: By scope: - name: otelcol/snmpreceiver + name: github.com/open-telemetry/opentelemetry-collector-contrib/receiver/snmpreceiver version: latest diff --git a/receiver/snmpreceiver/testdata/expected_metrics/27_multiple_scalar_ra_string_on_scalar_metric_golden.yaml b/receiver/snmpreceiver/testdata/expected_metrics/27_multiple_scalar_ra_string_on_scalar_metric_golden.yaml index 10a36f564362..f8e53ef300ff 100644 --- a/receiver/snmpreceiver/testdata/expected_metrics/27_multiple_scalar_ra_string_on_scalar_metric_golden.yaml +++ b/receiver/snmpreceiver/testdata/expected_metrics/27_multiple_scalar_ra_string_on_scalar_metric_golden.yaml @@ -17,5 +17,5 @@ resourceMetrics: name: metric1 unit: By scope: - name: otelcol/snmpreceiver + name: github.com/open-telemetry/opentelemetry-collector-contrib/receiver/snmpreceiver version: latest diff --git a/receiver/snmpreceiver/testdata/expected_metrics/28_two_scalar_oid_metrics_with_same_resource_attribute_golden.yaml b/receiver/snmpreceiver/testdata/expected_metrics/28_two_scalar_oid_metrics_with_same_resource_attribute_golden.yaml index 414906c75c8b..40d457cafa69 100644 --- a/receiver/snmpreceiver/testdata/expected_metrics/28_two_scalar_oid_metrics_with_same_resource_attribute_golden.yaml +++ b/receiver/snmpreceiver/testdata/expected_metrics/28_two_scalar_oid_metrics_with_same_resource_attribute_golden.yaml @@ -21,5 +21,5 @@ resourceMetrics: name: metric2 unit: By scope: - name: otelcol/snmpreceiver + name: github.com/open-telemetry/opentelemetry-collector-contrib/receiver/snmpreceiver version: latest diff --git a/receiver/snmpreceiver/testdata/expected_metrics/29_metric_does_not_use_all_available_scalar_RAs_golden.yaml b/receiver/snmpreceiver/testdata/expected_metrics/29_metric_does_not_use_all_available_scalar_RAs_golden.yaml index ad68c4e4cd3e..1c9246ad5b38 100644 --- a/receiver/snmpreceiver/testdata/expected_metrics/29_metric_does_not_use_all_available_scalar_RAs_golden.yaml +++ b/receiver/snmpreceiver/testdata/expected_metrics/29_metric_does_not_use_all_available_scalar_RAs_golden.yaml @@ -24,5 +24,5 @@ resourceMetrics: name: metric1 unit: By scope: - name: otelcol/snmpreceiver + name: github.com/open-telemetry/opentelemetry-collector-contrib/receiver/snmpreceiver version: latest diff --git a/receiver/snmpreceiver/testdata/expected_metrics/2_scalar_metrics_sum_cumulative_golden.yaml b/receiver/snmpreceiver/testdata/expected_metrics/2_scalar_metrics_sum_cumulative_golden.yaml index 9b18ed1a6a14..b572fb6ab51f 100644 --- a/receiver/snmpreceiver/testdata/expected_metrics/2_scalar_metrics_sum_cumulative_golden.yaml +++ b/receiver/snmpreceiver/testdata/expected_metrics/2_scalar_metrics_sum_cumulative_golden.yaml @@ -12,5 +12,5 @@ resourceMetrics: isMonotonic: true unit: By scope: - name: otelcol/snmpreceiver + name: github.com/open-telemetry/opentelemetry-collector-contrib/receiver/snmpreceiver version: latest diff --git a/receiver/snmpreceiver/testdata/expected_metrics/3_scalar_metrics_sum_delta_golden.yaml b/receiver/snmpreceiver/testdata/expected_metrics/3_scalar_metrics_sum_delta_golden.yaml index a6e01228f74a..c8a8fa64b096 100644 --- a/receiver/snmpreceiver/testdata/expected_metrics/3_scalar_metrics_sum_delta_golden.yaml +++ b/receiver/snmpreceiver/testdata/expected_metrics/3_scalar_metrics_sum_delta_golden.yaml @@ -11,5 +11,5 @@ resourceMetrics: timeUnixNano: "1000000" unit: By scope: - name: otelcol/snmpreceiver + name: github.com/open-telemetry/opentelemetry-collector-contrib/receiver/snmpreceiver version: latest diff --git a/receiver/snmpreceiver/testdata/expected_metrics/4_scalar_multiple_metrics_golden.yaml b/receiver/snmpreceiver/testdata/expected_metrics/4_scalar_multiple_metrics_golden.yaml index abe5439d047e..e559d6605e86 100644 --- a/receiver/snmpreceiver/testdata/expected_metrics/4_scalar_multiple_metrics_golden.yaml +++ b/receiver/snmpreceiver/testdata/expected_metrics/4_scalar_multiple_metrics_golden.yaml @@ -17,5 +17,5 @@ resourceMetrics: name: metric2 unit: '{things}' scope: - name: otelcol/snmpreceiver + name: github.com/open-telemetry/opentelemetry-collector-contrib/receiver/snmpreceiver version: latest diff --git a/receiver/snmpreceiver/testdata/expected_metrics/5_scalar_metric_w_attr_golden.yaml b/receiver/snmpreceiver/testdata/expected_metrics/5_scalar_metric_w_attr_golden.yaml index 71e3fa0e810d..170bda78c992 100644 --- a/receiver/snmpreceiver/testdata/expected_metrics/5_scalar_metric_w_attr_golden.yaml +++ b/receiver/snmpreceiver/testdata/expected_metrics/5_scalar_metric_w_attr_golden.yaml @@ -17,5 +17,5 @@ resourceMetrics: name: metric1 unit: By scope: - name: otelcol/snmpreceiver + name: github.com/open-telemetry/opentelemetry-collector-contrib/receiver/snmpreceiver version: latest diff --git a/receiver/snmpreceiver/testdata/expected_metrics/6_scalar_metric_w_multi_datapoint_golden.yaml b/receiver/snmpreceiver/testdata/expected_metrics/6_scalar_metric_w_multi_datapoint_golden.yaml index 0352c07fd9d8..343acbeaf6f6 100644 --- a/receiver/snmpreceiver/testdata/expected_metrics/6_scalar_metric_w_multi_datapoint_golden.yaml +++ b/receiver/snmpreceiver/testdata/expected_metrics/6_scalar_metric_w_multi_datapoint_golden.yaml @@ -20,5 +20,5 @@ resourceMetrics: name: metric1 unit: By scope: - name: otelcol/snmpreceiver + name: github.com/open-telemetry/opentelemetry-collector-contrib/receiver/snmpreceiver version: latest diff --git a/receiver/snmpreceiver/testdata/expected_metrics/7_indexed_metrics_golden.yaml b/receiver/snmpreceiver/testdata/expected_metrics/7_indexed_metrics_golden.yaml index 8a7e942ad609..296c16e17bef 100644 --- a/receiver/snmpreceiver/testdata/expected_metrics/7_indexed_metrics_golden.yaml +++ b/receiver/snmpreceiver/testdata/expected_metrics/7_indexed_metrics_golden.yaml @@ -20,5 +20,5 @@ resourceMetrics: name: metric1 unit: By scope: - name: otelcol/snmpreceiver + name: github.com/open-telemetry/opentelemetry-collector-contrib/receiver/snmpreceiver version: latest diff --git a/receiver/snmpreceiver/testdata/expected_metrics/8_indexed_metrics_sum_cumulative_golden.yaml b/receiver/snmpreceiver/testdata/expected_metrics/8_indexed_metrics_sum_cumulative_golden.yaml index cac7eeb49d1a..afde8c05bc7a 100644 --- a/receiver/snmpreceiver/testdata/expected_metrics/8_indexed_metrics_sum_cumulative_golden.yaml +++ b/receiver/snmpreceiver/testdata/expected_metrics/8_indexed_metrics_sum_cumulative_golden.yaml @@ -22,5 +22,5 @@ resourceMetrics: isMonotonic: true unit: By scope: - name: otelcol/snmpreceiver + name: github.com/open-telemetry/opentelemetry-collector-contrib/receiver/snmpreceiver version: latest diff --git a/receiver/snmpreceiver/testdata/expected_metrics/9_indexed_metrics_sum_delta_golden.yaml b/receiver/snmpreceiver/testdata/expected_metrics/9_indexed_metrics_sum_delta_golden.yaml index 72a6b24769c0..2e7817183db6 100644 --- a/receiver/snmpreceiver/testdata/expected_metrics/9_indexed_metrics_sum_delta_golden.yaml +++ b/receiver/snmpreceiver/testdata/expected_metrics/9_indexed_metrics_sum_delta_golden.yaml @@ -21,5 +21,5 @@ resourceMetrics: timeUnixNano: "1000000" unit: By scope: - name: otelcol/snmpreceiver + name: github.com/open-telemetry/opentelemetry-collector-contrib/receiver/snmpreceiver version: latest diff --git a/receiver/snmpreceiver/testdata/integration/v2c_config_expected_metrics.yaml b/receiver/snmpreceiver/testdata/integration/v2c_config_expected_metrics.yaml index 521e01d6fcda..7b1f58a8cc17 100644 --- a/receiver/snmpreceiver/testdata/integration/v2c_config_expected_metrics.yaml +++ b/receiver/snmpreceiver/testdata/integration/v2c_config_expected_metrics.yaml @@ -27,7 +27,7 @@ resourceMetrics: name: snmp.test.metric.sysservices unit: by scope: - name: otelcol/snmpreceiver + name: github.com/open-telemetry/opentelemetry-collector-contrib/receiver/snmpreceiver version: latest - resource: attributes: @@ -53,7 +53,7 @@ resourceMetrics: isMonotonic: true unit: By scope: - name: otelcol/snmpreceiver + name: github.com/open-telemetry/opentelemetry-collector-contrib/receiver/snmpreceiver version: latest - resource: attributes: @@ -79,7 +79,7 @@ resourceMetrics: isMonotonic: true unit: By scope: - name: otelcol/snmpreceiver + name: github.com/open-telemetry/opentelemetry-collector-contrib/receiver/snmpreceiver version: latest - resource: attributes: @@ -105,5 +105,5 @@ resourceMetrics: isMonotonic: true unit: By scope: - name: otelcol/snmpreceiver + name: github.com/open-telemetry/opentelemetry-collector-contrib/receiver/snmpreceiver version: latest diff --git a/receiver/snmpreceiver/testdata/integration/v3_config_expected_metrics.yaml b/receiver/snmpreceiver/testdata/integration/v3_config_expected_metrics.yaml index 441f5491aeaa..cc1337c8cfe0 100644 --- a/receiver/snmpreceiver/testdata/integration/v3_config_expected_metrics.yaml +++ b/receiver/snmpreceiver/testdata/integration/v3_config_expected_metrics.yaml @@ -27,7 +27,7 @@ resourceMetrics: name: snmp.test.metric.sysuptime unit: by scope: - name: otelcol/snmpreceiver + name: github.com/open-telemetry/opentelemetry-collector-contrib/receiver/snmpreceiver version: latest - resource: attributes: @@ -53,7 +53,7 @@ resourceMetrics: isMonotonic: true unit: By scope: - name: otelcol/snmpreceiver + name: github.com/open-telemetry/opentelemetry-collector-contrib/receiver/snmpreceiver version: latest - resource: attributes: @@ -79,7 +79,7 @@ resourceMetrics: isMonotonic: true unit: By scope: - name: otelcol/snmpreceiver + name: github.com/open-telemetry/opentelemetry-collector-contrib/receiver/snmpreceiver version: latest - resource: attributes: @@ -105,5 +105,5 @@ resourceMetrics: isMonotonic: true unit: By scope: - name: otelcol/snmpreceiver + name: github.com/open-telemetry/opentelemetry-collector-contrib/receiver/snmpreceiver version: latest diff --git a/reports/distributions/contrib.yaml b/reports/distributions/contrib.yaml index afebe9fbff42..a4fb9e373609 100644 --- a/reports/distributions/contrib.yaml +++ b/reports/distributions/contrib.yaml @@ -125,6 +125,7 @@ components: - filestats - flinkmetrics - fluentforward + - googlecloudmonitoring - googlecloudspanner - haproxy - hostmetrics diff --git a/versions.yaml b/versions.yaml index 912ece946935..75531d492b6e 100644 --- a/versions.yaml +++ b/versions.yaml @@ -212,6 +212,7 @@ module-sets: - github.com/open-telemetry/opentelemetry-collector-contrib/receiver/flinkmetricsreceiver - github.com/open-telemetry/opentelemetry-collector-contrib/receiver/fluentforwardreceiver - github.com/open-telemetry/opentelemetry-collector-contrib/receiver/gitproviderreceiver + - github.com/open-telemetry/opentelemetry-collector-contrib/receiver/googlecloudmonitoringreceiver - github.com/open-telemetry/opentelemetry-collector-contrib/receiver/googlecloudpubsubreceiver - github.com/open-telemetry/opentelemetry-collector-contrib/receiver/googlecloudspannerreceiver - github.com/open-telemetry/opentelemetry-collector-contrib/receiver/haproxyreceiver