diff --git a/.chloggen/codeboten_semconv-1.26.0.yaml b/.chloggen/add-batching-option-to-otlp-exporter.yaml similarity index 89% rename from .chloggen/codeboten_semconv-1.26.0.yaml rename to .chloggen/add-batching-option-to-otlp-exporter.yaml index 6bc4a70b621..b83465823df 100644 --- a/.chloggen/codeboten_semconv-1.26.0.yaml +++ b/.chloggen/add-batching-option-to-otlp-exporter.yaml @@ -4,13 +4,13 @@ change_type: enhancement # The name of the component, or a single word describing the area of concern, (e.g. otlpreceiver) -component: semconv +component: exporter/otlp # A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). -note: Add v1.26.0 semantic conventions package +note: "Add batching option to otlp exporter" # One or more tracking issues or pull requests related to the change -issues: [10249,10829] +issues: [8122] # (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. @@ -22,4 +22,4 @@ subtext: # 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: [] +change_logs: [user] diff --git a/.chloggen/mx-psi_remove-has-original.yaml b/.chloggen/batchprocessor_metric_units.yaml similarity index 91% rename from .chloggen/mx-psi_remove-has-original.yaml rename to .chloggen/batchprocessor_metric_units.yaml index 9f1417fca57..a611ce94026 100644 --- a/.chloggen/mx-psi_remove-has-original.yaml +++ b/.chloggen/batchprocessor_metric_units.yaml @@ -4,13 +4,13 @@ change_type: bug_fix # The name of the component, or a single word describing the area of concern, (e.g. otlpreceiver) -component: confmap +component: batchprocessor # A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). -note: Remove original string representation if invalid. +note: Update units for internal telemetry # One or more tracking issues or pull requests related to the change -issues: [10787] +issues: [10652] # (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. diff --git a/.chloggen/new_cors_default_config.yaml b/.chloggen/builder-skip-go-mod.yaml similarity index 86% rename from .chloggen/new_cors_default_config.yaml rename to .chloggen/builder-skip-go-mod.yaml index 5587c31d28f..619e29e3489 100644 --- a/.chloggen/new_cors_default_config.yaml +++ b/.chloggen/builder-skip-go-mod.yaml @@ -4,13 +4,13 @@ change_type: enhancement # The name of the component, or a single word describing the area of concern, (e.g. otlpreceiver) -component: confighttp +component: builder # A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). -note: Add `NewDefaultCORSConfig` function to initialize the default `confighttp.CORSConfig` +note: Add a --skip-new-go-module flag to skip creating a module in the output directory. # One or more tracking issues or pull requests related to the change -issues: [9655] +issues: [9252] # (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. @@ -22,4 +22,4 @@ subtext: # 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: [api] +change_logs: [] diff --git a/.chloggen/unify-env-var-gate-stable.yaml b/.chloggen/codeboten_go-1.23.yaml similarity index 65% rename from .chloggen/unify-env-var-gate-stable.yaml rename to .chloggen/codeboten_go-1.23.yaml index e75a001f686..60cacf65cc0 100644 --- a/.chloggen/unify-env-var-gate-stable.yaml +++ b/.chloggen/codeboten_go-1.23.yaml @@ -3,20 +3,22 @@ # 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. otlpreceiver) -component: confmap +# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver) +component: all # A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). -note: Set the `confmap.unifyEnvVarExpansion` feature gate to Stable. Expansion of `$FOO` env vars is no longer supported. Use `${FOO}` or `${env:FOO}` instead. +note: Added support for go1.23, bumped the minimum version to 1.22 -# One or more tracking issues or pull requests related to the change -issues: [10508] +# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists. +issues: [10869] # (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. diff --git a/.chloggen/codeboten_leveled-meter-split-2.yaml b/.chloggen/codeboten_leveled-meter-split-2.yaml new file mode 100644 index 00000000000..72419990771 --- /dev/null +++ b/.chloggen/codeboten_leveled-meter-split-2.yaml @@ -0,0 +1,25 @@ +# 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. otlpreceiver) +component: component + +# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). +note: "Add `TelemetrySettings.LeveledMeterProvider` func to replace MetricsLevel in the near future" + +# One or more tracking issues or pull requests related to the change +issues: [10931] + +# (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: + +# 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/stabilize_client.yaml b/.chloggen/codeboten_leveled-meter-split-3.yaml similarity index 92% rename from .chloggen/stabilize_client.yaml rename to .chloggen/codeboten_leveled-meter-split-3.yaml index aeabbbd7e6a..c3841a027d6 100644 --- a/.chloggen/stabilize_client.yaml +++ b/.chloggen/codeboten_leveled-meter-split-3.yaml @@ -4,13 +4,13 @@ change_type: enhancement # The name of the component, or a single word describing the area of concern, (e.g. otlpreceiver) -component: client +component: mdatagen # A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). -note: Mark module as stable. +note: "Add `LeveledMeter` method to mdatagen" # One or more tracking issues or pull requests related to the change -issues: [10775] +issues: [10933] # (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. diff --git a/.chloggen/deprecate-expandconverter.yaml b/.chloggen/codeboten_mark-meter-deprecated.yaml similarity index 89% rename from .chloggen/deprecate-expandconverter.yaml rename to .chloggen/codeboten_mark-meter-deprecated.yaml index 770ce3e0164..b97e7662497 100644 --- a/.chloggen/deprecate-expandconverter.yaml +++ b/.chloggen/codeboten_mark-meter-deprecated.yaml @@ -4,13 +4,13 @@ change_type: deprecation # The name of the component, or a single word describing the area of concern, (e.g. otlpreceiver) -component: expandconverter +component: mdatagen # A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). -note: Deprecate `expandconverter`. +note: "Deprecating generated `Meter` func in favour of `LeveledMeter`" # One or more tracking issues or pull requests related to the change -issues: [10510] +issues: [10939] # (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. diff --git a/.chloggen/NewCommandMustSetProvider.yaml b/.chloggen/codeboten_remove-deprecated.yaml similarity index 91% rename from .chloggen/NewCommandMustSetProvider.yaml rename to .chloggen/codeboten_remove-deprecated.yaml index 742b1c8ada0..5cdc50982b0 100644 --- a/.chloggen/NewCommandMustSetProvider.yaml +++ b/.chloggen/codeboten_remove-deprecated.yaml @@ -7,10 +7,10 @@ change_type: breaking component: otelcol # A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). -note: Delete deprecated NewCommandMustSetProvider +note: Remove deprecated `ConfmapProvider` interface. # One or more tracking issues or pull requests related to the change -issues: [10778] +issues: [10934] # (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. @@ -22,4 +22,4 @@ subtext: # 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: [api] +change_logs: [] diff --git a/.chloggen/deprecate-expandconverter-3.yaml b/.chloggen/component-remove-reporting-from-struct-2-2.yaml similarity index 88% rename from .chloggen/deprecate-expandconverter-3.yaml rename to .chloggen/component-remove-reporting-from-struct-2-2.yaml index ee8001aa4f3..56479c00f18 100644 --- a/.chloggen/deprecate-expandconverter-3.yaml +++ b/.chloggen/component-remove-reporting-from-struct-2-2.yaml @@ -4,13 +4,13 @@ change_type: breaking # The name of the component, or a single word describing the area of concern, (e.g. otlpreceiver) -component: ocb +component: extensions # A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). -note: Collectors built with OCB will no longer include the `expandconverter` +note: Remove `StatusWatcher` interface. Use `componentstatus.Watcher` instead. # One or more tracking issues or pull requests related to the change -issues: [10510] +issues: [10777] # (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. diff --git a/.chloggen/component-remove-deprecated-method.yaml b/.chloggen/component-remove-reporting-from-struct-2-3.yaml similarity index 90% rename from .chloggen/component-remove-deprecated-method.yaml rename to .chloggen/component-remove-reporting-from-struct-2-3.yaml index f17e273ec5f..4af073a52da 100644 --- a/.chloggen/component-remove-deprecated-method.yaml +++ b/.chloggen/component-remove-reporting-from-struct-2-3.yaml @@ -7,10 +7,10 @@ change_type: breaking component: component # A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). -note: Removes the deprecated `Host.GetFactory` method. +note: Removed Status related types and functions. Use `componentstatus` instead. # One or more tracking issues or pull requests related to the change -issues: [10771] +issues: [10777] # (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. diff --git a/.chloggen/deprecate-expandconverter-2.yaml b/.chloggen/component-remove-reporting-from-struct-2.yaml similarity index 87% rename from .chloggen/deprecate-expandconverter-2.yaml rename to .chloggen/component-remove-reporting-from-struct-2.yaml index 4375a388747..7151d58f36f 100644 --- a/.chloggen/deprecate-expandconverter-2.yaml +++ b/.chloggen/component-remove-reporting-from-struct-2.yaml @@ -4,13 +4,13 @@ change_type: breaking # The name of the component, or a single word describing the area of concern, (e.g. otlpreceiver) -component: otelcoltest +component: component # A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). -note: The `otelcol.LoadConfig` method no longer sets the `expandconverter`. +note: Remove `ReportStatus` from `TelemetrySettings`. Use `componentstatus.ReportStatus` instead. # One or more tracking issues or pull requests related to the change -issues: [10510] +issues: [10777] # (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. diff --git a/.chloggen/componentstatus-new-module.yaml b/.chloggen/componentstatus-add-reporter-interface.yaml similarity index 85% rename from .chloggen/componentstatus-new-module.yaml rename to .chloggen/componentstatus-add-reporter-interface.yaml index 17a11840b58..84ba7643ef7 100644 --- a/.chloggen/componentstatus-new-module.yaml +++ b/.chloggen/componentstatus-add-reporter-interface.yaml @@ -1,16 +1,16 @@ # Use this changelog template to create an entry for release notes. # One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' -change_type: new_component +change_type: enhancement # The name of the component, or a single word describing the area of concern, (e.g. otlpreceiver) component: componentstatus # A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). -note: Adds new componentstatus module that will soon replace status content in component. +note: Add new Reporter interface to define how to report a status via a `component.Host` implementation # One or more tracking issues or pull requests related to the change -issues: [10730] +issues: [10852] # (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. @@ -22,4 +22,4 @@ subtext: # 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: [api] +change_logs: [] diff --git a/.chloggen/mx-psi_restrict-providers-scheme.yaml b/.chloggen/fix_links.yaml similarity index 87% rename from .chloggen/mx-psi_restrict-providers-scheme.yaml rename to .chloggen/fix_links.yaml index e96b51f6408..7ff4bcd2664 100644 --- a/.chloggen/mx-psi_restrict-providers-scheme.yaml +++ b/.chloggen/fix_links.yaml @@ -4,13 +4,13 @@ change_type: enhancement # The name of the component, or a single word describing the area of concern, (e.g. otlpreceiver) -component: confmap +component: mdatagen # A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). -note: Check that providers have a correct scheme when building a confmap.Resolver. +note: support using a different github project in mdatagen README issues list # One or more tracking issues or pull requests related to the change -issues: [10786] +issues: [10484] # (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. @@ -22,4 +22,4 @@ subtext: # 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: [api] +change_logs: [] diff --git a/.chloggen/mx-psi_limit-for-component-names.yaml b/.chloggen/goleak_service.yaml old mode 100644 new mode 100755 similarity index 88% rename from .chloggen/mx-psi_limit-for-component-names.yaml rename to .chloggen/goleak_service.yaml index 5b5dcfbb259..b16d72fa43f --- a/.chloggen/mx-psi_limit-for-component-names.yaml +++ b/.chloggen/goleak_service.yaml @@ -4,13 +4,13 @@ change_type: bug_fix # The name of the component, or a single word describing the area of concern, (e.g. otlpreceiver) -component: component +component: service # A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). -note: Allow component names of up to 1024 characters in length. +note: Fix memory leaks during service package shutdown # One or more tracking issues or pull requests related to the change -issues: [10816] +issues: [9165] # (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. @@ -22,4 +22,4 @@ subtext: # 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: [] +change_logs: [] \ No newline at end of file diff --git a/.chloggen/immutable-instance-id.yaml b/.chloggen/immutable-instance-id.yaml new file mode 100644 index 00000000000..78820178d86 --- /dev/null +++ b/.chloggen/immutable-instance-id.yaml @@ -0,0 +1,25 @@ +# 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. otlpreceiver) +component: componentstatus + +# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). +note: Make componentstatus.InstanceID immutable. + +# One or more tracking issues or pull requests related to the change +issues: [10494] + +# (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: + +# 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: [api] \ No newline at end of file diff --git a/.chloggen/int-telemetry-otlp-options.yaml b/.chloggen/int-telemetry-otlp-options.yaml deleted file mode 100644 index 008977eeb6f..00000000000 --- a/.chloggen/int-telemetry-otlp-options.yaml +++ /dev/null @@ -1,25 +0,0 @@ -# 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. otlpreceiver) -component: service - -# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). -note: "Implement the `temporality_preference` setting for internal telemetry exported via OTLP" - -# One or more tracking issues or pull requests related to the change -issues: [ 10745 ] - -# (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: - -# 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/add_default_timeout.yaml b/.chloggen/mdatagen-context.yaml similarity index 87% rename from .chloggen/add_default_timeout.yaml rename to .chloggen/mdatagen-context.yaml index 3bd111a09e1..f061acad1ef 100644 --- a/.chloggen/add_default_timeout.yaml +++ b/.chloggen/mdatagen-context.yaml @@ -4,13 +4,13 @@ change_type: bug_fix # The name of the component, or a single word describing the area of concern, (e.g. otlpreceiver) -component: configtelemetry +component: mdatagen # A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). -note: Add 10s read header timeout on the configtelemetry Prometheus HTTP server. +note: Update generated telemetry template to only include context import when there are async metrics. # One or more tracking issues or pull requests related to the change -issues: [5699] +issues: [10883] # (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. diff --git a/.chloggen/mdatagen-test-gen.yaml b/.chloggen/mdatagen-test-gen.yaml new file mode 100644 index 00000000000..e3d376033a2 --- /dev/null +++ b/.chloggen/mdatagen-test-gen.yaml @@ -0,0 +1,25 @@ +# 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. otlpreceiver) +component: mdatagen + +# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). +note: Fixed bug in which setting `SkipLifecycle` & `SkipShutdown` to true would result in a generated file with an unused import `confmaptest` + +# One or more tracking issues or pull requests related to the change +issues: [10866] + +# (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: + +# 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/mdatagen-usage.yaml b/.chloggen/mdatagen-usage.yaml new file mode 100644 index 00000000000..d0ddd938a50 --- /dev/null +++ b/.chloggen/mdatagen-usage.yaml @@ -0,0 +1,25 @@ +# 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. otlpreceiver) +component: mdatagen + +# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). +note: Updates mdatagen's usage to output a complete command line example, including the metadata.yaml file. + +# One or more tracking issues or pull requests related to the change +issues: [10886] + +# (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: + +# 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/module-info-extensions.yaml b/.chloggen/module-info-extensions.yaml new file mode 100644 index 00000000000..191d80a1016 --- /dev/null +++ b/.chloggen/module-info-extensions.yaml @@ -0,0 +1,25 @@ +# 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. otlpreceiver) +component: extension + +# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). +note: "Add ModuleInfo to extension.Settings to allow extensions to access component go module information." + +# One or more tracking issues or pull requests related to the change +issues: [10876] + +# (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: + +# 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/mx-psi_add-string-representation-for-everything.yaml b/.chloggen/mx-psi_add-string-representation-for-everything.yaml deleted file mode 100644 index 8abc371f6fc..00000000000 --- a/.chloggen/mx-psi_add-string-representation-for-everything.yaml +++ /dev/null @@ -1,26 +0,0 @@ -# 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. otlpreceiver) -component: confmap - -# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). -note: Allow using any YAML structure as a string when loading configuration. - -# One or more tracking issues or pull requests related to the change -issues: [10800] - -# (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: | - Previous to this change, slices could not be used as strings in configuration. - -# 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/mx-psi_fix-invalid-yaml-string.yaml b/.chloggen/mx-psi_fix-invalid-yaml-string.yaml deleted file mode 100644 index 01af9d41f68..00000000000 --- a/.chloggen/mx-psi_fix-invalid-yaml-string.yaml +++ /dev/null @@ -1,26 +0,0 @@ -# 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. otlpreceiver) -component: confmap - -# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). -note: If loading an invalid YAML string through a provider, use it verbatim instead of erroring out. - -# One or more tracking issues or pull requests related to the change -issues: [10759] - -# (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: | - This makes the ${env:ENV} syntax closer to how ${ENV} worked before unifying syntaxes. - -# 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/mx-psi_fix-106-issue.yaml b/.chloggen/mx-psi_preserve-internal-repr.yaml similarity index 89% rename from .chloggen/mx-psi_fix-106-issue.yaml rename to .chloggen/mx-psi_preserve-internal-repr.yaml index abf6d216b85..55a2f2dc969 100644 --- a/.chloggen/mx-psi_fix-106-issue.yaml +++ b/.chloggen/mx-psi_preserve-internal-repr.yaml @@ -4,13 +4,13 @@ change_type: bug_fix # The name of the component, or a single word describing the area of concern, (e.g. otlpreceiver) -component: configauth +component: otelcol # A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). -note: Fix unmarshaling of authentication in HTTP servers. +note: Preserve internal representation when unmarshaling component configs # One or more tracking issues or pull requests related to the change -issues: [10750] +issues: [10552] # (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. diff --git a/.chloggen/codeboten_rm-opencensus.yaml b/.chloggen/mx-psi_strict-typing-stable.yaml similarity index 89% rename from .chloggen/codeboten_rm-opencensus.yaml rename to .chloggen/mx-psi_strict-typing-stable.yaml index 3599f765550..4488c466533 100644 --- a/.chloggen/codeboten_rm-opencensus.yaml +++ b/.chloggen/mx-psi_strict-typing-stable.yaml @@ -4,13 +4,13 @@ change_type: breaking # The name of the component, or a single word describing the area of concern, (e.g. otlpreceiver) -component: service +component: confmap # A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). -note: Remove OpenCensus bridge completely, mark feature gate as stable. +note: Mark `confmap.strictlyTypedInput` as stable # One or more tracking issues or pull requests related to the change -issues: [10414] +issues: [10552] # (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. diff --git a/.chloggen/obsexporter.yaml b/.chloggen/obsexporter.yaml deleted file mode 100644 index 7162ec0df1b..00000000000 --- a/.chloggen/obsexporter.yaml +++ /dev/null @@ -1,25 +0,0 @@ -# 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. otlpreceiver) -component: exporterhelper - -# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). -note: Delete deprecated `exporterhelper.ObsReport` and `exporterhelper.NewObsReport` - -# One or more tracking issues or pull requests related to the change -issues: [10779, 10592] - -# (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: - -# 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: [api] diff --git a/.chloggen/private-connector-builder.yaml b/.chloggen/private-connector-builder.yaml new file mode 100644 index 00000000000..a4909b061a7 --- /dev/null +++ b/.chloggen/private-connector-builder.yaml @@ -0,0 +1,25 @@ +# Use this changelog template to create an entry for release notes. + +# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' +change_type: deprecation + +# The name of the component, or a single word describing the area of concern, (e.g. otlpreceiver) +component: connector + +# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). +note: Deprecate connector.Builder, and move it into an internal package of the service module + +# One or more tracking issues or pull requests related to the change +issues: [10784] + +# (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: + +# 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: [api] diff --git a/.chloggen/private-exporter-builder.yaml b/.chloggen/private-exporter-builder.yaml new file mode 100644 index 00000000000..d31aa643ab4 --- /dev/null +++ b/.chloggen/private-exporter-builder.yaml @@ -0,0 +1,25 @@ +# Use this changelog template to create an entry for release notes. + +# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' +change_type: deprecation + +# The name of the component, or a single word describing the area of concern, (e.g. otlpreceiver) +component: exporter + +# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). +note: Deprecate exporter.Builder, and move it into an internal package of the service module + +# One or more tracking issues or pull requests related to the change +issues: [10783] + +# (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: + +# 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: [api] diff --git a/.chloggen/private-extension-builder.yaml b/.chloggen/private-extension-builder.yaml new file mode 100644 index 00000000000..ae4a99e3524 --- /dev/null +++ b/.chloggen/private-extension-builder.yaml @@ -0,0 +1,25 @@ +# Use this changelog template to create an entry for release notes. + +# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' +change_type: deprecation + +# The name of the component, or a single word describing the area of concern, (e.g. otlpreceiver) +component: extension + +# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). +note: Deprecate extension.Builder, and move it into an internal package of the service module + +# One or more tracking issues or pull requests related to the change +issues: [10785] + +# (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: + +# 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: [api] diff --git a/.chloggen/private-processor-builder.yaml b/.chloggen/private-processor-builder.yaml new file mode 100644 index 00000000000..66eb572672a --- /dev/null +++ b/.chloggen/private-processor-builder.yaml @@ -0,0 +1,25 @@ +# Use this changelog template to create an entry for release notes. + +# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' +change_type: deprecation + +# The name of the component, or a single word describing the area of concern, (e.g. otlpreceiver) +component: processor + +# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). +note: Deprecate processor.Builder, and move it into an internal package of the service module + +# One or more tracking issues or pull requests related to the change +issues: [10782] + +# (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: + +# 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: [api] diff --git a/.chloggen/private-receiver-builder.yaml b/.chloggen/private-receiver-builder.yaml new file mode 100644 index 00000000000..aa6657ecae2 --- /dev/null +++ b/.chloggen/private-receiver-builder.yaml @@ -0,0 +1,25 @@ +# Use this changelog template to create an entry for release notes. + +# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' +change_type: deprecation + +# The name of the component, or a single word describing the area of concern, (e.g. otlpreceiver) +component: receiver + +# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). +note: Deprecate receiver.Builder, and move it into an internal package of the service module + +# One or more tracking issues or pull requests related to the change +issues: [10781] + +# (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: + +# 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: [api] diff --git a/.chloggen/profiles-connector.yaml b/.chloggen/profiles-connector.yaml deleted file mode 100644 index 3cddea2ffad..00000000000 --- a/.chloggen/profiles-connector.yaml +++ /dev/null @@ -1,25 +0,0 @@ -# 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. otlpreceiver) -component: connector/connectorprofiles - -# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). -note: Allow handling profiles in connector. - -# One or more tracking issues or pull requests related to the change -issues: [10703] - -# (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: - -# 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: [api] diff --git a/.chloggen/profiles-exporter.yaml b/.chloggen/profiles-exporter.yaml deleted file mode 100644 index 4611e37a37f..00000000000 --- a/.chloggen/profiles-exporter.yaml +++ /dev/null @@ -1,25 +0,0 @@ -# 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. otlpreceiver) -component: exporter/exporterprofiles - -# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). -note: Allow handling profiles in exporter. - -# One or more tracking issues or pull requests related to the change -issues: [10702] - -# (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: - -# 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: [api] diff --git a/.chloggen/profiles-processor.yaml b/.chloggen/profiles-processor.yaml deleted file mode 100644 index 64a7a8655db..00000000000 --- a/.chloggen/profiles-processor.yaml +++ /dev/null @@ -1,25 +0,0 @@ -# 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. otlpreceiver) -component: processor/processorprofiles - -# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). -note: Allow handling profiles in processor. - -# One or more tracking issues or pull requests related to the change -issues: [10691] - -# (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: - -# 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: [api] diff --git a/.chloggen/profiles-receiver.yaml b/.chloggen/profiles-receiver.yaml deleted file mode 100644 index c167255eaf6..00000000000 --- a/.chloggen/profiles-receiver.yaml +++ /dev/null @@ -1,25 +0,0 @@ -# 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. otlpreceiver) -component: receiver/receiverprofiles - -# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). -note: Allow handling profiles in receiver. - -# One or more tracking issues or pull requests related to the change -issues: [10690] - -# (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: - -# 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: [api] diff --git a/.chloggen/semconv-v1.27.0.yaml b/.chloggen/semconv-v1.27.0.yaml deleted file mode 100644 index b9b7552bdca..00000000000 --- a/.chloggen/semconv-v1.27.0.yaml +++ /dev/null @@ -1,4 +0,0 @@ -change_type: enhancement -component: semconv -note: Add semantic conventions version v1.27.0 -issues: [10837] diff --git a/.github/workflows/api-compatibility.yml b/.github/workflows/api-compatibility.yml index 62bc59f99e6..92dbb6e3686 100644 --- a/.github/workflows/api-compatibility.yml +++ b/.github/workflows/api-compatibility.yml @@ -20,7 +20,6 @@ jobs: BASE_REF: ${{ github.base_ref }} HEAD_REF: ${{ github.head_ref }} steps: - - name: Checkout-Main uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 with: @@ -35,7 +34,7 @@ jobs: - name: Setup Go uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2 with: - go-version: ~1.21.5 + go-version: ~1.22.6 # Generate apidiff states of Main - name: Generate-States diff --git a/.github/workflows/build-and-test-arm.yml b/.github/workflows/build-and-test-arm.yml index 5f1e9887cd9..4e6ecf9dccf 100644 --- a/.github/workflows/build-and-test-arm.yml +++ b/.github/workflows/build-and-test-arm.yml @@ -31,7 +31,7 @@ jobs: - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2 with: - go-version: "~1.22.4" + go-version: "~1.22.6" cache: false - name: Cache Go id: go-cache diff --git a/.github/workflows/build-and-test-windows.yaml b/.github/workflows/build-and-test-windows.yaml index 3ad23e3941a..d89ca657143 100644 --- a/.github/workflows/build-and-test-windows.yaml +++ b/.github/workflows/build-and-test-windows.yaml @@ -1,9 +1,9 @@ name: build-and-test-windows on: push: - branches: [ main ] + branches: [main] tags: - - 'v[0-9]+.[0-9]+.[0-9]+*' + - "v[0-9]+.[0-9]+.[0-9]+*" pull_request: concurrency: @@ -22,7 +22,7 @@ jobs: - name: Setup Go uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2 with: - go-version: ~1.21.5 + go-version: ~1.22.6 cache: false - name: Cache Go uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2 @@ -47,7 +47,7 @@ jobs: - name: Setup Go uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2 with: - go-version: ~1.21.5 + go-version: ~1.22.6 cache: false - name: Cache Go uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2 diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index 55cd469832d..6916b9bea36 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -22,7 +22,7 @@ jobs: - name: Setup Go uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2 with: - go-version: ~1.21.12 + go-version: ~1.22.6 cache: false - name: Cache Go id: go-cache @@ -45,7 +45,7 @@ jobs: - name: Setup Go uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2 with: - go-version: ~1.21.12 + go-version: ~1.22.6 cache: false - name: Cache Go id: go-cache @@ -69,7 +69,7 @@ jobs: - name: Setup Go uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2 with: - go-version: ~1.21.12 + go-version: ~1.22.6 cache: false - name: Cache Go id: go-cache @@ -94,7 +94,7 @@ jobs: - name: Setup Go uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2 with: - go-version: ~1.21.12 + go-version: ~1.22.6 cache: false - name: Cache Go id: go-cache @@ -141,7 +141,7 @@ jobs: strategy: matrix: runner: [ubuntu-latest] - go-version: ["~1.22", "~1.21.12"] # 1.20 needs quotes otherwise it's interpreted as 1.2 + go-version: ["~1.23", "~1.22"] # 1.20 needs quotes otherwise it's interpreted as 1.2 runs-on: ${{ matrix.runner }} needs: [setup-environment] steps: @@ -194,7 +194,7 @@ jobs: - name: Setup Go uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2 with: - go-version: ~1.21.12 + go-version: ~1.22.6 cache: false - name: Cache Go id: go-cache @@ -256,7 +256,7 @@ jobs: - name: Setup Go uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2 with: - go-version: ~1.21.12 + go-version: ~1.22.6 cache: false - name: Cache Go id: go-cache diff --git a/.github/workflows/builder-integration-test.yaml b/.github/workflows/builder-integration-test.yaml index e8063fcdb71..c0712ec95d4 100644 --- a/.github/workflows/builder-integration-test.yaml +++ b/.github/workflows/builder-integration-test.yaml @@ -3,15 +3,15 @@ name: Builder - Integration tests on: # on changes to the main branch touching the builder push: - branches: [ main ] + branches: [main] # on PRs touching the builder pull_request: - branches: [ main ] + branches: [main] # once a day at 6:17 AM UTC schedule: - - cron: '17 6 * * *' + - cron: "17 6 * * *" # manual execution workflow_dispatch: @@ -33,6 +33,6 @@ jobs: - name: Setup Go uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2 with: - go-version: ~1.21.5 + go-version: ~1.22.6 - name: Test run: make builder-integration-test diff --git a/.github/workflows/changelog.yml b/.github/workflows/changelog.yml index fd5a8d6b0ce..78e15c0e140 100644 --- a/.github/workflows/changelog.yml +++ b/.github/workflows/changelog.yml @@ -32,7 +32,7 @@ jobs: - name: Setup Go uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2 with: - go-version: ~1.21.5 + go-version: ~1.22.6 - name: Cache Go id: go-cache uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2 @@ -77,10 +77,10 @@ jobs: - name: Render .chloggen changelog entries run: make chlog-preview > changelog_preview.md - name: Install markdown-link-check - run: npm install -g markdown-link-check + run: npm install - name: Run markdown-link-check run: | - markdown-link-check \ + npx --no -- markdown-link-check \ --verbose \ --config .github/workflows/check_links_config.json \ changelog_preview.md \ diff --git a/.github/workflows/check-goreleaser.yaml b/.github/workflows/check-goreleaser.yaml deleted file mode 100644 index 875b4b17f7c..00000000000 --- a/.github/workflows/check-goreleaser.yaml +++ /dev/null @@ -1,32 +0,0 @@ -name: Check GoReleaser Config -on: - push: - branches: [main] - tags: - - "v[0-9]+.[0-9]+.[0-9]+*" - pull_request: - -permissions: - contents: read - -jobs: - check: - runs-on: ubuntu-latest - steps: - - name: Checkout Repo - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - with: - fetch-depth: 0 - - name: Setup Go - uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2 - with: - go-version: ~1.21.5 - - name: Check GoReleaser - uses: goreleaser/goreleaser-action@286f3b13b1b49da4ac219696163fb8c1c93e1200 # v6.0.0 - with: - distribution: goreleaser-pro - version: latest - args: check --verbose cmd/builder/.goreleaser.yml - env: - GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }} - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/check-links.yaml b/.github/workflows/check-links.yaml index d7ce5c97691..3736e079aaf 100644 --- a/.github/workflows/check-links.yaml +++ b/.github/workflows/check-links.yaml @@ -1,7 +1,7 @@ name: check-links on: push: - branches: [ main ] + branches: [main] pull_request: concurrency: @@ -39,11 +39,11 @@ jobs: fetch-depth: 0 - name: Install markdown-link-check - run: npm install -g markdown-link-check@3.11.2 + run: npm install - name: Run markdown-link-check run: | - markdown-link-check \ + npx --no -- markdown-link-check \ --verbose \ --config .github/workflows/check_links_config.json \ ${{needs.changedfiles.outputs.md}} \ diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index e426e759180..f96735de217 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -1,7 +1,7 @@ name: "CodeQL Analysis" on: push: - branches: [ main ] + branches: [main] pull_request: concurrency: @@ -14,9 +14,9 @@ permissions: jobs: CodeQL-Build: permissions: - actions: read # for github/codeql-action/init to get workflow details - contents: read # for actions/checkout to fetch code - security-events: write # for github/codeql-action/autobuild to send a status report + actions: read # for github/codeql-action/init to get workflow details + contents: read # for actions/checkout to fetch code + security-events: write # for github/codeql-action/autobuild to send a status report runs-on: ubuntu-latest steps: @@ -26,16 +26,16 @@ jobs: - name: Setup Go uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2 with: - go-version: ~1.21.5 + go-version: ~1.22.6 # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL - uses: github/codeql-action/init@eb055d739abdc2e8de2e5f4ba1a8b246daa779aa # v3.26.0 + uses: github/codeql-action/init@883d8588e56d1753a8a58c1c86e88976f0c23449 # v3.26.3 with: languages: go - name: Autobuild - uses: github/codeql-action/autobuild@eb055d739abdc2e8de2e5f4ba1a8b246daa779aa # v3.26.0 + uses: github/codeql-action/autobuild@883d8588e56d1753a8a58c1c86e88976f0c23449 # v3.26.3 - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@eb055d739abdc2e8de2e5f4ba1a8b246daa779aa # v3.26.0 + uses: github/codeql-action/analyze@883d8588e56d1753a8a58c1c86e88976f0c23449 # v3.26.3 diff --git a/.github/workflows/contrib-tests.yml b/.github/workflows/contrib-tests.yml index 7319c8a6f91..6f5226a20c7 100644 --- a/.github/workflows/contrib-tests.yml +++ b/.github/workflows/contrib-tests.yml @@ -1,12 +1,12 @@ name: contrib-tests on: push: - branches: [ main ] + branches: [main] tags: - v[0-9]+.[0-9]+.[0-9]+.* pull_request: types: [opened, ready_for_review, synchronize, reopened, labeled, unlabeled] - branches: [ main ] + branches: [main] concurrency: group: ${{ github.workflow }}-${{ github.head_ref }} @@ -43,18 +43,18 @@ jobs: - name: Setup Go uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2 with: - go-version: ~1.21.5 + go-version: ~1.22.6 cache: false - name: Run Contrib Tests run: | contrib_path=/tmp/opentelemetry-collector-contrib git clone --depth=1 https://github.com/open-telemetry/opentelemetry-collector-contrib.git $contrib_path - make CONTRIB_PATH=$contrib_path SKIP_RESTORE_CONTRIB=true GROUP=${{ matrix.group }} check-contrib + make CONTRIB_PATH=$contrib_path SKIP_RESTORE_CONTRIB=true GROUP=${{ matrix.group }} check-contrib contrib_tests: runs-on: ubuntu-latest if: ${{ !contains(github.event.pull_request.labels.*.name, 'Skip Contrib Tests') }} - needs: [ contrib-tests-matrix ] + needs: [contrib-tests-matrix] steps: - name: Print result run: echo ${{ needs.contrib-tests-matrix.result }} diff --git a/.github/workflows/perf.yml b/.github/workflows/perf.yml index 279d3986801..12fd41b4eac 100644 --- a/.github/workflows/perf.yml +++ b/.github/workflows/perf.yml @@ -16,7 +16,7 @@ jobs: - name: Setup Go uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2 with: - go-version: ~1.21.5 + go-version: ~1.22.6 - name: Run benchmark run: make gobenchmark diff --git a/.github/workflows/prepare-release.yml b/.github/workflows/prepare-release.yml index 5074ed2acfe..8c35088c778 100644 --- a/.github/workflows/prepare-release.yml +++ b/.github/workflows/prepare-release.yml @@ -25,6 +25,7 @@ jobs: steps: - name: Validate version format + shell: bash run: | validate_beta_version() { local regex_pattern_beta='^[0-9]+\.[0-9]+\.[0-9]+$' @@ -42,17 +43,24 @@ jobs: fi } - validate_beta_version "${{ inputs.candidate-beta }}" "candidate-beta" + if [[ ! -z "${{ inputs.candidate-beta }}" ]]; then + validate_beta_version "${{ inputs.candidate-beta }}" "candidate-beta" + fi validate_beta_version "${{ inputs.current-beta }}" "current-beta" + if [[ ! -z "${{ inputs.candidate-stable }}" ]]; then validate_stable_version "${{ inputs.candidate-stable }}" "candidate-stable" fi validate_stable_version "${{ inputs.current-stable }}" "current-stable" - shell: bash + + if [[ -z "${{ inputs.candidate-beta }}" && -z "${{ inputs.candidate-stable }}" ]]; then + echo "Candidate version is not set for beta or stable. Please set a version to proceed." + exit 1 + fi # Releasing opentelemetry-collector prepare-release: - needs: + needs: - validate-versions runs-on: ubuntu-latest steps: @@ -86,7 +94,7 @@ jobs: - name: Setup Go uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2 with: - go-version: ~1.21.5 + go-version: ~1.22.6 # Prepare Core for release. # - Update CHANGELOG.md file, this is done via chloggen # - Run make prepare-release PREVIOUS_VERSION=1.0.0 RELEASE_CANDIDATE=1.1.0 MODSET=stable diff --git a/.github/workflows/scorecard.yml b/.github/workflows/scorecard.yml index e4ff70fc016..6f0993379d3 100644 --- a/.github/workflows/scorecard.yml +++ b/.github/workflows/scorecard.yml @@ -64,6 +64,6 @@ jobs: # Upload the results to GitHub's code scanning dashboard. - name: "Upload to code-scanning" - uses: github/codeql-action/upload-sarif@eb055d739abdc2e8de2e5f4ba1a8b246daa779aa # v3.26.0 + uses: github/codeql-action/upload-sarif@883d8588e56d1753a8a58c1c86e88976f0c23449 # v3.26.3 with: sarif_file: results.sarif diff --git a/.github/workflows/builder-release.yaml b/.github/workflows/sourcecode-release.yaml similarity index 72% rename from .github/workflows/builder-release.yaml rename to .github/workflows/sourcecode-release.yaml index b6ae4795adb..7e767539fc9 100644 --- a/.github/workflows/builder-release.yaml +++ b/.github/workflows/sourcecode-release.yaml @@ -1,9 +1,9 @@ -name: Builder - Release +name: Source Code - Release on: push: tags: - - 'v*' + - "v*" jobs: goreleaser: @@ -13,19 +13,6 @@ jobs: uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 with: fetch-depth: 0 - - name: Setup Go - uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2 - with: - go-version: ~1.21.5 - - name: Run GoReleaser - uses: goreleaser/goreleaser-action@286f3b13b1b49da4ac219696163fb8c1c93e1200 # v6.0.0 - with: - distribution: goreleaser-pro - version: latest - args: release --clean -f cmd/builder/.goreleaser.yml - env: - GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }} - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Create Github Release run: | gh release create ${{ github.ref_name }} -t ${{ github.ref_name }} -n "### Images and binaries here: https://github.com/open-telemetry/opentelemetry-collector-releases/releases/tag/${{ github.ref_name }}" diff --git a/.github/workflows/tidy-dependencies.yml b/.github/workflows/tidy-dependencies.yml index c5a203f0ad5..f0ed338285d 100644 --- a/.github/workflows/tidy-dependencies.yml +++ b/.github/workflows/tidy-dependencies.yml @@ -21,7 +21,7 @@ jobs: ref: ${{ github.head_ref }} - uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2 with: - go-version: ~1.21.12 + go-version: ~1.22.6 cache: false - name: Cache Go id: go-cache diff --git a/.gitignore b/.gitignore index dc953359570..1957dffda1d 100644 --- a/.gitignore +++ b/.gitignore @@ -31,3 +31,8 @@ benchmarks.txt # golang go.work* + +# npm (used for markdown-link-check) +node_modules/* +package-lock.json + diff --git a/.golangci.yml b/.golangci.yml index 8409866ece8..c0f9668eed3 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -110,6 +110,8 @@ linters-settings: desc: "Use 'errors' or 'fmt' instead of github.com/pkg/errors" - pkg: github.com/hashicorp/go-multierror desc: "Use go.uber.org/multierr instead of github.com/hashicorp/go-multierror" + - pkg: "math/rand$" + desc: "Use the newer 'math/rand/v2' instead of math/rand" # Add a different guard rule so that we can ignore tests. ignore-in-test: deny: diff --git a/CHANGELOG-API.md b/CHANGELOG-API.md index bcafbb3c8cc..af75f457823 100644 --- a/CHANGELOG-API.md +++ b/CHANGELOG-API.md @@ -7,6 +7,33 @@ If you are looking for user-facing changes, check out [CHANGELOG.md](./CHANGELOG +## v1.13.0/v0.107.0 + +### 🛑 Breaking changes 🛑 + +- `otelcol`: Delete deprecated NewCommandMustSetProvider (#10778) +- `component`: Removes the deprecated `Host.GetFactory` method. (#10771) +- `otelcoltest`: The `otelcol.LoadConfig` method no longer sets the `expandconverter`. (#10510) +- `ocb`: Collectors built with OCB will no longer include the `expandconverter` (#10510) +- `exporterhelper`: Delete deprecated `exporterhelper.ObsReport` and `exporterhelper.NewObsReport` (#10779, #10592) + +### 🚩 Deprecations 🚩 + +- `expandconverter`: Deprecate `expandconverter`. (#10510) + +### 🚀 New components 🚀 + +- `componentstatus`: Adds new componentstatus module that will soon replace status content in component. (#10730) +- `connector/connectorprofiles`: Allow handling profiles in connector. (#10703) +- `exporter/exporterprofiles`: Allow handling profiles in exporter. (#10702) +- `processor/processorprofiles`: Allow handling profiles in processor. (#10691) +- `receiver/receiverprofiles`: Allow handling profiles in receiver. (#10690) + +### 💡 Enhancements 💡 + +- `confmap`: Check that providers have a correct scheme when building a confmap.Resolver. (#10786) +- `confighttp`: Add `NewDefaultCORSConfig` function to initialize the default `confighttp.CORSConfig` (#9655) + ## v0.106.0 ### 🛑 Breaking changes 🛑 diff --git a/CHANGELOG.md b/CHANGELOG.md index b20ef018cdf..e91c33b19b6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,45 @@ If you are looking for developer-facing changes, check out [CHANGELOG-API.md](./ +## v1.13.0/v0.107.0 + +### 🛑 Breaking changes 🛑 + +- `service`: Remove OpenCensus bridge completely, mark feature gate as stable. (#10414) +- `confmap`: Set the `confmap.unifyEnvVarExpansion` feature gate to Stable. Expansion of `$FOO` env vars is no longer supported. Use `${FOO}` or `${env:FOO}` instead. (#10508) +- `service`: Remove `otelcol` from Prometheus configuration. This means that any metric that isn't explicitly prefixed with `otelcol_` no longer have that prefix. (#9759) + +### 💡 Enhancements 💡 + +- `mdatagen`: export ScopeName in internal/metadata package (#10845) + This can be used by components that need to set their scope name manually. Will save component owners from having to store a variable, which may diverge from the scope name used by the component for emitting its own telemetry. +- `semconv`: Add v1.26.0 semantic conventions package (#10249, #10829) +- `mdatagen`: Expose a setting on tests::host to set up your own host initialization code (#10765) + Some receivers require a host that has additional capabilities such as exposing exporters. + For those, we can expose a setting that allows them to place a different host in the generated code. + +- `confmap`: Allow using any YAML structure as a string when loading configuration. (#10800) + Previous to this change, slices could not be used as strings in configuration. + +- `ocb`: migrate build and release of ocb binaries to opentelemetry-collector-releases repository (#10710) + ocb binaries will now be released under open-telemetry/opentelemetry-collector-releases tagged as "cmd/builder/vX.XXX.X" +- `semconv`: Add semantic conventions version v1.27.0 (#10837) +- `client`: Mark module as stable. (#10775) + +### 🧰 Bug fixes 🧰 + +- `configtelemetry`: Add 10s read header timeout on the configtelemetry Prometheus HTTP server. (#5699) +- `service`: Allow users to disable the tracer provider via the feature gate `service.noopTracerProvider` (#10858) + The service is returning an instance of a SDK tracer provider regardless of whether there were any processors configured causing resources to be consumed unnecessarily. +- `processorhelper`: Fix processor metrics not being reported initially with 0 values. (#10855) +- `service`: Implement the `temporality_preference` setting for internal telemetry exported via OTLP (#10745) +- `configauth`: Fix unmarshaling of authentication in HTTP servers. (#10750) +- `confmap`: If loading an invalid YAML string through a provider, use it verbatim instead of erroring out. (#10759) + This makes the ${env:ENV} syntax closer to how ${ENV} worked before unifying syntaxes. + +- `component`: Allow component names of up to 1024 characters in length. (#10816) +- `confmap`: Remove original string representation if invalid. (#10787) + ## v0.106.1 ### 🧰 Bug fixes 🧰 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 788d092053c..f671ee84ef5 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -101,7 +101,7 @@ Reporting bugs is an important contribution. Please make sure to include: ### Before you start Please read the project contribution -[guide](https://github.com/open-telemetry/community/blob/main/CONTRIBUTING.md) +[guide](https://github.com/open-telemetry/community/tree/main/guides/contributor) for general practices for the OpenTelemetry project. Select a good issue from the links below (ordered by difficulty/complexity): @@ -153,7 +153,7 @@ Remember to always work in a branch of your local copy, as you might otherwise have to contend with conflicts in `main`. Please also see [GitHub -workflow](https://github.com/open-telemetry/community/blob/main/CONTRIBUTING.md#github-workflow) +workflow](https://github.com/open-telemetry/community/blob/main/guides/contributor/processes.md#github-workflow) section of the general project contributing guide. ## Required Tools @@ -161,7 +161,7 @@ section of the general project contributing guide. Working with the project sources requires the following tools: 1. [git](https://git-scm.com/) -2. [go](https://golang.org/) (version 1.21 and up) +2. [go](https://golang.org/) (version 1.22 and up) 3. [make](https://www.gnu.org/software/make/) 4. [docker](https://www.docker.com/) @@ -218,7 +218,7 @@ before merging (but see the above paragraph about writing good commit messages i ## General Notes -This project uses Go 1.21.* and [Github Actions.](https://github.com/features/actions) +This project uses Go 1.22.* and [Github Actions.](https://github.com/features/actions) It is recommended to run `make gofmt all` before submitting your PR. @@ -642,7 +642,7 @@ When renaming or removing a configuration option: - a WARN level message should be logged, with a link to a place within the component's repository where the change is documented and a migration path is provided - the option MUST be kept for at least N+1 version and MAY be hidden behind a feature gate in N+2 -- the option and the WARN level message MAY be removed after N+2 or 6 months, whichever comes later +- the option and the WARN level message MUST NOT be removed earlier than N+2 or 6 months, whichever comes later Additionally, when removing an option: - the option MAY be made non-operational already by the same version where it is deprecated diff --git a/Makefile.Common b/Makefile.Common index 31f5a80d156..15c1407d446 100644 --- a/Makefile.Common +++ b/Makefile.Common @@ -67,7 +67,7 @@ fmt: $(GOIMPORTS) .PHONY: tidy tidy: rm -fr go.sum - $(GOCMD) mod tidy -compat=1.21.0 + $(GOCMD) mod tidy -compat=1.22.0 .PHONY: lint lint: $(LINT) diff --git a/client/go.mod b/client/go.mod index 94d4defb837..0d862716094 100644 --- a/client/go.mod +++ b/client/go.mod @@ -1,11 +1,11 @@ module go.opentelemetry.io/collector/client -go 1.21.0 +go 1.22.0 require ( github.com/stretchr/testify v1.9.0 - go.opentelemetry.io/collector/consumer v0.106.1 - go.opentelemetry.io/collector/pdata v1.12.0 + go.opentelemetry.io/collector/consumer v0.107.0 + go.opentelemetry.io/collector/pdata v1.13.0 go.uber.org/goleak v1.3.0 ) diff --git a/cmd/builder/.goreleaser.yml b/cmd/builder/.goreleaser.yml deleted file mode 100644 index a964ac6c6ee..00000000000 --- a/cmd/builder/.goreleaser.yml +++ /dev/null @@ -1,39 +0,0 @@ -before: - hooks: - - go mod download -monorepo: - tag_prefix: cmd/builder/ - dir: cmd/builder -builds: - - flags: - - -trimpath - ldflags: - - -s -w -X go.opentelemetry.io/collector/cmd/builder/internal.version={{.Version}} -X go.opentelemetry.io/collector/cmd/builder/internal.date={{.Date}} - env: - - CGO_ENABLED=0 - goos: - - linux - - windows - - darwin - goarch: - - amd64 - - arm64 - - ppc64le - ignore: - - goos: windows - goarch: arm64 - binary: ocb -release: - github: - owner: open-telemetry - name: opentelemetry-collector - header: | - ### Images and binaries here: https://github.com/open-telemetry/opentelemetry-collector-releases/releases/tag/{{ .Tag }} -archives: - - format: binary -checksum: - name_template: "checksums.txt" -snapshot: - name_template: "{{ .Tag }}-next" -changelog: - disable: true diff --git a/cmd/builder/Makefile b/cmd/builder/Makefile index 988ed9e64a5..4c4549c747a 100644 --- a/cmd/builder/Makefile +++ b/cmd/builder/Makefile @@ -1,5 +1,7 @@ include ../../Makefile.Common +GOTEST_TIMEOUT=360s + .PHONY: ocb ocb: CGO_ENABLED=0 $(GOCMD) build -trimpath -o ../../bin/ocb_$(GOOS)_$(GOARCH) . diff --git a/cmd/builder/README.md b/cmd/builder/README.md index 003a7e93f6b..a0226b5ed2e 100644 --- a/cmd/builder/README.md +++ b/cmd/builder/README.md @@ -5,24 +5,21 @@ This program generates a custom OpenTelemetry Collector binary based on a given ## TL;DR ```console -$ go install go.opentelemetry.io/collector/cmd/builder@latest +$ go install go.opentelemetry.io/collector/cmd/builder@v0.107.0 $ cat > otelcol-builder.yaml < 0 { + // version in enclosing module is newer, do not change + c.Logger.Info("Not upgrading component, enclosing module is newer.", zap.String("module", mod), zap.String("existing", hasVer), zap.String("config_version", ver)) + return nil + } + + // upgrading or changing version + updatespec := "-require=" + mod + "@" + ver + + if _, err := runGoCommand(*c, "mod", "edit", updatespec); err != nil { + return err + } + return nil } func (c *Config) readGoModFile() (string, map[string]string, error) { diff --git a/cmd/builder/internal/builder/main_test.go b/cmd/builder/internal/builder/main_test.go index d2a5d47ca85..93151739252 100644 --- a/cmd/builder/internal/builder/main_test.go +++ b/cmd/builder/internal/builder/main_test.go @@ -19,29 +19,14 @@ import ( "golang.org/x/mod/modfile" ) -const ( - goModTestFile = `// Copyright The OpenTelemetry Authors -// SPDX-License-Identifier: Apache-2.0 -module go.opentelemetry.io/collector/cmd/builder/internal/tester -go 1.20 -require ( - go.opentelemetry.io/collector/component v0.96.0 - go.opentelemetry.io/collector/connector v0.94.1 - go.opentelemetry.io/collector/exporter v0.94.1 - go.opentelemetry.io/collector/extension v0.94.1 - go.opentelemetry.io/collector/otelcol v0.94.1 - go.opentelemetry.io/collector/processor v0.94.1 - go.opentelemetry.io/collector/receiver v0.94.1 - go.opentelemetry.io/collector v0.96.0 -)` - modulePrefix = "go.opentelemetry.io/collector" -) +const modulePrefix = "go.opentelemetry.io/collector" var ( replaceModules = []string{ "", "/component", "/component/componentprofiles", + "/component/componentstatus", "/client", "/config/configauth", "/config/configcompression", @@ -106,18 +91,6 @@ func newInitializedConfig(t *testing.T) Config { return cfg } -func TestGenerateDefault(t *testing.T) { - require.NoError(t, Generate(newInitializedConfig(t))) -} - -func TestGenerateInvalidOutputPath(t *testing.T) { - cfg := newInitializedConfig(t) - cfg.Distribution.OutputPath = ":/invalid" - err := Generate(cfg) - require.Error(t, err) - require.Contains(t, err.Error(), "failed to create output path") -} - func TestVersioning(t *testing.T) { replaces := generateReplaces() tests := []struct { @@ -244,7 +217,7 @@ func TestSkipGenerate(t *testing.T) { cfg.SkipGenerate = true err := Generate(cfg) require.NoError(t, err) - outputFile, err := os.Open(cfg.Distribution.OutputPath) + outputFile, err := os.Open(filepath.Clean(cfg.Distribution.OutputPath)) defer func() { require.NoError(t, outputFile.Close()) }() @@ -255,10 +228,13 @@ func TestSkipGenerate(t *testing.T) { func TestGenerateAndCompile(t *testing.T) { replaces := generateReplaces() - testCases := []struct { - testCase string - cfgBuilder func(t *testing.T) Config - }{ + type testDesc struct { + testCase string + cfgBuilder func(t *testing.T) Config + verifyFiles func(t *testing.T, dir string) + expectedErr string + } + testCases := []testDesc{ { testCase: "Default Configuration Compilation", cfgBuilder: func(t *testing.T) Config { @@ -269,6 +245,68 @@ func TestGenerateAndCompile(t *testing.T) { cfg.Replaces = append(cfg.Replaces, replaces...) return cfg }, + }, { + testCase: "Skip New Gomod Configuration Compilation", + cfgBuilder: func(t *testing.T) Config { + cfg := newTestConfig() + err := cfg.SetBackwardsCompatibility() + require.NoError(t, err) + cfg.Receivers = append(cfg.Receivers, + Module{ + GoMod: "go.opentelemetry.io/collector/receiver/otlpreceiver v0.106.0", + }, + ) + cfg.Exporters = append(cfg.Exporters, + Module{ + GoMod: "go.opentelemetry.io/collector/exporter/otlpexporter v0.106.0", + }, + ) + tempDir := t.TempDir() + err = makeModule(tempDir, []byte(goModTestFile)) + require.NoError(t, err) + cfg.Distribution.OutputPath = filepath.Clean(filepath.Join(tempDir, "output")) + cfg.Replaces = nil + cfg.Excludes = nil + cfg.SkipNewGoModule = true + return cfg + }, + verifyFiles: func(t *testing.T, dir string) { + assert.FileExists(t, filepath.Clean(filepath.Join(dir, mainTemplate.Name()))) + assert.NoFileExists(t, filepath.Clean(filepath.Join(dir, "go.mod"))) + }, + }, + { + testCase: "Generate Only", + cfgBuilder: func(t *testing.T) Config { + cfg := newInitializedConfig(t) + cfg.SkipCompilation = true + cfg.SkipGetModules = true + return cfg + }, + }, + { + testCase: "Skip Everything", + cfgBuilder: func(_ *testing.T) Config { + cfg := NewDefaultConfig() + cfg.Replaces = nil + cfg.Excludes = nil + cfg.SkipCompilation = true + cfg.SkipGenerate = true + cfg.SkipGetModules = true + cfg.SkipNewGoModule = true + return cfg + }, + verifyFiles: func(t *testing.T, dir string) { + // gosec linting error: G304 Potential file inclusion via variable + // we are setting the dir + outputFile, err := os.Open(dir) //nolint:gosec + defer func() { + require.NoError(t, outputFile.Close()) + }() + require.NoError(t, err) + _, err = outputFile.Readdirnames(1) + require.ErrorIs(t, err, io.EOF, "skip generate should leave output directory empty") + }, }, { testCase: "LDFlags Compilation", @@ -347,6 +385,53 @@ func TestGenerateAndCompile(t *testing.T) { return cfg }, }, + { + testCase: "Invalid Output Path", + cfgBuilder: func(t *testing.T) Config { + cfg := newInitializedConfig(t) + cfg.Distribution.OutputPath = ":/invalid" + return cfg + }, + expectedErr: "failed to create output path", + }, + { + testCase: "Malformed Receiver", + cfgBuilder: func(t *testing.T) Config { + cfg := NewDefaultConfig() + cfg.Receivers = append(cfg.Receivers, + Module{ + Name: "missing version", + GoMod: "go.opentelemetry.io/collector/cmd/builder/unittests", + }, + ) + tempDir := t.TempDir() + err := makeModule(tempDir, []byte(goModTestFile)) + require.NoError(t, err) + cfg.Distribution.OutputPath = filepath.Clean(filepath.Join(tempDir, "output")) + cfg.Replaces = nil + cfg.Excludes = nil + cfg.SkipNewGoModule = true + return cfg + }, + expectedErr: "ill-formatted modspec", + }, + } + + // file permissions don't work the same on windows systems, so this test always passes. + if runtime.GOOS != "windows" { + testCases = append(testCases, testDesc{ + testCase: "No Dir Permissions", + cfgBuilder: func(t *testing.T) Config { + cfg := newTestConfig() + err := cfg.SetBackwardsCompatibility() + require.NoError(t, err) + cfg.Distribution.OutputPath = t.TempDir() + assert.NoError(t, os.Chmod(cfg.Distribution.OutputPath, 0400)) + cfg.Replaces = append(cfg.Replaces, replaces...) + return cfg + }, + expectedErr: "failed to generate source file", + }) } for _, tt := range testCases { @@ -355,7 +440,221 @@ func TestGenerateAndCompile(t *testing.T) { assert.NoError(t, cfg.Validate()) assert.NoError(t, cfg.SetGoPath()) assert.NoError(t, cfg.ParseModules()) - require.NoError(t, GenerateAndCompile(cfg)) + err := GenerateAndCompile(cfg) + if len(tt.expectedErr) == 0 { + assert.NoError(t, err) + } else { + assert.ErrorContains(t, err, tt.expectedErr) + } + if tt.verifyFiles != nil { + tt.verifyFiles(t, cfg.Distribution.OutputPath) + } + }) + } +} + +func TestGetModules(t *testing.T) { + testCases := []struct { + description string + cfgBuilder func(t *testing.T) Config + expectedErr string + }{ + { + description: "Skip New Gomod Success", + cfgBuilder: func(t *testing.T) Config { + cfg := newTestConfig() + cfg.Distribution.Go = "go" + tempDir := t.TempDir() + require.NoError(t, makeModule(tempDir, []byte(goModTestFile))) + outputDir := filepath.Clean(filepath.Join(tempDir, "output")) + cfg.Distribution.OutputPath = outputDir + cfg.Replaces = nil + cfg.Excludes = nil + cfg.SkipNewGoModule = true + return cfg + }, + }, + { + description: "Core Version Mismatch", + cfgBuilder: func(t *testing.T) Config { + cfg := newTestConfig() + cfg.Distribution.Go = "go" + cfg.Distribution.OtelColVersion = "0.100.0" + tempDir := t.TempDir() + require.NoError(t, makeModule(tempDir, []byte(goModTestFile))) + outputDir := filepath.Clean(filepath.Join(tempDir, "output")) + cfg.Distribution.OutputPath = outputDir + cfg.Replaces = nil + cfg.Excludes = nil + cfg.SkipNewGoModule = true + return cfg + }, + expectedErr: ErrVersionMismatch.Error(), + }, + { + description: "No Go Distribution", + cfgBuilder: func(_ *testing.T) Config { + cfg := NewDefaultConfig() + cfg.downloadModules.wait = 0 + return cfg + }, + expectedErr: "failed to update go.mod", + }, + { + description: "Invalid Dependency", + cfgBuilder: func(t *testing.T) Config { + cfg := NewDefaultConfig() + cfg.downloadModules.wait = 0 + cfg.Distribution.Go = "go" + tempDir := t.TempDir() + require.NoError(t, makeModule(tempDir, []byte(invalidDependencyGoMod))) + outputDir := filepath.Clean(filepath.Join(tempDir, "output")) + cfg.Distribution.OutputPath = outputDir + cfg.Replaces = nil + cfg.Excludes = nil + cfg.SkipNewGoModule = true + return cfg + }, + expectedErr: "failed to update go.mod", + }, + { + description: "Malformed Go Mod", + cfgBuilder: func(t *testing.T) Config { + cfg := NewDefaultConfig() + cfg.downloadModules.wait = 0 + cfg.Distribution.Go = "go" + tempDir := t.TempDir() + require.NoError(t, makeModule(tempDir, []byte(malformedGoMod))) + outputDir := filepath.Clean(filepath.Join(tempDir, "output")) + cfg.Distribution.OutputPath = outputDir + cfg.Replaces = nil + cfg.Excludes = nil + cfg.SkipNewGoModule = true + return cfg + }, + expectedErr: "go subcommand failed with args '[mod edit -print]'", + }, + { + description: "Receiver Version Mismatch - Configured Lower", + cfgBuilder: func(t *testing.T) Config { + cfg := NewDefaultConfig() + cfg.Distribution.Go = "go" + cfg.Receivers = append(cfg.Receivers, + Module{ + GoMod: "go.opentelemetry.io/collector/receiver/otlpreceiver v0.105.0", + }, + ) + tempDir := t.TempDir() + err := makeModule(tempDir, []byte(goModTestFile)) + require.NoError(t, err) + cfg.Distribution.OutputPath = filepath.Clean(filepath.Join(tempDir, "output")) + cfg.Replaces = nil + cfg.Excludes = nil + cfg.SkipNewGoModule = true + return cfg + }, + expectedErr: ErrVersionMismatch.Error(), + }, + { + description: "Receiver Version Mismatch - Configured Higher", + cfgBuilder: func(t *testing.T) Config { + cfg := NewDefaultConfig() + cfg.Distribution.Go = "go" + cfg.Receivers = append(cfg.Receivers, + Module{ + GoMod: "go.opentelemetry.io/collector/receiver/otlpreceiver v0.106.1", + }, + ) + tempDir := t.TempDir() + err := makeModule(tempDir, []byte(goModTestFile)) + require.NoError(t, err) + cfg.Distribution.OutputPath = filepath.Clean(filepath.Join(tempDir, "output")) + cfg.Replaces = nil + cfg.Excludes = nil + cfg.SkipNewGoModule = true + return cfg + }, + }, + { + description: "Exporter Not in Gomod", + cfgBuilder: func(t *testing.T) Config { + cfg := NewDefaultConfig() + cfg.Distribution.Go = "go" + cfg.Exporters = append(cfg.Exporters, + Module{ + GoMod: "go.opentelemetry.io/collector/exporter/otlpexporter v0.106.0", + }, + ) + tempDir := t.TempDir() + err := makeModule(tempDir, []byte(goModTestFile)) + require.NoError(t, err) + cfg.Distribution.OutputPath = filepath.Clean(filepath.Join(tempDir, "output")) + cfg.Replaces = nil + cfg.Excludes = nil + cfg.SkipNewGoModule = true + return cfg + }, + }, + { + description: "Receiver Nonexistent Version", + cfgBuilder: func(t *testing.T) Config { + cfg := NewDefaultConfig() + cfg.Distribution.Go = "go" + cfg.Receivers = append(cfg.Receivers, + Module{ + GoMod: "go.opentelemetry.io/collector/receiver/otlpreceiver v0.106.2", + }, + ) + tempDir := t.TempDir() + err := makeModule(tempDir, []byte(goModTestFile)) + require.NoError(t, err) + cfg.Distribution.OutputPath = filepath.Clean(filepath.Join(tempDir, "output")) + cfg.Replaces = nil + cfg.Excludes = nil + cfg.SkipNewGoModule = true + return cfg + }, + expectedErr: "failed to update go.mod", + }, + { + description: "Receiver In Current Module", + cfgBuilder: func(t *testing.T) Config { + cfg := NewDefaultConfig() + cfg.Distribution.Go = "go" + cfg.Receivers = append(cfg.Receivers, + Module{ + GoMod: "go.opentelemetry.io/collector/cmd/builder/unittests v0.0.0", + }, + ) + tempDir := t.TempDir() + err := makeModule(tempDir, []byte(goModTestFile)) + require.NoError(t, err) + cfg.Distribution.OutputPath = filepath.Clean(filepath.Join(tempDir, "output")) + cfg.Replaces = nil + cfg.Excludes = nil + cfg.SkipNewGoModule = true + return cfg + }, + expectedErr: "failed to update go.mod", + }, + } + for _, tc := range testCases { + t.Run(tc.description, func(t *testing.T) { + cfg := tc.cfgBuilder(t) + require.NoError(t, cfg.SetBackwardsCompatibility()) + require.NoError(t, cfg.Validate()) + require.NoError(t, cfg.ParseModules()) + // GenerateAndCompile calls GetModules(). We want to call Generate() + // first so our dependencies stay in the gomod after go mod tidy. + err := GenerateAndCompile(cfg) + if len(tc.expectedErr) == 0 { + if !assert.NoError(t, err) { + mf, mvm, readErr := cfg.readGoModFile() + t.Log("go mod file", mf, mvm, readErr) + } + return + } + assert.ErrorContains(t, err, tc.expectedErr) }) } } diff --git a/cmd/builder/internal/builder/modfiles_test.go b/cmd/builder/internal/builder/modfiles_test.go new file mode 100644 index 00000000000..45d478975ba --- /dev/null +++ b/cmd/builder/internal/builder/modfiles_test.go @@ -0,0 +1,85 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package builder + +const ( + goModTestFile = `// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 +module go.opentelemetry.io/collector/cmd/builder/unittests + +go 1.21.0 + +require ( + go.opentelemetry.io/collector/component v0.106.0 + go.opentelemetry.io/collector/confmap v0.106.0 + go.opentelemetry.io/collector/confmap/converter/expandconverter v0.106.0 + go.opentelemetry.io/collector/confmap/provider/envprovider v0.106.0 + go.opentelemetry.io/collector/confmap/provider/fileprovider v0.106.0 + go.opentelemetry.io/collector/confmap/provider/httpprovider v0.106.0 + go.opentelemetry.io/collector/confmap/provider/httpsprovider v0.106.0 + go.opentelemetry.io/collector/confmap/provider/yamlprovider v0.106.0 + go.opentelemetry.io/collector/connector v0.106.0 + go.opentelemetry.io/collector/exporter v0.106.0 + go.opentelemetry.io/collector/exporter/otlpexporter v0.106.0 + go.opentelemetry.io/collector/extension v0.106.0 + go.opentelemetry.io/collector/otelcol v0.106.0 + go.opentelemetry.io/collector/processor v0.106.0 + go.opentelemetry.io/collector/receiver v0.106.0 + go.opentelemetry.io/collector/receiver/otlpreceiver v0.106.0 + golang.org/x/sys v0.20.0 +)` + + invalidDependencyGoMod = `// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 +module go.opentelemetry.io/collector/cmd/builder/unittests + +go 1.21.0 + +require ( + go.opentelemetry.io/collector/bad/otelcol v0.94.1 + go.opentelemetry.io/collector/component v0.102.1 + go.opentelemetry.io/collector/confmap v0.102.1 + go.opentelemetry.io/collector/confmap/converter/expandconverter v0.102.1 + go.opentelemetry.io/collector/confmap/provider/envprovider v0.102.1 + go.opentelemetry.io/collector/confmap/provider/fileprovider v0.102.1 + go.opentelemetry.io/collector/confmap/provider/httpprovider v0.102.1 + go.opentelemetry.io/collector/confmap/provider/httpsprovider v0.102.1 + go.opentelemetry.io/collector/confmap/provider/yamlprovider v0.102.1 + go.opentelemetry.io/collector/connector v0.102.1 + go.opentelemetry.io/collector/exporter v0.102.1 + go.opentelemetry.io/collector/exporter/otlpexporter v0.102.1 + go.opentelemetry.io/collector/extension v0.102.1 + go.opentelemetry.io/collector/otelcol v0.102.1 + go.opentelemetry.io/collector/processor v0.102.1 + go.opentelemetry.io/collector/receiver v0.102.1 + go.opentelemetry.io/collector/receiver/otlpreceiver v0.102.1 + golang.org/x/sys v0.20.0 +)` + + malformedGoMod = `// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 +module go.opentelemetry.io/collector/cmd/builder/unittests + +go 1.21.0 + +require ( + go.opentelemetry.io/collector/componentv0.102.1 + go.opentelemetry.io/collector/confmap v0.102.1 + go.opentelemetry.io/collector/confmap/converter/expandconverter v0.102.1 + go.opentelemetry.io/collector/confmap/provider/envprovider v0.102.1 + go.opentelemetry.io/collector/confmap/provider/fileprovider v0.102.1 + go.opentelemetry.io/collector/confmap/provider/httpprovider v0.102.1 + go.opentelemetry.io/collector/confmap/provider/httpsprovider v0.102.1 + go.opentelemetry.io/collector/confmap/provider/yamlprovider v0.102.1 + go.opentelemetry.io/collector/connector v0.102.1 + go.opentelemetry.io/collector/exporter v0.102.1 + go.opentelemetry.io/collector/exporter/otlpexporter v0.102.1 + go.opentelemetry.io/collector/extension v0.102.1 + go.opentelemetry.io/collector/otelcol v0.102.1 + go.opentelemetry.io/collector/processor v0.102.1 + go.opentelemetry.io/collector/receiver v0.102.1 + go.opentelemetry.io/collector/receiver/otlpreceiver v0.102.1 + golang.org/x/sys v0.20.0 +)` +) diff --git a/cmd/builder/internal/builder/templates/go.mod.tmpl b/cmd/builder/internal/builder/templates/go.mod.tmpl index 3ce0e7eb454..a7ad357aac6 100644 --- a/cmd/builder/internal/builder/templates/go.mod.tmpl +++ b/cmd/builder/internal/builder/templates/go.mod.tmpl @@ -2,7 +2,7 @@ module {{.Distribution.Module}} -go 1.21 +go 1.22 require ( {{if .Distribution.SupportsConfmapFactories -}} diff --git a/cmd/builder/internal/command.go b/cmd/builder/internal/command.go index a738fb1c1f1..41b7d6e4d95 100644 --- a/cmd/builder/internal/command.go +++ b/cmd/builder/internal/command.go @@ -23,6 +23,7 @@ const ( skipGenerateFlag = "skip-generate" skipCompilationFlag = "skip-compilation" skipGetModulesFlag = "skip-get-modules" + skipNewGoModuleFlag = "skip-new-go-module" skipStrictVersioningFlag = "skip-strict-versioning" ldflagsFlag = "ldflags" distributionNameFlag = "name" @@ -84,6 +85,7 @@ configuration is provided, ocb will generate a default Collector. cmd.Flags().BoolVar(&cfg.SkipGenerate, skipGenerateFlag, false, "Whether builder should skip generating go code (default false)") cmd.Flags().BoolVar(&cfg.SkipCompilation, skipCompilationFlag, false, "Whether builder should only generate go code with no compile of the collector (default false)") cmd.Flags().BoolVar(&cfg.SkipGetModules, skipGetModulesFlag, false, "Whether builder should skip updating go.mod and retrieve Go module list (default false)") + cmd.Flags().BoolVar(&cfg.SkipNewGoModule, skipNewGoModuleFlag, false, "Whether builder should skip generating a new go.mod file, using the enclosing Go module instead (default false)") cmd.Flags().BoolVar(&cfg.SkipStrictVersioning, skipStrictVersioningFlag, false, "Whether builder should skip strictly checking the calculated versions following dependency resolution") cmd.Flags().BoolVar(&cfg.Verbose, verboseFlag, false, "Whether builder should print verbose output (default false)") cmd.Flags().StringVar(&cfg.LDFlags, ldflagsFlag, "", `ldflags to include in the "go build" command`) @@ -185,6 +187,9 @@ func applyCfgFromFile(flags *flag.FlagSet, cfgFromFile builder.Config) { if !flags.Changed(skipGetModulesFlag) && cfgFromFile.SkipGetModules { cfg.SkipGetModules = cfgFromFile.SkipGetModules } + if !flags.Changed(skipNewGoModuleFlag) && cfgFromFile.SkipNewGoModule { + cfg.SkipNewGoModule = cfgFromFile.SkipNewGoModule + } if !flags.Changed(skipStrictVersioningFlag) && cfgFromFile.SkipStrictVersioning { cfg.SkipStrictVersioning = cfgFromFile.SkipStrictVersioning } diff --git a/cmd/builder/internal/command_test.go b/cmd/builder/internal/command_test.go index d071efb312d..c7d1b27e535 100644 --- a/cmd/builder/internal/command_test.go +++ b/cmd/builder/internal/command_test.go @@ -248,6 +248,54 @@ func Test_applyCfgFromFile(t *testing.T) { }, wantErr: false, }, + { + name: "Skip new go mod false", + args: args{ + flags: flag.NewFlagSet("version=1.0.0", 1), + cfgFromFile: builder.Config{ + Logger: zap.NewNop(), + SkipGenerate: true, + SkipCompilation: true, + SkipGetModules: true, + SkipNewGoModule: false, + Distribution: testDistribution, + }, + }, + want: builder.Config{ + Logger: zap.NewNop(), + SkipGenerate: true, + SkipCompilation: true, + SkipGetModules: true, + SkipStrictVersioning: true, + SkipNewGoModule: false, + Distribution: testDistribution, + }, + wantErr: false, + }, + { + name: "Skip new go mod true", + args: args{ + flags: flag.NewFlagSet("version=1.0.0", 1), + cfgFromFile: builder.Config{ + Logger: zap.NewNop(), + SkipGenerate: true, + SkipCompilation: true, + SkipGetModules: true, + SkipNewGoModule: true, + Distribution: testDistribution, + }, + }, + want: builder.Config{ + Logger: zap.NewNop(), + SkipGenerate: true, + SkipCompilation: true, + SkipGetModules: true, + SkipStrictVersioning: true, + SkipNewGoModule: true, + Distribution: testDistribution, + }, + wantErr: false, + }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { diff --git a/cmd/builder/internal/config/default.yaml b/cmd/builder/internal/config/default.yaml index 216c0e3c805..5b02a1a98d5 100644 --- a/cmd/builder/internal/config/default.yaml +++ b/cmd/builder/internal/config/default.yaml @@ -10,32 +10,32 @@ dist: module: go.opentelemetry.io/collector/cmd/otelcorecol name: otelcorecol description: Local OpenTelemetry Collector binary, testing only. - version: 0.106.1-dev - otelcol_version: 0.106.1 + version: 0.107.0-dev + otelcol_version: 0.107.0 receivers: - - gomod: go.opentelemetry.io/collector/receiver/nopreceiver v0.106.1 - - gomod: go.opentelemetry.io/collector/receiver/otlpreceiver v0.106.1 + - gomod: go.opentelemetry.io/collector/receiver/nopreceiver v0.107.0 + - gomod: go.opentelemetry.io/collector/receiver/otlpreceiver v0.107.0 exporters: - - gomod: go.opentelemetry.io/collector/exporter/debugexporter v0.106.1 - - gomod: go.opentelemetry.io/collector/exporter/loggingexporter v0.106.1 - - gomod: go.opentelemetry.io/collector/exporter/nopexporter v0.106.1 - - gomod: go.opentelemetry.io/collector/exporter/otlpexporter v0.106.1 - - gomod: go.opentelemetry.io/collector/exporter/otlphttpexporter v0.106.1 + - gomod: go.opentelemetry.io/collector/exporter/debugexporter v0.107.0 + - gomod: go.opentelemetry.io/collector/exporter/loggingexporter v0.107.0 + - gomod: go.opentelemetry.io/collector/exporter/nopexporter v0.107.0 + - gomod: go.opentelemetry.io/collector/exporter/otlpexporter v0.107.0 + - gomod: go.opentelemetry.io/collector/exporter/otlphttpexporter v0.107.0 extensions: - - gomod: go.opentelemetry.io/collector/extension/ballastextension v0.106.1 - - gomod: go.opentelemetry.io/collector/extension/memorylimiterextension v0.106.1 - - gomod: go.opentelemetry.io/collector/extension/zpagesextension v0.106.1 + - gomod: go.opentelemetry.io/collector/extension/ballastextension v0.107.0 + - gomod: go.opentelemetry.io/collector/extension/memorylimiterextension v0.107.0 + - gomod: go.opentelemetry.io/collector/extension/zpagesextension v0.107.0 processors: - - gomod: go.opentelemetry.io/collector/processor/batchprocessor v0.106.1 - - gomod: go.opentelemetry.io/collector/processor/memorylimiterprocessor v0.106.1 + - gomod: go.opentelemetry.io/collector/processor/batchprocessor v0.107.0 + - gomod: go.opentelemetry.io/collector/processor/memorylimiterprocessor v0.107.0 connectors: - - gomod: go.opentelemetry.io/collector/connector/forwardconnector v0.106.1 + - gomod: go.opentelemetry.io/collector/connector/forwardconnector v0.107.0 providers: - - gomod: go.opentelemetry.io/collector/confmap/provider/envprovider v0.106.1 - - gomod: go.opentelemetry.io/collector/confmap/provider/fileprovider v0.106.1 - - gomod: go.opentelemetry.io/collector/confmap/provider/httpprovider v0.106.1 - - gomod: go.opentelemetry.io/collector/confmap/provider/httpsprovider v0.106.1 - - gomod: go.opentelemetry.io/collector/confmap/provider/yamlprovider v0.106.1 + - gomod: go.opentelemetry.io/collector/confmap/provider/envprovider v0.107.0 + - gomod: go.opentelemetry.io/collector/confmap/provider/fileprovider v0.107.0 + - gomod: go.opentelemetry.io/collector/confmap/provider/httpprovider v0.107.0 + - gomod: go.opentelemetry.io/collector/confmap/provider/httpsprovider v0.107.0 + - gomod: go.opentelemetry.io/collector/confmap/provider/yamlprovider v0.107.0 diff --git a/cmd/builder/test/core.builder.yaml b/cmd/builder/test/core.builder.yaml index f4828350824..3de6aca0f30 100644 --- a/cmd/builder/test/core.builder.yaml +++ b/cmd/builder/test/core.builder.yaml @@ -1,20 +1,20 @@ dist: module: go.opentelemetry.io/collector/builder/test/core - otelcol_version: 0.106.1 + otelcol_version: 0.107.0 extensions: - import: go.opentelemetry.io/collector/extension/zpagesextension - gomod: go.opentelemetry.io/collector v0.106.1 + gomod: go.opentelemetry.io/collector v0.107.0 path: ${WORKSPACE_DIR} receivers: - import: go.opentelemetry.io/collector/receiver/otlpreceiver - gomod: go.opentelemetry.io/collector v0.106.1 + gomod: go.opentelemetry.io/collector v0.107.0 path: ${WORKSPACE_DIR} exporters: - import: go.opentelemetry.io/collector/exporter/debugexporter - gomod: go.opentelemetry.io/collector v0.106.1 + gomod: go.opentelemetry.io/collector v0.107.0 path: ${WORKSPACE_DIR} replaces: @@ -22,6 +22,7 @@ replaces: - go.opentelemetry.io/collector/client => ${WORKSPACE_DIR}/client - go.opentelemetry.io/collector/component => ${WORKSPACE_DIR}/component - go.opentelemetry.io/collector/component/componentprofiles => ${WORKSPACE_DIR}/component/componentprofiles + - go.opentelemetry.io/collector/component/componentstatus => ${WORKSPACE_DIR}/component/componentstatus - go.opentelemetry.io/collector/config/configauth => ${WORKSPACE_DIR}/config/configauth - go.opentelemetry.io/collector/config/configcompression => ${WORKSPACE_DIR}/config/configcompression - go.opentelemetry.io/collector/config/configgrpc => ${WORKSPACE_DIR}/config/configgrpc diff --git a/cmd/mdatagen/README.md b/cmd/mdatagen/README.md index ccdbf40f737..63cc5260401 100644 --- a/cmd/mdatagen/README.md +++ b/cmd/mdatagen/README.md @@ -1,5 +1,15 @@ # Metadata Generator + +| Status | | +| ------------- |-----------| +| Stability | [alpha]: metrics | +| Issues | [![Open issues](https://img.shields.io/github/issues-search/open-telemetry/opentelemetry-collector?query=is%3Aissue%20is%3Aopen%20label%3Acmd%2Fmdatagen%20&label=open&color=orange&logo=opentelemetry)](https://github.com/open-telemetry/opentelemetry-collector/issues?q=is%3Aopen+is%3Aissue+label%3Acmd%2Fmdatagen) [![Closed issues](https://img.shields.io/github/issues-search/open-telemetry/opentelemetry-collector?query=is%3Aissue%20is%3Aclosed%20label%3Acmd%2Fmdatagen%20&label=closed&color=blue&logo=opentelemetry)](https://github.com/open-telemetry/opentelemetry-collector/issues?q=is%3Aclosed+is%3Aissue+label%3Acmd%2Fmdatagen) | +| [Code Owners](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/CONTRIBUTING.md#becoming-a-code-owner) | [@dmitryax](https://www.github.com/dmitryax) | + +[alpha]: https://github.com/open-telemetry/opentelemetry-collector#alpha + + Every component's documentation should include a brief description of the component and guidance on how to use it. There is also some information about the component (or metadata) that should be included to help end-users understand the current state of the component and whether it is right for their use case. Examples of this metadata about a component are: diff --git a/cmd/mdatagen/go.mod b/cmd/mdatagen/go.mod index 1886d7c58ee..11854148aa4 100644 --- a/cmd/mdatagen/go.mod +++ b/cmd/mdatagen/go.mod @@ -1,20 +1,20 @@ module go.opentelemetry.io/collector/cmd/mdatagen -go 1.21.0 +go 1.22.0 require ( github.com/google/go-cmp v0.6.0 github.com/stretchr/testify v1.9.0 - go.opentelemetry.io/collector/component v0.106.1 - go.opentelemetry.io/collector/config/configtelemetry v0.106.1 - go.opentelemetry.io/collector/confmap v0.106.1 - go.opentelemetry.io/collector/confmap/provider/fileprovider v0.106.1 - go.opentelemetry.io/collector/consumer v0.106.1 - go.opentelemetry.io/collector/consumer/consumertest v0.106.1 - go.opentelemetry.io/collector/filter v0.106.1 - go.opentelemetry.io/collector/pdata v1.12.0 - go.opentelemetry.io/collector/receiver v0.106.1 - go.opentelemetry.io/collector/semconv v0.106.1 + go.opentelemetry.io/collector/component v0.107.0 + go.opentelemetry.io/collector/config/configtelemetry v0.107.0 + go.opentelemetry.io/collector/confmap v0.107.0 + go.opentelemetry.io/collector/confmap/provider/fileprovider v0.107.0 + go.opentelemetry.io/collector/consumer v0.107.0 + go.opentelemetry.io/collector/consumer/consumertest v0.107.0 + go.opentelemetry.io/collector/filter v0.107.0 + go.opentelemetry.io/collector/pdata v1.13.0 + go.opentelemetry.io/collector/receiver v0.107.0 + go.opentelemetry.io/collector/semconv v0.107.0 go.opentelemetry.io/otel/metric v1.28.0 go.opentelemetry.io/otel/sdk/metric v1.28.0 go.opentelemetry.io/otel/trace v1.28.0 @@ -29,11 +29,11 @@ require ( github.com/davecgh/go-spew v1.1.1 // indirect github.com/go-logr/logr v1.4.2 // indirect github.com/go-logr/stdr v1.2.2 // indirect - github.com/go-viper/mapstructure/v2 v2.0.0 // indirect + github.com/go-viper/mapstructure/v2 v2.1.0 // indirect github.com/gogo/protobuf v1.3.2 // indirect github.com/google/uuid v1.6.0 // indirect - github.com/hashicorp/go-version v1.7.0 // indirect github.com/json-iterator/go v1.1.12 // indirect + github.com/klauspost/compress v1.17.9 // 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 @@ -43,14 +43,12 @@ require ( 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_golang v1.20.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/consumer/consumerprofiles v0.106.1 // indirect - go.opentelemetry.io/collector/featuregate v1.12.0 // indirect - go.opentelemetry.io/collector/internal/globalgates v0.106.1 // indirect - go.opentelemetry.io/collector/pdata/pprofile v0.106.1 // indirect + go.opentelemetry.io/collector/consumer/consumerprofiles v0.107.0 // indirect + go.opentelemetry.io/collector/pdata/pprofile v0.107.0 // indirect go.opentelemetry.io/otel v1.28.0 // indirect go.opentelemetry.io/otel/exporters/prometheus v0.50.0 // indirect go.opentelemetry.io/otel/sdk v1.28.0 // indirect @@ -95,8 +93,8 @@ retract ( replace go.opentelemetry.io/collector/pdata/pprofile => ../../pdata/pprofile -replace go.opentelemetry.io/collector/internal/globalgates => ../../internal/globalgates - replace go.opentelemetry.io/collector/consumer/consumerprofiles => ../../consumer/consumerprofiles replace go.opentelemetry.io/collector/consumer/consumertest => ../../consumer/consumertest + +replace go.opentelemetry.io/collector/component/componentstatus => ../../component/componentstatus diff --git a/cmd/mdatagen/go.sum b/cmd/mdatagen/go.sum index 819ce91ab81..83cb9614373 100644 --- a/cmd/mdatagen/go.sum +++ b/cmd/mdatagen/go.sum @@ -10,8 +10,8 @@ github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY= github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= -github.com/go-viper/mapstructure/v2 v2.0.0 h1:dhn8MZ1gZ0mzeodTG3jt5Vj/o87xZKuNAprG2mQfMfc= -github.com/go-viper/mapstructure/v2 v2.0.0/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM= +github.com/go-viper/mapstructure/v2 v2.1.0 h1:gHnMa2Y/pIxElCH2GlZZ1lZSsn6XMtufpGyP1XxdC/w= +github.com/go-viper/mapstructure/v2 v2.1.0/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= @@ -19,12 +19,12 @@ github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeN 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/klauspost/compress v1.17.9 h1:6KIumPrER1LHsvBVuDa0r5xaG0Es51mhhB9BQB2qeMA= +github.com/klauspost/compress v1.17.9/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw= 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= @@ -35,6 +35,8 @@ 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/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= +github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= 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= @@ -48,8 +50,8 @@ github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq 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_golang v1.20.1 h1:IMJXHOD6eARkQpxo8KkhgEVFlBNm+nkrFUyGlIu7Na8= +github.com/prometheus/client_golang v1.20.1/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= 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= diff --git a/cmd/mdatagen/internal/samplereceiver/README.md b/cmd/mdatagen/internal/samplereceiver/README.md index 8444ce2e8ec..1098e17470e 100644 --- a/cmd/mdatagen/internal/samplereceiver/README.md +++ b/cmd/mdatagen/internal/samplereceiver/README.md @@ -9,7 +9,7 @@ This receiver is used for testing purposes to check the output of mdatagen. | Unsupported Platforms | freebsd, illumos | | Distributions | [] | | Warnings | [Any additional information that should be brought to the consumer's attention](#warnings) | -| Issues | [![Open issues](https://img.shields.io/github/issues-search/open-telemetry/opentelemetry-collector-contrib?query=is%3Aissue%20is%3Aopen%20label%3Areceiver%2Fsample%20&label=open&color=orange&logo=opentelemetry)](https://github.com/open-telemetry/opentelemetry-collector-contrib/issues?q=is%3Aopen+is%3Aissue+label%3Areceiver%2Fsample) [![Closed issues](https://img.shields.io/github/issues-search/open-telemetry/opentelemetry-collector-contrib?query=is%3Aissue%20is%3Aclosed%20label%3Areceiver%2Fsample%20&label=closed&color=blue&logo=opentelemetry)](https://github.com/open-telemetry/opentelemetry-collector-contrib/issues?q=is%3Aclosed+is%3Aissue+label%3Areceiver%2Fsample) | +| Issues | [![Open issues](https://img.shields.io/github/issues-search/open-telemetry/opentelemetry-collector?query=is%3Aissue%20is%3Aopen%20label%3Areceiver%2Fsample%20&label=open&color=orange&logo=opentelemetry)](https://github.com/open-telemetry/opentelemetry-collector/issues?q=is%3Aopen+is%3Aissue+label%3Areceiver%2Fsample) [![Closed issues](https://img.shields.io/github/issues-search/open-telemetry/opentelemetry-collector?query=is%3Aissue%20is%3Aclosed%20label%3Areceiver%2Fsample%20&label=closed&color=blue&logo=opentelemetry)](https://github.com/open-telemetry/opentelemetry-collector/issues?q=is%3Aclosed+is%3Aissue+label%3Areceiver%2Fsample) | | [Code Owners](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/CONTRIBUTING.md#becoming-a-code-owner) | [@dmitryax](https://www.github.com/dmitryax) | [development]: https://github.com/open-telemetry/opentelemetry-collector#development diff --git a/cmd/mdatagen/internal/samplereceiver/generated_component_telemetry_test.go b/cmd/mdatagen/internal/samplereceiver/generated_component_telemetry_test.go index e0a3e1cb559..084aef2bbac 100644 --- a/cmd/mdatagen/internal/samplereceiver/generated_component_telemetry_test.go +++ b/cmd/mdatagen/internal/samplereceiver/generated_component_telemetry_test.go @@ -7,11 +7,13 @@ import ( "testing" "github.com/stretchr/testify/require" + "go.opentelemetry.io/otel/metric" sdkmetric "go.opentelemetry.io/otel/sdk/metric" "go.opentelemetry.io/otel/sdk/metric/metricdata" "go.opentelemetry.io/otel/sdk/metric/metricdata/metricdatatest" "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/config/configtelemetry" "go.opentelemetry.io/collector/receiver" "go.opentelemetry.io/collector/receiver/receivertest" ) @@ -24,6 +26,9 @@ type componentTestTelemetry struct { func (tt *componentTestTelemetry) NewSettings() receiver.Settings { settings := receivertest.NewNopSettings() settings.MeterProvider = tt.meterProvider + settings.LeveledMeterProvider = func(_ configtelemetry.Level) metric.MeterProvider { + return tt.meterProvider + } settings.ID = component.NewID(component.MustNewType("sample")) return settings diff --git a/cmd/mdatagen/internal/samplereceiver/internal/metadata/generated_status.go b/cmd/mdatagen/internal/samplereceiver/internal/metadata/generated_status.go index e3e8df2ad14..7f86f1d8fc1 100644 --- a/cmd/mdatagen/internal/samplereceiver/internal/metadata/generated_status.go +++ b/cmd/mdatagen/internal/samplereceiver/internal/metadata/generated_status.go @@ -7,7 +7,8 @@ import ( ) var ( - Type = component.MustNewType("sample") + Type = component.MustNewType("sample") + ScopeName = "go.opentelemetry.io/collector/internal/receiver/samplereceiver" ) const ( diff --git a/cmd/mdatagen/internal/samplereceiver/internal/metadata/generated_telemetry.go b/cmd/mdatagen/internal/samplereceiver/internal/metadata/generated_telemetry.go index 0626d810b93..ea6bfee53e9 100644 --- a/cmd/mdatagen/internal/samplereceiver/internal/metadata/generated_telemetry.go +++ b/cmd/mdatagen/internal/samplereceiver/internal/metadata/generated_telemetry.go @@ -14,10 +14,15 @@ import ( "go.opentelemetry.io/collector/config/configtelemetry" ) +// Deprecated: [v0.108.0] use LeveledMeter instead. func Meter(settings component.TelemetrySettings) metric.Meter { return settings.MeterProvider.Meter("go.opentelemetry.io/collector/internal/receiver/samplereceiver") } +func LeveledMeter(settings component.TelemetrySettings, level configtelemetry.Level) metric.Meter { + return settings.LeveledMeterProvider(level).Meter("go.opentelemetry.io/collector/internal/receiver/samplereceiver") +} + func Tracer(settings component.TelemetrySettings) trace.Tracer { return settings.TracerProvider.Tracer("go.opentelemetry.io/collector/internal/receiver/samplereceiver") } diff --git a/cmd/mdatagen/internal/samplereceiver/internal/metadata/generated_telemetry_test.go b/cmd/mdatagen/internal/samplereceiver/internal/metadata/generated_telemetry_test.go index da03a267c62..2d6767665ff 100644 --- a/cmd/mdatagen/internal/samplereceiver/internal/metadata/generated_telemetry_test.go +++ b/cmd/mdatagen/internal/samplereceiver/internal/metadata/generated_telemetry_test.go @@ -14,6 +14,7 @@ import ( nooptrace "go.opentelemetry.io/otel/trace/noop" "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/config/configtelemetry" ) type mockMeter struct { @@ -43,6 +44,9 @@ func (m mockTracerProvider) Tracer(name string, opts ...trace.TracerOption) trac func TestProviders(t *testing.T) { set := component.TelemetrySettings{ + LeveledMeterProvider: func(_ configtelemetry.Level) metric.MeterProvider { + return mockMeterProvider{} + }, MeterProvider: mockMeterProvider{}, TracerProvider: mockTracerProvider{}, } @@ -64,6 +68,9 @@ func TestProviders(t *testing.T) { func TestNewTelemetryBuilder(t *testing.T) { set := component.TelemetrySettings{ + LeveledMeterProvider: func(_ configtelemetry.Level) metric.MeterProvider { + return mockMeterProvider{} + }, MeterProvider: mockMeterProvider{}, TracerProvider: mockTracerProvider{}, } diff --git a/cmd/mdatagen/internal/samplereceiver/metadata.yaml b/cmd/mdatagen/internal/samplereceiver/metadata.yaml index 9ef87715990..5a6df8fb734 100644 --- a/cmd/mdatagen/internal/samplereceiver/metadata.yaml +++ b/cmd/mdatagen/internal/samplereceiver/metadata.yaml @@ -2,6 +2,7 @@ type: sample scope_name: go.opentelemetry.io/collector/internal/receiver/samplereceiver +github_project: open-telemetry/opentelemetry-collector sem_conv_version: 1.9.0 diff --git a/cmd/mdatagen/loader.go b/cmd/mdatagen/loader.go index 70a316981c7..c091d39052c 100644 --- a/cmd/mdatagen/loader.go +++ b/cmd/mdatagen/loader.go @@ -229,6 +229,7 @@ type tests struct { SkipShutdown bool `mapstructure:"skip_shutdown"` GoLeak goLeak `mapstructure:"goleak"` ExpectConsumerError bool `mapstructure:"expect_consumer_error"` + Host string `mapstructure:"host"` } type telemetry struct { @@ -253,11 +254,13 @@ type metadata struct { Attributes map[attributeName]attribute `mapstructure:"attributes"` // Metrics that can be emitted by the component. Metrics map[metricName]metric `mapstructure:"metrics"` + // GithubProject is the project where the component README lives in the format of org/repo, defaults to open-telemetry/opentelemetry-collector-contrib + GithubProject string `mapstructure:"github_project"` // ScopeName of the metrics emitted by the component. ScopeName string `mapstructure:"scope_name"` // ShortFolderName is the shortened folder name of the component, removing class if present ShortFolderName string `mapstructure:"-"` - + // Tests is the set of tests generated with the component Tests tests `mapstructure:"tests"` } @@ -285,7 +288,7 @@ func loadMetadata(filePath string) (metadata, error) { return metadata{}, err } - md := metadata{ShortFolderName: shortFolderName(filePath)} + md := metadata{ShortFolderName: shortFolderName(filePath), Tests: tests{Host: "componenttest.NewNopHost()"}} if err = conf.Unmarshal(&md); err != nil { return md, err } diff --git a/cmd/mdatagen/loader_test.go b/cmd/mdatagen/loader_test.go index 63d7277e2ea..7d6927d3105 100644 --- a/cmd/mdatagen/loader_test.go +++ b/cmd/mdatagen/loader_test.go @@ -22,6 +22,7 @@ func TestLoadMetadata(t *testing.T) { { name: "internal/samplereceiver/metadata.yaml", want: metadata{ + GithubProject: "open-telemetry/opentelemetry-collector", Type: "sample", SemConvVersion: "1.9.0", Status: &Status{ @@ -280,6 +281,7 @@ func TestLoadMetadata(t *testing.T) { }, ScopeName: "go.opentelemetry.io/collector/internal/receiver/samplereceiver", ShortFolderName: "sample", + Tests: tests{Host: "componenttest.NewNopHost()"}, }, }, { @@ -289,6 +291,7 @@ func TestLoadMetadata(t *testing.T) { Parent: "parentComponent", ScopeName: "go.opentelemetry.io/collector/cmd/mdatagen", ShortFolderName: "testdata", + Tests: tests{Host: "componenttest.NewNopHost()"}, }, }, { diff --git a/cmd/mdatagen/main.go b/cmd/mdatagen/main.go index cc325376826..66f97ae54da 100644 --- a/cmd/mdatagen/main.go +++ b/cmd/mdatagen/main.go @@ -28,6 +28,10 @@ const ( ) func main() { + flag.Usage = func() { + fmt.Fprintf(flag.CommandLine.Output(), "Usage: %s metadata.yaml\n", os.Args[0]) + flag.PrintDefaults() + } flag.Parse() yml := flag.Arg(0) if err := run(yml); err != nil { @@ -356,6 +360,10 @@ func inlineReplace(tmplFile string, outputFile string, md metadata, start string tmpl := templatize(tmplFile, md) buf := bytes.Buffer{} + if md.GithubProject == "" { + md.GithubProject = "open-telemetry/opentelemetry-collector-contrib" + } + if err := tmpl.Execute(&buf, templateContext{metadata: md, Package: "metadata"}); err != nil { return fmt.Errorf("failed executing template: %w", err) } diff --git a/cmd/mdatagen/main_test.go b/cmd/mdatagen/main_test.go index 7136b9b8f80..aec9ec132dc 100644 --- a/cmd/mdatagen/main_test.go +++ b/cmd/mdatagen/main_test.go @@ -21,6 +21,7 @@ func TestRunContents(t *testing.T) { tests := []struct { yml string wantMetricsGenerated bool + wantMetricsContext bool wantConfigGenerated bool wantTelemetryGenerated bool wantStatusGenerated bool @@ -98,6 +99,12 @@ func TestRunContents(t *testing.T) { yml: "invalid_telemetry_missing_value_type_for_histogram.yaml", wantErr: true, }, + { + yml: "async_metric.yaml", + wantMetricsGenerated: true, + wantConfigGenerated: true, + wantStatusGenerated: true, + }, } for _, tt := range tests { t.Run(tt.yml, func(t *testing.T) { @@ -120,10 +127,18 @@ foo } require.NoError(t, err) + var contents []byte if tt.wantMetricsGenerated { require.FileExists(t, filepath.Join(tmpdir, "internal/metadata/generated_metrics.go")) require.FileExists(t, filepath.Join(tmpdir, "internal/metadata/generated_metrics_test.go")) require.FileExists(t, filepath.Join(tmpdir, "documentation.md")) + contents, err = os.ReadFile(filepath.Join(tmpdir, "internal/metadata/generated_metrics.go")) // nolint: gosec + require.NoError(t, err) + if tt.wantMetricsContext { + require.Contains(t, string(contents), "\"context\"") + } else { + require.NotContains(t, string(contents), "\"context\"") + } } else { require.NoFileExists(t, filepath.Join(tmpdir, "internal/metadata/generated_metrics.go")) require.NoFileExists(t, filepath.Join(tmpdir, "internal/metadata/generated_metrics_test.go")) @@ -141,6 +156,13 @@ foo require.FileExists(t, filepath.Join(tmpdir, "internal/metadata/generated_telemetry.go")) require.FileExists(t, filepath.Join(tmpdir, "internal/metadata/generated_telemetry_test.go")) require.FileExists(t, filepath.Join(tmpdir, "documentation.md")) + contents, err = os.ReadFile(filepath.Join(tmpdir, "internal/metadata/generated_telemetry.go")) // nolint: gosec + require.NoError(t, err) + if tt.wantMetricsContext { + require.Contains(t, string(contents), "\"context\"") + } else { + require.NotContains(t, string(contents), "\"context\"") + } } else { require.NoFileExists(t, filepath.Join(tmpdir, "internal/metadata/generated_telemetry.go")) require.NoFileExists(t, filepath.Join(tmpdir, "internal/metadata/generated_telemetry_test.go")) @@ -150,7 +172,6 @@ foo require.NoFileExists(t, filepath.Join(tmpdir, "documentation.md")) } - var contents []byte if tt.wantStatusGenerated { require.FileExists(t, filepath.Join(tmpdir, "internal/metadata/generated_status.go")) contents, err = os.ReadFile(filepath.Join(tmpdir, "README.md")) // nolint: gosec @@ -245,6 +266,7 @@ func TestInlineReplace(t *testing.T) { stability map[component.StabilityLevel][]string distros []string codeowners *Codeowners + githubProject string }{ { name: "readme with empty status", @@ -258,6 +280,7 @@ Some info about a component outputFile: "readme_with_status.md", componentClass: "receiver", distros: []string{"contrib"}, + githubProject: "open-telemetry/opentelemetry-collector", }, { name: "readme with status for extension", @@ -336,6 +359,7 @@ Some info about a component outputFile: "readme_with_status.md", componentClass: "receiver", distros: []string{"contrib"}, + githubProject: "open-telemetry/opentelemetry-collector", }, { name: "readme with no status", @@ -402,6 +426,7 @@ Some info about a component stability = tt.stability } md := metadata{ + GithubProject: tt.githubProject, Type: "foo", ShortFolderName: "foo", Status: &Status{ @@ -462,7 +487,8 @@ import ( ) var ( - Type = component.MustNewType("foo") + Type = component.MustNewType("foo") + ScopeName = "" ) const ( @@ -491,7 +517,8 @@ import ( ) var ( - Type = component.MustNewType("foo") + Type = component.MustNewType("foo") + ScopeName = "" ) const ( @@ -546,10 +573,15 @@ import ( "go.opentelemetry.io/collector/config/configtelemetry" ) +// Deprecated: [v0.108.0] use LeveledMeter instead. func Meter(settings component.TelemetrySettings) metric.Meter { return settings.MeterProvider.Meter("") } +func LeveledMeter(settings component.TelemetrySettings, level configtelemetry.Level) metric.Meter { + return settings.LeveledMeterProvider(level).Meter("") +} + func Tracer(settings component.TelemetrySettings) trace.Tracer { return settings.TracerProvider.Tracer("") } @@ -580,10 +612,15 @@ import ( "go.opentelemetry.io/collector/config/configtelemetry" ) +// Deprecated: [v0.108.0] use LeveledMeter instead. func Meter(settings component.TelemetrySettings) metric.Meter { return settings.MeterProvider.Meter("") } +func LeveledMeter(settings component.TelemetrySettings, level configtelemetry.Level) metric.Meter { + return settings.LeveledMeterProvider(level).Meter("") +} + func Tracer(settings component.TelemetrySettings) trace.Tracer { return settings.TracerProvider.Tracer("") } diff --git a/cmd/mdatagen/metadata.yaml b/cmd/mdatagen/metadata.yaml index bc18609e74c..b2b4343d840 100644 --- a/cmd/mdatagen/metadata.yaml +++ b/cmd/mdatagen/metadata.yaml @@ -1,4 +1,5 @@ type: mdatagen +github_project: open-telemetry/opentelemetry-collector status: class: cmd diff --git a/cmd/mdatagen/templates/component_telemetry_test.go.tmpl b/cmd/mdatagen/templates/component_telemetry_test.go.tmpl index c5989de15af..bf4b3ba2a11 100644 --- a/cmd/mdatagen/templates/component_telemetry_test.go.tmpl +++ b/cmd/mdatagen/templates/component_telemetry_test.go.tmpl @@ -13,6 +13,7 @@ import ( "go.opentelemetry.io/collector/component" {{- if or isConnector isExporter isExtension isProcessor isReceiver }} + "go.opentelemetry.io/collector/config/configtelemetry" "go.opentelemetry.io/collector/{{ .Status.Class }}" "go.opentelemetry.io/collector/{{ .Status.Class }}/{{ .Status.Class }}test" {{- end }} @@ -27,6 +28,9 @@ type componentTestTelemetry struct { func (tt *componentTestTelemetry) NewSettings() {{ .Status.Class }}.Settings { settings := {{ .Status.Class }}test.NewNopSettings() settings.MeterProvider = tt.meterProvider + settings.LeveledMeterProvider = func(_ configtelemetry.Level) metric.MeterProvider { + return tt.meterProvider + } settings.ID = component.NewID(component.MustNewType("{{ .Type }}")) return settings diff --git a/cmd/mdatagen/templates/component_test.go.tmpl b/cmd/mdatagen/templates/component_test.go.tmpl index bfc70c2b751..be75cb1bae9 100644 --- a/cmd/mdatagen/templates/component_test.go.tmpl +++ b/cmd/mdatagen/templates/component_test.go.tmpl @@ -20,8 +20,8 @@ import ( "go.opentelemetry.io/collector/component" {{- end }} "go.opentelemetry.io/collector/component/componenttest" - "go.opentelemetry.io/collector/confmap/confmaptest" {{- if not (and .Tests.SkipLifecycle .Tests.SkipShutdown) }} + "go.opentelemetry.io/collector/confmap/confmaptest" {{- if isExporter }} "go.opentelemetry.io/collector/exporter" "go.opentelemetry.io/collector/exporter/exportertest" @@ -118,7 +118,7 @@ func TestComponentLifecycle(t *testing.T) { t.Run(test.name + "-lifecycle", func(t *testing.T) { c, err := test.createFn(context.Background(), exportertest.NewNopSettings(), cfg) require.NoError(t, err) - host := componenttest.NewNopHost() + host := {{ .Tests.Host }} err = c.Start(context.Background(), host) require.NoError(t, err) require.NotPanics(t, func() { @@ -215,7 +215,7 @@ func TestComponentLifecycle(t *testing.T) { t.Run(test.name + "-lifecycle", func(t *testing.T) { c, err := test.createFn(context.Background(), processortest.NewNopSettings(), cfg) require.NoError(t, err) - host := componenttest.NewNopHost() + host := {{ .Tests.Host }} err = c.Start(context.Background(), host) require.NoError(t, err) require.NotPanics(t, func() { @@ -310,7 +310,7 @@ func TestComponentLifecycle(t *testing.T) { 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() + host := {{ .Tests.Host }} require.NoError(t, err) require.NoError(t, firstRcvr.Start(context.Background(), host)) require.NoError(t, firstRcvr.Shutdown(context.Background())) @@ -348,12 +348,12 @@ func TestComponentLifecycle(t *testing.T) { t.Run("lifecycle", func(t *testing.T) { firstExt, err := factory.CreateExtension(context.Background(), extensiontest.NewNopSettings(), cfg) require.NoError(t, err) - require.NoError(t, firstExt.Start(context.Background(), componenttest.NewNopHost())) + require.NoError(t, firstExt.Start(context.Background(), {{ .Tests.Host }})) require.NoError(t, firstExt.Shutdown(context.Background())) secondExt, err := factory.CreateExtension(context.Background(), extensiontest.NewNopSettings(), cfg) require.NoError(t, err) - require.NoError(t, secondExt.Start(context.Background(), componenttest.NewNopHost())) + require.NoError(t, secondExt.Start(context.Background(), {{ .Tests.Host }})) require.NoError(t, secondExt.Shutdown(context.Background())) }) {{- end }} @@ -472,7 +472,7 @@ func TestComponentLifecycle(t *testing.T) { t.Run(test.name + "-lifecycle", func(t *testing.T) { firstConnector, err := test.createFn(context.Background(), connectortest.NewNopSettings(), cfg) require.NoError(t, err) - host := componenttest.NewNopHost() + host := {{ .Tests.Host }} require.NoError(t, err) require.NoError(t, firstConnector.Start(context.Background(), host)) require.NoError(t, firstConnector.Shutdown(context.Background())) diff --git a/cmd/mdatagen/templates/readme.md.tmpl b/cmd/mdatagen/templates/readme.md.tmpl index 3ead446b982..073b0d58ca6 100644 --- a/cmd/mdatagen/templates/readme.md.tmpl +++ b/cmd/mdatagen/templates/readme.md.tmpl @@ -21,7 +21,7 @@ | Warnings | [{{ stringsJoin .Status.Warnings ", " }}](#warnings) | {{- end }} {{- if ne $class "" }} -| Issues | [![Open issues](https://img.shields.io/github/issues-search/open-telemetry/opentelemetry-collector-contrib?query=is%3Aissue%20is%3Aopen%20label%3A{{ $class }}%2F{{ $shortName }}%20&label=open&color=orange&logo=opentelemetry)](https://github.com/open-telemetry/opentelemetry-collector-contrib/issues?q=is%3Aopen+is%3Aissue+label%3A{{ $class }}%2F{{ $shortName }}) [![Closed issues](https://img.shields.io/github/issues-search/open-telemetry/opentelemetry-collector-contrib?query=is%3Aissue%20is%3Aclosed%20label%3A{{ $class }}%2F{{ $shortName }}%20&label=closed&color=blue&logo=opentelemetry)](https://github.com/open-telemetry/opentelemetry-collector-contrib/issues?q=is%3Aclosed+is%3Aissue+label%3A{{ $class }}%2F{{ $shortName }}) | +| Issues | [![Open issues](https://img.shields.io/github/issues-search/{{ .GithubProject }}?query=is%3Aissue%20is%3Aopen%20label%3A{{ $class }}%2F{{ $shortName }}%20&label=open&color=orange&logo=opentelemetry)](https://github.com/{{ .GithubProject }}/issues?q=is%3Aopen+is%3Aissue+label%3A{{ $class }}%2F{{ $shortName }}) [![Closed issues](https://img.shields.io/github/issues-search/{{ .GithubProject }}?query=is%3Aissue%20is%3Aclosed%20label%3A{{ $class }}%2F{{ $shortName }}%20&label=closed&color=blue&logo=opentelemetry)](https://github.com/{{ .GithubProject }}/issues?q=is%3Aclosed+is%3Aissue+label%3A{{ $class }}%2F{{ $shortName }}) | {{- end }} {{- if .Status.Codeowners }} {{- $codeowners := userLinks .Status.Codeowners.Active }} diff --git a/cmd/mdatagen/templates/status.go.tmpl b/cmd/mdatagen/templates/status.go.tmpl index b90047f7dd0..789605ee01f 100644 --- a/cmd/mdatagen/templates/status.go.tmpl +++ b/cmd/mdatagen/templates/status.go.tmpl @@ -7,7 +7,8 @@ import ( ) var ( - Type = component.MustNewType("{{ .Type }}") + Type = component.MustNewType("{{ .Type }}") + ScopeName = "{{ .ScopeName }}" ) const ( diff --git a/cmd/mdatagen/templates/telemetry.go.tmpl b/cmd/mdatagen/templates/telemetry.go.tmpl index 7610f04a55f..1727e823e61 100644 --- a/cmd/mdatagen/templates/telemetry.go.tmpl +++ b/cmd/mdatagen/templates/telemetry.go.tmpl @@ -4,7 +4,12 @@ package {{ .Package }} import ( {{- if .Telemetry.Metrics }} + {{- range $_, $metric := .Telemetry.Metrics }} + {{- if $metric.Data.Async }} "context" + {{- break}} + {{- end }} + {{- end }} "errors" {{- end }} @@ -16,10 +21,15 @@ import ( "go.opentelemetry.io/collector/config/configtelemetry" ) +// Deprecated: [v0.108.0] use LeveledMeter instead. func Meter(settings component.TelemetrySettings) metric.Meter { return settings.MeterProvider.Meter("{{ .ScopeName }}") } +func LeveledMeter(settings component.TelemetrySettings, level configtelemetry.Level) metric.Meter { + return settings.LeveledMeterProvider(level).Meter("{{ .ScopeName }}") +} + func Tracer(settings component.TelemetrySettings) trace.Tracer { return settings.TracerProvider.Tracer("{{ .ScopeName }}") } diff --git a/cmd/mdatagen/templates/telemetry_test.go.tmpl b/cmd/mdatagen/templates/telemetry_test.go.tmpl index 0663d3a0790..600fe5d42d8 100644 --- a/cmd/mdatagen/templates/telemetry_test.go.tmpl +++ b/cmd/mdatagen/templates/telemetry_test.go.tmpl @@ -14,6 +14,7 @@ import ( nooptrace "go.opentelemetry.io/otel/trace/noop" "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/config/configtelemetry" ) type mockMeter struct { @@ -43,6 +44,9 @@ func (m mockTracerProvider) Tracer(name string, opts ...trace.TracerOption) trac func TestProviders(t *testing.T) { set := component.TelemetrySettings{ + LeveledMeterProvider: func(_ configtelemetry.Level) metric.MeterProvider { + return mockMeterProvider{} + }, MeterProvider: mockMeterProvider{}, TracerProvider: mockTracerProvider{}, } @@ -65,6 +69,9 @@ func TestProviders(t *testing.T) { func TestNewTelemetryBuilder(t *testing.T) { set := component.TelemetrySettings{ + LeveledMeterProvider: func(_ configtelemetry.Level) metric.MeterProvider { + return mockMeterProvider{} + }, MeterProvider: mockMeterProvider{}, TracerProvider: mockTracerProvider{}, } diff --git a/cmd/mdatagen/testdata/async_metric.yaml b/cmd/mdatagen/testdata/async_metric.yaml new file mode 100644 index 00000000000..5c344009696 --- /dev/null +++ b/cmd/mdatagen/testdata/async_metric.yaml @@ -0,0 +1,24 @@ +type: metricreceiver + +status: + class: receiver + stability: + development: [logs] + beta: [traces] + stable: [metrics] + distributions: [contrib] + warnings: + - Any additional information that should be brought to the consumer's attention + +metrics: + metric: + enabled: true + description: Description. + unit: s + gauge: + value_type: double + async: true + +tests: + skip_lifecycle: true + skip_shutdown: true diff --git a/cmd/mdatagen/testdata/readme_with_status.md b/cmd/mdatagen/testdata/readme_with_status.md index 92e0b1f4258..6384b6be495 100644 --- a/cmd/mdatagen/testdata/readme_with_status.md +++ b/cmd/mdatagen/testdata/readme_with_status.md @@ -5,7 +5,7 @@ | ------------- |-----------| | Stability | [beta]: 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%2Ffoo%20&label=open&color=orange&logo=opentelemetry)](https://github.com/open-telemetry/opentelemetry-collector-contrib/issues?q=is%3Aopen+is%3Aissue+label%3Areceiver%2Ffoo) [![Closed issues](https://img.shields.io/github/issues-search/open-telemetry/opentelemetry-collector-contrib?query=is%3Aissue%20is%3Aclosed%20label%3Areceiver%2Ffoo%20&label=closed&color=blue&logo=opentelemetry)](https://github.com/open-telemetry/opentelemetry-collector-contrib/issues?q=is%3Aclosed+is%3Aissue+label%3Areceiver%2Ffoo) | +| Issues | [![Open issues](https://img.shields.io/github/issues-search/open-telemetry/opentelemetry-collector?query=is%3Aissue%20is%3Aopen%20label%3Areceiver%2Ffoo%20&label=open&color=orange&logo=opentelemetry)](https://github.com/open-telemetry/opentelemetry-collector/issues?q=is%3Aopen+is%3Aissue+label%3Areceiver%2Ffoo) [![Closed issues](https://img.shields.io/github/issues-search/open-telemetry/opentelemetry-collector?query=is%3Aissue%20is%3Aclosed%20label%3Areceiver%2Ffoo%20&label=closed&color=blue&logo=opentelemetry)](https://github.com/open-telemetry/opentelemetry-collector/issues?q=is%3Aclosed+is%3Aissue+label%3Areceiver%2Ffoo) | [beta]: https://github.com/open-telemetry/opentelemetry-collector#beta [contrib]: https://github.com/open-telemetry/opentelemetry-collector-releases/tree/main/distributions/otelcol-contrib diff --git a/cmd/otelcorecol/builder-config.yaml b/cmd/otelcorecol/builder-config.yaml index 35ca62e4538..a1c8fa02157 100644 --- a/cmd/otelcorecol/builder-config.yaml +++ b/cmd/otelcorecol/builder-config.yaml @@ -10,34 +10,34 @@ dist: module: go.opentelemetry.io/collector/cmd/otelcorecol name: otelcorecol description: Local OpenTelemetry Collector binary, testing only. - version: 0.106.1-dev - otelcol_version: 0.106.1 + version: 0.107.0-dev + otelcol_version: 0.107.0 receivers: - - gomod: go.opentelemetry.io/collector/receiver/nopreceiver v0.106.1 - - gomod: go.opentelemetry.io/collector/receiver/otlpreceiver v0.106.1 + - gomod: go.opentelemetry.io/collector/receiver/nopreceiver v0.107.0 + - gomod: go.opentelemetry.io/collector/receiver/otlpreceiver v0.107.0 exporters: - - gomod: go.opentelemetry.io/collector/exporter/debugexporter v0.106.1 - - gomod: go.opentelemetry.io/collector/exporter/loggingexporter v0.106.1 - - gomod: go.opentelemetry.io/collector/exporter/nopexporter v0.106.1 - - gomod: go.opentelemetry.io/collector/exporter/otlpexporter v0.106.1 - - gomod: go.opentelemetry.io/collector/exporter/otlphttpexporter v0.106.1 + - gomod: go.opentelemetry.io/collector/exporter/debugexporter v0.107.0 + - gomod: go.opentelemetry.io/collector/exporter/loggingexporter v0.107.0 + - gomod: go.opentelemetry.io/collector/exporter/nopexporter v0.107.0 + - gomod: go.opentelemetry.io/collector/exporter/otlpexporter v0.107.0 + - gomod: go.opentelemetry.io/collector/exporter/otlphttpexporter v0.107.0 extensions: - - gomod: go.opentelemetry.io/collector/extension/ballastextension v0.106.1 - - gomod: go.opentelemetry.io/collector/extension/memorylimiterextension v0.106.1 - - gomod: go.opentelemetry.io/collector/extension/zpagesextension v0.106.1 + - gomod: go.opentelemetry.io/collector/extension/ballastextension v0.107.0 + - gomod: go.opentelemetry.io/collector/extension/memorylimiterextension v0.107.0 + - gomod: go.opentelemetry.io/collector/extension/zpagesextension v0.107.0 processors: - - gomod: go.opentelemetry.io/collector/processor/batchprocessor v0.106.1 - - gomod: go.opentelemetry.io/collector/processor/memorylimiterprocessor v0.106.1 + - gomod: go.opentelemetry.io/collector/processor/batchprocessor v0.107.0 + - gomod: go.opentelemetry.io/collector/processor/memorylimiterprocessor v0.107.0 connectors: - - gomod: go.opentelemetry.io/collector/connector/forwardconnector v0.106.1 + - gomod: go.opentelemetry.io/collector/connector/forwardconnector v0.107.0 providers: - - gomod: go.opentelemetry.io/collector/confmap/provider/envprovider v0.106.1 - - gomod: go.opentelemetry.io/collector/confmap/provider/fileprovider v0.106.1 - - gomod: go.opentelemetry.io/collector/confmap/provider/httpprovider v0.106.1 - - gomod: go.opentelemetry.io/collector/confmap/provider/httpsprovider v0.106.1 - - gomod: go.opentelemetry.io/collector/confmap/provider/yamlprovider v0.106.1 + - gomod: go.opentelemetry.io/collector/confmap/provider/envprovider v0.107.0 + - gomod: go.opentelemetry.io/collector/confmap/provider/fileprovider v0.107.0 + - gomod: go.opentelemetry.io/collector/confmap/provider/httpprovider v0.107.0 + - gomod: go.opentelemetry.io/collector/confmap/provider/httpsprovider v0.107.0 + - gomod: go.opentelemetry.io/collector/confmap/provider/yamlprovider v0.107.0 replaces: - go.opentelemetry.io/collector => ../../ @@ -46,6 +46,7 @@ replaces: - go.opentelemetry.io/collector/otelcol => ../../otelcol - go.opentelemetry.io/collector/component => ../../component - go.opentelemetry.io/collector/component/componentprofiles => ../../component/componentprofiles + - go.opentelemetry.io/collector/component/componentstatus => ../../component/componentstatus - go.opentelemetry.io/collector/config/configauth => ../../config/configauth - go.opentelemetry.io/collector/config/configcompression => ../../config/configcompression - go.opentelemetry.io/collector/config/configgrpc => ../../config/configgrpc diff --git a/cmd/otelcorecol/components.go b/cmd/otelcorecol/components.go index 3f5a60bd471..7c97d448801 100644 --- a/cmd/otelcorecol/components.go +++ b/cmd/otelcorecol/components.go @@ -38,9 +38,9 @@ func components() (otelcol.Factories, error) { return otelcol.Factories{}, err } factories.ExtensionModules = make(map[component.Type]string, len(factories.Extensions)) - factories.ExtensionModules[ballastextension.NewFactory().Type()] = "go.opentelemetry.io/collector/extension/ballastextension v0.106.1" - factories.ExtensionModules[memorylimiterextension.NewFactory().Type()] = "go.opentelemetry.io/collector/extension/memorylimiterextension v0.106.1" - factories.ExtensionModules[zpagesextension.NewFactory().Type()] = "go.opentelemetry.io/collector/extension/zpagesextension v0.106.1" + factories.ExtensionModules[ballastextension.NewFactory().Type()] = "go.opentelemetry.io/collector/extension/ballastextension v0.107.0" + factories.ExtensionModules[memorylimiterextension.NewFactory().Type()] = "go.opentelemetry.io/collector/extension/memorylimiterextension v0.107.0" + factories.ExtensionModules[zpagesextension.NewFactory().Type()] = "go.opentelemetry.io/collector/extension/zpagesextension v0.107.0" factories.Receivers, err = receiver.MakeFactoryMap( nopreceiver.NewFactory(), @@ -50,8 +50,8 @@ func components() (otelcol.Factories, error) { return otelcol.Factories{}, err } factories.ReceiverModules = make(map[component.Type]string, len(factories.Receivers)) - factories.ReceiverModules[nopreceiver.NewFactory().Type()] = "go.opentelemetry.io/collector/receiver/nopreceiver v0.106.1" - factories.ReceiverModules[otlpreceiver.NewFactory().Type()] = "go.opentelemetry.io/collector/receiver/otlpreceiver v0.106.1" + factories.ReceiverModules[nopreceiver.NewFactory().Type()] = "go.opentelemetry.io/collector/receiver/nopreceiver v0.107.0" + factories.ReceiverModules[otlpreceiver.NewFactory().Type()] = "go.opentelemetry.io/collector/receiver/otlpreceiver v0.107.0" factories.Exporters, err = exporter.MakeFactoryMap( debugexporter.NewFactory(), @@ -64,11 +64,11 @@ func components() (otelcol.Factories, error) { return otelcol.Factories{}, err } factories.ExporterModules = make(map[component.Type]string, len(factories.Exporters)) - factories.ExporterModules[debugexporter.NewFactory().Type()] = "go.opentelemetry.io/collector/exporter/debugexporter v0.106.1" - factories.ExporterModules[loggingexporter.NewFactory().Type()] = "go.opentelemetry.io/collector/exporter/loggingexporter v0.106.1" - factories.ExporterModules[nopexporter.NewFactory().Type()] = "go.opentelemetry.io/collector/exporter/nopexporter v0.106.1" - factories.ExporterModules[otlpexporter.NewFactory().Type()] = "go.opentelemetry.io/collector/exporter/otlpexporter v0.106.1" - factories.ExporterModules[otlphttpexporter.NewFactory().Type()] = "go.opentelemetry.io/collector/exporter/otlphttpexporter v0.106.1" + factories.ExporterModules[debugexporter.NewFactory().Type()] = "go.opentelemetry.io/collector/exporter/debugexporter v0.107.0" + factories.ExporterModules[loggingexporter.NewFactory().Type()] = "go.opentelemetry.io/collector/exporter/loggingexporter v0.107.0" + factories.ExporterModules[nopexporter.NewFactory().Type()] = "go.opentelemetry.io/collector/exporter/nopexporter v0.107.0" + factories.ExporterModules[otlpexporter.NewFactory().Type()] = "go.opentelemetry.io/collector/exporter/otlpexporter v0.107.0" + factories.ExporterModules[otlphttpexporter.NewFactory().Type()] = "go.opentelemetry.io/collector/exporter/otlphttpexporter v0.107.0" factories.Processors, err = processor.MakeFactoryMap( batchprocessor.NewFactory(), @@ -78,8 +78,8 @@ func components() (otelcol.Factories, error) { return otelcol.Factories{}, err } factories.ProcessorModules = make(map[component.Type]string, len(factories.Processors)) - factories.ProcessorModules[batchprocessor.NewFactory().Type()] = "go.opentelemetry.io/collector/processor/batchprocessor v0.106.1" - factories.ProcessorModules[memorylimiterprocessor.NewFactory().Type()] = "go.opentelemetry.io/collector/processor/memorylimiterprocessor v0.106.1" + factories.ProcessorModules[batchprocessor.NewFactory().Type()] = "go.opentelemetry.io/collector/processor/batchprocessor v0.107.0" + factories.ProcessorModules[memorylimiterprocessor.NewFactory().Type()] = "go.opentelemetry.io/collector/processor/memorylimiterprocessor v0.107.0" factories.Connectors, err = connector.MakeFactoryMap( forwardconnector.NewFactory(), @@ -88,7 +88,7 @@ func components() (otelcol.Factories, error) { return otelcol.Factories{}, err } factories.ConnectorModules = make(map[component.Type]string, len(factories.Connectors)) - factories.ConnectorModules[forwardconnector.NewFactory().Type()] = "go.opentelemetry.io/collector/connector/forwardconnector v0.106.1" + factories.ConnectorModules[forwardconnector.NewFactory().Type()] = "go.opentelemetry.io/collector/connector/forwardconnector v0.107.0" return factories, nil } diff --git a/cmd/otelcorecol/go.mod b/cmd/otelcorecol/go.mod index c3ef845882b..3d781e0e3e0 100644 --- a/cmd/otelcorecol/go.mod +++ b/cmd/otelcorecol/go.mod @@ -2,50 +2,51 @@ module go.opentelemetry.io/collector/cmd/otelcorecol -go 1.21.0 +go 1.22.0 -toolchain go1.21.12 +toolchain go1.22.6 require ( - go.opentelemetry.io/collector/component v0.106.1 - go.opentelemetry.io/collector/confmap v0.106.1 - go.opentelemetry.io/collector/confmap/provider/envprovider v0.106.1 - go.opentelemetry.io/collector/confmap/provider/fileprovider v0.106.1 - go.opentelemetry.io/collector/confmap/provider/httpprovider v0.106.1 - go.opentelemetry.io/collector/confmap/provider/httpsprovider v0.106.1 - go.opentelemetry.io/collector/confmap/provider/yamlprovider v0.106.1 - go.opentelemetry.io/collector/connector v0.106.1 - go.opentelemetry.io/collector/connector/forwardconnector v0.106.1 - go.opentelemetry.io/collector/exporter v0.106.1 - go.opentelemetry.io/collector/exporter/debugexporter v0.106.1 - go.opentelemetry.io/collector/exporter/loggingexporter v0.106.1 - go.opentelemetry.io/collector/exporter/nopexporter v0.106.1 - go.opentelemetry.io/collector/exporter/otlpexporter v0.106.1 - go.opentelemetry.io/collector/exporter/otlphttpexporter v0.106.1 - go.opentelemetry.io/collector/extension v0.106.1 - go.opentelemetry.io/collector/extension/ballastextension v0.106.1 - go.opentelemetry.io/collector/extension/memorylimiterextension v0.106.1 - go.opentelemetry.io/collector/extension/zpagesextension v0.106.1 - go.opentelemetry.io/collector/otelcol v0.106.1 - go.opentelemetry.io/collector/processor v0.106.1 - go.opentelemetry.io/collector/processor/batchprocessor v0.106.1 - go.opentelemetry.io/collector/processor/memorylimiterprocessor v0.106.1 - go.opentelemetry.io/collector/receiver v0.106.1 - go.opentelemetry.io/collector/receiver/nopreceiver v0.106.1 - go.opentelemetry.io/collector/receiver/otlpreceiver v0.106.1 - golang.org/x/sys v0.23.0 + go.opentelemetry.io/collector/component v0.107.0 + go.opentelemetry.io/collector/confmap v0.107.0 + go.opentelemetry.io/collector/confmap/provider/envprovider v0.107.0 + go.opentelemetry.io/collector/confmap/provider/fileprovider v0.107.0 + go.opentelemetry.io/collector/confmap/provider/httpprovider v0.107.0 + go.opentelemetry.io/collector/confmap/provider/httpsprovider v0.107.0 + go.opentelemetry.io/collector/confmap/provider/yamlprovider v0.107.0 + go.opentelemetry.io/collector/connector v0.107.0 + go.opentelemetry.io/collector/connector/forwardconnector v0.107.0 + go.opentelemetry.io/collector/exporter v0.107.0 + go.opentelemetry.io/collector/exporter/debugexporter v0.107.0 + go.opentelemetry.io/collector/exporter/loggingexporter v0.107.0 + go.opentelemetry.io/collector/exporter/nopexporter v0.107.0 + go.opentelemetry.io/collector/exporter/otlpexporter v0.107.0 + go.opentelemetry.io/collector/exporter/otlphttpexporter v0.107.0 + go.opentelemetry.io/collector/extension v0.107.0 + go.opentelemetry.io/collector/extension/ballastextension v0.107.0 + go.opentelemetry.io/collector/extension/memorylimiterextension v0.107.0 + go.opentelemetry.io/collector/extension/zpagesextension v0.107.0 + go.opentelemetry.io/collector/otelcol v0.107.0 + go.opentelemetry.io/collector/processor v0.107.0 + go.opentelemetry.io/collector/processor/batchprocessor v0.107.0 + go.opentelemetry.io/collector/processor/memorylimiterprocessor v0.107.0 + go.opentelemetry.io/collector/receiver v0.107.0 + go.opentelemetry.io/collector/receiver/nopreceiver v0.107.0 + go.opentelemetry.io/collector/receiver/otlpreceiver v0.107.0 + golang.org/x/sys v0.24.0 ) require ( github.com/beorn7/perks v1.0.1 // indirect github.com/cenkalti/backoff/v4 v4.3.0 // indirect github.com/cespare/xxhash/v2 v2.3.0 // indirect + github.com/davecgh/go-spew v1.1.1 // indirect github.com/felixge/httpsnoop v1.0.4 // indirect github.com/fsnotify/fsnotify v1.7.0 // indirect github.com/go-logr/logr v1.4.2 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/go-ole/go-ole v1.2.6 // indirect - github.com/go-viper/mapstructure/v2 v2.0.0 // indirect + github.com/go-viper/mapstructure/v2 v2.1.0 // indirect github.com/gogo/protobuf v1.3.2 // indirect github.com/golang/snappy v0.0.4 // indirect github.com/google/uuid v1.6.0 // indirect @@ -64,8 +65,9 @@ require ( github.com/modern-go/reflect2 v1.0.2 // indirect github.com/mostynb/go-grpc-compression v1.2.3 // indirect github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect + github.com/pmezard/go-difflib v1.0.0 // indirect github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c // indirect - github.com/prometheus/client_golang v1.19.1 // indirect + github.com/prometheus/client_golang v1.20.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 @@ -74,32 +76,35 @@ require ( github.com/shoenig/go-m1cpu v0.1.6 // indirect github.com/spf13/cobra v1.8.1 // indirect github.com/spf13/pflag v1.0.5 // indirect + github.com/stretchr/testify v1.9.0 // indirect github.com/tklauser/go-sysconf v0.3.12 // indirect github.com/tklauser/numcpus v0.6.1 // indirect github.com/yusufpapurcu/wmi v1.2.4 // indirect - go.opentelemetry.io/collector v0.106.1 // indirect - go.opentelemetry.io/collector/client v0.106.1 // indirect - go.opentelemetry.io/collector/component/componentprofiles v0.106.1 // indirect - go.opentelemetry.io/collector/config/configauth v0.106.1 // indirect - go.opentelemetry.io/collector/config/configcompression v1.12.0 // indirect - go.opentelemetry.io/collector/config/configgrpc v0.106.1 // indirect - go.opentelemetry.io/collector/config/confighttp v0.106.1 // indirect - go.opentelemetry.io/collector/config/confignet v0.106.1 // indirect - go.opentelemetry.io/collector/config/configopaque v1.12.0 // indirect - go.opentelemetry.io/collector/config/configretry v1.12.0 // indirect - go.opentelemetry.io/collector/config/configtelemetry v0.106.1 // indirect - go.opentelemetry.io/collector/config/configtls v1.12.0 // indirect - go.opentelemetry.io/collector/config/internal v0.106.1 // indirect - go.opentelemetry.io/collector/consumer v0.106.1 // indirect - go.opentelemetry.io/collector/consumer/consumerprofiles v0.106.1 // indirect - go.opentelemetry.io/collector/consumer/consumertest v0.106.1 // indirect - go.opentelemetry.io/collector/extension/auth v0.106.1 // indirect - go.opentelemetry.io/collector/featuregate v1.12.0 // indirect - go.opentelemetry.io/collector/internal/globalgates v0.106.1 // indirect - go.opentelemetry.io/collector/pdata v1.12.0 // indirect - go.opentelemetry.io/collector/pdata/pprofile v0.106.1 // indirect - go.opentelemetry.io/collector/semconv v0.106.1 // indirect - go.opentelemetry.io/collector/service v0.106.1 // indirect + go.opentelemetry.io/collector v0.107.0 // indirect + go.opentelemetry.io/collector/client v1.13.0 // indirect + go.opentelemetry.io/collector/component/componentprofiles v0.107.0 // indirect + go.opentelemetry.io/collector/component/componentstatus v0.107.0 // indirect + go.opentelemetry.io/collector/config/configauth v0.107.0 // indirect + go.opentelemetry.io/collector/config/configcompression v1.13.0 // indirect + go.opentelemetry.io/collector/config/configgrpc v0.107.0 // indirect + go.opentelemetry.io/collector/config/confighttp v0.107.0 // indirect + go.opentelemetry.io/collector/config/confignet v0.107.0 // indirect + go.opentelemetry.io/collector/config/configopaque v1.13.0 // indirect + go.opentelemetry.io/collector/config/configretry v1.13.0 // indirect + go.opentelemetry.io/collector/config/configtelemetry v0.107.0 // indirect + go.opentelemetry.io/collector/config/configtls v1.13.0 // indirect + go.opentelemetry.io/collector/config/internal v0.107.0 // indirect + go.opentelemetry.io/collector/consumer v0.107.0 // indirect + go.opentelemetry.io/collector/consumer/consumerprofiles v0.107.0 // indirect + go.opentelemetry.io/collector/consumer/consumertest v0.107.0 // indirect + go.opentelemetry.io/collector/extension/auth v0.107.0 // indirect + go.opentelemetry.io/collector/featuregate v1.13.0 // indirect + go.opentelemetry.io/collector/internal/globalgates v0.107.0 // indirect + go.opentelemetry.io/collector/pdata v1.13.0 // indirect + go.opentelemetry.io/collector/pdata/pprofile v0.107.0 // indirect + go.opentelemetry.io/collector/pdata/testdata v0.107.0 // indirect + go.opentelemetry.io/collector/semconv v0.107.0 // indirect + go.opentelemetry.io/collector/service v0.107.0 // indirect go.opentelemetry.io/contrib/config v0.8.0 // indirect go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.53.0 // indirect go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.53.0 // indirect @@ -127,7 +132,7 @@ require ( golang.org/x/exp v0.0.0-20240506185415-9bf2ced13842 // indirect golang.org/x/net v0.28.0 // indirect golang.org/x/text v0.17.0 // indirect - gonum.org/v1/gonum v0.15.0 // indirect + gonum.org/v1/gonum v0.15.1 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20240701130421-f6361c86f094 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240701130421-f6361c86f094 // indirect google.golang.org/grpc v1.65.0 // indirect @@ -147,6 +152,8 @@ replace go.opentelemetry.io/collector/component => ../../component replace go.opentelemetry.io/collector/component/componentprofiles => ../../component/componentprofiles +replace go.opentelemetry.io/collector/component/componentstatus => ../../component/componentstatus + replace go.opentelemetry.io/collector/config/configauth => ../../config/configauth replace go.opentelemetry.io/collector/config/configcompression => ../../config/configcompression diff --git a/cmd/otelcorecol/go.sum b/cmd/otelcorecol/go.sum index 59508887e98..4ced4fdf134 100644 --- a/cmd/otelcorecol/go.sum +++ b/cmd/otelcorecol/go.sum @@ -19,8 +19,8 @@ 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-ole/go-ole v1.2.6 h1:/Fpf6oFPoeFik9ty7siob0G6Ke8QvQEuVcuChpwXzpY= github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0= -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/go-viper/mapstructure/v2 v2.1.0 h1:gHnMa2Y/pIxElCH2GlZZ1lZSsn6XMtufpGyP1XxdC/w= +github.com/go-viper/mapstructure/v2 v2.1.0/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM= @@ -53,6 +53,8 @@ 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/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= +github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 h1:6E+4a0GO5zZEnZ81pIr0yLvtUWk2if982qA3F3QD6H4= github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0/go.mod h1:zJYVVT2jmtg6P3p1VtQj7WsuWi/y4VnjVBn7F8KPB3I= github.com/mitchellh/copystructure v1.2.0 h1:vpKXTN4ewci03Vljg/q9QvCGUDttBOGBIa15WveJJGw= @@ -72,8 +74,8 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c h1:ncq/mPwQF4JjgDlrVEn3C11VoGHZN7m8qihwgMEtzYw= github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE= -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_golang v1.20.1 h1:IMJXHOD6eARkQpxo8KkhgEVFlBNm+nkrFUyGlIu7Na8= +github.com/prometheus/client_golang v1.20.1/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= 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= @@ -180,8 +182,8 @@ golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20201204225414-ed752295db88/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.23.0 h1:YfKFowiIMvtgl1UERQoTPPToxltDeZfbj4H7dVUCwmM= -golang.org/x/sys v0.23.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.24.0 h1:Twjiwq9dn6R1fQcyiK+wQyHWfaz/BJB+YIpzU/Cv3Xg= +golang.org/x/sys v0.24.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.17.0 h1:XtiM5bkSOt+ewxlOE/aE/AKEHibwj/6gvWMl9Rsh0Qc= @@ -194,8 +196,8 @@ golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8T 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= -gonum.org/v1/gonum v0.15.0 h1:2lYxjRbTYyxkJxlhC+LvJIx3SsANPdRybu1tGj9/OrQ= -gonum.org/v1/gonum v0.15.0/go.mod h1:xzZVBJBtS+Mz4q0Yl2LJTk+OxOg4jiXZ7qBoM0uISGo= +gonum.org/v1/gonum v0.15.1 h1:FNy7N6OUZVUaWG9pTiD+jlhdQ3lMP+/LcTpJ6+a8sQ0= +gonum.org/v1/gonum v0.15.1/go.mod h1:eZTZuRFrzu5pcyjN5wJhcIhnUdNijYxX1T2IcrOGY0o= google.golang.org/genproto/googleapis/api v0.0.0-20240701130421-f6361c86f094 h1:0+ozOGcrp+Y8Aq8TLNN2Aliibms5LEzsq99ZZmAGYm0= google.golang.org/genproto/googleapis/api v0.0.0-20240701130421-f6361c86f094/go.mod h1:fJ/e3If/Q67Mj99hin0hMhiNyCRmt6BQ2aWIJshUSJw= google.golang.org/genproto/googleapis/rpc v0.0.0-20240701130421-f6361c86f094 h1:BwIjyKYGsK9dMCBOorzRri8MQwmi7mT9rGHsCEinZkA= diff --git a/cmd/otelcorecol/main.go b/cmd/otelcorecol/main.go index 3ea4852ceef..3d243d5dcb2 100644 --- a/cmd/otelcorecol/main.go +++ b/cmd/otelcorecol/main.go @@ -20,7 +20,7 @@ func main() { info := component.BuildInfo{ Command: "otelcorecol", Description: "Local OpenTelemetry Collector binary, testing only.", - Version: "0.106.1-dev", + Version: "0.107.0-dev", } set := otelcol.CollectorSettings{ diff --git a/component/component.go b/component/component.go index f5f68b57290..bd1ff210d4b 100644 --- a/component/component.go +++ b/component/component.go @@ -189,10 +189,3 @@ type CreateDefaultConfigFunc func() Config func (f CreateDefaultConfigFunc) CreateDefaultConfig() Config { return f() } - -// InstanceID uniquely identifies a component instance -type InstanceID struct { - ID ID - Kind Kind - PipelineIDs map[ID]struct{} -} diff --git a/component/componentprofiles/go.mod b/component/componentprofiles/go.mod index 859fde50f41..426135098ca 100644 --- a/component/componentprofiles/go.mod +++ b/component/componentprofiles/go.mod @@ -1,20 +1,20 @@ module go.opentelemetry.io/collector/component/componentprofiles -go 1.21.0 +go 1.22.0 -require go.opentelemetry.io/collector/component v0.106.1 +require go.opentelemetry.io/collector/component v0.107.0 require ( github.com/gogo/protobuf v1.3.2 // indirect - go.opentelemetry.io/collector/config/configtelemetry v0.106.1 // indirect - go.opentelemetry.io/collector/pdata v1.12.0 // indirect + go.opentelemetry.io/collector/config/configtelemetry v0.107.0 // indirect + go.opentelemetry.io/collector/pdata v1.13.0 // indirect go.opentelemetry.io/otel v1.28.0 // indirect go.opentelemetry.io/otel/metric v1.28.0 // indirect go.opentelemetry.io/otel/trace v1.28.0 // indirect go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.27.0 // indirect golang.org/x/net v0.26.0 // indirect - golang.org/x/sys v0.21.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-20240528184218-531527333157 // indirect google.golang.org/grpc v1.65.0 // indirect diff --git a/component/componentprofiles/go.sum b/component/componentprofiles/go.sum index a7c977750d1..5befe46899d 100644 --- a/component/componentprofiles/go.sum +++ b/component/componentprofiles/go.sum @@ -45,8 +45,8 @@ golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJ 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.21.0 h1:rF+pYz3DAGSQAxAu1CbC7catZg4ebC4UIeIhKxBZvws= -golang.org/x/sys v0.21.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +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= diff --git a/component/componentstatus/go.mod b/component/componentstatus/go.mod index c02c171b802..1e8008c1c1c 100644 --- a/component/componentstatus/go.mod +++ b/component/componentstatus/go.mod @@ -1,25 +1,25 @@ module go.opentelemetry.io/collector/component/componentstatus -go 1.21.0 +go 1.22.0 require ( github.com/stretchr/testify v1.9.0 - go.opentelemetry.io/collector/component v0.106.1 + go.opentelemetry.io/collector/component v0.107.0 ) require ( github.com/davecgh/go-spew v1.1.1 // indirect github.com/gogo/protobuf v1.3.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/collector/config/configtelemetry v0.106.1 // indirect - go.opentelemetry.io/collector/pdata v1.12.0 // indirect + go.opentelemetry.io/collector/config/configtelemetry v0.107.0 // indirect + go.opentelemetry.io/collector/pdata v1.13.0 // indirect go.opentelemetry.io/otel v1.28.0 // indirect go.opentelemetry.io/otel/metric v1.28.0 // indirect go.opentelemetry.io/otel/trace v1.28.0 // indirect go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.27.0 // indirect golang.org/x/net v0.26.0 // indirect - golang.org/x/sys v0.21.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-20240528184218-531527333157 // indirect google.golang.org/grpc v1.65.0 // indirect diff --git a/component/componentstatus/go.sum b/component/componentstatus/go.sum index 147b5cbbcda..794cc35a2ad 100644 --- a/component/componentstatus/go.sum +++ b/component/componentstatus/go.sum @@ -51,8 +51,8 @@ golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJ 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.21.0 h1:rF+pYz3DAGSQAxAu1CbC7catZg4ebC4UIeIhKxBZvws= -golang.org/x/sys v0.21.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +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= diff --git a/component/componentstatus/instance.go b/component/componentstatus/instance.go index 22ea4c8003e..71668b6d351 100644 --- a/component/componentstatus/instance.go +++ b/component/componentstatus/instance.go @@ -3,14 +3,88 @@ package componentstatus // import "go.opentelemetry.io/collector/component/componentstatus" -import "go.opentelemetry.io/collector/component" +import ( + "slices" + "sort" + "strings" + + "go.opentelemetry.io/collector/component" +) + +// pipelineDelim is the delimiter for internal representation of pipeline +// component IDs. +const pipelineDelim = byte(0x20) // InstanceID uniquely identifies a component instance // // TODO: consider moving this struct to a new package/module like `extension/statuswatcher` // https://github.com/open-telemetry/opentelemetry-collector/issues/10764 type InstanceID struct { - ID component.ID - Kind component.Kind - PipelineIDs map[component.ID]struct{} + componentID component.ID + kind component.Kind + pipelineIDs string // IDs encoded as a string so InstanceID is Comparable. +} + +// NewInstanceID returns an ID that uniquely identifies a component. +func NewInstanceID(componentID component.ID, kind component.Kind, pipelineIDs ...component.ID) *InstanceID { + instanceID := &InstanceID{ + componentID: componentID, + kind: kind, + } + instanceID.addPipelines(pipelineIDs) + return instanceID +} + +// ComponentID returns the ComponentID associated with this instance. +func (id *InstanceID) ComponentID() component.ID { + return id.componentID +} + +// Kind returns the component Kind associated with this instance. +func (id *InstanceID) Kind() component.Kind { + return id.kind +} + +// AllPipelineIDs calls f for each pipeline this instance is associated with. If +// f returns false it will stop iteration. +func (id *InstanceID) AllPipelineIDs(f func(component.ID) bool) { + var bs []byte + for _, b := range []byte(id.pipelineIDs) { + if b != pipelineDelim { + bs = append(bs, b) + continue + } + pipelineID := component.ID{} + err := pipelineID.UnmarshalText(bs) + bs = bs[:0] + if err != nil { + continue + } + if !f(pipelineID) { + break + } + } +} + +// WithPipelines returns a new InstanceID updated to include the given +// pipelineIDs. +func (id *InstanceID) WithPipelines(pipelineIDs ...component.ID) *InstanceID { + instanceID := &InstanceID{ + componentID: id.componentID, + kind: id.kind, + pipelineIDs: id.pipelineIDs, + } + instanceID.addPipelines(pipelineIDs) + return instanceID +} + +func (id *InstanceID) addPipelines(pipelineIDs []component.ID) { + delim := string(pipelineDelim) + strIDs := strings.Split(id.pipelineIDs, delim) + for _, pID := range pipelineIDs { + strIDs = append(strIDs, pID.String()) + } + sort.Strings(strIDs) + strIDs = slices.Compact(strIDs) + id.pipelineIDs = strings.Join(strIDs, delim) + delim } diff --git a/component/componentstatus/instance_test.go b/component/componentstatus/instance_test.go new file mode 100644 index 00000000000..486607ae8dd --- /dev/null +++ b/component/componentstatus/instance_test.go @@ -0,0 +1,95 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package componentstatus + +import ( + "testing" + + "github.com/stretchr/testify/assert" + + "go.opentelemetry.io/collector/component" +) + +func TestInstanceID(t *testing.T) { + traces := component.MustNewID("traces") + tracesA := component.MustNewIDWithName("traces", "a") + tracesB := component.MustNewIDWithName("traces", "b") + tracesC := component.MustNewIDWithName("traces", "c") + + idTracesA := NewInstanceID(traces, component.KindReceiver, tracesA) + idTracesAll := NewInstanceID(traces, component.KindReceiver, tracesA, tracesB, tracesC) + assert.NotEqual(t, idTracesA, idTracesAll) + + assertHasPipelines := func(t *testing.T, instanceID *InstanceID, expectedPipelineIDs []component.ID) { + var pipelineIDs []component.ID + instanceID.AllPipelineIDs(func(id component.ID) bool { + pipelineIDs = append(pipelineIDs, id) + return true + }) + assert.Equal(t, expectedPipelineIDs, pipelineIDs) + } + + for _, tc := range []struct { + name string + id1 *InstanceID + id2 *InstanceID + pipelineIDs []component.ID + }{ + { + name: "equal instances", + id1: idTracesA, + id2: NewInstanceID(traces, component.KindReceiver, tracesA), + pipelineIDs: []component.ID{tracesA}, + }, + { + name: "equal instances - out of order", + id1: idTracesAll, + id2: NewInstanceID(traces, component.KindReceiver, tracesC, tracesB, tracesA), + pipelineIDs: []component.ID{tracesA, tracesB, tracesC}, + }, + { + name: "with pipelines", + id1: idTracesAll, + id2: idTracesA.WithPipelines(tracesB, tracesC), + pipelineIDs: []component.ID{tracesA, tracesB, tracesC}, + }, + { + name: "with pipelines - out of order", + id1: idTracesAll, + id2: idTracesA.WithPipelines(tracesC, tracesB), + pipelineIDs: []component.ID{tracesA, tracesB, tracesC}, + }, + } { + t.Run(tc.name, func(t *testing.T) { + assert.Equal(t, tc.id1, tc.id2) + assertHasPipelines(t, tc.id1, tc.pipelineIDs) + assertHasPipelines(t, tc.id2, tc.pipelineIDs) + }) + } +} + +func TestAllPipelineIDs(t *testing.T) { + instanceID := NewInstanceID( + component.MustNewID("traces"), + component.KindReceiver, + component.MustNewIDWithName("traces", "a"), + component.MustNewIDWithName("traces", "b"), + component.MustNewIDWithName("traces", "c"), + ) + + count := 0 + instanceID.AllPipelineIDs(func(component.ID) bool { + count++ + return true + }) + assert.Equal(t, 3, count) + + count = 0 + instanceID.AllPipelineIDs(func(component.ID) bool { + count++ + return false + }) + assert.Equal(t, 1, count) + +} diff --git a/component/componentstatus/status.go b/component/componentstatus/status.go index 6f016cf0797..c55fff3ffa3 100644 --- a/component/componentstatus/status.go +++ b/component/componentstatus/status.go @@ -11,8 +11,20 @@ package componentstatus // import "go.opentelemetry.io/collector/component/compo import ( "time" + + "go.opentelemetry.io/collector/component" ) +// Reporter is an extra interface for `component.Host` implementations. +// A Reporter defines how to report a `componentstatus.Event`. +type Reporter interface { + // Report allows a component to report runtime changes in status. The service + // will automatically report status for a component during startup and shutdown. Components can + // use this method to report status after start and before shutdown. For more details about + // component status reporting see: https://github.com/open-telemetry/opentelemetry-collector/blob/main/docs/component-status.md + Report(*Event) +} + // Watcher is an extra interface for Extension hosted by the OpenTelemetry // Collector that is to be implemented by extensions interested in changes to component // status. @@ -137,3 +149,12 @@ func StatusIsError(status Status) bool { status == StatusPermanentError || status == StatusFatalError } + +// ReportStatus is a helper function that handles checking if the component.Host has implemented Reporter. +// If it has, the Event is reported. Otherwise, nothing happens. +func ReportStatus(host component.Host, e *Event) { + statusReporter, ok := host.(Reporter) + if ok { + statusReporter.Report(e) + } +} diff --git a/component/componentstatus/status_test.go b/component/componentstatus/status_test.go index 7d66f2c5c3d..d34a0fbd2c0 100644 --- a/component/componentstatus/status_test.go +++ b/component/componentstatus/status_test.go @@ -8,6 +8,8 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + + "go.opentelemetry.io/collector/component" ) func TestNewStatusEvent(t *testing.T) { @@ -88,3 +90,42 @@ func TestStatusIsError(t *testing.T) { }) } } + +func Test_ReportStatus(t *testing.T) { + t.Run("Reporter implemented", func(t *testing.T) { + r := &reporter{} + ReportStatus(r, NewEvent(StatusOK)) + require.True(t, r.reportStatusCalled) + }) + + t.Run("Reporter not implemented", func(t *testing.T) { + h := &host{} + ReportStatus(h, NewEvent(StatusOK)) + require.False(t, h.reportStatusCalled) + }) +} + +var _ = (component.Host)(nil) +var _ = (Reporter)(nil) + +type reporter struct { + reportStatusCalled bool +} + +func (r *reporter) GetExtensions() map[component.ID]component.Component { + return nil +} + +func (r *reporter) Report(_ *Event) { + r.reportStatusCalled = true +} + +var _ = (component.Host)(nil) + +type host struct { + reportStatusCalled bool +} + +func (h *host) GetExtensions() map[component.ID]component.Component { + return nil +} diff --git a/component/componenttest/nop_telemetry.go b/component/componenttest/nop_telemetry.go index 171e9daa47e..0324f65c980 100644 --- a/component/componenttest/nop_telemetry.go +++ b/component/componenttest/nop_telemetry.go @@ -21,7 +21,5 @@ func NewNopTelemetrySettings() component.TelemetrySettings { MeterProvider: noopmetric.NewMeterProvider(), MetricsLevel: configtelemetry.LevelNone, Resource: pcommon.NewResource(), - ReportStatus: func(*component.StatusEvent) { - }, } } diff --git a/component/go.mod b/component/go.mod index 14fbde0f5ec..e1067c18faa 100644 --- a/component/go.mod +++ b/component/go.mod @@ -1,14 +1,14 @@ module go.opentelemetry.io/collector/component -go 1.21.0 +go 1.22.0 require ( - github.com/prometheus/client_golang v1.19.1 + github.com/prometheus/client_golang v1.20.1 github.com/prometheus/client_model v0.6.1 github.com/prometheus/common v0.55.0 github.com/stretchr/testify v1.9.0 - go.opentelemetry.io/collector/config/configtelemetry v0.106.1 - go.opentelemetry.io/collector/pdata v1.12.0 + go.opentelemetry.io/collector/config/configtelemetry v0.107.0 + go.opentelemetry.io/collector/pdata v1.13.0 go.opentelemetry.io/otel v1.28.0 go.opentelemetry.io/otel/exporters/prometheus v0.50.0 go.opentelemetry.io/otel/metric v1.28.0 @@ -28,11 +28,12 @@ require ( github.com/go-logr/stdr v1.2.2 // indirect github.com/gogo/protobuf v1.3.2 // indirect github.com/google/uuid v1.6.0 // indirect + github.com/klauspost/compress v1.17.9 // indirect github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/prometheus/procfs v0.15.1 // indirect golang.org/x/net v0.26.0 // indirect - golang.org/x/sys v0.21.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-20240528184218-531527333157 // indirect google.golang.org/grpc v1.65.0 // indirect diff --git a/component/go.sum b/component/go.sum index 84c77c2abda..2c8948bdbe8 100644 --- a/component/go.sum +++ b/component/go.sum @@ -17,16 +17,20 @@ 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/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/klauspost/compress v1.17.9 h1:6KIumPrER1LHsvBVuDa0r5xaG0Es51mhhB9BQB2qeMA= +github.com/klauspost/compress v1.17.9/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw= 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/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= +github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= 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_golang v1.20.1 h1:IMJXHOD6eARkQpxo8KkhgEVFlBNm+nkrFUyGlIu7Na8= +github.com/prometheus/client_golang v1.20.1/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= 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= @@ -74,8 +78,8 @@ golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJ 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.21.0 h1:rF+pYz3DAGSQAxAu1CbC7catZg4ebC4UIeIhKxBZvws= -golang.org/x/sys v0.21.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +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= diff --git a/component/status.go b/component/status.go deleted file mode 100644 index 60894a217ca..00000000000 --- a/component/status.go +++ /dev/null @@ -1,200 +0,0 @@ -// Copyright The OpenTelemetry Authors -// SPDX-License-Identifier: Apache-2.0 - -package component // import "go.opentelemetry.io/collector/component" - -import ( - "time" -) - -type Status int32 - -// Enumeration of possible component statuses -const ( - // StatusNone indicates absence of component status. - StatusNone Status = iota - // StatusStarting indicates the component is starting. - StatusStarting - // StatusOK indicates the component is running without issues. - StatusOK - // StatusRecoverableError indicates that the component has experienced a transient error and may recover. - StatusRecoverableError - // StatusPermanentError indicates that the component has detected a condition at runtime that will need human intervention to fix. The collector will continue to run in a degraded mode. - StatusPermanentError - // StatusFatalError indicates that the collector has experienced a fatal runtime error and will shut down. - StatusFatalError - // StatusStopping indicates that the component is in the process of shutting down. - StatusStopping - // StatusStopped indicates that the component has completed shutdown. - StatusStopped -) - -// String returns a string representation of a Status -func (s Status) String() string { - switch s { - case StatusStarting: - return "StatusStarting" - case StatusOK: - return "StatusOK" - case StatusRecoverableError: - return "StatusRecoverableError" - case StatusPermanentError: - return "StatusPermanentError" - case StatusFatalError: - return "StatusFatalError" - case StatusStopping: - return "StatusStopping" - case StatusStopped: - return "StatusStopped" - } - return "StatusNone" -} - -// StatusEvent contains a status and timestamp, and can contain an error -type StatusEvent struct { - status Status - err error - timestamp time.Time -} - -// Status returns the Status (enum) associated with the StatusEvent -func (ev *StatusEvent) Status() Status { - return ev.status -} - -// Err returns the error associated with the StatusEvent. -func (ev *StatusEvent) Err() error { - return ev.err -} - -// Timestamp returns the timestamp associated with the StatusEvent -func (ev *StatusEvent) Timestamp() time.Time { - return ev.timestamp -} - -// NewStatusEvent creates and returns a StatusEvent with the specified status and sets the timestamp -// time.Now(). To set an error on the event for an error status use one of the dedicated -// constructors (e.g. NewRecoverableErrorEvent, NewPermanentErrorEvent, NewFatalErrorEvent) -func NewStatusEvent(status Status) *StatusEvent { - return &StatusEvent{ - status: status, - timestamp: time.Now(), - } -} - -// NewRecoverableErrorEvent wraps a transient error -// passed as argument as a StatusEvent with a status StatusRecoverableError -// and a timestamp set to time.Now(). -func NewRecoverableErrorEvent(err error) *StatusEvent { - ev := NewStatusEvent(StatusRecoverableError) - ev.err = err - return ev -} - -// NewPermanentErrorEvent wraps an error requiring human intervention to fix -// passed as argument as a StatusEvent with a status StatusPermanentError -// and a timestamp set to time.Now(). -func NewPermanentErrorEvent(err error) *StatusEvent { - ev := NewStatusEvent(StatusPermanentError) - ev.err = err - return ev -} - -// NewFatalErrorEvent wraps the fatal runtime error passed as argument as a StatusEvent -// with a status StatusFatalError and a timestamp set to time.Now(). -func NewFatalErrorEvent(err error) *StatusEvent { - ev := NewStatusEvent(StatusFatalError) - ev.err = err - return ev -} - -// AggregateStatus will derive a status for the given input using the following rules in order: -// 1. If all instances have the same status, there is nothing to aggregate, return it. -// 2. If any instance encounters a fatal error, the component is in a Fatal Error state. -// 3. If any instance is in a Permanent Error state, the component status is Permanent Error. -// 4. If any instance is Stopping, the component is in a Stopping state. -// 5. An instance is Stopped, but not all instances are Stopped, we must be in the process of Stopping the component. -// 6. If any instance is in a Recoverable Error state, the component status is Recoverable Error. -// 7. By process of elimination, the only remaining state is starting. -func AggregateStatus[K comparable](eventMap map[K]*StatusEvent) Status { - seen := make(map[Status]struct{}) - for _, ev := range eventMap { - seen[ev.Status()] = struct{}{} - } - - // All statuses are the same. Note, this will handle StatusOK and StatusStopped as these two - // cases require all components be in the same state. - if len(seen) == 1 { - for st := range seen { - return st - } - } - - // Handle mixed status cases - if _, isFatal := seen[StatusFatalError]; isFatal { - return StatusFatalError - } - - if _, isPermanent := seen[StatusPermanentError]; isPermanent { - return StatusPermanentError - } - - if _, isStopping := seen[StatusStopping]; isStopping { - return StatusStopping - } - - if _, isStopped := seen[StatusStopped]; isStopped { - return StatusStopping - } - - if _, isRecoverable := seen[StatusRecoverableError]; isRecoverable { - return StatusRecoverableError - } - - // By process of elimination, this is the last possible status; no check necessary. - return StatusStarting -} - -// StatusIsError returns true for error statuses (e.g. StatusRecoverableError, -// StatusPermanentError, or StatusFatalError) -func StatusIsError(status Status) bool { - return status == StatusRecoverableError || - status == StatusPermanentError || - status == StatusFatalError -} - -// AggregateStatusEvent returns a status event where: -// - The status is set to the aggregate status of the events in the eventMap -// - The timestamp is set to the latest timestamp of the events in the eventMap -// - For an error status, the event will have same error as the most current event of the same -// error type from the eventMap -func AggregateStatusEvent[K comparable](eventMap map[K]*StatusEvent) *StatusEvent { - var lastEvent, lastMatchingEvent *StatusEvent - aggregateStatus := AggregateStatus[K](eventMap) - - for _, ev := range eventMap { - if lastEvent == nil || lastEvent.timestamp.Before(ev.timestamp) { - lastEvent = ev - } - if aggregateStatus == ev.Status() && - (lastMatchingEvent == nil || lastMatchingEvent.timestamp.Before(ev.timestamp)) { - lastMatchingEvent = ev - } - } - - // the effective status matches an existing event - if lastEvent.Status() == aggregateStatus { - return lastEvent - } - - // the effective status requires a synthetic event - aggregateEvent := &StatusEvent{ - status: aggregateStatus, - timestamp: lastEvent.timestamp, - } - if StatusIsError(aggregateStatus) { - aggregateEvent.err = lastMatchingEvent.err - } - - return aggregateEvent -} diff --git a/component/status_test.go b/component/status_test.go deleted file mode 100644 index 13755d078a5..00000000000 --- a/component/status_test.go +++ /dev/null @@ -1,330 +0,0 @@ -// Copyright The OpenTelemetry Authors -// SPDX-License-Identifier: Apache-2.0 -package component - -import ( - "fmt" - "testing" - "time" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" -) - -func TestNewStatusEvent(t *testing.T) { - statuses := []Status{ - StatusStarting, - StatusOK, - StatusRecoverableError, - StatusPermanentError, - StatusFatalError, - StatusStopping, - StatusStopped, - } - - for _, status := range statuses { - t.Run(fmt.Sprintf("%s without error", status), func(t *testing.T) { - ev := NewStatusEvent(status) - require.Equal(t, status, ev.Status()) - require.Nil(t, ev.Err()) - require.False(t, ev.Timestamp().IsZero()) - }) - } -} - -func TestStatusEventsWithError(t *testing.T) { - statusConstructorMap := map[Status]func(error) *StatusEvent{ - StatusRecoverableError: NewRecoverableErrorEvent, - StatusPermanentError: NewPermanentErrorEvent, - StatusFatalError: NewFatalErrorEvent, - } - - for status, newEvent := range statusConstructorMap { - t.Run(fmt.Sprintf("error status constructor for: %s", status), func(t *testing.T) { - ev := newEvent(assert.AnError) - require.Equal(t, status, ev.Status()) - require.Equal(t, assert.AnError, ev.Err()) - require.False(t, ev.Timestamp().IsZero()) - }) - } -} - -func TestAggregateStatus(t *testing.T) { - for _, tc := range []struct { - name string - statusMap map[*InstanceID]*StatusEvent - expectedStatus Status - }{ - { - name: "aggregate status with fatal is FatalError", - statusMap: map[*InstanceID]*StatusEvent{ - {}: NewStatusEvent(StatusStarting), - {}: NewStatusEvent(StatusOK), - {}: NewStatusEvent(StatusFatalError), - {}: NewStatusEvent(StatusRecoverableError), - }, - expectedStatus: StatusFatalError, - }, - { - name: "aggregate status with permanent is PermanentError", - statusMap: map[*InstanceID]*StatusEvent{ - {}: NewStatusEvent(StatusStarting), - {}: NewStatusEvent(StatusOK), - {}: NewStatusEvent(StatusPermanentError), - {}: NewStatusEvent(StatusRecoverableError), - }, - expectedStatus: StatusPermanentError, - }, - { - name: "aggregate status with stopping is Stopping", - statusMap: map[*InstanceID]*StatusEvent{ - {}: NewStatusEvent(StatusStarting), - {}: NewStatusEvent(StatusOK), - {}: NewStatusEvent(StatusRecoverableError), - {}: NewStatusEvent(StatusStopping), - }, - expectedStatus: StatusStopping, - }, - { - name: "aggregate status with stopped and non-stopped is Stopping", - statusMap: map[*InstanceID]*StatusEvent{ - {}: NewStatusEvent(StatusStarting), - {}: NewStatusEvent(StatusOK), - {}: NewStatusEvent(StatusRecoverableError), - {}: NewStatusEvent(StatusStopped), - }, - expectedStatus: StatusStopping, - }, - { - name: "aggregate status with all stopped is Stopped", - statusMap: map[*InstanceID]*StatusEvent{ - {}: NewStatusEvent(StatusStopped), - {}: NewStatusEvent(StatusStopped), - {}: NewStatusEvent(StatusStopped), - }, - expectedStatus: StatusStopped, - }, - { - name: "aggregate status with recoverable is RecoverableError", - statusMap: map[*InstanceID]*StatusEvent{ - {}: NewStatusEvent(StatusStarting), - {}: NewStatusEvent(StatusOK), - {}: NewStatusEvent(StatusRecoverableError), - }, - expectedStatus: StatusRecoverableError, - }, - { - name: "aggregate status with starting is Starting", - statusMap: map[*InstanceID]*StatusEvent{ - {}: NewStatusEvent(StatusStarting), - {}: NewStatusEvent(StatusOK), - }, - expectedStatus: StatusStarting, - }, - { - name: "aggregate status with all ok is OK", - statusMap: map[*InstanceID]*StatusEvent{ - {}: NewStatusEvent(StatusOK), - {}: NewStatusEvent(StatusOK), - {}: NewStatusEvent(StatusOK), - }, - expectedStatus: StatusOK, - }, - } { - t.Run(tc.name, func(t *testing.T) { - assert.Equal(t, tc.expectedStatus, AggregateStatus(tc.statusMap)) - }) - } -} - -func TestStatusIsError(t *testing.T) { - for _, tc := range []struct { - status Status - isError bool - }{ - { - status: StatusStarting, - isError: false, - }, - { - status: StatusOK, - isError: false, - }, - { - status: StatusRecoverableError, - isError: true, - }, - { - status: StatusPermanentError, - isError: true, - }, - { - status: StatusFatalError, - isError: true, - }, - { - status: StatusStopping, - isError: false, - }, - { - status: StatusStopped, - isError: false, - }, - } { - name := fmt.Sprintf("StatusIsError(%s) is %t", tc.status, tc.isError) - t.Run(name, func(t *testing.T) { - assert.Equal(t, tc.isError, StatusIsError(tc.status)) - }) - } -} - -func TestAggregateStatusEvent(t *testing.T) { - // maxTime is used to make sure we select the event with the latest timestamp - maxTime := time.Unix(1<<63-62135596801, 999999999) - // latest sets the timestamp for an event to maxTime - latest := func(ev *StatusEvent) *StatusEvent { - ev.timestamp = maxTime - return ev - } - - for _, tc := range []struct { - name string - statusMap map[*InstanceID]*StatusEvent - expectedStatus *StatusEvent - }{ - { - name: "FatalError - existing event", - statusMap: map[*InstanceID]*StatusEvent{ - {}: NewStatusEvent(StatusStarting), - {}: NewStatusEvent(StatusOK), - {}: latest(NewFatalErrorEvent(assert.AnError)), - {}: NewStatusEvent(StatusRecoverableError), - }, - expectedStatus: &StatusEvent{ - status: StatusFatalError, - timestamp: maxTime, - err: assert.AnError, - }, - }, - { - name: "FatalError - synthetic event", - statusMap: map[*InstanceID]*StatusEvent{ - {}: NewStatusEvent(StatusStarting), - {}: NewStatusEvent(StatusOK), - {}: NewFatalErrorEvent(assert.AnError), - {}: latest(NewStatusEvent(StatusRecoverableError)), - }, - expectedStatus: &StatusEvent{ - status: StatusFatalError, - timestamp: maxTime, - err: assert.AnError, - }, - }, - { - name: "PermanentError - existing event", - statusMap: map[*InstanceID]*StatusEvent{ - {}: NewStatusEvent(StatusStarting), - {}: NewStatusEvent(StatusOK), - {}: latest(NewPermanentErrorEvent(assert.AnError)), - {}: NewStatusEvent(StatusRecoverableError), - }, - expectedStatus: &StatusEvent{ - status: StatusPermanentError, - timestamp: maxTime, - err: assert.AnError, - }, - }, - { - name: "PermanentError - synthetic event", - statusMap: map[*InstanceID]*StatusEvent{ - {}: NewStatusEvent(StatusStarting), - {}: NewStatusEvent(StatusOK), - {}: NewPermanentErrorEvent(assert.AnError), - {}: latest(NewStatusEvent(StatusRecoverableError)), - }, - expectedStatus: &StatusEvent{ - status: StatusPermanentError, - timestamp: maxTime, - err: assert.AnError, - }, - }, - { - name: "Stopping - existing event", - statusMap: map[*InstanceID]*StatusEvent{ - {}: NewStatusEvent(StatusStarting), - {}: NewStatusEvent(StatusOK), - {}: NewStatusEvent(StatusRecoverableError), - {}: latest(NewStatusEvent(StatusStopping)), - }, - expectedStatus: &StatusEvent{ - status: StatusStopping, - timestamp: maxTime, - }, - }, - { - name: "Stopping - synthetic event", - statusMap: map[*InstanceID]*StatusEvent{ - {}: NewStatusEvent(StatusStarting), - {}: NewStatusEvent(StatusOK), - {}: NewStatusEvent(StatusRecoverableError), - {}: latest(NewStatusEvent(StatusStopped)), - }, - expectedStatus: &StatusEvent{ - status: StatusStopping, - timestamp: maxTime, - }, - }, - { - name: "Stopped - existing event", - statusMap: map[*InstanceID]*StatusEvent{ - {}: NewStatusEvent(StatusStopped), - {}: latest(NewStatusEvent(StatusStopped)), - {}: NewStatusEvent(StatusStopped), - }, - expectedStatus: &StatusEvent{ - status: StatusStopped, - timestamp: maxTime, - }, - }, - { - name: "RecoverableError - existing event", - statusMap: map[*InstanceID]*StatusEvent{ - {}: NewStatusEvent(StatusStarting), - {}: NewStatusEvent(StatusOK), - {}: latest(NewRecoverableErrorEvent(assert.AnError)), - }, - expectedStatus: &StatusEvent{ - status: StatusRecoverableError, - timestamp: maxTime, - err: assert.AnError, - }, - }, - { - name: "Starting - synthetic event", - statusMap: map[*InstanceID]*StatusEvent{ - {}: NewStatusEvent(StatusStarting), - {}: latest(NewStatusEvent(StatusOK)), - }, - expectedStatus: &StatusEvent{ - status: StatusStarting, - timestamp: maxTime, - }, - }, - { - name: "OK - existing event", - statusMap: map[*InstanceID]*StatusEvent{ - {}: NewStatusEvent(StatusOK), - {}: latest(NewStatusEvent(StatusOK)), - {}: NewStatusEvent(StatusOK), - }, - expectedStatus: &StatusEvent{ - status: StatusOK, - timestamp: maxTime, - }, - }, - } { - t.Run(tc.name, func(t *testing.T) { - assert.Equal(t, tc.expectedStatus, AggregateStatusEvent(tc.statusMap)) - }) - } -} diff --git a/component/telemetry.go b/component/telemetry.go index febb6d6cbcd..3d33efbdab0 100644 --- a/component/telemetry.go +++ b/component/telemetry.go @@ -24,16 +24,14 @@ type TelemetrySettings struct { // MeterProvider that the factory can pass to other instrumented third-party libraries. MeterProvider metric.MeterProvider + // LeveledMeterProvider returns a MeterProvider for a Level that the factory can + // pass to other instrumented third-party libraries. + LeveledMeterProvider func(level configtelemetry.Level) metric.MeterProvider + // MetricsLevel controls the level of detail for metrics emitted by the collector. // Experimental: *NOTE* this field is experimental and may be changed or removed. MetricsLevel configtelemetry.Level // Resource contains the resource attributes for the collector's telemetry. Resource pcommon.Resource - - // ReportStatus allows a component to report runtime changes in status. The service - // will automatically report status for a component during startup and shutdown. Components can - // use this method to report status after start and before shutdown. For more details about - // component status reporting see: https://github.com/open-telemetry/opentelemetry-collector/blob/main/docs/component-status.md - ReportStatus func(*StatusEvent) } diff --git a/config/configauth/go.mod b/config/configauth/go.mod index 726afb2fb6d..8a9880a8a8d 100644 --- a/config/configauth/go.mod +++ b/config/configauth/go.mod @@ -1,38 +1,35 @@ module go.opentelemetry.io/collector/config/configauth -go 1.21.0 +go 1.22.0 require ( github.com/stretchr/testify v1.9.0 - go.opentelemetry.io/collector/component v0.106.1 - go.opentelemetry.io/collector/extension v0.106.1 - go.opentelemetry.io/collector/extension/auth v0.106.1 + go.opentelemetry.io/collector/component v0.107.0 + go.opentelemetry.io/collector/extension v0.107.0 + go.opentelemetry.io/collector/extension/auth v0.107.0 go.uber.org/goleak v1.3.0 ) require ( github.com/davecgh/go-spew v1.1.1 // indirect - github.com/go-viper/mapstructure/v2 v2.0.0 // indirect + github.com/go-viper/mapstructure/v2 v2.1.0 // indirect github.com/gogo/protobuf v1.3.2 // indirect - github.com/hashicorp/go-version v1.7.0 // 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/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/collector/config/configtelemetry v0.106.1 // indirect - go.opentelemetry.io/collector/confmap v0.106.1 // indirect - go.opentelemetry.io/collector/featuregate v1.12.0 // indirect - go.opentelemetry.io/collector/internal/globalgates v0.106.1 // indirect - go.opentelemetry.io/collector/pdata v1.12.0 // indirect + go.opentelemetry.io/collector/config/configtelemetry v0.107.0 // indirect + go.opentelemetry.io/collector/confmap v0.107.0 // indirect + go.opentelemetry.io/collector/pdata v1.13.0 // indirect go.opentelemetry.io/otel v1.28.0 // indirect go.opentelemetry.io/otel/metric v1.28.0 // indirect go.opentelemetry.io/otel/trace v1.28.0 // indirect go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.27.0 // indirect golang.org/x/net v0.26.0 // indirect - golang.org/x/sys v0.21.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-20240528184218-531527333157 // indirect google.golang.org/grpc v1.65.0 // indirect @@ -52,6 +49,4 @@ replace go.opentelemetry.io/collector/extension => ../../extension replace go.opentelemetry.io/collector/extension/auth => ../../extension/auth -replace go.opentelemetry.io/collector/featuregate => ../../featuregate - -replace go.opentelemetry.io/collector/internal/globalgates => ../../internal/globalgates +replace go.opentelemetry.io/collector/component/componentstatus => ../../component/componentstatus diff --git a/config/configauth/go.sum b/config/configauth/go.sum index 81edf9baf77..3cf14ef19e6 100644 --- a/config/configauth/go.sum +++ b/config/configauth/go.sum @@ -8,18 +8,18 @@ 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/go-viper/mapstructure/v2 v2.1.0 h1:gHnMa2Y/pIxElCH2GlZZ1lZSsn6XMtufpGyP1XxdC/w= +github.com/go-viper/mapstructure/v2 v2.1.0/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/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/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/klauspost/compress v1.17.9 h1:6KIumPrER1LHsvBVuDa0r5xaG0Es51mhhB9BQB2qeMA= +github.com/klauspost/compress v1.17.9/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw= 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= @@ -38,8 +38,8 @@ github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq 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_golang v1.20.1 h1:IMJXHOD6eARkQpxo8KkhgEVFlBNm+nkrFUyGlIu7Na8= +github.com/prometheus/client_golang v1.20.1/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= 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= @@ -87,8 +87,8 @@ golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJ 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.21.0 h1:rF+pYz3DAGSQAxAu1CbC7catZg4ebC4UIeIhKxBZvws= -golang.org/x/sys v0.21.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +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= diff --git a/config/configcompression/go.mod b/config/configcompression/go.mod index 159d320056b..3e9b00c0d02 100644 --- a/config/configcompression/go.mod +++ b/config/configcompression/go.mod @@ -1,6 +1,6 @@ module go.opentelemetry.io/collector/config/configcompression -go 1.21.0 +go 1.22.0 require ( github.com/stretchr/testify v1.9.0 diff --git a/config/configgrpc/go.mod b/config/configgrpc/go.mod index efedfd59bac..c2c8e51a3c2 100644 --- a/config/configgrpc/go.mod +++ b/config/configgrpc/go.mod @@ -1,24 +1,24 @@ module go.opentelemetry.io/collector/config/configgrpc -go 1.21.0 +go 1.22.0 require ( github.com/mostynb/go-grpc-compression v1.2.3 github.com/stretchr/testify v1.9.0 - go.opentelemetry.io/collector v0.106.1 - go.opentelemetry.io/collector/client v0.106.1 - go.opentelemetry.io/collector/component v0.106.1 - go.opentelemetry.io/collector/config/configauth v0.106.1 - go.opentelemetry.io/collector/config/configcompression v1.12.0 - go.opentelemetry.io/collector/config/confignet v0.106.1 - go.opentelemetry.io/collector/config/configopaque v1.12.0 - go.opentelemetry.io/collector/config/configtelemetry v0.106.1 - go.opentelemetry.io/collector/config/configtls v1.12.0 - go.opentelemetry.io/collector/config/internal v0.106.1 - go.opentelemetry.io/collector/extension/auth v0.106.1 - go.opentelemetry.io/collector/featuregate v1.12.0 - go.opentelemetry.io/collector/pdata v1.12.0 - go.opentelemetry.io/collector/pdata/testdata v0.106.1 + go.opentelemetry.io/collector v0.107.0 + go.opentelemetry.io/collector/client v1.13.0 + go.opentelemetry.io/collector/component v0.107.0 + go.opentelemetry.io/collector/config/configauth v0.107.0 + go.opentelemetry.io/collector/config/configcompression v1.13.0 + go.opentelemetry.io/collector/config/confignet v0.107.0 + go.opentelemetry.io/collector/config/configopaque v1.13.0 + go.opentelemetry.io/collector/config/configtelemetry v0.107.0 + go.opentelemetry.io/collector/config/configtls v1.13.0 + go.opentelemetry.io/collector/config/internal v0.107.0 + go.opentelemetry.io/collector/extension/auth v0.107.0 + go.opentelemetry.io/collector/featuregate v1.13.0 + go.opentelemetry.io/collector/pdata v1.13.0 + go.opentelemetry.io/collector/pdata/testdata v0.107.0 go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.53.0 go.opentelemetry.io/otel v1.28.0 go.uber.org/goleak v1.3.0 @@ -33,13 +33,13 @@ require ( github.com/fsnotify/fsnotify v1.7.0 // 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/go-viper/mapstructure/v2 v2.1.0 // indirect github.com/gogo/protobuf v1.3.2 // indirect github.com/golang/snappy v0.0.4 // indirect github.com/google/uuid v1.6.0 // indirect github.com/hashicorp/go-version v1.7.0 // indirect github.com/json-iterator/go v1.1.12 // indirect - github.com/klauspost/compress v1.17.8 // indirect + github.com/klauspost/compress v1.17.9 // 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 @@ -49,14 +49,13 @@ require ( 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_golang v1.20.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/confmap v0.106.1 // indirect - go.opentelemetry.io/collector/extension v0.106.1 // indirect - go.opentelemetry.io/collector/internal/globalgates v0.106.1 // indirect - go.opentelemetry.io/collector/pdata/pprofile v0.106.1 // indirect + go.opentelemetry.io/collector/confmap v0.107.0 // indirect + go.opentelemetry.io/collector/extension v0.107.0 // indirect + go.opentelemetry.io/collector/pdata/pprofile v0.107.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 @@ -73,8 +72,6 @@ require ( replace go.opentelemetry.io/collector => ../../ -replace go.opentelemetry.io/collector/internal/globalgates => ../../internal/globalgates - replace go.opentelemetry.io/collector/client => ../../client replace go.opentelemetry.io/collector/config/configauth => ../configauth @@ -112,3 +109,5 @@ replace go.opentelemetry.io/collector/consumer => ../../consumer replace go.opentelemetry.io/collector/consumer/consumerprofiles => ../../consumer/consumerprofiles replace go.opentelemetry.io/collector/consumer/consumertest => ../../consumer/consumertest + +replace go.opentelemetry.io/collector/component/componentstatus => ../../component/componentstatus diff --git a/config/configgrpc/go.sum b/config/configgrpc/go.sum index 943252cc942..6f0a16f9389 100644 --- a/config/configgrpc/go.sum +++ b/config/configgrpc/go.sum @@ -12,8 +12,8 @@ github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY= github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= -github.com/go-viper/mapstructure/v2 v2.0.0 h1:dhn8MZ1gZ0mzeodTG3jt5Vj/o87xZKuNAprG2mQfMfc= -github.com/go-viper/mapstructure/v2 v2.0.0/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM= +github.com/go-viper/mapstructure/v2 v2.1.0 h1:gHnMa2Y/pIxElCH2GlZZ1lZSsn6XMtufpGyP1XxdC/w= +github.com/go-viper/mapstructure/v2 v2.1.0/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM= @@ -29,8 +29,8 @@ github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnr 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/klauspost/compress v1.17.8 h1:YcnTYrq7MikUT7k0Yb5eceMmALQPYBW/Xltxn0NAMnU= -github.com/klauspost/compress v1.17.8/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw= +github.com/klauspost/compress v1.17.9 h1:6KIumPrER1LHsvBVuDa0r5xaG0Es51mhhB9BQB2qeMA= +github.com/klauspost/compress v1.17.9/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw= 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= @@ -41,6 +41,8 @@ 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/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= +github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= 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= @@ -56,8 +58,8 @@ github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq 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_golang v1.20.1 h1:IMJXHOD6eARkQpxo8KkhgEVFlBNm+nkrFUyGlIu7Na8= +github.com/prometheus/client_golang v1.20.1/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= 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= diff --git a/config/confighttp/confighttp.go b/config/confighttp/confighttp.go index a62c5d7b2f5..e7ac390a93c 100644 --- a/config/confighttp/confighttp.go +++ b/config/confighttp/confighttp.go @@ -47,12 +47,15 @@ type ClientConfig struct { TLSSetting configtls.ClientConfig `mapstructure:"tls"` // ReadBufferSize for HTTP client. See http.Transport.ReadBufferSize. + // Default is 0. ReadBufferSize int `mapstructure:"read_buffer_size"` // WriteBufferSize for HTTP client. See http.Transport.WriteBufferSize. + // Default is 0. WriteBufferSize int `mapstructure:"write_buffer_size"` // Timeout parameter configures `http.Client.Timeout`. + // Default is 0 (unlimited). Timeout time.Duration `mapstructure:"timeout"` // Additional headers attached to each HTTP request sent by the client. @@ -67,20 +70,20 @@ type ClientConfig struct { Compression configcompression.Type `mapstructure:"compression"` // MaxIdleConns is used to set a limit to the maximum idle HTTP connections the client can keep open. - // There's an already set value, and we want to override it only if an explicit value provided + // By default, it is set to 100. MaxIdleConns *int `mapstructure:"max_idle_conns"` // MaxIdleConnsPerHost is used to set a limit to the maximum idle HTTP connections the host can keep open. - // There's an already set value, and we want to override it only if an explicit value provided + // By default, it is set to [http.DefaultTransport.MaxIdleConnsPerHost]. MaxIdleConnsPerHost *int `mapstructure:"max_idle_conns_per_host"` // MaxConnsPerHost limits the total number of connections per host, including connections in the dialing, // active, and idle states. - // There's an already set value, and we want to override it only if an explicit value provided + // By default, it is set to [http.DefaultTransport.MaxConnsPerHost]. MaxConnsPerHost *int `mapstructure:"max_conns_per_host"` // IdleConnTimeout is the maximum amount of time a connection will remain open before closing itself. - // There's an already set value, and we want to override it only if an explicit value provided + // By default, it is set to [http.DefaultTransport.IdleConnTimeout] IdleConnTimeout *time.Duration `mapstructure:"idle_conn_timeout"` // DisableKeepAlives, if true, disables HTTP keep-alives and will only use the connection to the server @@ -111,17 +114,21 @@ type CookiesConfig struct { } // NewDefaultClientConfig returns ClientConfig type object with -// the default values of 'MaxIdleConns' and 'IdleConnTimeout'. +// the default values of 'MaxIdleConns' and 'IdleConnTimeout', as well as [http.DefaultTransport] values. // Other config options are not added as they are initialized with 'zero value' by GoLang as default. // We encourage to use this function to create an object of ClientConfig. func NewDefaultClientConfig() ClientConfig { // The default values are taken from the values of 'DefaultTransport' of 'http' package. - maxIdleConns := 100 - idleConnTimeout := 90 * time.Second + defaultTransport := http.DefaultTransport.(*http.Transport) return ClientConfig{ - MaxIdleConns: &maxIdleConns, - IdleConnTimeout: &idleConnTimeout, + ReadBufferSize: defaultTransport.ReadBufferSize, + WriteBufferSize: defaultTransport.WriteBufferSize, + Headers: map[string]configopaque.String{}, + MaxIdleConns: &defaultTransport.MaxIdleConns, + MaxIdleConnsPerHost: &defaultTransport.MaxIdleConnsPerHost, + MaxConnsPerHost: &defaultTransport.MaxConnsPerHost, + IdleConnTimeout: &defaultTransport.IdleConnTimeout, } } diff --git a/config/confighttp/confighttp_test.go b/config/confighttp/confighttp_test.go index 9c9a6fd1695..8107b6a77f8 100644 --- a/config/confighttp/confighttp_test.go +++ b/config/confighttp/confighttp_test.go @@ -51,6 +51,8 @@ var ( mockID = component.MustNewID("mock") dummyID = component.MustNewID("dummy") nonExistingID = component.MustNewID("nonexisting") + // Omit TracerProvider and MeterProvider in TelemetrySettings as otelhttp.Transport cannot be introspected + nilProvidersSettings = component.TelemetrySettings{Logger: zap.NewNop(), MetricsLevel: configtelemetry.LevelNone} ) func TestAllHTTPClientSettings(t *testing.T) { @@ -438,7 +440,7 @@ func TestHTTPClientSettingWithAuthConfig(t *testing.T) { for _, test := range tests { t.Run(test.name, func(t *testing.T) { // Omit TracerProvider and MeterProvider in TelemetrySettings as otelhttp.Transport cannot be introspected - client, err := test.settings.ToClient(context.Background(), test.host, component.TelemetrySettings{Logger: zap.NewNop(), MetricsLevel: configtelemetry.LevelNone}) + client, err := test.settings.ToClient(context.Background(), test.host, nilProvidersSettings) if test.shouldErr { assert.Error(t, err) return @@ -721,7 +723,7 @@ func TestHttpReception(t *testing.T) { TLSSetting: *tt.tlsClientCreds, } - client, errClient := hcs.ToClient(context.Background(), componenttest.NewNopHost(), component.TelemetrySettings{}) + client, errClient := hcs.ToClient(context.Background(), componenttest.NewNopHost(), nilProvidersSettings) require.NoError(t, errClient) if tt.forceHTTP1 { @@ -1523,13 +1525,13 @@ func BenchmarkHttpRequest(b *testing.B) { b.Run(bb.name, func(b *testing.B) { var c *http.Client if !bb.clientPerThread { - c, err = hcs.ToClient(context.Background(), componenttest.NewNopHost(), component.TelemetrySettings{}) + c, err = hcs.ToClient(context.Background(), componenttest.NewNopHost(), nilProvidersSettings) require.NoError(b, err) } b.RunParallel(func(pb *testing.PB) { if c == nil { - c, err = hcs.ToClient(context.Background(), componenttest.NewNopHost(), component.TelemetrySettings{}) + c, err = hcs.ToClient(context.Background(), componenttest.NewNopHost(), nilProvidersSettings) require.NoError(b, err) } if bb.forceHTTP1 { diff --git a/config/confighttp/go.mod b/config/confighttp/go.mod index d361d102dbc..bea398a330b 100644 --- a/config/confighttp/go.mod +++ b/config/confighttp/go.mod @@ -1,23 +1,23 @@ module go.opentelemetry.io/collector/config/confighttp -go 1.21.0 +go 1.22.0 require ( github.com/golang/snappy v0.0.4 github.com/klauspost/compress v1.17.9 github.com/rs/cors v1.11.0 github.com/stretchr/testify v1.9.0 - go.opentelemetry.io/collector v0.106.1 - go.opentelemetry.io/collector/client v0.106.1 - go.opentelemetry.io/collector/component v0.106.1 - go.opentelemetry.io/collector/config/configauth v0.106.1 - go.opentelemetry.io/collector/config/configcompression v1.12.0 - go.opentelemetry.io/collector/config/configopaque v1.12.0 - go.opentelemetry.io/collector/config/configtelemetry v0.106.1 - go.opentelemetry.io/collector/config/configtls v1.12.0 - go.opentelemetry.io/collector/config/internal v0.106.1 - go.opentelemetry.io/collector/extension/auth v0.106.1 - go.opentelemetry.io/collector/featuregate v1.12.0 + go.opentelemetry.io/collector v0.107.0 + go.opentelemetry.io/collector/client v1.13.0 + go.opentelemetry.io/collector/component v0.107.0 + go.opentelemetry.io/collector/config/configauth v0.107.0 + go.opentelemetry.io/collector/config/configcompression v1.13.0 + go.opentelemetry.io/collector/config/configopaque v1.13.0 + go.opentelemetry.io/collector/config/configtelemetry v0.107.0 + go.opentelemetry.io/collector/config/configtls v1.13.0 + go.opentelemetry.io/collector/config/internal v0.107.0 + go.opentelemetry.io/collector/extension/auth v0.107.0 + go.opentelemetry.io/collector/featuregate v1.13.0 go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.53.0 go.opentelemetry.io/otel v1.28.0 go.uber.org/goleak v1.3.0 @@ -33,7 +33,7 @@ require ( github.com/fsnotify/fsnotify v1.7.0 // 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/go-viper/mapstructure/v2 v2.1.0 // indirect github.com/gogo/protobuf v1.3.2 // indirect github.com/google/uuid v1.6.0 // indirect github.com/hashicorp/go-version v1.7.0 // indirect @@ -44,14 +44,13 @@ require ( github.com/mitchellh/reflectwalk 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_golang v1.20.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/confmap v0.106.1 // indirect - go.opentelemetry.io/collector/extension v0.106.1 // indirect - go.opentelemetry.io/collector/internal/globalgates v0.106.1 // indirect - go.opentelemetry.io/collector/pdata v1.12.0 // indirect + go.opentelemetry.io/collector/confmap v0.107.0 // indirect + go.opentelemetry.io/collector/extension v0.107.0 // indirect + go.opentelemetry.io/collector/pdata v1.13.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 @@ -68,8 +67,6 @@ require ( replace go.opentelemetry.io/collector => ../../ -replace go.opentelemetry.io/collector/internal/globalgates => ../../internal/globalgates - replace go.opentelemetry.io/collector/config/configauth => ../configauth replace go.opentelemetry.io/collector/config/configcompression => ../configcompression @@ -105,3 +102,5 @@ replace go.opentelemetry.io/collector/pdata/pprofile => ../../pdata/pprofile replace go.opentelemetry.io/collector/consumer/consumerprofiles => ../../consumer/consumerprofiles replace go.opentelemetry.io/collector/consumer/consumertest => ../../consumer/consumertest + +replace go.opentelemetry.io/collector/component/componentstatus => ../../component/componentstatus diff --git a/config/confighttp/go.sum b/config/confighttp/go.sum index c9c7b3d192a..58f94cde76f 100644 --- a/config/confighttp/go.sum +++ b/config/confighttp/go.sum @@ -13,8 +13,8 @@ github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY= github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= -github.com/go-viper/mapstructure/v2 v2.0.0 h1:dhn8MZ1gZ0mzeodTG3jt5Vj/o87xZKuNAprG2mQfMfc= -github.com/go-viper/mapstructure/v2 v2.0.0/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM= +github.com/go-viper/mapstructure/v2 v2.1.0 h1:gHnMa2Y/pIxElCH2GlZZ1lZSsn6XMtufpGyP1XxdC/w= +github.com/go-viper/mapstructure/v2 v2.1.0/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM= @@ -41,6 +41,8 @@ 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/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= +github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= 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= @@ -53,8 +55,8 @@ github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq 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_golang v1.20.1 h1:IMJXHOD6eARkQpxo8KkhgEVFlBNm+nkrFUyGlIu7Na8= +github.com/prometheus/client_golang v1.20.1/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= 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= diff --git a/config/confignet/go.mod b/config/confignet/go.mod index f1f33364d78..ec8317ee55f 100644 --- a/config/confignet/go.mod +++ b/config/confignet/go.mod @@ -1,6 +1,6 @@ module go.opentelemetry.io/collector/config/confignet -go 1.21.0 +go 1.22.0 require ( github.com/stretchr/testify v1.9.0 diff --git a/config/configopaque/go.mod b/config/configopaque/go.mod index 599192dabf5..8381fe16cbc 100644 --- a/config/configopaque/go.mod +++ b/config/configopaque/go.mod @@ -1,6 +1,6 @@ module go.opentelemetry.io/collector/config/configopaque -go 1.21.0 +go 1.22.0 require ( github.com/stretchr/testify v1.9.0 diff --git a/config/configretry/go.mod b/config/configretry/go.mod index fa25d5627f9..c118ae63bae 100644 --- a/config/configretry/go.mod +++ b/config/configretry/go.mod @@ -1,6 +1,6 @@ module go.opentelemetry.io/collector/config/configretry -go 1.21.0 +go 1.22.0 require ( github.com/cenkalti/backoff/v4 v4.3.0 diff --git a/config/configtelemetry/go.mod b/config/configtelemetry/go.mod index e3a49a0bdca..27bfd5c92cc 100644 --- a/config/configtelemetry/go.mod +++ b/config/configtelemetry/go.mod @@ -1,6 +1,6 @@ module go.opentelemetry.io/collector/config/configtelemetry -go 1.21.0 +go 1.22.0 require ( github.com/stretchr/testify v1.9.0 diff --git a/config/configtls/go.mod b/config/configtls/go.mod index 8594f8ee144..e16fba9956e 100644 --- a/config/configtls/go.mod +++ b/config/configtls/go.mod @@ -1,11 +1,11 @@ module go.opentelemetry.io/collector/config/configtls -go 1.21.0 +go 1.22.0 require ( github.com/fsnotify/fsnotify v1.7.0 github.com/stretchr/testify v1.9.0 - go.opentelemetry.io/collector/config/configopaque v1.12.0 + go.opentelemetry.io/collector/config/configopaque v1.13.0 ) require ( diff --git a/config/internal/go.mod b/config/internal/go.mod index 6fbb3e70c35..07e2fab5c7f 100644 --- a/config/internal/go.mod +++ b/config/internal/go.mod @@ -1,10 +1,10 @@ module go.opentelemetry.io/collector/config/internal -go 1.21.0 +go 1.22.0 require ( github.com/stretchr/testify v1.9.0 - go.opentelemetry.io/collector v0.106.1 + go.opentelemetry.io/collector v0.107.0 go.uber.org/goleak v1.3.0 go.uber.org/zap v1.27.0 ) @@ -13,7 +13,7 @@ require ( github.com/davecgh/go-spew v1.1.1 // indirect github.com/hashicorp/go-version v1.7.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/collector/featuregate v1.12.0 // indirect + go.opentelemetry.io/collector/featuregate v1.13.0 // indirect go.uber.org/multierr v1.11.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) @@ -36,8 +36,8 @@ replace go.opentelemetry.io/collector/pdata/testdata => ../../pdata/testdata replace go.opentelemetry.io/collector/pdata/pprofile => ../../pdata/pprofile -replace go.opentelemetry.io/collector/internal/globalgates => ../../internal/globalgates - replace go.opentelemetry.io/collector/consumer/consumerprofiles => ../../consumer/consumerprofiles replace go.opentelemetry.io/collector/consumer/consumertest => ../../consumer/consumertest + +replace go.opentelemetry.io/collector/component/componentstatus => ../../component/componentstatus diff --git a/confmap/confmap.go b/confmap/confmap.go index 4e881f9d804..c625b8b82fa 100644 --- a/confmap/confmap.go +++ b/confmap/confmap.go @@ -17,7 +17,6 @@ import ( "github.com/knadh/koanf/v2" encoder "go.opentelemetry.io/collector/confmap/internal/mapstructure" - "go.opentelemetry.io/collector/internal/globalgates" ) const ( @@ -187,7 +186,7 @@ func decodeConfig(m *Conf, result any, errorUnused bool, skipTopLevelUnmarshaler ErrorUnused: errorUnused, Result: result, TagName: "mapstructure", - WeaklyTypedInput: !globalgates.StrictlyTypedInputGate.IsEnabled(), + WeaklyTypedInput: false, MatchName: caseSensitiveMatchName, DecodeHook: mapstructure.ComposeDecodeHookFunc( useExpandValue(), @@ -201,7 +200,6 @@ func decodeConfig(m *Conf, result any, errorUnused bool, skipTopLevelUnmarshaler // we unmarshal the embedded structs if present to merge with the result: unmarshalerEmbeddedStructsHookFunc(), zeroSliceHookFunc(), - negativeUintHookFunc(), ), } decoder, err := mapstructure.NewDecoder(dc) @@ -239,7 +237,7 @@ func caseSensitiveMatchName(a, b string) bool { func castTo(exp expandedValue, useOriginal bool) (any, error) { // If the target field is a string, use `exp.Original` or fail if not available. - if globalgates.StrictlyTypedInputGate.IsEnabled() && useOriginal { + if useOriginal { return exp.Original, nil } // Otherwise, use the parsed value (previous behavior). @@ -500,19 +498,6 @@ func zeroSliceHookFunc() mapstructure.DecodeHookFuncValue { } } -// This hook is used to solve the issue: https://github.com/open-telemetry/opentelemetry-collector/issues/9060 -// Decoding should fail when converting a negative integer to any type of unsigned integer. This prevents -// negative values being decoded as large uint values. -// TODO: This should be removed as a part of https://github.com/open-telemetry/opentelemetry-collector/issues/9532 -func negativeUintHookFunc() mapstructure.DecodeHookFuncValue { - return func(from reflect.Value, to reflect.Value) (interface{}, error) { - if from.CanInt() && from.Int() < 0 && to.CanUint() { - return nil, fmt.Errorf("cannot convert negative value %v to an unsigned integer", from.Int()) - } - return from.Interface(), nil - } -} - type moduleFactory[T any, S any] interface { Create(s S) T } diff --git a/confmap/confmap_test.go b/confmap/confmap_test.go index ac48d0359e6..32bf272d5d8 100644 --- a/confmap/confmap_test.go +++ b/confmap/confmap_test.go @@ -279,7 +279,7 @@ func TestUintUnmarshalerFailure(t *testing.T) { err := conf.Unmarshal(cfg) assert.Error(t, err) - assert.Contains(t, err.Error(), fmt.Sprintf("decoding failed due to the following error(s):\n\nerror decoding 'uint_test': cannot convert negative value %v to an unsigned integer", testValue)) + assert.Contains(t, err.Error(), fmt.Sprintf("decoding failed due to the following error(s):\n\ncannot parse 'uint_test', %d overflows uint", testValue)) } func TestMapKeyStringToMapKeyTextUnmarshalerHookFuncDuplicateID(t *testing.T) { diff --git a/confmap/converter/expandconverter/go.mod b/confmap/converter/expandconverter/go.mod index 60b4d680b5b..587d6a02f48 100644 --- a/confmap/converter/expandconverter/go.mod +++ b/confmap/converter/expandconverter/go.mod @@ -2,33 +2,26 @@ // Using the expandconverter with `confmap.Resolver` will cause double escaping, so `$$$$` -> `$` instead of `$$`. module go.opentelemetry.io/collector/confmap/converter/expandconverter -go 1.21.0 +go 1.22.0 require ( github.com/stretchr/testify v1.9.0 - go.opentelemetry.io/collector/confmap v0.106.1 + go.opentelemetry.io/collector/confmap v0.107.0 go.uber.org/goleak v1.3.0 go.uber.org/zap v1.27.0 ) require ( github.com/davecgh/go-spew v1.1.1 // indirect - github.com/go-viper/mapstructure/v2 v2.0.0 // indirect - github.com/hashicorp/go-version v1.7.0 // indirect + github.com/go-viper/mapstructure/v2 v2.1.0 // 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/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/collector/featuregate v1.12.0 // indirect - go.opentelemetry.io/collector/internal/globalgates v0.106.1 // indirect go.uber.org/multierr v1.11.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) replace go.opentelemetry.io/collector/confmap => ../.. - -replace go.opentelemetry.io/collector/featuregate => ../../../featuregate - -replace go.opentelemetry.io/collector/internal/globalgates => ../../../internal/globalgates diff --git a/confmap/converter/expandconverter/go.sum b/confmap/converter/expandconverter/go.sum index 95211d58154..3a051879bb3 100644 --- a/confmap/converter/expandconverter/go.sum +++ b/confmap/converter/expandconverter/go.sum @@ -1,9 +1,7 @@ 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-viper/mapstructure/v2 v2.0.0 h1:dhn8MZ1gZ0mzeodTG3jt5Vj/o87xZKuNAprG2mQfMfc= -github.com/go-viper/mapstructure/v2 v2.0.0/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM= -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/go-viper/mapstructure/v2 v2.1.0 h1:gHnMa2Y/pIxElCH2GlZZ1lZSsn6XMtufpGyP1XxdC/w= +github.com/go-viper/mapstructure/v2 v2.1.0/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM= github.com/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= diff --git a/confmap/expand.go b/confmap/expand.go index 09e1907eeb6..42f3b6296da 100644 --- a/confmap/expand.go +++ b/confmap/expand.go @@ -7,12 +7,8 @@ import ( "context" "errors" "fmt" - "reflect" "regexp" - "strconv" "strings" - - "go.opentelemetry.io/collector/internal/globalgates" ) // schemePattern defines the regexp pattern for scheme names. @@ -192,41 +188,13 @@ func (mr *Resolver) findAndExpandURI(ctx context.Context, input string) (any, bo return input, false, err } - var repl string - if globalgates.StrictlyTypedInputGate.IsEnabled() { - repl, err = expanded.AsString() - } else { - repl, err = toString(expanded) - } + repl, err := expanded.AsString() if err != nil { return input, false, fmt.Errorf("expanding %v: %w", uri, err) } return strings.ReplaceAll(input, uri, repl), true, err } -// toString attempts to convert input to a string. -func toString(ret *Retrieved) (string, error) { - // This list must be kept in sync with checkRawConfType. - input, err := ret.AsRaw() - if err != nil { - return "", err - } - - val := reflect.ValueOf(input) - switch val.Kind() { - case reflect.String: - return val.String(), nil - case reflect.Int, reflect.Int32, reflect.Int64: - return strconv.FormatInt(val.Int(), 10), nil - case reflect.Float32, reflect.Float64: - return strconv.FormatFloat(val.Float(), 'f', -1, 64), nil - case reflect.Bool: - return strconv.FormatBool(val.Bool()), nil - default: - return "", fmt.Errorf("expected convertable to string value type, got %q(%T)", input, input) - } -} - func (mr *Resolver) expandURI(ctx context.Context, input string) (*Retrieved, error) { // strip ${ and } uri := input[2 : len(input)-1] diff --git a/confmap/go.mod b/confmap/go.mod index 891b6cc9b1b..8b516e42c16 100644 --- a/confmap/go.mod +++ b/confmap/go.mod @@ -1,14 +1,13 @@ module go.opentelemetry.io/collector/confmap -go 1.21.0 +go 1.22.0 require ( - github.com/go-viper/mapstructure/v2 v2.0.0 + github.com/go-viper/mapstructure/v2 v2.1.0 github.com/knadh/koanf/maps v0.1.1 github.com/knadh/koanf/providers/confmap v0.1.0 github.com/knadh/koanf/v2 v2.1.1 github.com/stretchr/testify v1.9.0 - go.opentelemetry.io/collector/internal/globalgates v0.106.1 go.uber.org/goleak v1.3.0 go.uber.org/multierr v1.11.0 go.uber.org/zap v1.27.0 @@ -17,18 +16,15 @@ require ( require ( github.com/davecgh/go-spew v1.1.1 // indirect - github.com/hashicorp/go-version v1.7.0 // indirect + github.com/kr/pretty v0.3.1 // indirect github.com/mitchellh/copystructure v1.2.0 // indirect github.com/mitchellh/reflectwalk v1.0.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/collector/featuregate v1.12.0 // indirect + github.com/rogpeppe/go-internal v1.10.0 // indirect + gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect ) retract ( v0.76.0 // Depends on retracted pdata v1.0.0-rc10 module, use v0.76.1 v0.69.0 // Release failed, use v0.69.1 ) - -replace go.opentelemetry.io/collector/featuregate => ../featuregate - -replace go.opentelemetry.io/collector/internal/globalgates => ../internal/globalgates diff --git a/confmap/go.sum b/confmap/go.sum index 95211d58154..d716a4a75f7 100644 --- a/confmap/go.sum +++ b/confmap/go.sum @@ -1,25 +1,29 @@ +github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= 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-viper/mapstructure/v2 v2.0.0 h1:dhn8MZ1gZ0mzeodTG3jt5Vj/o87xZKuNAprG2mQfMfc= -github.com/go-viper/mapstructure/v2 v2.0.0/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM= -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/go-viper/mapstructure/v2 v2.1.0 h1:gHnMa2Y/pIxElCH2GlZZ1lZSsn6XMtufpGyP1XxdC/w= +github.com/go-viper/mapstructure/v2 v2.1.0/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM= github.com/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.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= 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/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= 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/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= diff --git a/confmap/internal/e2e/go.mod b/confmap/internal/e2e/go.mod index 1792377658f..0d6409c9bef 100644 --- a/confmap/internal/e2e/go.mod +++ b/confmap/internal/e2e/go.mod @@ -1,20 +1,17 @@ module go.opentelemetry.io/collector/confmap/internal/e2e -go 1.21.0 +go 1.22.0 require ( github.com/stretchr/testify v1.9.0 - go.opentelemetry.io/collector/confmap v0.106.1 - go.opentelemetry.io/collector/confmap/provider/envprovider v0.106.1 - go.opentelemetry.io/collector/confmap/provider/fileprovider v0.106.1 - go.opentelemetry.io/collector/featuregate v1.12.0 - go.opentelemetry.io/collector/internal/globalgates v0.106.1 + go.opentelemetry.io/collector/confmap v0.107.0 + go.opentelemetry.io/collector/confmap/provider/envprovider v0.107.0 + go.opentelemetry.io/collector/confmap/provider/fileprovider v0.107.0 ) require ( github.com/davecgh/go-spew v1.1.1 // indirect - github.com/go-viper/mapstructure/v2 v2.0.0 // indirect - github.com/hashicorp/go-version v1.7.0 // indirect + github.com/go-viper/mapstructure/v2 v2.1.0 // 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 @@ -31,7 +28,3 @@ replace go.opentelemetry.io/collector/confmap => ../../ replace go.opentelemetry.io/collector/confmap/provider/fileprovider => ../../provider/fileprovider replace go.opentelemetry.io/collector/confmap/provider/envprovider => ../../provider/envprovider - -replace go.opentelemetry.io/collector/featuregate => ../../../featuregate - -replace go.opentelemetry.io/collector/internal/globalgates => ../../../internal/globalgates diff --git a/confmap/internal/e2e/go.sum b/confmap/internal/e2e/go.sum index 95211d58154..3a051879bb3 100644 --- a/confmap/internal/e2e/go.sum +++ b/confmap/internal/e2e/go.sum @@ -1,9 +1,7 @@ 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-viper/mapstructure/v2 v2.0.0 h1:dhn8MZ1gZ0mzeodTG3jt5Vj/o87xZKuNAprG2mQfMfc= -github.com/go-viper/mapstructure/v2 v2.0.0/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM= -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/go-viper/mapstructure/v2 v2.1.0 h1:gHnMa2Y/pIxElCH2GlZZ1lZSsn6XMtufpGyP1XxdC/w= +github.com/go-viper/mapstructure/v2 v2.1.0/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM= github.com/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= diff --git a/confmap/internal/e2e/types_test.go b/confmap/internal/e2e/types_test.go index 2d72b624313..7bc2c2d0a56 100644 --- a/confmap/internal/e2e/types_test.go +++ b/confmap/internal/e2e/types_test.go @@ -14,8 +14,6 @@ import ( "go.opentelemetry.io/collector/confmap" "go.opentelemetry.io/collector/confmap/provider/envprovider" "go.opentelemetry.io/collector/confmap/provider/fileprovider" - "go.opentelemetry.io/collector/featuregate" - "go.opentelemetry.io/collector/internal/globalgates" ) type TargetField string @@ -89,161 +87,6 @@ func AssertResolvesTo(t *testing.T, resolver *confmap.Resolver, tt Test) { } } -func TestTypeCasting(t *testing.T) { - values := []Test{ - { - value: "123", - targetField: TargetFieldInt, - expected: 123, - }, - { - value: "123", - targetField: TargetFieldString, - expected: "123", - }, - { - value: "123", - targetField: TargetFieldInlineString, - expected: "inline field with 123 expansion", - }, - { - value: "0123", - targetField: TargetFieldInt, - expected: 83, - }, - { - value: "0123", - targetField: TargetFieldString, - expected: "83", - }, - { - value: "0123", - targetField: TargetFieldInlineString, - expected: "inline field with 83 expansion", - }, - { - value: "0xdeadbeef", - targetField: TargetFieldInt, - expected: 3735928559, - }, - { - value: "0xdeadbeef", - targetField: TargetFieldString, - expected: "3735928559", - }, - { - value: "0xdeadbeef", - targetField: TargetFieldInlineString, - expected: "inline field with 3735928559 expansion", - }, - { - value: "\"0123\"", - targetField: TargetFieldString, - expected: "0123", - }, - { - value: "\"0123\"", - targetField: TargetFieldInt, - expected: 83, - }, - { - value: "\"0123\"", - targetField: TargetFieldInlineString, - expected: "inline field with 0123 expansion", - }, - { - value: "!!str 0123", - targetField: TargetFieldString, - expected: "0123", - }, - { - value: "!!str 0123", - targetField: TargetFieldInlineString, - expected: "inline field with 0123 expansion", - }, - { - value: "'!!str 0123'", - targetField: TargetFieldString, - expected: "!!str 0123", - }, - { - value: "\"!!str 0123\"", - targetField: TargetFieldInlineString, - expected: "inline field with !!str 0123 expansion", - }, - { - value: "''", - targetField: TargetFieldString, - expected: "", - }, - { - value: "\"\"", - targetField: TargetFieldInlineString, - expected: "inline field with expansion", - }, - { - value: "t", - targetField: TargetFieldBool, - expected: true, - }, - { - value: "23", - targetField: TargetFieldBool, - expected: true, - }, - { - value: "foo\nbar", - targetField: TargetFieldString, - expected: "foo bar", - }, - { - value: "foo\nbar", - targetField: TargetFieldInlineString, - expected: "inline field with foo bar expansion", - }, - { - value: "\"1111:1111:1111:1111:1111::\"", - targetField: TargetFieldString, - expected: "1111:1111:1111:1111:1111::", - }, - { - value: "\"1111:1111:1111:1111:1111::\"", - targetField: TargetFieldInlineString, - expected: "inline field with 1111:1111:1111:1111:1111:: expansion", - }, - { - value: "2006-01-02T15:04:05Z07:00", - targetField: TargetFieldString, - expected: "2006-01-02T15:04:05Z07:00", - }, - { - value: "2006-01-02T15:04:05Z07:00", - targetField: TargetFieldInlineString, - expected: "inline field with 2006-01-02T15:04:05Z07:00 expansion", - }, - } - - previousValue := globalgates.StrictlyTypedInputGate.IsEnabled() - err := featuregate.GlobalRegistry().Set(globalgates.StrictlyTypedInputID, false) - require.NoError(t, err) - defer func() { - err := featuregate.GlobalRegistry().Set(globalgates.StrictlyTypedInputID, previousValue) - require.NoError(t, err) - }() - - for _, tt := range values { - t.Run(tt.value+"/"+string(tt.targetField), func(t *testing.T) { - testFile := "types_expand.yaml" - if tt.targetField == TargetFieldInlineString { - testFile = "types_expand_inline.yaml" - } - resolver := NewResolver(t, testFile) - t.Setenv("ENV", tt.value) - AssertResolvesTo(t, resolver, tt) - }) - } -} - func TestStrictTypeCasting(t *testing.T) { t.Setenv("ENV_VALUE", "testreceiver") @@ -458,14 +301,6 @@ func TestStrictTypeCasting(t *testing.T) { }, } - previousValue := globalgates.StrictlyTypedInputGate.IsEnabled() - err := featuregate.GlobalRegistry().Set(globalgates.StrictlyTypedInputID, true) - require.NoError(t, err) - defer func() { - err := featuregate.GlobalRegistry().Set(globalgates.StrictlyTypedInputID, previousValue) - require.NoError(t, err) - }() - for _, tt := range values { t.Run(tt.value+"/"+string(tt.targetField)+"/"+"direct", func(t *testing.T) { testFile := "types_expand.yaml" @@ -515,14 +350,6 @@ func TestRecursiveInlineString(t *testing.T) { }, } - previousValue := globalgates.StrictlyTypedInputGate.IsEnabled() - err := featuregate.GlobalRegistry().Set(globalgates.StrictlyTypedInputID, true) - require.NoError(t, err) - defer func() { - err := featuregate.GlobalRegistry().Set(globalgates.StrictlyTypedInputID, previousValue) - require.NoError(t, err) - }() - for _, tt := range values { t.Run(tt.value+"/"+string(tt.targetField), func(t *testing.T) { testFile := "types_expand.yaml" @@ -541,15 +368,6 @@ func TestRecursiveInlineString(t *testing.T) { func TestRecursiveMaps(t *testing.T) { value := "{value: 123}" - - previousValue := globalgates.StrictlyTypedInputGate.IsEnabled() - err := featuregate.GlobalRegistry().Set(globalgates.StrictlyTypedInputID, true) - require.NoError(t, err) - defer func() { - seterr := featuregate.GlobalRegistry().Set(globalgates.StrictlyTypedInputID, previousValue) - require.NoError(t, seterr) - }() - resolver := NewResolver(t, "types_expand.yaml") t.Setenv("ENV", `{env: "${env:ENV2}", inline: "inline ${env:ENV2}"}`) t.Setenv("ENV2", `{env2: "${env:ENV3}"}`) @@ -597,14 +415,6 @@ func TestRecursiveMaps(t *testing.T) { // Test that comments with invalid ${env:...} references do not prevent configuration from loading. func TestIssue10787(t *testing.T) { - previousValue := globalgates.StrictlyTypedInputGate.IsEnabled() - err := featuregate.GlobalRegistry().Set(globalgates.StrictlyTypedInputID, true) - require.NoError(t, err) - defer func() { - seterr := featuregate.GlobalRegistry().Set(globalgates.StrictlyTypedInputID, previousValue) - require.NoError(t, seterr) - }() - resolver := NewResolver(t, "issue-10787-main.yaml") conf, err := resolver.Resolve(context.Background()) require.NoError(t, err) @@ -649,14 +459,6 @@ func TestIssue10787(t *testing.T) { } func TestStructMappingIssue10787(t *testing.T) { - previousValue := globalgates.StrictlyTypedInputGate.IsEnabled() - err := featuregate.GlobalRegistry().Set(globalgates.StrictlyTypedInputID, true) - require.NoError(t, err) - defer func() { - seterr := featuregate.GlobalRegistry().Set(globalgates.StrictlyTypedInputID, previousValue) - require.NoError(t, seterr) - }() - resolver := NewResolver(t, "types_expand.yaml") t.Setenv("ENV", `# this is a comment logging: @@ -699,14 +501,6 @@ logging: } func TestStructMappingIssue10787_ExpandComment(t *testing.T) { - previousValue := globalgates.StrictlyTypedInputGate.IsEnabled() - err := featuregate.GlobalRegistry().Set(globalgates.StrictlyTypedInputID, true) - require.NoError(t, err) - defer func() { - seterr := featuregate.GlobalRegistry().Set(globalgates.StrictlyTypedInputID, previousValue) - require.NoError(t, seterr) - }() - resolver := NewResolver(t, "types_expand.yaml") t.Setenv("EXPAND_ME", "an expanded env var") t.Setenv("ENV", `# this is a comment with ${EXPAND_ME} @@ -750,14 +544,6 @@ logging: } func TestIndirectSliceEnvVar(t *testing.T) { - previousValue := globalgates.StrictlyTypedInputGate.IsEnabled() - err := featuregate.GlobalRegistry().Set(globalgates.StrictlyTypedInputID, true) - require.NoError(t, err) - defer func() { - seterr := featuregate.GlobalRegistry().Set(globalgates.StrictlyTypedInputID, previousValue) - require.NoError(t, seterr) - }() - // This replicates the situation in https://github.com/open-telemetry/opentelemetry-collector/issues/10799 // where a configuration file is loaded that contains a reference to a slice of strings in an environment variable. t.Setenv("BASE_FOLDER", "testdata") diff --git a/confmap/provider.go b/confmap/provider.go index e1c1973988d..91d513fad37 100644 --- a/confmap/provider.go +++ b/confmap/provider.go @@ -9,8 +9,6 @@ import ( "go.uber.org/zap" "gopkg.in/yaml.v3" - - "go.opentelemetry.io/collector/internal/globalgates" ) // ProviderSettings are the settings to initialize a Provider. @@ -137,20 +135,14 @@ func withStringRepresentation(stringRepresentation string) RetrievedOption { func NewRetrievedFromYAML(yamlBytes []byte, opts ...RetrievedOption) (*Retrieved, error) { var rawConf any if err := yaml.Unmarshal(yamlBytes, &rawConf); err != nil { - if globalgates.StrictlyTypedInputGate.IsEnabled() { - // If the string is not valid YAML, we try to use it verbatim as a string. - strRep := string(yamlBytes) - return NewRetrieved(strRep, append(opts, withStringRepresentation(strRep))...) - } - return nil, err + // If the string is not valid YAML, we try to use it verbatim as a string. + strRep := string(yamlBytes) + return NewRetrieved(strRep, append(opts, withStringRepresentation(strRep))...) } - switch v := rawConf.(type) { + switch rawConf.(type) { case string: - val := v - if globalgates.StrictlyTypedInputGate.IsEnabled() { - val = string(yamlBytes) - } + val := string(yamlBytes) return NewRetrieved(val, append(opts, withStringRepresentation(val))...) default: opts = append(opts, withStringRepresentation(string(yamlBytes))) diff --git a/confmap/provider/envprovider/go.mod b/confmap/provider/envprovider/go.mod index 9aa62935834..0b29e70b309 100644 --- a/confmap/provider/envprovider/go.mod +++ b/confmap/provider/envprovider/go.mod @@ -1,32 +1,25 @@ module go.opentelemetry.io/collector/confmap/provider/envprovider -go 1.21.0 +go 1.22.0 require ( github.com/stretchr/testify v1.9.0 - go.opentelemetry.io/collector/confmap v0.106.1 + go.opentelemetry.io/collector/confmap v0.107.0 go.uber.org/goleak v1.3.0 go.uber.org/zap v1.27.0 ) require ( github.com/davecgh/go-spew v1.1.1 // indirect - github.com/go-viper/mapstructure/v2 v2.0.0 // indirect - github.com/hashicorp/go-version v1.7.0 // indirect + github.com/go-viper/mapstructure/v2 v2.1.0 // 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/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/collector/featuregate v1.12.0 // indirect - go.opentelemetry.io/collector/internal/globalgates v0.106.1 // indirect go.uber.org/multierr v1.11.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) replace go.opentelemetry.io/collector/confmap => ../../ - -replace go.opentelemetry.io/collector/featuregate => ../../../featuregate - -replace go.opentelemetry.io/collector/internal/globalgates => ../../../internal/globalgates diff --git a/confmap/provider/envprovider/go.sum b/confmap/provider/envprovider/go.sum index 95211d58154..3a051879bb3 100644 --- a/confmap/provider/envprovider/go.sum +++ b/confmap/provider/envprovider/go.sum @@ -1,9 +1,7 @@ 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-viper/mapstructure/v2 v2.0.0 h1:dhn8MZ1gZ0mzeodTG3jt5Vj/o87xZKuNAprG2mQfMfc= -github.com/go-viper/mapstructure/v2 v2.0.0/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM= -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/go-viper/mapstructure/v2 v2.1.0 h1:gHnMa2Y/pIxElCH2GlZZ1lZSsn6XMtufpGyP1XxdC/w= +github.com/go-viper/mapstructure/v2 v2.1.0/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM= github.com/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= diff --git a/confmap/provider/fileprovider/go.mod b/confmap/provider/fileprovider/go.mod index c512bf8f0d3..519829d71a7 100644 --- a/confmap/provider/fileprovider/go.mod +++ b/confmap/provider/fileprovider/go.mod @@ -1,32 +1,25 @@ module go.opentelemetry.io/collector/confmap/provider/fileprovider -go 1.21.0 +go 1.22.0 require ( github.com/stretchr/testify v1.9.0 - go.opentelemetry.io/collector/confmap v0.106.1 + go.opentelemetry.io/collector/confmap v0.107.0 go.uber.org/goleak v1.3.0 ) require ( github.com/davecgh/go-spew v1.1.1 // indirect - github.com/go-viper/mapstructure/v2 v2.0.0 // indirect - github.com/hashicorp/go-version v1.7.0 // indirect + github.com/go-viper/mapstructure/v2 v2.1.0 // 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/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/collector/featuregate v1.12.0 // indirect - go.opentelemetry.io/collector/internal/globalgates v0.106.1 // indirect go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.27.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) replace go.opentelemetry.io/collector/confmap => ../../ - -replace go.opentelemetry.io/collector/featuregate => ../../../featuregate - -replace go.opentelemetry.io/collector/internal/globalgates => ../../../internal/globalgates diff --git a/confmap/provider/fileprovider/go.sum b/confmap/provider/fileprovider/go.sum index 95211d58154..3a051879bb3 100644 --- a/confmap/provider/fileprovider/go.sum +++ b/confmap/provider/fileprovider/go.sum @@ -1,9 +1,7 @@ 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-viper/mapstructure/v2 v2.0.0 h1:dhn8MZ1gZ0mzeodTG3jt5Vj/o87xZKuNAprG2mQfMfc= -github.com/go-viper/mapstructure/v2 v2.0.0/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM= -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/go-viper/mapstructure/v2 v2.1.0 h1:gHnMa2Y/pIxElCH2GlZZ1lZSsn6XMtufpGyP1XxdC/w= +github.com/go-viper/mapstructure/v2 v2.1.0/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM= github.com/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= diff --git a/confmap/provider/httpprovider/go.mod b/confmap/provider/httpprovider/go.mod index 596e3fef31a..b66a22105c2 100644 --- a/confmap/provider/httpprovider/go.mod +++ b/confmap/provider/httpprovider/go.mod @@ -1,32 +1,25 @@ module go.opentelemetry.io/collector/confmap/provider/httpprovider -go 1.21.0 +go 1.22.0 require ( github.com/stretchr/testify v1.9.0 - go.opentelemetry.io/collector/confmap v0.106.1 + go.opentelemetry.io/collector/confmap v0.107.0 go.uber.org/goleak v1.3.0 ) require ( github.com/davecgh/go-spew v1.1.1 // indirect - github.com/go-viper/mapstructure/v2 v2.0.0 // indirect - github.com/hashicorp/go-version v1.7.0 // indirect + github.com/go-viper/mapstructure/v2 v2.1.0 // 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/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/collector/featuregate v1.12.0 // indirect - go.opentelemetry.io/collector/internal/globalgates v0.106.1 // indirect go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.27.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) replace go.opentelemetry.io/collector/confmap => ../../ - -replace go.opentelemetry.io/collector/featuregate => ../../../featuregate - -replace go.opentelemetry.io/collector/internal/globalgates => ../../../internal/globalgates diff --git a/confmap/provider/httpprovider/go.sum b/confmap/provider/httpprovider/go.sum index 95211d58154..3a051879bb3 100644 --- a/confmap/provider/httpprovider/go.sum +++ b/confmap/provider/httpprovider/go.sum @@ -1,9 +1,7 @@ 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-viper/mapstructure/v2 v2.0.0 h1:dhn8MZ1gZ0mzeodTG3jt5Vj/o87xZKuNAprG2mQfMfc= -github.com/go-viper/mapstructure/v2 v2.0.0/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM= -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/go-viper/mapstructure/v2 v2.1.0 h1:gHnMa2Y/pIxElCH2GlZZ1lZSsn6XMtufpGyP1XxdC/w= +github.com/go-viper/mapstructure/v2 v2.1.0/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM= github.com/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= diff --git a/confmap/provider/httpsprovider/go.mod b/confmap/provider/httpsprovider/go.mod index f179ff0085d..647da6cb712 100644 --- a/confmap/provider/httpsprovider/go.mod +++ b/confmap/provider/httpsprovider/go.mod @@ -1,32 +1,25 @@ module go.opentelemetry.io/collector/confmap/provider/httpsprovider -go 1.21.0 +go 1.22.0 require ( github.com/stretchr/testify v1.9.0 - go.opentelemetry.io/collector/confmap v0.106.1 + go.opentelemetry.io/collector/confmap v0.107.0 go.uber.org/goleak v1.3.0 ) require ( github.com/davecgh/go-spew v1.1.1 // indirect - github.com/go-viper/mapstructure/v2 v2.0.0 // indirect - github.com/hashicorp/go-version v1.7.0 // indirect + github.com/go-viper/mapstructure/v2 v2.1.0 // 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/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/collector/featuregate v1.12.0 // indirect - go.opentelemetry.io/collector/internal/globalgates v0.106.1 // indirect go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.27.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) replace go.opentelemetry.io/collector/confmap => ../../ - -replace go.opentelemetry.io/collector/featuregate => ../../../featuregate - -replace go.opentelemetry.io/collector/internal/globalgates => ../../../internal/globalgates diff --git a/confmap/provider/httpsprovider/go.sum b/confmap/provider/httpsprovider/go.sum index 95211d58154..3a051879bb3 100644 --- a/confmap/provider/httpsprovider/go.sum +++ b/confmap/provider/httpsprovider/go.sum @@ -1,9 +1,7 @@ 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-viper/mapstructure/v2 v2.0.0 h1:dhn8MZ1gZ0mzeodTG3jt5Vj/o87xZKuNAprG2mQfMfc= -github.com/go-viper/mapstructure/v2 v2.0.0/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM= -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/go-viper/mapstructure/v2 v2.1.0 h1:gHnMa2Y/pIxElCH2GlZZ1lZSsn6XMtufpGyP1XxdC/w= +github.com/go-viper/mapstructure/v2 v2.1.0/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM= github.com/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= diff --git a/confmap/provider/yamlprovider/go.mod b/confmap/provider/yamlprovider/go.mod index 208a3dc2772..002c84ef1dd 100644 --- a/confmap/provider/yamlprovider/go.mod +++ b/confmap/provider/yamlprovider/go.mod @@ -1,32 +1,25 @@ module go.opentelemetry.io/collector/confmap/provider/yamlprovider -go 1.21.0 +go 1.22.0 require ( github.com/stretchr/testify v1.9.0 - go.opentelemetry.io/collector/confmap v0.106.1 + go.opentelemetry.io/collector/confmap v0.107.0 go.uber.org/goleak v1.3.0 ) require ( github.com/davecgh/go-spew v1.1.1 // indirect - github.com/go-viper/mapstructure/v2 v2.0.0 // indirect - github.com/hashicorp/go-version v1.7.0 // indirect + github.com/go-viper/mapstructure/v2 v2.1.0 // 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/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/collector/featuregate v1.12.0 // indirect - go.opentelemetry.io/collector/internal/globalgates v0.106.1 // indirect go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.27.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) replace go.opentelemetry.io/collector/confmap => ../../ - -replace go.opentelemetry.io/collector/featuregate => ../../../featuregate - -replace go.opentelemetry.io/collector/internal/globalgates => ../../../internal/globalgates diff --git a/confmap/provider/yamlprovider/go.sum b/confmap/provider/yamlprovider/go.sum index 95211d58154..3a051879bb3 100644 --- a/confmap/provider/yamlprovider/go.sum +++ b/confmap/provider/yamlprovider/go.sum @@ -1,9 +1,7 @@ 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-viper/mapstructure/v2 v2.0.0 h1:dhn8MZ1gZ0mzeodTG3jt5Vj/o87xZKuNAprG2mQfMfc= -github.com/go-viper/mapstructure/v2 v2.0.0/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM= -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/go-viper/mapstructure/v2 v2.1.0 h1:gHnMa2Y/pIxElCH2GlZZ1lZSsn6XMtufpGyP1XxdC/w= +github.com/go-viper/mapstructure/v2 v2.1.0/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM= github.com/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= diff --git a/connector/README.md b/connector/README.md index 51377534628..02477644c4d 100644 --- a/connector/README.md +++ b/connector/README.md @@ -1,7 +1,7 @@ # Connectors A connector is both an exporter and receiver. As the name suggests a Connector connects -two pipelines: it consumes data as an exporter at the end of one pipeline and emits data +two pipelines: it emits data as an exporter at the end of one pipeline and consumes data as a receiver at the start of another pipeline. It may consume and emit data of the same data type, or of different data types. A connector may generate and emit data to summarize the consumed data, or it may simply replicate or route data. diff --git a/connector/builder.go b/connector/builder.go index e0e3c3b198c..dc15e719248 100644 --- a/connector/builder.go +++ b/connector/builder.go @@ -5,6 +5,7 @@ package connector // import "go.opentelemetry.io/collector/connector" import ( "context" + "errors" "fmt" "go.uber.org/zap" @@ -13,13 +14,21 @@ import ( "go.opentelemetry.io/collector/consumer" ) +var errNilNextConsumer = errors.New("nil next Consumer") + // Builder is a helper struct that given a set of Configs and Factories helps with creating connectors. +// +// Deprecated: [v0.108.0] this builder is being internalized within the service module, +// and will be removed soon. type Builder struct { cfgs map[component.ID]component.Config factories map[component.Type]Factory } // NewBuilder creates a new connector.Builder to help with creating components form a set of configs and factories. +// +// Deprecated: [v0.108.0] this builder is being internalized within the service module, +// and will be removed soon. func NewBuilder(cfgs map[component.ID]component.Config, factories map[component.Type]Factory) *Builder { return &Builder{cfgs: cfgs, factories: factories} } diff --git a/connector/connector.go b/connector/connector.go index f7d9cc46e63..c29aefb8d64 100644 --- a/connector/connector.go +++ b/connector/connector.go @@ -4,17 +4,12 @@ package connector // import "go.opentelemetry.io/collector/connector" import ( - "errors" "fmt" "go.opentelemetry.io/collector/component" "go.opentelemetry.io/collector/connector/internal" ) -var ( - errNilNextConsumer = errors.New("nil next Consumer") -) - // A Traces connector acts as an exporter from a traces pipeline and a receiver // to one or more traces, metrics, or logs pipelines. // Traces feeds a consumer.Traces, consumer.Metrics, or consumer.Logs with data. diff --git a/connector/connectorprofiles/go.mod b/connector/connectorprofiles/go.mod index a90558b471d..1da88a66330 100644 --- a/connector/connectorprofiles/go.mod +++ b/connector/connectorprofiles/go.mod @@ -1,15 +1,15 @@ module go.opentelemetry.io/collector/connector/connectorprofiles -go 1.21.0 +go 1.22.0 require ( github.com/stretchr/testify v1.9.0 - go.opentelemetry.io/collector/component v0.106.1 - go.opentelemetry.io/collector/component/componentprofiles v0.106.1 - go.opentelemetry.io/collector/connector v0.106.1 - go.opentelemetry.io/collector/consumer v0.106.1 - go.opentelemetry.io/collector/consumer/consumerprofiles v0.106.1 - go.opentelemetry.io/collector/consumer/consumertest v0.106.1 + go.opentelemetry.io/collector/component v0.107.0 + go.opentelemetry.io/collector/component/componentprofiles v0.107.0 + go.opentelemetry.io/collector/connector v0.107.0 + go.opentelemetry.io/collector/consumer v0.107.0 + go.opentelemetry.io/collector/consumer/consumerprofiles v0.107.0 + go.opentelemetry.io/collector/consumer/consumertest v0.107.0 ) require ( @@ -19,10 +19,10 @@ require ( github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/collector v0.106.1 // indirect - go.opentelemetry.io/collector/config/configtelemetry v0.106.1 // indirect - go.opentelemetry.io/collector/pdata v1.12.0 // indirect - go.opentelemetry.io/collector/pdata/pprofile v0.106.1 // indirect + go.opentelemetry.io/collector v0.107.0 // indirect + go.opentelemetry.io/collector/config/configtelemetry v0.107.0 // indirect + go.opentelemetry.io/collector/pdata v1.13.0 // indirect + go.opentelemetry.io/collector/pdata/pprofile v0.107.0 // indirect go.opentelemetry.io/otel v1.28.0 // indirect go.opentelemetry.io/otel/metric v1.28.0 // indirect go.opentelemetry.io/otel/trace v1.28.0 // indirect @@ -53,8 +53,6 @@ replace go.opentelemetry.io/collector/component/componentprofiles => ../../compo replace go.opentelemetry.io/collector => ../.. -replace go.opentelemetry.io/collector/internal/globalgates => ../../internal/globalgates - replace go.opentelemetry.io/collector/confmap => ../../confmap replace go.opentelemetry.io/collector/component => ../../component @@ -64,3 +62,5 @@ replace go.opentelemetry.io/collector/pdata => ../../pdata replace go.opentelemetry.io/collector/config/configtelemetry => ../../config/configtelemetry replace go.opentelemetry.io/collector/pdata/testdata => ../../pdata/testdata + +replace go.opentelemetry.io/collector/component/componentstatus => ../../component/componentstatus diff --git a/connector/connectorprofiles/go.sum b/connector/connectorprofiles/go.sum index 1a8baef6976..ae826f7d610 100644 --- a/connector/connectorprofiles/go.sum +++ b/connector/connectorprofiles/go.sum @@ -20,6 +20,8 @@ github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnr 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/klauspost/compress v1.17.9 h1:6KIumPrER1LHsvBVuDa0r5xaG0Es51mhhB9BQB2qeMA= +github.com/klauspost/compress v1.17.9/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw= 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= @@ -33,8 +35,8 @@ github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq 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_golang v1.20.1 h1:IMJXHOD6eARkQpxo8KkhgEVFlBNm+nkrFUyGlIu7Na8= +github.com/prometheus/client_golang v1.20.1/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= 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= diff --git a/connector/connectortest/connector.go b/connector/connectortest/connector.go index db3bdbb5aaa..68668c010fb 100644 --- a/connector/connectortest/connector.go +++ b/connector/connectortest/connector.go @@ -91,6 +91,9 @@ type nopConnector struct { } // NewNopBuilder returns a connector.Builder that constructs nop receivers. +// +// Deprecated: [v0.108.0] this builder is being internalized within the service module, +// and will be removed soon. func NewNopBuilder() *connector.Builder { nopFactory := NewNopFactory() // Use a different ID than receivertest and exportertest to avoid ambiguous diff --git a/connector/forwardconnector/README.md b/connector/forwardconnector/README.md index acbf15eba18..bf71e5785d8 100644 --- a/connector/forwardconnector/README.md +++ b/connector/forwardconnector/README.md @@ -4,7 +4,7 @@ | Status | | | ------------- |-----------| | Distributions | [core], [contrib], [k8s] | -| Issues | [![Open issues](https://img.shields.io/github/issues-search/open-telemetry/opentelemetry-collector-contrib?query=is%3Aissue%20is%3Aopen%20label%3Aconnector%2Fforward%20&label=open&color=orange&logo=opentelemetry)](https://github.com/open-telemetry/opentelemetry-collector-contrib/issues?q=is%3Aopen+is%3Aissue+label%3Aconnector%2Fforward) [![Closed issues](https://img.shields.io/github/issues-search/open-telemetry/opentelemetry-collector-contrib?query=is%3Aissue%20is%3Aclosed%20label%3Aconnector%2Fforward%20&label=closed&color=blue&logo=opentelemetry)](https://github.com/open-telemetry/opentelemetry-collector-contrib/issues?q=is%3Aclosed+is%3Aissue+label%3Aconnector%2Fforward) | +| Issues | [![Open issues](https://img.shields.io/github/issues-search/open-telemetry/opentelemetry-collector?query=is%3Aissue%20is%3Aopen%20label%3Aconnector%2Fforward%20&label=open&color=orange&logo=opentelemetry)](https://github.com/open-telemetry/opentelemetry-collector/issues?q=is%3Aopen+is%3Aissue+label%3Aconnector%2Fforward) [![Closed issues](https://img.shields.io/github/issues-search/open-telemetry/opentelemetry-collector?query=is%3Aissue%20is%3Aclosed%20label%3Aconnector%2Fforward%20&label=closed&color=blue&logo=opentelemetry)](https://github.com/open-telemetry/opentelemetry-collector/issues?q=is%3Aclosed+is%3Aissue+label%3Aconnector%2Fforward) | [beta]: https://github.com/open-telemetry/opentelemetry-collector#beta [core]: https://github.com/open-telemetry/opentelemetry-collector-releases/tree/main/distributions/otelcol diff --git a/connector/forwardconnector/go.mod b/connector/forwardconnector/go.mod index 64d1fd2ccf3..a16315c3308 100644 --- a/connector/forwardconnector/go.mod +++ b/connector/forwardconnector/go.mod @@ -1,15 +1,15 @@ module go.opentelemetry.io/collector/connector/forwardconnector -go 1.21.0 +go 1.22.0 require ( github.com/stretchr/testify v1.9.0 - go.opentelemetry.io/collector/component v0.106.1 - go.opentelemetry.io/collector/confmap v0.106.1 - go.opentelemetry.io/collector/connector v0.106.1 - go.opentelemetry.io/collector/consumer v0.106.1 - go.opentelemetry.io/collector/consumer/consumertest v0.106.1 - go.opentelemetry.io/collector/pdata v1.12.0 + go.opentelemetry.io/collector/component v0.107.0 + go.opentelemetry.io/collector/confmap v0.107.0 + go.opentelemetry.io/collector/connector v0.107.0 + go.opentelemetry.io/collector/consumer v0.107.0 + go.opentelemetry.io/collector/consumer/consumertest v0.107.0 + go.opentelemetry.io/collector/pdata v1.13.0 go.uber.org/goleak v1.3.0 ) @@ -19,11 +19,11 @@ require ( github.com/davecgh/go-spew v1.1.1 // indirect github.com/go-logr/logr v1.4.2 // indirect github.com/go-logr/stdr v1.2.2 // indirect - github.com/go-viper/mapstructure/v2 v2.0.0 // indirect + github.com/go-viper/mapstructure/v2 v2.1.0 // indirect github.com/gogo/protobuf v1.3.2 // indirect github.com/google/uuid v1.6.0 // indirect - github.com/hashicorp/go-version v1.7.0 // indirect github.com/json-iterator/go v1.1.12 // indirect + github.com/klauspost/compress v1.17.9 // 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 @@ -33,17 +33,15 @@ require ( 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_golang v1.20.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.1 // indirect - go.opentelemetry.io/collector/component/componentprofiles v0.106.1 // indirect - go.opentelemetry.io/collector/config/configtelemetry v0.106.1 // indirect - go.opentelemetry.io/collector/consumer/consumerprofiles v0.106.1 // indirect - go.opentelemetry.io/collector/featuregate v1.12.0 // indirect - go.opentelemetry.io/collector/internal/globalgates v0.106.1 // indirect - go.opentelemetry.io/collector/pdata/pprofile v0.106.1 // indirect + go.opentelemetry.io/collector v0.107.0 // indirect + go.opentelemetry.io/collector/component/componentprofiles v0.107.0 // indirect + go.opentelemetry.io/collector/config/configtelemetry v0.107.0 // indirect + go.opentelemetry.io/collector/consumer/consumerprofiles v0.107.0 // indirect + go.opentelemetry.io/collector/pdata/pprofile v0.107.0 // 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 @@ -63,8 +61,6 @@ require ( replace go.opentelemetry.io/collector => ../../ -replace go.opentelemetry.io/collector/internal/globalgates => ../../internal/globalgates - replace go.opentelemetry.io/collector/component => ../../component replace go.opentelemetry.io/collector/connector => ../ @@ -93,3 +89,5 @@ replace go.opentelemetry.io/collector/consumer/consumerprofiles => ../../consume replace go.opentelemetry.io/collector/consumer/consumertest => ../../consumer/consumertest replace go.opentelemetry.io/collector/component/componentprofiles => ../../component/componentprofiles + +replace go.opentelemetry.io/collector/component/componentstatus => ../../component/componentstatus diff --git a/connector/forwardconnector/go.sum b/connector/forwardconnector/go.sum index 9f1ade0bfde..87196d45d6f 100644 --- a/connector/forwardconnector/go.sum +++ b/connector/forwardconnector/go.sum @@ -10,8 +10,8 @@ github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY= github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= -github.com/go-viper/mapstructure/v2 v2.0.0 h1:dhn8MZ1gZ0mzeodTG3jt5Vj/o87xZKuNAprG2mQfMfc= -github.com/go-viper/mapstructure/v2 v2.0.0/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM= +github.com/go-viper/mapstructure/v2 v2.1.0 h1:gHnMa2Y/pIxElCH2GlZZ1lZSsn6XMtufpGyP1XxdC/w= +github.com/go-viper/mapstructure/v2 v2.1.0/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= @@ -19,12 +19,12 @@ github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeN 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/klauspost/compress v1.17.9 h1:6KIumPrER1LHsvBVuDa0r5xaG0Es51mhhB9BQB2qeMA= +github.com/klauspost/compress v1.17.9/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw= 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= @@ -35,6 +35,8 @@ 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/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= +github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= 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= @@ -48,8 +50,8 @@ github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq 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_golang v1.20.1 h1:IMJXHOD6eARkQpxo8KkhgEVFlBNm+nkrFUyGlIu7Na8= +github.com/prometheus/client_golang v1.20.1/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= 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= diff --git a/connector/forwardconnector/internal/metadata/generated_status.go b/connector/forwardconnector/internal/metadata/generated_status.go index 25007e42e02..87699068c03 100644 --- a/connector/forwardconnector/internal/metadata/generated_status.go +++ b/connector/forwardconnector/internal/metadata/generated_status.go @@ -7,7 +7,8 @@ import ( ) var ( - Type = component.MustNewType("forward") + Type = component.MustNewType("forward") + ScopeName = "go.opentelemetry.io/collector/connector/forwardconnector" ) const ( diff --git a/connector/forwardconnector/metadata.yaml b/connector/forwardconnector/metadata.yaml index b3ea1d24c0a..5d7b4a813fd 100644 --- a/connector/forwardconnector/metadata.yaml +++ b/connector/forwardconnector/metadata.yaml @@ -1,4 +1,5 @@ type: forward +github_project: open-telemetry/opentelemetry-collector status: class: connector diff --git a/connector/go.mod b/connector/go.mod index 26fffbe72db..d77fae82cb1 100644 --- a/connector/go.mod +++ b/connector/go.mod @@ -1,18 +1,18 @@ module go.opentelemetry.io/collector/connector -go 1.21.0 +go 1.22.0 require ( github.com/google/uuid v1.6.0 github.com/stretchr/testify v1.9.0 - go.opentelemetry.io/collector v0.106.1 - go.opentelemetry.io/collector/component v0.106.1 - go.opentelemetry.io/collector/component/componentprofiles v0.106.1 - go.opentelemetry.io/collector/consumer v0.106.1 - go.opentelemetry.io/collector/consumer/consumerprofiles v0.106.1 - go.opentelemetry.io/collector/consumer/consumertest v0.106.1 - go.opentelemetry.io/collector/pdata v1.12.0 - go.opentelemetry.io/collector/pdata/testdata v0.106.1 + go.opentelemetry.io/collector v0.107.0 + go.opentelemetry.io/collector/component v0.107.0 + go.opentelemetry.io/collector/component/componentprofiles v0.107.0 + go.opentelemetry.io/collector/consumer v0.107.0 + go.opentelemetry.io/collector/consumer/consumerprofiles v0.107.0 + go.opentelemetry.io/collector/consumer/consumertest v0.107.0 + go.opentelemetry.io/collector/pdata v1.13.0 + go.opentelemetry.io/collector/pdata/testdata v0.107.0 go.uber.org/goleak v1.3.0 go.uber.org/multierr v1.11.0 go.uber.org/zap v1.27.0 @@ -26,16 +26,17 @@ require ( github.com/go-logr/stdr v1.2.2 // indirect github.com/gogo/protobuf v1.3.2 // indirect github.com/json-iterator/go v1.1.12 // indirect + github.com/klauspost/compress v1.17.9 // 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_golang v1.20.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/config/configtelemetry v0.106.1 // indirect - go.opentelemetry.io/collector/pdata/pprofile v0.106.1 // indirect + go.opentelemetry.io/collector/config/configtelemetry v0.107.0 // indirect + go.opentelemetry.io/collector/pdata/pprofile v0.107.0 // 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 @@ -69,10 +70,10 @@ replace go.opentelemetry.io/collector/pdata/testdata => ../pdata/testdata replace go.opentelemetry.io/collector/pdata/pprofile => ../pdata/pprofile -replace go.opentelemetry.io/collector/internal/globalgates => ../internal/globalgates - replace go.opentelemetry.io/collector/consumer/consumerprofiles => ../consumer/consumerprofiles replace go.opentelemetry.io/collector/consumer/consumertest => ../consumer/consumertest replace go.opentelemetry.io/collector/component/componentprofiles => ../component/componentprofiles + +replace go.opentelemetry.io/collector/component/componentstatus => ../component/componentstatus diff --git a/connector/go.sum b/connector/go.sum index a8a6b586c17..e8730e47884 100644 --- a/connector/go.sum +++ b/connector/go.sum @@ -21,10 +21,14 @@ github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnr 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/klauspost/compress v1.17.9 h1:6KIumPrER1LHsvBVuDa0r5xaG0Es51mhhB9BQB2qeMA= +github.com/klauspost/compress v1.17.9/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw= 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/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= +github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= 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= @@ -34,8 +38,8 @@ github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq 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_golang v1.20.1 h1:IMJXHOD6eARkQpxo8KkhgEVFlBNm+nkrFUyGlIu7Na8= +github.com/prometheus/client_golang v1.20.1/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= 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= diff --git a/consumer/consumerprofiles/go.mod b/consumer/consumerprofiles/go.mod index 2052b2b3d5f..4791b42dd5b 100644 --- a/consumer/consumerprofiles/go.mod +++ b/consumer/consumerprofiles/go.mod @@ -1,6 +1,6 @@ module go.opentelemetry.io/collector/consumer/consumerprofiles -go 1.21.0 +go 1.22.0 replace go.opentelemetry.io/collector/pdata => ../../pdata @@ -10,8 +10,8 @@ replace go.opentelemetry.io/collector/consumer => ../ require ( github.com/stretchr/testify v1.9.0 - go.opentelemetry.io/collector/consumer v0.106.1 - go.opentelemetry.io/collector/pdata/pprofile v0.106.1 + go.opentelemetry.io/collector/consumer v0.107.0 + go.opentelemetry.io/collector/pdata/pprofile v0.107.0 ) require ( @@ -21,7 +21,7 @@ require ( github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/collector/pdata v1.12.0 // indirect + go.opentelemetry.io/collector/pdata v1.13.0 // indirect go.uber.org/multierr v1.11.0 // indirect golang.org/x/net v0.25.0 // indirect golang.org/x/sys v0.20.0 // indirect diff --git a/consumer/consumertest/go.mod b/consumer/consumertest/go.mod index e64e306c6be..a2ff56b05f4 100644 --- a/consumer/consumertest/go.mod +++ b/consumer/consumertest/go.mod @@ -1,16 +1,16 @@ module go.opentelemetry.io/collector/consumer/consumertest -go 1.21.0 +go 1.22.0 replace go.opentelemetry.io/collector/consumer => ../ require ( github.com/stretchr/testify v1.9.0 - go.opentelemetry.io/collector/consumer v0.106.1 - go.opentelemetry.io/collector/consumer/consumerprofiles v0.106.1 - go.opentelemetry.io/collector/pdata v1.12.0 - go.opentelemetry.io/collector/pdata/pprofile v0.106.1 - go.opentelemetry.io/collector/pdata/testdata v0.106.1 + go.opentelemetry.io/collector/consumer v0.107.0 + go.opentelemetry.io/collector/consumer/consumerprofiles v0.107.0 + go.opentelemetry.io/collector/pdata v1.13.0 + go.opentelemetry.io/collector/pdata/pprofile v0.107.0 + go.opentelemetry.io/collector/pdata/testdata v0.107.0 go.uber.org/goleak v1.3.0 ) diff --git a/consumer/go.mod b/consumer/go.mod index 24056beea87..d4640a781de 100644 --- a/consumer/go.mod +++ b/consumer/go.mod @@ -1,11 +1,11 @@ module go.opentelemetry.io/collector/consumer -go 1.21.0 +go 1.22.0 require ( github.com/stretchr/testify v1.9.0 - go.opentelemetry.io/collector/pdata v1.12.0 - go.opentelemetry.io/collector/pdata/testdata v0.106.1 + go.opentelemetry.io/collector/pdata v1.13.0 + go.opentelemetry.io/collector/pdata/testdata v0.107.0 go.uber.org/goleak v1.3.0 ) @@ -16,7 +16,7 @@ require ( github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/collector/pdata/pprofile v0.106.1 // indirect + go.opentelemetry.io/collector/pdata/pprofile v0.107.0 // indirect go.uber.org/multierr v1.11.0 // indirect golang.org/x/net v0.25.0 // indirect golang.org/x/sys v0.20.0 // indirect diff --git a/docs/observability.md b/docs/observability.md index 2086647fdcc..af249e2cf65 100644 --- a/docs/observability.md +++ b/docs/observability.md @@ -12,6 +12,101 @@ If you need to troubleshoot the Collector, see [Troubleshooting]. Read on to learn about experimental features and the project's overall vision for internal telemetry. + + +- [Goals of internal telemetry](#goals-of-internal-telemetry) + * [Observable elements](#observable-elements) + * [Impact](#impact) + * [Configurable level of observability](#configurable-level-of-observability) + * [Internal telemetry properties](#internal-telemetry-properties) + + [Units](#units) + + [Process for defining new metrics](#process-for-defining-new-metrics) +- [Experimental trace telemetry](#experimental-trace-telemetry) + + + +## Goals of internal telemetry + +The Collector's internal telemetry is an important part of fulfilling +OpenTelemetry's [project vision](vision.md). The following section explains the +priorities for making the Collector an observable service. + +### Observable elements + +The following aspects of the Collector need to be observable. + +- [Current values] + - Some of the current values and rates might be calculated as derivatives of + cumulative values in the backend, so it's an open question whether to expose + them separately or not. +- [Cumulative values] +- [Trace or log events] + - For start or stop events, an appropriate hysteresis must be defined to avoid + generating too many events. Note that start and stop events can't be + detected in the backend simply as derivatives of current rates. The events + include additional data that is not present in the current value. +- [Host metrics] + - Host metrics can help users determine if the observed problem in a service + is caused by a different process on the same host. + +### Impact + +The impact of these observability improvements on the core performance of the +Collector must be assessed. + +### Configurable level of observability + +Some metrics and traces can be high volume and users might not always want to +observe them. An observability verbosity “level” allows configuration of the +Collector to send more or less observability data or with even finer +granularity, to allow turning on or off specific metrics. + +The default level of observability must be defined in a way that has +insignificant performance impact on the service. + +### Internal telemetry properties + +Telemetry produced by the Collector has the following properties: + +- metrics produced by Collector components use the prefix `otelcol_` +- metrics produced by any instrumentation library used by Collector components will *not* be prefixed with `otelcol_` +- code is instrumented using the OpenTelemetry API for metrics, and traces. Logs are instrumented using zap. Telemetry is collected and produced via the OpenTelemetry Go SDK +- instrumentation scope defaults to the package name of the component recording telemetry. It can be configured + via the `scope_name` option in mdatagen, but the recommendation is to keep the default +- metrics are defined via `metadata.yaml` except in components that have specific cases where + it is not possible to do so. See the [issue](https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/33523) + which list such components +- whenever possible, components should leverage core components or helper libraries to capture + telemetry, ensuring that all components of the Collector can be consistently observed +- telemetry produced by components should include attributes that identify specific instances + of the components + +#### Units + +The following units should be used for metrics emitted by the Collector +for the purpose of its internal telemetry: + +| Field type | Unit | +| -------------------------------------------------------------------------- | -------------- | +| Metric counting the number of log records received, processed, or exported | `{records}` | +| Metric counting the number of spans received, processed, or exported | `{spans}` | +| Metric counting the number of data points received, processed, or exported | `{datapoints}` | + +#### Process for defining new metrics + +Metrics in the Collector are defined via `metadata.yaml`, which is used by [mdatagen] to +produce: + +- code to create metric instruments that can be used by components +- documentation for internal metrics +- a consistent prefix for all internal metrics +- convenience accessors for meter and tracer +- a consistent instrumentation scope for components +- test methods for validating the telemetry + +The process to generate new metrics is to configure them via +`metadata.yaml`, and run `go generate` on the component. + ## Experimental trace telemetry The Collector does not expose traces by default, but an effort is underway to @@ -73,45 +168,6 @@ service: endpoint: ${MY_POD_IP}:4317 ``` -## Goals of internal telemetry - -The Collector's internal telemetry is an important part of fulfilling -OpenTelemetry's [project vision](vision.md). The following section explains the -priorities for making the Collector an observable service. - -### Observable elements - -The following aspects of the Collector need to be observable. - -- [Current values] - - Some of the current values and rates might be calculated as derivatives of - cumulative values in the backend, so it's an open question whether to expose - them separately or not. -- [Cumulative values] -- [Trace or log events] - - For start or stop events, an appropriate hysteresis must be defined to avoid - generating too many events. Note that start and stop events can't be - detected in the backend simply as derivatives of current rates. The events - include additional data that is not present in the current value. -- [Host metrics] - - Host metrics can help users determine if the observed problem in a service - is caused by a different process on the same host. - -### Impact - -The impact of these observability improvements on the core performance of the -Collector must be assessed. - -### Configurable level of observability - -Some metrics and traces can be high volume and users might not always want to -observe them. An observability verboseness “level” allows configuration of the -Collector to send more or less observability data or with even finer -granularity, to allow turning on or off specific metrics. - -The default level of observability must be defined in a way that has -insignificant performance impact on the service. - [Internal telemetry]: https://opentelemetry.io/docs/collector/internal-telemetry/ [Troubleshooting]: https://opentelemetry.io/docs/collector/troubleshooting/ @@ -132,3 +188,5 @@ insignificant performance impact on the service. https://opentelemetry.io/docs/collector/internal-telemetry/#events-observable-with-internal-logs [Host metrics]: https://opentelemetry.io/docs/collector/internal-telemetry/#lists-of-internal-metrics +[mdatagen]: + https://github.com/open-telemetry/opentelemetry-collector/tree/main/cmd/mdatagen \ No newline at end of file diff --git a/docs/release.md b/docs/release.md index 38dad9e75cb..9057f06d1c1 100644 --- a/docs/release.md +++ b/docs/release.md @@ -46,9 +46,7 @@ It is possible that a core approver isn't a contrib approver. In that case, the If you set your remote using `https` you need to include `REMOTE=https://github.com/open-telemetry/opentelemetry-collector.git` in each command. Wait for the new tag build to pass successfully. -6. The release script for the collector builder should create a new GitHub release for the builder. This is a separate release from the core, but we might join them in the future if it makes sense. - -7. A new `v0.85.0` release should be automatically created on Github by now. Edit it and use the contents from the CHANGELOG.md and CHANGELOG-API.md as the release's description. +6. A new `v0.85.0` source code release should be automatically created on Github by now. Edit it and use the contents from the CHANGELOG.md and CHANGELOG-API.md as the release's description. ## Releasing opentelemetry-collector-contrib @@ -74,10 +72,9 @@ It is possible that a core approver isn't a contrib approver. In that case, the 5. A new `v0.85.0` release should be automatically created on Github by now. Edit it and use the contents from the CHANGELOG.md as the release's description. ## Producing the artifacts - The last step of the release process creates artifacts for the new version of the collector and publishes images to Dockerhub. The steps in this portion of the release are done in the [opentelemetry-collector-releases](https://github.com/open-telemetry/opentelemetry-collector-releases) repo. -1. Update the `./distribution/**/manifest.yaml` files to include the new release version. +1. Update the `./distributions/**/manifest.yaml` files to include the new release version. 2. Update the builder version in `OTELCOL_BUILDER_VERSION` to the new release in the `Makefile`. While this might not be strictly necessary for every release, this is a good practice. @@ -86,12 +83,14 @@ The last step of the release process creates artifacts for the new version of th 4. Check out the commit created by merging the PR and tag with the new release version by running the `make push-tags TAG=v0.85.0` command. If you set your remote using `https` you need to include `REMOTE=https://github.com/open-telemetry/opentelemetry-collector-releases.git` in each command. Wait for the new tag build to pass successfully. -5. Ensure the "Release Core", "Release Contrib" and "Release k8s" actions pass, this will +5. Ensure the "Release Core", "Release Contrib", "Release k8s", and "Builder - Release" actions pass, this will 1. push new container images to `https://hub.docker.com/repository/docker/otel/opentelemetry-collector`, `https://hub.docker.com/repository/docker/otel/opentelemetry-collector-contrib` and `https://hub.docker.com/repository/docker/otel/opentelemetry-collector-k8s` 2. create a Github release for the tag and push all the build artifacts to the Github release. See [example](https://github.com/open-telemetry/opentelemetry-collector-releases/actions/workflows/release-core.yaml). + 3. build and release ocb binaries under a separate tagged Github release, e.g. `cmd/builder/v0.85.0` + ## Troubleshooting 1. `unknown revision internal/coreinternal/v0.85.0` -- This is typically an indication that there's a dependency on a new module. You can fix it by adding a new `replaces` entry to the `go.mod` for the affected module. diff --git a/docs/rfcs/component-status-reporting.md b/docs/rfcs/component-status-reporting.md new file mode 100644 index 00000000000..9dd243c5f1e --- /dev/null +++ b/docs/rfcs/component-status-reporting.md @@ -0,0 +1,119 @@ +# Component Status Reporting + +## Overview + +Since the OpenTelemetry Collector is made up of pipelines with components, it needs a way for the components within those pipelines to emit information about their health. This information allows the collector service, or other interested software or people, to make decisions about how to proceed when something goes wrong. This document describes: + +1. The historical state of how components reported health +2. The current state of how components report health +3. The goals component health reporting should achieve +4. Existing deviations from those goals +5. Desired behavior for 1.0 + +For context throughout this document, component defines a `component.Host` interface, which components may use to interact with the struct that is managing all the collector pipelines and the components. In this repository, our implementation of `component.Host` can be found in `service/internal/graph.Host`. + +## Out Of Scope + +How to get from the current to desired behavior is also considered out of scope and will be discussed on individual PRs. It will likely involve one or multiple feature gates, warnings and transition periods. + +## The Collector’s Historical method of reporting component health +Until recently, the Collector relied on four ways to report health. + +1. The `error` returned by the Component’s Start method. During startup, if any component decided to return an error, the Collector would stop gracefully. +2. The `component.Host.ReportFatalError` method. This method let components tell the `component.Host` that something bad happened and the collector needed to shut down. While this method could be used anywhere in the component, it was primarily used with a Component’s Start method to report errors in async work, such as starting a server. + ```golang + if errHTTP := fmr.server.Serve(listener); errHTTP != nil && !errors.Is(errHTTP, http.ErrServerClosed) { + host.ReportFatalError(errHTTP) + } + ``` +3. The error returned by `Shutdown`. This error was indicative that the collector did not cleanly shut down, but did not prevent the shutdown process from moving forward. + +4. Panicking. During runtime, if the collector experienced an unhandled error, it crashes. + +These are all the way the components in a collector could report that they were unhealthy. + +There are several major gaps in the Collector’s historic reporting of component health. First, many components return recoverable errors from Start, causing the collector to shutdown, while it could recover if the collector was allowed to run. Second, when a component experienced a transient error, such as an endpoint suddenly not working, the component would simply log the error and return it up the pipeline. There was no mechanism for the component to tell the `component.Host` or anything else that something was going wrong. Last, when a component experienced an issue it would never be able to recover from, such as receiving a 404 response from an endpoint, the component would log the error and return it up the pipeline. This situation was handled in the same way as the transient error, which means the component could not tell the `component.Host` or anything else that something was wrong, but worse is that the issue would never get better. + +## Current State of Component Health Reporting + +See [Component Status Reporting](../component-status.md) + +## The Goals the Component Health Reporting Should Achieve + +The following are the goals, as of June 2024 and with Collector 1.0 looming, for a component health reporting system. + +1. A `component.Host` implementation, such as `service/internal/graph.Host`, may report statuses Starting, Ok, Stopping and PermanentError on behalf of components. + - Additional status may be reported in the future +2. Components may opt-in to reporting health status at runtime. Components must not be required to report health statuses themselves. + - The consumers of the health reporting system must be able to identify which components are and are not opting to report their own statuses. +3. Component health reporting must be opt-in for collector users. While the underlying components are always allowed to report their health via the system, the `component.Host` implementation, such as `service/internal/graph.Host`, or any other listener may only take action when the user has configured the collector accordingly. + - As one example of compliance, the current health reporting system is dependent on the user configuring an extension that can watch for status updates. +4. Component health must be representable as a finite state machine with clear transitions between states. +5. Component health reporting must only be a mechanism for reporting health - it should have no mechanisms for taking actions on the health it reports. How consumers of the health reporting system respond to component updates is not a concern of the health reporting system. + +## Existing deviations from those goals + +### Fatal Error Reporting + +Before the current implementation of component status reporting, a component could stop the collector by using `component.Host.ReportFatalError`. Now, a component MUST use component status reporting and emit a `FatalError`. This fact is in conflict with Goal 1, which states component health reporting must be opt-in for components. + +A couple solutions: +1. Accept this reality as an exception to Goal 2. +2. Add back `component.Host.ReportFatalError`. +3. Remove the ability for components to stop the collector be removing `FatalError`. + +### No way to identify components that are not reporting status +Goal 2 states that consumers of component status reporting must be able to identify components in use that have not opted in to component status reporting. Our current implementation does not have this feature. + +### Should component health reporting be an opt-in for `component.Host` implementations? + +The current implementation of component status reporting does not add anything to `component.Host` to force a `component.Host` implementation, such as `service/internal/graph.Host`, to be compatible with component status reporting. Instead, it adds `ReportStatus func(*StatusEvent)` to `component.TelemetrySettings` and things that instantiate components, such as `service/internal/graph.Host`, should, but are not required, to pass in a value for `ReportStatus`. + +As a result, `component.Host` implementation is not required to engage with the component status reporting system. This could lead to situations where a user adds a status watcher extension that can do nothing because the `component.Host` is not reporting component status updates. + +Is this acceptable? Should we: +1. Require the `component.Host` implementations be compatible with the component status reporting framework? +2. Add some sort of configuration/build flag then enforces the `component.Host` implementation be compatible (or not) with component status reporting? +3. Accept this edge case. + +### Component TelemetrySettings Requirements + +The current implementation of component status reporting added a new field to `component.TelemetrySettings`, `ReportStatus`. This field is technically optional, but would be marked as stable with component 1.0. Are we ok with 1 of the following? + +1. Including a component status reporting feature, `component.TelemetrySettings.ReportStatus`, in the 1.0 version of `component.TelemetrySettings`? +2. Marking `component.TelemetrySettings.ReportStatus` as experimentatal via godoc comments in the 1.0 version of `component.TelemetrySettings`? + +Or should we refactor `component` somehow to remove `ReportStatus` from `component.TelemetrySettings`? + +## Desired Behavior for 1.0 + +For each listed deviation, the solution for unblocking component 1.0 is: + +- `Fatal Error Reporting` :white_check_mark:: The `component` module provides no mechanism for a component to stop a collector after it has started. It is expected that an error returned from `Start` will terminate a starting Collector, but it is ultimately up to the caller of `Start` how to handle the returned error. A `component.Host` implementation may choose to provide a mechanism to stop a running collector via a different Interface, but doing so is not required. + - As part of this stance, we agree that the `component.Component.Start` method will continue returning an error. +- `No way to identify components that are not reporting status` :white_check_mark:: This can be implemented as a feature addition to component status reporting without blocking `component` 1.0 +- `Should component health reporting be an opt-in for component.Host implementations?` :white_check_mark:: Yes. A `component.Host` implementation is not required to provide a component status reporting feature. They may do so via an additional interface, such as `componentstatus.Reporter`. +- `Component TelemetrySettings Requirements` :white_check_mark:: `component.TelemetrySettings.ReportStatus` has been removed. Instead, component status reporting is expected to be provided via an additional interface that `component.Host` implements. Components can check if the `component.Host` implements the desired interface, such as `componentstatus.Reporter` to access component status reporting features. + + +## Reference +- Remove FatalError? Looking for opinions either way: https://github.com/open-telemetry/opentelemetry-collector/issues/9823 +- In order to prioritize lifecycle events over runtime events for status reporting, allow a component to transition from PermanentError -> Stopping: https://github.com/open-telemetry/opentelemetry-collector/issues/10058 +- Runtime status reporting for components in core: https://github.com/open-telemetry/opentelemetry-collector/issues/9957 +- Should Start return an error: https://github.com/open-telemetry/opentelemetry-collector/issues/9324 +- Should Shutdown return an error: https://github.com/open-telemetry/opentelemetry-collector/issues/9325 +- Status reporting doc incoming; preview here: https://github.com/mwear/opentelemetry-collector/blob/cc870fd2a7160da298acdda447511ea9a83455e0/docs/component-status.md +- Issues + - Closed: https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/8349 + - Open: https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/8816 +- Status Reporting PRs + - Closed + - https://github.com/open-telemetry/opentelemetry-collector/pull/5304 + - https://github.com/open-telemetry/opentelemetry-collector/pull/6550 + - https://github.com/open-telemetry/opentelemetry-collector/pull/6560 + - Merged + - https://github.com/open-telemetry/opentelemetry-collector/pull/8169 + + + + diff --git a/exporter/builder.go b/exporter/builder.go index f35359c7650..daba3ac5fe1 100644 --- a/exporter/builder.go +++ b/exporter/builder.go @@ -13,12 +13,18 @@ import ( ) // Builder exporter is a helper struct that given a set of Configs and Factories helps with creating exporters. +// +// Deprecated: [v0.108.0] this builder is being internalized within the service module, +// and will be removed soon. type Builder struct { cfgs map[component.ID]component.Config factories map[component.Type]Factory } // NewBuilder creates a new exporter.Builder to help with creating components form a set of configs and factories. +// +// Deprecated: [v0.108.0] this builder is being internalized within the service module, +// and will be removed soon. func NewBuilder(cfgs map[component.ID]component.Config, factories map[component.Type]Factory) *Builder { return &Builder{cfgs: cfgs, factories: factories} } diff --git a/exporter/debugexporter/README.md b/exporter/debugexporter/README.md index 57237c76972..9b581eea46f 100644 --- a/exporter/debugexporter/README.md +++ b/exporter/debugexporter/README.md @@ -6,7 +6,7 @@ | Stability | [development]: traces, metrics, logs | | Distributions | [core], [contrib], [k8s] | | Warnings | [Unstable Output Format](#warnings) | -| Issues | [![Open issues](https://img.shields.io/github/issues-search/open-telemetry/opentelemetry-collector-contrib?query=is%3Aissue%20is%3Aopen%20label%3Aexporter%2Fdebug%20&label=open&color=orange&logo=opentelemetry)](https://github.com/open-telemetry/opentelemetry-collector-contrib/issues?q=is%3Aopen+is%3Aissue+label%3Aexporter%2Fdebug) [![Closed issues](https://img.shields.io/github/issues-search/open-telemetry/opentelemetry-collector-contrib?query=is%3Aissue%20is%3Aclosed%20label%3Aexporter%2Fdebug%20&label=closed&color=blue&logo=opentelemetry)](https://github.com/open-telemetry/opentelemetry-collector-contrib/issues?q=is%3Aclosed+is%3Aissue+label%3Aexporter%2Fdebug) | +| Issues | [![Open issues](https://img.shields.io/github/issues-search/open-telemetry/opentelemetry-collector?query=is%3Aissue%20is%3Aopen%20label%3Aexporter%2Fdebug%20&label=open&color=orange&logo=opentelemetry)](https://github.com/open-telemetry/opentelemetry-collector/issues?q=is%3Aopen+is%3Aissue+label%3Aexporter%2Fdebug) [![Closed issues](https://img.shields.io/github/issues-search/open-telemetry/opentelemetry-collector?query=is%3Aissue%20is%3Aclosed%20label%3Aexporter%2Fdebug%20&label=closed&color=blue&logo=opentelemetry)](https://github.com/open-telemetry/opentelemetry-collector/issues?q=is%3Aclosed+is%3Aissue+label%3Aexporter%2Fdebug) | [development]: https://github.com/open-telemetry/opentelemetry-collector#development [core]: https://github.com/open-telemetry/opentelemetry-collector-releases/tree/main/distributions/otelcol diff --git a/exporter/debugexporter/go.mod b/exporter/debugexporter/go.mod index 58a19af50a9..ed8999b3acb 100644 --- a/exporter/debugexporter/go.mod +++ b/exporter/debugexporter/go.mod @@ -1,16 +1,16 @@ module go.opentelemetry.io/collector/exporter/debugexporter -go 1.21.0 +go 1.22.0 require ( github.com/stretchr/testify v1.9.0 - go.opentelemetry.io/collector/component v0.106.1 - go.opentelemetry.io/collector/config/configtelemetry v0.106.1 - go.opentelemetry.io/collector/confmap v0.106.1 - go.opentelemetry.io/collector/consumer v0.106.1 - go.opentelemetry.io/collector/exporter v0.106.1 - go.opentelemetry.io/collector/pdata v1.12.0 - go.opentelemetry.io/collector/pdata/testdata v0.106.1 + go.opentelemetry.io/collector/component v0.107.0 + go.opentelemetry.io/collector/config/configtelemetry v0.107.0 + go.opentelemetry.io/collector/confmap v0.107.0 + go.opentelemetry.io/collector/consumer v0.107.0 + go.opentelemetry.io/collector/exporter v0.107.0 + go.opentelemetry.io/collector/pdata v1.13.0 + go.opentelemetry.io/collector/pdata/testdata v0.107.0 go.uber.org/goleak v1.3.0 go.uber.org/zap v1.27.0 ) @@ -22,11 +22,11 @@ require ( github.com/davecgh/go-spew v1.1.1 // indirect github.com/go-logr/logr v1.4.2 // indirect github.com/go-logr/stdr v1.2.2 // indirect - github.com/go-viper/mapstructure/v2 v2.0.0 // indirect + github.com/go-viper/mapstructure/v2 v2.1.0 // indirect github.com/gogo/protobuf v1.3.2 // indirect github.com/google/uuid v1.6.0 // indirect - github.com/hashicorp/go-version v1.7.0 // indirect github.com/json-iterator/go v1.1.12 // indirect + github.com/klauspost/compress v1.17.9 // 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 @@ -36,19 +36,17 @@ require ( 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_golang v1.20.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.1 // indirect - go.opentelemetry.io/collector/config/configretry v1.12.0 // indirect - go.opentelemetry.io/collector/consumer/consumerprofiles v0.106.1 // indirect - go.opentelemetry.io/collector/consumer/consumertest v0.106.1 // indirect - go.opentelemetry.io/collector/extension v0.106.1 // indirect - go.opentelemetry.io/collector/featuregate v1.12.0 // indirect - go.opentelemetry.io/collector/internal/globalgates v0.106.1 // indirect - go.opentelemetry.io/collector/pdata/pprofile v0.106.1 // indirect - go.opentelemetry.io/collector/receiver v0.106.1 // indirect + go.opentelemetry.io/collector v0.107.0 // indirect + go.opentelemetry.io/collector/config/configretry v1.13.0 // indirect + go.opentelemetry.io/collector/consumer/consumerprofiles v0.107.0 // indirect + go.opentelemetry.io/collector/consumer/consumertest v0.107.0 // indirect + go.opentelemetry.io/collector/extension v0.107.0 // indirect + go.opentelemetry.io/collector/pdata/pprofile v0.107.0 // indirect + go.opentelemetry.io/collector/receiver v0.107.0 // 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 @@ -57,7 +55,7 @@ require ( 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.23.0 // indirect + golang.org/x/sys v0.24.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 @@ -67,8 +65,6 @@ require ( replace go.opentelemetry.io/collector => ../../ -replace go.opentelemetry.io/collector/internal/globalgates => ../../internal/globalgates - replace go.opentelemetry.io/collector/component => ../../component replace go.opentelemetry.io/collector/confmap => ../../confmap @@ -96,3 +92,5 @@ replace go.opentelemetry.io/collector/config/configretry => ../../config/configr replace go.opentelemetry.io/collector/consumer/consumerprofiles => ../../consumer/consumerprofiles replace go.opentelemetry.io/collector/consumer/consumertest => ../../consumer/consumertest + +replace go.opentelemetry.io/collector/component/componentstatus => ../../component/componentstatus diff --git a/exporter/debugexporter/go.sum b/exporter/debugexporter/go.sum index 501dc8aa362..4e0b4f2dea6 100644 --- a/exporter/debugexporter/go.sum +++ b/exporter/debugexporter/go.sum @@ -12,8 +12,8 @@ github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY= github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= -github.com/go-viper/mapstructure/v2 v2.0.0 h1:dhn8MZ1gZ0mzeodTG3jt5Vj/o87xZKuNAprG2mQfMfc= -github.com/go-viper/mapstructure/v2 v2.0.0/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM= +github.com/go-viper/mapstructure/v2 v2.1.0 h1:gHnMa2Y/pIxElCH2GlZZ1lZSsn6XMtufpGyP1XxdC/w= +github.com/go-viper/mapstructure/v2 v2.1.0/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= @@ -21,12 +21,12 @@ github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeN 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/klauspost/compress v1.17.9 h1:6KIumPrER1LHsvBVuDa0r5xaG0Es51mhhB9BQB2qeMA= +github.com/klauspost/compress v1.17.9/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw= 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= @@ -37,6 +37,8 @@ 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/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= +github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= 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= @@ -50,8 +52,8 @@ github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq 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_golang v1.20.1 h1:IMJXHOD6eARkQpxo8KkhgEVFlBNm+nkrFUyGlIu7Na8= +github.com/prometheus/client_golang v1.20.1/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= 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= @@ -101,8 +103,8 @@ golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJ 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.23.0 h1:YfKFowiIMvtgl1UERQoTPPToxltDeZfbj4H7dVUCwmM= -golang.org/x/sys v0.23.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.24.0 h1:Twjiwq9dn6R1fQcyiK+wQyHWfaz/BJB+YIpzU/Cv3Xg= +golang.org/x/sys v0.24.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= diff --git a/exporter/debugexporter/internal/metadata/generated_status.go b/exporter/debugexporter/internal/metadata/generated_status.go index 608b23c1536..b4588f75200 100644 --- a/exporter/debugexporter/internal/metadata/generated_status.go +++ b/exporter/debugexporter/internal/metadata/generated_status.go @@ -7,7 +7,8 @@ import ( ) var ( - Type = component.MustNewType("debug") + Type = component.MustNewType("debug") + ScopeName = "go.opentelemetry.io/collector/exporter/debugexporter" ) const ( diff --git a/exporter/debugexporter/metadata.yaml b/exporter/debugexporter/metadata.yaml index 2c9f9093c4d..2d927eff8dc 100644 --- a/exporter/debugexporter/metadata.yaml +++ b/exporter/debugexporter/metadata.yaml @@ -1,4 +1,5 @@ type: debug +github_project: open-telemetry/opentelemetry-collector status: class: exporter diff --git a/exporter/exporterhelper/generated_component_telemetry_test.go b/exporter/exporterhelper/generated_component_telemetry_test.go index f80e23147a7..238d62f6356 100644 --- a/exporter/exporterhelper/generated_component_telemetry_test.go +++ b/exporter/exporterhelper/generated_component_telemetry_test.go @@ -7,11 +7,13 @@ import ( "testing" "github.com/stretchr/testify/require" + "go.opentelemetry.io/otel/metric" sdkmetric "go.opentelemetry.io/otel/sdk/metric" "go.opentelemetry.io/otel/sdk/metric/metricdata" "go.opentelemetry.io/otel/sdk/metric/metricdata/metricdatatest" "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/config/configtelemetry" "go.opentelemetry.io/collector/exporter" "go.opentelemetry.io/collector/exporter/exportertest" ) @@ -24,6 +26,9 @@ type componentTestTelemetry struct { func (tt *componentTestTelemetry) NewSettings() exporter.Settings { settings := exportertest.NewNopSettings() settings.MeterProvider = tt.meterProvider + settings.LeveledMeterProvider = func(_ configtelemetry.Level) metric.MeterProvider { + return tt.meterProvider + } settings.ID = component.NewID(component.MustNewType("exporterhelper")) return settings diff --git a/exporter/exporterhelper/internal/metadata/generated_telemetry.go b/exporter/exporterhelper/internal/metadata/generated_telemetry.go index d0b27bf441b..7155f256b58 100644 --- a/exporter/exporterhelper/internal/metadata/generated_telemetry.go +++ b/exporter/exporterhelper/internal/metadata/generated_telemetry.go @@ -14,10 +14,15 @@ import ( "go.opentelemetry.io/collector/config/configtelemetry" ) +// Deprecated: [v0.108.0] use LeveledMeter instead. func Meter(settings component.TelemetrySettings) metric.Meter { return settings.MeterProvider.Meter("go.opentelemetry.io/collector/exporter/exporterhelper") } +func LeveledMeter(settings component.TelemetrySettings, level configtelemetry.Level) metric.Meter { + return settings.LeveledMeterProvider(level).Meter("go.opentelemetry.io/collector/exporter/exporterhelper") +} + func Tracer(settings component.TelemetrySettings) trace.Tracer { return settings.TracerProvider.Tracer("go.opentelemetry.io/collector/exporter/exporterhelper") } diff --git a/exporter/exporterhelper/internal/metadata/generated_telemetry_test.go b/exporter/exporterhelper/internal/metadata/generated_telemetry_test.go index 34ce1d281f5..ad1906945a4 100644 --- a/exporter/exporterhelper/internal/metadata/generated_telemetry_test.go +++ b/exporter/exporterhelper/internal/metadata/generated_telemetry_test.go @@ -14,6 +14,7 @@ import ( nooptrace "go.opentelemetry.io/otel/trace/noop" "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/config/configtelemetry" ) type mockMeter struct { @@ -43,6 +44,9 @@ func (m mockTracerProvider) Tracer(name string, opts ...trace.TracerOption) trac func TestProviders(t *testing.T) { set := component.TelemetrySettings{ + LeveledMeterProvider: func(_ configtelemetry.Level) metric.MeterProvider { + return mockMeterProvider{} + }, MeterProvider: mockMeterProvider{}, TracerProvider: mockTracerProvider{}, } @@ -64,6 +68,9 @@ func TestProviders(t *testing.T) { func TestNewTelemetryBuilder(t *testing.T) { set := component.TelemetrySettings{ + LeveledMeterProvider: func(_ configtelemetry.Level) metric.MeterProvider { + return mockMeterProvider{} + }, MeterProvider: mockMeterProvider{}, TracerProvider: mockTracerProvider{}, } diff --git a/exporter/exporterhelper/metadata.yaml b/exporter/exporterhelper/metadata.yaml index e10113eb494..9156cb95c80 100644 --- a/exporter/exporterhelper/metadata.yaml +++ b/exporter/exporterhelper/metadata.yaml @@ -1,4 +1,5 @@ type: exporterhelper +github_project: open-telemetry/opentelemetry-collector status: class: exporter diff --git a/exporter/exporterprofiles/go.mod b/exporter/exporterprofiles/go.mod index 11ba7ab969f..020d8511642 100644 --- a/exporter/exporterprofiles/go.mod +++ b/exporter/exporterprofiles/go.mod @@ -1,12 +1,12 @@ module go.opentelemetry.io/collector/exporter/exporterprofiles -go 1.21.0 +go 1.22.0 require ( github.com/stretchr/testify v1.9.0 - go.opentelemetry.io/collector/component v0.106.1 - go.opentelemetry.io/collector/consumer/consumertest v0.106.1 - go.opentelemetry.io/collector/exporter v0.106.1 + go.opentelemetry.io/collector/component v0.107.0 + go.opentelemetry.io/collector/consumer/consumertest v0.107.0 + go.opentelemetry.io/collector/exporter v0.107.0 ) require ( @@ -16,18 +16,18 @@ require ( github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/collector/config/configtelemetry v0.106.1 // indirect - go.opentelemetry.io/collector/consumer v0.106.1 // indirect - go.opentelemetry.io/collector/consumer/consumerprofiles v0.106.1 // indirect - go.opentelemetry.io/collector/pdata v1.12.0 // indirect - go.opentelemetry.io/collector/pdata/pprofile v0.106.1 // indirect + go.opentelemetry.io/collector/config/configtelemetry v0.107.0 // indirect + go.opentelemetry.io/collector/consumer v0.107.0 // indirect + go.opentelemetry.io/collector/consumer/consumerprofiles v0.107.0 // indirect + go.opentelemetry.io/collector/pdata v1.13.0 // indirect + go.opentelemetry.io/collector/pdata/pprofile v0.107.0 // indirect go.opentelemetry.io/otel v1.28.0 // indirect go.opentelemetry.io/otel/metric v1.28.0 // indirect go.opentelemetry.io/otel/trace v1.28.0 // indirect go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.27.0 // indirect golang.org/x/net v0.26.0 // indirect - golang.org/x/sys v0.23.0 // indirect + golang.org/x/sys v0.24.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 @@ -37,8 +37,6 @@ require ( replace go.opentelemetry.io/collector/consumer/consumerprofiles => ../../consumer/consumerprofiles -replace go.opentelemetry.io/collector/internal/globalgates => ../../internal/globalgates - replace go.opentelemetry.io/collector/extension => ../../extension replace go.opentelemetry.io/collector => ../.. @@ -66,3 +64,5 @@ replace go.opentelemetry.io/collector/consumer/consumertest => ../../consumer/co replace go.opentelemetry.io/collector/consumer => ../../consumer replace go.opentelemetry.io/collector/exporter => ../ + +replace go.opentelemetry.io/collector/component/componentstatus => ../../component/componentstatus diff --git a/exporter/exporterprofiles/go.sum b/exporter/exporterprofiles/go.sum index eea56416a5f..5bb499278f4 100644 --- a/exporter/exporterprofiles/go.sum +++ b/exporter/exporterprofiles/go.sum @@ -20,6 +20,8 @@ github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnr 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/klauspost/compress v1.17.9 h1:6KIumPrER1LHsvBVuDa0r5xaG0Es51mhhB9BQB2qeMA= +github.com/klauspost/compress v1.17.9/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw= 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= @@ -33,8 +35,8 @@ github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq 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_golang v1.20.1 h1:IMJXHOD6eARkQpxo8KkhgEVFlBNm+nkrFUyGlIu7Na8= +github.com/prometheus/client_golang v1.20.1/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= 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= @@ -84,8 +86,8 @@ golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJ 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.23.0 h1:YfKFowiIMvtgl1UERQoTPPToxltDeZfbj4H7dVUCwmM= -golang.org/x/sys v0.23.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.24.0 h1:Twjiwq9dn6R1fQcyiK+wQyHWfaz/BJB+YIpzU/Cv3Xg= +golang.org/x/sys v0.24.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= diff --git a/exporter/exportertest/mock_consumer.go b/exporter/exportertest/mock_consumer.go index b513e524735..6781f68e788 100644 --- a/exporter/exportertest/mock_consumer.go +++ b/exporter/exportertest/mock_consumer.go @@ -5,7 +5,7 @@ package exportertest // import "go.opentelemetry.io/collector/exporter/exportert import ( "context" "fmt" - "math/rand" + "math/rand/v2" "sync" "google.golang.org/grpc/codes" diff --git a/exporter/exportertest/nop_exporter.go b/exporter/exportertest/nop_exporter.go index 4034d70ef87..73abe305df8 100644 --- a/exporter/exportertest/nop_exporter.go +++ b/exporter/exportertest/nop_exporter.go @@ -62,6 +62,9 @@ type nopExporter struct { } // NewNopBuilder returns an exporter.Builder that constructs nop receivers. +// +// Deprecated: [v0.108.0] this builder is being internalized within the service module, +// and will be removed soon. func NewNopBuilder() *exporter.Builder { nopFactory := NewNopFactory() return exporter.NewBuilder( diff --git a/exporter/go.mod b/exporter/go.mod index 60e93705f47..f1cb37a4402 100644 --- a/exporter/go.mod +++ b/exporter/go.mod @@ -1,22 +1,22 @@ module go.opentelemetry.io/collector/exporter -go 1.21.0 +go 1.22.0 require ( github.com/cenkalti/backoff/v4 v4.3.0 github.com/google/uuid v1.6.0 github.com/stretchr/testify v1.9.0 - go.opentelemetry.io/collector v0.106.1 - go.opentelemetry.io/collector/component v0.106.1 - go.opentelemetry.io/collector/config/configretry v1.12.0 - go.opentelemetry.io/collector/config/configtelemetry v0.106.1 - go.opentelemetry.io/collector/consumer v0.106.1 - go.opentelemetry.io/collector/consumer/consumerprofiles v0.106.1 - go.opentelemetry.io/collector/consumer/consumertest v0.106.1 - go.opentelemetry.io/collector/extension v0.106.1 - go.opentelemetry.io/collector/pdata v1.12.0 - go.opentelemetry.io/collector/pdata/testdata v0.106.1 - go.opentelemetry.io/collector/receiver v0.106.1 + go.opentelemetry.io/collector v0.107.0 + go.opentelemetry.io/collector/component v0.107.0 + go.opentelemetry.io/collector/config/configretry v1.13.0 + go.opentelemetry.io/collector/config/configtelemetry v0.107.0 + go.opentelemetry.io/collector/consumer v0.107.0 + go.opentelemetry.io/collector/consumer/consumerprofiles v0.107.0 + go.opentelemetry.io/collector/consumer/consumertest v0.107.0 + go.opentelemetry.io/collector/extension v0.107.0 + go.opentelemetry.io/collector/pdata v1.13.0 + go.opentelemetry.io/collector/pdata/testdata v0.107.0 + go.opentelemetry.io/collector/receiver v0.107.0 go.opentelemetry.io/otel v1.28.0 go.opentelemetry.io/otel/metric v1.28.0 go.opentelemetry.io/otel/sdk v1.28.0 @@ -25,7 +25,7 @@ require ( go.uber.org/goleak v1.3.0 go.uber.org/multierr v1.11.0 go.uber.org/zap v1.27.0 - golang.org/x/sys v0.23.0 + golang.org/x/sys v0.24.0 google.golang.org/grpc v1.65.0 ) @@ -35,10 +35,10 @@ require ( github.com/davecgh/go-spew v1.1.1 // indirect github.com/go-logr/logr v1.4.2 // indirect github.com/go-logr/stdr v1.2.2 // indirect - github.com/go-viper/mapstructure/v2 v2.0.0 // indirect + github.com/go-viper/mapstructure/v2 v2.1.0 // indirect github.com/gogo/protobuf v1.3.2 // indirect - github.com/hashicorp/go-version v1.7.0 // indirect github.com/json-iterator/go v1.1.12 // indirect + github.com/klauspost/compress v1.17.9 // 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 @@ -48,14 +48,13 @@ require ( 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_golang v1.20.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/confmap v0.106.1 // indirect - go.opentelemetry.io/collector/featuregate v1.12.0 // indirect - go.opentelemetry.io/collector/internal/globalgates v0.106.1 // indirect - go.opentelemetry.io/collector/pdata/pprofile v0.106.1 // indirect + go.opentelemetry.io/collector/component/componentstatus v0.107.0 // indirect + go.opentelemetry.io/collector/confmap v0.107.0 // indirect + go.opentelemetry.io/collector/pdata/pprofile v0.107.0 // indirect go.opentelemetry.io/otel/exporters/prometheus v0.50.0 // indirect golang.org/x/net v0.26.0 // indirect golang.org/x/text v0.16.0 // indirect @@ -66,8 +65,6 @@ require ( replace go.opentelemetry.io/collector => ../ -replace go.opentelemetry.io/collector/internal/globalgates => ../internal/globalgates - replace go.opentelemetry.io/collector/component => ../component replace go.opentelemetry.io/collector/confmap => ../confmap @@ -95,3 +92,5 @@ replace go.opentelemetry.io/collector/config/configtelemetry => ../config/config replace go.opentelemetry.io/collector/consumer/consumerprofiles => ../consumer/consumerprofiles replace go.opentelemetry.io/collector/consumer/consumertest => ../consumer/consumertest + +replace go.opentelemetry.io/collector/component/componentstatus => ../component/componentstatus diff --git a/exporter/go.sum b/exporter/go.sum index 501dc8aa362..4e0b4f2dea6 100644 --- a/exporter/go.sum +++ b/exporter/go.sum @@ -12,8 +12,8 @@ github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY= github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= -github.com/go-viper/mapstructure/v2 v2.0.0 h1:dhn8MZ1gZ0mzeodTG3jt5Vj/o87xZKuNAprG2mQfMfc= -github.com/go-viper/mapstructure/v2 v2.0.0/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM= +github.com/go-viper/mapstructure/v2 v2.1.0 h1:gHnMa2Y/pIxElCH2GlZZ1lZSsn6XMtufpGyP1XxdC/w= +github.com/go-viper/mapstructure/v2 v2.1.0/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= @@ -21,12 +21,12 @@ github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeN 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/klauspost/compress v1.17.9 h1:6KIumPrER1LHsvBVuDa0r5xaG0Es51mhhB9BQB2qeMA= +github.com/klauspost/compress v1.17.9/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw= 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= @@ -37,6 +37,8 @@ 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/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= +github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= 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= @@ -50,8 +52,8 @@ github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq 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_golang v1.20.1 h1:IMJXHOD6eARkQpxo8KkhgEVFlBNm+nkrFUyGlIu7Na8= +github.com/prometheus/client_golang v1.20.1/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= 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= @@ -101,8 +103,8 @@ golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJ 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.23.0 h1:YfKFowiIMvtgl1UERQoTPPToxltDeZfbj4H7dVUCwmM= -golang.org/x/sys v0.23.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.24.0 h1:Twjiwq9dn6R1fQcyiK+wQyHWfaz/BJB+YIpzU/Cv3Xg= +golang.org/x/sys v0.24.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= diff --git a/exporter/loggingexporter/README.md b/exporter/loggingexporter/README.md index 161060a6dd0..685e1264e28 100644 --- a/exporter/loggingexporter/README.md +++ b/exporter/loggingexporter/README.md @@ -5,7 +5,7 @@ | ------------- |-----------| | Stability | [deprecated]: traces, metrics, logs | | Distributions | [core], [contrib] | -| Issues | [![Open issues](https://img.shields.io/github/issues-search/open-telemetry/opentelemetry-collector-contrib?query=is%3Aissue%20is%3Aopen%20label%3Aexporter%2Flogging%20&label=open&color=orange&logo=opentelemetry)](https://github.com/open-telemetry/opentelemetry-collector-contrib/issues?q=is%3Aopen+is%3Aissue+label%3Aexporter%2Flogging) [![Closed issues](https://img.shields.io/github/issues-search/open-telemetry/opentelemetry-collector-contrib?query=is%3Aissue%20is%3Aclosed%20label%3Aexporter%2Flogging%20&label=closed&color=blue&logo=opentelemetry)](https://github.com/open-telemetry/opentelemetry-collector-contrib/issues?q=is%3Aclosed+is%3Aissue+label%3Aexporter%2Flogging) | +| Issues | [![Open issues](https://img.shields.io/github/issues-search/open-telemetry/opentelemetry-collector?query=is%3Aissue%20is%3Aopen%20label%3Aexporter%2Flogging%20&label=open&color=orange&logo=opentelemetry)](https://github.com/open-telemetry/opentelemetry-collector/issues?q=is%3Aopen+is%3Aissue+label%3Aexporter%2Flogging) [![Closed issues](https://img.shields.io/github/issues-search/open-telemetry/opentelemetry-collector?query=is%3Aissue%20is%3Aclosed%20label%3Aexporter%2Flogging%20&label=closed&color=blue&logo=opentelemetry)](https://github.com/open-telemetry/opentelemetry-collector/issues?q=is%3Aclosed+is%3Aissue+label%3Aexporter%2Flogging) | [deprecated]: https://github.com/open-telemetry/opentelemetry-collector#deprecated [core]: https://github.com/open-telemetry/opentelemetry-collector-releases/tree/main/distributions/otelcol diff --git a/exporter/loggingexporter/go.mod b/exporter/loggingexporter/go.mod index 629c12d465e..05416c7638e 100644 --- a/exporter/loggingexporter/go.mod +++ b/exporter/loggingexporter/go.mod @@ -1,15 +1,15 @@ // Deprecated: loggingexporter is deprecated in favour of the debugexporter. It will be removed in September 2024. module go.opentelemetry.io/collector/exporter/loggingexporter -go 1.21.0 +go 1.22.0 require ( github.com/stretchr/testify v1.9.0 - go.opentelemetry.io/collector/component v0.106.1 - go.opentelemetry.io/collector/config/configtelemetry v0.106.1 - go.opentelemetry.io/collector/confmap v0.106.1 - go.opentelemetry.io/collector/exporter v0.106.1 - go.opentelemetry.io/collector/pdata v1.12.0 + go.opentelemetry.io/collector/component v0.107.0 + go.opentelemetry.io/collector/config/configtelemetry v0.107.0 + go.opentelemetry.io/collector/confmap v0.107.0 + go.opentelemetry.io/collector/exporter v0.107.0 + go.opentelemetry.io/collector/pdata v1.13.0 go.uber.org/goleak v1.3.0 go.uber.org/zap v1.27.0 ) @@ -21,11 +21,11 @@ require ( github.com/davecgh/go-spew v1.1.1 // indirect github.com/go-logr/logr v1.4.2 // indirect github.com/go-logr/stdr v1.2.2 // indirect - github.com/go-viper/mapstructure/v2 v2.0.0 // indirect + github.com/go-viper/mapstructure/v2 v2.1.0 // indirect github.com/gogo/protobuf v1.3.2 // indirect github.com/google/uuid v1.6.0 // indirect - github.com/hashicorp/go-version v1.7.0 // indirect github.com/json-iterator/go v1.1.12 // indirect + github.com/klauspost/compress v1.17.9 // 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 @@ -35,20 +35,18 @@ require ( 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_golang v1.20.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.1 // indirect - go.opentelemetry.io/collector/config/configretry v1.12.0 // indirect - go.opentelemetry.io/collector/consumer v0.106.1 // indirect - go.opentelemetry.io/collector/consumer/consumerprofiles v0.106.1 // indirect - go.opentelemetry.io/collector/consumer/consumertest v0.106.1 // indirect - go.opentelemetry.io/collector/extension v0.106.1 // indirect - go.opentelemetry.io/collector/featuregate v1.12.0 // indirect - go.opentelemetry.io/collector/internal/globalgates v0.106.1 // indirect - go.opentelemetry.io/collector/pdata/pprofile v0.106.1 // indirect - go.opentelemetry.io/collector/receiver v0.106.1 // indirect + go.opentelemetry.io/collector v0.107.0 // indirect + go.opentelemetry.io/collector/config/configretry v1.13.0 // indirect + go.opentelemetry.io/collector/consumer v0.107.0 // indirect + go.opentelemetry.io/collector/consumer/consumerprofiles v0.107.0 // indirect + go.opentelemetry.io/collector/consumer/consumertest v0.107.0 // indirect + go.opentelemetry.io/collector/extension v0.107.0 // indirect + go.opentelemetry.io/collector/pdata/pprofile v0.107.0 // indirect + go.opentelemetry.io/collector/receiver v0.107.0 // 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 @@ -57,7 +55,7 @@ require ( 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.23.0 // indirect + golang.org/x/sys v0.24.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 @@ -67,8 +65,6 @@ require ( replace go.opentelemetry.io/collector => ../../ -replace go.opentelemetry.io/collector/internal/globalgates => ../../internal/globalgates - replace go.opentelemetry.io/collector/component => ../../component replace go.opentelemetry.io/collector/confmap => ../../confmap @@ -101,3 +97,5 @@ replace go.opentelemetry.io/collector/pdata/pprofile => ../../pdata/pprofile replace go.opentelemetry.io/collector/consumer/consumerprofiles => ../../consumer/consumerprofiles replace go.opentelemetry.io/collector/consumer/consumertest => ../../consumer/consumertest + +replace go.opentelemetry.io/collector/component/componentstatus => ../../component/componentstatus diff --git a/exporter/loggingexporter/go.sum b/exporter/loggingexporter/go.sum index 501dc8aa362..4e0b4f2dea6 100644 --- a/exporter/loggingexporter/go.sum +++ b/exporter/loggingexporter/go.sum @@ -12,8 +12,8 @@ github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY= github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= -github.com/go-viper/mapstructure/v2 v2.0.0 h1:dhn8MZ1gZ0mzeodTG3jt5Vj/o87xZKuNAprG2mQfMfc= -github.com/go-viper/mapstructure/v2 v2.0.0/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM= +github.com/go-viper/mapstructure/v2 v2.1.0 h1:gHnMa2Y/pIxElCH2GlZZ1lZSsn6XMtufpGyP1XxdC/w= +github.com/go-viper/mapstructure/v2 v2.1.0/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= @@ -21,12 +21,12 @@ github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeN 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/klauspost/compress v1.17.9 h1:6KIumPrER1LHsvBVuDa0r5xaG0Es51mhhB9BQB2qeMA= +github.com/klauspost/compress v1.17.9/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw= 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= @@ -37,6 +37,8 @@ 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/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= +github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= 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= @@ -50,8 +52,8 @@ github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq 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_golang v1.20.1 h1:IMJXHOD6eARkQpxo8KkhgEVFlBNm+nkrFUyGlIu7Na8= +github.com/prometheus/client_golang v1.20.1/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= 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= @@ -101,8 +103,8 @@ golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJ 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.23.0 h1:YfKFowiIMvtgl1UERQoTPPToxltDeZfbj4H7dVUCwmM= -golang.org/x/sys v0.23.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.24.0 h1:Twjiwq9dn6R1fQcyiK+wQyHWfaz/BJB+YIpzU/Cv3Xg= +golang.org/x/sys v0.24.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= diff --git a/exporter/loggingexporter/internal/metadata/generated_status.go b/exporter/loggingexporter/internal/metadata/generated_status.go index ce3f313e8e0..7c415b23aae 100644 --- a/exporter/loggingexporter/internal/metadata/generated_status.go +++ b/exporter/loggingexporter/internal/metadata/generated_status.go @@ -7,7 +7,8 @@ import ( ) var ( - Type = component.MustNewType("logging") + Type = component.MustNewType("logging") + ScopeName = "go.opentelemetry.io/collector/exporter/loggingexporter" ) const ( diff --git a/exporter/loggingexporter/metadata.yaml b/exporter/loggingexporter/metadata.yaml index 165fa39f173..135c1749611 100644 --- a/exporter/loggingexporter/metadata.yaml +++ b/exporter/loggingexporter/metadata.yaml @@ -1,4 +1,5 @@ type: logging +github_project: open-telemetry/opentelemetry-collector status: class: exporter diff --git a/exporter/nopexporter/README.md b/exporter/nopexporter/README.md index 98a98b37ca0..53ed9ac4c14 100644 --- a/exporter/nopexporter/README.md +++ b/exporter/nopexporter/README.md @@ -5,7 +5,7 @@ | ------------- |-----------| | Stability | [beta]: traces, metrics, logs | | Distributions | [core], [contrib], [k8s] | -| Issues | [![Open issues](https://img.shields.io/github/issues-search/open-telemetry/opentelemetry-collector-contrib?query=is%3Aissue%20is%3Aopen%20label%3Aexporter%2Fnop%20&label=open&color=orange&logo=opentelemetry)](https://github.com/open-telemetry/opentelemetry-collector-contrib/issues?q=is%3Aopen+is%3Aissue+label%3Aexporter%2Fnop) [![Closed issues](https://img.shields.io/github/issues-search/open-telemetry/opentelemetry-collector-contrib?query=is%3Aissue%20is%3Aclosed%20label%3Aexporter%2Fnop%20&label=closed&color=blue&logo=opentelemetry)](https://github.com/open-telemetry/opentelemetry-collector-contrib/issues?q=is%3Aclosed+is%3Aissue+label%3Aexporter%2Fnop) | +| Issues | [![Open issues](https://img.shields.io/github/issues-search/open-telemetry/opentelemetry-collector?query=is%3Aissue%20is%3Aopen%20label%3Aexporter%2Fnop%20&label=open&color=orange&logo=opentelemetry)](https://github.com/open-telemetry/opentelemetry-collector/issues?q=is%3Aopen+is%3Aissue+label%3Aexporter%2Fnop) [![Closed issues](https://img.shields.io/github/issues-search/open-telemetry/opentelemetry-collector?query=is%3Aissue%20is%3Aclosed%20label%3Aexporter%2Fnop%20&label=closed&color=blue&logo=opentelemetry)](https://github.com/open-telemetry/opentelemetry-collector/issues?q=is%3Aclosed+is%3Aissue+label%3Aexporter%2Fnop) | [beta]: https://github.com/open-telemetry/opentelemetry-collector#beta [core]: https://github.com/open-telemetry/opentelemetry-collector-releases/tree/main/distributions/otelcol diff --git a/exporter/nopexporter/go.mod b/exporter/nopexporter/go.mod index 59638882e04..0f7b489708b 100644 --- a/exporter/nopexporter/go.mod +++ b/exporter/nopexporter/go.mod @@ -1,14 +1,14 @@ module go.opentelemetry.io/collector/exporter/nopexporter -go 1.21.0 +go 1.22.0 require ( github.com/stretchr/testify v1.9.0 - go.opentelemetry.io/collector/component v0.106.1 - go.opentelemetry.io/collector/confmap v0.106.1 - go.opentelemetry.io/collector/consumer/consumertest v0.106.1 - go.opentelemetry.io/collector/exporter v0.106.1 - go.opentelemetry.io/collector/pdata v1.12.0 + go.opentelemetry.io/collector/component v0.107.0 + go.opentelemetry.io/collector/confmap v0.107.0 + go.opentelemetry.io/collector/consumer/consumertest v0.107.0 + go.opentelemetry.io/collector/exporter v0.107.0 + go.opentelemetry.io/collector/pdata v1.13.0 go.uber.org/goleak v1.3.0 ) @@ -18,11 +18,11 @@ require ( github.com/davecgh/go-spew v1.1.1 // indirect github.com/go-logr/logr v1.4.2 // indirect github.com/go-logr/stdr v1.2.2 // indirect - github.com/go-viper/mapstructure/v2 v2.0.0 // indirect + github.com/go-viper/mapstructure/v2 v2.1.0 // indirect github.com/gogo/protobuf v1.3.2 // indirect github.com/google/uuid v1.6.0 // indirect - github.com/hashicorp/go-version v1.7.0 // indirect github.com/json-iterator/go v1.1.12 // indirect + github.com/klauspost/compress v1.17.9 // 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 @@ -32,17 +32,15 @@ require ( 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_golang v1.20.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/config/configtelemetry v0.106.1 // indirect - go.opentelemetry.io/collector/consumer v0.106.1 // indirect - go.opentelemetry.io/collector/consumer/consumerprofiles v0.106.1 // indirect - go.opentelemetry.io/collector/featuregate v1.12.0 // indirect - go.opentelemetry.io/collector/internal/globalgates v0.106.1 // indirect - go.opentelemetry.io/collector/pdata/pprofile v0.106.1 // indirect - go.opentelemetry.io/collector/receiver v0.106.1 // indirect + go.opentelemetry.io/collector/config/configtelemetry v0.107.0 // indirect + go.opentelemetry.io/collector/consumer v0.107.0 // indirect + go.opentelemetry.io/collector/consumer/consumerprofiles v0.107.0 // indirect + go.opentelemetry.io/collector/pdata/pprofile v0.107.0 // indirect + go.opentelemetry.io/collector/receiver v0.107.0 // 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 @@ -52,7 +50,7 @@ require ( go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.27.0 // indirect golang.org/x/net v0.26.0 // indirect - golang.org/x/sys v0.23.0 // indirect + golang.org/x/sys v0.24.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 @@ -76,8 +74,6 @@ replace go.opentelemetry.io/collector/receiver => ../../receiver replace go.opentelemetry.io/collector => ../.. -replace go.opentelemetry.io/collector/internal/globalgates => ../../internal/globalgates - replace go.opentelemetry.io/collector/featuregate => ../../featuregate replace go.opentelemetry.io/collector/confmap => ../../confmap @@ -91,3 +87,5 @@ replace go.opentelemetry.io/collector/pdata/pprofile => ../../pdata/pprofile replace go.opentelemetry.io/collector/consumer/consumerprofiles => ../../consumer/consumerprofiles replace go.opentelemetry.io/collector/consumer/consumertest => ../../consumer/consumertest + +replace go.opentelemetry.io/collector/component/componentstatus => ../../component/componentstatus diff --git a/exporter/nopexporter/go.sum b/exporter/nopexporter/go.sum index 501dc8aa362..4e0b4f2dea6 100644 --- a/exporter/nopexporter/go.sum +++ b/exporter/nopexporter/go.sum @@ -12,8 +12,8 @@ github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY= github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= -github.com/go-viper/mapstructure/v2 v2.0.0 h1:dhn8MZ1gZ0mzeodTG3jt5Vj/o87xZKuNAprG2mQfMfc= -github.com/go-viper/mapstructure/v2 v2.0.0/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM= +github.com/go-viper/mapstructure/v2 v2.1.0 h1:gHnMa2Y/pIxElCH2GlZZ1lZSsn6XMtufpGyP1XxdC/w= +github.com/go-viper/mapstructure/v2 v2.1.0/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= @@ -21,12 +21,12 @@ github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeN 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/klauspost/compress v1.17.9 h1:6KIumPrER1LHsvBVuDa0r5xaG0Es51mhhB9BQB2qeMA= +github.com/klauspost/compress v1.17.9/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw= 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= @@ -37,6 +37,8 @@ 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/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= +github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= 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= @@ -50,8 +52,8 @@ github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq 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_golang v1.20.1 h1:IMJXHOD6eARkQpxo8KkhgEVFlBNm+nkrFUyGlIu7Na8= +github.com/prometheus/client_golang v1.20.1/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= 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= @@ -101,8 +103,8 @@ golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJ 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.23.0 h1:YfKFowiIMvtgl1UERQoTPPToxltDeZfbj4H7dVUCwmM= -golang.org/x/sys v0.23.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.24.0 h1:Twjiwq9dn6R1fQcyiK+wQyHWfaz/BJB+YIpzU/Cv3Xg= +golang.org/x/sys v0.24.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= diff --git a/exporter/nopexporter/internal/metadata/generated_status.go b/exporter/nopexporter/internal/metadata/generated_status.go index 1901cab9ee6..d7336115c61 100644 --- a/exporter/nopexporter/internal/metadata/generated_status.go +++ b/exporter/nopexporter/internal/metadata/generated_status.go @@ -7,7 +7,8 @@ import ( ) var ( - Type = component.MustNewType("nop") + Type = component.MustNewType("nop") + ScopeName = "go.opentelemetry.io/collector/exporter/nopexporter" ) const ( diff --git a/exporter/nopexporter/metadata.yaml b/exporter/nopexporter/metadata.yaml index 9c0c931892d..352312a44c4 100644 --- a/exporter/nopexporter/metadata.yaml +++ b/exporter/nopexporter/metadata.yaml @@ -1,4 +1,5 @@ type: nop +github_project: open-telemetry/opentelemetry-collector status: class: exporter diff --git a/exporter/otlpexporter/README.md b/exporter/otlpexporter/README.md index b4a5c7b055d..c1ea6716e1b 100644 --- a/exporter/otlpexporter/README.md +++ b/exporter/otlpexporter/README.md @@ -6,7 +6,7 @@ | Stability | [beta]: logs | | | [stable]: traces, metrics | | Distributions | [core], [contrib], [k8s] | -| Issues | [![Open issues](https://img.shields.io/github/issues-search/open-telemetry/opentelemetry-collector-contrib?query=is%3Aissue%20is%3Aopen%20label%3Aexporter%2Fotlp%20&label=open&color=orange&logo=opentelemetry)](https://github.com/open-telemetry/opentelemetry-collector-contrib/issues?q=is%3Aopen+is%3Aissue+label%3Aexporter%2Fotlp) [![Closed issues](https://img.shields.io/github/issues-search/open-telemetry/opentelemetry-collector-contrib?query=is%3Aissue%20is%3Aclosed%20label%3Aexporter%2Fotlp%20&label=closed&color=blue&logo=opentelemetry)](https://github.com/open-telemetry/opentelemetry-collector-contrib/issues?q=is%3Aclosed+is%3Aissue+label%3Aexporter%2Fotlp) | +| Issues | [![Open issues](https://img.shields.io/github/issues-search/open-telemetry/opentelemetry-collector?query=is%3Aissue%20is%3Aopen%20label%3Aexporter%2Fotlp%20&label=open&color=orange&logo=opentelemetry)](https://github.com/open-telemetry/opentelemetry-collector/issues?q=is%3Aopen+is%3Aissue+label%3Aexporter%2Fotlp) [![Closed issues](https://img.shields.io/github/issues-search/open-telemetry/opentelemetry-collector?query=is%3Aissue%20is%3Aclosed%20label%3Aexporter%2Fotlp%20&label=closed&color=blue&logo=opentelemetry)](https://github.com/open-telemetry/opentelemetry-collector/issues?q=is%3Aclosed+is%3Aissue+label%3Aexporter%2Fotlp) | [beta]: https://github.com/open-telemetry/opentelemetry-collector#beta [stable]: https://github.com/open-telemetry/opentelemetry-collector#stable @@ -59,4 +59,4 @@ Several helper files are leveraged to provide additional capabilities automatica - [gRPC settings](https://github.com/open-telemetry/opentelemetry-collector/blob/main/config/configgrpc/README.md) - [TLS and mTLS settings](https://github.com/open-telemetry/opentelemetry-collector/blob/main/config/configtls/README.md) -- [Queuing, retry and timeout settings](https://github.com/open-telemetry/opentelemetry-collector/blob/main/exporter/exporterhelper/README.md) +- [Queuing, batching, retry and timeout settings](https://github.com/open-telemetry/opentelemetry-collector/blob/main/exporter/exporterhelper/README.md) diff --git a/exporter/otlpexporter/config.go b/exporter/otlpexporter/config.go index f1d5b668e54..2aec2995054 100644 --- a/exporter/otlpexporter/config.go +++ b/exporter/otlpexporter/config.go @@ -14,6 +14,7 @@ import ( "go.opentelemetry.io/collector/component" "go.opentelemetry.io/collector/config/configgrpc" "go.opentelemetry.io/collector/config/configretry" + "go.opentelemetry.io/collector/exporter/exporterbatcher" "go.opentelemetry.io/collector/exporter/exporterhelper" ) @@ -23,6 +24,10 @@ type Config struct { QueueConfig exporterhelper.QueueSettings `mapstructure:"sending_queue"` RetryConfig configretry.BackOffConfig `mapstructure:"retry_on_failure"` + // Experimental: This configuration is at the early stage of development and may change without backward compatibility + // until https://github.com/open-telemetry/opentelemetry-collector/issues/8122 is resolved + BatcherConfig exporterbatcher.Config `mapstructure:"batcher"` + configgrpc.ClientConfig `mapstructure:",squash"` // squash ensures fields are correctly decoded in embedded struct. } diff --git a/exporter/otlpexporter/config_test.go b/exporter/otlpexporter/config_test.go index a29d0182860..7a855d47b51 100644 --- a/exporter/otlpexporter/config_test.go +++ b/exporter/otlpexporter/config_test.go @@ -19,6 +19,7 @@ import ( "go.opentelemetry.io/collector/config/configtls" "go.opentelemetry.io/collector/confmap" "go.opentelemetry.io/collector/confmap/confmaptest" + "go.opentelemetry.io/collector/exporter/exporterbatcher" "go.opentelemetry.io/collector/exporter/exporterhelper" ) @@ -53,6 +54,16 @@ func TestUnmarshalConfig(t *testing.T) { NumConsumers: 2, QueueSize: 10, }, + BatcherConfig: exporterbatcher.Config{ + Enabled: true, + FlushTimeout: 200 * time.Millisecond, + MinSizeConfig: exporterbatcher.MinSizeConfig{ + MinSizeItems: 1000, + }, + MaxSizeConfig: exporterbatcher.MaxSizeConfig{ + MaxSizeItems: 10000, + }, + }, ClientConfig: configgrpc.ClientConfig{ Headers: map[string]configopaque.String{ "can you have a . here?": "F0000000-0000-0000-0000-000000000000", diff --git a/exporter/otlpexporter/factory.go b/exporter/otlpexporter/factory.go index c06a6c605b2..84952defdf3 100644 --- a/exporter/otlpexporter/factory.go +++ b/exporter/otlpexporter/factory.go @@ -13,6 +13,7 @@ import ( "go.opentelemetry.io/collector/config/configretry" "go.opentelemetry.io/collector/consumer" "go.opentelemetry.io/collector/exporter" + "go.opentelemetry.io/collector/exporter/exporterbatcher" "go.opentelemetry.io/collector/exporter/exporterhelper" "go.opentelemetry.io/collector/exporter/otlpexporter/internal/metadata" ) @@ -29,10 +30,14 @@ func NewFactory() exporter.Factory { } func createDefaultConfig() component.Config { + batcherCfg := exporterbatcher.NewDefaultConfig() + batcherCfg.Enabled = false + return &Config{ TimeoutSettings: exporterhelper.NewDefaultTimeoutSettings(), RetryConfig: configretry.NewDefaultBackOffConfig(), QueueConfig: exporterhelper.NewDefaultQueueSettings(), + BatcherConfig: batcherCfg, ClientConfig: configgrpc.ClientConfig{ Headers: map[string]configopaque.String{}, // Default to gzip compression @@ -56,8 +61,10 @@ func createTracesExporter( exporterhelper.WithTimeout(oCfg.TimeoutSettings), exporterhelper.WithRetry(oCfg.RetryConfig), exporterhelper.WithQueue(oCfg.QueueConfig), + exporterhelper.WithBatcher(oCfg.BatcherConfig), exporterhelper.WithStart(oce.start), - exporterhelper.WithShutdown(oce.shutdown)) + exporterhelper.WithShutdown(oce.shutdown), + ) } func createMetricsExporter( @@ -73,6 +80,7 @@ func createMetricsExporter( exporterhelper.WithTimeout(oCfg.TimeoutSettings), exporterhelper.WithRetry(oCfg.RetryConfig), exporterhelper.WithQueue(oCfg.QueueConfig), + exporterhelper.WithBatcher(oCfg.BatcherConfig), exporterhelper.WithStart(oce.start), exporterhelper.WithShutdown(oce.shutdown), ) @@ -91,6 +99,7 @@ func createLogsExporter( exporterhelper.WithTimeout(oCfg.TimeoutSettings), exporterhelper.WithRetry(oCfg.RetryConfig), exporterhelper.WithQueue(oCfg.QueueConfig), + exporterhelper.WithBatcher(oCfg.BatcherConfig), exporterhelper.WithStart(oce.start), exporterhelper.WithShutdown(oce.shutdown), ) diff --git a/exporter/otlpexporter/go.mod b/exporter/otlpexporter/go.mod index bb14599981d..3c61b6ff0f3 100644 --- a/exporter/otlpexporter/go.mod +++ b/exporter/otlpexporter/go.mod @@ -1,22 +1,22 @@ module go.opentelemetry.io/collector/exporter/otlpexporter -go 1.21.0 +go 1.22.0 require ( github.com/stretchr/testify v1.9.0 - go.opentelemetry.io/collector v0.106.1 - go.opentelemetry.io/collector/component v0.106.1 - go.opentelemetry.io/collector/config/configauth v0.106.1 - go.opentelemetry.io/collector/config/configcompression v1.12.0 - go.opentelemetry.io/collector/config/configgrpc v0.106.1 - go.opentelemetry.io/collector/config/configopaque v1.12.0 - go.opentelemetry.io/collector/config/configretry v1.12.0 - go.opentelemetry.io/collector/config/configtls v1.12.0 - go.opentelemetry.io/collector/confmap v0.106.1 - go.opentelemetry.io/collector/consumer v0.106.1 - go.opentelemetry.io/collector/exporter v0.106.1 - go.opentelemetry.io/collector/pdata v1.12.0 - go.opentelemetry.io/collector/pdata/testdata v0.106.1 + go.opentelemetry.io/collector v0.107.0 + go.opentelemetry.io/collector/component v0.107.0 + go.opentelemetry.io/collector/config/configauth v0.107.0 + go.opentelemetry.io/collector/config/configcompression v1.13.0 + go.opentelemetry.io/collector/config/configgrpc v0.107.0 + go.opentelemetry.io/collector/config/configopaque v1.13.0 + go.opentelemetry.io/collector/config/configretry v1.13.0 + go.opentelemetry.io/collector/config/configtls v1.13.0 + go.opentelemetry.io/collector/confmap v0.107.0 + go.opentelemetry.io/collector/consumer v0.107.0 + go.opentelemetry.io/collector/exporter v0.107.0 + go.opentelemetry.io/collector/pdata v1.13.0 + go.opentelemetry.io/collector/pdata/testdata v0.107.0 go.uber.org/goleak v1.3.0 go.uber.org/zap v1.27.0 google.golang.org/genproto/googleapis/rpc v0.0.0-20240701130421-f6361c86f094 @@ -32,14 +32,14 @@ require ( github.com/fsnotify/fsnotify v1.7.0 // 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/go-viper/mapstructure/v2 v2.1.0 // indirect github.com/gogo/protobuf v1.3.2 // indirect github.com/golang/snappy v0.0.4 // indirect github.com/google/uuid v1.6.0 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.20.0 // indirect github.com/hashicorp/go-version v1.7.0 // indirect github.com/json-iterator/go v1.1.12 // indirect - github.com/klauspost/compress v1.17.8 // indirect + github.com/klauspost/compress v1.17.9 // 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 @@ -50,22 +50,21 @@ require ( github.com/mostynb/go-grpc-compression v1.2.3 // 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_golang v1.20.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/client v0.106.1 // indirect - go.opentelemetry.io/collector/config/confignet v0.106.1 // indirect - go.opentelemetry.io/collector/config/configtelemetry v0.106.1 // indirect - go.opentelemetry.io/collector/config/internal v0.106.1 // indirect - go.opentelemetry.io/collector/consumer/consumerprofiles v0.106.1 // indirect - go.opentelemetry.io/collector/consumer/consumertest v0.106.1 // indirect - go.opentelemetry.io/collector/extension v0.106.1 // indirect - go.opentelemetry.io/collector/extension/auth v0.106.1 // indirect - go.opentelemetry.io/collector/featuregate v1.12.0 // indirect - go.opentelemetry.io/collector/internal/globalgates v0.106.1 // indirect - go.opentelemetry.io/collector/pdata/pprofile v0.106.1 // indirect - go.opentelemetry.io/collector/receiver v0.106.1 // indirect + go.opentelemetry.io/collector/client v1.13.0 // indirect + go.opentelemetry.io/collector/config/confignet v0.107.0 // indirect + go.opentelemetry.io/collector/config/configtelemetry v0.107.0 // indirect + go.opentelemetry.io/collector/config/internal v0.107.0 // indirect + go.opentelemetry.io/collector/consumer/consumerprofiles v0.107.0 // indirect + go.opentelemetry.io/collector/consumer/consumertest v0.107.0 // indirect + go.opentelemetry.io/collector/extension v0.107.0 // indirect + go.opentelemetry.io/collector/extension/auth v0.107.0 // indirect + go.opentelemetry.io/collector/featuregate v1.13.0 // indirect + go.opentelemetry.io/collector/pdata/pprofile v0.107.0 // indirect + go.opentelemetry.io/collector/receiver v0.107.0 // indirect go.opentelemetry.io/contrib/config v0.8.0 // indirect go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.53.0 // indirect go.opentelemetry.io/otel v1.28.0 // indirect @@ -87,7 +86,7 @@ require ( go.opentelemetry.io/proto/otlp v1.3.1 // indirect go.uber.org/multierr v1.11.0 // indirect golang.org/x/net v0.26.0 // indirect - golang.org/x/sys v0.23.0 // indirect + golang.org/x/sys v0.24.0 // indirect golang.org/x/text v0.16.0 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20240701130421-f6361c86f094 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect @@ -142,8 +141,8 @@ replace go.opentelemetry.io/collector/config/configtelemetry => ../../config/con replace go.opentelemetry.io/collector/config/configretry => ../../config/configretry -replace go.opentelemetry.io/collector/internal/globalgates => ../../internal/globalgates - replace go.opentelemetry.io/collector/consumer/consumerprofiles => ../../consumer/consumerprofiles replace go.opentelemetry.io/collector/consumer/consumertest => ../../consumer/consumertest + +replace go.opentelemetry.io/collector/component/componentstatus => ../../component/componentstatus diff --git a/exporter/otlpexporter/go.sum b/exporter/otlpexporter/go.sum index 8701786224c..8a8fcaa4cda 100644 --- a/exporter/otlpexporter/go.sum +++ b/exporter/otlpexporter/go.sum @@ -14,8 +14,8 @@ github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY= github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= -github.com/go-viper/mapstructure/v2 v2.0.0 h1:dhn8MZ1gZ0mzeodTG3jt5Vj/o87xZKuNAprG2mQfMfc= -github.com/go-viper/mapstructure/v2 v2.0.0/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM= +github.com/go-viper/mapstructure/v2 v2.1.0 h1:gHnMa2Y/pIxElCH2GlZZ1lZSsn6XMtufpGyP1XxdC/w= +github.com/go-viper/mapstructure/v2 v2.1.0/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM= @@ -33,8 +33,8 @@ github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnr 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/klauspost/compress v1.17.8 h1:YcnTYrq7MikUT7k0Yb5eceMmALQPYBW/Xltxn0NAMnU= -github.com/klauspost/compress v1.17.8/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw= +github.com/klauspost/compress v1.17.9 h1:6KIumPrER1LHsvBVuDa0r5xaG0Es51mhhB9BQB2qeMA= +github.com/klauspost/compress v1.17.9/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw= 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= @@ -45,6 +45,8 @@ 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/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= +github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= 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= @@ -60,8 +62,8 @@ github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq 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_golang v1.20.1 h1:IMJXHOD6eARkQpxo8KkhgEVFlBNm+nkrFUyGlIu7Na8= +github.com/prometheus/client_golang v1.20.1/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= 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= @@ -137,8 +139,8 @@ golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJ 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.23.0 h1:YfKFowiIMvtgl1UERQoTPPToxltDeZfbj4H7dVUCwmM= -golang.org/x/sys v0.23.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.24.0 h1:Twjiwq9dn6R1fQcyiK+wQyHWfaz/BJB+YIpzU/Cv3Xg= +golang.org/x/sys v0.24.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= diff --git a/exporter/otlpexporter/internal/metadata/generated_status.go b/exporter/otlpexporter/internal/metadata/generated_status.go index c9cff844fa2..6003002a1a3 100644 --- a/exporter/otlpexporter/internal/metadata/generated_status.go +++ b/exporter/otlpexporter/internal/metadata/generated_status.go @@ -7,7 +7,8 @@ import ( ) var ( - Type = component.MustNewType("otlp") + Type = component.MustNewType("otlp") + ScopeName = "go.opentelemetry.io/collector/exporter/otlpexporter" ) const ( diff --git a/exporter/otlpexporter/metadata.yaml b/exporter/otlpexporter/metadata.yaml index 0d517c86116..4ab3e8d74a1 100644 --- a/exporter/otlpexporter/metadata.yaml +++ b/exporter/otlpexporter/metadata.yaml @@ -1,4 +1,5 @@ type: otlp +github_project: open-telemetry/opentelemetry-collector status: class: exporter diff --git a/exporter/otlpexporter/testdata/config.yaml b/exporter/otlpexporter/testdata/config.yaml index 7716736b678..d26631053e1 100644 --- a/exporter/otlpexporter/testdata/config.yaml +++ b/exporter/otlpexporter/testdata/config.yaml @@ -14,6 +14,11 @@ retry_on_failure: multiplier: 1.3 max_interval: 60s max_elapsed_time: 10m +batcher: + enabled: true + flush_timeout: 200ms + min_size_items: 1000 + max_size_items: 10000 auth: authenticator: nop headers: diff --git a/exporter/otlphttpexporter/README.md b/exporter/otlphttpexporter/README.md index c41aef98ff6..fbc58e4c9a2 100644 --- a/exporter/otlphttpexporter/README.md +++ b/exporter/otlphttpexporter/README.md @@ -6,7 +6,7 @@ | Stability | [beta]: logs | | | [stable]: traces, metrics | | Distributions | [core], [contrib], [k8s] | -| Issues | [![Open issues](https://img.shields.io/github/issues-search/open-telemetry/opentelemetry-collector-contrib?query=is%3Aissue%20is%3Aopen%20label%3Aexporter%2Fotlphttp%20&label=open&color=orange&logo=opentelemetry)](https://github.com/open-telemetry/opentelemetry-collector-contrib/issues?q=is%3Aopen+is%3Aissue+label%3Aexporter%2Fotlphttp) [![Closed issues](https://img.shields.io/github/issues-search/open-telemetry/opentelemetry-collector-contrib?query=is%3Aissue%20is%3Aclosed%20label%3Aexporter%2Fotlphttp%20&label=closed&color=blue&logo=opentelemetry)](https://github.com/open-telemetry/opentelemetry-collector-contrib/issues?q=is%3Aclosed+is%3Aissue+label%3Aexporter%2Fotlphttp) | +| Issues | [![Open issues](https://img.shields.io/github/issues-search/open-telemetry/opentelemetry-collector?query=is%3Aissue%20is%3Aopen%20label%3Aexporter%2Fotlphttp%20&label=open&color=orange&logo=opentelemetry)](https://github.com/open-telemetry/opentelemetry-collector/issues?q=is%3Aopen+is%3Aissue+label%3Aexporter%2Fotlphttp) [![Closed issues](https://img.shields.io/github/issues-search/open-telemetry/opentelemetry-collector?query=is%3Aissue%20is%3Aclosed%20label%3Aexporter%2Fotlphttp%20&label=closed&color=blue&logo=opentelemetry)](https://github.com/open-telemetry/opentelemetry-collector/issues?q=is%3Aclosed+is%3Aissue+label%3Aexporter%2Fotlphttp) | [beta]: https://github.com/open-telemetry/opentelemetry-collector#beta [stable]: https://github.com/open-telemetry/opentelemetry-collector#stable diff --git a/exporter/otlphttpexporter/go.mod b/exporter/otlphttpexporter/go.mod index a71b69b3b48..b0dcec9b6b7 100644 --- a/exporter/otlphttpexporter/go.mod +++ b/exporter/otlphttpexporter/go.mod @@ -1,20 +1,20 @@ module go.opentelemetry.io/collector/exporter/otlphttpexporter -go 1.21.0 +go 1.22.0 require ( github.com/stretchr/testify v1.9.0 - go.opentelemetry.io/collector v0.106.1 - go.opentelemetry.io/collector/component v0.106.1 - go.opentelemetry.io/collector/config/configcompression v1.12.0 - go.opentelemetry.io/collector/config/confighttp v0.106.1 - go.opentelemetry.io/collector/config/configopaque v1.12.0 - go.opentelemetry.io/collector/config/configretry v1.12.0 - go.opentelemetry.io/collector/config/configtls v1.12.0 - go.opentelemetry.io/collector/confmap v0.106.1 - go.opentelemetry.io/collector/consumer v0.106.1 - go.opentelemetry.io/collector/exporter v0.106.1 - go.opentelemetry.io/collector/pdata v1.12.0 + go.opentelemetry.io/collector v0.107.0 + go.opentelemetry.io/collector/component v0.107.0 + go.opentelemetry.io/collector/config/configcompression v1.13.0 + go.opentelemetry.io/collector/config/confighttp v0.107.0 + go.opentelemetry.io/collector/config/configopaque v1.13.0 + go.opentelemetry.io/collector/config/configretry v1.13.0 + go.opentelemetry.io/collector/config/configtls v1.13.0 + go.opentelemetry.io/collector/confmap v0.107.0 + go.opentelemetry.io/collector/consumer v0.107.0 + go.opentelemetry.io/collector/exporter v0.107.0 + go.opentelemetry.io/collector/pdata v1.13.0 go.uber.org/goleak v1.3.0 go.uber.org/zap v1.27.0 google.golang.org/genproto/googleapis/rpc v0.0.0-20240701130421-f6361c86f094 @@ -31,7 +31,7 @@ require ( github.com/fsnotify/fsnotify v1.7.0 // 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/go-viper/mapstructure/v2 v2.1.0 // indirect github.com/gogo/protobuf v1.3.2 // indirect github.com/golang/snappy v0.0.4 // indirect github.com/google/uuid v1.6.0 // indirect @@ -48,23 +48,22 @@ require ( 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_golang v1.20.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 github.com/rs/cors v1.11.0 // indirect - go.opentelemetry.io/collector/client v0.106.1 // indirect - go.opentelemetry.io/collector/config/configauth v0.106.1 // indirect - go.opentelemetry.io/collector/config/configtelemetry v0.106.1 // indirect - go.opentelemetry.io/collector/config/internal v0.106.1 // indirect - go.opentelemetry.io/collector/consumer/consumerprofiles v0.106.1 // indirect - go.opentelemetry.io/collector/consumer/consumertest v0.106.1 // indirect - go.opentelemetry.io/collector/extension v0.106.1 // indirect - go.opentelemetry.io/collector/extension/auth v0.106.1 // indirect - go.opentelemetry.io/collector/featuregate v1.12.0 // indirect - go.opentelemetry.io/collector/internal/globalgates v0.106.1 // indirect - go.opentelemetry.io/collector/pdata/pprofile v0.106.1 // indirect - go.opentelemetry.io/collector/receiver v0.106.1 // indirect + go.opentelemetry.io/collector/client v1.13.0 // indirect + go.opentelemetry.io/collector/config/configauth v0.107.0 // indirect + go.opentelemetry.io/collector/config/configtelemetry v0.107.0 // indirect + go.opentelemetry.io/collector/config/internal v0.107.0 // indirect + go.opentelemetry.io/collector/consumer/consumerprofiles v0.107.0 // indirect + go.opentelemetry.io/collector/consumer/consumertest v0.107.0 // indirect + go.opentelemetry.io/collector/extension v0.107.0 // indirect + go.opentelemetry.io/collector/extension/auth v0.107.0 // indirect + go.opentelemetry.io/collector/featuregate v1.13.0 // indirect + go.opentelemetry.io/collector/pdata/pprofile v0.107.0 // indirect + go.opentelemetry.io/collector/receiver v0.107.0 // indirect go.opentelemetry.io/contrib/config v0.8.0 // indirect go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.53.0 // indirect go.opentelemetry.io/otel v1.28.0 // indirect @@ -86,7 +85,7 @@ require ( go.opentelemetry.io/proto/otlp v1.3.1 // indirect go.uber.org/multierr v1.11.0 // indirect golang.org/x/net v0.28.0 // indirect - golang.org/x/sys v0.23.0 // indirect + golang.org/x/sys v0.24.0 // indirect golang.org/x/text v0.17.0 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20240701130421-f6361c86f094 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect @@ -137,10 +136,10 @@ retract ( replace go.opentelemetry.io/collector/config/configretry => ../../config/configretry -replace go.opentelemetry.io/collector/internal/globalgates => ../../internal/globalgates - replace go.opentelemetry.io/collector/consumer/consumerprofiles => ../../consumer/consumerprofiles replace go.opentelemetry.io/collector/consumer/consumertest => ../../consumer/consumertest replace go.opentelemetry.io/collector/client => ../../client + +replace go.opentelemetry.io/collector/component/componentstatus => ../../component/componentstatus diff --git a/exporter/otlphttpexporter/go.sum b/exporter/otlphttpexporter/go.sum index c18cccee1af..59dad80e341 100644 --- a/exporter/otlphttpexporter/go.sum +++ b/exporter/otlphttpexporter/go.sum @@ -16,8 +16,8 @@ github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY= github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= -github.com/go-viper/mapstructure/v2 v2.0.0 h1:dhn8MZ1gZ0mzeodTG3jt5Vj/o87xZKuNAprG2mQfMfc= -github.com/go-viper/mapstructure/v2 v2.0.0/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM= +github.com/go-viper/mapstructure/v2 v2.1.0 h1:gHnMa2Y/pIxElCH2GlZZ1lZSsn6XMtufpGyP1XxdC/w= +github.com/go-viper/mapstructure/v2 v2.1.0/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM= @@ -47,6 +47,8 @@ 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/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= +github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= 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= @@ -60,8 +62,8 @@ github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq 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_golang v1.20.1 h1:IMJXHOD6eARkQpxo8KkhgEVFlBNm+nkrFUyGlIu7Na8= +github.com/prometheus/client_golang v1.20.1/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= 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= @@ -139,8 +141,8 @@ golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJ 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.23.0 h1:YfKFowiIMvtgl1UERQoTPPToxltDeZfbj4H7dVUCwmM= -golang.org/x/sys v0.23.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.24.0 h1:Twjiwq9dn6R1fQcyiK+wQyHWfaz/BJB+YIpzU/Cv3Xg= +golang.org/x/sys v0.24.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.17.0 h1:XtiM5bkSOt+ewxlOE/aE/AKEHibwj/6gvWMl9Rsh0Qc= diff --git a/exporter/otlphttpexporter/internal/metadata/generated_status.go b/exporter/otlphttpexporter/internal/metadata/generated_status.go index 8af2905a456..c38e6de2550 100644 --- a/exporter/otlphttpexporter/internal/metadata/generated_status.go +++ b/exporter/otlphttpexporter/internal/metadata/generated_status.go @@ -7,7 +7,8 @@ import ( ) var ( - Type = component.MustNewType("otlphttp") + Type = component.MustNewType("otlphttp") + ScopeName = "go.opentelemetry.io/collector/exporter/otlphttpexporter" ) const ( diff --git a/exporter/otlphttpexporter/metadata.yaml b/exporter/otlphttpexporter/metadata.yaml index c5dddcf25e8..6d4b1bcba34 100644 --- a/exporter/otlphttpexporter/metadata.yaml +++ b/exporter/otlphttpexporter/metadata.yaml @@ -1,4 +1,5 @@ type: otlphttp +github_project: open-telemetry/opentelemetry-collector status: class: exporter diff --git a/extension/auth/go.mod b/extension/auth/go.mod index a818c203cdc..6e8c00344de 100644 --- a/extension/auth/go.mod +++ b/extension/auth/go.mod @@ -1,11 +1,11 @@ module go.opentelemetry.io/collector/extension/auth -go 1.21.0 +go 1.22.0 require ( github.com/stretchr/testify v1.9.0 - go.opentelemetry.io/collector/component v0.106.1 - go.opentelemetry.io/collector/extension v0.106.1 + go.opentelemetry.io/collector/component v0.107.0 + go.opentelemetry.io/collector/extension v0.107.0 go.uber.org/goleak v1.3.0 google.golang.org/grpc v1.65.0 ) @@ -16,10 +16,10 @@ require ( github.com/davecgh/go-spew v1.1.1 // indirect github.com/go-logr/logr v1.4.2 // indirect github.com/go-logr/stdr v1.2.2 // indirect - github.com/go-viper/mapstructure/v2 v2.0.0 // indirect + github.com/go-viper/mapstructure/v2 v2.1.0 // indirect github.com/gogo/protobuf v1.3.2 // indirect github.com/google/uuid v1.6.0 // indirect - github.com/hashicorp/go-version v1.7.0 // indirect + github.com/klauspost/compress v1.17.9 // 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 @@ -27,15 +27,13 @@ require ( github.com/mitchellh/reflectwalk 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_golang v1.20.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/config/configtelemetry v0.106.1 // indirect - go.opentelemetry.io/collector/confmap v0.106.1 // indirect - go.opentelemetry.io/collector/featuregate v1.12.0 // indirect - go.opentelemetry.io/collector/internal/globalgates v0.106.1 // indirect - go.opentelemetry.io/collector/pdata v1.12.0 // indirect + go.opentelemetry.io/collector/config/configtelemetry v0.107.0 // indirect + go.opentelemetry.io/collector/confmap v0.107.0 // indirect + go.opentelemetry.io/collector/pdata v1.13.0 // 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 @@ -45,7 +43,7 @@ require ( go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.27.0 // indirect golang.org/x/net v0.26.0 // indirect - golang.org/x/sys v0.21.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-20240528184218-531527333157 // indirect google.golang.org/protobuf v1.34.2 // indirect @@ -62,6 +60,4 @@ replace go.opentelemetry.io/collector/pdata => ../../pdata replace go.opentelemetry.io/collector/config/configtelemetry => ../../config/configtelemetry -replace go.opentelemetry.io/collector/featuregate => ../../featuregate - -replace go.opentelemetry.io/collector/internal/globalgates => ../../internal/globalgates +replace go.opentelemetry.io/collector/component/componentstatus => ../../component/componentstatus diff --git a/extension/auth/go.sum b/extension/auth/go.sum index dea0d23e1c9..c577176d803 100644 --- a/extension/auth/go.sum +++ b/extension/auth/go.sum @@ -9,18 +9,18 @@ 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/go-viper/mapstructure/v2 v2.1.0 h1:gHnMa2Y/pIxElCH2GlZZ1lZSsn6XMtufpGyP1XxdC/w= +github.com/go-viper/mapstructure/v2 v2.1.0/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/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/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/klauspost/compress v1.17.9 h1:6KIumPrER1LHsvBVuDa0r5xaG0Es51mhhB9BQB2qeMA= +github.com/klauspost/compress v1.17.9/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw= 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= @@ -31,6 +31,8 @@ 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/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= +github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= 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= @@ -39,8 +41,8 @@ github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq 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_golang v1.20.1 h1:IMJXHOD6eARkQpxo8KkhgEVFlBNm+nkrFUyGlIu7Na8= +github.com/prometheus/client_golang v1.20.1/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= 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= @@ -88,8 +90,8 @@ golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJ 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.21.0 h1:rF+pYz3DAGSQAxAu1CbC7catZg4ebC4UIeIhKxBZvws= -golang.org/x/sys v0.21.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +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= diff --git a/extension/ballastextension/README.md b/extension/ballastextension/README.md index a82e1b7ad39..3115ca39de8 100644 --- a/extension/ballastextension/README.md +++ b/extension/ballastextension/README.md @@ -13,7 +13,7 @@ | ------------- |-----------| | Stability | [deprecated] | | Distributions | [core], [contrib] | -| Issues | [![Open issues](https://img.shields.io/github/issues-search/open-telemetry/opentelemetry-collector-contrib?query=is%3Aissue%20is%3Aopen%20label%3Aextension%2Fballast%20&label=open&color=orange&logo=opentelemetry)](https://github.com/open-telemetry/opentelemetry-collector-contrib/issues?q=is%3Aopen+is%3Aissue+label%3Aextension%2Fballast) [![Closed issues](https://img.shields.io/github/issues-search/open-telemetry/opentelemetry-collector-contrib?query=is%3Aissue%20is%3Aclosed%20label%3Aextension%2Fballast%20&label=closed&color=blue&logo=opentelemetry)](https://github.com/open-telemetry/opentelemetry-collector-contrib/issues?q=is%3Aclosed+is%3Aissue+label%3Aextension%2Fballast) | +| Issues | [![Open issues](https://img.shields.io/github/issues-search/open-telemetry/opentelemetry-collector?query=is%3Aissue%20is%3Aopen%20label%3Aextension%2Fballast%20&label=open&color=orange&logo=opentelemetry)](https://github.com/open-telemetry/opentelemetry-collector/issues?q=is%3Aopen+is%3Aissue+label%3Aextension%2Fballast) [![Closed issues](https://img.shields.io/github/issues-search/open-telemetry/opentelemetry-collector?query=is%3Aissue%20is%3Aclosed%20label%3Aextension%2Fballast%20&label=closed&color=blue&logo=opentelemetry)](https://github.com/open-telemetry/opentelemetry-collector/issues?q=is%3Aclosed+is%3Aissue+label%3Aextension%2Fballast) | [deprecated]: https://github.com/open-telemetry/opentelemetry-collector#deprecated [core]: https://github.com/open-telemetry/opentelemetry-collector-releases/tree/main/distributions/otelcol diff --git a/extension/ballastextension/factory.go b/extension/ballastextension/factory.go index 730950da7d4..36d6004c902 100644 --- a/extension/ballastextension/factory.go +++ b/extension/ballastextension/factory.go @@ -17,7 +17,7 @@ import ( // memHandler returns the total memory of the target host/vm var memHandler = iruntime.TotalMemory -// NewFactory creates a factory for FluentBit extension. +// NewFactory creates a factory for ballast extension. func NewFactory() extension.Factory { return extension.NewFactory(metadata.Type, createDefaultConfig, createExtension, metadata.ExtensionStability) } diff --git a/extension/ballastextension/go.mod b/extension/ballastextension/go.mod index 614a24551c7..8d47549e3e3 100644 --- a/extension/ballastextension/go.mod +++ b/extension/ballastextension/go.mod @@ -1,14 +1,14 @@ // Deprecated: Use the GOMEMLIMIT environment variable instead. module go.opentelemetry.io/collector/extension/ballastextension -go 1.21.0 +go 1.22.0 require ( github.com/stretchr/testify v1.9.0 - go.opentelemetry.io/collector v0.106.1 - go.opentelemetry.io/collector/component v0.106.1 - go.opentelemetry.io/collector/confmap v0.106.1 - go.opentelemetry.io/collector/extension v0.106.1 + go.opentelemetry.io/collector v0.107.0 + go.opentelemetry.io/collector/component v0.107.0 + go.opentelemetry.io/collector/confmap v0.107.0 + go.opentelemetry.io/collector/extension v0.107.0 go.uber.org/goleak v1.3.0 go.uber.org/zap v1.27.0 ) @@ -20,10 +20,10 @@ require ( github.com/go-logr/logr v1.4.2 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/go-ole/go-ole v1.2.6 // indirect - github.com/go-viper/mapstructure/v2 v2.0.0 // indirect + github.com/go-viper/mapstructure/v2 v2.1.0 // indirect github.com/gogo/protobuf v1.3.2 // indirect github.com/google/uuid v1.6.0 // indirect - github.com/hashicorp/go-version v1.7.0 // indirect + github.com/klauspost/compress v1.17.9 // 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 @@ -33,7 +33,7 @@ require ( github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c // indirect - github.com/prometheus/client_golang v1.19.1 // indirect + github.com/prometheus/client_golang v1.20.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 @@ -41,10 +41,9 @@ require ( github.com/tklauser/go-sysconf v0.3.12 // indirect github.com/tklauser/numcpus v0.6.1 // indirect github.com/yusufpapurcu/wmi v1.2.4 // indirect - go.opentelemetry.io/collector/config/configtelemetry v0.106.1 // indirect - go.opentelemetry.io/collector/featuregate v1.12.0 // indirect - go.opentelemetry.io/collector/internal/globalgates v0.106.1 // indirect - go.opentelemetry.io/collector/pdata v1.12.0 // indirect + go.opentelemetry.io/collector/component/componentstatus v0.107.0 // indirect + go.opentelemetry.io/collector/config/configtelemetry v0.107.0 // indirect + go.opentelemetry.io/collector/pdata v1.13.0 // 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 @@ -63,8 +62,6 @@ require ( replace go.opentelemetry.io/collector => ../../ -replace go.opentelemetry.io/collector/internal/globalgates => ../../internal/globalgates - replace go.opentelemetry.io/collector/component => ../../component replace go.opentelemetry.io/collector/confmap => ../../confmap @@ -91,3 +88,5 @@ replace go.opentelemetry.io/collector/pdata/pprofile => ../../pdata/pprofile replace go.opentelemetry.io/collector/consumer/consumerprofiles => ../../consumer/consumerprofiles replace go.opentelemetry.io/collector/consumer/consumertest => ../../consumer/consumertest + +replace go.opentelemetry.io/collector/component/componentstatus => ../../component/componentstatus diff --git a/extension/ballastextension/go.sum b/extension/ballastextension/go.sum index 2578d150a2c..1fdfccf9440 100644 --- a/extension/ballastextension/go.sum +++ b/extension/ballastextension/go.sum @@ -11,8 +11,8 @@ 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-ole/go-ole v1.2.6 h1:/Fpf6oFPoeFik9ty7siob0G6Ke8QvQEuVcuChpwXzpY= github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0= -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/go-viper/mapstructure/v2 v2.1.0 h1:gHnMa2Y/pIxElCH2GlZZ1lZSsn6XMtufpGyP1XxdC/w= +github.com/go-viper/mapstructure/v2 v2.1.0/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= @@ -20,10 +20,10 @@ 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/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/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/klauspost/compress v1.17.9 h1:6KIumPrER1LHsvBVuDa0r5xaG0Es51mhhB9BQB2qeMA= +github.com/klauspost/compress v1.17.9/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw= 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= @@ -34,6 +34,8 @@ 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/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= +github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 h1:6E+4a0GO5zZEnZ81pIr0yLvtUWk2if982qA3F3QD6H4= github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0/go.mod h1:zJYVVT2jmtg6P3p1VtQj7WsuWi/y4VnjVBn7F8KPB3I= github.com/mitchellh/copystructure v1.2.0 h1:vpKXTN4ewci03Vljg/q9QvCGUDttBOGBIa15WveJJGw= @@ -46,8 +48,8 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c h1:ncq/mPwQF4JjgDlrVEn3C11VoGHZN7m8qihwgMEtzYw= github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE= -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_golang v1.20.1 h1:IMJXHOD6eARkQpxo8KkhgEVFlBNm+nkrFUyGlIu7Na8= +github.com/prometheus/client_golang v1.20.1/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= 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= diff --git a/extension/ballastextension/internal/metadata/generated_status.go b/extension/ballastextension/internal/metadata/generated_status.go index 54e3d38805d..2acd5fd7570 100644 --- a/extension/ballastextension/internal/metadata/generated_status.go +++ b/extension/ballastextension/internal/metadata/generated_status.go @@ -7,7 +7,8 @@ import ( ) var ( - Type = component.MustNewType("memory_ballast") + Type = component.MustNewType("memory_ballast") + ScopeName = "go.opentelemetry.io/collector/extension/ballastextension" ) const ( diff --git a/extension/ballastextension/metadata.yaml b/extension/ballastextension/metadata.yaml index 2909cd5cd83..548d4a4ed75 100644 --- a/extension/ballastextension/metadata.yaml +++ b/extension/ballastextension/metadata.yaml @@ -1,4 +1,5 @@ type: memory_ballast +github_project: open-telemetry/opentelemetry-collector status: class: extension diff --git a/extension/extension.go b/extension/extension.go index aaa235d5ae0..9fc9bdd600b 100644 --- a/extension/extension.go +++ b/extension/extension.go @@ -51,15 +51,13 @@ type ConfigWatcher interface { NotifyConfig(ctx context.Context, conf *confmap.Conf) error } -// StatusWatcher is an extra interface for Extension hosted by the OpenTelemetry -// Collector that is to be implemented by extensions interested in changes to component -// status. -type StatusWatcher interface { - // ComponentStatusChanged notifies about a change in the source component status. - // Extensions that implement this interface must be ready that the ComponentStatusChanged - // may be called before, after or concurrently with calls to Component.Start() and Component.Shutdown(). - // The function may be called concurrently with itself. - ComponentStatusChanged(source *component.InstanceID, event *component.StatusEvent) +// ModuleInfo describes the go module for each component. +type ModuleInfo struct { + Receiver map[component.Type]string + Processor map[component.Type]string + Exporter map[component.Type]string + Extension map[component.Type]string + Connector map[component.Type]string } // Settings is passed to Factory.Create(...) function. @@ -71,6 +69,9 @@ type Settings struct { // BuildInfo can be used by components for informational purposes BuildInfo component.BuildInfo + + // ModuleInfo describes the go module for each component. + ModuleInfo ModuleInfo } // CreateFunc is the equivalent of Factory.Create(...) function. @@ -138,12 +139,18 @@ func MakeFactoryMap(factories ...Factory) (map[component.Type]Factory, error) { } // Builder extension is a helper struct that given a set of Configs and Factories helps with creating extensions. +// +// Deprecated: [v0.108.0] this builder is being internalized within the service module, +// and will be removed soon. type Builder struct { cfgs map[component.ID]component.Config factories map[component.Type]Factory } // NewBuilder creates a new extension.Builder to help with creating components form a set of configs and factories. +// +// Deprecated: [v0.108.0] this builder is being internalized within the service module, +// and will be removed soon. func NewBuilder(cfgs map[component.ID]component.Config, factories map[component.Type]Factory) *Builder { return &Builder{cfgs: cfgs, factories: factories} } diff --git a/extension/extension_test.go b/extension/extension_test.go index 3c4b2968667..1c591d5d6d4 100644 --- a/extension/extension_test.go +++ b/extension/extension_test.go @@ -98,7 +98,15 @@ func TestBuilder(t *testing.T) { cfgs := map[component.ID]component.Config{testID: defaultCfg, unknownID: defaultCfg} b := NewBuilder(cfgs, factories) - e, err := b.Create(context.Background(), createSettings(testID)) + testIDSettings := createSettings(testID) + testIDModuleInfo := ModuleInfo{ + Extension: map[component.Type]string{ + testType: "go.opentelemetry.io/collector/extension/extensiontest v1.2.3", + }, + } + testIDSettings.ModuleInfo = testIDModuleInfo + + e, err := b.Create(context.Background(), testIDSettings) assert.NoError(t, err) assert.NotNil(t, e) @@ -107,6 +115,9 @@ func TestBuilder(t *testing.T) { assert.True(t, ok) assert.Equal(t, nop.Settings.Resource.Attributes().Len(), 0) + // Check that the extension has access to the module info. + assert.Equal(t, testIDModuleInfo, nop.ModuleInfo) + missingType, err := b.Create(context.Background(), createSettings(unknownID)) assert.EqualError(t, err, "extension factory not available for: \"unknown\"") assert.Nil(t, missingType) diff --git a/extension/extensiontest/nop_extension.go b/extension/extensiontest/nop_extension.go index 1fd483e5e4f..bb4a4493db6 100644 --- a/extension/extensiontest/nop_extension.go +++ b/extension/extensiontest/nop_extension.go @@ -48,6 +48,9 @@ type nopExtension struct { } // NewNopBuilder returns a extension.Builder that constructs nop extension. +// +// Deprecated: [v0.108.0] this builder is being internalized within the service module, +// and will be removed soon. func NewNopBuilder() *extension.Builder { nopFactory := NewNopFactory() return extension.NewBuilder( diff --git a/extension/extensiontest/statuswatcher_extension.go b/extension/extensiontest/statuswatcher_extension.go index a4d78f9033e..8a14bd2e9a1 100644 --- a/extension/extensiontest/statuswatcher_extension.go +++ b/extension/extensiontest/statuswatcher_extension.go @@ -7,6 +7,7 @@ import ( "context" "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/component/componentstatus" "go.opentelemetry.io/collector/component/componenttest" "go.opentelemetry.io/collector/extension" ) @@ -21,7 +22,7 @@ func NewStatusWatcherExtensionCreateSettings() extension.Settings { // NewStatusWatcherExtensionFactory returns a component.ExtensionFactory to construct a status watcher extension. func NewStatusWatcherExtensionFactory( - onStatusChanged func(source *component.InstanceID, event *component.StatusEvent), + onStatusChanged func(source *componentstatus.InstanceID, event *componentstatus.Event), ) extension.Factory { return extension.NewFactory( component.MustNewType("statuswatcher"), @@ -39,9 +40,9 @@ func NewStatusWatcherExtensionFactory( type statusWatcherExtension struct { component.StartFunc component.ShutdownFunc - onStatusChanged func(source *component.InstanceID, event *component.StatusEvent) + onStatusChanged func(source *componentstatus.InstanceID, event *componentstatus.Event) } -func (e statusWatcherExtension) ComponentStatusChanged(source *component.InstanceID, event *component.StatusEvent) { +func (e statusWatcherExtension) ComponentStatusChanged(source *componentstatus.InstanceID, event *componentstatus.Event) { e.onStatusChanged(source, event) } diff --git a/extension/extensiontest/statuswatcher_extension_test.go b/extension/extensiontest/statuswatcher_extension_test.go index 14f9859e354..cee610795f1 100644 --- a/extension/extensiontest/statuswatcher_extension_test.go +++ b/extension/extensiontest/statuswatcher_extension_test.go @@ -11,14 +11,14 @@ import ( "github.com/stretchr/testify/require" "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/component/componentstatus" "go.opentelemetry.io/collector/component/componenttest" - "go.opentelemetry.io/collector/extension" ) func TestStatusWatcherExtension(t *testing.T) { statusChanged := false factory := NewStatusWatcherExtensionFactory( - func(*component.InstanceID, *component.StatusEvent) { + func(*componentstatus.InstanceID, *componentstatus.Event) { statusChanged = true }, ) @@ -32,7 +32,7 @@ func TestStatusWatcherExtension(t *testing.T) { assert.NoError(t, ext.Start(context.Background(), componenttest.NewNopHost())) assert.False(t, statusChanged) - ext.(extension.StatusWatcher).ComponentStatusChanged(&component.InstanceID{}, &component.StatusEvent{}) + ext.(componentstatus.Watcher).ComponentStatusChanged(&componentstatus.InstanceID{}, &componentstatus.Event{}) assert.True(t, statusChanged) assert.NoError(t, ext.Shutdown(context.Background())) diff --git a/extension/go.mod b/extension/go.mod index f52b45547d9..20d54e60067 100644 --- a/extension/go.mod +++ b/extension/go.mod @@ -1,12 +1,13 @@ module go.opentelemetry.io/collector/extension -go 1.21.0 +go 1.22.0 require ( github.com/google/uuid v1.6.0 github.com/stretchr/testify v1.9.0 - go.opentelemetry.io/collector/component v0.106.1 - go.opentelemetry.io/collector/confmap v0.106.1 + go.opentelemetry.io/collector/component v0.107.0 + go.opentelemetry.io/collector/component/componentstatus v0.107.0 + go.opentelemetry.io/collector/confmap v0.107.0 go.uber.org/goleak v1.3.0 ) @@ -16,9 +17,9 @@ require ( github.com/davecgh/go-spew v1.1.1 // indirect github.com/go-logr/logr v1.4.2 // indirect github.com/go-logr/stdr v1.2.2 // indirect - github.com/go-viper/mapstructure/v2 v2.0.0 // indirect + github.com/go-viper/mapstructure/v2 v2.1.0 // indirect github.com/gogo/protobuf v1.3.2 // indirect - github.com/hashicorp/go-version v1.7.0 // indirect + github.com/klauspost/compress v1.17.9 // 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 @@ -26,14 +27,12 @@ require ( github.com/mitchellh/reflectwalk 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_golang v1.20.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/config/configtelemetry v0.106.1 // indirect - go.opentelemetry.io/collector/featuregate v1.12.0 // indirect - go.opentelemetry.io/collector/internal/globalgates v0.106.1 // indirect - go.opentelemetry.io/collector/pdata v1.12.0 // indirect + go.opentelemetry.io/collector/config/configtelemetry v0.107.0 // indirect + go.opentelemetry.io/collector/pdata v1.13.0 // 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 @@ -43,7 +42,7 @@ require ( go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.27.0 // indirect golang.org/x/net v0.26.0 // indirect - golang.org/x/sys v0.21.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-20240528184218-531527333157 // indirect google.golang.org/grpc v1.65.0 // indirect @@ -59,6 +58,4 @@ replace go.opentelemetry.io/collector/pdata => ../pdata replace go.opentelemetry.io/collector/config/configtelemetry => ../config/configtelemetry -replace go.opentelemetry.io/collector/featuregate => ../featuregate - -replace go.opentelemetry.io/collector/internal/globalgates => ../internal/globalgates +replace go.opentelemetry.io/collector/component/componentstatus => ../component/componentstatus diff --git a/extension/go.sum b/extension/go.sum index dea0d23e1c9..c577176d803 100644 --- a/extension/go.sum +++ b/extension/go.sum @@ -9,18 +9,18 @@ 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/go-viper/mapstructure/v2 v2.1.0 h1:gHnMa2Y/pIxElCH2GlZZ1lZSsn6XMtufpGyP1XxdC/w= +github.com/go-viper/mapstructure/v2 v2.1.0/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/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/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/klauspost/compress v1.17.9 h1:6KIumPrER1LHsvBVuDa0r5xaG0Es51mhhB9BQB2qeMA= +github.com/klauspost/compress v1.17.9/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw= 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= @@ -31,6 +31,8 @@ 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/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= +github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= 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= @@ -39,8 +41,8 @@ github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq 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_golang v1.20.1 h1:IMJXHOD6eARkQpxo8KkhgEVFlBNm+nkrFUyGlIu7Na8= +github.com/prometheus/client_golang v1.20.1/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= 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= @@ -88,8 +90,8 @@ golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJ 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.21.0 h1:rF+pYz3DAGSQAxAu1CbC7catZg4ebC4UIeIhKxBZvws= -golang.org/x/sys v0.21.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +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= diff --git a/extension/memorylimiterextension/README.md b/extension/memorylimiterextension/README.md index 90f19a78a07..ab45eb8e840 100644 --- a/extension/memorylimiterextension/README.md +++ b/extension/memorylimiterextension/README.md @@ -8,7 +8,7 @@ | ------------- |-----------| | Stability | [development] | | Distributions | [] | -| Issues | [![Open issues](https://img.shields.io/github/issues-search/open-telemetry/opentelemetry-collector-contrib?query=is%3Aissue%20is%3Aopen%20label%3Aextension%2Fmemorylimiter%20&label=open&color=orange&logo=opentelemetry)](https://github.com/open-telemetry/opentelemetry-collector-contrib/issues?q=is%3Aopen+is%3Aissue+label%3Aextension%2Fmemorylimiter) [![Closed issues](https://img.shields.io/github/issues-search/open-telemetry/opentelemetry-collector-contrib?query=is%3Aissue%20is%3Aclosed%20label%3Aextension%2Fmemorylimiter%20&label=closed&color=blue&logo=opentelemetry)](https://github.com/open-telemetry/opentelemetry-collector-contrib/issues?q=is%3Aclosed+is%3Aissue+label%3Aextension%2Fmemorylimiter) | +| Issues | [![Open issues](https://img.shields.io/github/issues-search/open-telemetry/opentelemetry-collector?query=is%3Aissue%20is%3Aopen%20label%3Aextension%2Fmemorylimiter%20&label=open&color=orange&logo=opentelemetry)](https://github.com/open-telemetry/opentelemetry-collector/issues?q=is%3Aopen+is%3Aissue+label%3Aextension%2Fmemorylimiter) [![Closed issues](https://img.shields.io/github/issues-search/open-telemetry/opentelemetry-collector?query=is%3Aissue%20is%3Aclosed%20label%3Aextension%2Fmemorylimiter%20&label=closed&color=blue&logo=opentelemetry)](https://github.com/open-telemetry/opentelemetry-collector/issues?q=is%3Aclosed+is%3Aissue+label%3Aextension%2Fmemorylimiter) | [development]: https://github.com/open-telemetry/opentelemetry-collector#development diff --git a/extension/memorylimiterextension/go.mod b/extension/memorylimiterextension/go.mod index a3742b6668d..0bd297dee75 100644 --- a/extension/memorylimiterextension/go.mod +++ b/extension/memorylimiterextension/go.mod @@ -1,13 +1,13 @@ module go.opentelemetry.io/collector/extension/memorylimiterextension -go 1.21.0 +go 1.22.0 require ( github.com/stretchr/testify v1.9.0 - go.opentelemetry.io/collector v0.106.1 - go.opentelemetry.io/collector/component v0.106.1 - go.opentelemetry.io/collector/confmap v0.106.1 - go.opentelemetry.io/collector/extension v0.106.1 + go.opentelemetry.io/collector v0.107.0 + go.opentelemetry.io/collector/component v0.107.0 + go.opentelemetry.io/collector/confmap v0.107.0 + go.opentelemetry.io/collector/extension v0.107.0 go.uber.org/goleak v1.3.0 go.uber.org/zap v1.27.0 ) @@ -19,10 +19,10 @@ require ( github.com/go-logr/logr v1.4.2 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/go-ole/go-ole v1.2.6 // indirect - github.com/go-viper/mapstructure/v2 v2.0.0 // indirect + github.com/go-viper/mapstructure/v2 v2.1.0 // indirect github.com/gogo/protobuf v1.3.2 // indirect github.com/google/uuid v1.6.0 // indirect - github.com/hashicorp/go-version v1.7.0 // indirect + github.com/klauspost/compress v1.17.9 // 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 @@ -32,7 +32,7 @@ require ( github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c // indirect - github.com/prometheus/client_golang v1.19.1 // indirect + github.com/prometheus/client_golang v1.20.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 @@ -40,10 +40,9 @@ require ( github.com/tklauser/go-sysconf v0.3.12 // indirect github.com/tklauser/numcpus v0.6.1 // indirect github.com/yusufpapurcu/wmi v1.2.4 // indirect - go.opentelemetry.io/collector/config/configtelemetry v0.106.1 // indirect - go.opentelemetry.io/collector/featuregate v1.12.0 // indirect - go.opentelemetry.io/collector/internal/globalgates v0.106.1 // indirect - go.opentelemetry.io/collector/pdata v1.12.0 // indirect + go.opentelemetry.io/collector/component/componentstatus v0.107.0 // indirect + go.opentelemetry.io/collector/config/configtelemetry v0.107.0 // indirect + go.opentelemetry.io/collector/pdata v1.13.0 // 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 @@ -62,8 +61,6 @@ require ( replace go.opentelemetry.io/collector => ../../ -replace go.opentelemetry.io/collector/internal/globalgates => ../../internal/globalgates - replace go.opentelemetry.io/collector/component => ../../component replace go.opentelemetry.io/collector/confmap => ../../confmap @@ -85,3 +82,5 @@ replace go.opentelemetry.io/collector/pdata/pprofile => ../../pdata/pprofile replace go.opentelemetry.io/collector/consumer/consumerprofiles => ../../consumer/consumerprofiles replace go.opentelemetry.io/collector/consumer/consumertest => ../../consumer/consumertest + +replace go.opentelemetry.io/collector/component/componentstatus => ../../component/componentstatus diff --git a/extension/memorylimiterextension/go.sum b/extension/memorylimiterextension/go.sum index 2578d150a2c..1fdfccf9440 100644 --- a/extension/memorylimiterextension/go.sum +++ b/extension/memorylimiterextension/go.sum @@ -11,8 +11,8 @@ 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-ole/go-ole v1.2.6 h1:/Fpf6oFPoeFik9ty7siob0G6Ke8QvQEuVcuChpwXzpY= github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0= -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/go-viper/mapstructure/v2 v2.1.0 h1:gHnMa2Y/pIxElCH2GlZZ1lZSsn6XMtufpGyP1XxdC/w= +github.com/go-viper/mapstructure/v2 v2.1.0/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= @@ -20,10 +20,10 @@ 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/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/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/klauspost/compress v1.17.9 h1:6KIumPrER1LHsvBVuDa0r5xaG0Es51mhhB9BQB2qeMA= +github.com/klauspost/compress v1.17.9/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw= 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= @@ -34,6 +34,8 @@ 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/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= +github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 h1:6E+4a0GO5zZEnZ81pIr0yLvtUWk2if982qA3F3QD6H4= github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0/go.mod h1:zJYVVT2jmtg6P3p1VtQj7WsuWi/y4VnjVBn7F8KPB3I= github.com/mitchellh/copystructure v1.2.0 h1:vpKXTN4ewci03Vljg/q9QvCGUDttBOGBIa15WveJJGw= @@ -46,8 +48,8 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c h1:ncq/mPwQF4JjgDlrVEn3C11VoGHZN7m8qihwgMEtzYw= github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE= -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_golang v1.20.1 h1:IMJXHOD6eARkQpxo8KkhgEVFlBNm+nkrFUyGlIu7Na8= +github.com/prometheus/client_golang v1.20.1/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= 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= diff --git a/extension/memorylimiterextension/internal/metadata/generated_status.go b/extension/memorylimiterextension/internal/metadata/generated_status.go index 21472c5d5aa..d8e99a2bebc 100644 --- a/extension/memorylimiterextension/internal/metadata/generated_status.go +++ b/extension/memorylimiterextension/internal/metadata/generated_status.go @@ -7,7 +7,8 @@ import ( ) var ( - Type = component.MustNewType("memory_limiter") + Type = component.MustNewType("memory_limiter") + ScopeName = "go.opentelemetry.io/collector/extension/memorylimiterextension" ) const ( diff --git a/extension/memorylimiterextension/metadata.yaml b/extension/memorylimiterextension/metadata.yaml index 26cafc9b5ad..76835b00c5d 100644 --- a/extension/memorylimiterextension/metadata.yaml +++ b/extension/memorylimiterextension/metadata.yaml @@ -1,4 +1,5 @@ type: memory_limiter +github_project: open-telemetry/opentelemetry-collector status: class: extension diff --git a/extension/zpagesextension/README.md b/extension/zpagesextension/README.md index 357552e7513..60a5a5a1f25 100644 --- a/extension/zpagesextension/README.md +++ b/extension/zpagesextension/README.md @@ -5,7 +5,7 @@ | ------------- |-----------| | Stability | [beta] | | Distributions | [core], [contrib], [k8s] | -| Issues | [![Open issues](https://img.shields.io/github/issues-search/open-telemetry/opentelemetry-collector-contrib?query=is%3Aissue%20is%3Aopen%20label%3Aextension%2Fzpages%20&label=open&color=orange&logo=opentelemetry)](https://github.com/open-telemetry/opentelemetry-collector-contrib/issues?q=is%3Aopen+is%3Aissue+label%3Aextension%2Fzpages) [![Closed issues](https://img.shields.io/github/issues-search/open-telemetry/opentelemetry-collector-contrib?query=is%3Aissue%20is%3Aclosed%20label%3Aextension%2Fzpages%20&label=closed&color=blue&logo=opentelemetry)](https://github.com/open-telemetry/opentelemetry-collector-contrib/issues?q=is%3Aclosed+is%3Aissue+label%3Aextension%2Fzpages) | +| Issues | [![Open issues](https://img.shields.io/github/issues-search/open-telemetry/opentelemetry-collector?query=is%3Aissue%20is%3Aopen%20label%3Aextension%2Fzpages%20&label=open&color=orange&logo=opentelemetry)](https://github.com/open-telemetry/opentelemetry-collector/issues?q=is%3Aopen+is%3Aissue+label%3Aextension%2Fzpages) [![Closed issues](https://img.shields.io/github/issues-search/open-telemetry/opentelemetry-collector?query=is%3Aissue%20is%3Aclosed%20label%3Aextension%2Fzpages%20&label=closed&color=blue&logo=opentelemetry)](https://github.com/open-telemetry/opentelemetry-collector/issues?q=is%3Aclosed+is%3Aissue+label%3Aextension%2Fzpages) | [beta]: https://github.com/open-telemetry/opentelemetry-collector#beta [core]: https://github.com/open-telemetry/opentelemetry-collector-releases/tree/main/distributions/otelcol diff --git a/extension/zpagesextension/go.mod b/extension/zpagesextension/go.mod index 60b5c4595af..8269c4cb63b 100644 --- a/extension/zpagesextension/go.mod +++ b/extension/zpagesextension/go.mod @@ -1,15 +1,16 @@ module go.opentelemetry.io/collector/extension/zpagesextension -go 1.21.0 +go 1.22.0 require ( github.com/stretchr/testify v1.9.0 - go.opentelemetry.io/collector v0.106.1 - go.opentelemetry.io/collector/component v0.106.1 - go.opentelemetry.io/collector/config/configauth v0.106.1 - go.opentelemetry.io/collector/config/confighttp v0.106.1 - go.opentelemetry.io/collector/confmap v0.106.1 - go.opentelemetry.io/collector/extension v0.106.1 + go.opentelemetry.io/collector v0.107.0 + go.opentelemetry.io/collector/component v0.107.0 + go.opentelemetry.io/collector/component/componentstatus v0.107.0 + go.opentelemetry.io/collector/config/configauth v0.107.0 + go.opentelemetry.io/collector/config/confighttp v0.107.0 + go.opentelemetry.io/collector/confmap v0.107.0 + go.opentelemetry.io/collector/extension v0.107.0 go.opentelemetry.io/contrib/zpages v0.53.0 go.opentelemetry.io/otel/sdk v1.28.0 go.opentelemetry.io/otel/trace v1.28.0 @@ -26,7 +27,7 @@ require ( github.com/fsnotify/fsnotify v1.7.0 // 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/go-viper/mapstructure/v2 v2.1.0 // indirect github.com/gogo/protobuf v1.3.2 // indirect github.com/golang/snappy v0.0.4 // indirect github.com/google/uuid v1.6.0 // indirect @@ -40,21 +41,20 @@ require ( github.com/mitchellh/reflectwalk 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_golang v1.20.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 github.com/rs/cors v1.11.0 // indirect - go.opentelemetry.io/collector/client v0.106.1 // indirect - go.opentelemetry.io/collector/config/configcompression v1.12.0 // indirect - go.opentelemetry.io/collector/config/configopaque v1.12.0 // indirect - go.opentelemetry.io/collector/config/configtelemetry v0.106.1 // indirect - go.opentelemetry.io/collector/config/configtls v1.12.0 // indirect - go.opentelemetry.io/collector/config/internal v0.106.1 // indirect - go.opentelemetry.io/collector/extension/auth v0.106.1 // indirect - go.opentelemetry.io/collector/featuregate v1.12.0 // indirect - go.opentelemetry.io/collector/internal/globalgates v0.106.1 // indirect - go.opentelemetry.io/collector/pdata v1.12.0 // indirect + go.opentelemetry.io/collector/client v1.13.0 // indirect + go.opentelemetry.io/collector/config/configcompression v1.13.0 // indirect + go.opentelemetry.io/collector/config/configopaque v1.13.0 // indirect + go.opentelemetry.io/collector/config/configtelemetry v0.107.0 // indirect + go.opentelemetry.io/collector/config/configtls v1.13.0 // indirect + go.opentelemetry.io/collector/config/internal v0.107.0 // indirect + go.opentelemetry.io/collector/extension/auth v0.107.0 // indirect + go.opentelemetry.io/collector/featuregate v1.13.0 // indirect + go.opentelemetry.io/collector/pdata v1.13.0 // indirect go.opentelemetry.io/contrib/config v0.8.0 // indirect go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.53.0 // indirect go.opentelemetry.io/otel v1.28.0 // indirect @@ -122,10 +122,10 @@ replace go.opentelemetry.io/collector/config/confighttp => ../../config/confight replace go.opentelemetry.io/collector/pdata/pprofile => ../../pdata/pprofile -replace go.opentelemetry.io/collector/internal/globalgates => ../../internal/globalgates - replace go.opentelemetry.io/collector/consumer/consumerprofiles => ../../consumer/consumerprofiles replace go.opentelemetry.io/collector/consumer/consumertest => ../../consumer/consumertest replace go.opentelemetry.io/collector/client => ../../client + +replace go.opentelemetry.io/collector/component/componentstatus => ../../component/componentstatus diff --git a/extension/zpagesextension/go.sum b/extension/zpagesextension/go.sum index 90b6f8ec2d4..90db0ddfab5 100644 --- a/extension/zpagesextension/go.sum +++ b/extension/zpagesextension/go.sum @@ -15,8 +15,8 @@ github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY= github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= -github.com/go-viper/mapstructure/v2 v2.0.0 h1:dhn8MZ1gZ0mzeodTG3jt5Vj/o87xZKuNAprG2mQfMfc= -github.com/go-viper/mapstructure/v2 v2.0.0/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM= +github.com/go-viper/mapstructure/v2 v2.1.0 h1:gHnMa2Y/pIxElCH2GlZZ1lZSsn6XMtufpGyP1XxdC/w= +github.com/go-viper/mapstructure/v2 v2.1.0/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM= @@ -45,6 +45,8 @@ 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/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= +github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= 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= @@ -57,8 +59,8 @@ github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq 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_golang v1.20.1 h1:IMJXHOD6eARkQpxo8KkhgEVFlBNm+nkrFUyGlIu7Na8= +github.com/prometheus/client_golang v1.20.1/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= 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= diff --git a/extension/zpagesextension/internal/metadata/generated_status.go b/extension/zpagesextension/internal/metadata/generated_status.go index ee7c714b77a..cff3d7b0b2c 100644 --- a/extension/zpagesextension/internal/metadata/generated_status.go +++ b/extension/zpagesextension/internal/metadata/generated_status.go @@ -7,7 +7,8 @@ import ( ) var ( - Type = component.MustNewType("zpages") + Type = component.MustNewType("zpages") + ScopeName = "go.opentelemetry.io/collector/extension/zpagesextension" ) const ( diff --git a/extension/zpagesextension/metadata.yaml b/extension/zpagesextension/metadata.yaml index 13101e73964..8c379cb238a 100644 --- a/extension/zpagesextension/metadata.yaml +++ b/extension/zpagesextension/metadata.yaml @@ -1,4 +1,5 @@ type: zpages +github_project: open-telemetry/opentelemetry-collector status: class: extension diff --git a/extension/zpagesextension/zpagesextension.go b/extension/zpagesextension/zpagesextension.go index 16bb6c6635d..dc2cd3a7f27 100644 --- a/extension/zpagesextension/zpagesextension.go +++ b/extension/zpagesextension/zpagesextension.go @@ -14,6 +14,7 @@ import ( "go.uber.org/zap" "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/component/componentstatus" ) const ( @@ -83,7 +84,7 @@ func (zpe *zpagesExtension) Start(ctx context.Context, host component.Host) erro defer close(zpe.stopCh) if errHTTP := zpe.server.Serve(ln); errHTTP != nil && !errors.Is(errHTTP, http.ErrServerClosed) { - zpe.telemetry.ReportStatus(component.NewFatalErrorEvent(errHTTP)) + componentstatus.ReportStatus(host, componentstatus.NewFatalErrorEvent(errHTTP)) } }() diff --git a/featuregate/go.mod b/featuregate/go.mod index d84687e6d87..3d7395ac156 100644 --- a/featuregate/go.mod +++ b/featuregate/go.mod @@ -1,6 +1,6 @@ module go.opentelemetry.io/collector/featuregate -go 1.21.0 +go 1.22.0 require ( github.com/hashicorp/go-version v1.7.0 diff --git a/filter/go.mod b/filter/go.mod index 78c32ad90ec..1c4a286b4d2 100644 --- a/filter/go.mod +++ b/filter/go.mod @@ -1,31 +1,24 @@ module go.opentelemetry.io/collector/filter -go 1.21.0 +go 1.22.0 require ( github.com/stretchr/testify v1.9.0 - go.opentelemetry.io/collector/confmap v0.106.1 + go.opentelemetry.io/collector/confmap v0.107.0 ) require ( github.com/davecgh/go-spew v1.1.1 // indirect - github.com/go-viper/mapstructure/v2 v2.0.0 // indirect - github.com/hashicorp/go-version v1.7.0 // indirect + github.com/go-viper/mapstructure/v2 v2.1.0 // 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/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/collector/featuregate v1.12.0 // indirect - go.opentelemetry.io/collector/internal/globalgates v0.106.1 // indirect go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.27.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) replace go.opentelemetry.io/collector/confmap => ../confmap - -replace go.opentelemetry.io/collector/featuregate => ../featuregate - -replace go.opentelemetry.io/collector/internal/globalgates => ../internal/globalgates diff --git a/filter/go.sum b/filter/go.sum index 95211d58154..3a051879bb3 100644 --- a/filter/go.sum +++ b/filter/go.sum @@ -1,9 +1,7 @@ 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-viper/mapstructure/v2 v2.0.0 h1:dhn8MZ1gZ0mzeodTG3jt5Vj/o87xZKuNAprG2mQfMfc= -github.com/go-viper/mapstructure/v2 v2.0.0/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM= -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/go-viper/mapstructure/v2 v2.1.0 h1:gHnMa2Y/pIxElCH2GlZZ1lZSsn6XMtufpGyP1XxdC/w= +github.com/go-viper/mapstructure/v2 v2.1.0/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM= github.com/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= diff --git a/go.mod b/go.mod index 966a3906b7f..306fb680a67 100644 --- a/go.mod +++ b/go.mod @@ -8,18 +8,19 @@ module go.opentelemetry.io/collector // For the OpenTelemetry Collector Core distribution specifically, see // https://github.com/open-telemetry/opentelemetry-collector-releases/tree/main/distributions/otelcol -go 1.21.0 +go 1.22.0 require ( github.com/shirou/gopsutil/v4 v4.24.7 github.com/stretchr/testify v1.9.0 - go.opentelemetry.io/collector/component v0.106.1 - go.opentelemetry.io/collector/confmap v0.106.1 - go.opentelemetry.io/collector/consumer v0.106.1 - go.opentelemetry.io/collector/consumer/consumertest v0.106.1 - go.opentelemetry.io/collector/featuregate v1.12.0 - go.opentelemetry.io/collector/pdata v1.12.0 - go.opentelemetry.io/collector/pdata/testdata v0.106.1 + go.opentelemetry.io/collector/component v0.107.0 + go.opentelemetry.io/collector/component/componentstatus v0.107.0 + go.opentelemetry.io/collector/confmap v0.107.0 + go.opentelemetry.io/collector/consumer v0.107.0 + go.opentelemetry.io/collector/consumer/consumertest v0.107.0 + go.opentelemetry.io/collector/featuregate v1.13.0 + go.opentelemetry.io/collector/pdata v1.13.0 + go.opentelemetry.io/collector/pdata/testdata v0.107.0 go.opentelemetry.io/contrib/config v0.8.0 go.uber.org/goleak v1.3.0 go.uber.org/multierr v1.11.0 @@ -35,12 +36,13 @@ require ( github.com/go-logr/logr v1.4.2 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/go-ole/go-ole v1.2.6 // indirect - github.com/go-viper/mapstructure/v2 v2.0.0 // indirect + github.com/go-viper/mapstructure/v2 v2.1.0 // indirect github.com/gogo/protobuf v1.3.2 // indirect github.com/google/uuid v1.6.0 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.20.0 // indirect github.com/hashicorp/go-version v1.7.0 // indirect github.com/json-iterator/go v1.1.12 // indirect + github.com/klauspost/compress v1.17.9 // 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 @@ -52,17 +54,16 @@ require ( github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c // indirect - github.com/prometheus/client_golang v1.19.1 // indirect + github.com/prometheus/client_golang v1.20.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 github.com/tklauser/go-sysconf v0.3.12 // indirect github.com/tklauser/numcpus v0.6.1 // indirect github.com/yusufpapurcu/wmi v1.2.4 // indirect - go.opentelemetry.io/collector/config/configtelemetry v0.106.1 // indirect - go.opentelemetry.io/collector/consumer/consumerprofiles v0.106.1 // indirect - go.opentelemetry.io/collector/internal/globalgates v0.106.1 // indirect - go.opentelemetry.io/collector/pdata/pprofile v0.106.1 // indirect + go.opentelemetry.io/collector/config/configtelemetry v0.107.0 // indirect + go.opentelemetry.io/collector/consumer/consumerprofiles v0.107.0 // indirect + go.opentelemetry.io/collector/pdata/pprofile v0.107.0 // indirect go.opentelemetry.io/otel v1.28.0 // indirect go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp v0.4.0 // indirect go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.28.0 // indirect @@ -91,6 +92,8 @@ require ( replace go.opentelemetry.io/collector/component => ./component +replace go.opentelemetry.io/collector/component/componentstatus => ./component/componentstatus + replace go.opentelemetry.io/collector/confmap => ./confmap replace go.opentelemetry.io/collector/config/configtelemetry => ./config/configtelemetry @@ -115,6 +118,4 @@ retract ( replace go.opentelemetry.io/collector/pdata/pprofile => ./pdata/pprofile -replace go.opentelemetry.io/collector/internal/globalgates => ./internal/globalgates - replace go.opentelemetry.io/collector/consumer/consumerprofiles => ./consumer/consumerprofiles diff --git a/go.sum b/go.sum index c6a6090f5d4..dff343d79d9 100644 --- a/go.sum +++ b/go.sum @@ -14,8 +14,8 @@ 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-ole/go-ole v1.2.6 h1:/Fpf6oFPoeFik9ty7siob0G6Ke8QvQEuVcuChpwXzpY= github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0= -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/go-viper/mapstructure/v2 v2.1.0 h1:gHnMa2Y/pIxElCH2GlZZ1lZSsn6XMtufpGyP1XxdC/w= +github.com/go-viper/mapstructure/v2 v2.1.0/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= @@ -32,6 +32,8 @@ github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnr 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/klauspost/compress v1.17.9 h1:6KIumPrER1LHsvBVuDa0r5xaG0Es51mhhB9BQB2qeMA= +github.com/klauspost/compress v1.17.9/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw= 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= @@ -42,6 +44,8 @@ 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/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= +github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 h1:6E+4a0GO5zZEnZ81pIr0yLvtUWk2if982qA3F3QD6H4= github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0/go.mod h1:zJYVVT2jmtg6P3p1VtQj7WsuWi/y4VnjVBn7F8KPB3I= github.com/mitchellh/copystructure v1.2.0 h1:vpKXTN4ewci03Vljg/q9QvCGUDttBOGBIa15WveJJGw= @@ -59,8 +63,8 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c h1:ncq/mPwQF4JjgDlrVEn3C11VoGHZN7m8qihwgMEtzYw= github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE= -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_golang v1.20.1 h1:IMJXHOD6eARkQpxo8KkhgEVFlBNm+nkrFUyGlIu7Na8= +github.com/prometheus/client_golang v1.20.1/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= 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= diff --git a/internal/e2e/go.mod b/internal/e2e/go.mod index f6abea998b5..8de9d9ee92b 100644 --- a/internal/e2e/go.mod +++ b/internal/e2e/go.mod @@ -1,27 +1,33 @@ module go.opentelemetry.io/collector/internal/e2e -go 1.21.0 +go 1.22.0 require ( github.com/stretchr/testify v1.9.0 - go.opentelemetry.io/collector v0.106.1 - go.opentelemetry.io/collector/component v0.106.1 - go.opentelemetry.io/collector/config/configgrpc v0.106.1 - go.opentelemetry.io/collector/config/confighttp v0.106.1 - go.opentelemetry.io/collector/config/configopaque v1.12.0 - go.opentelemetry.io/collector/config/configretry v1.12.0 - go.opentelemetry.io/collector/config/configtls v1.12.0 - go.opentelemetry.io/collector/confmap v0.106.1 - go.opentelemetry.io/collector/consumer v0.106.1 - go.opentelemetry.io/collector/consumer/consumertest v0.106.1 - go.opentelemetry.io/collector/exporter v0.106.1 - go.opentelemetry.io/collector/exporter/otlpexporter v0.106.1 - go.opentelemetry.io/collector/exporter/otlphttpexporter v0.106.1 - go.opentelemetry.io/collector/pdata v1.12.0 - go.opentelemetry.io/collector/pdata/testdata v0.106.1 - go.opentelemetry.io/collector/receiver v0.106.1 - go.opentelemetry.io/collector/receiver/otlpreceiver v0.106.1 + go.opentelemetry.io/collector v0.107.0 + go.opentelemetry.io/collector/component v0.107.0 + go.opentelemetry.io/collector/component/componentstatus v0.107.0 + go.opentelemetry.io/collector/config/configgrpc v0.107.0 + go.opentelemetry.io/collector/config/confighttp v0.107.0 + go.opentelemetry.io/collector/config/configopaque v1.13.0 + go.opentelemetry.io/collector/config/configretry v1.13.0 + go.opentelemetry.io/collector/config/configtelemetry v0.107.0 + go.opentelemetry.io/collector/config/configtls v1.13.0 + go.opentelemetry.io/collector/confmap v0.107.0 + go.opentelemetry.io/collector/connector v0.107.0 + go.opentelemetry.io/collector/consumer v0.107.0 + go.opentelemetry.io/collector/consumer/consumertest v0.107.0 + go.opentelemetry.io/collector/exporter v0.107.0 + go.opentelemetry.io/collector/exporter/otlpexporter v0.107.0 + go.opentelemetry.io/collector/exporter/otlphttpexporter v0.107.0 + go.opentelemetry.io/collector/extension v0.107.0 + go.opentelemetry.io/collector/pdata v1.13.0 + go.opentelemetry.io/collector/pdata/testdata v0.107.0 + go.opentelemetry.io/collector/receiver v0.107.0 + go.opentelemetry.io/collector/receiver/otlpreceiver v0.107.0 + go.opentelemetry.io/collector/service v0.107.0 go.uber.org/goleak v1.3.0 + go.uber.org/zap v1.27.0 ) require ( @@ -33,7 +39,8 @@ require ( github.com/fsnotify/fsnotify v1.7.0 // 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/go-ole/go-ole v1.2.6 // indirect + github.com/go-viper/mapstructure/v2 v2.1.0 // indirect github.com/gogo/protobuf v1.3.2 // indirect github.com/golang/snappy v0.0.4 // indirect github.com/google/uuid v1.6.0 // indirect @@ -44,6 +51,7 @@ require ( 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/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 // 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 @@ -51,26 +59,34 @@ require ( github.com/mostynb/go-grpc-compression v1.2.3 // 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/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c // indirect + github.com/prometheus/client_golang v1.20.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 github.com/rs/cors v1.11.0 // indirect - go.opentelemetry.io/collector/client v0.106.1 // indirect - go.opentelemetry.io/collector/config/configauth v0.106.1 // indirect - go.opentelemetry.io/collector/config/configcompression v1.12.0 // indirect - go.opentelemetry.io/collector/config/confignet v0.106.1 // indirect - go.opentelemetry.io/collector/config/configtelemetry v0.106.1 // indirect - go.opentelemetry.io/collector/config/internal v0.106.1 // indirect - go.opentelemetry.io/collector/consumer/consumerprofiles v0.106.1 // indirect - go.opentelemetry.io/collector/extension v0.106.1 // indirect - go.opentelemetry.io/collector/extension/auth v0.106.1 // indirect - go.opentelemetry.io/collector/featuregate v1.12.0 // indirect - go.opentelemetry.io/collector/internal/globalgates v0.106.1 // indirect - go.opentelemetry.io/collector/pdata/pprofile v0.106.1 // indirect + github.com/shirou/gopsutil/v4 v4.24.7 // indirect + github.com/shoenig/go-m1cpu v0.1.6 // indirect + github.com/tklauser/go-sysconf v0.3.12 // indirect + github.com/tklauser/numcpus v0.6.1 // indirect + github.com/yusufpapurcu/wmi v1.2.4 // indirect + go.opentelemetry.io/collector/client v1.13.0 // indirect + go.opentelemetry.io/collector/component/componentprofiles v0.107.0 // indirect + go.opentelemetry.io/collector/config/configauth v0.107.0 // indirect + go.opentelemetry.io/collector/config/configcompression v1.13.0 // indirect + go.opentelemetry.io/collector/config/confignet v0.107.0 // indirect + go.opentelemetry.io/collector/config/internal v0.107.0 // indirect + go.opentelemetry.io/collector/consumer/consumerprofiles v0.107.0 // indirect + go.opentelemetry.io/collector/extension/auth v0.107.0 // indirect + go.opentelemetry.io/collector/featuregate v1.13.0 // indirect + go.opentelemetry.io/collector/internal/globalgates v0.107.0 // indirect + go.opentelemetry.io/collector/pdata/pprofile v0.107.0 // indirect + go.opentelemetry.io/collector/processor v0.107.0 // indirect + go.opentelemetry.io/collector/semconv v0.107.0 // indirect go.opentelemetry.io/contrib/config v0.8.0 // indirect go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.53.0 // indirect go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.53.0 // indirect + go.opentelemetry.io/contrib/propagators/b3 v1.28.0 // indirect go.opentelemetry.io/otel v1.28.0 // indirect go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp v0.4.0 // indirect go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.28.0 // indirect @@ -89,10 +105,10 @@ require ( go.opentelemetry.io/otel/trace v1.28.0 // indirect go.opentelemetry.io/proto/otlp v1.3.1 // indirect go.uber.org/multierr v1.11.0 // indirect - go.uber.org/zap v1.27.0 // indirect golang.org/x/net v0.28.0 // indirect - golang.org/x/sys v0.23.0 // indirect + golang.org/x/sys v0.24.0 // indirect golang.org/x/text v0.17.0 // indirect + gonum.org/v1/gonum v0.15.1 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20240701130421-f6361c86f094 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240701130421-f6361c86f094 // indirect google.golang.org/grpc v1.65.0 // indirect @@ -150,10 +166,24 @@ replace go.opentelemetry.io/collector/featuregate => ../../featuregate replace go.opentelemetry.io/collector/config/configtelemetry => ../../config/configtelemetry -replace go.opentelemetry.io/collector/internal/globalgates => ../globalgates - replace go.opentelemetry.io/collector/consumer/consumerprofiles => ../../consumer/consumerprofiles replace go.opentelemetry.io/collector/consumer/consumertest => ../../consumer/consumertest replace go.opentelemetry.io/collector/client => ../../client + +replace go.opentelemetry.io/collector/component/componentstatus => ../../component/componentstatus + +replace go.opentelemetry.io/collector/connector => ../../connector + +replace go.opentelemetry.io/collector/semconv => ../../semconv + +replace go.opentelemetry.io/collector/processor => ../../processor + +replace go.opentelemetry.io/collector/extension/zpagesextension => ../../extension/zpagesextension + +replace go.opentelemetry.io/collector/service => ../../service + +replace go.opentelemetry.io/collector/component/componentprofiles => ../../component/componentprofiles + +replace go.opentelemetry.io/collector/internal/globalgates => ../globalgates diff --git a/internal/e2e/go.sum b/internal/e2e/go.sum index ba98580b4fd..ce277011684 100644 --- a/internal/e2e/go.sum +++ b/internal/e2e/go.sum @@ -16,12 +16,15 @@ 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/go-ole/go-ole v1.2.6 h1:/Fpf6oFPoeFik9ty7siob0G6Ke8QvQEuVcuChpwXzpY= +github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0= +github.com/go-viper/mapstructure/v2 v2.1.0 h1:gHnMa2Y/pIxElCH2GlZZ1lZSsn6XMtufpGyP1XxdC/w= +github.com/go-viper/mapstructure/v2 v2.1.0/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM= github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= @@ -47,6 +50,10 @@ 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/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= +github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= +github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 h1:6E+4a0GO5zZEnZ81pIr0yLvtUWk2if982qA3F3QD6H4= +github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0/go.mod h1:zJYVVT2jmtg6P3p1VtQj7WsuWi/y4VnjVBn7F8KPB3I= 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= @@ -62,8 +69,10 @@ github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq 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/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c h1:ncq/mPwQF4JjgDlrVEn3C11VoGHZN7m8qihwgMEtzYw= +github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE= +github.com/prometheus/client_golang v1.20.1 h1:IMJXHOD6eARkQpxo8KkhgEVFlBNm+nkrFUyGlIu7Na8= +github.com/prometheus/client_golang v1.20.1/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= 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= @@ -74,18 +83,34 @@ github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4= github.com/rs/cors v1.11.0 h1:0B9GE/r9Bc2UxRMMtymBkHTenPkHDv0CW4Y98GBY+po= github.com/rs/cors v1.11.0/go.mod h1:XyqrcTp5zjWr1wsJ8PIRZssZ8b/WMcMf71DJnit4EMU= +github.com/shirou/gopsutil/v4 v4.24.7 h1:V9UGTK4gQ8HvcnPKf6Zt3XHyQq/peaekfxpJ2HSocJk= +github.com/shirou/gopsutil/v4 v4.24.7/go.mod h1:0uW/073rP7FYLOkvxolUQM5rMOLTNmRXnFKafpb71rw= +github.com/shoenig/go-m1cpu v0.1.6 h1:nxdKQNcEB6vzgA2E2bvzKIYRuNj7XNJ4S/aRSwKzFtM= +github.com/shoenig/go-m1cpu v0.1.6/go.mod h1:1JJMcUBvfNwpq05QDQVAnx3gUHr9IYF7GNg9SUEw2VQ= +github.com/shoenig/test v0.6.4 h1:kVTaSd7WLz5WZ2IaoM0RSzRsUD+m8wRR+5qvntpn4LU= +github.com/shoenig/test v0.6.4/go.mod h1:byHiCGXqrVaflBLAMq/srcZIHynQPQgeyvkvXnjqq0k= 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/tklauser/go-sysconf v0.3.12 h1:0QaGUFOdQaIVdPgfITYzaTegZvdCjmYO52cSFAEVmqU= +github.com/tklauser/go-sysconf v0.3.12/go.mod h1:Ho14jnntGE1fpdOqQEEaiKRpvIavV0hSfmBq8nJbHYI= +github.com/tklauser/numcpus v0.6.1 h1:ng9scYS7az0Bk4OZLvrNXNSAO2Pxr1XXRAPyjhIx+Fk= +github.com/tklauser/numcpus v0.6.1/go.mod h1:1XfjsgE2zo8GVw7POkMbHENHzVg3GzmoZ9fESEdAacY= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yusufpapurcu/wmi v1.2.4 h1:zFUKzehAFReQwLys1b/iSMl+JQGSCSjtVqQn9bBrPo0= +github.com/yusufpapurcu/wmi v1.2.4/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0= go.opentelemetry.io/contrib/config v0.8.0 h1:OD7aDMhL+2EpzdSHfkDmcdD/uUA+PgKM5faFyF9XFT0= go.opentelemetry.io/contrib/config v0.8.0/go.mod h1:dGeVZWE//3wrxYHHP0iCBYJU1QmOmPcbV+FNB7pjDYI= go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.53.0 h1:9G6E0TXzGFVfTnawRzrPl83iHOAV7L8NJiR8RSGYV1g= go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.53.0/go.mod h1:azvtTADFQJA8mX80jIH/akaE7h+dbm/sVuaHqN13w74= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.53.0 h1:4K4tsIXefpVJtvA/8srF4V4y0akAoPHkIslgAkjixJA= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.53.0/go.mod h1:jjdQuTGVsXV4vSs+CJ2qYDeDPf9yIJV23qlIzBm73Vg= +go.opentelemetry.io/contrib/propagators/b3 v1.28.0 h1:XR6CFQrQ/ttAYmTBX2loUEFGdk1h17pxYI8828dk/1Y= +go.opentelemetry.io/contrib/propagators/b3 v1.28.0/go.mod h1:DWRkzJONLquRz7OJPh2rRbZ7MugQj62rk7g6HRnEqh0= +go.opentelemetry.io/contrib/zpages v0.53.0 h1:hGgaJ3nrescxEk383gOBHA5gNfoquHs8oV/XcKYxJkw= +go.opentelemetry.io/contrib/zpages v0.53.0/go.mod h1:iOo8fpUxMAu5+4x9DSEQeUOCeY19KaN6v2OPSeIggz4= 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/otlp/otlplog/otlploghttp v0.4.0 h1:zBPZAISA9NOc5cE8zydqDiS0itvg/P/0Hn9m72a5gvM= @@ -129,6 +154,8 @@ 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/exp v0.0.0-20231110203233-9a3e6036ecaa h1:FRnLl4eNAQl8hwxVVC17teOw8kdjVDVAiFMtgUdTSRQ= +golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa/go.mod h1:zk2irFbV9DP96SEBUUAy67IdHUaZuSnrz1n472HUCLE= 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= @@ -142,9 +169,13 @@ golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJ 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-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.23.0 h1:YfKFowiIMvtgl1UERQoTPPToxltDeZfbj4H7dVUCwmM= -golang.org/x/sys v0.23.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.0.0-20201204225414-ed752295db88/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.24.0 h1:Twjiwq9dn6R1fQcyiK+wQyHWfaz/BJB+YIpzU/Cv3Xg= +golang.org/x/sys v0.24.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.17.0 h1:XtiM5bkSOt+ewxlOE/aE/AKEHibwj/6gvWMl9Rsh0Qc= @@ -157,6 +188,8 @@ golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8T 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= +gonum.org/v1/gonum v0.15.1 h1:FNy7N6OUZVUaWG9pTiD+jlhdQ3lMP+/LcTpJ6+a8sQ0= +gonum.org/v1/gonum v0.15.1/go.mod h1:eZTZuRFrzu5pcyjN5wJhcIhnUdNijYxX1T2IcrOGY0o= google.golang.org/genproto/googleapis/api v0.0.0-20240701130421-f6361c86f094 h1:0+ozOGcrp+Y8Aq8TLNN2Aliibms5LEzsq99ZZmAGYm0= google.golang.org/genproto/googleapis/api v0.0.0-20240701130421-f6361c86f094/go.mod h1:fJ/e3If/Q67Mj99hin0hMhiNyCRmt6BQ2aWIJshUSJw= google.golang.org/genproto/googleapis/rpc v0.0.0-20240701130421-f6361c86f094 h1:BwIjyKYGsK9dMCBOorzRri8MQwmi7mT9rGHsCEinZkA= diff --git a/internal/e2e/status_test.go b/internal/e2e/status_test.go new file mode 100644 index 00000000000..25e0c52a3e3 --- /dev/null +++ b/internal/e2e/status_test.go @@ -0,0 +1,281 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package e2e + +import ( + "context" + "errors" + "testing" + "time" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "go.uber.org/zap/zapcore" + + "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/component/componentstatus" + "go.opentelemetry.io/collector/config/configtelemetry" + "go.opentelemetry.io/collector/confmap" + "go.opentelemetry.io/collector/connector" + "go.opentelemetry.io/collector/connector/connectortest" + "go.opentelemetry.io/collector/consumer" + "go.opentelemetry.io/collector/exporter" + "go.opentelemetry.io/collector/exporter/exportertest" + "go.opentelemetry.io/collector/extension" + "go.opentelemetry.io/collector/internal/sharedcomponent" + "go.opentelemetry.io/collector/receiver" + "go.opentelemetry.io/collector/service" + "go.opentelemetry.io/collector/service/extensions" + "go.opentelemetry.io/collector/service/pipelines" + "go.opentelemetry.io/collector/service/telemetry" +) + +var nopType = component.MustNewType("nop") + +func Test_ComponentStatusReporting_SharedInstance(t *testing.T) { + eventsReceived := make(map[*componentstatus.InstanceID][]*componentstatus.Event) + exporterFactory := exportertest.NewNopFactory() + connectorFactory := connectortest.NewNopFactory() + // Use a different ID than receivertest and exportertest to avoid ambiguous + // configuration scenarios. Ambiguous IDs are detected in the 'otelcol' package, + // but lower level packages such as 'service' assume that IDs are disambiguated. + connID := component.NewIDWithName(nopType, "conn") + + set := service.Settings{ + BuildInfo: component.NewDefaultBuildInfo(), + CollectorConf: confmap.New(), + ReceiversConfigs: map[component.ID]component.Config{ + component.NewID(component.MustNewType("test")): &receiverConfig{}, + }, + ReceiversFactories: map[component.Type]receiver.Factory{ + component.MustNewType("test"): newReceiverFactory(), + }, + ExportersConfigs: map[component.ID]component.Config{ + component.NewID(nopType): exporterFactory.CreateDefaultConfig(), + }, + ExportersFactories: map[component.Type]exporter.Factory{ + nopType: exporterFactory, + }, + ConnectorsConfigs: map[component.ID]component.Config{ + connID: connectorFactory.CreateDefaultConfig(), + }, + ConnectorsFactories: map[component.Type]connector.Factory{ + nopType: connectorFactory, + }, + ExtensionsConfigs: map[component.ID]component.Config{ + component.NewID(component.MustNewType("watcher")): &extensionConfig{eventsReceived}, + }, + ExtensionsFactories: map[component.Type]extension.Factory{ + component.MustNewType("watcher"): newExtensionFactory(), + }, + } + set.BuildInfo = component.BuildInfo{Version: "test version", Command: "otelcoltest"} + + cfg := service.Config{ + Telemetry: telemetry.Config{ + Logs: telemetry.LogsConfig{ + Level: zapcore.InfoLevel, + Development: false, + Encoding: "console", + Sampling: &telemetry.LogsSamplingConfig{ + Enabled: true, + Tick: 10 * time.Second, + Initial: 100, + Thereafter: 100, + }, + OutputPaths: []string{"stderr"}, + ErrorOutputPaths: []string{"stderr"}, + DisableCaller: false, + DisableStacktrace: false, + InitialFields: map[string]any(nil), + }, + Metrics: telemetry.MetricsConfig{ + Level: configtelemetry.LevelNone, + }, + }, + Pipelines: pipelines.Config{ + component.MustNewID("traces"): { + Receivers: []component.ID{component.NewID(component.MustNewType("test"))}, + Exporters: []component.ID{component.NewID(nopType)}, + }, + component.MustNewID("metrics"): { + Receivers: []component.ID{component.NewID(component.MustNewType("test"))}, + Exporters: []component.ID{component.NewID(nopType)}, + }, + }, + Extensions: extensions.Config{component.NewID(component.MustNewType("watcher"))}, + } + + s, err := service.New(context.Background(), set, cfg) + require.NoError(t, err) + + err = s.Start(context.Background()) + require.NoError(t, err) + time.Sleep(15 * time.Second) + err = s.Shutdown(context.Background()) + require.NoError(t, err) + + assert.Equal(t, 5, len(eventsReceived)) + + for instanceID, events := range eventsReceived { + if instanceID.ComponentID() == component.NewID(component.MustNewType("test")) { + for i, e := range events { + if i == 0 { + assert.Equal(t, componentstatus.StatusStarting, e.Status()) + } + if i == 1 { + assert.Equal(t, componentstatus.StatusRecoverableError, e.Status()) + } + if i == 2 { + assert.Equal(t, componentstatus.StatusOK, e.Status()) + } + if i == 3 { + assert.Equal(t, componentstatus.StatusStopping, e.Status()) + } + if i == 4 { + assert.Equal(t, componentstatus.StatusStopped, e.Status()) + } + if i >= 5 { + assert.Fail(t, "received too many events") + } + } + } + } +} + +func newReceiverFactory() receiver.Factory { + return receiver.NewFactory( + component.MustNewType("test"), + createDefaultReceiverConfig, + receiver.WithTraces(createTraces, component.StabilityLevelStable), + receiver.WithMetrics(createMetrics, component.StabilityLevelStable), + ) +} + +type testReceiver struct{} + +func (t *testReceiver) Start(_ context.Context, host component.Host) error { + if statusReporter, ok := host.(componentstatus.Reporter); ok { + statusReporter.Report(componentstatus.NewRecoverableErrorEvent(errors.New("test recoverable error"))) + go func() { + statusReporter.Report(componentstatus.NewEvent(componentstatus.StatusOK)) + }() + } + return nil +} + +func (t *testReceiver) Shutdown(_ context.Context) error { + return nil +} + +type receiverConfig struct{} + +func createDefaultReceiverConfig() component.Config { + return &receiverConfig{} +} + +func createTraces( + _ context.Context, + set receiver.Settings, + cfg component.Config, + _ consumer.Traces, +) (receiver.Traces, error) { + oCfg := cfg.(*receiverConfig) + r, err := receivers.LoadOrStore( + oCfg, + func() (*testReceiver, error) { + return &testReceiver{}, nil + }, + &set.TelemetrySettings, + ) + if err != nil { + return nil, err + } + + return r, nil +} + +func createMetrics( + _ context.Context, + set receiver.Settings, + cfg component.Config, + _ consumer.Metrics, +) (receiver.Metrics, error) { + oCfg := cfg.(*receiverConfig) + r, err := receivers.LoadOrStore( + oCfg, + func() (*testReceiver, error) { + return &testReceiver{}, nil + }, + &set.TelemetrySettings, + ) + if err != nil { + return nil, err + } + + return r, nil +} + +var receivers = sharedcomponent.NewMap[*receiverConfig, *testReceiver]() + +func newExtensionFactory() extension.Factory { + return extension.NewFactory( + component.MustNewType("watcher"), + createDefaultExtensionConfig, + createExtension, + component.StabilityLevelStable, + ) +} + +func createExtension(_ context.Context, _ extension.Settings, cfg component.Config) (extension.Extension, error) { + oCfg := cfg.(*extensionConfig) + return &testExtension{ + eventsReceived: oCfg.eventsReceived, + }, nil +} + +type testExtension struct { + eventsReceived map[*componentstatus.InstanceID][]*componentstatus.Event +} + +type extensionConfig struct { + eventsReceived map[*componentstatus.InstanceID][]*componentstatus.Event +} + +func createDefaultExtensionConfig() component.Config { + return &extensionConfig{} +} + +// Start implements the component.Component interface. +func (t *testExtension) Start(_ context.Context, _ component.Host) error { + return nil +} + +// Shutdown implements the component.Component interface. +func (t *testExtension) Shutdown(_ context.Context) error { + return nil +} + +// ComponentStatusChanged implements the extension.StatusWatcher interface. +func (t *testExtension) ComponentStatusChanged( + source *componentstatus.InstanceID, + event *componentstatus.Event, +) { + t.eventsReceived[source] = append(t.eventsReceived[source], event) +} + +// NotifyConfig implements the extension.ConfigWatcher interface. +func (t *testExtension) NotifyConfig(_ context.Context, _ *confmap.Conf) error { + return nil +} + +// Ready implements the extension.PipelineWatcher interface. +func (t *testExtension) Ready() error { + return nil +} + +// NotReady implements the extension.PipelineWatcher interface. +func (t *testExtension) NotReady() error { + return nil +} diff --git a/internal/globalgates/globalgates.go b/internal/globalgates/globalgates.go index 346bd2d64fd..146b13c9b93 100644 --- a/internal/globalgates/globalgates.go +++ b/internal/globalgates/globalgates.go @@ -13,9 +13,10 @@ var UseUnifiedEnvVarExpansionRules = featuregate.GlobalRegistry().MustRegister(" const StrictlyTypedInputID = "confmap.strictlyTypedInput" -var StrictlyTypedInputGate = featuregate.GlobalRegistry().MustRegister(StrictlyTypedInputID, - featuregate.StageBeta, +var _ = featuregate.GlobalRegistry().MustRegister(StrictlyTypedInputID, + featuregate.StageStable, featuregate.WithRegisterFromVersion("v0.103.0"), + featuregate.WithRegisterToVersion("v0.109.0"), featuregate.WithRegisterDescription("Makes type casting rules during configuration unmarshaling stricter. See https://github.com/open-telemetry/opentelemetry-collector/blob/main/docs/rfcs/env-vars.md for more details."), ) @@ -24,3 +25,8 @@ var DisableOpenCensusBridge = featuregate.GlobalRegistry().MustRegister("service featuregate.WithRegisterFromVersion("v0.105.0"), featuregate.WithRegisterToVersion("v0.109.0"), featuregate.WithRegisterDescription("`Disables the OpenCensus bridge meaning any component still using the OpenCensus SDK will no longer be able to produce telemetry.")) + +var NoopTracerProvider = featuregate.GlobalRegistry().MustRegister("service.noopTracerProvider", + featuregate.StageAlpha, + featuregate.WithRegisterFromVersion("v0.107.0"), + featuregate.WithRegisterDescription("Sets a Noop OpenTelemetry TracerProvider to reduce memory allocations. This featuregate is incompatible with the zPages extension.")) diff --git a/internal/globalgates/go.mod b/internal/globalgates/go.mod index 2b20de252d3..7f2ff458350 100644 --- a/internal/globalgates/go.mod +++ b/internal/globalgates/go.mod @@ -1,8 +1,8 @@ module go.opentelemetry.io/collector/internal/globalgates -go 1.21.0 +go 1.22.0 -require go.opentelemetry.io/collector/featuregate v1.12.0 +require go.opentelemetry.io/collector/featuregate v1.13.0 require ( github.com/hashicorp/go-version v1.7.0 // indirect diff --git a/internal/memorylimiter/config_test.go b/internal/memorylimiter/config_test.go index 032f4798988..2d5a08aebe3 100644 --- a/internal/memorylimiter/config_test.go +++ b/internal/memorylimiter/config_test.go @@ -99,6 +99,6 @@ func TestUnmarshalInvalidConfig(t *testing.T) { cfg := &Config{} err = cm.Unmarshal(&cfg) require.Error(t, err) - require.Contains(t, err.Error(), "error decoding 'limit_mib': cannot convert negative value -2000 to an unsigned integer") - require.Contains(t, err.Error(), "error decoding 'spike_limit_mib': cannot convert negative value -2300 to an unsigned integer") + require.Contains(t, err.Error(), "cannot parse 'limit_mib', -2000 overflows uint") + require.Contains(t, err.Error(), "cannot parse 'spike_limit_mib', -2300 overflows uint") } diff --git a/internal/sharedcomponent/sharedcomponent.go b/internal/sharedcomponent/sharedcomponent.go index 1a3e65878c2..f9c8193c6ff 100644 --- a/internal/sharedcomponent/sharedcomponent.go +++ b/internal/sharedcomponent/sharedcomponent.go @@ -8,9 +8,11 @@ package sharedcomponent // import "go.opentelemetry.io/collector/internal/shared import ( "context" + "slices" "sync" "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/component/componentstatus" ) func NewMap[K comparable, V component.Component]() *Map[K, V] { @@ -31,17 +33,6 @@ func (m *Map[K, V]) LoadOrStore(key K, create func() (V, error), telemetrySettin m.lock.Lock() defer m.lock.Unlock() if c, ok := m.components[key]; ok { - // If we haven't already seen this telemetry settings, this shared component represents - // another instance. Wrap ReportStatus to report for all instances this shared - // component represents. - if _, ok := c.seenSettings[telemetrySettings]; !ok { - c.seenSettings[telemetrySettings] = struct{}{} - prev := c.telemetry.ReportStatus - c.telemetry.ReportStatus = func(ev *component.StatusEvent) { - telemetrySettings.ReportStatus(ev) - prev(ev) - } - } return c, nil } comp, err := create() @@ -57,9 +48,6 @@ func (m *Map[K, V]) LoadOrStore(key K, create func() (V, error), telemetrySettin delete(m.components, key) }, telemetry: telemetrySettings, - seenSettings: map[*component.TelemetrySettings]struct{}{ - telemetrySettings: {}, - }, } m.components[key] = newComp return newComp, nil @@ -74,8 +62,9 @@ type Component[V component.Component] struct { stopOnce sync.Once removeFunc func() - telemetry *component.TelemetrySettings - seenSettings map[*component.TelemetrySettings]struct{} + telemetry *component.TelemetrySettings + + hostWrapper *hostWrapper } // Unwrap returns the original component. @@ -85,18 +74,76 @@ func (c *Component[V]) Unwrap() V { // Start starts the underlying component if it never started before. func (c *Component[V]) Start(ctx context.Context, host component.Host) error { - var err error - c.startOnce.Do(func() { - // It's important that status for a shared component is reported through its - // telemetry settings to keep status in sync and avoid race conditions. This logic duplicates - // and takes priority over the automated status reporting that happens in graph, making the - // status reporting in graph a no-op. - c.telemetry.ReportStatus(component.NewStatusEvent(component.StatusStarting)) - if err = c.component.Start(ctx, host); err != nil { - c.telemetry.ReportStatus(component.NewPermanentErrorEvent(err)) - } - }) - return err + if c.hostWrapper == nil { + var err error + c.startOnce.Do(func() { + c.hostWrapper = &hostWrapper{ + host: host, + sources: make([]componentstatus.Reporter, 0), + previousEvents: make([]*componentstatus.Event, 0), + } + statusReporter, isStatusReporter := host.(componentstatus.Reporter) + if isStatusReporter { + c.hostWrapper.addSource(statusReporter) + } + + // It's important that status for a shared component is reported through its + // telemetry settings to keep status in sync and avoid race conditions. This logic duplicates + // and takes priority over the automated status reporting that happens in graph, making the + // status reporting in graph a no-op. + c.hostWrapper.Report(componentstatus.NewEvent(componentstatus.StatusStarting)) + if err = c.component.Start(ctx, c.hostWrapper); err != nil { + c.hostWrapper.Report(componentstatus.NewPermanentErrorEvent(err)) + } + }) + return err + } + statusReporter, isStatusReporter := host.(componentstatus.Reporter) + if isStatusReporter { + c.hostWrapper.addSource(statusReporter) + } + return nil +} + +var _ component.Host = (*hostWrapper)(nil) +var _ componentstatus.Reporter = (*hostWrapper)(nil) + +type hostWrapper struct { + host component.Host + sources []componentstatus.Reporter + previousEvents []*componentstatus.Event + lock sync.Mutex +} + +func (h *hostWrapper) GetExtensions() map[component.ID]component.Component { + return h.host.GetExtensions() +} + +func (h *hostWrapper) Report(e *componentstatus.Event) { + // Only remember an event if it will be emitted and it has not been sent already. + h.lock.Lock() + if len(h.sources) > 0 && !slices.Contains(h.previousEvents, e) { + h.previousEvents = append(h.previousEvents, e) + } + h.lock.Unlock() + + h.lock.Lock() + for _, s := range h.sources { + s.Report(e) + } + h.lock.Unlock() +} + +func (h *hostWrapper) addSource(s componentstatus.Reporter) { + h.lock.Lock() + for _, e := range h.previousEvents { + s.Report(e) + } + h.lock.Unlock() + + h.lock.Lock() + h.sources = append(h.sources, s) + h.lock.Unlock() } // Shutdown shuts down the underlying component. @@ -107,12 +154,16 @@ func (c *Component[V]) Shutdown(ctx context.Context) error { // telemetry settings to keep status in sync and avoid race conditions. This logic duplicates // and takes priority over the automated status reporting that happens in graph, making the // status reporting in graph a no-op. - c.telemetry.ReportStatus(component.NewStatusEvent(component.StatusStopping)) + if c.hostWrapper != nil { + c.hostWrapper.Report(componentstatus.NewEvent(componentstatus.StatusStopping)) + } err = c.component.Shutdown(ctx) - if err != nil { - c.telemetry.ReportStatus(component.NewPermanentErrorEvent(err)) - } else { - c.telemetry.ReportStatus(component.NewStatusEvent(component.StatusStopped)) + if c.hostWrapper != nil { + if err != nil { + c.hostWrapper.Report(componentstatus.NewPermanentErrorEvent(err)) + } else { + c.hostWrapper.Report(componentstatus.NewEvent(componentstatus.StatusStopped)) + } } c.removeFunc() }) diff --git a/internal/sharedcomponent/sharedcomponent_test.go b/internal/sharedcomponent/sharedcomponent_test.go index 77cda5124db..08841a62479 100644 --- a/internal/sharedcomponent/sharedcomponent_test.go +++ b/internal/sharedcomponent/sharedcomponent_test.go @@ -12,6 +12,7 @@ import ( "github.com/stretchr/testify/require" "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/component/componentstatus" "go.opentelemetry.io/collector/component/componenttest" ) @@ -107,123 +108,53 @@ func TestSharedComponent(t *testing.T) { assert.NoError(t, got.Shutdown(context.Background())) assert.Equal(t, 1, calledStop) } -func TestSharedComponentsReportStatus(t *testing.T) { - reportedStatuses := make(map[*component.InstanceID][]component.Status) - newStatusFunc := func() func(*component.StatusEvent) { - instanceID := &component.InstanceID{} - return func(ev *component.StatusEvent) { - if ev.Status() == component.StatusNone { - return - } - reportedStatuses[instanceID] = append(reportedStatuses[instanceID], ev.Status()) - } - } - - comp := &baseComponent{} - comps := NewMap[component.ID, *baseComponent]() - var telemetrySettings *component.TelemetrySettings - - // make a shared component that represents three instances - for i := 0; i < 3; i++ { - telemetrySettings = newNopTelemetrySettings() - telemetrySettings.ReportStatus = newStatusFunc() - // The initial settings for the shared component need to match the ones passed to the first - // invocation of LoadOrStore so that underlying telemetry settings reference can be used to - // wrap ReportStatus for subsequently added "instances". - if i == 0 { - comp.telemetry = telemetrySettings - } - got, err := comps.LoadOrStore( - id, - func() (*baseComponent, error) { return comp, nil }, - telemetrySettings, - ) - require.NoError(t, err) - assert.Len(t, comps.components, 1) - assert.Same(t, comp, got.Unwrap()) - } - - // make sure we don't try to represent a fourth instance if we reuse a telemetrySettings - _, _ = comps.LoadOrStore( - id, - func() (*baseComponent, error) { return comp, nil }, - telemetrySettings, - ) - - comp.telemetry.ReportStatus(component.NewStatusEvent(component.StatusStarting)) - - comp.telemetry.ReportStatus(component.NewStatusEvent(component.StatusOK)) - - // simulate an error - comp.telemetry.ReportStatus(component.NewStatusEvent(component.StatusNone)) - - // stopping - comp.telemetry.ReportStatus(component.NewStatusEvent(component.StatusStopping)) - - // stopped - comp.telemetry.ReportStatus(component.NewStatusEvent(component.StatusStopped)) - - // The shared component represents 3 component instances. Reporting status for the shared - // component should report status for each of the instances it represents. - expectedStatuses := []component.Status{ - component.StatusStarting, - component.StatusOK, - component.StatusStopping, - component.StatusStopped, - } - - require.Equal(t, 3, len(reportedStatuses)) - - for _, actualStatuses := range reportedStatuses { - require.Equal(t, expectedStatuses, actualStatuses) - } -} func TestReportStatusOnStartShutdown(t *testing.T) { for _, tc := range []struct { - name string - startErr error - shutdownErr error - expectedStatuses []component.Status + name string + startErr error + shutdownErr error + expectedStatuses []componentstatus.Status + expectedNumReporterInstances int }{ { name: "successful start/stop", startErr: nil, shutdownErr: nil, - expectedStatuses: []component.Status{ - component.StatusStarting, - component.StatusOK, - component.StatusStopping, - component.StatusStopped, + expectedStatuses: []componentstatus.Status{ + componentstatus.StatusStarting, + componentstatus.StatusOK, + componentstatus.StatusStopping, + componentstatus.StatusStopped, }, + expectedNumReporterInstances: 3, }, { name: "start error", startErr: assert.AnError, shutdownErr: nil, - expectedStatuses: []component.Status{ - component.StatusStarting, - component.StatusPermanentError, + expectedStatuses: []componentstatus.Status{ + componentstatus.StatusStarting, + componentstatus.StatusPermanentError, }, + expectedNumReporterInstances: 1, }, { name: "shutdown error", shutdownErr: assert.AnError, - expectedStatuses: []component.Status{ - component.StatusStarting, - component.StatusOK, - component.StatusStopping, - component.StatusPermanentError, + expectedStatuses: []componentstatus.Status{ + componentstatus.StatusStarting, + componentstatus.StatusOK, + componentstatus.StatusStopping, + componentstatus.StatusPermanentError, }, + expectedNumReporterInstances: 3, }, } { t.Run(tc.name, func(t *testing.T) { - reportedStatuses := make(map[*component.InstanceID][]component.Status) - newStatusFunc := func() func(*component.StatusEvent) { - instanceID := &component.InstanceID{} - return func(ev *component.StatusEvent) { - reportedStatuses[instanceID] = append(reportedStatuses[instanceID], ev.Status()) - } + reportedStatuses := make(map[*componentstatus.InstanceID][]componentstatus.Status) + newStatusFunc := func(id *componentstatus.InstanceID, ev *componentstatus.Event) { + reportedStatuses[id] = append(reportedStatuses[id], ev.Status()) } base := &baseComponent{} if tc.startErr != nil { @@ -241,7 +172,6 @@ func TestReportStatusOnStartShutdown(t *testing.T) { var err error for i := 0; i < 3; i++ { telemetrySettings := newNopTelemetrySettings() - telemetrySettings.ReportStatus = newStatusFunc() if i == 0 { base.telemetry = telemetrySettings } @@ -253,17 +183,24 @@ func TestReportStatusOnStartShutdown(t *testing.T) { require.NoError(t, err) } - err = comp.Start(context.Background(), componenttest.NewNopHost()) + baseHost := componenttest.NewNopHost() + for i := 0; i < 3; i++ { + err = comp.Start(context.Background(), &testHost{Host: baseHost, InstanceID: &componentstatus.InstanceID{}, newStatusFunc: newStatusFunc}) + if err != nil { + break + } + } + require.Equal(t, tc.startErr, err) if tc.startErr == nil { - comp.telemetry.ReportStatus(component.NewStatusEvent(component.StatusOK)) + comp.hostWrapper.Report(componentstatus.NewEvent(componentstatus.StatusOK)) err = comp.Shutdown(context.Background()) require.Equal(t, tc.shutdownErr, err) } - require.Equal(t, 3, len(reportedStatuses)) + require.Equal(t, tc.expectedNumReporterInstances, len(reportedStatuses)) for _, actualStatuses := range reportedStatuses { require.Equal(t, tc.expectedStatuses, actualStatuses) @@ -277,3 +214,16 @@ func newNopTelemetrySettings() *component.TelemetrySettings { set := componenttest.NewNopTelemetrySettings() return &set } + +var _ component.Host = (*testHost)(nil) +var _ componentstatus.Reporter = (*testHost)(nil) + +type testHost struct { + component.Host + *componentstatus.InstanceID + newStatusFunc func(id *componentstatus.InstanceID, ev *componentstatus.Event) +} + +func (h *testHost) Report(e *componentstatus.Event) { + h.newStatusFunc(h.InstanceID, e) +} diff --git a/internal/tools/go.mod b/internal/tools/go.mod index 6eb46e6bbb5..f7c24193869 100644 --- a/internal/tools/go.mod +++ b/internal/tools/go.mod @@ -1,11 +1,13 @@ module go.opentelemetry.io/collector/internal/tools -go 1.21.0 +go 1.22.1 + +toolchain go1.22.6 require ( github.com/a8m/envsubst v1.4.2 github.com/client9/misspell v0.3.4 - github.com/golangci/golangci-lint v1.59.1 + github.com/golangci/golangci-lint v1.60.1 github.com/google/addlicense v1.1.1 github.com/jcchavezs/porto v0.6.0 github.com/pavius/impi v0.0.3 @@ -27,11 +29,11 @@ require ( github.com/Abirdcfly/dupword v0.0.14 // indirect github.com/Antonboom/errname v0.1.13 // indirect github.com/Antonboom/nilnil v0.1.9 // indirect - github.com/Antonboom/testifylint v1.3.1 // indirect - github.com/BurntSushi/toml v1.4.0 // indirect - github.com/Crocmagnon/fatcontext v0.2.2 // indirect + github.com/Antonboom/testifylint v1.4.3 // indirect + github.com/BurntSushi/toml v1.4.1-0.20240526193622-a339e1f7089c // indirect + github.com/Crocmagnon/fatcontext v0.4.0 // indirect github.com/Djarvur/go-err113 v0.0.0-20210108212216-aea10b59be24 // indirect - github.com/GaijinEntertainment/go-exhaustruct/v3 v3.2.0 // indirect + github.com/GaijinEntertainment/go-exhaustruct/v3 v3.3.0 // indirect github.com/Masterminds/semver/v3 v3.2.1 // indirect github.com/Microsoft/go-winio v0.6.1 // indirect github.com/OpenPeeDeeP/depguard/v2 v2.2.0 // indirect @@ -47,7 +49,7 @@ require ( github.com/bkielbasa/cyclop v1.2.1 // indirect github.com/blizzy78/varnamelen v0.8.0 // indirect github.com/bmatcuk/doublestar/v4 v4.0.2 // indirect - github.com/bombsimon/wsl/v4 v4.2.1 // indirect + github.com/bombsimon/wsl/v4 v4.4.1 // indirect github.com/breml/bidichk v0.2.7 // indirect github.com/breml/errchkjson v0.3.6 // indirect github.com/butuzov/ireturn v0.3.0 // indirect @@ -86,7 +88,7 @@ require ( github.com/go-viper/mapstructure/v2 v2.0.0 // indirect github.com/go-xmlfmt/xmlfmt v1.1.2 // indirect github.com/gobwas/glob v0.2.3 // indirect - github.com/gofrs/flock v0.8.1 // indirect + github.com/gofrs/flock v0.12.1 // indirect github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect github.com/golangci/dupl v0.0.0-20180902072040-3e9179ac440a // indirect github.com/golangci/gofmt v0.0.0-20231018234816-f50ced29576e // indirect @@ -109,7 +111,7 @@ require ( github.com/jgautheron/goconst v1.7.1 // indirect github.com/jingyugao/rowserrcheck v1.1.1 // indirect github.com/jirfag/go-printf-func-name v0.0.0-20200119135958-7558a9eaa5af // indirect - github.com/jjti/go-spancheck v0.6.1 // indirect + github.com/jjti/go-spancheck v0.6.2 // indirect github.com/julz/importas v0.1.0 // indirect github.com/karamaru-alpha/copyloopvar v1.1.0 // indirect github.com/kevinburke/ssh_config v1.2.0 // indirect @@ -132,10 +134,10 @@ require ( github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-isatty v0.0.20 // indirect github.com/mattn/go-runewidth v0.0.9 // indirect - github.com/mgechev/revive v1.3.7 // indirect + github.com/mgechev/revive v1.3.9 // indirect github.com/mitchellh/go-homedir v1.1.0 // indirect github.com/mitchellh/mapstructure v1.5.1-0.20220423185008-bf980b35cac4 // indirect - github.com/moricho/tparallel v0.3.1 // indirect + github.com/moricho/tparallel v0.3.2 // indirect github.com/nakabonne/nestif v0.3.1 // indirect github.com/nishanths/exhaustive v0.12.0 // indirect github.com/nishanths/predeclared v0.2.2 // indirect @@ -144,7 +146,7 @@ require ( github.com/pelletier/go-toml/v2 v2.2.2 // indirect github.com/pjbgf/sha1cd v0.3.0 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect - github.com/polyfloyd/go-errorlint v1.5.2 // indirect + github.com/polyfloyd/go-errorlint v1.6.0 // indirect github.com/prometheus/client_golang v1.19.0 // indirect github.com/prometheus/client_model v0.5.0 // indirect github.com/prometheus/common v0.48.0 // indirect @@ -154,20 +156,20 @@ require ( github.com/quasilyte/gogrep v0.5.0 // indirect github.com/quasilyte/regex/syntax v0.0.0-20210819130434-b3f0c404a727 // indirect github.com/quasilyte/stdinfo v0.0.0-20220114132959-f7386bf02567 // indirect - github.com/ryancurrah/gomodguard v1.3.2 // indirect + github.com/ryancurrah/gomodguard v1.3.3 // indirect github.com/ryanrolds/sqlclosecheck v0.5.1 // indirect github.com/sagikazarmark/locafero v0.4.0 // indirect github.com/sagikazarmark/slog-shim v0.1.0 // indirect github.com/sanposhiho/wastedassign/v2 v2.0.7 // indirect github.com/santhosh-tekuri/jsonschema/v5 v5.3.1 // indirect github.com/sashamelentyev/interfacebloat v1.1.0 // indirect - github.com/sashamelentyev/usestdlibvars v1.26.0 // indirect + github.com/sashamelentyev/usestdlibvars v1.27.0 // indirect github.com/securego/gosec/v2 v2.20.1-0.20240525090044-5f0084eb01a9 // indirect github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3 // indirect github.com/shazow/go-diff v0.0.0-20160112020656-b6b7b6733b8c // indirect github.com/sirupsen/logrus v1.9.3 // indirect github.com/sivchari/containedctx v1.0.3 // indirect - github.com/sivchari/tenv v1.7.1 // indirect + github.com/sivchari/tenv v1.10.0 // indirect github.com/skeema/knownhosts v1.2.2 // indirect github.com/sonatard/noctx v0.0.2 // indirect github.com/sourcegraph/conc v0.3.0 // indirect @@ -182,7 +184,6 @@ require ( github.com/stretchr/objx v0.5.2 // indirect github.com/stretchr/testify v1.9.0 // indirect github.com/subosito/gotenv v1.6.0 // indirect - github.com/t-yuki/gocover-cobertura v0.0.0-20180217150009-aaee18c8195c // indirect github.com/tdakkota/asciicheck v0.2.0 // indirect github.com/tetafro/godot v1.4.16 // indirect github.com/timakin/bodyclose v0.0.0-20230421092635-574207250966 // indirect @@ -191,7 +192,7 @@ require ( github.com/tommy-muehle/go-mnd/v2 v2.5.1 // indirect github.com/ultraware/funlen v0.1.0 // indirect github.com/ultraware/whitespace v0.1.1 // indirect - github.com/uudashr/gocognit v1.1.2 // indirect + github.com/uudashr/gocognit v1.1.3 // indirect github.com/xanzy/ssh-agent v0.3.3 // indirect github.com/xen0n/gosmopolitan v1.2.2 // indirect github.com/yagipy/maintidx v1.0.0 // indirect @@ -199,7 +200,7 @@ require ( github.com/ykadowak/zerologlint v0.1.5 // indirect gitlab.com/bosi/decorder v0.4.2 // indirect go-simpler.org/musttag v0.12.2 // indirect - go-simpler.org/sloglint v0.7.1 // indirect + go-simpler.org/sloglint v0.7.2 // indirect go.opentelemetry.io/build-tools v0.14.0 // indirect go.uber.org/automaxprocs v1.5.3 // indirect go.uber.org/multierr v1.11.0 // indirect @@ -217,7 +218,7 @@ require ( gopkg.in/warnings.v0 v0.1.2 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect - honnef.co/go/tools v0.4.7 // indirect + honnef.co/go/tools v0.5.0 // indirect mvdan.cc/gofumpt v0.6.0 // indirect mvdan.cc/unparam v0.0.0-20240528143540-8a5130ca722f // indirect ) diff --git a/internal/tools/go.sum b/internal/tools/go.sum index 195bccb4cf6..beec2147375 100644 --- a/internal/tools/go.sum +++ b/internal/tools/go.sum @@ -12,16 +12,16 @@ github.com/Antonboom/errname v0.1.13 h1:JHICqsewj/fNckzrfVSe+T33svwQxmjC+1ntDsHO github.com/Antonboom/errname v0.1.13/go.mod h1:uWyefRYRN54lBg6HseYCFhs6Qjcy41Y3Jl/dVhA87Ns= github.com/Antonboom/nilnil v0.1.9 h1:eKFMejSxPSA9eLSensFmjW2XTgTwJMjZ8hUHtV4s/SQ= github.com/Antonboom/nilnil v0.1.9/go.mod h1:iGe2rYwCq5/Me1khrysB4nwI7swQvjclR8/YRPl5ihQ= -github.com/Antonboom/testifylint v1.3.1 h1:Uam4q1Q+2b6H7gvk9RQFw6jyVDdpzIirFOOrbs14eG4= -github.com/Antonboom/testifylint v1.3.1/go.mod h1:NV0hTlteCkViPW9mSR4wEMfwp+Hs1T3dY60bkvSfhpM= -github.com/BurntSushi/toml v1.4.0 h1:kuoIxZQy2WRRk1pttg9asf+WVv6tWQuBNVmK8+nqPr0= -github.com/BurntSushi/toml v1.4.0/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2lLoLwho= -github.com/Crocmagnon/fatcontext v0.2.2 h1:OrFlsDdOj9hW/oBEJBNSuH7QWf+E9WPVHw+x52bXVbk= -github.com/Crocmagnon/fatcontext v0.2.2/go.mod h1:WSn/c/+MMNiD8Pri0ahRj0o9jVpeowzavOQplBJw6u0= +github.com/Antonboom/testifylint v1.4.3 h1:ohMt6AHuHgttaQ1xb6SSnxCeK4/rnK7KKzbvs7DmEck= +github.com/Antonboom/testifylint v1.4.3/go.mod h1:+8Q9+AOLsz5ZiQiiYujJKs9mNz398+M6UgslP4qgJLA= +github.com/BurntSushi/toml v1.4.1-0.20240526193622-a339e1f7089c h1:pxW6RcqyfI9/kWtOwnv/G+AzdKuy2ZrqINhenH4HyNs= +github.com/BurntSushi/toml v1.4.1-0.20240526193622-a339e1f7089c/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2lLoLwho= +github.com/Crocmagnon/fatcontext v0.4.0 h1:4ykozu23YHA0JB6+thiuEv7iT6xq995qS1vcuWZq0tg= +github.com/Crocmagnon/fatcontext v0.4.0/go.mod h1:ZtWrXkgyfsYPzS6K3O88va6t2GEglG93vnII/F94WC0= github.com/Djarvur/go-err113 v0.0.0-20210108212216-aea10b59be24 h1:sHglBQTwgx+rWPdisA5ynNEsoARbiCBOyGcJM4/OzsM= github.com/Djarvur/go-err113 v0.0.0-20210108212216-aea10b59be24/go.mod h1:4UJr5HIiMZrwgkSPdsjy2uOQExX/WEILpIrO9UPGuXs= -github.com/GaijinEntertainment/go-exhaustruct/v3 v3.2.0 h1:sATXp1x6/axKxz2Gjxv8MALP0bXaNRfQinEwyfMcx8c= -github.com/GaijinEntertainment/go-exhaustruct/v3 v3.2.0/go.mod h1:Nl76DrGNJTA1KJ0LePKBw/vznBX1EHbAZX8mwjR82nI= +github.com/GaijinEntertainment/go-exhaustruct/v3 v3.3.0 h1:/fTUt5vmbkAcMBt4YQiuC23cV0kEsN1MVMNqeOW43cU= +github.com/GaijinEntertainment/go-exhaustruct/v3 v3.3.0/go.mod h1:ONJg5sxcbsdQQ4pOW8TGdTidT2TMAUy/2Xhr8mrYaao= github.com/Masterminds/semver/v3 v3.2.1 h1:RN9w6+7QoMeJVGyfmbcgs28Br8cvmnucEXnY0rYXWg0= github.com/Masterminds/semver/v3 v3.2.1/go.mod h1:qvl/7zhW3nngYb5+80sSMF+FG2BjYrf8m9wsX0PNOMQ= github.com/Microsoft/go-winio v0.5.2/go.mod h1:WpS1mjBmmwHBEWmogvA2mj8546UReBk4v8QkMxJ6pZY= @@ -61,8 +61,8 @@ github.com/blizzy78/varnamelen v0.8.0 h1:oqSblyuQvFsW1hbBHh1zfwrKe3kcSj0rnXkKzsQ github.com/blizzy78/varnamelen v0.8.0/go.mod h1:V9TzQZ4fLJ1DSrjVDfl89H7aMnTvKkApdHeyESmyR7k= github.com/bmatcuk/doublestar/v4 v4.0.2 h1:X0krlUVAVmtr2cRoTqR8aDMrDqnB36ht8wpWTiQ3jsA= github.com/bmatcuk/doublestar/v4 v4.0.2/go.mod h1:xBQ8jztBU6kakFMg+8WGxn0c6z1fTSPVIjEY1Wr7jzc= -github.com/bombsimon/wsl/v4 v4.2.1 h1:Cxg6u+XDWff75SIFFmNsqnIOgob+Q9hG6y/ioKbRFiM= -github.com/bombsimon/wsl/v4 v4.2.1/go.mod h1:Xu/kDxGZTofQcDGCtQe9KCzhHphIe0fDuyWTxER9Feo= +github.com/bombsimon/wsl/v4 v4.4.1 h1:jfUaCkN+aUpobrMO24zwyAMwMAV5eSziCkOKEauOLdw= +github.com/bombsimon/wsl/v4 v4.4.1/go.mod h1:Xu/kDxGZTofQcDGCtQe9KCzhHphIe0fDuyWTxER9Feo= github.com/breml/bidichk v0.2.7 h1:dAkKQPLl/Qrk7hnP6P+E0xOodrq8Us7+U0o4UBOAlQY= github.com/breml/bidichk v0.2.7/go.mod h1:YodjipAGI9fGcYM7II6wFvGhdMYsC5pHDlGzqvEW3tQ= github.com/breml/errchkjson v0.3.6 h1:VLhVkqSBH96AvXEyclMR37rZslRrY2kcyq+31HCsVrA= @@ -163,16 +163,16 @@ github.com/go-xmlfmt/xmlfmt v1.1.2 h1:Nea7b4icn8s57fTx1M5AI4qQT5HEM3rVUO8MuE6g80 github.com/go-xmlfmt/xmlfmt v1.1.2/go.mod h1:aUCEOzzezBEjDBbFBoSiya/gduyIiWYRP6CnSFIV8AM= github.com/gobwas/glob v0.2.3 h1:A4xDbljILXROh+kObIiy5kIaPYD8e96x1tgBhUI5J+Y= github.com/gobwas/glob v0.2.3/go.mod h1:d3Ez4x06l9bZtSvzIay5+Yzi0fmZzPgnTbPcKjJAkT8= -github.com/gofrs/flock v0.8.1 h1:+gYjHKf32LDeiEEFhQaotPbLuUXjY5ZqxKgXy7n59aw= -github.com/gofrs/flock v0.8.1/go.mod h1:F1TvTiK9OcQqauNUHlbJvyl9Qa1QvF/gOUDKA14jxHU= +github.com/gofrs/flock v0.12.1 h1:MTLVXXHf8ekldpJk3AKicLij9MdwOWkZ+a/jHHZby9E= +github.com/gofrs/flock v0.12.1/go.mod h1:9zxTsyu5xtJ9DK+1tFZyibEV7y3uwDxPPfbxeeHCoD0= github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da h1:oI5xCqsCo564l8iNU+DwB5epxmsaqB+rhGL0m5jtYqE= github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golangci/dupl v0.0.0-20180902072040-3e9179ac440a h1:w8hkcTqaFpzKqonE9uMCefW1WDie15eSP/4MssdenaM= github.com/golangci/dupl v0.0.0-20180902072040-3e9179ac440a/go.mod h1:ryS0uhF+x9jgbj/N71xsEqODy9BN81/GonCZiOzirOk= github.com/golangci/gofmt v0.0.0-20231018234816-f50ced29576e h1:ULcKCDV1LOZPFxGZaA6TlQbiM3J2GCPnkx/bGF6sX/g= github.com/golangci/gofmt v0.0.0-20231018234816-f50ced29576e/go.mod h1:Pm5KhLPA8gSnQwrQ6ukebRcapGb/BG9iUkdaiCcGHJM= -github.com/golangci/golangci-lint v1.59.1 h1:CRRLu1JbhK5avLABFJ/OHVSQ0Ie5c4ulsOId1h3TTks= -github.com/golangci/golangci-lint v1.59.1/go.mod h1:jX5Oif4C7P0j9++YB2MMJmoNrb01NJ8ITqKWNLewThg= +github.com/golangci/golangci-lint v1.60.1 h1:DRKNqNTQRLBJZ1il5u4fvgLQCjQc7QFs0DbhksJtVJE= +github.com/golangci/golangci-lint v1.60.1/go.mod h1:jDIPN1rYaIA+ijp9OZcUmUCoQOtZ76pOlFbi15FlLJY= github.com/golangci/misspell v0.6.0 h1:JCle2HUTNWirNlDIAUO44hUsKhOFqGPoC4LZxlaSXDs= github.com/golangci/misspell v0.6.0/go.mod h1:keMNyY6R9isGaSAu+4Q8NMBwMPkh15Gtc8UCVoDtAWo= github.com/golangci/modinfo v0.3.4 h1:oU5huX3fbxqQXdfspamej74DFX0kyGLkw1ppvXoJ8GA= @@ -231,8 +231,8 @@ github.com/jingyugao/rowserrcheck v1.1.1 h1:zibz55j/MJtLsjP1OF4bSdgXxwL1b+Vn7Tjz github.com/jingyugao/rowserrcheck v1.1.1/go.mod h1:4yvlZSDb3IyDTUZJUmpZfm2Hwok+Dtp+nu2qOq+er9c= github.com/jirfag/go-printf-func-name v0.0.0-20200119135958-7558a9eaa5af h1:KA9BjwUk7KlCh6S9EAGWBt1oExIUv9WyNCiRz5amv48= github.com/jirfag/go-printf-func-name v0.0.0-20200119135958-7558a9eaa5af/go.mod h1:HEWGJkRDzjJY2sqdDwxccsGicWEf9BQOZsq2tV+xzM0= -github.com/jjti/go-spancheck v0.6.1 h1:ZK/wE5Kyi1VX3PJpUO2oEgeoI4FWOUm7Shb2Gbv5obI= -github.com/jjti/go-spancheck v0.6.1/go.mod h1:vF1QkOO159prdo6mHRxak2CpzDpHAfKiPUDP/NeRnX8= +github.com/jjti/go-spancheck v0.6.2 h1:iYtoxqPMzHUPp7St+5yA8+cONdyXD3ug6KK15n7Pklk= +github.com/jjti/go-spancheck v0.6.2/go.mod h1:+X7lvIrR5ZdUTkxFYqzJ0abr8Sb5LOo80uOhWNqIrYA= github.com/julz/importas v0.1.0 h1:F78HnrsjY3cR7j0etXy5+TU1Zuy7Xt08X/1aJnH5xXY= github.com/julz/importas v0.1.0/go.mod h1:oSFU2R4XK/P7kNBrnL/FEQlDGN1/6WoxXEjSSXO0DV0= github.com/karamaru-alpha/copyloopvar v1.1.0 h1:x7gNyKcC2vRBO1H2Mks5u1VxQtYvFiym7fCjIP8RPos= @@ -287,14 +287,14 @@ github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWE github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mattn/go-runewidth v0.0.9 h1:Lm995f3rfxdpd6TSmuVCHVb/QhupuXlYr8sCI/QdE+0= github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= -github.com/mgechev/revive v1.3.7 h1:502QY0vQGe9KtYJ9FpxMz9rL+Fc/P13CI5POL4uHCcE= -github.com/mgechev/revive v1.3.7/go.mod h1:RJ16jUbF0OWC3co/+XTxmFNgEpUPwnnA0BRllX2aDNA= +github.com/mgechev/revive v1.3.9 h1:18Y3R4a2USSBF+QZKFQwVkBROUda7uoBlkEuBD+YD1A= +github.com/mgechev/revive v1.3.9/go.mod h1:+uxEIr5UH0TjXWHTno3xh4u7eg6jDpXKzQccA9UGhHU= github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y= github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= github.com/mitchellh/mapstructure v1.5.1-0.20220423185008-bf980b35cac4 h1:BpfhmLKZf+SjVanKKhCgf3bg+511DmU9eDQTen7LLbY= github.com/mitchellh/mapstructure v1.5.1-0.20220423185008-bf980b35cac4/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= -github.com/moricho/tparallel v0.3.1 h1:fQKD4U1wRMAYNngDonW5XupoB/ZGJHdpzrWqgyg9krA= -github.com/moricho/tparallel v0.3.1/go.mod h1:leENX2cUv7Sv2qDgdi0D0fCftN8fRC67Bcn8pqzeYNI= +github.com/moricho/tparallel v0.3.2 h1:odr8aZVFA3NZrNybggMkYO3rgPRcqjeQUlBBFVxKHTI= +github.com/moricho/tparallel v0.3.2/go.mod h1:OQ+K3b4Ln3l2TZveGCywybl68glfLEwFGqvnjok8b+U= github.com/nakabonne/nestif v0.3.1 h1:wm28nZjhQY5HyYPx+weN3Q65k6ilSBxDb8v5S81B81U= github.com/nakabonne/nestif v0.3.1/go.mod h1:9EtoZochLn5iUprVDmDjqGKPofoUEBL8U4Ngq6aY7OE= github.com/nishanths/exhaustive v0.12.0 h1:vIY9sALmw6T/yxiASewa4TQcFsVYZQQRUQJhKRf3Swg= @@ -327,8 +327,8 @@ github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINE github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/polyfloyd/go-errorlint v1.5.2 h1:SJhVik3Umsjh7mte1vE0fVZ5T1gznasQG3PV7U5xFdA= -github.com/polyfloyd/go-errorlint v1.5.2/go.mod h1:sH1QC1pxxi0fFecsVIzBmxtrgd9IF/SkJpA6wqyKAJs= +github.com/polyfloyd/go-errorlint v1.6.0 h1:tftWV9DE7txiFzPpztTAwyoRLKNj9gpVm2cg8/OwcYY= +github.com/polyfloyd/go-errorlint v1.6.0/go.mod h1:HR7u8wuP1kb1NeN1zqTd1ZMlqUKPPHF+Id4vIPvDqVw= github.com/prashantv/gostub v1.1.0 h1:BTyx3RfQjRHnUWaGF9oQos79AlQ5k8WNktv7VGvVH4g= github.com/prashantv/gostub v1.1.0/go.mod h1:A5zLQHz7ieHGG7is6LLXLz7I8+3LZzsrV0P1IAHhP5U= github.com/prometheus/client_golang v1.19.0 h1:ygXvpU1AoN1MhdzckN+PyD9QJOSD4x7kmXYlnfbA6JU= @@ -352,8 +352,8 @@ github.com/quasilyte/stdinfo v0.0.0-20220114132959-f7386bf02567/go.mod h1:DWNGW8 github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8= github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= -github.com/ryancurrah/gomodguard v1.3.2 h1:CuG27ulzEB1Gu5Dk5gP8PFxSOZ3ptSdP5iI/3IXxM18= -github.com/ryancurrah/gomodguard v1.3.2/go.mod h1:LqdemiFomEjcxOqirbQCb3JFvSxH2JUYMerTFd3sF2o= +github.com/ryancurrah/gomodguard v1.3.3 h1:eiSQdJVNr9KTNxY2Niij8UReSwR8Xrte3exBrAZfqpg= +github.com/ryancurrah/gomodguard v1.3.3/go.mod h1:rsKQjj4l3LXe8N344Ow7agAy5p9yjsWOtRzUMYmA0QY= github.com/ryanrolds/sqlclosecheck v0.5.1 h1:dibWW826u0P8jNLsLN+En7+RqWWTYrjCB9fJfSfdyCU= github.com/ryanrolds/sqlclosecheck v0.5.1/go.mod h1:2g3dUjoS6AL4huFdv6wn55WpLIDjY7ZgUR4J8HOO/XQ= github.com/sagikazarmark/locafero v0.4.0 h1:HApY1R9zGo4DBgr7dqsTH/JJxLTTsOt7u6keLGt6kNQ= @@ -366,8 +366,8 @@ github.com/santhosh-tekuri/jsonschema/v5 v5.3.1 h1:lZUw3E0/J3roVtGQ+SCrUrg3ON6Ng github.com/santhosh-tekuri/jsonschema/v5 v5.3.1/go.mod h1:uToXkOrWAZ6/Oc07xWQrPOhJotwFIyu2bBVN41fcDUY= github.com/sashamelentyev/interfacebloat v1.1.0 h1:xdRdJp0irL086OyW1H/RTZTr1h/tMEOsumirXcOJqAw= github.com/sashamelentyev/interfacebloat v1.1.0/go.mod h1:+Y9yU5YdTkrNvoX0xHc84dxiN1iBi9+G8zZIhPVoNjQ= -github.com/sashamelentyev/usestdlibvars v1.26.0 h1:LONR2hNVKxRmzIrZR0PhSF3mhCAzvnr+DcUiHgREfXE= -github.com/sashamelentyev/usestdlibvars v1.26.0/go.mod h1:9nl0jgOfHKWNFS43Ojw0i7aRoS4j6EBye3YBhmAIRF8= +github.com/sashamelentyev/usestdlibvars v1.27.0 h1:t/3jZpSXtRPRf2xr0m63i32ZrusyurIGT9E5wAvXQnI= +github.com/sashamelentyev/usestdlibvars v1.27.0/go.mod h1:9nl0jgOfHKWNFS43Ojw0i7aRoS4j6EBye3YBhmAIRF8= github.com/securego/gosec/v2 v2.20.1-0.20240525090044-5f0084eb01a9 h1:rnO6Zp1YMQwv8AyxzuwsVohljJgp4L0ZqiCgtACsPsc= github.com/securego/gosec/v2 v2.20.1-0.20240525090044-5f0084eb01a9/go.mod h1:dg7lPlu/xK/Ut9SedURCoZbVCR4yC7fM65DtH9/CDHs= github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3 h1:n661drycOFuPLCN3Uc8sB6B/s6Z4t2xvBgU1htSHuq8= @@ -381,8 +381,8 @@ github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= github.com/sivchari/containedctx v1.0.3 h1:x+etemjbsh2fB5ewm5FeLNi5bUjK0V8n0RB+Wwfd0XE= github.com/sivchari/containedctx v1.0.3/go.mod h1:c1RDvCbnJLtH4lLcYD/GqwiBSSf4F5Qk0xld2rBqzJ4= -github.com/sivchari/tenv v1.7.1 h1:PSpuD4bu6fSmtWMxSGWcvqUUgIn7k3yOJhOIzVWn8Ak= -github.com/sivchari/tenv v1.7.1/go.mod h1:64yStXKSOxDfX47NlhVwND4dHwfZDdbp2Lyl018Icvg= +github.com/sivchari/tenv v1.10.0 h1:g/hzMA+dBCKqGXgW8AV/1xIWhAvDrx0zFKNR48NFMg0= +github.com/sivchari/tenv v1.10.0/go.mod h1:tdY24masnVoZFxYrHv/nD6Tc8FbkEtAQEEziXpyMgqY= github.com/skeema/knownhosts v1.2.2 h1:Iug2P4fLmDw9f41PB6thxUkNUkJzB5i+1/exaj40L3A= github.com/skeema/knownhosts v1.2.2/go.mod h1:xYbVRSPxqBZFrdmDyMmsOs+uX1UZC3nTN3ThzgDxUwo= github.com/sonatard/noctx v0.0.2 h1:L7Dz4De2zDQhW8S0t+KUjY0MAQJd6SgVwhzNIc4ok00= @@ -423,8 +423,6 @@ github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsT github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8= github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU= -github.com/t-yuki/gocover-cobertura v0.0.0-20180217150009-aaee18c8195c h1:+aPplBwWcHBo6q9xrfWdMrT9o4kltkmmvpemgIjep/8= -github.com/t-yuki/gocover-cobertura v0.0.0-20180217150009-aaee18c8195c/go.mod h1:SbErYREK7xXdsRiigaQiQkI9McGRzYMvlKYaP3Nimdk= github.com/tdakkota/asciicheck v0.2.0 h1:o8jvnUANo0qXtnslk2d3nMKTFNlOnJjRrNcj0j9qkHM= github.com/tdakkota/asciicheck v0.2.0/go.mod h1:Qb7Y9EgjCLJGup51gDHFzbI08/gbGhL/UVhYIPWG2rg= github.com/tenntenn/modver v1.0.1 h1:2klLppGhDgzJrScMpkj9Ujy3rXPUspSjAcev9tSEBgA= @@ -445,8 +443,8 @@ github.com/ultraware/funlen v0.1.0 h1:BuqclbkY6pO+cvxoq7OsktIXZpgBSkYTQtmwhAK81v github.com/ultraware/funlen v0.1.0/go.mod h1:XJqmOQja6DpxarLj6Jj1U7JuoS8PvL4nEqDaQhy22p4= github.com/ultraware/whitespace v0.1.1 h1:bTPOGejYFulW3PkcrqkeQwOd6NKOOXvmGD9bo/Gk8VQ= github.com/ultraware/whitespace v0.1.1/go.mod h1:XcP1RLD81eV4BW8UhQlpaR+SDc2givTvyI8a586WjW8= -github.com/uudashr/gocognit v1.1.2 h1:l6BAEKJqQH2UpKAPKdMfZf5kE4W/2xk8pfU1OVLvniI= -github.com/uudashr/gocognit v1.1.2/go.mod h1:aAVdLURqcanke8h3vg35BC++eseDm66Z7KmchI5et4k= +github.com/uudashr/gocognit v1.1.3 h1:l+a111VcDbKfynh+airAy/DJQKaXh2m9vkoysMPSZyM= +github.com/uudashr/gocognit v1.1.3/go.mod h1:aKH8/e8xbTRBwjbCkwZ8qt4l2EpKXl31KMHgSS+lZ2U= github.com/xanzy/ssh-agent v0.3.3 h1:+/15pJfg/RsTxqYcX6fHqOXZwwMP+2VyYWJeWM2qQFM= github.com/xanzy/ssh-agent v0.3.3/go.mod h1:6dzNDKs0J9rVPHPhaGCukekBHKqfl+L3KghI1Bc68Uw= github.com/xen0n/gosmopolitan v1.2.2 h1:/p2KTnMzwRexIW8GlKawsTWOxn7UHA+jCMF/V8HHtvU= @@ -469,8 +467,8 @@ go-simpler.org/assert v0.9.0 h1:PfpmcSvL7yAnWyChSjOz6Sp6m9j5lyK8Ok9pEL31YkQ= go-simpler.org/assert v0.9.0/go.mod h1:74Eqh5eI6vCK6Y5l3PI8ZYFXG4Sa+tkr70OIPJAUr28= go-simpler.org/musttag v0.12.2 h1:J7lRc2ysXOq7eM8rwaTYnNrHd5JwjppzB6mScysB2Cs= go-simpler.org/musttag v0.12.2/go.mod h1:uN1DVIasMTQKk6XSik7yrJoEysGtR2GRqvWnI9S7TYM= -go-simpler.org/sloglint v0.7.1 h1:qlGLiqHbN5islOxjeLXoPtUdZXb669RW+BDQ+xOSNoU= -go-simpler.org/sloglint v0.7.1/go.mod h1:OlaVDRh/FKKd4X4sIMbsz8st97vomydceL146Fthh/c= +go-simpler.org/sloglint v0.7.2 h1:Wc9Em/Zeuu7JYpl+oKoYOsQSy2X560aVueCW/m6IijY= +go-simpler.org/sloglint v0.7.2/go.mod h1:US+9C80ppl7VsThQclkM7BkCHQAzuz8kHLsW3ppuluo= go.opentelemetry.io/build-tools v0.14.0 h1:fcnriXRUVpnVIFXtdlc1fTn9g+YRxzOV0xhw4nN919c= go.opentelemetry.io/build-tools v0.14.0/go.mod h1:pxTqOr0uL/0s9+xnpuKTAhmVFDssF3O4UUUuWKQqThE= go.opentelemetry.io/build-tools/checkfile v0.14.0 h1:vj4F4f5uZPH4L3hpEMDcQvnZ7b9T3O2ecWLfgWiXagM= @@ -561,7 +559,6 @@ golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211105183446-c75c47738b0c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220702020025-31831981b65f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -612,7 +609,6 @@ golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.9/go.mod h1:nABZi5QlRsZVlzPpHl034qft6wpY4eDcsTt5AaioBiU= golang.org/x/tools v0.1.10/go.mod h1:Uh6Zz+xoGYZom868N8YTex3t7RhtHDBrE8Gzo9bV56E= -golang.org/x/tools v0.1.11/go.mod h1:SgwaegtQh8clINPpECJMqnxLv9I09HLqnW3RMqW0CA4= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= golang.org/x/tools v0.2.0/go.mod h1:y4OqIKeOV/fWJetJ8bXPU1sEVniLMIyDAZWeHdV+NTA= golang.org/x/tools v0.3.0/go.mod h1:/rWhSS2+zyEVwoJf8YAX6L2f0ntZ7Kn/mGgAWcipA5k= @@ -642,8 +638,8 @@ gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -honnef.co/go/tools v0.4.7 h1:9MDAWxMoSnB6QoSqiVr7P5mtkT9pOc1kSxchzPCnqJs= -honnef.co/go/tools v0.4.7/go.mod h1:+rnGS1THNh8zMwnd2oVOTL9QF6vmfyG6ZXBULae2uc0= +honnef.co/go/tools v0.5.0 h1:29uoiIormS3Z6R+t56STz/oI4v+mB51TSmEOdJPgRnE= +honnef.co/go/tools v0.5.0/go.mod h1:e9irvo83WDG9/irijV44wr3tbhcFeRnfpVlRqVwpzMs= mvdan.cc/gofumpt v0.6.0 h1:G3QvahNDmpD+Aek/bNOLrFR2XC6ZAdo62dZu65gmwGo= mvdan.cc/gofumpt v0.6.0/go.mod h1:4L0wf+kgIPZtcCWXynNS2e6bhmj73umwnuXSZarixzA= mvdan.cc/unparam v0.0.0-20240528143540-8a5130ca722f h1:lMpcwN6GxNbWtbpI1+xzFLSW8XzX0u72NttUGVFjO3U= diff --git a/otelcol/collector.go b/otelcol/collector.go index b1d4705649c..3526861ad83 100644 --- a/otelcol/collector.go +++ b/otelcol/collector.go @@ -21,12 +21,8 @@ import ( "go.opentelemetry.io/collector/component" "go.opentelemetry.io/collector/confmap" - "go.opentelemetry.io/collector/connector" - "go.opentelemetry.io/collector/exporter" "go.opentelemetry.io/collector/extension" "go.opentelemetry.io/collector/otelcol/internal/grpclog" - "go.opentelemetry.io/collector/processor" - "go.opentelemetry.io/collector/receiver" "go.opentelemetry.io/collector/service" ) @@ -185,13 +181,27 @@ func (col *Collector) setupConfigurationComponents(ctx context.Context) error { } col.service, err = service.New(ctx, service.Settings{ - BuildInfo: col.set.BuildInfo, - CollectorConf: conf, - Receivers: receiver.NewBuilder(cfg.Receivers, factories.Receivers), - Processors: processor.NewBuilder(cfg.Processors, factories.Processors), - Exporters: exporter.NewBuilder(cfg.Exporters, factories.Exporters), - Connectors: connector.NewBuilder(cfg.Connectors, factories.Connectors), - Extensions: extension.NewBuilder(cfg.Extensions, factories.Extensions), + BuildInfo: col.set.BuildInfo, + CollectorConf: conf, + + ReceiversConfigs: cfg.Receivers, + ReceiversFactories: factories.Receivers, + ProcessorsConfigs: cfg.Processors, + ProcessorsFactories: factories.Processors, + ExportersConfigs: cfg.Exporters, + ExportersFactories: factories.Exporters, + ConnectorsConfigs: cfg.Connectors, + ConnectorsFactories: factories.Connectors, + ExtensionsConfigs: cfg.Extensions, + ExtensionsFactories: factories.Extensions, + + ModuleInfo: extension.ModuleInfo{ + Receiver: factories.ReceiverModules, + Processor: factories.ProcessorModules, + Exporter: factories.ExporterModules, + Extension: factories.ExtensionModules, + Connector: factories.ConnectorModules, + }, AsyncErrorChannel: col.asyncErrorChannel, LoggingOptions: col.set.LoggingOptions, }, cfg.Service) diff --git a/otelcol/collector_test.go b/otelcol/collector_test.go index a2dc4083f5f..14465dff826 100644 --- a/otelcol/collector_test.go +++ b/otelcol/collector_test.go @@ -20,6 +20,7 @@ import ( "gopkg.in/yaml.v3" "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/component/componentstatus" "go.opentelemetry.io/collector/confmap" "go.opentelemetry.io/collector/extension/extensiontest" "go.opentelemetry.io/collector/processor/processortest" @@ -145,10 +146,10 @@ func TestComponentStatusWatcher(t *testing.T) { factories.Processors[unhealthyProcessorFactory.Type()] = unhealthyProcessorFactory // Keep track of all status changes in a map. - changedComponents := map[*component.InstanceID][]component.Status{} + changedComponents := map[*componentstatus.InstanceID][]componentstatus.Status{} var mux sync.Mutex - onStatusChanged := func(source *component.InstanceID, event *component.StatusEvent) { - if source.ID.Type() != unhealthyProcessorFactory.Type() { + onStatusChanged := func(source *componentstatus.InstanceID, event *componentstatus.Event) { + if source.ComponentID().Type() != unhealthyProcessorFactory.Type() { return } mux.Lock() @@ -174,17 +175,17 @@ func TestComponentStatusWatcher(t *testing.T) { // An unhealthy processor asynchronously reports a recoverable error. Depending on the Go // Scheduler the statuses reported at startup will be one of the two valid sequnces below. - startupStatuses1 := []component.Status{ - component.StatusStarting, - component.StatusOK, - component.StatusRecoverableError, + startupStatuses1 := []componentstatus.Status{ + componentstatus.StatusStarting, + componentstatus.StatusOK, + componentstatus.StatusRecoverableError, } - startupStatuses2 := []component.Status{ - component.StatusStarting, - component.StatusRecoverableError, + startupStatuses2 := []componentstatus.Status{ + componentstatus.StatusStarting, + componentstatus.StatusRecoverableError, } // the modulus of the actual statuses will match the modulus of the startup statuses - startupStatuses := func(actualStatuses []component.Status) []component.Status { + startupStatuses := func(actualStatuses []componentstatus.Status) []componentstatus.Status { if len(actualStatuses)%2 == 1 { return startupStatuses1 } @@ -199,7 +200,7 @@ func TestComponentStatusWatcher(t *testing.T) { for k, v := range changedComponents { // All processors must report a status change with the same ID - assert.EqualValues(t, component.NewID(unhealthyProcessorFactory.Type()), k.ID) + assert.EqualValues(t, component.NewID(unhealthyProcessorFactory.Type()), k.ComponentID()) // And all must have a valid startup sequence assert.Equal(t, startupStatuses(v), v) } @@ -216,8 +217,8 @@ func TestComponentStatusWatcher(t *testing.T) { // Check for additional statuses after Shutdown. for _, v := range changedComponents { - expectedStatuses := append([]component.Status{}, startupStatuses(v)...) - expectedStatuses = append(expectedStatuses, component.StatusStopping, component.StatusStopped) + expectedStatuses := append([]componentstatus.Status{}, startupStatuses(v)...) + expectedStatuses = append(expectedStatuses, componentstatus.StatusStopping, componentstatus.StatusStopped) assert.Equal(t, expectedStatuses, v) } diff --git a/otelcol/configprovider.go b/otelcol/configprovider.go index e5c56aa8671..440ffad5254 100644 --- a/otelcol/configprovider.go +++ b/otelcol/configprovider.go @@ -6,16 +6,8 @@ package otelcol // import "go.opentelemetry.io/collector/otelcol" import ( "context" "fmt" - "strings" "go.opentelemetry.io/collector/confmap" - "go.opentelemetry.io/collector/internal/globalgates" -) - -var ( - strictlyTypedMessageCoda = `Hint: Temporarily restore the previous behavior by disabling - the ` + fmt.Sprintf("`%s`", globalgates.StrictlyTypedInputID) + ` feature gate. More details at: - https://github.com/open-telemetry/opentelemetry-collector/issues/10552` ) // ConfigProvider provides the service configuration. @@ -52,22 +44,6 @@ type ConfigProvider interface { Shutdown(ctx context.Context) error } -// ConfmapProvider is an optional interface to be implemented by ConfigProviders -// to provide confmap.Conf objects representing a marshaled version of the -// Collector's configuration. -// -// The purpose of this interface is that otelcol.ConfigProvider structs do not -// necessarily need to use confmap.Conf as their underlying config structure. -// -// Deprecated: [v0.105.0] This interface is deprecated. otelcol.Collector will now obtain -// a confmap.Conf object from the unmarshaled config itself. -type ConfmapProvider interface { - // GetConfmap resolves the Collector's configuration and provides it as a confmap.Conf object. - // - // Should never be called concurrently with itself or any ConfigProvider method. - GetConfmap(ctx context.Context) (*confmap.Conf, error) -} - type configProvider struct { mapResolver *confmap.Resolver } @@ -105,26 +81,7 @@ func (cm *configProvider) Get(ctx context.Context, factories Factories) (*Config var cfg *configSettings if cfg, err = unmarshal(conf, factories); err != nil { - err = fmt.Errorf("cannot unmarshal the configuration: %w", err) - - if globalgates.StrictlyTypedInputGate.IsEnabled() { - var shouldAddCoda bool - for _, errorStr := range []string{ - "got unconvertible type", // https://github.com/mitchellh/mapstructure/blob/8508981/mapstructure.go#L610 - "source data must be", // https://github.com/mitchellh/mapstructure/blob/8508981/mapstructure.go#L1114 - "expected a map, got 'slice'", // https://github.com/mitchellh/mapstructure/blob/8508981/mapstructure.go#L831 - } { - shouldAddCoda = strings.Contains(err.Error(), errorStr) - if shouldAddCoda { - break - } - } - if shouldAddCoda { - err = fmt.Errorf("%w\n\n%s", err, strictlyTypedMessageCoda) - } - } - - return nil, err + return nil, fmt.Errorf("cannot unmarshal the configuration: %w", err) } return &Config{ @@ -144,15 +101,3 @@ func (cm *configProvider) Watch() <-chan error { func (cm *configProvider) Shutdown(ctx context.Context) error { return cm.mapResolver.Shutdown(ctx) } - -// Deprecated: [v0.105.0] Call `(*confmap.Conf).Marshal(*otelcol.Config)` to get -// the Collector's configuration instead. -func (cm *configProvider) GetConfmap(ctx context.Context) (*confmap.Conf, error) { - conf, err := cm.mapResolver.Resolve(ctx) - - if err != nil { - return nil, fmt.Errorf("cannot resolve the configuration: %w", err) - } - - return conf, nil -} diff --git a/otelcol/configprovider_test.go b/otelcol/configprovider_test.go index da810a96daf..a1ea023b9ab 100644 --- a/otelcol/configprovider_test.go +++ b/otelcol/configprovider_test.go @@ -14,8 +14,6 @@ import ( "gopkg.in/yaml.v3" "go.opentelemetry.io/collector/confmap" - "go.opentelemetry.io/collector/featuregate" - "go.opentelemetry.io/collector/internal/globalgates" ) func newConfig(yamlBytes []byte, factories Factories) (*Config, error) { @@ -108,106 +106,3 @@ func TestConfigProviderFile(t *testing.T) { assert.EqualValues(t, configNop, cfg) } - -func TestGetConfmap(t *testing.T) { - uriLocation := "file:" + filepath.Join("testdata", "otelcol-nop.yaml") - fileProvider := newFakeProvider("file", func(_ context.Context, _ string, _ confmap.WatcherFunc) (*confmap.Retrieved, error) { - return confmap.NewRetrieved(newConfFromFile(t, uriLocation[5:])) - }) - set := ConfigProviderSettings{ - ResolverSettings: confmap.ResolverSettings{ - URIs: []string{uriLocation}, - ProviderFactories: []confmap.ProviderFactory{fileProvider}, - }, - } - - configBytes, err := os.ReadFile(filepath.Join("testdata", "otelcol-nop.yaml")) - require.NoError(t, err) - - yamlMap := map[string]any{} - err = yaml.Unmarshal(configBytes, yamlMap) - require.NoError(t, err) - - cp, err := NewConfigProvider(set) - require.NoError(t, err) - - cmp, ok := cp.(ConfmapProvider) - require.True(t, ok) - - cmap, err := cmp.GetConfmap(context.Background()) - require.NoError(t, err) - - assert.EqualValues(t, yamlMap, cmap.ToStringMap()) -} - -func TestStrictlyTypedCoda(t *testing.T) { - tests := []struct { - basename string - // isErrFromStrictTypes indicates whether the test should expect an error when the feature gate is - // disabled. If so, we check that it errs both with and without the feature gate and that the coda is never - // present. - isErrFromStrictTypes bool - }{ - {basename: "weak-implicit-bool-to-string.yaml"}, - {basename: "weak-implicit-int-to-string.yaml"}, - {basename: "weak-implicit-bool-to-int.yaml"}, - {basename: "weak-implicit-string-to-int.yaml"}, - {basename: "weak-implicit-int-to-bool.yaml"}, - {basename: "weak-implicit-string-to-bool.yaml"}, - {basename: "weak-empty-map-to-empty-array.yaml"}, - {basename: "weak-slice-of-maps-to-map.yaml"}, - {basename: "weak-single-element-to-slice.yaml"}, - { - basename: "otelcol-invalid-components.yaml", - isErrFromStrictTypes: true, - }, - } - - for _, tt := range tests { - t.Run(tt.basename, func(t *testing.T) { - filename := filepath.Join("testdata", tt.basename) - uriLocation := "file:" + filename - fileProvider := newFakeProvider("file", func(_ context.Context, _ string, _ confmap.WatcherFunc) (*confmap.Retrieved, error) { - return confmap.NewRetrieved(newConfFromFile(t, filename)) - }) - cp, err := NewConfigProvider(ConfigProviderSettings{ - ResolverSettings: confmap.ResolverSettings{ - URIs: []string{uriLocation}, - ProviderFactories: []confmap.ProviderFactory{fileProvider}, - }, - }) - require.NoError(t, err) - factories, err := nopFactories() - require.NoError(t, err) - - // Save the previous value of the feature gate and restore it after the test. - prev := globalgates.StrictlyTypedInputGate.IsEnabled() - defer func() { - require.NoError(t, featuregate.GlobalRegistry().Set(globalgates.StrictlyTypedInputID, prev)) - }() - - // Ensure the error does not appear with the feature gate disabled. - require.NoError(t, featuregate.GlobalRegistry().Set(globalgates.StrictlyTypedInputID, false)) - _, errWeakTypes := cp.Get(context.Background(), factories) - if tt.isErrFromStrictTypes { - require.Error(t, errWeakTypes) - // Ensure coda is **NOT** present. - assert.NotContains(t, errWeakTypes.Error(), strictlyTypedMessageCoda) - } else { - require.NoError(t, errWeakTypes) - } - - // Test with the feature gate enabled. - require.NoError(t, featuregate.GlobalRegistry().Set(globalgates.StrictlyTypedInputID, true)) - _, errStrictTypes := cp.Get(context.Background(), factories) - require.Error(t, errStrictTypes) - if tt.isErrFromStrictTypes { - // Ensure coda is **NOT** present. - assert.NotContains(t, errStrictTypes.Error(), strictlyTypedMessageCoda) - } else { - // Ensure coda is present. - assert.ErrorContains(t, errStrictTypes, strictlyTypedMessageCoda) - } - }) - } -} diff --git a/otelcol/go.mod b/otelcol/go.mod index dfd80ba6c20..5b7cdc5bfb2 100644 --- a/otelcol/go.mod +++ b/otelcol/go.mod @@ -1,26 +1,27 @@ module go.opentelemetry.io/collector/otelcol -go 1.21.0 +go 1.22.0 require ( github.com/spf13/cobra v1.8.1 github.com/stretchr/testify v1.9.0 - go.opentelemetry.io/collector/component v0.106.1 - go.opentelemetry.io/collector/config/configtelemetry v0.106.1 - go.opentelemetry.io/collector/confmap v0.106.1 - go.opentelemetry.io/collector/connector v0.106.1 - go.opentelemetry.io/collector/exporter v0.106.1 - go.opentelemetry.io/collector/extension v0.106.1 - go.opentelemetry.io/collector/featuregate v1.12.0 - go.opentelemetry.io/collector/internal/globalgates v0.106.1 - go.opentelemetry.io/collector/processor v0.106.1 - go.opentelemetry.io/collector/receiver v0.106.1 - go.opentelemetry.io/collector/service v0.106.1 + go.opentelemetry.io/collector/component v0.107.0 + go.opentelemetry.io/collector/component/componentstatus v0.107.0 + go.opentelemetry.io/collector/config/configtelemetry v0.107.0 + go.opentelemetry.io/collector/confmap v0.107.0 + go.opentelemetry.io/collector/connector v0.107.0 + go.opentelemetry.io/collector/exporter v0.107.0 + go.opentelemetry.io/collector/extension v0.107.0 + go.opentelemetry.io/collector/featuregate v1.13.0 + go.opentelemetry.io/collector/internal/globalgates v0.107.0 + go.opentelemetry.io/collector/processor v0.107.0 + go.opentelemetry.io/collector/receiver v0.107.0 + go.opentelemetry.io/collector/service v0.107.0 go.uber.org/goleak v1.3.0 go.uber.org/multierr v1.11.0 go.uber.org/zap v1.27.0 golang.org/x/exp v0.0.0-20240506185415-9bf2ced13842 - golang.org/x/sys v0.23.0 + golang.org/x/sys v0.24.0 google.golang.org/grpc v1.65.0 gopkg.in/yaml.v3 v3.0.1 ) @@ -33,13 +34,14 @@ require ( github.com/go-logr/logr v1.4.2 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/go-ole/go-ole v1.2.6 // indirect - github.com/go-viper/mapstructure/v2 v2.0.0 // indirect + github.com/go-viper/mapstructure/v2 v2.1.0 // indirect github.com/gogo/protobuf v1.3.2 // indirect github.com/google/uuid v1.6.0 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.20.0 // indirect github.com/hashicorp/go-version v1.7.0 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/json-iterator/go v1.1.12 // indirect + github.com/klauspost/compress v1.17.9 // 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 @@ -51,7 +53,7 @@ require ( github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c // indirect - github.com/prometheus/client_golang v1.19.1 // indirect + github.com/prometheus/client_golang v1.20.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 @@ -61,15 +63,15 @@ require ( github.com/tklauser/go-sysconf v0.3.12 // indirect github.com/tklauser/numcpus v0.6.1 // indirect github.com/yusufpapurcu/wmi v1.2.4 // indirect - go.opentelemetry.io/collector v0.106.1 // indirect - go.opentelemetry.io/collector/component/componentprofiles v0.106.1 // indirect - go.opentelemetry.io/collector/consumer v0.106.1 // indirect - go.opentelemetry.io/collector/consumer/consumerprofiles v0.106.1 // indirect - go.opentelemetry.io/collector/consumer/consumertest v0.106.1 // indirect - go.opentelemetry.io/collector/pdata v1.12.0 // indirect - go.opentelemetry.io/collector/pdata/pprofile v0.106.1 // indirect - go.opentelemetry.io/collector/pdata/testdata v0.106.1 // indirect - go.opentelemetry.io/collector/semconv v0.106.1 // indirect + go.opentelemetry.io/collector v0.107.0 // indirect + go.opentelemetry.io/collector/component/componentprofiles v0.107.0 // indirect + go.opentelemetry.io/collector/consumer v0.107.0 // indirect + go.opentelemetry.io/collector/consumer/consumerprofiles v0.107.0 // indirect + go.opentelemetry.io/collector/consumer/consumertest v0.107.0 // indirect + go.opentelemetry.io/collector/pdata v1.13.0 // indirect + go.opentelemetry.io/collector/pdata/pprofile v0.107.0 // indirect + go.opentelemetry.io/collector/pdata/testdata v0.107.0 // indirect + go.opentelemetry.io/collector/semconv v0.107.0 // indirect go.opentelemetry.io/contrib/config v0.8.0 // indirect go.opentelemetry.io/contrib/propagators/b3 v1.28.0 // indirect go.opentelemetry.io/otel v1.28.0 // indirect @@ -91,7 +93,7 @@ require ( go.opentelemetry.io/proto/otlp v1.3.1 // indirect golang.org/x/net v0.28.0 // indirect golang.org/x/text v0.17.0 // indirect - gonum.org/v1/gonum v0.15.0 // indirect + gonum.org/v1/gonum v0.15.1 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20240701130421-f6361c86f094 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240701130421-f6361c86f094 // indirect google.golang.org/protobuf v1.34.2 // indirect @@ -156,3 +158,5 @@ replace go.opentelemetry.io/collector/consumer/consumertest => ../consumer/consu replace go.opentelemetry.io/collector/component/componentprofiles => ../component/componentprofiles replace go.opentelemetry.io/collector/client => ../client + +replace go.opentelemetry.io/collector/component/componentstatus => ../component/componentstatus diff --git a/otelcol/go.sum b/otelcol/go.sum index 083dce0f93b..b075a946eaa 100644 --- a/otelcol/go.sum +++ b/otelcol/go.sum @@ -19,8 +19,8 @@ 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-ole/go-ole v1.2.6 h1:/Fpf6oFPoeFik9ty7siob0G6Ke8QvQEuVcuChpwXzpY= github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0= -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/go-viper/mapstructure/v2 v2.1.0 h1:gHnMa2Y/pIxElCH2GlZZ1lZSsn6XMtufpGyP1XxdC/w= +github.com/go-viper/mapstructure/v2 v2.1.0/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM= @@ -53,6 +53,8 @@ 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/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= +github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 h1:6E+4a0GO5zZEnZ81pIr0yLvtUWk2if982qA3F3QD6H4= github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0/go.mod h1:zJYVVT2jmtg6P3p1VtQj7WsuWi/y4VnjVBn7F8KPB3I= github.com/mitchellh/copystructure v1.2.0 h1:vpKXTN4ewci03Vljg/q9QvCGUDttBOGBIa15WveJJGw= @@ -70,8 +72,8 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c h1:ncq/mPwQF4JjgDlrVEn3C11VoGHZN7m8qihwgMEtzYw= github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE= -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_golang v1.20.1 h1:IMJXHOD6eARkQpxo8KkhgEVFlBNm+nkrFUyGlIu7Na8= +github.com/prometheus/client_golang v1.20.1/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= 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= @@ -176,8 +178,8 @@ golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20201204225414-ed752295db88/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.23.0 h1:YfKFowiIMvtgl1UERQoTPPToxltDeZfbj4H7dVUCwmM= -golang.org/x/sys v0.23.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.24.0 h1:Twjiwq9dn6R1fQcyiK+wQyHWfaz/BJB+YIpzU/Cv3Xg= +golang.org/x/sys v0.24.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.17.0 h1:XtiM5bkSOt+ewxlOE/aE/AKEHibwj/6gvWMl9Rsh0Qc= @@ -190,8 +192,8 @@ golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8T 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= -gonum.org/v1/gonum v0.15.0 h1:2lYxjRbTYyxkJxlhC+LvJIx3SsANPdRybu1tGj9/OrQ= -gonum.org/v1/gonum v0.15.0/go.mod h1:xzZVBJBtS+Mz4q0Yl2LJTk+OxOg4jiXZ7qBoM0uISGo= +gonum.org/v1/gonum v0.15.1 h1:FNy7N6OUZVUaWG9pTiD+jlhdQ3lMP+/LcTpJ6+a8sQ0= +gonum.org/v1/gonum v0.15.1/go.mod h1:eZTZuRFrzu5pcyjN5wJhcIhnUdNijYxX1T2IcrOGY0o= google.golang.org/genproto/googleapis/api v0.0.0-20240701130421-f6361c86f094 h1:0+ozOGcrp+Y8Aq8TLNN2Aliibms5LEzsq99ZZmAGYm0= google.golang.org/genproto/googleapis/api v0.0.0-20240701130421-f6361c86f094/go.mod h1:fJ/e3If/Q67Mj99hin0hMhiNyCRmt6BQ2aWIJshUSJw= google.golang.org/genproto/googleapis/rpc v0.0.0-20240701130421-f6361c86f094 h1:BwIjyKYGsK9dMCBOorzRri8MQwmi7mT9rGHsCEinZkA= diff --git a/otelcol/internal/configunmarshaler/configs.go b/otelcol/internal/configunmarshaler/configs.go index 7f864fdfd32..341c6fcad9d 100644 --- a/otelcol/internal/configunmarshaler/configs.go +++ b/otelcol/internal/configunmarshaler/configs.go @@ -31,19 +31,25 @@ func (c *Configs[F]) Unmarshal(conf *confmap.Conf) error { // Prepare resulting map. c.cfgs = make(map[component.ID]component.Config) // Iterate over raw configs and create a config for each. - for id, value := range rawCfgs { + for id := range rawCfgs { // Find factory based on component kind and type that we read from config source. factory, ok := c.factories[id.Type()] if !ok { return errorUnknownType(id, maps.Keys(c.factories)) } + // Get the configuration from the confmap.Conf to preserve internal representation. + sub, err := conf.Sub(id.String()) + if err != nil { + return errorUnmarshalError(id, err) + } + // Create the default config for this component. cfg := factory.CreateDefaultConfig() // Now that the default config struct is created we can Unmarshal into it, // and it will apply user-defined config on top of the default. - if err := confmap.NewFromStringMap(value).Unmarshal(&cfg); err != nil { + if err := sub.Unmarshal(&cfg); err != nil { return errorUnmarshalError(id, err) } diff --git a/otelcol/otelcoltest/go.mod b/otelcol/otelcoltest/go.mod index ce8515383c2..119b34ed78f 100644 --- a/otelcol/otelcoltest/go.mod +++ b/otelcol/otelcoltest/go.mod @@ -1,22 +1,22 @@ module go.opentelemetry.io/collector/otelcol/otelcoltest -go 1.21.0 +go 1.22.0 require ( github.com/stretchr/testify v1.9.0 - go.opentelemetry.io/collector/component v0.106.1 - go.opentelemetry.io/collector/confmap v0.106.1 - go.opentelemetry.io/collector/confmap/provider/envprovider v0.106.1 - go.opentelemetry.io/collector/confmap/provider/fileprovider v0.106.1 - go.opentelemetry.io/collector/confmap/provider/httpprovider v0.106.1 - go.opentelemetry.io/collector/confmap/provider/yamlprovider v0.106.1 - go.opentelemetry.io/collector/connector v0.106.1 - go.opentelemetry.io/collector/exporter v0.106.1 - go.opentelemetry.io/collector/extension v0.106.1 - go.opentelemetry.io/collector/otelcol v0.106.1 - go.opentelemetry.io/collector/processor v0.106.1 - go.opentelemetry.io/collector/receiver v0.106.1 - go.opentelemetry.io/collector/service v0.106.1 + go.opentelemetry.io/collector/component v0.107.0 + go.opentelemetry.io/collector/confmap v0.107.0 + go.opentelemetry.io/collector/confmap/provider/envprovider v0.107.0 + go.opentelemetry.io/collector/confmap/provider/fileprovider v0.107.0 + go.opentelemetry.io/collector/confmap/provider/httpprovider v0.107.0 + go.opentelemetry.io/collector/confmap/provider/yamlprovider v0.107.0 + go.opentelemetry.io/collector/connector v0.107.0 + go.opentelemetry.io/collector/exporter v0.107.0 + go.opentelemetry.io/collector/extension v0.107.0 + go.opentelemetry.io/collector/otelcol v0.107.0 + go.opentelemetry.io/collector/processor v0.107.0 + go.opentelemetry.io/collector/receiver v0.107.0 + go.opentelemetry.io/collector/service v0.107.0 go.uber.org/goleak v1.3.0 ) @@ -28,13 +28,14 @@ require ( github.com/go-logr/logr v1.4.2 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/go-ole/go-ole v1.2.6 // indirect - github.com/go-viper/mapstructure/v2 v2.0.0 // indirect + github.com/go-viper/mapstructure/v2 v2.1.0 // indirect github.com/gogo/protobuf v1.3.2 // indirect github.com/google/uuid v1.6.0 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.20.0 // indirect github.com/hashicorp/go-version v1.7.0 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/json-iterator/go v1.1.12 // indirect + github.com/klauspost/compress v1.17.9 // 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 @@ -46,7 +47,7 @@ require ( github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c // indirect - github.com/prometheus/client_golang v1.19.1 // indirect + github.com/prometheus/client_golang v1.20.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 @@ -57,18 +58,19 @@ require ( github.com/tklauser/go-sysconf v0.3.12 // indirect github.com/tklauser/numcpus v0.6.1 // indirect github.com/yusufpapurcu/wmi v1.2.4 // indirect - go.opentelemetry.io/collector v0.106.1 // indirect - go.opentelemetry.io/collector/component/componentprofiles v0.106.1 // indirect - go.opentelemetry.io/collector/config/configtelemetry v0.106.1 // indirect - go.opentelemetry.io/collector/consumer v0.106.1 // indirect - go.opentelemetry.io/collector/consumer/consumerprofiles v0.106.1 // indirect - go.opentelemetry.io/collector/consumer/consumertest v0.106.1 // indirect - go.opentelemetry.io/collector/featuregate v1.12.0 // indirect - go.opentelemetry.io/collector/internal/globalgates v0.106.1 // indirect - go.opentelemetry.io/collector/pdata v1.12.0 // indirect - go.opentelemetry.io/collector/pdata/pprofile v0.106.1 // indirect - go.opentelemetry.io/collector/pdata/testdata v0.106.1 // indirect - go.opentelemetry.io/collector/semconv v0.106.1 // indirect + go.opentelemetry.io/collector v0.107.0 // indirect + go.opentelemetry.io/collector/component/componentprofiles v0.107.0 // indirect + go.opentelemetry.io/collector/component/componentstatus v0.107.0 // indirect + go.opentelemetry.io/collector/config/configtelemetry v0.107.0 // indirect + go.opentelemetry.io/collector/consumer v0.107.0 // indirect + go.opentelemetry.io/collector/consumer/consumerprofiles v0.107.0 // indirect + go.opentelemetry.io/collector/consumer/consumertest v0.107.0 // indirect + go.opentelemetry.io/collector/featuregate v1.13.0 // indirect + go.opentelemetry.io/collector/internal/globalgates v0.107.0 // indirect + go.opentelemetry.io/collector/pdata v1.13.0 // indirect + go.opentelemetry.io/collector/pdata/pprofile v0.107.0 // indirect + go.opentelemetry.io/collector/pdata/testdata v0.107.0 // indirect + go.opentelemetry.io/collector/semconv v0.107.0 // indirect go.opentelemetry.io/contrib/config v0.8.0 // indirect go.opentelemetry.io/contrib/propagators/b3 v1.28.0 // indirect go.opentelemetry.io/otel v1.28.0 // indirect @@ -92,9 +94,9 @@ require ( go.uber.org/zap v1.27.0 // indirect golang.org/x/exp v0.0.0-20240506185415-9bf2ced13842 // indirect golang.org/x/net v0.28.0 // indirect - golang.org/x/sys v0.23.0 // indirect + golang.org/x/sys v0.24.0 // indirect golang.org/x/text v0.17.0 // indirect - gonum.org/v1/gonum v0.15.0 // indirect + gonum.org/v1/gonum v0.15.1 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20240701130421-f6361c86f094 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240701130421-f6361c86f094 // indirect google.golang.org/grpc v1.65.0 // indirect @@ -171,3 +173,5 @@ replace go.opentelemetry.io/collector/consumer/consumertest => ../../consumer/co replace go.opentelemetry.io/collector/component/componentprofiles => ../../component/componentprofiles replace go.opentelemetry.io/collector/client => ../../client + +replace go.opentelemetry.io/collector/component/componentstatus => ../../component/componentstatus diff --git a/otelcol/otelcoltest/go.sum b/otelcol/otelcoltest/go.sum index 083dce0f93b..b075a946eaa 100644 --- a/otelcol/otelcoltest/go.sum +++ b/otelcol/otelcoltest/go.sum @@ -19,8 +19,8 @@ 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-ole/go-ole v1.2.6 h1:/Fpf6oFPoeFik9ty7siob0G6Ke8QvQEuVcuChpwXzpY= github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0= -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/go-viper/mapstructure/v2 v2.1.0 h1:gHnMa2Y/pIxElCH2GlZZ1lZSsn6XMtufpGyP1XxdC/w= +github.com/go-viper/mapstructure/v2 v2.1.0/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM= @@ -53,6 +53,8 @@ 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/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= +github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 h1:6E+4a0GO5zZEnZ81pIr0yLvtUWk2if982qA3F3QD6H4= github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0/go.mod h1:zJYVVT2jmtg6P3p1VtQj7WsuWi/y4VnjVBn7F8KPB3I= github.com/mitchellh/copystructure v1.2.0 h1:vpKXTN4ewci03Vljg/q9QvCGUDttBOGBIa15WveJJGw= @@ -70,8 +72,8 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c h1:ncq/mPwQF4JjgDlrVEn3C11VoGHZN7m8qihwgMEtzYw= github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE= -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_golang v1.20.1 h1:IMJXHOD6eARkQpxo8KkhgEVFlBNm+nkrFUyGlIu7Na8= +github.com/prometheus/client_golang v1.20.1/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= 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= @@ -176,8 +178,8 @@ golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20201204225414-ed752295db88/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.23.0 h1:YfKFowiIMvtgl1UERQoTPPToxltDeZfbj4H7dVUCwmM= -golang.org/x/sys v0.23.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.24.0 h1:Twjiwq9dn6R1fQcyiK+wQyHWfaz/BJB+YIpzU/Cv3Xg= +golang.org/x/sys v0.24.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.17.0 h1:XtiM5bkSOt+ewxlOE/aE/AKEHibwj/6gvWMl9Rsh0Qc= @@ -190,8 +192,8 @@ golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8T 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= -gonum.org/v1/gonum v0.15.0 h1:2lYxjRbTYyxkJxlhC+LvJIx3SsANPdRybu1tGj9/OrQ= -gonum.org/v1/gonum v0.15.0/go.mod h1:xzZVBJBtS+Mz4q0Yl2LJTk+OxOg4jiXZ7qBoM0uISGo= +gonum.org/v1/gonum v0.15.1 h1:FNy7N6OUZVUaWG9pTiD+jlhdQ3lMP+/LcTpJ6+a8sQ0= +gonum.org/v1/gonum v0.15.1/go.mod h1:eZTZuRFrzu5pcyjN5wJhcIhnUdNijYxX1T2IcrOGY0o= google.golang.org/genproto/googleapis/api v0.0.0-20240701130421-f6361c86f094 h1:0+ozOGcrp+Y8Aq8TLNN2Aliibms5LEzsq99ZZmAGYm0= google.golang.org/genproto/googleapis/api v0.0.0-20240701130421-f6361c86f094/go.mod h1:fJ/e3If/Q67Mj99hin0hMhiNyCRmt6BQ2aWIJshUSJw= google.golang.org/genproto/googleapis/rpc v0.0.0-20240701130421-f6361c86f094 h1:BwIjyKYGsK9dMCBOorzRri8MQwmi7mT9rGHsCEinZkA= diff --git a/otelcol/testdata/weak-empty-map-to-empty-array.yaml b/otelcol/testdata/weak-empty-map-to-empty-array.yaml deleted file mode 100644 index 4a272e93ca3..00000000000 --- a/otelcol/testdata/weak-empty-map-to-empty-array.yaml +++ /dev/null @@ -1,33 +0,0 @@ -receivers: - nop: - -processors: - nop: - -exporters: - nop: - -extensions: - nop: - -connectors: - nop/con: - -service: - telemetry: - metrics: - address: localhost:8888 - extensions: [nop] - pipelines: - traces: - receivers: [nop] - processors: {} # <-- Empty map casted to empty array - exporters: [nop, nop/con] - metrics: - receivers: [nop] - processors: [nop] - exporters: [nop] - logs: - receivers: [nop, nop/con] - processors: [nop] - exporters: [nop] diff --git a/otelcol/testdata/weak-implicit-bool-to-int.yaml b/otelcol/testdata/weak-implicit-bool-to-int.yaml deleted file mode 100644 index a1e0bdce27f..00000000000 --- a/otelcol/testdata/weak-implicit-bool-to-int.yaml +++ /dev/null @@ -1,36 +0,0 @@ -receivers: - nop: - -processors: - nop: - -exporters: - nop: - -extensions: - nop: - -connectors: - nop/con: - -service: - telemetry: - metrics: - address: localhost:8888 - logs: - sampling: - initial: true # <-- Implicit cast bool to int - extensions: [nop] - pipelines: - traces: - receivers: [nop] - processors: [nop] - exporters: [nop, nop/con] - metrics: - receivers: [nop] - processors: [nop] - exporters: [nop] - logs: - receivers: [nop, nop/con] - processors: [nop] - exporters: [nop] diff --git a/otelcol/testdata/weak-implicit-bool-to-string.yaml b/otelcol/testdata/weak-implicit-bool-to-string.yaml deleted file mode 100644 index d74046baf10..00000000000 --- a/otelcol/testdata/weak-implicit-bool-to-string.yaml +++ /dev/null @@ -1,33 +0,0 @@ -receivers: - nop: - -processors: - nop: - -exporters: - nop: - -extensions: - nop: - -connectors: - nop/con: - -service: - telemetry: - metrics: - address: true # <-- Implicit cast bool to string - extensions: [nop] - pipelines: - traces: - receivers: [nop] - processors: [nop] - exporters: [nop, nop/con] - metrics: - receivers: [nop] - processors: [nop] - exporters: [nop] - logs: - receivers: [nop, nop/con] - processors: [nop] - exporters: [nop] diff --git a/otelcol/testdata/weak-implicit-int-to-bool.yaml b/otelcol/testdata/weak-implicit-int-to-bool.yaml deleted file mode 100644 index 0fec68386c0..00000000000 --- a/otelcol/testdata/weak-implicit-int-to-bool.yaml +++ /dev/null @@ -1,36 +0,0 @@ -receivers: - nop: - -processors: - nop: - -exporters: - nop: - -extensions: - nop: - -connectors: - nop/con: - -service: - telemetry: - metrics: - address: localhost:8888 - logs: - sampling: - enabled: 1 # <-- Implicit cast int to bool - extensions: [nop] - pipelines: - traces: - receivers: [nop] - processors: [nop] - exporters: [nop, nop/con] - metrics: - receivers: [nop] - processors: [nop] - exporters: [nop] - logs: - receivers: [nop, nop/con] - processors: [nop] - exporters: [nop] diff --git a/otelcol/testdata/weak-implicit-int-to-string.yaml b/otelcol/testdata/weak-implicit-int-to-string.yaml deleted file mode 100644 index 78e920f6554..00000000000 --- a/otelcol/testdata/weak-implicit-int-to-string.yaml +++ /dev/null @@ -1,33 +0,0 @@ -receivers: - nop: - -processors: - nop: - -exporters: - nop: - -extensions: - nop: - -connectors: - nop/con: - -service: - telemetry: - metrics: - address: 0xdeadbeef # <-- Implicit cast int to string - extensions: [nop] - pipelines: - traces: - receivers: [nop] - processors: [nop] - exporters: [nop, nop/con] - metrics: - receivers: [nop] - processors: [nop] - exporters: [nop] - logs: - receivers: [nop, nop/con] - processors: [nop] - exporters: [nop] diff --git a/otelcol/testdata/weak-implicit-string-to-bool.yaml b/otelcol/testdata/weak-implicit-string-to-bool.yaml deleted file mode 100644 index 7a4f578e761..00000000000 --- a/otelcol/testdata/weak-implicit-string-to-bool.yaml +++ /dev/null @@ -1,36 +0,0 @@ -receivers: - nop: - -processors: - nop: - -exporters: - nop: - -extensions: - nop: - -connectors: - nop/con: - -service: - telemetry: - metrics: - address: localhost:8888 - logs: - sampling: - enabled: t # <-- Implicit cast string to bool - extensions: [nop] - pipelines: - traces: - receivers: [nop] - processors: [nop] - exporters: [nop, nop/con] - metrics: - receivers: [nop] - processors: [nop] - exporters: [nop] - logs: - receivers: [nop, nop/con] - processors: [nop] - exporters: [nop] diff --git a/otelcol/testdata/weak-implicit-string-to-int.yaml b/otelcol/testdata/weak-implicit-string-to-int.yaml deleted file mode 100644 index d22178a84bf..00000000000 --- a/otelcol/testdata/weak-implicit-string-to-int.yaml +++ /dev/null @@ -1,36 +0,0 @@ -receivers: - nop: - -processors: - nop: - -exporters: - nop: - -extensions: - nop: - -connectors: - nop/con: - -service: - telemetry: - metrics: - address: localhost:8888 - logs: - sampling: - initial: "100" # <-- Implicit cast string to int - extensions: [nop] - pipelines: - traces: - receivers: [nop] - processors: [nop] - exporters: [nop, nop/con] - metrics: - receivers: [nop] - processors: [nop] - exporters: [nop] - logs: - receivers: [nop, nop/con] - processors: [nop] - exporters: [nop] diff --git a/otelcol/testdata/weak-single-element-to-slice.yaml b/otelcol/testdata/weak-single-element-to-slice.yaml deleted file mode 100644 index 8ce29a01248..00000000000 --- a/otelcol/testdata/weak-single-element-to-slice.yaml +++ /dev/null @@ -1,33 +0,0 @@ -receivers: - nop: - -processors: - nop: - -exporters: - nop: - -extensions: - nop: - -connectors: - nop/con: - -service: - telemetry: - metrics: - address: localhost:8888 - extensions: nop # <-- Single element casted to slice - pipelines: - traces: - receivers: [nop] - processors: [nop] - exporters: [nop, nop/con] - metrics: - receivers: [nop] - processors: [nop] - exporters: [nop] - logs: - receivers: [nop, nop/con] - processors: [nop] - exporters: [nop] diff --git a/otelcol/testdata/weak-slice-of-maps-to-map.yaml b/otelcol/testdata/weak-slice-of-maps-to-map.yaml deleted file mode 100644 index 2b3aeb2e11e..00000000000 --- a/otelcol/testdata/weak-slice-of-maps-to-map.yaml +++ /dev/null @@ -1,33 +0,0 @@ -receivers: - nop: - -processors: - nop: - -exporters: - nop: - -extensions: - nop: - -connectors: - nop/con: - -service: - telemetry: - metrics: - address: localhost:8888 - extensions: [nop] - pipelines: - - traces: # <-- Slice of maps casted to map - receivers: [nop] - processors: [nop] - exporters: [nop, nop/con] - metrics: - receivers: [nop] - processors: [nop] - exporters: [nop] - - logs: - receivers: [nop, nop/con] - processors: [nop] - exporters: [nop] diff --git a/otelcol/unmarshal_dry_run_test.go b/otelcol/unmarshal_dry_run_test.go new file mode 100644 index 00000000000..b8dd585051f --- /dev/null +++ b/otelcol/unmarshal_dry_run_test.go @@ -0,0 +1,115 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package otelcol + +import ( + "context" + "testing" + + "github.com/stretchr/testify/require" + + "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/confmap" + "go.opentelemetry.io/collector/receiver" +) + +var _ component.Config = (*Config)(nil) + +type ValidateTestConfig struct { + Number int `mapstructure:"number"` + String string `mapstructure:"string"` +} + +var genericType component.Type = component.MustNewType("generic") + +func NewFactories(_ *testing.T) func() (Factories, error) { + return func() (Factories, error) { + factories, err := nopFactories() + if err != nil { + return Factories{}, err + } + factories.Receivers[genericType] = receiver.NewFactory( + genericType, + func() component.Config { + return &ValidateTestConfig{ + Number: 1, + String: "default", + } + }) + + return factories, nil + } +} + +var sampleYAMLConfig = ` +receivers: + generic: + number: ${mock:number} + string: ${mock:number} + +exporters: + nop: + +service: + pipelines: + traces: + receivers: [generic] + exporters: [nop] +` + +func TestDryRunWithExpandedValues(t *testing.T) { + tests := []struct { + name string + yamlConfig string + mockMap map[string]string + expectErr bool + }{ + { + name: "string that looks like an integer", + yamlConfig: sampleYAMLConfig, + mockMap: map[string]string{ + "number": "123", + }, + }, + { + name: "string that looks like a bool", + yamlConfig: sampleYAMLConfig, + mockMap: map[string]string{ + "number": "true", + }, + expectErr: true, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + collector, err := NewCollector(CollectorSettings{ + Factories: NewFactories(t), + ConfigProviderSettings: ConfigProviderSettings{ + ResolverSettings: confmap.ResolverSettings{ + URIs: []string{"file:file"}, + DefaultScheme: "mock", + ProviderFactories: []confmap.ProviderFactory{ + newFakeProvider("mock", func(_ context.Context, uri string, _ confmap.WatcherFunc) (*confmap.Retrieved, error) { + return confmap.NewRetrievedFromYAML([]byte(tt.mockMap[uri[len("mock:"):]])) + }), + newFakeProvider("file", func(_ context.Context, _ string, _ confmap.WatcherFunc) (*confmap.Retrieved, error) { + return confmap.NewRetrievedFromYAML([]byte(tt.yamlConfig)) + }), + }, + }, + }, + SkipSettingGRPCLogger: true, + }) + require.NoError(t, err) + + err = collector.DryRun(context.Background()) + if tt.expectErr { + require.Error(t, err) + return + } + require.NoError(t, err) + }) + } +} diff --git a/package.json b/package.json new file mode 100644 index 00000000000..81c3ab3b996 --- /dev/null +++ b/package.json @@ -0,0 +1,5 @@ +{ + "devDependencies": { + "markdown-link-check": "^3.11.2" + } +} diff --git a/pdata/go.mod b/pdata/go.mod index 0bedaefc0fe..3817fb5eb08 100644 --- a/pdata/go.mod +++ b/pdata/go.mod @@ -1,6 +1,6 @@ module go.opentelemetry.io/collector/pdata -go 1.21.0 +go 1.22.0 require ( github.com/gogo/protobuf v1.3.2 diff --git a/pdata/pprofile/go.mod b/pdata/pprofile/go.mod index aeac535adae..1397f761d29 100644 --- a/pdata/pprofile/go.mod +++ b/pdata/pprofile/go.mod @@ -1,10 +1,10 @@ module go.opentelemetry.io/collector/pdata/pprofile -go 1.21.0 +go 1.22.0 require ( github.com/stretchr/testify v1.9.0 - go.opentelemetry.io/collector/pdata v1.12.0 + go.opentelemetry.io/collector/pdata v1.13.0 ) require ( diff --git a/pdata/testdata/go.mod b/pdata/testdata/go.mod index 44eb7534aea..1d5d424252d 100644 --- a/pdata/testdata/go.mod +++ b/pdata/testdata/go.mod @@ -1,10 +1,10 @@ module go.opentelemetry.io/collector/pdata/testdata -go 1.21.0 +go 1.22.0 require ( - go.opentelemetry.io/collector/pdata v1.12.0 - go.opentelemetry.io/collector/pdata/pprofile v0.106.1 + go.opentelemetry.io/collector/pdata v1.13.0 + go.opentelemetry.io/collector/pdata/pprofile v0.107.0 ) require ( diff --git a/processor/batchprocessor/README.md b/processor/batchprocessor/README.md index 44b297fc344..36781d3931c 100644 --- a/processor/batchprocessor/README.md +++ b/processor/batchprocessor/README.md @@ -5,7 +5,7 @@ | ------------- |-----------| | Stability | [beta]: traces, metrics, logs | | Distributions | [core], [contrib], [k8s] | -| Issues | [![Open issues](https://img.shields.io/github/issues-search/open-telemetry/opentelemetry-collector-contrib?query=is%3Aissue%20is%3Aopen%20label%3Aprocessor%2Fbatch%20&label=open&color=orange&logo=opentelemetry)](https://github.com/open-telemetry/opentelemetry-collector-contrib/issues?q=is%3Aopen+is%3Aissue+label%3Aprocessor%2Fbatch) [![Closed issues](https://img.shields.io/github/issues-search/open-telemetry/opentelemetry-collector-contrib?query=is%3Aissue%20is%3Aclosed%20label%3Aprocessor%2Fbatch%20&label=closed&color=blue&logo=opentelemetry)](https://github.com/open-telemetry/opentelemetry-collector-contrib/issues?q=is%3Aclosed+is%3Aissue+label%3Aprocessor%2Fbatch) | +| Issues | [![Open issues](https://img.shields.io/github/issues-search/open-telemetry/opentelemetry-collector?query=is%3Aissue%20is%3Aopen%20label%3Aprocessor%2Fbatch%20&label=open&color=orange&logo=opentelemetry)](https://github.com/open-telemetry/opentelemetry-collector/issues?q=is%3Aopen+is%3Aissue+label%3Aprocessor%2Fbatch) [![Closed issues](https://img.shields.io/github/issues-search/open-telemetry/opentelemetry-collector?query=is%3Aissue%20is%3Aclosed%20label%3Aprocessor%2Fbatch%20&label=closed&color=blue&logo=opentelemetry)](https://github.com/open-telemetry/opentelemetry-collector/issues?q=is%3Aclosed+is%3Aissue+label%3Aprocessor%2Fbatch) | [beta]: https://github.com/open-telemetry/opentelemetry-collector#beta [core]: https://github.com/open-telemetry/opentelemetry-collector-releases/tree/main/distributions/otelcol diff --git a/processor/batchprocessor/batch_processor_test.go b/processor/batchprocessor/batch_processor_test.go index 856ea6e48a5..36ce38d57d7 100644 --- a/processor/batchprocessor/batch_processor_test.go +++ b/processor/batchprocessor/batch_processor_test.go @@ -236,7 +236,7 @@ func TestBatchProcessorSentBySize(t *testing.T) { { Name: "otelcol_processor_batch_batch_send_size", Description: "Number of units in the batch", - Unit: "1", + Unit: "{units}", Data: metricdata.Histogram[int64]{ Temporality: metricdata.CumulativeTemporality, DataPoints: []metricdata.HistogramDataPoint[int64]{ @@ -255,7 +255,7 @@ func TestBatchProcessorSentBySize(t *testing.T) { { Name: "otelcol_processor_batch_batch_size_trigger_send", Description: "Number of times the batch was sent due to a size trigger", - Unit: "1", + Unit: "{times}", Data: metricdata.Sum[int64]{ Temporality: metricdata.CumulativeTemporality, IsMonotonic: true, @@ -270,7 +270,7 @@ func TestBatchProcessorSentBySize(t *testing.T) { { Name: "otelcol_processor_batch_metadata_cardinality", Description: "Number of distinct metadata value combinations being processed", - Unit: "1", + Unit: "{combinations}", Data: metricdata.Sum[int64]{ Temporality: metricdata.CumulativeTemporality, IsMonotonic: false, @@ -362,7 +362,7 @@ func TestBatchProcessorSentBySizeWithMaxSize(t *testing.T) { { Name: "otelcol_processor_batch_batch_send_size", Description: "Number of units in the batch", - Unit: "1", + Unit: "{units}", Data: metricdata.Histogram[int64]{ Temporality: metricdata.CumulativeTemporality, DataPoints: []metricdata.HistogramDataPoint[int64]{ @@ -381,7 +381,7 @@ func TestBatchProcessorSentBySizeWithMaxSize(t *testing.T) { { Name: "otelcol_processor_batch_batch_size_trigger_send", Description: "Number of times the batch was sent due to a size trigger", - Unit: "1", + Unit: "{times}", Data: metricdata.Sum[int64]{ Temporality: metricdata.CumulativeTemporality, IsMonotonic: true, @@ -396,7 +396,7 @@ func TestBatchProcessorSentBySizeWithMaxSize(t *testing.T) { { Name: "otelcol_processor_batch_timeout_trigger_send", Description: "Number of times the batch was sent due to a timeout trigger", - Unit: "1", + Unit: "{times}", Data: metricdata.Sum[int64]{ Temporality: metricdata.CumulativeTemporality, IsMonotonic: true, @@ -411,7 +411,7 @@ func TestBatchProcessorSentBySizeWithMaxSize(t *testing.T) { { Name: "otelcol_processor_batch_metadata_cardinality", Description: "Number of distinct metadata value combinations being processed", - Unit: "1", + Unit: "{combinations}", Data: metricdata.Sum[int64]{ Temporality: metricdata.CumulativeTemporality, IsMonotonic: false, @@ -625,7 +625,7 @@ func TestBatchMetricProcessorBatchSize(t *testing.T) { { Name: "otelcol_processor_batch_batch_send_size", Description: "Number of units in the batch", - Unit: "1", + Unit: "{units}", Data: metricdata.Histogram[int64]{ Temporality: metricdata.CumulativeTemporality, DataPoints: []metricdata.HistogramDataPoint[int64]{ @@ -644,7 +644,7 @@ func TestBatchMetricProcessorBatchSize(t *testing.T) { { Name: "otelcol_processor_batch_batch_size_trigger_send", Description: "Number of times the batch was sent due to a size trigger", - Unit: "1", + Unit: "{times}", Data: metricdata.Sum[int64]{ Temporality: metricdata.CumulativeTemporality, IsMonotonic: true, @@ -659,7 +659,7 @@ func TestBatchMetricProcessorBatchSize(t *testing.T) { { Name: "otelcol_processor_batch_metadata_cardinality", Description: "Number of distinct metadata value combinations being processed", - Unit: "1", + Unit: "{combinations}", Data: metricdata.Sum[int64]{ Temporality: metricdata.CumulativeTemporality, IsMonotonic: false, @@ -1005,7 +1005,7 @@ func TestBatchLogProcessor_BatchSize(t *testing.T) { { Name: "otelcol_processor_batch_batch_send_size", Description: "Number of units in the batch", - Unit: "1", + Unit: "{units}", Data: metricdata.Histogram[int64]{ Temporality: metricdata.CumulativeTemporality, DataPoints: []metricdata.HistogramDataPoint[int64]{ @@ -1024,7 +1024,7 @@ func TestBatchLogProcessor_BatchSize(t *testing.T) { { Name: "otelcol_processor_batch_batch_size_trigger_send", Description: "Number of times the batch was sent due to a size trigger", - Unit: "1", + Unit: "{times}", Data: metricdata.Sum[int64]{ Temporality: metricdata.CumulativeTemporality, IsMonotonic: true, @@ -1039,7 +1039,7 @@ func TestBatchLogProcessor_BatchSize(t *testing.T) { { Name: "otelcol_processor_batch_metadata_cardinality", Description: "Number of distinct metadata value combinations being processed", - Unit: "1", + Unit: "{combinations}", Data: metricdata.Sum[int64]{ Temporality: metricdata.CumulativeTemporality, IsMonotonic: false, diff --git a/processor/batchprocessor/documentation.md b/processor/batchprocessor/documentation.md index 32833a7a90b..18c0d15f831 100644 --- a/processor/batchprocessor/documentation.md +++ b/processor/batchprocessor/documentation.md @@ -12,7 +12,7 @@ Number of units in the batch | Unit | Metric Type | Value Type | | ---- | ----------- | ---------- | -| 1 | Histogram | Int | +| {units} | Histogram | Int | ### otelcol_processor_batch_batch_send_size_bytes @@ -28,7 +28,7 @@ Number of times the batch was sent due to a size trigger | Unit | Metric Type | Value Type | Monotonic | | ---- | ----------- | ---------- | --------- | -| 1 | Sum | Int | true | +| {times} | Sum | Int | true | ### otelcol_processor_batch_metadata_cardinality @@ -36,7 +36,7 @@ Number of distinct metadata value combinations being processed | Unit | Metric Type | Value Type | Monotonic | | ---- | ----------- | ---------- | --------- | -| 1 | Sum | Int | false | +| {combinations} | Sum | Int | false | ### otelcol_processor_batch_timeout_trigger_send @@ -44,4 +44,4 @@ Number of times the batch was sent due to a timeout trigger | Unit | Metric Type | Value Type | Monotonic | | ---- | ----------- | ---------- | --------- | -| 1 | Sum | Int | true | +| {times} | Sum | Int | true | diff --git a/processor/batchprocessor/generated_component_telemetry_test.go b/processor/batchprocessor/generated_component_telemetry_test.go index 640256a9a49..4747507bcb3 100644 --- a/processor/batchprocessor/generated_component_telemetry_test.go +++ b/processor/batchprocessor/generated_component_telemetry_test.go @@ -7,11 +7,13 @@ import ( "testing" "github.com/stretchr/testify/require" + "go.opentelemetry.io/otel/metric" sdkmetric "go.opentelemetry.io/otel/sdk/metric" "go.opentelemetry.io/otel/sdk/metric/metricdata" "go.opentelemetry.io/otel/sdk/metric/metricdata/metricdatatest" "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/config/configtelemetry" "go.opentelemetry.io/collector/processor" "go.opentelemetry.io/collector/processor/processortest" ) @@ -24,6 +26,9 @@ type componentTestTelemetry struct { func (tt *componentTestTelemetry) NewSettings() processor.Settings { settings := processortest.NewNopSettings() settings.MeterProvider = tt.meterProvider + settings.LeveledMeterProvider = func(_ configtelemetry.Level) metric.MeterProvider { + return tt.meterProvider + } settings.ID = component.NewID(component.MustNewType("batch")) return settings diff --git a/processor/batchprocessor/go.mod b/processor/batchprocessor/go.mod index 6495b7ba3fa..e69d6104777 100644 --- a/processor/batchprocessor/go.mod +++ b/processor/batchprocessor/go.mod @@ -1,19 +1,19 @@ module go.opentelemetry.io/collector/processor/batchprocessor -go 1.21.0 +go 1.22.0 require ( github.com/stretchr/testify v1.9.0 - go.opentelemetry.io/collector v0.106.1 - go.opentelemetry.io/collector/client v0.106.1 - go.opentelemetry.io/collector/component v0.106.1 - go.opentelemetry.io/collector/config/configtelemetry v0.106.1 - go.opentelemetry.io/collector/confmap v0.106.1 - go.opentelemetry.io/collector/consumer v0.106.1 - go.opentelemetry.io/collector/consumer/consumertest v0.106.1 - go.opentelemetry.io/collector/pdata v1.12.0 - go.opentelemetry.io/collector/pdata/testdata v0.106.1 - go.opentelemetry.io/collector/processor v0.106.1 + go.opentelemetry.io/collector v0.107.0 + go.opentelemetry.io/collector/client v1.13.0 + go.opentelemetry.io/collector/component v0.107.0 + go.opentelemetry.io/collector/config/configtelemetry v0.107.0 + go.opentelemetry.io/collector/confmap v0.107.0 + go.opentelemetry.io/collector/consumer v0.107.0 + go.opentelemetry.io/collector/consumer/consumertest v0.107.0 + go.opentelemetry.io/collector/pdata v1.13.0 + go.opentelemetry.io/collector/pdata/testdata v0.107.0 + go.opentelemetry.io/collector/processor v0.107.0 go.opentelemetry.io/otel v1.28.0 go.opentelemetry.io/otel/metric v1.28.0 go.opentelemetry.io/otel/sdk/metric v1.28.0 @@ -28,11 +28,11 @@ require ( github.com/davecgh/go-spew v1.1.1 // indirect github.com/go-logr/logr v1.4.2 // indirect github.com/go-logr/stdr v1.2.2 // indirect - github.com/go-viper/mapstructure/v2 v2.0.0 // indirect + github.com/go-viper/mapstructure/v2 v2.1.0 // indirect github.com/gogo/protobuf v1.3.2 // indirect github.com/google/uuid v1.6.0 // indirect - github.com/hashicorp/go-version v1.7.0 // indirect github.com/json-iterator/go v1.1.12 // indirect + github.com/klauspost/compress v1.17.9 // 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 @@ -42,14 +42,13 @@ require ( 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_golang v1.20.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/consumer/consumerprofiles v0.106.1 // indirect - go.opentelemetry.io/collector/featuregate v1.12.0 // indirect - go.opentelemetry.io/collector/internal/globalgates v0.106.1 // indirect - go.opentelemetry.io/collector/pdata/pprofile v0.106.1 // indirect + go.opentelemetry.io/collector/component/componentstatus v0.107.0 // indirect + go.opentelemetry.io/collector/consumer/consumerprofiles v0.107.0 // indirect + go.opentelemetry.io/collector/pdata/pprofile v0.107.0 // indirect go.opentelemetry.io/otel/exporters/prometheus v0.50.0 // indirect go.opentelemetry.io/otel/sdk v1.28.0 // indirect go.uber.org/multierr v1.11.0 // indirect @@ -64,8 +63,6 @@ require ( replace go.opentelemetry.io/collector => ../../ -replace go.opentelemetry.io/collector/internal/globalgates => ../../internal/globalgates - replace go.opentelemetry.io/collector/processor => ../ replace go.opentelemetry.io/collector/component => ../../component @@ -94,3 +91,5 @@ replace go.opentelemetry.io/collector/pdata/pprofile => ../../pdata/pprofile replace go.opentelemetry.io/collector/consumer/consumerprofiles => ../../consumer/consumerprofiles replace go.opentelemetry.io/collector/consumer/consumertest => ../../consumer/consumertest + +replace go.opentelemetry.io/collector/component/componentstatus => ../../component/componentstatus diff --git a/processor/batchprocessor/go.sum b/processor/batchprocessor/go.sum index 9f1ade0bfde..87196d45d6f 100644 --- a/processor/batchprocessor/go.sum +++ b/processor/batchprocessor/go.sum @@ -10,8 +10,8 @@ github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY= github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= -github.com/go-viper/mapstructure/v2 v2.0.0 h1:dhn8MZ1gZ0mzeodTG3jt5Vj/o87xZKuNAprG2mQfMfc= -github.com/go-viper/mapstructure/v2 v2.0.0/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM= +github.com/go-viper/mapstructure/v2 v2.1.0 h1:gHnMa2Y/pIxElCH2GlZZ1lZSsn6XMtufpGyP1XxdC/w= +github.com/go-viper/mapstructure/v2 v2.1.0/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= @@ -19,12 +19,12 @@ github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeN 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/klauspost/compress v1.17.9 h1:6KIumPrER1LHsvBVuDa0r5xaG0Es51mhhB9BQB2qeMA= +github.com/klauspost/compress v1.17.9/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw= 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= @@ -35,6 +35,8 @@ 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/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= +github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= 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= @@ -48,8 +50,8 @@ github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq 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_golang v1.20.1 h1:IMJXHOD6eARkQpxo8KkhgEVFlBNm+nkrFUyGlIu7Na8= +github.com/prometheus/client_golang v1.20.1/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= 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= diff --git a/processor/batchprocessor/internal/metadata/generated_status.go b/processor/batchprocessor/internal/metadata/generated_status.go index c77d7c0a539..8f1fa8cfe60 100644 --- a/processor/batchprocessor/internal/metadata/generated_status.go +++ b/processor/batchprocessor/internal/metadata/generated_status.go @@ -7,7 +7,8 @@ import ( ) var ( - Type = component.MustNewType("batch") + Type = component.MustNewType("batch") + ScopeName = "go.opentelemetry.io/collector/processor/batchprocessor" ) const ( diff --git a/processor/batchprocessor/internal/metadata/generated_telemetry.go b/processor/batchprocessor/internal/metadata/generated_telemetry.go index 554da0686db..87bfa10e369 100644 --- a/processor/batchprocessor/internal/metadata/generated_telemetry.go +++ b/processor/batchprocessor/internal/metadata/generated_telemetry.go @@ -14,10 +14,15 @@ import ( "go.opentelemetry.io/collector/config/configtelemetry" ) +// Deprecated: [v0.108.0] use LeveledMeter instead. func Meter(settings component.TelemetrySettings) metric.Meter { return settings.MeterProvider.Meter("go.opentelemetry.io/collector/processor/batchprocessor") } +func LeveledMeter(settings component.TelemetrySettings, level configtelemetry.Level) metric.Meter { + return settings.LeveledMeterProvider(level).Meter("go.opentelemetry.io/collector/processor/batchprocessor") +} + func Tracer(settings component.TelemetrySettings) trace.Tracer { return settings.TracerProvider.Tracer("go.opentelemetry.io/collector/processor/batchprocessor") } @@ -71,7 +76,7 @@ func NewTelemetryBuilder(settings component.TelemetrySettings, options ...teleme builder.ProcessorBatchBatchSendSize, err = builder.meter.Int64Histogram( "otelcol_processor_batch_batch_send_size", metric.WithDescription("Number of units in the batch"), - metric.WithUnit("1"), metric.WithExplicitBucketBoundaries([]float64{10, 25, 50, 75, 100, 250, 500, 750, 1000, 2000, 3000, 4000, 5000, 6000, 7000, 8000, 9000, 10000, 20000, 30000, 50000, 100000}...), + metric.WithUnit("{units}"), metric.WithExplicitBucketBoundaries([]float64{10, 25, 50, 75, 100, 250, 500, 750, 1000, 2000, 3000, 4000, 5000, 6000, 7000, 8000, 9000, 10000, 20000, 30000, 50000, 100000}...), ) errs = errors.Join(errs, err) builder.ProcessorBatchBatchSendSizeBytes, err = builder.meter.Int64Histogram( @@ -83,13 +88,13 @@ func NewTelemetryBuilder(settings component.TelemetrySettings, options ...teleme builder.ProcessorBatchBatchSizeTriggerSend, err = builder.meter.Int64Counter( "otelcol_processor_batch_batch_size_trigger_send", metric.WithDescription("Number of times the batch was sent due to a size trigger"), - metric.WithUnit("1"), + metric.WithUnit("{times}"), ) errs = errors.Join(errs, err) builder.ProcessorBatchMetadataCardinality, err = builder.meter.Int64ObservableUpDownCounter( "otelcol_processor_batch_metadata_cardinality", metric.WithDescription("Number of distinct metadata value combinations being processed"), - metric.WithUnit("1"), + metric.WithUnit("{combinations}"), ) errs = errors.Join(errs, err) _, err = builder.meter.RegisterCallback(builder.observeProcessorBatchMetadataCardinality, builder.ProcessorBatchMetadataCardinality) @@ -97,7 +102,7 @@ func NewTelemetryBuilder(settings component.TelemetrySettings, options ...teleme builder.ProcessorBatchTimeoutTriggerSend, err = builder.meter.Int64Counter( "otelcol_processor_batch_timeout_trigger_send", metric.WithDescription("Number of times the batch was sent due to a timeout trigger"), - metric.WithUnit("1"), + metric.WithUnit("{times}"), ) errs = errors.Join(errs, err) return &builder, errs diff --git a/processor/batchprocessor/internal/metadata/generated_telemetry_test.go b/processor/batchprocessor/internal/metadata/generated_telemetry_test.go index 6480073f1dc..f05add260c3 100644 --- a/processor/batchprocessor/internal/metadata/generated_telemetry_test.go +++ b/processor/batchprocessor/internal/metadata/generated_telemetry_test.go @@ -14,6 +14,7 @@ import ( nooptrace "go.opentelemetry.io/otel/trace/noop" "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/config/configtelemetry" ) type mockMeter struct { @@ -43,6 +44,9 @@ func (m mockTracerProvider) Tracer(name string, opts ...trace.TracerOption) trac func TestProviders(t *testing.T) { set := component.TelemetrySettings{ + LeveledMeterProvider: func(_ configtelemetry.Level) metric.MeterProvider { + return mockMeterProvider{} + }, MeterProvider: mockMeterProvider{}, TracerProvider: mockTracerProvider{}, } @@ -64,6 +68,9 @@ func TestProviders(t *testing.T) { func TestNewTelemetryBuilder(t *testing.T) { set := component.TelemetrySettings{ + LeveledMeterProvider: func(_ configtelemetry.Level) metric.MeterProvider { + return mockMeterProvider{} + }, MeterProvider: mockMeterProvider{}, TracerProvider: mockTracerProvider{}, } diff --git a/processor/batchprocessor/metadata.yaml b/processor/batchprocessor/metadata.yaml index b0d2458c9b4..c9bd117706d 100644 --- a/processor/batchprocessor/metadata.yaml +++ b/processor/batchprocessor/metadata.yaml @@ -1,4 +1,5 @@ type: batch +github_project: open-telemetry/opentelemetry-collector status: class: processor @@ -14,21 +15,21 @@ telemetry: processor_batch_batch_size_trigger_send: enabled: true description: Number of times the batch was sent due to a size trigger - unit: "1" + unit: "{times}" sum: value_type: int monotonic: true processor_batch_timeout_trigger_send: enabled: true description: Number of times the batch was sent due to a timeout trigger - unit: "1" + unit: "{times}" sum: value_type: int monotonic: true processor_batch_batch_send_size: enabled: true description: Number of units in the batch - unit: "1" + unit: "{units}" histogram: value_type: int bucket_boundaries: [10, 25, 50, 75, 100, 250, 500, 750, 1000, 2000, 3000, 4000, 5000, 6000, 7000, 8000, 9000, 10000, 20000, 30000, 50000, 100000] @@ -42,7 +43,7 @@ telemetry: processor_batch_metadata_cardinality: enabled: true description: Number of distinct metadata value combinations being processed - unit: "1" + unit: "{combinations}" sum: value_type: int async: true diff --git a/processor/builder.go b/processor/builder.go index a1a0378b37c..e64714b8e0e 100644 --- a/processor/builder.go +++ b/processor/builder.go @@ -5,6 +5,7 @@ package processor // import "go.opentelemetry.io/collector/processor" import ( "context" + "errors" "fmt" "go.uber.org/zap" @@ -13,13 +14,21 @@ import ( "go.opentelemetry.io/collector/consumer" ) +var errNilNextConsumer = errors.New("nil next Consumer") + // Builder processor is a helper struct that given a set of Configs and Factories helps with creating processors. +// +// Deprecated: [v0.108.0] this builder is being internalized within the service module, +// and will be removed soon. type Builder struct { cfgs map[component.ID]component.Config factories map[component.Type]Factory } // NewBuilder creates a new processor.Builder to help with creating components form a set of configs and factories. +// +// Deprecated: [v0.108.0] this builder is being internalized within the service module, +// and will be removed soon. func NewBuilder(cfgs map[component.ID]component.Config, factories map[component.Type]Factory) *Builder { return &Builder{cfgs: cfgs, factories: factories} } diff --git a/processor/go.mod b/processor/go.mod index 8f6161fb1c5..721b90787ea 100644 --- a/processor/go.mod +++ b/processor/go.mod @@ -1,18 +1,19 @@ module go.opentelemetry.io/collector/processor -go 1.21.0 +go 1.22.0 require ( github.com/google/uuid v1.6.0 github.com/stretchr/testify v1.9.0 - go.opentelemetry.io/collector v0.106.1 - go.opentelemetry.io/collector/component v0.106.1 - go.opentelemetry.io/collector/config/configtelemetry v0.106.1 - go.opentelemetry.io/collector/consumer v0.106.1 - go.opentelemetry.io/collector/consumer/consumerprofiles v0.106.1 - go.opentelemetry.io/collector/consumer/consumertest v0.106.1 - go.opentelemetry.io/collector/pdata v1.12.0 - go.opentelemetry.io/collector/pdata/testdata v0.106.1 + go.opentelemetry.io/collector v0.107.0 + go.opentelemetry.io/collector/component v0.107.0 + go.opentelemetry.io/collector/component/componentstatus v0.107.0 + go.opentelemetry.io/collector/config/configtelemetry v0.107.0 + go.opentelemetry.io/collector/consumer v0.107.0 + go.opentelemetry.io/collector/consumer/consumerprofiles v0.107.0 + go.opentelemetry.io/collector/consumer/consumertest v0.107.0 + go.opentelemetry.io/collector/pdata v1.13.0 + go.opentelemetry.io/collector/pdata/testdata v0.107.0 go.opentelemetry.io/otel v1.28.0 go.opentelemetry.io/otel/metric v1.28.0 go.opentelemetry.io/otel/sdk/metric v1.28.0 @@ -29,15 +30,16 @@ require ( github.com/go-logr/stdr v1.2.2 // indirect github.com/gogo/protobuf v1.3.2 // indirect github.com/json-iterator/go v1.1.12 // indirect + github.com/klauspost/compress v1.17.9 // 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_golang v1.20.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/pdata/pprofile v0.106.1 // indirect + go.opentelemetry.io/collector/pdata/pprofile v0.107.0 // indirect go.opentelemetry.io/otel/exporters/prometheus v0.50.0 // indirect go.opentelemetry.io/otel/sdk v1.28.0 // indirect go.uber.org/multierr v1.11.0 // indirect @@ -68,8 +70,8 @@ replace go.opentelemetry.io/collector/pdata/pprofile => ../pdata/pprofile replace go.opentelemetry.io/collector/config/configtelemetry => ../config/configtelemetry -replace go.opentelemetry.io/collector/internal/globalgates => ../internal/globalgates - replace go.opentelemetry.io/collector/consumer/consumerprofiles => ../consumer/consumerprofiles replace go.opentelemetry.io/collector/consumer/consumertest => ../consumer/consumertest + +replace go.opentelemetry.io/collector/component/componentstatus => ../component/componentstatus diff --git a/processor/go.sum b/processor/go.sum index a8a6b586c17..e8730e47884 100644 --- a/processor/go.sum +++ b/processor/go.sum @@ -21,10 +21,14 @@ github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnr 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/klauspost/compress v1.17.9 h1:6KIumPrER1LHsvBVuDa0r5xaG0Es51mhhB9BQB2qeMA= +github.com/klauspost/compress v1.17.9/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw= 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/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= +github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= 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= @@ -34,8 +38,8 @@ github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq 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_golang v1.20.1 h1:IMJXHOD6eARkQpxo8KkhgEVFlBNm+nkrFUyGlIu7Na8= +github.com/prometheus/client_golang v1.20.1/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= 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= diff --git a/processor/memorylimiterprocessor/README.md b/processor/memorylimiterprocessor/README.md index 87795b62404..d5707909f40 100644 --- a/processor/memorylimiterprocessor/README.md +++ b/processor/memorylimiterprocessor/README.md @@ -5,7 +5,7 @@ | ------------- |-----------| | Stability | [beta]: traces, metrics, logs | | Distributions | [core], [contrib], [k8s] | -| Issues | [![Open issues](https://img.shields.io/github/issues-search/open-telemetry/opentelemetry-collector-contrib?query=is%3Aissue%20is%3Aopen%20label%3Aprocessor%2Fmemorylimiter%20&label=open&color=orange&logo=opentelemetry)](https://github.com/open-telemetry/opentelemetry-collector-contrib/issues?q=is%3Aopen+is%3Aissue+label%3Aprocessor%2Fmemorylimiter) [![Closed issues](https://img.shields.io/github/issues-search/open-telemetry/opentelemetry-collector-contrib?query=is%3Aissue%20is%3Aclosed%20label%3Aprocessor%2Fmemorylimiter%20&label=closed&color=blue&logo=opentelemetry)](https://github.com/open-telemetry/opentelemetry-collector-contrib/issues?q=is%3Aclosed+is%3Aissue+label%3Aprocessor%2Fmemorylimiter) | +| Issues | [![Open issues](https://img.shields.io/github/issues-search/open-telemetry/opentelemetry-collector?query=is%3Aissue%20is%3Aopen%20label%3Aprocessor%2Fmemorylimiter%20&label=open&color=orange&logo=opentelemetry)](https://github.com/open-telemetry/opentelemetry-collector/issues?q=is%3Aopen+is%3Aissue+label%3Aprocessor%2Fmemorylimiter) [![Closed issues](https://img.shields.io/github/issues-search/open-telemetry/opentelemetry-collector?query=is%3Aissue%20is%3Aclosed%20label%3Aprocessor%2Fmemorylimiter%20&label=closed&color=blue&logo=opentelemetry)](https://github.com/open-telemetry/opentelemetry-collector/issues?q=is%3Aclosed+is%3Aissue+label%3Aprocessor%2Fmemorylimiter) | [beta]: https://github.com/open-telemetry/opentelemetry-collector#beta [core]: https://github.com/open-telemetry/opentelemetry-collector-releases/tree/main/distributions/otelcol diff --git a/processor/memorylimiterprocessor/go.mod b/processor/memorylimiterprocessor/go.mod index 5d09ab6167f..0868da614a3 100644 --- a/processor/memorylimiterprocessor/go.mod +++ b/processor/memorylimiterprocessor/go.mod @@ -1,16 +1,16 @@ module go.opentelemetry.io/collector/processor/memorylimiterprocessor -go 1.21.0 +go 1.22.0 require ( github.com/stretchr/testify v1.9.0 - go.opentelemetry.io/collector v0.106.1 - go.opentelemetry.io/collector/component v0.106.1 - go.opentelemetry.io/collector/confmap v0.106.1 - go.opentelemetry.io/collector/consumer v0.106.1 - go.opentelemetry.io/collector/consumer/consumertest v0.106.1 - go.opentelemetry.io/collector/pdata v1.12.0 - go.opentelemetry.io/collector/processor v0.106.1 + go.opentelemetry.io/collector v0.107.0 + go.opentelemetry.io/collector/component v0.107.0 + go.opentelemetry.io/collector/confmap v0.107.0 + go.opentelemetry.io/collector/consumer v0.107.0 + go.opentelemetry.io/collector/consumer/consumertest v0.107.0 + go.opentelemetry.io/collector/pdata v1.13.0 + go.opentelemetry.io/collector/processor v0.107.0 go.uber.org/goleak v1.3.0 ) @@ -21,11 +21,11 @@ require ( github.com/go-logr/logr v1.4.2 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/go-ole/go-ole v1.2.6 // indirect - github.com/go-viper/mapstructure/v2 v2.0.0 // indirect + github.com/go-viper/mapstructure/v2 v2.1.0 // indirect github.com/gogo/protobuf v1.3.2 // indirect github.com/google/uuid v1.6.0 // indirect - github.com/hashicorp/go-version v1.7.0 // indirect github.com/json-iterator/go v1.1.12 // indirect + github.com/klauspost/compress v1.17.9 // 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 @@ -37,7 +37,7 @@ require ( github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c // indirect - github.com/prometheus/client_golang v1.19.1 // indirect + github.com/prometheus/client_golang v1.20.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 @@ -45,12 +45,11 @@ require ( github.com/tklauser/go-sysconf v0.3.12 // indirect github.com/tklauser/numcpus v0.6.1 // indirect github.com/yusufpapurcu/wmi v1.2.4 // indirect - go.opentelemetry.io/collector/config/configtelemetry v0.106.1 // indirect - go.opentelemetry.io/collector/consumer/consumerprofiles v0.106.1 // indirect - go.opentelemetry.io/collector/featuregate v1.12.0 // indirect - go.opentelemetry.io/collector/internal/globalgates v0.106.1 // indirect - go.opentelemetry.io/collector/pdata/pprofile v0.106.1 // indirect - go.opentelemetry.io/collector/pdata/testdata v0.106.1 // indirect + go.opentelemetry.io/collector/component/componentstatus v0.107.0 // indirect + go.opentelemetry.io/collector/config/configtelemetry v0.107.0 // indirect + go.opentelemetry.io/collector/consumer/consumerprofiles v0.107.0 // indirect + go.opentelemetry.io/collector/pdata/pprofile v0.107.0 // indirect + go.opentelemetry.io/collector/pdata/testdata v0.107.0 // 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 @@ -70,8 +69,6 @@ require ( replace go.opentelemetry.io/collector => ../../ -replace go.opentelemetry.io/collector/internal/globalgates => ../../internal/globalgates - replace go.opentelemetry.io/collector/processor => ../ replace go.opentelemetry.io/collector/component => ../../component @@ -98,3 +95,5 @@ replace go.opentelemetry.io/collector/pdata/pprofile => ../../pdata/pprofile replace go.opentelemetry.io/collector/consumer/consumerprofiles => ../../consumer/consumerprofiles replace go.opentelemetry.io/collector/consumer/consumertest => ../../consumer/consumertest + +replace go.opentelemetry.io/collector/component/componentstatus => ../../component/componentstatus diff --git a/processor/memorylimiterprocessor/go.sum b/processor/memorylimiterprocessor/go.sum index 9cef1fa997e..1df8002de39 100644 --- a/processor/memorylimiterprocessor/go.sum +++ b/processor/memorylimiterprocessor/go.sum @@ -12,8 +12,8 @@ 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-ole/go-ole v1.2.6 h1:/Fpf6oFPoeFik9ty7siob0G6Ke8QvQEuVcuChpwXzpY= github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0= -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/go-viper/mapstructure/v2 v2.1.0 h1:gHnMa2Y/pIxElCH2GlZZ1lZSsn6XMtufpGyP1XxdC/w= +github.com/go-viper/mapstructure/v2 v2.1.0/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= @@ -22,12 +22,12 @@ github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeN 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/klauspost/compress v1.17.9 h1:6KIumPrER1LHsvBVuDa0r5xaG0Es51mhhB9BQB2qeMA= +github.com/klauspost/compress v1.17.9/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw= 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= @@ -38,6 +38,8 @@ 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/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= +github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 h1:6E+4a0GO5zZEnZ81pIr0yLvtUWk2if982qA3F3QD6H4= github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0/go.mod h1:zJYVVT2jmtg6P3p1VtQj7WsuWi/y4VnjVBn7F8KPB3I= github.com/mitchellh/copystructure v1.2.0 h1:vpKXTN4ewci03Vljg/q9QvCGUDttBOGBIa15WveJJGw= @@ -55,8 +57,8 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c h1:ncq/mPwQF4JjgDlrVEn3C11VoGHZN7m8qihwgMEtzYw= github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE= -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_golang v1.20.1 h1:IMJXHOD6eARkQpxo8KkhgEVFlBNm+nkrFUyGlIu7Na8= +github.com/prometheus/client_golang v1.20.1/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= 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= diff --git a/processor/memorylimiterprocessor/internal/metadata/generated_status.go b/processor/memorylimiterprocessor/internal/metadata/generated_status.go index bd77272f645..0e841608278 100644 --- a/processor/memorylimiterprocessor/internal/metadata/generated_status.go +++ b/processor/memorylimiterprocessor/internal/metadata/generated_status.go @@ -7,7 +7,8 @@ import ( ) var ( - Type = component.MustNewType("memory_limiter") + Type = component.MustNewType("memory_limiter") + ScopeName = "go.opentelemetry.io/collector/processor/memorylimiterprocessor" ) const ( diff --git a/processor/memorylimiterprocessor/metadata.yaml b/processor/memorylimiterprocessor/metadata.yaml index cf155ca04ab..c6ec4d54dac 100644 --- a/processor/memorylimiterprocessor/metadata.yaml +++ b/processor/memorylimiterprocessor/metadata.yaml @@ -1,4 +1,5 @@ type: memory_limiter +github_project: open-telemetry/opentelemetry-collector status: class: processor diff --git a/processor/processor.go b/processor/processor.go index 543d4869d52..72233b425b3 100644 --- a/processor/processor.go +++ b/processor/processor.go @@ -4,17 +4,12 @@ package processor // import "go.opentelemetry.io/collector/processor" import ( - "errors" "fmt" "go.opentelemetry.io/collector/component" "go.opentelemetry.io/collector/processor/internal" ) -var ( - errNilNextConsumer = errors.New("nil next Consumer") -) - // Traces is a processor that can consume traces. type Traces = internal.Traces diff --git a/processor/processorhelper/generated_component_telemetry_test.go b/processor/processorhelper/generated_component_telemetry_test.go index 53e2c3c5a34..f03fb0ad564 100644 --- a/processor/processorhelper/generated_component_telemetry_test.go +++ b/processor/processorhelper/generated_component_telemetry_test.go @@ -7,11 +7,13 @@ import ( "testing" "github.com/stretchr/testify/require" + "go.opentelemetry.io/otel/metric" sdkmetric "go.opentelemetry.io/otel/sdk/metric" "go.opentelemetry.io/otel/sdk/metric/metricdata" "go.opentelemetry.io/otel/sdk/metric/metricdata/metricdatatest" "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/config/configtelemetry" "go.opentelemetry.io/collector/processor" "go.opentelemetry.io/collector/processor/processortest" ) @@ -24,6 +26,9 @@ type componentTestTelemetry struct { func (tt *componentTestTelemetry) NewSettings() processor.Settings { settings := processortest.NewNopSettings() settings.MeterProvider = tt.meterProvider + settings.LeveledMeterProvider = func(_ configtelemetry.Level) metric.MeterProvider { + return tt.meterProvider + } settings.ID = component.NewID(component.MustNewType("processorhelper")) return settings diff --git a/processor/processorhelper/internal/metadata/generated_telemetry.go b/processor/processorhelper/internal/metadata/generated_telemetry.go index 6c145bb65cd..432f3703f88 100644 --- a/processor/processorhelper/internal/metadata/generated_telemetry.go +++ b/processor/processorhelper/internal/metadata/generated_telemetry.go @@ -13,10 +13,15 @@ import ( "go.opentelemetry.io/collector/config/configtelemetry" ) +// Deprecated: [v0.108.0] use LeveledMeter instead. func Meter(settings component.TelemetrySettings) metric.Meter { return settings.MeterProvider.Meter("go.opentelemetry.io/collector/processor/processorhelper") } +func LeveledMeter(settings component.TelemetrySettings, level configtelemetry.Level) metric.Meter { + return settings.LeveledMeterProvider(level).Meter("go.opentelemetry.io/collector/processor/processorhelper") +} + func Tracer(settings component.TelemetrySettings) trace.Tracer { return settings.TracerProvider.Tracer("go.opentelemetry.io/collector/processor/processorhelper") } diff --git a/processor/processorhelper/internal/metadata/generated_telemetry_test.go b/processor/processorhelper/internal/metadata/generated_telemetry_test.go index 1fb64bf6023..dc6fbeca903 100644 --- a/processor/processorhelper/internal/metadata/generated_telemetry_test.go +++ b/processor/processorhelper/internal/metadata/generated_telemetry_test.go @@ -14,6 +14,7 @@ import ( nooptrace "go.opentelemetry.io/otel/trace/noop" "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/config/configtelemetry" ) type mockMeter struct { @@ -43,6 +44,9 @@ func (m mockTracerProvider) Tracer(name string, opts ...trace.TracerOption) trac func TestProviders(t *testing.T) { set := component.TelemetrySettings{ + LeveledMeterProvider: func(_ configtelemetry.Level) metric.MeterProvider { + return mockMeterProvider{} + }, MeterProvider: mockMeterProvider{}, TracerProvider: mockTracerProvider{}, } @@ -64,6 +68,9 @@ func TestProviders(t *testing.T) { func TestNewTelemetryBuilder(t *testing.T) { set := component.TelemetrySettings{ + LeveledMeterProvider: func(_ configtelemetry.Level) metric.MeterProvider { + return mockMeterProvider{} + }, MeterProvider: mockMeterProvider{}, TracerProvider: mockTracerProvider{}, } diff --git a/processor/processorhelper/obsreport.go b/processor/processorhelper/obsreport.go index baebb6b3b0c..2a3bd0dc754 100644 --- a/processor/processorhelper/obsreport.go +++ b/processor/processorhelper/obsreport.go @@ -32,8 +32,8 @@ func BuildCustomMetricName(configType, metric string) string { // ObsReport is a helper to add observability to a processor. type ObsReport struct { - otelAttrs []attribute.KeyValue - telBuilder *metadata.TelemetryBuilder + otelAttrs []attribute.KeyValue + telemetryBuilder *metadata.TelemetryBuilder } // ObsReportSettings are settings for creating an ObsReport. @@ -48,7 +48,7 @@ func NewObsReport(cfg ObsReportSettings) (*ObsReport, error) { } func newObsReport(cfg ObsReportSettings) (*ObsReport, error) { - telBuilder, err := metadata.NewTelemetryBuilder(cfg.ProcessorCreateSettings.TelemetrySettings, metadata.WithLevel(cfg.ProcessorCreateSettings.MetricsLevel)) + telemetryBuilder, err := metadata.NewTelemetryBuilder(cfg.ProcessorCreateSettings.TelemetrySettings, metadata.WithLevel(cfg.ProcessorCreateSettings.MetricsLevel)) if err != nil { return nil, err } @@ -56,66 +56,92 @@ func newObsReport(cfg ObsReportSettings) (*ObsReport, error) { otelAttrs: []attribute.KeyValue{ attribute.String(obsmetrics.ProcessorKey, cfg.ProcessorID.String()), }, - telBuilder: telBuilder, + telemetryBuilder: telemetryBuilder, }, nil } +func (or *ObsReport) recordData(ctx context.Context, dataType component.DataType, accepted, refused, dropped, inserted int64) { + var acceptedCount, refusedCount, droppedCount, insertedCount metric.Int64Counter + switch dataType { + case component.DataTypeTraces: + acceptedCount = or.telemetryBuilder.ProcessorAcceptedSpans + refusedCount = or.telemetryBuilder.ProcessorRefusedSpans + droppedCount = or.telemetryBuilder.ProcessorDroppedSpans + insertedCount = or.telemetryBuilder.ProcessorInsertedSpans + case component.DataTypeMetrics: + acceptedCount = or.telemetryBuilder.ProcessorAcceptedMetricPoints + refusedCount = or.telemetryBuilder.ProcessorRefusedMetricPoints + droppedCount = or.telemetryBuilder.ProcessorDroppedMetricPoints + insertedCount = or.telemetryBuilder.ProcessorInsertedMetricPoints + case component.DataTypeLogs: + acceptedCount = or.telemetryBuilder.ProcessorAcceptedLogRecords + refusedCount = or.telemetryBuilder.ProcessorRefusedLogRecords + droppedCount = or.telemetryBuilder.ProcessorDroppedLogRecords + insertedCount = or.telemetryBuilder.ProcessorInsertedLogRecords + } + + acceptedCount.Add(ctx, accepted, metric.WithAttributes(or.otelAttrs...)) + refusedCount.Add(ctx, refused, metric.WithAttributes(or.otelAttrs...)) + droppedCount.Add(ctx, dropped, metric.WithAttributes(or.otelAttrs...)) + insertedCount.Add(ctx, inserted, metric.WithAttributes(or.otelAttrs...)) +} + // TracesAccepted reports that the trace data was accepted. func (or *ObsReport) TracesAccepted(ctx context.Context, numSpans int) { - or.telBuilder.ProcessorAcceptedSpans.Add(ctx, int64(numSpans), metric.WithAttributes(or.otelAttrs...)) + or.recordData(ctx, component.DataTypeTraces, int64(numSpans), int64(0), int64(0), int64(0)) } // TracesRefused reports that the trace data was refused. func (or *ObsReport) TracesRefused(ctx context.Context, numSpans int) { - or.telBuilder.ProcessorRefusedSpans.Add(ctx, int64(numSpans), metric.WithAttributes(or.otelAttrs...)) + or.recordData(ctx, component.DataTypeTraces, int64(0), int64(numSpans), int64(0), int64(0)) } // TracesDropped reports that the trace data was dropped. func (or *ObsReport) TracesDropped(ctx context.Context, numSpans int) { - or.telBuilder.ProcessorDroppedSpans.Add(ctx, int64(numSpans), metric.WithAttributes(or.otelAttrs...)) + or.recordData(ctx, component.DataTypeTraces, int64(0), int64(0), int64(numSpans), int64(0)) } // TracesInserted reports that the trace data was inserted. func (or *ObsReport) TracesInserted(ctx context.Context, numSpans int) { - or.telBuilder.ProcessorInsertedSpans.Add(ctx, int64(numSpans), metric.WithAttributes(or.otelAttrs...)) + or.recordData(ctx, component.DataTypeTraces, int64(0), int64(0), int64(0), int64(numSpans)) } // MetricsAccepted reports that the metrics were accepted. func (or *ObsReport) MetricsAccepted(ctx context.Context, numPoints int) { - or.telBuilder.ProcessorAcceptedMetricPoints.Add(ctx, int64(numPoints), metric.WithAttributes(or.otelAttrs...)) + or.recordData(ctx, component.DataTypeMetrics, int64(numPoints), int64(0), int64(0), int64(0)) } // MetricsRefused reports that the metrics were refused. func (or *ObsReport) MetricsRefused(ctx context.Context, numPoints int) { - or.telBuilder.ProcessorRefusedMetricPoints.Add(ctx, int64(numPoints), metric.WithAttributes(or.otelAttrs...)) + or.recordData(ctx, component.DataTypeMetrics, int64(0), int64(numPoints), int64(0), int64(0)) } // MetricsDropped reports that the metrics were dropped. func (or *ObsReport) MetricsDropped(ctx context.Context, numPoints int) { - or.telBuilder.ProcessorDroppedMetricPoints.Add(ctx, int64(numPoints), metric.WithAttributes(or.otelAttrs...)) + or.recordData(ctx, component.DataTypeMetrics, int64(0), int64(0), int64(numPoints), int64(0)) } // MetricsInserted reports that the metrics were inserted. func (or *ObsReport) MetricsInserted(ctx context.Context, numPoints int) { - or.telBuilder.ProcessorInsertedMetricPoints.Add(ctx, int64(numPoints), metric.WithAttributes(or.otelAttrs...)) + or.recordData(ctx, component.DataTypeMetrics, int64(0), int64(0), int64(0), int64(numPoints)) } // LogsAccepted reports that the logs were accepted. func (or *ObsReport) LogsAccepted(ctx context.Context, numRecords int) { - or.telBuilder.ProcessorAcceptedLogRecords.Add(ctx, int64(numRecords), metric.WithAttributes(or.otelAttrs...)) + or.recordData(ctx, component.DataTypeLogs, int64(numRecords), int64(0), int64(0), int64(0)) } // LogsRefused reports that the logs were refused. func (or *ObsReport) LogsRefused(ctx context.Context, numRecords int) { - or.telBuilder.ProcessorRefusedLogRecords.Add(ctx, int64(numRecords), metric.WithAttributes(or.otelAttrs...)) + or.recordData(ctx, component.DataTypeLogs, int64(0), int64(numRecords), int64(0), int64(0)) } // LogsDropped reports that the logs were dropped. func (or *ObsReport) LogsDropped(ctx context.Context, numRecords int) { - or.telBuilder.ProcessorDroppedLogRecords.Add(ctx, int64(numRecords), metric.WithAttributes(or.otelAttrs...)) + or.recordData(ctx, component.DataTypeLogs, int64(0), int64(0), int64(numRecords), int64(0)) } // LogsInserted reports that the logs were inserted. func (or *ObsReport) LogsInserted(ctx context.Context, numRecords int) { - or.telBuilder.ProcessorInsertedLogRecords.Add(ctx, int64(numRecords), metric.WithAttributes(or.otelAttrs...)) + or.recordData(ctx, component.DataTypeLogs, int64(0), int64(0), int64(0), int64(numRecords)) } diff --git a/processor/processorhelper/obsreport_test.go b/processor/processorhelper/obsreport_test.go index 57ae4d04184..63e88bb5ced 100644 --- a/processor/processorhelper/obsreport_test.go +++ b/processor/processorhelper/obsreport_test.go @@ -9,6 +9,8 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + "go.opentelemetry.io/otel/metric" + "go.opentelemetry.io/otel/metric/noop" "go.opentelemetry.io/collector/component" "go.opentelemetry.io/collector/component/componenttest" @@ -217,6 +219,9 @@ func TestNoMetrics(t *testing.T) { set := tt.TelemetrySettings() set.MetricsLevel = configtelemetry.LevelNone + set.LeveledMeterProvider = func(_ configtelemetry.Level) metric.MeterProvider { + return noop.MeterProvider{} + } por, err := NewObsReport(ObsReportSettings{ ProcessorID: processorID, @@ -239,6 +244,9 @@ func TestNoMetrics(t *testing.T) { set := tt.TelemetrySettings() set.MetricsLevel = configtelemetry.LevelNone + set.LeveledMeterProvider = func(_ configtelemetry.Level) metric.MeterProvider { + return noop.MeterProvider{} + } por, err := NewObsReport(ObsReportSettings{ ProcessorID: processorID, @@ -261,6 +269,9 @@ func TestNoMetrics(t *testing.T) { set := tt.TelemetrySettings() set.MetricsLevel = configtelemetry.LevelNone + set.LeveledMeterProvider = func(_ configtelemetry.Level) metric.MeterProvider { + return noop.MeterProvider{} + } por, err := NewObsReport(ObsReportSettings{ ProcessorID: processorID, diff --git a/processor/processorprofiles/go.mod b/processor/processorprofiles/go.mod index 8c69071c354..87cc69ab7f4 100644 --- a/processor/processorprofiles/go.mod +++ b/processor/processorprofiles/go.mod @@ -1,13 +1,13 @@ module go.opentelemetry.io/collector/processor/processorprofiles -go 1.21.0 +go 1.22.0 require ( github.com/stretchr/testify v1.9.0 - go.opentelemetry.io/collector/component v0.106.1 - go.opentelemetry.io/collector/consumer/consumerprofiles v0.106.1 - go.opentelemetry.io/collector/consumer/consumertest v0.106.1 - go.opentelemetry.io/collector/processor v0.106.1 + go.opentelemetry.io/collector/component v0.107.0 + go.opentelemetry.io/collector/consumer/consumerprofiles v0.107.0 + go.opentelemetry.io/collector/consumer/consumertest v0.107.0 + go.opentelemetry.io/collector/processor v0.107.0 ) require ( @@ -17,10 +17,10 @@ require ( github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/collector/config/configtelemetry v0.106.1 // indirect - go.opentelemetry.io/collector/consumer v0.106.1 // indirect - go.opentelemetry.io/collector/pdata v1.12.0 // indirect - go.opentelemetry.io/collector/pdata/pprofile v0.106.1 // indirect + go.opentelemetry.io/collector/config/configtelemetry v0.107.0 // indirect + go.opentelemetry.io/collector/consumer v0.107.0 // indirect + go.opentelemetry.io/collector/pdata v1.13.0 // indirect + go.opentelemetry.io/collector/pdata/pprofile v0.107.0 // indirect go.opentelemetry.io/otel v1.28.0 // indirect go.opentelemetry.io/otel/metric v1.28.0 // indirect go.opentelemetry.io/otel/trace v1.28.0 // indirect @@ -41,8 +41,6 @@ replace go.opentelemetry.io/collector/config/configtelemetry => ../../config/con replace go.opentelemetry.io/collector => ../.. -replace go.opentelemetry.io/collector/internal/globalgates => ../../internal/globalgates - replace go.opentelemetry.io/collector/pdata/pprofile => ../../pdata/pprofile replace go.opentelemetry.io/collector/consumer => ../../consumer @@ -60,3 +58,5 @@ replace go.opentelemetry.io/collector/consumer/consumerprofiles => ../../consume replace go.opentelemetry.io/collector/featuregate => ../../featuregate replace go.opentelemetry.io/collector/consumer/consumertest => ../../consumer/consumertest + +replace go.opentelemetry.io/collector/component/componentstatus => ../../component/componentstatus diff --git a/processor/processorprofiles/go.sum b/processor/processorprofiles/go.sum index 1a8baef6976..ae826f7d610 100644 --- a/processor/processorprofiles/go.sum +++ b/processor/processorprofiles/go.sum @@ -20,6 +20,8 @@ github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnr 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/klauspost/compress v1.17.9 h1:6KIumPrER1LHsvBVuDa0r5xaG0Es51mhhB9BQB2qeMA= +github.com/klauspost/compress v1.17.9/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw= 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= @@ -33,8 +35,8 @@ github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq 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_golang v1.20.1 h1:IMJXHOD6eARkQpxo8KkhgEVFlBNm+nkrFUyGlIu7Na8= +github.com/prometheus/client_golang v1.20.1/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= 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= diff --git a/processor/processortest/nop_processor.go b/processor/processortest/nop_processor.go index c5af55084c1..6e16dbc78e3 100644 --- a/processor/processortest/nop_processor.go +++ b/processor/processortest/nop_processor.go @@ -63,6 +63,9 @@ type nopProcessor struct { } // NewNopBuilder returns a processor.Builder that constructs nop processors. +// +// Deprecated: [v0.108.0] this builder is being internalized within the service module, +// and will be removed soon. func NewNopBuilder() *processor.Builder { nopFactory := NewNopFactory() return processor.NewBuilder( diff --git a/processor/processortest/unhealthy_processor.go b/processor/processortest/unhealthy_processor.go index c537ab53498..3db2a10b667 100644 --- a/processor/processortest/unhealthy_processor.go +++ b/processor/processortest/unhealthy_processor.go @@ -7,6 +7,7 @@ import ( "context" "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/component/componentstatus" "go.opentelemetry.io/collector/component/componenttest" "go.opentelemetry.io/collector/consumer" "go.opentelemetry.io/collector/consumer/consumertest" @@ -62,9 +63,9 @@ type unhealthyProcessor struct { telemetry component.TelemetrySettings } -func (p unhealthyProcessor) Start(context.Context, component.Host) error { +func (p unhealthyProcessor) Start(_ context.Context, host component.Host) error { go func() { - p.telemetry.ReportStatus(component.NewStatusEvent(component.StatusRecoverableError)) + componentstatus.ReportStatus(host, componentstatus.NewEvent(componentstatus.StatusRecoverableError)) }() return nil } diff --git a/receiver/builder.go b/receiver/builder.go index e35826d5609..08462d0425f 100644 --- a/receiver/builder.go +++ b/receiver/builder.go @@ -5,6 +5,7 @@ package receiver // import "go.opentelemetry.io/collector/receiver" import ( "context" + "errors" "fmt" "go.uber.org/zap" @@ -13,13 +14,22 @@ import ( "go.opentelemetry.io/collector/consumer" ) -// Builder receiver is a helper struct that given a set of Configs and Factories helps with creating receivers. +var errNilNextConsumer = errors.New("nil next Consumer") + +// Builder receiver is a helper struct that given a set of Configs and +// Factories helps with creating receivers. +// +// Deprecated: [v0.108.0] this builder is being internalized within the service module, +// and will be removed soon. type Builder struct { cfgs map[component.ID]component.Config factories map[component.Type]Factory } // NewBuilder creates a new receiver.Builder to help with creating components form a set of configs and factories. +// +// Deprecated: [v0.108.0] this builder is being internalized within the service module, +// and will be removed soon. func NewBuilder(cfgs map[component.ID]component.Config, factories map[component.Type]Factory) *Builder { return &Builder{cfgs: cfgs, factories: factories} } diff --git a/receiver/go.mod b/receiver/go.mod index 24fffe2f2b2..5f4c7b4816d 100644 --- a/receiver/go.mod +++ b/receiver/go.mod @@ -1,17 +1,17 @@ module go.opentelemetry.io/collector/receiver -go 1.21.0 +go 1.22.0 require ( github.com/google/uuid v1.6.0 github.com/stretchr/testify v1.9.0 - go.opentelemetry.io/collector v0.106.1 - go.opentelemetry.io/collector/component v0.106.1 - go.opentelemetry.io/collector/config/configtelemetry v0.106.1 - go.opentelemetry.io/collector/consumer v0.106.1 - go.opentelemetry.io/collector/consumer/consumerprofiles v0.106.1 - go.opentelemetry.io/collector/consumer/consumertest v0.106.1 - go.opentelemetry.io/collector/pdata v1.12.0 + go.opentelemetry.io/collector v0.107.0 + go.opentelemetry.io/collector/component v0.107.0 + go.opentelemetry.io/collector/config/configtelemetry v0.107.0 + go.opentelemetry.io/collector/consumer v0.107.0 + go.opentelemetry.io/collector/consumer/consumerprofiles v0.107.0 + go.opentelemetry.io/collector/consumer/consumertest v0.107.0 + go.opentelemetry.io/collector/pdata v1.13.0 go.opentelemetry.io/otel v1.28.0 go.opentelemetry.io/otel/metric v1.28.0 go.opentelemetry.io/otel/sdk v1.28.0 @@ -30,15 +30,16 @@ require ( github.com/go-logr/stdr v1.2.2 // indirect github.com/gogo/protobuf v1.3.2 // indirect github.com/json-iterator/go v1.1.12 // indirect + github.com/klauspost/compress v1.17.9 // 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_golang v1.20.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/pdata/pprofile v0.106.1 // indirect + go.opentelemetry.io/collector/pdata/pprofile v0.107.0 // indirect go.opentelemetry.io/otel/exporters/prometheus v0.50.0 // indirect golang.org/x/net v0.26.0 // indirect golang.org/x/sys v0.22.0 // indirect @@ -69,8 +70,8 @@ replace go.opentelemetry.io/collector/config/configtelemetry => ../config/config replace go.opentelemetry.io/collector/pdata/pprofile => ../pdata/pprofile -replace go.opentelemetry.io/collector/internal/globalgates => ../internal/globalgates - replace go.opentelemetry.io/collector/consumer/consumerprofiles => ../consumer/consumerprofiles replace go.opentelemetry.io/collector/consumer/consumertest => ../consumer/consumertest + +replace go.opentelemetry.io/collector/component/componentstatus => ../component/componentstatus diff --git a/receiver/go.sum b/receiver/go.sum index a8a6b586c17..e8730e47884 100644 --- a/receiver/go.sum +++ b/receiver/go.sum @@ -21,10 +21,14 @@ github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnr 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/klauspost/compress v1.17.9 h1:6KIumPrER1LHsvBVuDa0r5xaG0Es51mhhB9BQB2qeMA= +github.com/klauspost/compress v1.17.9/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw= 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/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= +github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= 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= @@ -34,8 +38,8 @@ github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq 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_golang v1.20.1 h1:IMJXHOD6eARkQpxo8KkhgEVFlBNm+nkrFUyGlIu7Na8= +github.com/prometheus/client_golang v1.20.1/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= 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= diff --git a/receiver/nopreceiver/README.md b/receiver/nopreceiver/README.md index 62a699bb438..36ebbaaba98 100644 --- a/receiver/nopreceiver/README.md +++ b/receiver/nopreceiver/README.md @@ -5,7 +5,7 @@ | ------------- |-----------| | Stability | [beta]: traces, metrics, logs | | Distributions | [core], [contrib] | -| Issues | [![Open issues](https://img.shields.io/github/issues-search/open-telemetry/opentelemetry-collector-contrib?query=is%3Aissue%20is%3Aopen%20label%3Areceiver%2Fnop%20&label=open&color=orange&logo=opentelemetry)](https://github.com/open-telemetry/opentelemetry-collector-contrib/issues?q=is%3Aopen+is%3Aissue+label%3Areceiver%2Fnop) [![Closed issues](https://img.shields.io/github/issues-search/open-telemetry/opentelemetry-collector-contrib?query=is%3Aissue%20is%3Aclosed%20label%3Areceiver%2Fnop%20&label=closed&color=blue&logo=opentelemetry)](https://github.com/open-telemetry/opentelemetry-collector-contrib/issues?q=is%3Aclosed+is%3Aissue+label%3Areceiver%2Fnop) | +| Issues | [![Open issues](https://img.shields.io/github/issues-search/open-telemetry/opentelemetry-collector?query=is%3Aissue%20is%3Aopen%20label%3Areceiver%2Fnop%20&label=open&color=orange&logo=opentelemetry)](https://github.com/open-telemetry/opentelemetry-collector/issues?q=is%3Aopen+is%3Aissue+label%3Areceiver%2Fnop) [![Closed issues](https://img.shields.io/github/issues-search/open-telemetry/opentelemetry-collector?query=is%3Aissue%20is%3Aclosed%20label%3Areceiver%2Fnop%20&label=closed&color=blue&logo=opentelemetry)](https://github.com/open-telemetry/opentelemetry-collector/issues?q=is%3Aclosed+is%3Aissue+label%3Areceiver%2Fnop) | [beta]: https://github.com/open-telemetry/opentelemetry-collector#beta [core]: https://github.com/open-telemetry/opentelemetry-collector-releases/tree/main/distributions/otelcol diff --git a/receiver/nopreceiver/go.mod b/receiver/nopreceiver/go.mod index 9c4d1f6a3d3..6d665181f66 100644 --- a/receiver/nopreceiver/go.mod +++ b/receiver/nopreceiver/go.mod @@ -1,14 +1,14 @@ module go.opentelemetry.io/collector/receiver/nopreceiver -go 1.21.0 +go 1.22.0 require ( github.com/stretchr/testify v1.9.0 - go.opentelemetry.io/collector/component v0.106.1 - go.opentelemetry.io/collector/confmap v0.106.1 - go.opentelemetry.io/collector/consumer v0.106.1 - go.opentelemetry.io/collector/consumer/consumertest v0.106.1 - go.opentelemetry.io/collector/receiver v0.106.1 + go.opentelemetry.io/collector/component v0.107.0 + go.opentelemetry.io/collector/confmap v0.107.0 + go.opentelemetry.io/collector/consumer v0.107.0 + go.opentelemetry.io/collector/consumer/consumertest v0.107.0 + go.opentelemetry.io/collector/receiver v0.107.0 go.uber.org/goleak v1.3.0 ) @@ -18,11 +18,11 @@ require ( github.com/davecgh/go-spew v1.1.1 // indirect github.com/go-logr/logr v1.4.2 // indirect github.com/go-logr/stdr v1.2.2 // indirect - github.com/go-viper/mapstructure/v2 v2.0.0 // indirect + github.com/go-viper/mapstructure/v2 v2.1.0 // indirect github.com/gogo/protobuf v1.3.2 // indirect github.com/google/uuid v1.6.0 // indirect - github.com/hashicorp/go-version v1.7.0 // indirect github.com/json-iterator/go v1.1.12 // indirect + github.com/klauspost/compress v1.17.9 // 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 @@ -32,16 +32,14 @@ require ( 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_golang v1.20.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/config/configtelemetry v0.106.1 // indirect - go.opentelemetry.io/collector/consumer/consumerprofiles v0.106.1 // indirect - go.opentelemetry.io/collector/featuregate v1.12.0 // indirect - go.opentelemetry.io/collector/internal/globalgates v0.106.1 // indirect - go.opentelemetry.io/collector/pdata v1.12.0 // indirect - go.opentelemetry.io/collector/pdata/pprofile v0.106.1 // indirect + go.opentelemetry.io/collector/config/configtelemetry v0.107.0 // indirect + go.opentelemetry.io/collector/consumer/consumerprofiles v0.107.0 // indirect + go.opentelemetry.io/collector/pdata v1.13.0 // indirect + go.opentelemetry.io/collector/pdata/pprofile v0.107.0 // 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 @@ -75,8 +73,6 @@ replace go.opentelemetry.io/collector/config/configtelemetry => ../../config/con replace go.opentelemetry.io/collector => ../.. -replace go.opentelemetry.io/collector/internal/globalgates => ../../internal/globalgates - replace go.opentelemetry.io/collector/featuregate => ../../featuregate replace go.opentelemetry.io/collector/pdata/pprofile => ../../pdata/pprofile @@ -84,3 +80,5 @@ replace go.opentelemetry.io/collector/pdata/pprofile => ../../pdata/pprofile replace go.opentelemetry.io/collector/consumer/consumerprofiles => ../../consumer/consumerprofiles replace go.opentelemetry.io/collector/consumer/consumertest => ../../consumer/consumertest + +replace go.opentelemetry.io/collector/component/componentstatus => ../../component/componentstatus diff --git a/receiver/nopreceiver/go.sum b/receiver/nopreceiver/go.sum index 9f1ade0bfde..87196d45d6f 100644 --- a/receiver/nopreceiver/go.sum +++ b/receiver/nopreceiver/go.sum @@ -10,8 +10,8 @@ github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY= github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= -github.com/go-viper/mapstructure/v2 v2.0.0 h1:dhn8MZ1gZ0mzeodTG3jt5Vj/o87xZKuNAprG2mQfMfc= -github.com/go-viper/mapstructure/v2 v2.0.0/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM= +github.com/go-viper/mapstructure/v2 v2.1.0 h1:gHnMa2Y/pIxElCH2GlZZ1lZSsn6XMtufpGyP1XxdC/w= +github.com/go-viper/mapstructure/v2 v2.1.0/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= @@ -19,12 +19,12 @@ github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeN 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/klauspost/compress v1.17.9 h1:6KIumPrER1LHsvBVuDa0r5xaG0Es51mhhB9BQB2qeMA= +github.com/klauspost/compress v1.17.9/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw= 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= @@ -35,6 +35,8 @@ 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/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= +github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= 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= @@ -48,8 +50,8 @@ github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq 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_golang v1.20.1 h1:IMJXHOD6eARkQpxo8KkhgEVFlBNm+nkrFUyGlIu7Na8= +github.com/prometheus/client_golang v1.20.1/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= 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= diff --git a/receiver/nopreceiver/internal/metadata/generated_status.go b/receiver/nopreceiver/internal/metadata/generated_status.go index 1901cab9ee6..a8716db919c 100644 --- a/receiver/nopreceiver/internal/metadata/generated_status.go +++ b/receiver/nopreceiver/internal/metadata/generated_status.go @@ -7,7 +7,8 @@ import ( ) var ( - Type = component.MustNewType("nop") + Type = component.MustNewType("nop") + ScopeName = "go.opentelemetry.io/collector/receiver/nopreceiver" ) const ( diff --git a/receiver/nopreceiver/metadata.yaml b/receiver/nopreceiver/metadata.yaml index 6a03166e73d..6a994d88c10 100644 --- a/receiver/nopreceiver/metadata.yaml +++ b/receiver/nopreceiver/metadata.yaml @@ -1,4 +1,5 @@ type: nop +github_project: open-telemetry/opentelemetry-collector status: class: receiver diff --git a/receiver/otlpreceiver/README.md b/receiver/otlpreceiver/README.md index 98be8b39ffd..5c9984e023c 100644 --- a/receiver/otlpreceiver/README.md +++ b/receiver/otlpreceiver/README.md @@ -6,7 +6,7 @@ | Stability | [beta]: logs | | | [stable]: traces, metrics | | Distributions | [core], [contrib], [k8s] | -| Issues | [![Open issues](https://img.shields.io/github/issues-search/open-telemetry/opentelemetry-collector-contrib?query=is%3Aissue%20is%3Aopen%20label%3Areceiver%2Fotlp%20&label=open&color=orange&logo=opentelemetry)](https://github.com/open-telemetry/opentelemetry-collector-contrib/issues?q=is%3Aopen+is%3Aissue+label%3Areceiver%2Fotlp) [![Closed issues](https://img.shields.io/github/issues-search/open-telemetry/opentelemetry-collector-contrib?query=is%3Aissue%20is%3Aclosed%20label%3Areceiver%2Fotlp%20&label=closed&color=blue&logo=opentelemetry)](https://github.com/open-telemetry/opentelemetry-collector-contrib/issues?q=is%3Aclosed+is%3Aissue+label%3Areceiver%2Fotlp) | +| Issues | [![Open issues](https://img.shields.io/github/issues-search/open-telemetry/opentelemetry-collector?query=is%3Aissue%20is%3Aopen%20label%3Areceiver%2Fotlp%20&label=open&color=orange&logo=opentelemetry)](https://github.com/open-telemetry/opentelemetry-collector/issues?q=is%3Aopen+is%3Aissue+label%3Areceiver%2Fotlp) [![Closed issues](https://img.shields.io/github/issues-search/open-telemetry/opentelemetry-collector?query=is%3Aissue%20is%3Aclosed%20label%3Areceiver%2Fotlp%20&label=closed&color=blue&logo=opentelemetry)](https://github.com/open-telemetry/opentelemetry-collector/issues?q=is%3Aclosed+is%3Aissue+label%3Areceiver%2Fotlp) | [beta]: https://github.com/open-telemetry/opentelemetry-collector#beta [stable]: https://github.com/open-telemetry/opentelemetry-collector#stable diff --git a/receiver/otlpreceiver/go.mod b/receiver/otlpreceiver/go.mod index 5a27ea8e723..6ef67014741 100644 --- a/receiver/otlpreceiver/go.mod +++ b/receiver/otlpreceiver/go.mod @@ -1,24 +1,25 @@ module go.opentelemetry.io/collector/receiver/otlpreceiver -go 1.21.0 +go 1.22.0 require ( github.com/gogo/protobuf v1.3.2 github.com/klauspost/compress v1.17.9 github.com/stretchr/testify v1.9.0 - go.opentelemetry.io/collector v0.106.1 - go.opentelemetry.io/collector/component v0.106.1 - go.opentelemetry.io/collector/config/configauth v0.106.1 - go.opentelemetry.io/collector/config/configgrpc v0.106.1 - go.opentelemetry.io/collector/config/confighttp v0.106.1 - go.opentelemetry.io/collector/config/confignet v0.106.1 - go.opentelemetry.io/collector/config/configtls v1.12.0 - go.opentelemetry.io/collector/confmap v0.106.1 - go.opentelemetry.io/collector/consumer v0.106.1 - go.opentelemetry.io/collector/consumer/consumertest v0.106.1 - go.opentelemetry.io/collector/pdata v1.12.0 - go.opentelemetry.io/collector/pdata/testdata v0.106.1 - go.opentelemetry.io/collector/receiver v0.106.1 + go.opentelemetry.io/collector v0.107.0 + go.opentelemetry.io/collector/component v0.107.0 + go.opentelemetry.io/collector/component/componentstatus v0.107.0 + go.opentelemetry.io/collector/config/configauth v0.107.0 + go.opentelemetry.io/collector/config/configgrpc v0.107.0 + go.opentelemetry.io/collector/config/confighttp v0.107.0 + go.opentelemetry.io/collector/config/confignet v0.107.0 + go.opentelemetry.io/collector/config/configtls v1.13.0 + go.opentelemetry.io/collector/confmap v0.107.0 + go.opentelemetry.io/collector/consumer v0.107.0 + go.opentelemetry.io/collector/consumer/consumertest v0.107.0 + go.opentelemetry.io/collector/pdata v1.13.0 + go.opentelemetry.io/collector/pdata/testdata v0.107.0 + go.opentelemetry.io/collector/receiver v0.107.0 go.uber.org/goleak v1.3.0 go.uber.org/zap v1.27.0 google.golang.org/genproto/googleapis/rpc v0.0.0-20240701130421-f6361c86f094 @@ -35,7 +36,7 @@ require ( github.com/fsnotify/fsnotify v1.7.0 // 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/go-viper/mapstructure/v2 v2.1.0 // indirect github.com/golang/snappy v0.0.4 // indirect github.com/google/uuid v1.6.0 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.20.0 // indirect @@ -51,22 +52,21 @@ require ( github.com/mostynb/go-grpc-compression v1.2.3 // 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_golang v1.20.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 github.com/rs/cors v1.11.0 // indirect - go.opentelemetry.io/collector/client v0.106.1 // indirect - go.opentelemetry.io/collector/config/configcompression v1.12.0 // indirect - go.opentelemetry.io/collector/config/configopaque v1.12.0 // indirect - go.opentelemetry.io/collector/config/configtelemetry v0.106.1 // indirect - go.opentelemetry.io/collector/config/internal v0.106.1 // indirect - go.opentelemetry.io/collector/consumer/consumerprofiles v0.106.1 // indirect - go.opentelemetry.io/collector/extension v0.106.1 // indirect - go.opentelemetry.io/collector/extension/auth v0.106.1 // indirect - go.opentelemetry.io/collector/featuregate v1.12.0 // indirect - go.opentelemetry.io/collector/internal/globalgates v0.106.1 // indirect - go.opentelemetry.io/collector/pdata/pprofile v0.106.1 // indirect + go.opentelemetry.io/collector/client v1.13.0 // indirect + go.opentelemetry.io/collector/config/configcompression v1.13.0 // indirect + go.opentelemetry.io/collector/config/configopaque v1.13.0 // indirect + go.opentelemetry.io/collector/config/configtelemetry v0.107.0 // indirect + go.opentelemetry.io/collector/config/internal v0.107.0 // indirect + go.opentelemetry.io/collector/consumer/consumerprofiles v0.107.0 // indirect + go.opentelemetry.io/collector/extension v0.107.0 // indirect + go.opentelemetry.io/collector/extension/auth v0.107.0 // indirect + go.opentelemetry.io/collector/featuregate v1.13.0 // indirect + go.opentelemetry.io/collector/pdata/pprofile v0.107.0 // indirect go.opentelemetry.io/contrib/config v0.8.0 // indirect go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.53.0 // indirect go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.53.0 // indirect @@ -140,10 +140,10 @@ retract ( replace go.opentelemetry.io/collector/pdata/pprofile => ../../pdata/pprofile -replace go.opentelemetry.io/collector/internal/globalgates => ../../internal/globalgates - replace go.opentelemetry.io/collector/consumer/consumerprofiles => ../../consumer/consumerprofiles replace go.opentelemetry.io/collector/consumer/consumertest => ../../consumer/consumertest replace go.opentelemetry.io/collector/client => ../../client + +replace go.opentelemetry.io/collector/component/componentstatus => ../../component/componentstatus diff --git a/receiver/otlpreceiver/go.sum b/receiver/otlpreceiver/go.sum index ba98580b4fd..990088ff466 100644 --- a/receiver/otlpreceiver/go.sum +++ b/receiver/otlpreceiver/go.sum @@ -16,8 +16,8 @@ github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY= github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= -github.com/go-viper/mapstructure/v2 v2.0.0 h1:dhn8MZ1gZ0mzeodTG3jt5Vj/o87xZKuNAprG2mQfMfc= -github.com/go-viper/mapstructure/v2 v2.0.0/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM= +github.com/go-viper/mapstructure/v2 v2.1.0 h1:gHnMa2Y/pIxElCH2GlZZ1lZSsn6XMtufpGyP1XxdC/w= +github.com/go-viper/mapstructure/v2 v2.1.0/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM= @@ -47,6 +47,8 @@ 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/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= +github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= 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= @@ -62,8 +64,8 @@ github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq 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_golang v1.20.1 h1:IMJXHOD6eARkQpxo8KkhgEVFlBNm+nkrFUyGlIu7Na8= +github.com/prometheus/client_golang v1.20.1/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= 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= diff --git a/receiver/otlpreceiver/internal/metadata/generated_status.go b/receiver/otlpreceiver/internal/metadata/generated_status.go index c9cff844fa2..02715c16850 100644 --- a/receiver/otlpreceiver/internal/metadata/generated_status.go +++ b/receiver/otlpreceiver/internal/metadata/generated_status.go @@ -7,7 +7,8 @@ import ( ) var ( - Type = component.MustNewType("otlp") + Type = component.MustNewType("otlp") + ScopeName = "go.opentelemetry.io/collector/receiver/otlpreceiver" ) const ( diff --git a/receiver/otlpreceiver/metadata.yaml b/receiver/otlpreceiver/metadata.yaml index db490cfe6fe..115355e784d 100644 --- a/receiver/otlpreceiver/metadata.yaml +++ b/receiver/otlpreceiver/metadata.yaml @@ -1,4 +1,5 @@ type: otlp +github_project: open-telemetry/opentelemetry-collector status: class: receiver diff --git a/receiver/otlpreceiver/otlp.go b/receiver/otlpreceiver/otlp.go index 95d782b880e..f22c9bc9a7e 100644 --- a/receiver/otlpreceiver/otlp.go +++ b/receiver/otlpreceiver/otlp.go @@ -14,6 +14,7 @@ import ( "google.golang.org/grpc" "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/component/componentstatus" "go.opentelemetry.io/collector/config/confighttp" "go.opentelemetry.io/collector/consumer" "go.opentelemetry.io/collector/pdata/plog/plogotlp" @@ -110,7 +111,7 @@ func (r *otlpReceiver) startGRPCServer(host component.Host) error { defer r.shutdownWG.Done() if errGrpc := r.serverGRPC.Serve(gln); errGrpc != nil && !errors.Is(errGrpc, grpc.ErrServerStopped) { - r.settings.ReportStatus(component.NewFatalErrorEvent(errGrpc)) + componentstatus.ReportStatus(host, componentstatus.NewFatalErrorEvent(errGrpc)) } }() return nil @@ -160,7 +161,7 @@ func (r *otlpReceiver) startHTTPServer(ctx context.Context, host component.Host) defer r.shutdownWG.Done() if errHTTP := r.serverHTTP.Serve(hln); errHTTP != nil && !errors.Is(errHTTP, http.ErrServerClosed) { - r.settings.ReportStatus(component.NewFatalErrorEvent(errHTTP)) + componentstatus.ReportStatus(host, componentstatus.NewFatalErrorEvent(errHTTP)) } }() return nil diff --git a/receiver/receiver.go b/receiver/receiver.go index 2ad2b90a789..0f3b5a886fb 100644 --- a/receiver/receiver.go +++ b/receiver/receiver.go @@ -4,17 +4,12 @@ package receiver // import "go.opentelemetry.io/collector/receiver" import ( - "errors" "fmt" "go.opentelemetry.io/collector/component" "go.opentelemetry.io/collector/receiver/internal" ) -var ( - errNilNextConsumer = errors.New("nil next Consumer") -) - // Traces receiver receives traces. // Its purpose is to translate data from any format to the collector's internal trace format. // TracesReceiver feeds a consumer.Traces with data. diff --git a/receiver/receiverhelper/generated_component_telemetry_test.go b/receiver/receiverhelper/generated_component_telemetry_test.go index e858cbac476..7cef87c72b2 100644 --- a/receiver/receiverhelper/generated_component_telemetry_test.go +++ b/receiver/receiverhelper/generated_component_telemetry_test.go @@ -7,11 +7,13 @@ import ( "testing" "github.com/stretchr/testify/require" + "go.opentelemetry.io/otel/metric" sdkmetric "go.opentelemetry.io/otel/sdk/metric" "go.opentelemetry.io/otel/sdk/metric/metricdata" "go.opentelemetry.io/otel/sdk/metric/metricdata/metricdatatest" "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/config/configtelemetry" "go.opentelemetry.io/collector/receiver" "go.opentelemetry.io/collector/receiver/receivertest" ) @@ -24,6 +26,9 @@ type componentTestTelemetry struct { func (tt *componentTestTelemetry) NewSettings() receiver.Settings { settings := receivertest.NewNopSettings() settings.MeterProvider = tt.meterProvider + settings.LeveledMeterProvider = func(_ configtelemetry.Level) metric.MeterProvider { + return tt.meterProvider + } settings.ID = component.NewID(component.MustNewType("receiverhelper")) return settings diff --git a/receiver/receiverhelper/internal/metadata/generated_telemetry.go b/receiver/receiverhelper/internal/metadata/generated_telemetry.go index 8e0b5a8455a..b0e676d1961 100644 --- a/receiver/receiverhelper/internal/metadata/generated_telemetry.go +++ b/receiver/receiverhelper/internal/metadata/generated_telemetry.go @@ -13,10 +13,15 @@ import ( "go.opentelemetry.io/collector/config/configtelemetry" ) +// Deprecated: [v0.108.0] use LeveledMeter instead. func Meter(settings component.TelemetrySettings) metric.Meter { return settings.MeterProvider.Meter("go.opentelemetry.io/collector/receiver/receiverhelper") } +func LeveledMeter(settings component.TelemetrySettings, level configtelemetry.Level) metric.Meter { + return settings.LeveledMeterProvider(level).Meter("go.opentelemetry.io/collector/receiver/receiverhelper") +} + func Tracer(settings component.TelemetrySettings) trace.Tracer { return settings.TracerProvider.Tracer("go.opentelemetry.io/collector/receiver/receiverhelper") } diff --git a/receiver/receiverhelper/internal/metadata/generated_telemetry_test.go b/receiver/receiverhelper/internal/metadata/generated_telemetry_test.go index 65b40921527..c96d8509125 100644 --- a/receiver/receiverhelper/internal/metadata/generated_telemetry_test.go +++ b/receiver/receiverhelper/internal/metadata/generated_telemetry_test.go @@ -14,6 +14,7 @@ import ( nooptrace "go.opentelemetry.io/otel/trace/noop" "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/config/configtelemetry" ) type mockMeter struct { @@ -43,6 +44,9 @@ func (m mockTracerProvider) Tracer(name string, opts ...trace.TracerOption) trac func TestProviders(t *testing.T) { set := component.TelemetrySettings{ + LeveledMeterProvider: func(_ configtelemetry.Level) metric.MeterProvider { + return mockMeterProvider{} + }, MeterProvider: mockMeterProvider{}, TracerProvider: mockTracerProvider{}, } @@ -64,6 +68,9 @@ func TestProviders(t *testing.T) { func TestNewTelemetryBuilder(t *testing.T) { set := component.TelemetrySettings{ + LeveledMeterProvider: func(_ configtelemetry.Level) metric.MeterProvider { + return mockMeterProvider{} + }, MeterProvider: mockMeterProvider{}, TracerProvider: mockTracerProvider{}, } diff --git a/receiver/receiverhelper/metadata.yaml b/receiver/receiverhelper/metadata.yaml index 373b6838262..e2efe523e37 100644 --- a/receiver/receiverhelper/metadata.yaml +++ b/receiver/receiverhelper/metadata.yaml @@ -1,4 +1,5 @@ type: receiverhelper +github_project: open-telemetry/opentelemetry-collector status: class: receiver diff --git a/receiver/receiverprofiles/go.mod b/receiver/receiverprofiles/go.mod index af06ebf2a56..7dc32e3b254 100644 --- a/receiver/receiverprofiles/go.mod +++ b/receiver/receiverprofiles/go.mod @@ -1,13 +1,13 @@ module go.opentelemetry.io/collector/receiver/receiverprofiles -go 1.21.0 +go 1.22.0 require ( github.com/stretchr/testify v1.9.0 - go.opentelemetry.io/collector/component v0.106.1 - go.opentelemetry.io/collector/consumer/consumerprofiles v0.106.1 - go.opentelemetry.io/collector/consumer/consumertest v0.106.1 - go.opentelemetry.io/collector/receiver v0.106.1 + go.opentelemetry.io/collector/component v0.107.0 + go.opentelemetry.io/collector/consumer/consumerprofiles v0.107.0 + go.opentelemetry.io/collector/consumer/consumertest v0.107.0 + go.opentelemetry.io/collector/receiver v0.107.0 ) require ( @@ -17,10 +17,10 @@ require ( github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/collector/config/configtelemetry v0.106.1 // indirect - go.opentelemetry.io/collector/consumer v0.106.1 // indirect - go.opentelemetry.io/collector/pdata v1.12.0 // indirect - go.opentelemetry.io/collector/pdata/pprofile v0.106.1 // indirect + go.opentelemetry.io/collector/config/configtelemetry v0.107.0 // indirect + go.opentelemetry.io/collector/consumer v0.107.0 // indirect + go.opentelemetry.io/collector/pdata v1.13.0 // indirect + go.opentelemetry.io/collector/pdata/pprofile v0.107.0 // indirect go.opentelemetry.io/otel v1.28.0 // indirect go.opentelemetry.io/otel/metric v1.28.0 // indirect go.opentelemetry.io/otel/trace v1.28.0 // indirect @@ -49,8 +49,6 @@ replace go.opentelemetry.io/collector/config/configtelemetry => ../../config/con replace go.opentelemetry.io/collector => ../.. -replace go.opentelemetry.io/collector/internal/globalgates => ../../internal/globalgates - replace go.opentelemetry.io/collector/pdata/testdata => ../../pdata/testdata replace go.opentelemetry.io/collector/featuregate => ../../featuregate @@ -60,3 +58,5 @@ replace go.opentelemetry.io/collector/pdata/pprofile => ../../pdata/pprofile replace go.opentelemetry.io/collector/pdata => ../../pdata replace go.opentelemetry.io/collector/consumer/consumertest => ../../consumer/consumertest + +replace go.opentelemetry.io/collector/component/componentstatus => ../../component/componentstatus diff --git a/receiver/receiverprofiles/go.sum b/receiver/receiverprofiles/go.sum index 1a8baef6976..ae826f7d610 100644 --- a/receiver/receiverprofiles/go.sum +++ b/receiver/receiverprofiles/go.sum @@ -20,6 +20,8 @@ github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnr 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/klauspost/compress v1.17.9 h1:6KIumPrER1LHsvBVuDa0r5xaG0Es51mhhB9BQB2qeMA= +github.com/klauspost/compress v1.17.9/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw= 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= @@ -33,8 +35,8 @@ github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq 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_golang v1.20.1 h1:IMJXHOD6eARkQpxo8KkhgEVFlBNm+nkrFUyGlIu7Na8= +github.com/prometheus/client_golang v1.20.1/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= 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= diff --git a/receiver/receivertest/contract_checker.go b/receiver/receivertest/contract_checker.go index d52e1d3a60f..32e5681bfdc 100644 --- a/receiver/receivertest/contract_checker.go +++ b/receiver/receivertest/contract_checker.go @@ -7,7 +7,7 @@ import ( "context" "errors" "fmt" - "math/rand" + "math/rand/v2" "sync" "sync/atomic" "testing" diff --git a/receiver/receivertest/nop_receiver.go b/receiver/receivertest/nop_receiver.go index e9d22eee0de..f97ccf2eb53 100644 --- a/receiver/receivertest/nop_receiver.go +++ b/receiver/receivertest/nop_receiver.go @@ -77,6 +77,9 @@ type nopReceiver struct { } // NewNopBuilder returns a receiver.Builder that constructs nop receivers. +// +// Deprecated: [v0.108.0] this builder is being internalized within the service module, +// and will be removed soon. func NewNopBuilder() *receiver.Builder { nopFactory := NewNopFactory() return receiver.NewBuilder( diff --git a/receiver/scraperhelper/generated_component_telemetry_test.go b/receiver/scraperhelper/generated_component_telemetry_test.go index d0e9d175ff9..0610d16424b 100644 --- a/receiver/scraperhelper/generated_component_telemetry_test.go +++ b/receiver/scraperhelper/generated_component_telemetry_test.go @@ -7,11 +7,13 @@ import ( "testing" "github.com/stretchr/testify/require" + "go.opentelemetry.io/otel/metric" sdkmetric "go.opentelemetry.io/otel/sdk/metric" "go.opentelemetry.io/otel/sdk/metric/metricdata" "go.opentelemetry.io/otel/sdk/metric/metricdata/metricdatatest" "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/config/configtelemetry" "go.opentelemetry.io/collector/receiver" "go.opentelemetry.io/collector/receiver/receivertest" ) @@ -24,6 +26,9 @@ type componentTestTelemetry struct { func (tt *componentTestTelemetry) NewSettings() receiver.Settings { settings := receivertest.NewNopSettings() settings.MeterProvider = tt.meterProvider + settings.LeveledMeterProvider = func(_ configtelemetry.Level) metric.MeterProvider { + return tt.meterProvider + } settings.ID = component.NewID(component.MustNewType("scraperhelper")) return settings diff --git a/receiver/scraperhelper/internal/metadata/generated_telemetry.go b/receiver/scraperhelper/internal/metadata/generated_telemetry.go index 98cf15f4123..204dcb0ff55 100644 --- a/receiver/scraperhelper/internal/metadata/generated_telemetry.go +++ b/receiver/scraperhelper/internal/metadata/generated_telemetry.go @@ -13,10 +13,15 @@ import ( "go.opentelemetry.io/collector/config/configtelemetry" ) +// Deprecated: [v0.108.0] use LeveledMeter instead. func Meter(settings component.TelemetrySettings) metric.Meter { return settings.MeterProvider.Meter("go.opentelemetry.io/collector/receiver/scraperhelper") } +func LeveledMeter(settings component.TelemetrySettings, level configtelemetry.Level) metric.Meter { + return settings.LeveledMeterProvider(level).Meter("go.opentelemetry.io/collector/receiver/scraperhelper") +} + func Tracer(settings component.TelemetrySettings) trace.Tracer { return settings.TracerProvider.Tracer("go.opentelemetry.io/collector/receiver/scraperhelper") } diff --git a/receiver/scraperhelper/internal/metadata/generated_telemetry_test.go b/receiver/scraperhelper/internal/metadata/generated_telemetry_test.go index 4973ec82ec9..d2d189e7643 100644 --- a/receiver/scraperhelper/internal/metadata/generated_telemetry_test.go +++ b/receiver/scraperhelper/internal/metadata/generated_telemetry_test.go @@ -14,6 +14,7 @@ import ( nooptrace "go.opentelemetry.io/otel/trace/noop" "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/config/configtelemetry" ) type mockMeter struct { @@ -43,6 +44,9 @@ func (m mockTracerProvider) Tracer(name string, opts ...trace.TracerOption) trac func TestProviders(t *testing.T) { set := component.TelemetrySettings{ + LeveledMeterProvider: func(_ configtelemetry.Level) metric.MeterProvider { + return mockMeterProvider{} + }, MeterProvider: mockMeterProvider{}, TracerProvider: mockTracerProvider{}, } @@ -64,6 +68,9 @@ func TestProviders(t *testing.T) { func TestNewTelemetryBuilder(t *testing.T) { set := component.TelemetrySettings{ + LeveledMeterProvider: func(_ configtelemetry.Level) metric.MeterProvider { + return mockMeterProvider{} + }, MeterProvider: mockMeterProvider{}, TracerProvider: mockTracerProvider{}, } diff --git a/receiver/scraperhelper/metadata.yaml b/receiver/scraperhelper/metadata.yaml index b5a2e34efcb..011002be539 100644 --- a/receiver/scraperhelper/metadata.yaml +++ b/receiver/scraperhelper/metadata.yaml @@ -1,4 +1,5 @@ type: scraperhelper +github_project: open-telemetry/opentelemetry-collector status: class: receiver diff --git a/renovate.json b/renovate.json index 97c5d8a2792..d41340adbf3 100644 --- a/renovate.json +++ b/renovate.json @@ -5,7 +5,7 @@ "dependencies" ], "constraints": { - "go": "1.21" + "go": "1.22" }, "extends": ["config:recommended"], "schedule": ["every tuesday"], diff --git a/semconv/go.mod b/semconv/go.mod index 09c3f5a8d6d..cffa4f74aa2 100644 --- a/semconv/go.mod +++ b/semconv/go.mod @@ -1,6 +1,6 @@ module go.opentelemetry.io/collector/semconv -go 1.21.0 +go 1.22.0 require ( github.com/hashicorp/go-version v1.7.0 diff --git a/service/extensions/extensions.go b/service/extensions/extensions.go index b45221ee268..c3a83192158 100644 --- a/service/extensions/extensions.go +++ b/service/extensions/extensions.go @@ -13,8 +13,10 @@ import ( "go.uber.org/zap" "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/component/componentstatus" "go.opentelemetry.io/collector/confmap" "go.opentelemetry.io/collector/extension" + "go.opentelemetry.io/collector/service/internal/builders" "go.opentelemetry.io/collector/service/internal/components" "go.opentelemetry.io/collector/service/internal/status" "go.opentelemetry.io/collector/service/internal/zpages" @@ -26,7 +28,7 @@ const zExtensionName = "zextensionname" type Extensions struct { telemetry component.TelemetrySettings extMap map[component.ID]extension.Extension - instanceIDs map[component.ID]*component.InstanceID + instanceIDs map[component.ID]*componentstatus.InstanceID extensionIDs []component.ID // start order (and reverse stop order) reporter status.Reporter } @@ -41,12 +43,12 @@ func (bes *Extensions) Start(ctx context.Context, host component.Host) error { ext := bes.extMap[extID] bes.reporter.ReportStatus( instanceID, - component.NewStatusEvent(component.StatusStarting), + componentstatus.NewEvent(componentstatus.StatusStarting), ) if err := ext.Start(ctx, host); err != nil { bes.reporter.ReportStatus( instanceID, - component.NewPermanentErrorEvent(err), + componentstatus.NewPermanentErrorEvent(err), ) // We log with zap.AddStacktrace(zap.DPanicLevel) to avoid adding the stack trace to the error log extLogger.WithOptions(zap.AddStacktrace(zap.DPanicLevel)).Error("Failed to start extension", zap.Error(err)) @@ -68,19 +70,19 @@ func (bes *Extensions) Shutdown(ctx context.Context) error { ext := bes.extMap[extID] bes.reporter.ReportStatus( instanceID, - component.NewStatusEvent(component.StatusStopping), + componentstatus.NewEvent(componentstatus.StatusStopping), ) if err := ext.Shutdown(ctx); err != nil { bes.reporter.ReportStatus( instanceID, - component.NewPermanentErrorEvent(err), + componentstatus.NewPermanentErrorEvent(err), ) errs = multierr.Append(errs, err) continue } bes.reporter.ReportStatus( instanceID, - component.NewStatusEvent(component.StatusStopped), + componentstatus.NewEvent(componentstatus.StatusStopped), ) } @@ -122,10 +124,10 @@ func (bes *Extensions) NotifyConfig(ctx context.Context, conf *confmap.Conf) err return errs } -func (bes *Extensions) NotifyComponentStatusChange(source *component.InstanceID, event *component.StatusEvent) { +func (bes *Extensions) NotifyComponentStatusChange(source *componentstatus.InstanceID, event *componentstatus.Event) { for _, extID := range bes.extensionIDs { ext := bes.extMap[extID] - if sw, ok := ext.(extension.StatusWatcher); ok { + if sw, ok := ext.(componentstatus.Watcher); ok { sw.ComponentStatusChanged(source, event) } } @@ -167,11 +169,12 @@ func (bes *Extensions) HandleZPages(w http.ResponseWriter, r *http.Request) { // Settings holds configuration for building Extensions. type Settings struct { - Telemetry component.TelemetrySettings - BuildInfo component.BuildInfo + Telemetry component.TelemetrySettings + BuildInfo component.BuildInfo + ModuleInfo extension.ModuleInfo // Extensions builder for extensions. - Extensions *extension.Builder + Extensions builders.Extension } type Option func(*Extensions) @@ -187,7 +190,7 @@ func New(ctx context.Context, set Settings, cfg Config, options ...Option) (*Ext exts := &Extensions{ telemetry: set.Telemetry, extMap: make(map[component.ID]extension.Extension), - instanceIDs: make(map[component.ID]*component.InstanceID), + instanceIDs: make(map[component.ID]*componentstatus.InstanceID), extensionIDs: make([]component.ID, 0, len(cfg)), reporter: &nopReporter{}, } @@ -197,16 +200,13 @@ func New(ctx context.Context, set Settings, cfg Config, options ...Option) (*Ext } for _, extID := range cfg { - instanceID := &component.InstanceID{ - ID: extID, - Kind: component.KindExtension, - } + instanceID := componentstatus.NewInstanceID(extID, component.KindExtension) extSet := extension.Settings{ ID: extID, TelemetrySettings: set.Telemetry, BuildInfo: set.BuildInfo, + ModuleInfo: set.ModuleInfo, } - extSet.TelemetrySettings.ReportStatus = status.NewReportStatusFunc(instanceID, exts.reporter.ReportStatus) extSet.TelemetrySettings.Logger = components.ExtensionLogger(set.Telemetry.Logger, extID) ext, err := set.Extensions.Create(ctx, extSet) @@ -234,6 +234,6 @@ type nopReporter struct{} func (r *nopReporter) Ready() {} -func (r *nopReporter) ReportStatus(*component.InstanceID, *component.StatusEvent) {} +func (r *nopReporter) ReportStatus(*componentstatus.InstanceID, *componentstatus.Event) {} -func (r *nopReporter) ReportOKIfStarting(*component.InstanceID) {} +func (r *nopReporter) ReportOKIfStarting(*componentstatus.InstanceID) {} diff --git a/service/extensions/extensions_test.go b/service/extensions/extensions_test.go index 8b40d8c90f7..96bfa36071d 100644 --- a/service/extensions/extensions_test.go +++ b/service/extensions/extensions_test.go @@ -6,16 +6,19 @@ package extensions import ( "context" "errors" + "slices" "testing" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/component/componentstatus" "go.opentelemetry.io/collector/component/componenttest" "go.opentelemetry.io/collector/confmap" "go.opentelemetry.io/collector/extension" "go.opentelemetry.io/collector/extension/extensiontest" + "go.opentelemetry.io/collector/service/internal/builders" "go.opentelemetry.io/collector/service/internal/status" ) @@ -84,7 +87,7 @@ func TestBuildExtensions(t *testing.T) { _, err := New(context.Background(), Settings{ Telemetry: componenttest.NewNopTelemetrySettings(), BuildInfo: component.NewDefaultBuildInfo(), - Extensions: extension.NewBuilder(tt.extensionsConfigs, tt.factories), + Extensions: builders.NewExtension(tt.extensionsConfigs, tt.factories), }, tt.config) require.Error(t, err) assert.EqualError(t, err, tt.wantErrMsg) @@ -176,7 +179,7 @@ func (tc testOrderCase) testOrdering(t *testing.T) { exts, err := New(context.Background(), Settings{ Telemetry: componenttest.NewNopTelemetrySettings(), BuildInfo: component.NewDefaultBuildInfo(), - Extensions: extension.NewBuilder( + Extensions: builders.NewExtension( extCfgs, map[component.Type]extension.Factory{ recordingExtensionFactory.Type(): recordingExtensionFactory, @@ -193,16 +196,9 @@ func (tc testOrderCase) testOrdering(t *testing.T) { err = exts.Shutdown(context.Background()) require.NoError(t, err) - // TODO From Go 1.21 can use slices.Reverse() - reverseSlice := func(s []string) { - for i, j := 0, len(s)-1; i < j; i, j = i+1, j-1 { - s[i], s[j] = s[j], s[i] - } - } - if len(tc.order) > 0 { require.Equal(t, tc.order, startOrder) - reverseSlice(shutdownOrder) + slices.Reverse(shutdownOrder) require.Equal(t, tc.order, shutdownOrder) } } @@ -285,7 +281,7 @@ func TestNotifyConfig(t *testing.T) { extensions, err := New(context.Background(), Settings{ Telemetry: componenttest.NewNopTelemetrySettings(), BuildInfo: component.NewDefaultBuildInfo(), - Extensions: extension.NewBuilder(tt.extensionsConfigs, tt.factories), + Extensions: builders.NewExtension(tt.extensionsConfigs, tt.factories), }, tt.serviceExtensions) assert.NoError(t, err) errs := extensions.NotifyConfig(context.Background(), confmap.NewFromStringMap(map[string]interface{}{})) @@ -360,7 +356,7 @@ func newCreateErrorExtensionFactory() extension.Factory { func TestStatusReportedOnStartupShutdown(t *testing.T) { // compare two slices of status events ignoring timestamp - assertEqualStatuses := func(t *testing.T, evts1, evts2 []*component.StatusEvent) { + assertEqualStatuses := func(t *testing.T, evts1, evts2 []*componentstatus.Event) { assert.Equal(t, len(evts1), len(evts2)) for i := 0; i < len(evts1); i++ { ev1 := evts1[i] @@ -372,37 +368,37 @@ func TestStatusReportedOnStartupShutdown(t *testing.T) { for _, tc := range []struct { name string - expectedStatuses []*component.StatusEvent + expectedStatuses []*componentstatus.Event startErr error shutdownErr error }{ { name: "successful startup/shutdown", - expectedStatuses: []*component.StatusEvent{ - component.NewStatusEvent(component.StatusStarting), - component.NewStatusEvent(component.StatusOK), - component.NewStatusEvent(component.StatusStopping), - component.NewStatusEvent(component.StatusStopped), + expectedStatuses: []*componentstatus.Event{ + componentstatus.NewEvent(componentstatus.StatusStarting), + componentstatus.NewEvent(componentstatus.StatusOK), + componentstatus.NewEvent(componentstatus.StatusStopping), + componentstatus.NewEvent(componentstatus.StatusStopped), }, startErr: nil, shutdownErr: nil, }, { name: "start error", - expectedStatuses: []*component.StatusEvent{ - component.NewStatusEvent(component.StatusStarting), - component.NewPermanentErrorEvent(assert.AnError), + expectedStatuses: []*componentstatus.Event{ + componentstatus.NewEvent(componentstatus.StatusStarting), + componentstatus.NewPermanentErrorEvent(assert.AnError), }, startErr: assert.AnError, shutdownErr: nil, }, { name: "shutdown error", - expectedStatuses: []*component.StatusEvent{ - component.NewStatusEvent(component.StatusStarting), - component.NewStatusEvent(component.StatusOK), - component.NewStatusEvent(component.StatusStopping), - component.NewPermanentErrorEvent(assert.AnError), + expectedStatuses: []*componentstatus.Event{ + componentstatus.NewEvent(componentstatus.StatusStarting), + componentstatus.NewEvent(componentstatus.StatusOK), + componentstatus.NewEvent(componentstatus.StatusStopping), + componentstatus.NewPermanentErrorEvent(assert.AnError), }, startErr: nil, shutdownErr: assert.AnError, @@ -420,8 +416,8 @@ func TestStatusReportedOnStartupShutdown(t *testing.T) { statusType: factory, } - var actualStatuses []*component.StatusEvent - rep := status.NewReporter(func(_ *component.InstanceID, ev *component.StatusEvent) { + var actualStatuses []*componentstatus.Event + rep := status.NewReporter(func(_ *componentstatus.InstanceID, ev *componentstatus.Event) { actualStatuses = append(actualStatuses, ev) }, func(err error) { require.NoError(t, err) @@ -432,7 +428,7 @@ func TestStatusReportedOnStartupShutdown(t *testing.T) { Settings{ Telemetry: componenttest.NewNopTelemetrySettings(), BuildInfo: component.NewDefaultBuildInfo(), - Extensions: extension.NewBuilder(extensionsConfigs, factories), + Extensions: builders.NewExtension(extensionsConfigs, factories), }, []component.ID{compID}, WithReporter(rep), diff --git a/service/generated_package_test.go b/service/generated_package_test.go index bc7ce3cd666..a218b3677e2 100644 --- a/service/generated_package_test.go +++ b/service/generated_package_test.go @@ -9,5 +9,5 @@ import ( ) func TestMain(m *testing.M) { - goleak.VerifyTestMain(m, goleak.IgnoreTopFunction("go.opentelemetry.io/collector/service/internal/proctelemetry.InitPrometheusServer.func1")) + goleak.VerifyTestMain(m) } diff --git a/service/go.mod b/service/go.mod index 09fd63fa326..b73d39b161b 100644 --- a/service/go.mod +++ b/service/go.mod @@ -1,31 +1,33 @@ module go.opentelemetry.io/collector/service -go 1.21.0 +go 1.22.0 require ( github.com/google/uuid v1.6.0 - github.com/prometheus/client_golang v1.19.1 + github.com/prometheus/client_golang v1.20.1 github.com/prometheus/client_model v0.6.1 github.com/prometheus/common v0.55.0 github.com/shirou/gopsutil/v4 v4.24.7 github.com/stretchr/testify v1.9.0 - go.opentelemetry.io/collector v0.106.1 - go.opentelemetry.io/collector/component v0.106.1 - go.opentelemetry.io/collector/config/confighttp v0.106.1 - go.opentelemetry.io/collector/config/configtelemetry v0.106.1 - go.opentelemetry.io/collector/confmap v0.106.1 - go.opentelemetry.io/collector/connector v0.106.1 - go.opentelemetry.io/collector/consumer v0.106.1 - go.opentelemetry.io/collector/consumer/consumertest v0.106.1 - go.opentelemetry.io/collector/exporter v0.106.1 - go.opentelemetry.io/collector/extension v0.106.1 - go.opentelemetry.io/collector/extension/zpagesextension v0.106.1 - go.opentelemetry.io/collector/featuregate v1.12.0 - go.opentelemetry.io/collector/pdata v1.12.0 - go.opentelemetry.io/collector/pdata/testdata v0.106.1 - go.opentelemetry.io/collector/processor v0.106.1 - go.opentelemetry.io/collector/receiver v0.106.1 - go.opentelemetry.io/collector/semconv v0.106.1 + go.opentelemetry.io/collector v0.107.0 + go.opentelemetry.io/collector/component v0.107.0 + go.opentelemetry.io/collector/component/componentstatus v0.107.0 + go.opentelemetry.io/collector/config/confighttp v0.107.0 + go.opentelemetry.io/collector/config/configtelemetry v0.107.0 + go.opentelemetry.io/collector/confmap v0.107.0 + go.opentelemetry.io/collector/connector v0.107.0 + go.opentelemetry.io/collector/consumer v0.107.0 + go.opentelemetry.io/collector/consumer/consumertest v0.107.0 + go.opentelemetry.io/collector/exporter v0.107.0 + go.opentelemetry.io/collector/extension v0.107.0 + go.opentelemetry.io/collector/extension/zpagesextension v0.107.0 + go.opentelemetry.io/collector/featuregate v1.13.0 + go.opentelemetry.io/collector/internal/globalgates v0.107.0 + go.opentelemetry.io/collector/pdata v1.13.0 + go.opentelemetry.io/collector/pdata/testdata v0.107.0 + go.opentelemetry.io/collector/processor v0.107.0 + go.opentelemetry.io/collector/receiver v0.107.0 + go.opentelemetry.io/collector/semconv v0.107.0 go.opentelemetry.io/contrib/config v0.8.0 go.opentelemetry.io/contrib/propagators/b3 v1.28.0 go.opentelemetry.io/otel v1.28.0 @@ -40,7 +42,7 @@ require ( go.uber.org/goleak v1.3.0 go.uber.org/multierr v1.11.0 go.uber.org/zap v1.27.0 - gonum.org/v1/gonum v0.15.0 + gonum.org/v1/gonum v0.15.1 ) require ( @@ -53,7 +55,7 @@ require ( github.com/go-logr/logr v1.4.2 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/go-ole/go-ole v1.2.6 // indirect - github.com/go-viper/mapstructure/v2 v2.0.0 // indirect + github.com/go-viper/mapstructure/v2 v2.1.0 // indirect github.com/gogo/protobuf v1.3.2 // indirect github.com/golang/snappy v0.0.4 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.20.0 // indirect @@ -77,17 +79,16 @@ require ( github.com/tklauser/go-sysconf v0.3.12 // indirect github.com/tklauser/numcpus v0.6.1 // indirect github.com/yusufpapurcu/wmi v1.2.4 // indirect - go.opentelemetry.io/collector/client v0.106.1 // indirect - go.opentelemetry.io/collector/component/componentprofiles v0.106.1 // indirect - go.opentelemetry.io/collector/config/configauth v0.106.1 // indirect - go.opentelemetry.io/collector/config/configcompression v1.12.0 // indirect - go.opentelemetry.io/collector/config/configopaque v1.12.0 // indirect - go.opentelemetry.io/collector/config/configtls v1.12.0 // indirect - go.opentelemetry.io/collector/config/internal v0.106.1 // indirect - go.opentelemetry.io/collector/consumer/consumerprofiles v0.106.1 // indirect - go.opentelemetry.io/collector/extension/auth v0.106.1 // indirect - go.opentelemetry.io/collector/internal/globalgates v0.106.1 // indirect - go.opentelemetry.io/collector/pdata/pprofile v0.106.1 // indirect + go.opentelemetry.io/collector/client v1.13.0 // indirect + go.opentelemetry.io/collector/component/componentprofiles v0.107.0 // indirect + go.opentelemetry.io/collector/config/configauth v0.107.0 // indirect + go.opentelemetry.io/collector/config/configcompression v1.13.0 // indirect + go.opentelemetry.io/collector/config/configopaque v1.13.0 // indirect + go.opentelemetry.io/collector/config/configtls v1.13.0 // indirect + go.opentelemetry.io/collector/config/internal v0.107.0 // indirect + go.opentelemetry.io/collector/consumer/consumerprofiles v0.107.0 // indirect + go.opentelemetry.io/collector/extension/auth v0.107.0 // indirect + go.opentelemetry.io/collector/pdata/pprofile v0.107.0 // indirect go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.53.0 // indirect go.opentelemetry.io/contrib/zpages v0.53.0 // indirect go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp v0.4.0 // indirect @@ -99,7 +100,7 @@ require ( go.opentelemetry.io/otel/sdk/log v0.4.0 // indirect go.opentelemetry.io/proto/otlp v1.3.1 // indirect golang.org/x/net v0.28.0 // indirect - golang.org/x/sys v0.23.0 // indirect + golang.org/x/sys v0.24.0 // indirect golang.org/x/text v0.17.0 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20240701130421-f6361c86f094 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240701130421-f6361c86f094 // indirect @@ -114,6 +115,8 @@ replace go.opentelemetry.io/collector/connector => ../connector replace go.opentelemetry.io/collector/component => ../component +replace go.opentelemetry.io/collector/component/componentstatus => ../component/componentstatus + replace go.opentelemetry.io/collector/pdata => ../pdata replace go.opentelemetry.io/collector/pdata/testdata => ../pdata/testdata @@ -156,8 +159,6 @@ replace go.opentelemetry.io/collector/config/configcompression => ../config/conf replace go.opentelemetry.io/collector/pdata/pprofile => ../pdata/pprofile -replace go.opentelemetry.io/collector/internal/globalgates => ../internal/globalgates - replace go.opentelemetry.io/collector/consumer/consumerprofiles => ../consumer/consumerprofiles replace go.opentelemetry.io/collector/consumer/consumertest => ../consumer/consumertest @@ -165,3 +166,5 @@ replace go.opentelemetry.io/collector/consumer/consumertest => ../consumer/consu replace go.opentelemetry.io/collector/component/componentprofiles => ../component/componentprofiles replace go.opentelemetry.io/collector/client => ../client + +replace go.opentelemetry.io/collector/internal/globalgates => ../internal/globalgates diff --git a/service/go.sum b/service/go.sum index 32bf4d8d795..f32de918bc4 100644 --- a/service/go.sum +++ b/service/go.sum @@ -18,8 +18,8 @@ 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-ole/go-ole v1.2.6 h1:/Fpf6oFPoeFik9ty7siob0G6Ke8QvQEuVcuChpwXzpY= github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0= -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/go-viper/mapstructure/v2 v2.1.0 h1:gHnMa2Y/pIxElCH2GlZZ1lZSsn6XMtufpGyP1XxdC/w= +github.com/go-viper/mapstructure/v2 v2.1.0/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM= @@ -50,6 +50,8 @@ 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/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= +github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 h1:6E+4a0GO5zZEnZ81pIr0yLvtUWk2if982qA3F3QD6H4= github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0/go.mod h1:zJYVVT2jmtg6P3p1VtQj7WsuWi/y4VnjVBn7F8KPB3I= github.com/mitchellh/copystructure v1.2.0 h1:vpKXTN4ewci03Vljg/q9QvCGUDttBOGBIa15WveJJGw= @@ -67,8 +69,8 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c h1:ncq/mPwQF4JjgDlrVEn3C11VoGHZN7m8qihwgMEtzYw= github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE= -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_golang v1.20.1 h1:IMJXHOD6eARkQpxo8KkhgEVFlBNm+nkrFUyGlIu7Na8= +github.com/prometheus/client_golang v1.20.1/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= 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= @@ -168,8 +170,8 @@ golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20201204225414-ed752295db88/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.23.0 h1:YfKFowiIMvtgl1UERQoTPPToxltDeZfbj4H7dVUCwmM= -golang.org/x/sys v0.23.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.24.0 h1:Twjiwq9dn6R1fQcyiK+wQyHWfaz/BJB+YIpzU/Cv3Xg= +golang.org/x/sys v0.24.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.17.0 h1:XtiM5bkSOt+ewxlOE/aE/AKEHibwj/6gvWMl9Rsh0Qc= @@ -182,8 +184,8 @@ golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8T 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= -gonum.org/v1/gonum v0.15.0 h1:2lYxjRbTYyxkJxlhC+LvJIx3SsANPdRybu1tGj9/OrQ= -gonum.org/v1/gonum v0.15.0/go.mod h1:xzZVBJBtS+Mz4q0Yl2LJTk+OxOg4jiXZ7qBoM0uISGo= +gonum.org/v1/gonum v0.15.1 h1:FNy7N6OUZVUaWG9pTiD+jlhdQ3lMP+/LcTpJ6+a8sQ0= +gonum.org/v1/gonum v0.15.1/go.mod h1:eZTZuRFrzu5pcyjN5wJhcIhnUdNijYxX1T2IcrOGY0o= google.golang.org/genproto/googleapis/api v0.0.0-20240701130421-f6361c86f094 h1:0+ozOGcrp+Y8Aq8TLNN2Aliibms5LEzsq99ZZmAGYm0= google.golang.org/genproto/googleapis/api v0.0.0-20240701130421-f6361c86f094/go.mod h1:fJ/e3If/Q67Mj99hin0hMhiNyCRmt6BQ2aWIJshUSJw= google.golang.org/genproto/googleapis/rpc v0.0.0-20240701130421-f6361c86f094 h1:BwIjyKYGsK9dMCBOorzRri8MQwmi7mT9rGHsCEinZkA= diff --git a/service/host.go b/service/host.go deleted file mode 100644 index ce8dc530d40..00000000000 --- a/service/host.go +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright The OpenTelemetry Authors -// SPDX-License-Identifier: Apache-2.0 - -package service // import "go.opentelemetry.io/collector/service" - -import ( - "go.opentelemetry.io/collector/component" - "go.opentelemetry.io/collector/connector" - "go.opentelemetry.io/collector/exporter" - "go.opentelemetry.io/collector/extension" - "go.opentelemetry.io/collector/processor" - "go.opentelemetry.io/collector/receiver" - "go.opentelemetry.io/collector/service/extensions" - "go.opentelemetry.io/collector/service/internal/graph" -) - -// TODO: remove as part of https://github.com/open-telemetry/opentelemetry-collector/issues/7370 for service 1.0 -type getExporters interface { - GetExporters() map[component.DataType]map[component.ID]component.Component -} - -var _ getExporters = (*serviceHost)(nil) -var _ component.Host = (*serviceHost)(nil) - -type serviceHost struct { - asyncErrorChannel chan error - receivers *receiver.Builder - processors *processor.Builder - exporters *exporter.Builder - connectors *connector.Builder - extensions *extension.Builder - - buildInfo component.BuildInfo - - pipelines *graph.Graph - serviceExtensions *extensions.Extensions -} - -func (host *serviceHost) GetFactory(kind component.Kind, componentType component.Type) component.Factory { - switch kind { - case component.KindReceiver: - return host.receivers.Factory(componentType) - case component.KindProcessor: - return host.processors.Factory(componentType) - case component.KindExporter: - return host.exporters.Factory(componentType) - case component.KindConnector: - return host.connectors.Factory(componentType) - case component.KindExtension: - return host.extensions.Factory(componentType) - } - return nil -} - -func (host *serviceHost) GetExtensions() map[component.ID]component.Component { - return host.serviceExtensions.GetExtensions() -} - -// Deprecated: [0.79.0] This function will be removed in the future. -// Several components in the contrib repository use this function so it cannot be removed -// before those cases are removed. In most cases, use of this function can be replaced by a -// connector. See https://github.com/open-telemetry/opentelemetry-collector/issues/7370 and -// https://github.com/open-telemetry/opentelemetry-collector/pull/7390#issuecomment-1483710184 -// for additional information. -func (host *serviceHost) GetExporters() map[component.DataType]map[component.ID]component.Component { - return host.pipelines.GetExporters() -} - -func (host *serviceHost) notifyComponentStatusChange(source *component.InstanceID, event *component.StatusEvent) { - host.serviceExtensions.NotifyComponentStatusChange(source, event) - if event.Status() == component.StatusFatalError { - host.asyncErrorChannel <- event.Err() - } -} diff --git a/service/internal/builders/builders.go b/service/internal/builders/builders.go new file mode 100644 index 00000000000..bf5844bd932 --- /dev/null +++ b/service/internal/builders/builders.go @@ -0,0 +1,28 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package builders // import "go.opentelemetry.io/collector/service/internal/builders" + +import ( + "errors" + + "go.uber.org/zap" + + "go.opentelemetry.io/collector/component" +) + +var ( + errNilNextConsumer = errors.New("nil next Consumer") + nopType = component.MustNewType("nop") +) + +// logStabilityLevel logs the stability level of a component. The log level is set to info for +// undefined, unmaintained, deprecated and development. The log level is set to debug +// for alpha, beta and stable. +func logStabilityLevel(logger *zap.Logger, sl component.StabilityLevel) { + if sl >= component.StabilityLevelAlpha { + logger.Debug(sl.LogMessage()) + } else { + logger.Info(sl.LogMessage()) + } +} diff --git a/service/internal/builders/connector.go b/service/internal/builders/connector.go new file mode 100644 index 00000000000..3cd412187d0 --- /dev/null +++ b/service/internal/builders/connector.go @@ -0,0 +1,242 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package builders // import "go.opentelemetry.io/collector/service/internal/builders" + +import ( + "context" + "fmt" + + "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/connector" + "go.opentelemetry.io/collector/connector/connectortest" + "go.opentelemetry.io/collector/consumer" +) + +// Connector is an interface that allows using implementations of the builder +// from different packages. +type Connector interface { + CreateTracesToTraces(context.Context, connector.Settings, consumer.Traces) (connector.Traces, error) + CreateTracesToMetrics(context.Context, connector.Settings, consumer.Metrics) (connector.Traces, error) + CreateTracesToLogs(context.Context, connector.Settings, consumer.Logs) (connector.Traces, error) + + CreateMetricsToTraces(context.Context, connector.Settings, consumer.Traces) (connector.Metrics, error) + CreateMetricsToMetrics(context.Context, connector.Settings, consumer.Metrics) (connector.Metrics, error) + CreateMetricsToLogs(context.Context, connector.Settings, consumer.Logs) (connector.Metrics, error) + + CreateLogsToTraces(context.Context, connector.Settings, consumer.Traces) (connector.Logs, error) + CreateLogsToMetrics(context.Context, connector.Settings, consumer.Metrics) (connector.Logs, error) + CreateLogsToLogs(context.Context, connector.Settings, consumer.Logs) (connector.Logs, error) + + IsConfigured(component.ID) bool + Factory(component.Type) component.Factory +} + +// ConnectorBuilder is a helper struct that given a set of Configs and Factories helps with creating connectors. +type ConnectorBuilder struct { + cfgs map[component.ID]component.Config + factories map[component.Type]connector.Factory +} + +// NewConnector creates a new ConnectorBuilder to help with creating components form a set of configs and factories. +func NewConnector(cfgs map[component.ID]component.Config, factories map[component.Type]connector.Factory) *ConnectorBuilder { + return &ConnectorBuilder{cfgs: cfgs, factories: factories} +} + +// CreateTracesToTraces creates a Traces connector based on the settings and config. +func (b *ConnectorBuilder) CreateTracesToTraces(ctx context.Context, set connector.Settings, next consumer.Traces) (connector.Traces, error) { + if next == nil { + return nil, errNilNextConsumer + } + cfg, existsCfg := b.cfgs[set.ID] + if !existsCfg { + return nil, fmt.Errorf("connector %q is not configured", set.ID) + } + + f, existsFactory := b.factories[set.ID.Type()] + if !existsFactory { + return nil, fmt.Errorf("connector factory not available for: %q", set.ID) + } + + logStabilityLevel(set.Logger, f.TracesToTracesStability()) + return f.CreateTracesToTraces(ctx, set, cfg, next) +} + +// CreateTracesToMetrics creates a Traces connector based on the settings and config. +func (b *ConnectorBuilder) CreateTracesToMetrics(ctx context.Context, set connector.Settings, next consumer.Metrics) (connector.Traces, error) { + if next == nil { + return nil, errNilNextConsumer + } + cfg, existsCfg := b.cfgs[set.ID] + if !existsCfg { + return nil, fmt.Errorf("connector %q is not configured", set.ID) + } + + f, existsFactory := b.factories[set.ID.Type()] + if !existsFactory { + return nil, fmt.Errorf("connector factory not available for: %q", set.ID) + } + + logStabilityLevel(set.Logger, f.TracesToMetricsStability()) + return f.CreateTracesToMetrics(ctx, set, cfg, next) +} + +// CreateTracesToLogs creates a Traces connector based on the settings and config. +func (b *ConnectorBuilder) CreateTracesToLogs(ctx context.Context, set connector.Settings, next consumer.Logs) (connector.Traces, error) { + if next == nil { + return nil, errNilNextConsumer + } + cfg, existsCfg := b.cfgs[set.ID] + if !existsCfg { + return nil, fmt.Errorf("connector %q is not configured", set.ID) + } + + f, existsFactory := b.factories[set.ID.Type()] + if !existsFactory { + return nil, fmt.Errorf("connector factory not available for: %q", set.ID) + } + + logStabilityLevel(set.Logger, f.TracesToLogsStability()) + return f.CreateTracesToLogs(ctx, set, cfg, next) +} + +// CreateMetricsToTraces creates a Metrics connector based on the settings and config. +func (b *ConnectorBuilder) CreateMetricsToTraces(ctx context.Context, set connector.Settings, next consumer.Traces) (connector.Metrics, error) { + if next == nil { + return nil, errNilNextConsumer + } + cfg, existsCfg := b.cfgs[set.ID] + if !existsCfg { + return nil, fmt.Errorf("connector %q is not configured", set.ID) + } + + f, existsFactory := b.factories[set.ID.Type()] + if !existsFactory { + return nil, fmt.Errorf("connector factory not available for: %q", set.ID) + } + + logStabilityLevel(set.Logger, f.MetricsToTracesStability()) + return f.CreateMetricsToTraces(ctx, set, cfg, next) +} + +// CreateMetricsToMetrics creates a Metrics connector based on the settings and config. +func (b *ConnectorBuilder) CreateMetricsToMetrics(ctx context.Context, set connector.Settings, next consumer.Metrics) (connector.Metrics, error) { + if next == nil { + return nil, errNilNextConsumer + } + cfg, existsCfg := b.cfgs[set.ID] + if !existsCfg { + return nil, fmt.Errorf("connector %q is not configured", set.ID) + } + + f, existsFactory := b.factories[set.ID.Type()] + if !existsFactory { + return nil, fmt.Errorf("connector factory not available for: %q", set.ID) + } + + logStabilityLevel(set.Logger, f.MetricsToMetricsStability()) + return f.CreateMetricsToMetrics(ctx, set, cfg, next) +} + +// CreateMetricsToLogs creates a Metrics connector based on the settings and config. +func (b *ConnectorBuilder) CreateMetricsToLogs(ctx context.Context, set connector.Settings, next consumer.Logs) (connector.Metrics, error) { + if next == nil { + return nil, errNilNextConsumer + } + cfg, existsCfg := b.cfgs[set.ID] + if !existsCfg { + return nil, fmt.Errorf("connector %q is not configured", set.ID) + } + + f, existsFactory := b.factories[set.ID.Type()] + if !existsFactory { + return nil, fmt.Errorf("connector factory not available for: %q", set.ID) + } + + logStabilityLevel(set.Logger, f.MetricsToLogsStability()) + return f.CreateMetricsToLogs(ctx, set, cfg, next) +} + +// CreateLogsToTraces creates a Logs connector based on the settings and config. +func (b *ConnectorBuilder) CreateLogsToTraces(ctx context.Context, set connector.Settings, next consumer.Traces) (connector.Logs, error) { + if next == nil { + return nil, errNilNextConsumer + } + cfg, existsCfg := b.cfgs[set.ID] + if !existsCfg { + return nil, fmt.Errorf("connector %q is not configured", set.ID) + } + + f, existsFactory := b.factories[set.ID.Type()] + if !existsFactory { + return nil, fmt.Errorf("connector factory not available for: %q", set.ID) + } + + logStabilityLevel(set.Logger, f.LogsToTracesStability()) + return f.CreateLogsToTraces(ctx, set, cfg, next) +} + +// CreateLogsToMetrics creates a Logs connector based on the settings and config. +func (b *ConnectorBuilder) CreateLogsToMetrics(ctx context.Context, set connector.Settings, next consumer.Metrics) (connector.Logs, error) { + if next == nil { + return nil, errNilNextConsumer + } + cfg, existsCfg := b.cfgs[set.ID] + if !existsCfg { + return nil, fmt.Errorf("connector %q is not configured", set.ID) + } + + f, existsFactory := b.factories[set.ID.Type()] + if !existsFactory { + return nil, fmt.Errorf("connector factory not available for: %q", set.ID) + } + + logStabilityLevel(set.Logger, f.LogsToMetricsStability()) + return f.CreateLogsToMetrics(ctx, set, cfg, next) +} + +// CreateLogsToLogs creates a Logs connector based on the settings and config. +func (b *ConnectorBuilder) CreateLogsToLogs(ctx context.Context, set connector.Settings, next consumer.Logs) (connector.Logs, error) { + if next == nil { + return nil, errNilNextConsumer + } + cfg, existsCfg := b.cfgs[set.ID] + if !existsCfg { + return nil, fmt.Errorf("connector %q is not configured", set.ID) + } + + f, existsFactory := b.factories[set.ID.Type()] + if !existsFactory { + return nil, fmt.Errorf("connector factory not available for: %q", set.ID) + } + + logStabilityLevel(set.Logger, f.LogsToLogsStability()) + return f.CreateLogsToLogs(ctx, set, cfg, next) +} + +func (b *ConnectorBuilder) IsConfigured(componentID component.ID) bool { + _, ok := b.cfgs[componentID] + return ok +} + +func (b *ConnectorBuilder) Factory(componentType component.Type) component.Factory { + return b.factories[componentType] +} + +// NewNopConnectorConfigsAndFactories returns a configuration and factories that allows building a new nop connector. +func NewNopConnectorConfigsAndFactories() (map[component.ID]component.Config, map[component.Type]connector.Factory) { + nopFactory := connectortest.NewNopFactory() + // Use a different ID than receivertest and exportertest to avoid ambiguous + // configuration scenarios. Ambiguous IDs are detected in the 'otelcol' package, + // but lower level packages such as 'service' assume that IDs are disambiguated. + connID := component.NewIDWithName(nopType, "conn") + + configs := map[component.ID]component.Config{ + connID: nopFactory.CreateDefaultConfig(), + } + factories := map[component.Type]connector.Factory{ + nopType: nopFactory, + } + + return configs, factories +} diff --git a/service/internal/builders/connector_test.go b/service/internal/builders/connector_test.go new file mode 100644 index 00000000000..0fd337ea0ab --- /dev/null +++ b/service/internal/builders/connector_test.go @@ -0,0 +1,375 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package builders + +import ( + "context" + "fmt" + "testing" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + + "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/component/componenttest" + "go.opentelemetry.io/collector/connector" + "go.opentelemetry.io/collector/connector/connectortest" + "go.opentelemetry.io/collector/consumer" + "go.opentelemetry.io/collector/consumer/consumertest" +) + +func TestConnectorBuilder(t *testing.T) { + defaultCfg := struct{}{} + factories, err := connector.MakeFactoryMap([]connector.Factory{ + connector.NewFactory(component.MustNewType("err"), nil), + connector.NewFactory( + component.MustNewType("all"), + func() component.Config { return &defaultCfg }, + connector.WithTracesToTraces(createConnectorTracesToTraces, component.StabilityLevelDevelopment), + connector.WithTracesToMetrics(createConnectorTracesToMetrics, component.StabilityLevelDevelopment), + connector.WithTracesToLogs(createConnectorTracesToLogs, component.StabilityLevelDevelopment), + connector.WithMetricsToTraces(createConnectorMetricsToTraces, component.StabilityLevelAlpha), + connector.WithMetricsToMetrics(createConnectorMetricsToMetrics, component.StabilityLevelAlpha), + connector.WithMetricsToLogs(createConnectorMetricsToLogs, component.StabilityLevelAlpha), + connector.WithLogsToTraces(createConnectorLogsToTraces, component.StabilityLevelDeprecated), + connector.WithLogsToMetrics(createConnectorLogsToMetrics, component.StabilityLevelDeprecated), + connector.WithLogsToLogs(createConnectorLogsToLogs, component.StabilityLevelDeprecated), + ), + }...) + require.NoError(t, err) + + testCases := []struct { + name string + id component.ID + err func(component.DataType, component.DataType) string + nextTraces consumer.Traces + nextLogs consumer.Logs + nextMetrics consumer.Metrics + }{ + { + name: "unknown", + id: component.MustNewID("unknown"), + err: func(component.DataType, component.DataType) string { + return "connector factory not available for: \"unknown\"" + }, + nextTraces: consumertest.NewNop(), + nextLogs: consumertest.NewNop(), + nextMetrics: consumertest.NewNop(), + }, + { + name: "err", + id: component.MustNewID("err"), + err: func(expType, rcvType component.DataType) string { + return fmt.Sprintf("connector \"err\" cannot connect from %s to %s: telemetry type is not supported", expType, rcvType) + }, + nextTraces: consumertest.NewNop(), + nextLogs: consumertest.NewNop(), + nextMetrics: consumertest.NewNop(), + }, + { + name: "all", + id: component.MustNewID("all"), + err: func(component.DataType, component.DataType) string { + return "" + }, + nextTraces: consumertest.NewNop(), + nextLogs: consumertest.NewNop(), + nextMetrics: consumertest.NewNop(), + }, + { + name: "all/named", + id: component.MustNewIDWithName("all", "named"), + err: func(component.DataType, component.DataType) string { + return "" + }, + nextTraces: consumertest.NewNop(), + nextLogs: consumertest.NewNop(), + nextMetrics: consumertest.NewNop(), + }, + { + name: "no next consumer", + id: component.MustNewID("unknown"), + err: func(_, _ component.DataType) string { + return "nil next Consumer" + }, + nextTraces: nil, + nextLogs: nil, + nextMetrics: nil, + }, + } + + for _, tt := range testCases { + t.Run(tt.name, func(t *testing.T) { + cfgs := map[component.ID]component.Config{tt.id: defaultCfg} + b := NewConnector(cfgs, factories) + + t2t, err := b.CreateTracesToTraces(context.Background(), createConnectorSettings(tt.id), tt.nextTraces) + if expectedErr := tt.err(component.DataTypeTraces, component.DataTypeTraces); expectedErr != "" { + assert.EqualError(t, err, expectedErr) + assert.Nil(t, t2t) + } else { + assert.NoError(t, err) + assert.Equal(t, nopConnectorInstance, t2t) + } + t2m, err := b.CreateTracesToMetrics(context.Background(), createConnectorSettings(tt.id), tt.nextMetrics) + if expectedErr := tt.err(component.DataTypeTraces, component.DataTypeMetrics); expectedErr != "" { + assert.EqualError(t, err, expectedErr) + assert.Nil(t, t2m) + } else { + assert.NoError(t, err) + assert.Equal(t, nopConnectorInstance, t2m) + } + t2l, err := b.CreateTracesToLogs(context.Background(), createConnectorSettings(tt.id), tt.nextLogs) + if expectedErr := tt.err(component.DataTypeTraces, component.DataTypeLogs); expectedErr != "" { + assert.EqualError(t, err, expectedErr) + assert.Nil(t, t2l) + } else { + assert.NoError(t, err) + assert.Equal(t, nopConnectorInstance, t2l) + } + + m2t, err := b.CreateMetricsToTraces(context.Background(), createConnectorSettings(tt.id), tt.nextTraces) + if expectedErr := tt.err(component.DataTypeMetrics, component.DataTypeTraces); expectedErr != "" { + assert.EqualError(t, err, expectedErr) + assert.Nil(t, m2t) + } else { + assert.NoError(t, err) + assert.Equal(t, nopConnectorInstance, m2t) + } + + m2m, err := b.CreateMetricsToMetrics(context.Background(), createConnectorSettings(tt.id), tt.nextMetrics) + if expectedErr := tt.err(component.DataTypeMetrics, component.DataTypeMetrics); expectedErr != "" { + assert.EqualError(t, err, expectedErr) + assert.Nil(t, m2m) + } else { + assert.NoError(t, err) + assert.Equal(t, nopConnectorInstance, m2m) + } + + m2l, err := b.CreateMetricsToLogs(context.Background(), createConnectorSettings(tt.id), tt.nextLogs) + if expectedErr := tt.err(component.DataTypeMetrics, component.DataTypeLogs); expectedErr != "" { + assert.EqualError(t, err, expectedErr) + assert.Nil(t, m2l) + } else { + assert.NoError(t, err) + assert.Equal(t, nopConnectorInstance, m2l) + } + + l2t, err := b.CreateLogsToTraces(context.Background(), createConnectorSettings(tt.id), tt.nextTraces) + if expectedErr := tt.err(component.DataTypeLogs, component.DataTypeTraces); expectedErr != "" { + assert.EqualError(t, err, expectedErr) + assert.Nil(t, l2t) + } else { + assert.NoError(t, err) + assert.Equal(t, nopConnectorInstance, l2t) + } + + l2m, err := b.CreateLogsToMetrics(context.Background(), createConnectorSettings(tt.id), tt.nextMetrics) + if expectedErr := tt.err(component.DataTypeLogs, component.DataTypeMetrics); expectedErr != "" { + assert.EqualError(t, err, expectedErr) + assert.Nil(t, l2m) + } else { + assert.NoError(t, err) + assert.Equal(t, nopConnectorInstance, l2m) + } + + l2l, err := b.CreateLogsToLogs(context.Background(), createConnectorSettings(tt.id), tt.nextLogs) + if expectedErr := tt.err(component.DataTypeLogs, component.DataTypeLogs); expectedErr != "" { + assert.EqualError(t, err, expectedErr) + assert.Nil(t, l2l) + } else { + assert.NoError(t, err) + assert.Equal(t, nopConnectorInstance, l2l) + } + }) + } +} + +func TestConnectorBuilderMissingConfig(t *testing.T) { + defaultCfg := struct{}{} + factories, err := connector.MakeFactoryMap([]connector.Factory{ + connector.NewFactory( + component.MustNewType("all"), + func() component.Config { return &defaultCfg }, + connector.WithTracesToTraces(createConnectorTracesToTraces, component.StabilityLevelDevelopment), + connector.WithTracesToMetrics(createConnectorTracesToMetrics, component.StabilityLevelDevelopment), + connector.WithTracesToLogs(createConnectorTracesToLogs, component.StabilityLevelDevelopment), + connector.WithMetricsToTraces(createConnectorMetricsToTraces, component.StabilityLevelAlpha), + connector.WithMetricsToMetrics(createConnectorMetricsToMetrics, component.StabilityLevelAlpha), + connector.WithMetricsToLogs(createConnectorMetricsToLogs, component.StabilityLevelAlpha), + connector.WithLogsToTraces(createConnectorLogsToTraces, component.StabilityLevelDeprecated), + connector.WithLogsToMetrics(createConnectorLogsToMetrics, component.StabilityLevelDeprecated), + connector.WithLogsToLogs(createConnectorLogsToLogs, component.StabilityLevelDeprecated), + ), + }...) + + require.NoError(t, err) + + bErr := NewConnector(map[component.ID]component.Config{}, factories) + missingID := component.MustNewIDWithName("all", "missing") + + t2t, err := bErr.CreateTracesToTraces(context.Background(), createConnectorSettings(missingID), consumertest.NewNop()) + assert.EqualError(t, err, "connector \"all/missing\" is not configured") + assert.Nil(t, t2t) + + t2m, err := bErr.CreateTracesToMetrics(context.Background(), createConnectorSettings(missingID), consumertest.NewNop()) + assert.EqualError(t, err, "connector \"all/missing\" is not configured") + assert.Nil(t, t2m) + + t2l, err := bErr.CreateTracesToLogs(context.Background(), createConnectorSettings(missingID), consumertest.NewNop()) + assert.EqualError(t, err, "connector \"all/missing\" is not configured") + assert.Nil(t, t2l) + + m2t, err := bErr.CreateMetricsToTraces(context.Background(), createConnectorSettings(missingID), consumertest.NewNop()) + assert.EqualError(t, err, "connector \"all/missing\" is not configured") + assert.Nil(t, m2t) + + m2m, err := bErr.CreateMetricsToMetrics(context.Background(), createConnectorSettings(missingID), consumertest.NewNop()) + assert.EqualError(t, err, "connector \"all/missing\" is not configured") + assert.Nil(t, m2m) + + m2l, err := bErr.CreateMetricsToLogs(context.Background(), createConnectorSettings(missingID), consumertest.NewNop()) + assert.EqualError(t, err, "connector \"all/missing\" is not configured") + assert.Nil(t, m2l) + + l2t, err := bErr.CreateLogsToTraces(context.Background(), createConnectorSettings(missingID), consumertest.NewNop()) + assert.EqualError(t, err, "connector \"all/missing\" is not configured") + assert.Nil(t, l2t) + + l2m, err := bErr.CreateLogsToMetrics(context.Background(), createConnectorSettings(missingID), consumertest.NewNop()) + assert.EqualError(t, err, "connector \"all/missing\" is not configured") + assert.Nil(t, l2m) + + l2l, err := bErr.CreateLogsToLogs(context.Background(), createConnectorSettings(missingID), consumertest.NewNop()) + assert.EqualError(t, err, "connector \"all/missing\" is not configured") + assert.Nil(t, l2l) +} + +func TestConnectorBuilderGetters(t *testing.T) { + factories, err := connector.MakeFactoryMap([]connector.Factory{connector.NewFactory(component.MustNewType("foo"), nil)}...) + require.NoError(t, err) + + cfgs := map[component.ID]component.Config{component.MustNewID("foo"): struct{}{}} + b := NewConnector(cfgs, factories) + + assert.True(t, b.IsConfigured(component.MustNewID("foo"))) + assert.False(t, b.IsConfigured(component.MustNewID("bar"))) + + assert.NotNil(t, b.Factory(component.MustNewID("foo").Type())) + assert.Nil(t, b.Factory(component.MustNewID("bar").Type())) +} + +func TestNewNopConnectorConfigsAndFactories(t *testing.T) { + configs, factories := NewNopConnectorConfigsAndFactories() + builder := NewConnector(configs, factories) + require.NotNil(t, builder) + + factory := connectortest.NewNopFactory() + cfg := factory.CreateDefaultConfig() + set := connectortest.NewNopSettings() + set.ID = component.NewIDWithName(nopType, "conn") + + tracesToTraces, err := factory.CreateTracesToTraces(context.Background(), set, cfg, consumertest.NewNop()) + require.NoError(t, err) + bTracesToTraces, err := builder.CreateTracesToTraces(context.Background(), set, consumertest.NewNop()) + require.NoError(t, err) + assert.IsType(t, tracesToTraces, bTracesToTraces) + + tracesToMetrics, err := factory.CreateTracesToMetrics(context.Background(), set, cfg, consumertest.NewNop()) + require.NoError(t, err) + bTracesToMetrics, err := builder.CreateTracesToMetrics(context.Background(), set, consumertest.NewNop()) + require.NoError(t, err) + assert.IsType(t, tracesToMetrics, bTracesToMetrics) + + tracesToLogs, err := factory.CreateTracesToLogs(context.Background(), set, cfg, consumertest.NewNop()) + require.NoError(t, err) + bTracesToLogs, err := builder.CreateTracesToLogs(context.Background(), set, consumertest.NewNop()) + require.NoError(t, err) + assert.IsType(t, tracesToLogs, bTracesToLogs) + + metricsToTraces, err := factory.CreateMetricsToTraces(context.Background(), set, cfg, consumertest.NewNop()) + require.NoError(t, err) + bMetricsToTraces, err := builder.CreateMetricsToTraces(context.Background(), set, consumertest.NewNop()) + require.NoError(t, err) + assert.IsType(t, metricsToTraces, bMetricsToTraces) + + metricsToMetrics, err := factory.CreateMetricsToMetrics(context.Background(), set, cfg, consumertest.NewNop()) + require.NoError(t, err) + bMetricsToMetrics, err := builder.CreateMetricsToMetrics(context.Background(), set, consumertest.NewNop()) + require.NoError(t, err) + assert.IsType(t, metricsToMetrics, bMetricsToMetrics) + + metricsToLogs, err := factory.CreateMetricsToLogs(context.Background(), set, cfg, consumertest.NewNop()) + require.NoError(t, err) + bMetricsToLogs, err := builder.CreateMetricsToLogs(context.Background(), set, consumertest.NewNop()) + require.NoError(t, err) + assert.IsType(t, metricsToLogs, bMetricsToLogs) + + logsToTraces, err := factory.CreateLogsToTraces(context.Background(), set, cfg, consumertest.NewNop()) + require.NoError(t, err) + bLogsToTraces, err := builder.CreateLogsToTraces(context.Background(), set, consumertest.NewNop()) + require.NoError(t, err) + assert.IsType(t, logsToTraces, bLogsToTraces) + + logsToMetrics, err := factory.CreateLogsToMetrics(context.Background(), set, cfg, consumertest.NewNop()) + require.NoError(t, err) + bLogsToMetrics, err := builder.CreateLogsToMetrics(context.Background(), set, consumertest.NewNop()) + require.NoError(t, err) + assert.IsType(t, logsToMetrics, bLogsToMetrics) + + logsToLogs, err := factory.CreateLogsToLogs(context.Background(), set, cfg, consumertest.NewNop()) + require.NoError(t, err) + bLogsToLogs, err := builder.CreateLogsToLogs(context.Background(), set, consumertest.NewNop()) + require.NoError(t, err) + assert.IsType(t, logsToLogs, bLogsToLogs) +} + +var nopConnectorInstance = &nopConnector{ + Consumer: consumertest.NewNop(), +} + +// nopConnector stores consumed traces and metrics for testing purposes. +type nopConnector struct { + component.StartFunc + component.ShutdownFunc + consumertest.Consumer +} + +func createConnectorTracesToTraces(context.Context, connector.Settings, component.Config, consumer.Traces) (connector.Traces, error) { + return nopConnectorInstance, nil +} +func createConnectorTracesToMetrics(context.Context, connector.Settings, component.Config, consumer.Metrics) (connector.Traces, error) { + return nopConnectorInstance, nil +} +func createConnectorTracesToLogs(context.Context, connector.Settings, component.Config, consumer.Logs) (connector.Traces, error) { + return nopConnectorInstance, nil +} + +func createConnectorMetricsToTraces(context.Context, connector.Settings, component.Config, consumer.Traces) (connector.Metrics, error) { + return nopConnectorInstance, nil +} +func createConnectorMetricsToMetrics(context.Context, connector.Settings, component.Config, consumer.Metrics) (connector.Metrics, error) { + return nopConnectorInstance, nil +} +func createConnectorMetricsToLogs(context.Context, connector.Settings, component.Config, consumer.Logs) (connector.Metrics, error) { + return nopConnectorInstance, nil +} + +func createConnectorLogsToTraces(context.Context, connector.Settings, component.Config, consumer.Traces) (connector.Logs, error) { + return nopConnectorInstance, nil +} +func createConnectorLogsToMetrics(context.Context, connector.Settings, component.Config, consumer.Metrics) (connector.Logs, error) { + return nopConnectorInstance, nil +} +func createConnectorLogsToLogs(context.Context, connector.Settings, component.Config, consumer.Logs) (connector.Logs, error) { + return nopConnectorInstance, nil +} + +func createConnectorSettings(id component.ID) connector.Settings { + return connector.Settings{ + ID: id, + TelemetrySettings: componenttest.NewNopTelemetrySettings(), + BuildInfo: component.NewDefaultBuildInfo(), + } +} diff --git a/service/internal/builders/exporter.go b/service/internal/builders/exporter.go new file mode 100644 index 00000000000..84c698ef070 --- /dev/null +++ b/service/internal/builders/exporter.go @@ -0,0 +1,98 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package builders // import "go.opentelemetry.io/collector/service/internal/builders" + +import ( + "context" + "fmt" + + "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/exporter" + "go.opentelemetry.io/collector/exporter/exportertest" +) + +// Exporter is an interface that allows using implementations of the builder +// from different packages. +type Exporter interface { + CreateTraces(context.Context, exporter.Settings) (exporter.Traces, error) + CreateMetrics(context.Context, exporter.Settings) (exporter.Metrics, error) + CreateLogs(context.Context, exporter.Settings) (exporter.Logs, error) + Factory(component.Type) component.Factory +} + +// ExporterBuilder is a helper struct that given a set of Configs and Factories helps with creating exporters. +type ExporterBuilder struct { + cfgs map[component.ID]component.Config + factories map[component.Type]exporter.Factory +} + +// NewExporter creates a new ExporterBuilder to help with creating components form a set of configs and factories. +func NewExporter(cfgs map[component.ID]component.Config, factories map[component.Type]exporter.Factory) *ExporterBuilder { + return &ExporterBuilder{cfgs: cfgs, factories: factories} +} + +// CreateTraces creates a Traces exporter based on the settings and config. +func (b *ExporterBuilder) CreateTraces(ctx context.Context, set exporter.Settings) (exporter.Traces, error) { + cfg, existsCfg := b.cfgs[set.ID] + if !existsCfg { + return nil, fmt.Errorf("exporter %q is not configured", set.ID) + } + + f, existsFactory := b.factories[set.ID.Type()] + if !existsFactory { + return nil, fmt.Errorf("exporter factory not available for: %q", set.ID) + } + + logStabilityLevel(set.Logger, f.TracesExporterStability()) + return f.CreateTracesExporter(ctx, set, cfg) +} + +// CreateMetrics creates a Metrics exporter based on the settings and config. +func (b *ExporterBuilder) CreateMetrics(ctx context.Context, set exporter.Settings) (exporter.Metrics, error) { + cfg, existsCfg := b.cfgs[set.ID] + if !existsCfg { + return nil, fmt.Errorf("exporter %q is not configured", set.ID) + } + + f, existsFactory := b.factories[set.ID.Type()] + if !existsFactory { + return nil, fmt.Errorf("exporter factory not available for: %q", set.ID) + } + + logStabilityLevel(set.Logger, f.MetricsExporterStability()) + return f.CreateMetricsExporter(ctx, set, cfg) +} + +// CreateLogs creates a Logs exporter based on the settings and config. +func (b *ExporterBuilder) CreateLogs(ctx context.Context, set exporter.Settings) (exporter.Logs, error) { + cfg, existsCfg := b.cfgs[set.ID] + if !existsCfg { + return nil, fmt.Errorf("exporter %q is not configured", set.ID) + } + + f, existsFactory := b.factories[set.ID.Type()] + if !existsFactory { + return nil, fmt.Errorf("exporter factory not available for: %q", set.ID) + } + + logStabilityLevel(set.Logger, f.LogsExporterStability()) + return f.CreateLogsExporter(ctx, set, cfg) +} + +func (b *ExporterBuilder) Factory(componentType component.Type) component.Factory { + return b.factories[componentType] +} + +// NewNopExporterConfigsAndFactories returns a configuration and factories that allows building a new nop exporter. +func NewNopExporterConfigsAndFactories() (map[component.ID]component.Config, map[component.Type]exporter.Factory) { + nopFactory := exportertest.NewNopFactory() + configs := map[component.ID]component.Config{ + component.NewID(nopType): nopFactory.CreateDefaultConfig(), + } + factories := map[component.Type]exporter.Factory{ + nopType: nopFactory, + } + + return configs, factories +} diff --git a/service/internal/builders/exporter_test.go b/service/internal/builders/exporter_test.go new file mode 100644 index 00000000000..a8dd7e71382 --- /dev/null +++ b/service/internal/builders/exporter_test.go @@ -0,0 +1,193 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package builders + +import ( + "context" + "testing" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + + "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/component/componenttest" + "go.opentelemetry.io/collector/consumer/consumertest" + "go.opentelemetry.io/collector/exporter" + "go.opentelemetry.io/collector/exporter/exportertest" +) + +func TestExporterBuilder(t *testing.T) { + defaultCfg := struct{}{} + factories, err := exporter.MakeFactoryMap([]exporter.Factory{ + exporter.NewFactory(component.MustNewType("err"), nil), + exporter.NewFactory( + component.MustNewType("all"), + func() component.Config { return &defaultCfg }, + exporter.WithTraces(createExporterTraces, component.StabilityLevelDevelopment), + exporter.WithMetrics(createExporterMetrics, component.StabilityLevelAlpha), + exporter.WithLogs(createExporterLogs, component.StabilityLevelDeprecated), + ), + }...) + require.NoError(t, err) + + testCases := []struct { + name string + id component.ID + err string + }{ + { + name: "unknown", + id: component.MustNewID("unknown"), + err: "exporter factory not available for: \"unknown\"", + }, + { + name: "err", + id: component.MustNewID("err"), + err: "telemetry type is not supported", + }, + { + name: "all", + id: component.MustNewID("all"), + }, + { + name: "all/named", + id: component.MustNewIDWithName("all", "named"), + }, + } + + for _, tt := range testCases { + t.Run(tt.name, func(t *testing.T) { + cfgs := map[component.ID]component.Config{tt.id: defaultCfg} + b := NewExporter(cfgs, factories) + + te, err := b.CreateTraces(context.Background(), createExporterSettings(tt.id)) + if tt.err != "" { + assert.EqualError(t, err, tt.err) + assert.Nil(t, te) + } else { + assert.NoError(t, err) + assert.Equal(t, nopExporterInstance, te) + } + + me, err := b.CreateMetrics(context.Background(), createExporterSettings(tt.id)) + if tt.err != "" { + assert.EqualError(t, err, tt.err) + assert.Nil(t, me) + } else { + assert.NoError(t, err) + assert.Equal(t, nopExporterInstance, me) + } + + le, err := b.CreateLogs(context.Background(), createExporterSettings(tt.id)) + if tt.err != "" { + assert.EqualError(t, err, tt.err) + assert.Nil(t, le) + } else { + assert.NoError(t, err) + assert.Equal(t, nopExporterInstance, le) + } + }) + } +} + +func TestExporterBuilderMissingConfig(t *testing.T) { + defaultCfg := struct{}{} + factories, err := exporter.MakeFactoryMap([]exporter.Factory{ + exporter.NewFactory( + component.MustNewType("all"), + func() component.Config { return &defaultCfg }, + exporter.WithTraces(createExporterTraces, component.StabilityLevelDevelopment), + exporter.WithMetrics(createExporterMetrics, component.StabilityLevelAlpha), + exporter.WithLogs(createExporterLogs, component.StabilityLevelDeprecated), + ), + }...) + + require.NoError(t, err) + + bErr := NewExporter(map[component.ID]component.Config{}, factories) + missingID := component.MustNewIDWithName("all", "missing") + + te, err := bErr.CreateTraces(context.Background(), createExporterSettings(missingID)) + assert.EqualError(t, err, "exporter \"all/missing\" is not configured") + assert.Nil(t, te) + + me, err := bErr.CreateMetrics(context.Background(), createExporterSettings(missingID)) + assert.EqualError(t, err, "exporter \"all/missing\" is not configured") + assert.Nil(t, me) + + le, err := bErr.CreateLogs(context.Background(), createExporterSettings(missingID)) + assert.EqualError(t, err, "exporter \"all/missing\" is not configured") + assert.Nil(t, le) +} + +func TestExporterBuilderFactory(t *testing.T) { + factories, err := exporter.MakeFactoryMap([]exporter.Factory{exporter.NewFactory(component.MustNewType("foo"), nil)}...) + require.NoError(t, err) + + cfgs := map[component.ID]component.Config{component.MustNewID("foo"): struct{}{}} + b := NewExporter(cfgs, factories) + + assert.NotNil(t, b.Factory(component.MustNewID("foo").Type())) + assert.Nil(t, b.Factory(component.MustNewID("bar").Type())) +} + +func TestNewNopExporterConfigsAndFactories(t *testing.T) { + configs, factories := NewNopExporterConfigsAndFactories() + builder := NewExporter(configs, factories) + require.NotNil(t, builder) + + factory := exportertest.NewNopFactory() + cfg := factory.CreateDefaultConfig() + set := exportertest.NewNopSettings() + set.ID = component.NewID(nopType) + + traces, err := factory.CreateTracesExporter(context.Background(), set, cfg) + require.NoError(t, err) + bTraces, err := builder.CreateTraces(context.Background(), set) + require.NoError(t, err) + assert.IsType(t, traces, bTraces) + + metrics, err := factory.CreateMetricsExporter(context.Background(), set, cfg) + require.NoError(t, err) + bMetrics, err := builder.CreateMetrics(context.Background(), set) + require.NoError(t, err) + assert.IsType(t, metrics, bMetrics) + + logs, err := factory.CreateLogsExporter(context.Background(), set, cfg) + require.NoError(t, err) + bLogs, err := builder.CreateLogs(context.Background(), set) + require.NoError(t, err) + assert.IsType(t, logs, bLogs) +} + +var nopExporterInstance = &nopExporter{ + Consumer: consumertest.NewNop(), +} + +// nopExporter stores consumed traces and metrics for testing purposes. +type nopExporter struct { + component.StartFunc + component.ShutdownFunc + consumertest.Consumer +} + +func createExporterTraces(context.Context, exporter.Settings, component.Config) (exporter.Traces, error) { + return nopExporterInstance, nil +} + +func createExporterMetrics(context.Context, exporter.Settings, component.Config) (exporter.Metrics, error) { + return nopExporterInstance, nil +} + +func createExporterLogs(context.Context, exporter.Settings, component.Config) (exporter.Logs, error) { + return nopExporterInstance, nil +} + +func createExporterSettings(id component.ID) exporter.Settings { + return exporter.Settings{ + ID: id, + TelemetrySettings: componenttest.NewNopTelemetrySettings(), + BuildInfo: component.NewDefaultBuildInfo(), + } +} diff --git a/service/internal/builders/extension.go b/service/internal/builders/extension.go new file mode 100644 index 00000000000..9e4eb912dd5 --- /dev/null +++ b/service/internal/builders/extension.go @@ -0,0 +1,69 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package builders // import "go.opentelemetry.io/collector/service/internal/builders" + +import ( + "context" + "fmt" + + "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/extension" + "go.opentelemetry.io/collector/extension/extensiontest" +) + +// Extension is an interface that allows using implementations of the builder +// from different packages. +type Extension interface { + Create(context.Context, extension.Settings) (extension.Extension, error) + Factory(component.Type) component.Factory +} + +// ExtensionBuilder is a helper struct that given a set of Configs and Factories helps with creating extensions. +type ExtensionBuilder struct { + cfgs map[component.ID]component.Config + factories map[component.Type]extension.Factory +} + +// NewExtension creates a new ExtensionBuilder to help with creating +// components form a set of configs and factories. +func NewExtension(cfgs map[component.ID]component.Config, factories map[component.Type]extension.Factory) *ExtensionBuilder { + return &ExtensionBuilder{cfgs: cfgs, factories: factories} +} + +// Create creates an extension based on the settings and configs available. +func (b *ExtensionBuilder) Create(ctx context.Context, set extension.Settings) (extension.Extension, error) { + cfg, existsCfg := b.cfgs[set.ID] + if !existsCfg { + return nil, fmt.Errorf("extension %q is not configured", set.ID) + } + + f, existsFactory := b.factories[set.ID.Type()] + if !existsFactory { + return nil, fmt.Errorf("extension factory not available for: %q", set.ID) + } + + sl := f.ExtensionStability() + if sl >= component.StabilityLevelAlpha { + set.Logger.Debug(sl.LogMessage()) + } else { + set.Logger.Info(sl.LogMessage()) + } + return f.CreateExtension(ctx, set, cfg) +} + +func (b *ExtensionBuilder) Factory(componentType component.Type) component.Factory { + return b.factories[componentType] +} + +// NewNopProcessorConfigsAndFactories returns a configuration and factories that allows building a new nop processor. +func NewNopExtensionConfigsAndFactories() (map[component.ID]component.Config, map[component.Type]extension.Factory) { + nopFactory := extensiontest.NewNopFactory() + configs := map[component.ID]component.Config{ + component.NewID(nopType): nopFactory.CreateDefaultConfig(), + } + factories := map[component.Type]extension.Factory{ + nopType: nopFactory, + } + return configs, factories +} diff --git a/service/internal/builders/extension_test.go b/service/internal/builders/extension_test.go new file mode 100644 index 00000000000..4baa3a8d193 --- /dev/null +++ b/service/internal/builders/extension_test.go @@ -0,0 +1,97 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package builders + +import ( + "context" + "testing" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + + "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/component/componenttest" + "go.opentelemetry.io/collector/extension" + "go.opentelemetry.io/collector/extension/extensiontest" +) + +func TestExtensionBuilder(t *testing.T) { + var testType = component.MustNewType("test") + defaultCfg := struct{}{} + testID := component.NewID(testType) + unknownID := component.MustNewID("unknown") + + factories, err := extension.MakeFactoryMap([]extension.Factory{ + extension.NewFactory( + testType, + func() component.Config { return &defaultCfg }, + func(_ context.Context, settings extension.Settings, _ component.Config) (extension.Extension, error) { + return nopExtension{Settings: settings}, nil + }, + component.StabilityLevelDevelopment), + }...) + require.NoError(t, err) + + cfgs := map[component.ID]component.Config{testID: defaultCfg, unknownID: defaultCfg} + b := NewExtension(cfgs, factories) + + e, err := b.Create(context.Background(), createExtensionSettings(testID)) + assert.NoError(t, err) + assert.NotNil(t, e) + + // Check that the extension has access to the resource attributes. + nop, ok := e.(nopExtension) + assert.True(t, ok) + assert.Equal(t, nop.Settings.Resource.Attributes().Len(), 0) + + missingType, err := b.Create(context.Background(), createExtensionSettings(unknownID)) + assert.EqualError(t, err, "extension factory not available for: \"unknown\"") + assert.Nil(t, missingType) + + missingCfg, err := b.Create(context.Background(), createExtensionSettings(component.NewIDWithName(testType, "foo"))) + assert.EqualError(t, err, "extension \"test/foo\" is not configured") + assert.Nil(t, missingCfg) +} + +func TestExtensionBuilderFactory(t *testing.T) { + factories, err := extension.MakeFactoryMap([]extension.Factory{extension.NewFactory(component.MustNewType("foo"), nil, nil, component.StabilityLevelDevelopment)}...) + require.NoError(t, err) + + cfgs := map[component.ID]component.Config{component.MustNewID("foo"): struct{}{}} + b := NewExtension(cfgs, factories) + + assert.NotNil(t, b.Factory(component.MustNewID("foo").Type())) + assert.Nil(t, b.Factory(component.MustNewID("bar").Type())) +} + +func TestNewNopExtensionConfigsAndFactories(t *testing.T) { + configs, factories := NewNopExtensionConfigsAndFactories() + builder := NewExtension(configs, factories) + require.NotNil(t, builder) + + factory := extensiontest.NewNopFactory() + cfg := factory.CreateDefaultConfig() + set := extensiontest.NewNopSettings() + set.ID = component.NewID(nopType) + + ext, err := factory.CreateExtension(context.Background(), set, cfg) + require.NoError(t, err) + bExt, err := builder.Create(context.Background(), set) + require.NoError(t, err) + assert.IsType(t, ext, bExt) +} + +type nopExtension struct { + component.StartFunc + component.ShutdownFunc + extension.Settings +} + +func createExtensionSettings(id component.ID) extension.Settings { + return extension.Settings{ + ID: id, + TelemetrySettings: componenttest.NewNopTelemetrySettings(), + BuildInfo: component.NewDefaultBuildInfo(), + } +} diff --git a/service/internal/builders/processor.go b/service/internal/builders/processor.go new file mode 100644 index 00000000000..4200a997227 --- /dev/null +++ b/service/internal/builders/processor.go @@ -0,0 +1,109 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package builders // import "go.opentelemetry.io/collector/service/internal/builders" + +import ( + "context" + "fmt" + + "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/consumer" + "go.opentelemetry.io/collector/processor" + "go.opentelemetry.io/collector/processor/processortest" +) + +// Processor is an interface that allows using implementations of the builder +// from different packages. +type Processor interface { + CreateTraces(context.Context, processor.Settings, consumer.Traces) (processor.Traces, error) + CreateMetrics(context.Context, processor.Settings, consumer.Metrics) (processor.Metrics, error) + CreateLogs(context.Context, processor.Settings, consumer.Logs) (processor.Logs, error) + Factory(component.Type) component.Factory +} + +// ProcessorBuilder processor is a helper struct that given a set of Configs +// and Factories helps with creating processors. +type ProcessorBuilder struct { + cfgs map[component.ID]component.Config + factories map[component.Type]processor.Factory +} + +// NewProcessor creates a new ProcessorBuilder to help with creating components form a set of configs and factories. +func NewProcessor(cfgs map[component.ID]component.Config, factories map[component.Type]processor.Factory) *ProcessorBuilder { + return &ProcessorBuilder{cfgs: cfgs, factories: factories} +} + +// CreateTraces creates a Traces processor based on the settings and config. +func (b *ProcessorBuilder) CreateTraces(ctx context.Context, set processor.Settings, next consumer.Traces) (processor.Traces, error) { + if next == nil { + return nil, errNilNextConsumer + } + cfg, existsCfg := b.cfgs[set.ID] + if !existsCfg { + return nil, fmt.Errorf("processor %q is not configured", set.ID) + } + + f, existsFactory := b.factories[set.ID.Type()] + if !existsFactory { + return nil, fmt.Errorf("processor factory not available for: %q", set.ID) + } + + logStabilityLevel(set.Logger, f.TracesProcessorStability()) + return f.CreateTracesProcessor(ctx, set, cfg, next) +} + +// CreateMetrics creates a Metrics processor based on the settings and config. +func (b *ProcessorBuilder) CreateMetrics(ctx context.Context, set processor.Settings, next consumer.Metrics) (processor.Metrics, error) { + if next == nil { + return nil, errNilNextConsumer + } + cfg, existsCfg := b.cfgs[set.ID] + if !existsCfg { + return nil, fmt.Errorf("processor %q is not configured", set.ID) + } + + f, existsFactory := b.factories[set.ID.Type()] + if !existsFactory { + return nil, fmt.Errorf("processor factory not available for: %q", set.ID) + } + + logStabilityLevel(set.Logger, f.MetricsProcessorStability()) + return f.CreateMetricsProcessor(ctx, set, cfg, next) +} + +// CreateLogs creates a Logs processor based on the settings and config. +func (b *ProcessorBuilder) CreateLogs(ctx context.Context, set processor.Settings, next consumer.Logs) (processor.Logs, error) { + if next == nil { + return nil, errNilNextConsumer + } + cfg, existsCfg := b.cfgs[set.ID] + if !existsCfg { + return nil, fmt.Errorf("processor %q is not configured", set.ID) + } + + f, existsFactory := b.factories[set.ID.Type()] + if !existsFactory { + return nil, fmt.Errorf("processor factory not available for: %q", set.ID) + } + + logStabilityLevel(set.Logger, f.LogsProcessorStability()) + return f.CreateLogsProcessor(ctx, set, cfg, next) +} + +func (b *ProcessorBuilder) Factory(componentType component.Type) component.Factory { + return b.factories[componentType] +} + +// NewNopProcessorConfigsAndFactories returns a configuration and factories that allows building a new nop processor. +func NewNopProcessorConfigsAndFactories() (map[component.ID]component.Config, map[component.Type]processor.Factory) { + nopFactory := processortest.NewNopFactory() + configs := map[component.ID]component.Config{ + component.NewID(nopType): nopFactory.CreateDefaultConfig(), + } + factories := map[component.Type]processor.Factory{ + nopType: nopFactory, + } + + return configs, factories +} diff --git a/service/internal/builders/processor_test.go b/service/internal/builders/processor_test.go new file mode 100644 index 00000000000..713465a1301 --- /dev/null +++ b/service/internal/builders/processor_test.go @@ -0,0 +1,217 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package builders + +import ( + "context" + "testing" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + + "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/component/componenttest" + "go.opentelemetry.io/collector/consumer" + "go.opentelemetry.io/collector/consumer/consumertest" + "go.opentelemetry.io/collector/processor" + "go.opentelemetry.io/collector/processor/processortest" +) + +func TestProcessorBuilder(t *testing.T) { + defaultCfg := struct{}{} + factories, err := processor.MakeFactoryMap([]processor.Factory{ + processor.NewFactory(component.MustNewType("err"), nil), + processor.NewFactory( + component.MustNewType("all"), + func() component.Config { return &defaultCfg }, + processor.WithTraces(createProcessorTraces, component.StabilityLevelDevelopment), + processor.WithMetrics(createProcessorMetrics, component.StabilityLevelAlpha), + processor.WithLogs(createProcessorLogs, component.StabilityLevelDeprecated), + ), + }...) + require.NoError(t, err) + + testCases := []struct { + name string + id component.ID + err string + nextTraces consumer.Traces + nextLogs consumer.Logs + nextMetrics consumer.Metrics + }{ + { + name: "unknown", + id: component.MustNewID("unknown"), + err: "processor factory not available for: \"unknown\"", + nextTraces: consumertest.NewNop(), + nextLogs: consumertest.NewNop(), + nextMetrics: consumertest.NewNop(), + }, + { + name: "err", + id: component.MustNewID("err"), + err: "telemetry type is not supported", + nextTraces: consumertest.NewNop(), + nextLogs: consumertest.NewNop(), + nextMetrics: consumertest.NewNop(), + }, + { + name: "all", + id: component.MustNewID("all"), + nextTraces: consumertest.NewNop(), + nextLogs: consumertest.NewNop(), + nextMetrics: consumertest.NewNop(), + }, + { + name: "all/named", + id: component.MustNewIDWithName("all", "named"), + nextTraces: consumertest.NewNop(), + nextLogs: consumertest.NewNop(), + nextMetrics: consumertest.NewNop(), + }, + { + name: "no next consumer", + id: component.MustNewID("unknown"), + err: "nil next Consumer", + nextTraces: nil, + nextLogs: nil, + nextMetrics: nil, + }, + } + + for _, tt := range testCases { + t.Run(tt.name, func(t *testing.T) { + cfgs := map[component.ID]component.Config{tt.id: defaultCfg} + b := NewProcessor(cfgs, factories) + + te, err := b.CreateTraces(context.Background(), createProcessorSettings(tt.id), tt.nextTraces) + if tt.err != "" { + assert.EqualError(t, err, tt.err) + assert.Nil(t, te) + } else { + assert.NoError(t, err) + assert.Equal(t, nopProcessorInstance, te) + } + + me, err := b.CreateMetrics(context.Background(), createProcessorSettings(tt.id), tt.nextMetrics) + if tt.err != "" { + assert.EqualError(t, err, tt.err) + assert.Nil(t, me) + } else { + assert.NoError(t, err) + assert.Equal(t, nopProcessorInstance, me) + } + + le, err := b.CreateLogs(context.Background(), createProcessorSettings(tt.id), tt.nextLogs) + if tt.err != "" { + assert.EqualError(t, err, tt.err) + assert.Nil(t, le) + } else { + assert.NoError(t, err) + assert.Equal(t, nopProcessorInstance, le) + } + }) + } +} + +func TestProcessorBuilderMissingConfig(t *testing.T) { + defaultCfg := struct{}{} + factories, err := processor.MakeFactoryMap([]processor.Factory{ + processor.NewFactory( + component.MustNewType("all"), + func() component.Config { return &defaultCfg }, + processor.WithTraces(createProcessorTraces, component.StabilityLevelDevelopment), + processor.WithMetrics(createProcessorMetrics, component.StabilityLevelAlpha), + processor.WithLogs(createProcessorLogs, component.StabilityLevelDeprecated), + ), + }...) + + require.NoError(t, err) + + bErr := NewProcessor(map[component.ID]component.Config{}, factories) + missingID := component.MustNewIDWithName("all", "missing") + + te, err := bErr.CreateTraces(context.Background(), createProcessorSettings(missingID), consumertest.NewNop()) + assert.EqualError(t, err, "processor \"all/missing\" is not configured") + assert.Nil(t, te) + + me, err := bErr.CreateMetrics(context.Background(), createProcessorSettings(missingID), consumertest.NewNop()) + assert.EqualError(t, err, "processor \"all/missing\" is not configured") + assert.Nil(t, me) + + le, err := bErr.CreateLogs(context.Background(), createProcessorSettings(missingID), consumertest.NewNop()) + assert.EqualError(t, err, "processor \"all/missing\" is not configured") + assert.Nil(t, le) +} + +func TestProcessorBuilderFactory(t *testing.T) { + factories, err := processor.MakeFactoryMap([]processor.Factory{processor.NewFactory(component.MustNewType("foo"), nil)}...) + require.NoError(t, err) + + cfgs := map[component.ID]component.Config{component.MustNewID("foo"): struct{}{}} + b := NewProcessor(cfgs, factories) + + assert.NotNil(t, b.Factory(component.MustNewID("foo").Type())) + assert.Nil(t, b.Factory(component.MustNewID("bar").Type())) +} + +func TestNewNopProcessorBuilder(t *testing.T) { + configs, factories := NewNopProcessorConfigsAndFactories() + builder := NewProcessor(configs, factories) + require.NotNil(t, builder) + + factory := processortest.NewNopFactory() + cfg := factory.CreateDefaultConfig() + set := processortest.NewNopSettings() + set.ID = component.NewID(nopType) + + traces, err := factory.CreateTracesProcessor(context.Background(), set, cfg, consumertest.NewNop()) + require.NoError(t, err) + bTraces, err := builder.CreateTraces(context.Background(), set, consumertest.NewNop()) + require.NoError(t, err) + assert.IsType(t, traces, bTraces) + + metrics, err := factory.CreateMetricsProcessor(context.Background(), set, cfg, consumertest.NewNop()) + require.NoError(t, err) + bMetrics, err := builder.CreateMetrics(context.Background(), set, consumertest.NewNop()) + require.NoError(t, err) + assert.IsType(t, metrics, bMetrics) + + logs, err := factory.CreateLogsProcessor(context.Background(), set, cfg, consumertest.NewNop()) + require.NoError(t, err) + bLogs, err := builder.CreateLogs(context.Background(), set, consumertest.NewNop()) + require.NoError(t, err) + assert.IsType(t, logs, bLogs) +} + +var nopProcessorInstance = &nopProcessor{ + Consumer: consumertest.NewNop(), +} + +// nopProcessor stores consumed traces and metrics for testing purposes. +type nopProcessor struct { + component.StartFunc + component.ShutdownFunc + consumertest.Consumer +} + +func createProcessorTraces(context.Context, processor.Settings, component.Config, consumer.Traces) (processor.Traces, error) { + return nopProcessorInstance, nil +} + +func createProcessorMetrics(context.Context, processor.Settings, component.Config, consumer.Metrics) (processor.Metrics, error) { + return nopProcessorInstance, nil +} + +func createProcessorLogs(context.Context, processor.Settings, component.Config, consumer.Logs) (processor.Logs, error) { + return nopProcessorInstance, nil +} + +func createProcessorSettings(id component.ID) processor.Settings { + return processor.Settings{ + ID: id, + TelemetrySettings: componenttest.NewNopTelemetrySettings(), + BuildInfo: component.NewDefaultBuildInfo(), + } +} diff --git a/service/internal/builders/receiver.go b/service/internal/builders/receiver.go new file mode 100644 index 00000000000..94dba2e422f --- /dev/null +++ b/service/internal/builders/receiver.go @@ -0,0 +1,110 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package builders // import "go.opentelemetry.io/collector/service/internal/builders" + +import ( + "context" + "fmt" + + "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/consumer" + "go.opentelemetry.io/collector/receiver" + "go.opentelemetry.io/collector/receiver/receivertest" +) + +// Receiver is an interface that allows using implementations of the builder +// from different packages. +type Receiver interface { + CreateTraces(context.Context, receiver.Settings, consumer.Traces) (receiver.Traces, error) + CreateMetrics(context.Context, receiver.Settings, consumer.Metrics) (receiver.Metrics, error) + CreateLogs(context.Context, receiver.Settings, consumer.Logs) (receiver.Logs, error) + Factory(component.Type) component.Factory +} + +// ReceiverBuilder receiver is a helper struct that given a set of Configs and +// Factories helps with creating receivers. +type ReceiverBuilder struct { + cfgs map[component.ID]component.Config + factories map[component.Type]receiver.Factory +} + +// NewReceiver creates a new ReceiverBuilder to help with creating +// components form a set of configs and factories. +func NewReceiver(cfgs map[component.ID]component.Config, factories map[component.Type]receiver.Factory) *ReceiverBuilder { + return &ReceiverBuilder{cfgs: cfgs, factories: factories} +} + +// CreateTraces creates a Traces receiver based on the settings and config. +func (b *ReceiverBuilder) CreateTraces(ctx context.Context, set receiver.Settings, next consumer.Traces) (receiver.Traces, error) { + if next == nil { + return nil, errNilNextConsumer + } + cfg, existsCfg := b.cfgs[set.ID] + if !existsCfg { + return nil, fmt.Errorf("receiver %q is not configured", set.ID) + } + + f, existsFactory := b.factories[set.ID.Type()] + if !existsFactory { + return nil, fmt.Errorf("receiver factory not available for: %q", set.ID) + } + + logStabilityLevel(set.Logger, f.TracesReceiverStability()) + return f.CreateTracesReceiver(ctx, set, cfg, next) +} + +// CreateMetrics creates a Metrics receiver based on the settings and config. +func (b *ReceiverBuilder) CreateMetrics(ctx context.Context, set receiver.Settings, next consumer.Metrics) (receiver.Metrics, error) { + if next == nil { + return nil, errNilNextConsumer + } + cfg, existsCfg := b.cfgs[set.ID] + if !existsCfg { + return nil, fmt.Errorf("receiver %q is not configured", set.ID) + } + + f, existsFactory := b.factories[set.ID.Type()] + if !existsFactory { + return nil, fmt.Errorf("receiver factory not available for: %q", set.ID) + } + + logStabilityLevel(set.Logger, f.MetricsReceiverStability()) + return f.CreateMetricsReceiver(ctx, set, cfg, next) +} + +// CreateLogs creates a Logs receiver based on the settings and config. +func (b *ReceiverBuilder) CreateLogs(ctx context.Context, set receiver.Settings, next consumer.Logs) (receiver.Logs, error) { + if next == nil { + return nil, errNilNextConsumer + } + cfg, existsCfg := b.cfgs[set.ID] + if !existsCfg { + return nil, fmt.Errorf("receiver %q is not configured", set.ID) + } + + f, existsFactory := b.factories[set.ID.Type()] + if !existsFactory { + return nil, fmt.Errorf("receiver factory not available for: %q", set.ID) + } + + logStabilityLevel(set.Logger, f.LogsReceiverStability()) + return f.CreateLogsReceiver(ctx, set, cfg, next) +} + +func (b *ReceiverBuilder) Factory(componentType component.Type) component.Factory { + return b.factories[componentType] +} + +// NewNopReceiverConfigsAndFactories returns a configuration and factories that allows building a new nop receiver. +func NewNopReceiverConfigsAndFactories() (map[component.ID]component.Config, map[component.Type]receiver.Factory) { + nopFactory := receivertest.NewNopFactory() + configs := map[component.ID]component.Config{ + component.NewID(nopType): nopFactory.CreateDefaultConfig(), + } + factories := map[component.Type]receiver.Factory{ + nopType: nopFactory, + } + + return configs, factories +} diff --git a/service/internal/builders/receiver_test.go b/service/internal/builders/receiver_test.go new file mode 100644 index 00000000000..ba355de5e6e --- /dev/null +++ b/service/internal/builders/receiver_test.go @@ -0,0 +1,217 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package builders + +import ( + "context" + "testing" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + + "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/component/componenttest" + "go.opentelemetry.io/collector/consumer" + "go.opentelemetry.io/collector/consumer/consumertest" + "go.opentelemetry.io/collector/receiver" + "go.opentelemetry.io/collector/receiver/receivertest" +) + +func TestReceiverBuilder(t *testing.T) { + defaultCfg := struct{}{} + factories, err := receiver.MakeFactoryMap([]receiver.Factory{ + receiver.NewFactory(component.MustNewType("err"), nil), + receiver.NewFactory( + component.MustNewType("all"), + func() component.Config { return &defaultCfg }, + receiver.WithTraces(createReceiverTraces, component.StabilityLevelDevelopment), + receiver.WithMetrics(createReceiverMetrics, component.StabilityLevelAlpha), + receiver.WithLogs(createReceiverLogs, component.StabilityLevelDeprecated), + ), + }...) + require.NoError(t, err) + + testCases := []struct { + name string + id component.ID + err string + nextTraces consumer.Traces + nextLogs consumer.Logs + nextMetrics consumer.Metrics + }{ + { + name: "unknown", + id: component.MustNewID("unknown"), + err: "receiver factory not available for: \"unknown\"", + nextTraces: consumertest.NewNop(), + nextLogs: consumertest.NewNop(), + nextMetrics: consumertest.NewNop(), + }, + { + name: "err", + id: component.MustNewID("err"), + err: "telemetry type is not supported", + nextTraces: consumertest.NewNop(), + nextLogs: consumertest.NewNop(), + nextMetrics: consumertest.NewNop(), + }, + { + name: "all", + id: component.MustNewID("all"), + nextTraces: consumertest.NewNop(), + nextLogs: consumertest.NewNop(), + nextMetrics: consumertest.NewNop(), + }, + { + name: "all/named", + id: component.MustNewIDWithName("all", "named"), + nextTraces: consumertest.NewNop(), + nextLogs: consumertest.NewNop(), + nextMetrics: consumertest.NewNop(), + }, + { + name: "no next consumer", + id: component.MustNewID("unknown"), + err: "nil next Consumer", + nextTraces: nil, + nextLogs: nil, + nextMetrics: nil, + }, + } + + for _, tt := range testCases { + t.Run(tt.name, func(t *testing.T) { + cfgs := map[component.ID]component.Config{tt.id: defaultCfg} + b := NewReceiver(cfgs, factories) + + te, err := b.CreateTraces(context.Background(), settings(tt.id), tt.nextTraces) + if tt.err != "" { + assert.EqualError(t, err, tt.err) + assert.Nil(t, te) + } else { + assert.NoError(t, err) + assert.Equal(t, nopReceiverInstance, te) + } + + me, err := b.CreateMetrics(context.Background(), settings(tt.id), tt.nextMetrics) + if tt.err != "" { + assert.EqualError(t, err, tt.err) + assert.Nil(t, me) + } else { + assert.NoError(t, err) + assert.Equal(t, nopReceiverInstance, me) + } + + le, err := b.CreateLogs(context.Background(), settings(tt.id), tt.nextLogs) + if tt.err != "" { + assert.EqualError(t, err, tt.err) + assert.Nil(t, le) + } else { + assert.NoError(t, err) + assert.Equal(t, nopReceiverInstance, le) + } + }) + } +} + +func TestReceiverBuilderMissingConfig(t *testing.T) { + defaultCfg := struct{}{} + factories, err := receiver.MakeFactoryMap([]receiver.Factory{ + receiver.NewFactory( + component.MustNewType("all"), + func() component.Config { return &defaultCfg }, + receiver.WithTraces(createReceiverTraces, component.StabilityLevelDevelopment), + receiver.WithMetrics(createReceiverMetrics, component.StabilityLevelAlpha), + receiver.WithLogs(createReceiverLogs, component.StabilityLevelDeprecated), + ), + }...) + + require.NoError(t, err) + + bErr := NewReceiver(map[component.ID]component.Config{}, factories) + missingID := component.MustNewIDWithName("all", "missing") + + te, err := bErr.CreateTraces(context.Background(), settings(missingID), consumertest.NewNop()) + assert.EqualError(t, err, "receiver \"all/missing\" is not configured") + assert.Nil(t, te) + + me, err := bErr.CreateMetrics(context.Background(), settings(missingID), consumertest.NewNop()) + assert.EqualError(t, err, "receiver \"all/missing\" is not configured") + assert.Nil(t, me) + + le, err := bErr.CreateLogs(context.Background(), settings(missingID), consumertest.NewNop()) + assert.EqualError(t, err, "receiver \"all/missing\" is not configured") + assert.Nil(t, le) +} + +func TestReceiverBuilderFactory(t *testing.T) { + factories, err := receiver.MakeFactoryMap([]receiver.Factory{receiver.NewFactory(component.MustNewType("foo"), nil)}...) + require.NoError(t, err) + + cfgs := map[component.ID]component.Config{component.MustNewID("foo"): struct{}{}} + b := NewReceiver(cfgs, factories) + + assert.NotNil(t, b.Factory(component.MustNewID("foo").Type())) + assert.Nil(t, b.Factory(component.MustNewID("bar").Type())) +} + +func TestNewNopReceiverConfigsAndFactories(t *testing.T) { + configs, factories := NewNopReceiverConfigsAndFactories() + builder := NewReceiver(configs, factories) + require.NotNil(t, builder) + + factory := receivertest.NewNopFactory() + cfg := factory.CreateDefaultConfig() + set := receivertest.NewNopSettings() + set.ID = component.NewID(nopType) + + traces, err := factory.CreateTracesReceiver(context.Background(), set, cfg, consumertest.NewNop()) + require.NoError(t, err) + bTraces, err := builder.CreateTraces(context.Background(), set, consumertest.NewNop()) + require.NoError(t, err) + assert.IsType(t, traces, bTraces) + + metrics, err := factory.CreateMetricsReceiver(context.Background(), set, cfg, consumertest.NewNop()) + require.NoError(t, err) + bMetrics, err := builder.CreateMetrics(context.Background(), set, consumertest.NewNop()) + require.NoError(t, err) + assert.IsType(t, metrics, bMetrics) + + logs, err := factory.CreateLogsReceiver(context.Background(), set, cfg, consumertest.NewNop()) + require.NoError(t, err) + bLogs, err := builder.CreateLogs(context.Background(), set, consumertest.NewNop()) + require.NoError(t, err) + assert.IsType(t, logs, bLogs) +} + +func settings(id component.ID) receiver.Settings { + return receiver.Settings{ + ID: id, + TelemetrySettings: componenttest.NewNopTelemetrySettings(), + BuildInfo: component.NewDefaultBuildInfo(), + } +} + +var nopReceiverInstance = &nopReceiver{ + Consumer: consumertest.NewNop(), +} + +// nopReceiver stores consumed traces and metrics for testing purposes. +type nopReceiver struct { + component.StartFunc + component.ShutdownFunc + consumertest.Consumer +} + +func createReceiverTraces(context.Context, receiver.Settings, component.Config, consumer.Traces) (receiver.Traces, error) { + return nopReceiverInstance, nil +} + +func createReceiverMetrics(context.Context, receiver.Settings, component.Config, consumer.Metrics) (receiver.Metrics, error) { + return nopReceiverInstance, nil +} + +func createReceiverLogs(context.Context, receiver.Settings, component.Config, consumer.Logs) (receiver.Logs, error) { + return nopReceiverInstance, nil +} diff --git a/service/internal/graph/graph.go b/service/internal/graph/graph.go index 002fa3129f6..5f242cbe5f5 100644 --- a/service/internal/graph/graph.go +++ b/service/internal/graph/graph.go @@ -25,12 +25,11 @@ import ( "gonum.org/v1/gonum/graph/topo" "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/component/componentstatus" "go.opentelemetry.io/collector/connector" "go.opentelemetry.io/collector/consumer" - "go.opentelemetry.io/collector/exporter" "go.opentelemetry.io/collector/internal/fanoutconsumer" - "go.opentelemetry.io/collector/processor" - "go.opentelemetry.io/collector/receiver" + "go.opentelemetry.io/collector/service/internal/builders" "go.opentelemetry.io/collector/service/internal/capabilityconsumer" "go.opentelemetry.io/collector/service/internal/status" "go.opentelemetry.io/collector/service/pipelines" @@ -41,10 +40,10 @@ type Settings struct { Telemetry component.TelemetrySettings BuildInfo component.BuildInfo - ReceiverBuilder *receiver.Builder - ProcessorBuilder *processor.Builder - ExporterBuilder *exporter.Builder - ConnectorBuilder *connector.Builder + ReceiverBuilder builders.Receiver + ProcessorBuilder builders.Processor + ExporterBuilder builders.Exporter + ConnectorBuilder builders.Connector // PipelineConfigs is a map of component.ID to PipelineConfig. PipelineConfigs pipelines.Config @@ -60,7 +59,7 @@ type Graph struct { pipelines map[component.ID]*pipelineNodes // Keep track of status source per node - instanceIDs map[int64]*component.InstanceID + instanceIDs map[int64]*componentstatus.InstanceID telemetry component.TelemetrySettings } @@ -71,7 +70,7 @@ func Build(ctx context.Context, set Settings) (*Graph, error) { pipelines := &Graph{ componentGraph: simple.NewDirectedGraph(), pipelines: make(map[component.ID]*pipelineNodes, len(set.PipelineConfigs)), - instanceIDs: make(map[int64]*component.InstanceID), + instanceIDs: make(map[int64]*componentstatus.InstanceID), telemetry: set.Telemetry, } for pipelineID := range set.PipelineConfigs { @@ -196,47 +195,37 @@ func (g *Graph) createNodes(set Settings) error { func (g *Graph) createReceiver(pipelineID, recvID component.ID) *receiverNode { rcvrNode := newReceiverNode(pipelineID.Type(), recvID) if node := g.componentGraph.Node(rcvrNode.ID()); node != nil { - g.instanceIDs[node.ID()].PipelineIDs[pipelineID] = struct{}{} + instanceID := g.instanceIDs[node.ID()] + g.instanceIDs[node.ID()] = instanceID.WithPipelines(pipelineID) return node.(*receiverNode) } g.componentGraph.AddNode(rcvrNode) - g.instanceIDs[rcvrNode.ID()] = &component.InstanceID{ - ID: recvID, - Kind: component.KindReceiver, - PipelineIDs: map[component.ID]struct{}{ - pipelineID: {}, - }, - } + g.instanceIDs[rcvrNode.ID()] = componentstatus.NewInstanceID( + recvID, component.KindReceiver, pipelineID, + ) return rcvrNode } func (g *Graph) createProcessor(pipelineID, procID component.ID) *processorNode { procNode := newProcessorNode(pipelineID, procID) g.componentGraph.AddNode(procNode) - g.instanceIDs[procNode.ID()] = &component.InstanceID{ - ID: procID, - Kind: component.KindProcessor, - PipelineIDs: map[component.ID]struct{}{ - pipelineID: {}, - }, - } + g.instanceIDs[procNode.ID()] = componentstatus.NewInstanceID( + procID, component.KindProcessor, pipelineID, + ) return procNode } func (g *Graph) createExporter(pipelineID, exprID component.ID) *exporterNode { expNode := newExporterNode(pipelineID.Type(), exprID) if node := g.componentGraph.Node(expNode.ID()); node != nil { - g.instanceIDs[expNode.ID()].PipelineIDs[pipelineID] = struct{}{} + instanceID := g.instanceIDs[expNode.ID()] + g.instanceIDs[expNode.ID()] = instanceID.WithPipelines(pipelineID) return node.(*exporterNode) } g.componentGraph.AddNode(expNode) - g.instanceIDs[expNode.ID()] = &component.InstanceID{ - ID: expNode.componentID, - Kind: component.KindExporter, - PipelineIDs: map[component.ID]struct{}{ - pipelineID: {}, - }, - } + g.instanceIDs[expNode.ID()] = componentstatus.NewInstanceID( + expNode.componentID, component.KindExporter, pipelineID, + ) return expNode } @@ -244,19 +233,13 @@ func (g *Graph) createConnector(exprPipelineID, rcvrPipelineID, connID component connNode := newConnectorNode(exprPipelineID.Type(), rcvrPipelineID.Type(), connID) if node := g.componentGraph.Node(connNode.ID()); node != nil { instanceID := g.instanceIDs[connNode.ID()] - instanceID.PipelineIDs[exprPipelineID] = struct{}{} - instanceID.PipelineIDs[rcvrPipelineID] = struct{}{} + g.instanceIDs[connNode.ID()] = instanceID.WithPipelines(exprPipelineID, rcvrPipelineID) return node.(*connectorNode) } g.componentGraph.AddNode(connNode) - g.instanceIDs[connNode.ID()] = &component.InstanceID{ - ID: connNode.componentID, - Kind: component.KindConnector, - PipelineIDs: map[component.ID]struct{}{ - exprPipelineID: {}, - rcvrPipelineID: {}, - }, - } + g.instanceIDs[connNode.ID()] = componentstatus.NewInstanceID( + connNode.componentID, component.KindConnector, exprPipelineID, rcvrPipelineID, + ) return connNode } @@ -299,23 +282,16 @@ func (g *Graph) buildComponents(ctx context.Context, set Settings) error { for i := len(nodes) - 1; i >= 0; i-- { node := nodes[i] - // skipped for capabilitiesNodes and fanoutNodes as they are not assigned componentIDs. - var telemetrySettings component.TelemetrySettings - if instanceID, ok := g.instanceIDs[node.ID()]; ok { - telemetrySettings = set.Telemetry - telemetrySettings.ReportStatus = status.NewReportStatusFunc(instanceID, set.ReportStatus) - } - switch n := node.(type) { case *receiverNode: - err = n.buildComponent(ctx, telemetrySettings, set.BuildInfo, set.ReceiverBuilder, g.nextConsumers(n.ID())) + err = n.buildComponent(ctx, set.Telemetry, set.BuildInfo, set.ReceiverBuilder, g.nextConsumers(n.ID())) case *processorNode: // nextConsumers is guaranteed to be length 1. Either it is the next processor or it is the fanout node for the exporters. - err = n.buildComponent(ctx, telemetrySettings, set.BuildInfo, set.ProcessorBuilder, g.nextConsumers(n.ID())[0]) + err = n.buildComponent(ctx, set.Telemetry, set.BuildInfo, set.ProcessorBuilder, g.nextConsumers(n.ID())[0]) case *exporterNode: - err = n.buildComponent(ctx, telemetrySettings, set.BuildInfo, set.ExporterBuilder) + err = n.buildComponent(ctx, set.Telemetry, set.BuildInfo, set.ExporterBuilder) case *connectorNode: - err = n.buildComponent(ctx, telemetrySettings, set.BuildInfo, set.ConnectorBuilder, g.nextConsumers(n.ID())) + err = n.buildComponent(ctx, set.Telemetry, set.BuildInfo, set.ConnectorBuilder, g.nextConsumers(n.ID())) case *capabilitiesNode: capability := consumer.Capabilities{ // The fanOutNode represents the aggregate capabilities of the exporters in the pipeline. @@ -398,7 +374,11 @@ type pipelineNodes struct { exporters map[int64]graph.Node } -func (g *Graph) StartAll(ctx context.Context, host component.Host, reporter status.Reporter) error { +func (g *Graph) StartAll(ctx context.Context, host *Host) error { + if host == nil { + return errors.New("host cannot be nil") + } + nodes, err := topo.Sort(g.componentGraph) if err != nil { return err @@ -417,27 +397,27 @@ func (g *Graph) StartAll(ctx context.Context, host component.Host, reporter stat } instanceID := g.instanceIDs[node.ID()] - reporter.ReportStatus( + host.Reporter.ReportStatus( instanceID, - component.NewStatusEvent(component.StatusStarting), + componentstatus.NewEvent(componentstatus.StatusStarting), ) - if compErr := comp.Start(ctx, host); compErr != nil { - reporter.ReportStatus( + if compErr := comp.Start(ctx, &HostWrapper{Host: host, InstanceID: instanceID}); compErr != nil { + host.Reporter.ReportStatus( instanceID, - component.NewPermanentErrorEvent(compErr), + componentstatus.NewPermanentErrorEvent(compErr), ) // We log with zap.AddStacktrace(zap.DPanicLevel) to avoid adding the stack trace to the error log g.telemetry.Logger.WithOptions(zap.AddStacktrace(zap.DPanicLevel)). Error("Failed to start component", zap.Error(compErr), - zap.String("type", instanceID.Kind.String()), - zap.String("id", instanceID.ID.String()), + zap.String("type", instanceID.Kind().String()), + zap.String("id", instanceID.ComponentID().String()), ) return compErr } - reporter.ReportOKIfStarting(instanceID) + host.Reporter.ReportOKIfStarting(instanceID) } return nil } @@ -465,21 +445,21 @@ func (g *Graph) ShutdownAll(ctx context.Context, reporter status.Reporter) error instanceID := g.instanceIDs[node.ID()] reporter.ReportStatus( instanceID, - component.NewStatusEvent(component.StatusStopping), + componentstatus.NewEvent(componentstatus.StatusStopping), ) if compErr := comp.Shutdown(ctx); compErr != nil { errs = multierr.Append(errs, compErr) reporter.ReportStatus( instanceID, - component.NewPermanentErrorEvent(compErr), + componentstatus.NewPermanentErrorEvent(compErr), ) continue } reporter.ReportStatus( instanceID, - component.NewStatusEvent(component.StatusStopped), + componentstatus.NewEvent(componentstatus.StatusStopped), ) } return errs @@ -580,3 +560,16 @@ func connectorStability(f connector.Factory, expType, recType component.Type) co } return component.StabilityLevelUndefined } + +var _ getExporters = (*HostWrapper)(nil) +var _ component.Host = (*HostWrapper)(nil) +var _ componentstatus.Reporter = (*HostWrapper)(nil) + +type HostWrapper struct { + *Host + InstanceID *componentstatus.InstanceID +} + +func (host *HostWrapper) Report(event *componentstatus.Event) { + host.Reporter.ReportStatus(host.InstanceID, event) +} diff --git a/service/internal/graph/graph_test.go b/service/internal/graph/graph_test.go index fcc2ea6cf89..4256088328a 100644 --- a/service/internal/graph/graph_test.go +++ b/service/internal/graph/graph_test.go @@ -16,6 +16,7 @@ import ( "gonum.org/v1/gonum/graph/simple" "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/component/componentstatus" "go.opentelemetry.io/collector/component/componenttest" "go.opentelemetry.io/collector/connector" "go.opentelemetry.io/collector/connector/connectortest" @@ -28,6 +29,7 @@ import ( "go.opentelemetry.io/collector/processor/processortest" "go.opentelemetry.io/collector/receiver" "go.opentelemetry.io/collector/receiver/receivertest" + "go.opentelemetry.io/collector/service/internal/builders" "go.opentelemetry.io/collector/service/internal/status" "go.opentelemetry.io/collector/service/internal/status/statustest" "go.opentelemetry.io/collector/service/internal/testcomponents" @@ -145,16 +147,16 @@ func TestGraphStartStop(t *testing.T) { pg := &Graph{componentGraph: simple.NewDirectedGraph()} pg.telemetry = componenttest.NewNopTelemetrySettings() - pg.instanceIDs = make(map[int64]*component.InstanceID) + pg.instanceIDs = make(map[int64]*componentstatus.InstanceID) for _, edge := range tt.edges { f, t := &testNode{id: edge[0]}, &testNode{id: edge[1]} - pg.instanceIDs[f.ID()] = &component.InstanceID{} - pg.instanceIDs[t.ID()] = &component.InstanceID{} + pg.instanceIDs[f.ID()] = &componentstatus.InstanceID{} + pg.instanceIDs[t.ID()] = &componentstatus.InstanceID{} pg.componentGraph.SetEdge(simple.Edge{F: f, T: t}) } - require.NoError(t, pg.StartAll(ctx, componenttest.NewNopHost(), statustest.NewNopStatusReporter())) + require.NoError(t, pg.StartAll(ctx, &Host{Reporter: status.NewReporter(func(*componentstatus.InstanceID, *componentstatus.Event) {}, func(error) {})})) for _, edge := range tt.edges { assert.Greater(t, ctx.order[edge[0]], ctx.order[edge[1]]) } @@ -176,7 +178,7 @@ func TestGraphStartStopCycle(t *testing.T) { c1 := &testNode{id: component.MustNewIDWithName("c", "1")} e1 := &testNode{id: component.MustNewIDWithName("e", "1")} - pg.instanceIDs = map[int64]*component.InstanceID{ + pg.instanceIDs = map[int64]*componentstatus.InstanceID{ r1.ID(): {}, p1.ID(): {}, c1.ID(): {}, @@ -188,7 +190,7 @@ func TestGraphStartStopCycle(t *testing.T) { pg.componentGraph.SetEdge(simple.Edge{F: c1, T: e1}) pg.componentGraph.SetEdge(simple.Edge{F: c1, T: p1}) // loop back - err := pg.StartAll(context.Background(), componenttest.NewNopHost(), statustest.NewNopStatusReporter()) + err := pg.StartAll(context.Background(), &Host{Reporter: status.NewReporter(func(*componentstatus.InstanceID, *componentstatus.Event) {}, func(error) {})}) assert.Error(t, err) assert.Contains(t, err.Error(), `topo: no topological ordering: cyclic components`) @@ -208,7 +210,7 @@ func TestGraphStartStopComponentError(t *testing.T) { id: component.MustNewIDWithName("e", "1"), shutdownErr: errors.New("bar"), } - pg.instanceIDs = map[int64]*component.InstanceID{ + pg.instanceIDs = map[int64]*componentstatus.InstanceID{ r1.ID(): {}, e1.ID(): {}, } @@ -216,7 +218,7 @@ func TestGraphStartStopComponentError(t *testing.T) { F: r1, T: e1, }) - assert.EqualError(t, pg.StartAll(context.Background(), componenttest.NewNopHost(), statustest.NewNopStatusReporter()), "foo") + assert.EqualError(t, pg.StartAll(context.Background(), &Host{Reporter: status.NewReporter(func(*componentstatus.InstanceID, *componentstatus.Event) {}, func(error) {})}), "foo") assert.EqualError(t, pg.ShutdownAll(context.Background(), statustest.NewNopStatusReporter()), "bar") } @@ -224,7 +226,7 @@ func TestConnectorPipelinesGraph(t *testing.T) { tests := []struct { name string pipelineConfigs pipelines.Config - expectedPerExporter int // requires symmetry in pipelines + expectedPerExporter int // requires symmetry in Pipelines }{ { name: "pipelines_simple.yaml", @@ -756,7 +758,7 @@ func TestConnectorPipelinesGraph(t *testing.T) { set := Settings{ Telemetry: componenttest.NewNopTelemetrySettings(), BuildInfo: component.NewDefaultBuildInfo(), - ReceiverBuilder: receiver.NewBuilder( + ReceiverBuilder: builders.NewReceiver( map[component.ID]component.Config{ component.MustNewID("examplereceiver"): testcomponents.ExampleReceiverFactory.CreateDefaultConfig(), component.MustNewIDWithName("examplereceiver", "1"): testcomponents.ExampleReceiverFactory.CreateDefaultConfig(), @@ -765,7 +767,7 @@ func TestConnectorPipelinesGraph(t *testing.T) { testcomponents.ExampleReceiverFactory.Type(): testcomponents.ExampleReceiverFactory, }, ), - ProcessorBuilder: processor.NewBuilder( + ProcessorBuilder: builders.NewProcessor( map[component.ID]component.Config{ component.MustNewID("exampleprocessor"): testcomponents.ExampleProcessorFactory.CreateDefaultConfig(), component.MustNewIDWithName("exampleprocessor", "mutate"): testcomponents.ExampleProcessorFactory.CreateDefaultConfig(), @@ -774,7 +776,7 @@ func TestConnectorPipelinesGraph(t *testing.T) { testcomponents.ExampleProcessorFactory.Type(): testcomponents.ExampleProcessorFactory, }, ), - ExporterBuilder: exporter.NewBuilder( + ExporterBuilder: builders.NewExporter( map[component.ID]component.Config{ component.MustNewID("exampleexporter"): testcomponents.ExampleExporterFactory.CreateDefaultConfig(), component.MustNewIDWithName("exampleexporter", "1"): testcomponents.ExampleExporterFactory.CreateDefaultConfig(), @@ -783,7 +785,7 @@ func TestConnectorPipelinesGraph(t *testing.T) { testcomponents.ExampleExporterFactory.Type(): testcomponents.ExampleExporterFactory, }, ), - ConnectorBuilder: connector.NewBuilder( + ConnectorBuilder: builders.NewConnector( map[component.ID]component.Config{ component.MustNewID("exampleconnector"): testcomponents.ExampleConnectorFactory.CreateDefaultConfig(), component.MustNewIDWithName("exampleconnector", "merge"): testcomponents.ExampleConnectorFactory.CreateDefaultConfig(), @@ -804,7 +806,7 @@ func TestConnectorPipelinesGraph(t *testing.T) { assert.Equal(t, len(test.pipelineConfigs), len(pg.pipelines)) - assert.NoError(t, pg.StartAll(context.Background(), componenttest.NewNopHost(), statustest.NewNopStatusReporter())) + assert.NoError(t, pg.StartAll(context.Background(), &Host{Reporter: status.NewReporter(func(*componentstatus.InstanceID, *componentstatus.Event) {}, func(error) {})})) mutatingPipelines := make(map[component.ID]bool, len(test.pipelineConfigs)) @@ -881,7 +883,7 @@ func TestConnectorPipelinesGraph(t *testing.T) { } } - // Check that connectors are correctly inheriting mutability from downstream pipelines + // Check that Connectors are correctly inheriting mutability from downstream Pipelines for expPipelineID, expPipeline := range pg.pipelines { for _, exp := range expPipeline.exporters { expConn, ok := exp.(*connectorNode) @@ -891,7 +893,7 @@ func TestConnectorPipelinesGraph(t *testing.T) { if expConn.getConsumer().Capabilities().MutatesData { continue } - // find all the pipelines of the same type where this connector is a receiver + // find all the Pipelines of the same type where this connector is a receiver var inheritMutatesData bool for recPipelineID, recPipeline := range pg.pipelines { if recPipelineID == expPipelineID || recPipelineID.Type() != expPipelineID.Type() { @@ -909,9 +911,9 @@ func TestConnectorPipelinesGraph(t *testing.T) { } } - // Push data into the pipelines. The list of receivers is retrieved directly from the overall - // component graph because we do not want to duplicate signal inputs to receivers that are - // shared between pipelines. The `allReceivers` function also excludes connectors, which we do + // Push data into the Pipelines. The list of Receivers is retrieved directly from the overall + // component graph because we do not want to duplicate signal inputs to Receivers that are + // shared between Pipelines. The `allReceivers` function also excludes Connectors, which we do // not want to directly inject with signals. allReceivers := pg.getReceivers() for _, c := range allReceivers[component.DataTypeTraces] { @@ -979,8 +981,8 @@ func TestConnectorPipelinesGraph(t *testing.T) { } } - // Get the list of exporters directly from the overall component graph. Like receivers, - // exclude connectors and validate each exporter once regardless of sharing between pipelines. + // Get the list of Exporters directly from the overall component graph. Like Receivers, + // exclude Connectors and validate each exporter once regardless of sharing between Pipelines. allExporters := pg.GetExporters() for _, e := range allExporters[component.DataTypeTraces] { tracesExporter := e.(*testcomponents.ExampleExporter) @@ -1052,7 +1054,7 @@ func TestConnectorRouter(t *testing.T) { set := Settings{ Telemetry: componenttest.NewNopTelemetrySettings(), BuildInfo: component.NewDefaultBuildInfo(), - ReceiverBuilder: receiver.NewBuilder( + ReceiverBuilder: builders.NewReceiver( map[component.ID]component.Config{ rcvrID: testcomponents.ExampleReceiverFactory.CreateDefaultConfig(), }, @@ -1060,7 +1062,7 @@ func TestConnectorRouter(t *testing.T) { testcomponents.ExampleReceiverFactory.Type(): testcomponents.ExampleReceiverFactory, }, ), - ExporterBuilder: exporter.NewBuilder( + ExporterBuilder: builders.NewExporter( map[component.ID]component.Config{ expRightID: testcomponents.ExampleExporterFactory.CreateDefaultConfig(), expLeftID: testcomponents.ExampleExporterFactory.CreateDefaultConfig(), @@ -1069,7 +1071,7 @@ func TestConnectorRouter(t *testing.T) { testcomponents.ExampleExporterFactory.Type(): testcomponents.ExampleExporterFactory, }, ), - ConnectorBuilder: connector.NewBuilder( + ConnectorBuilder: builders.NewConnector( map[component.ID]component.Config{ routeTracesID: testcomponents.ExampleRouterConfig{ Traces: &testcomponents.LeftRightConfig{ @@ -1142,7 +1144,7 @@ func TestConnectorRouter(t *testing.T) { assert.Equal(t, len(set.PipelineConfigs), len(pg.pipelines)) - // Get a handle for the traces receiver and both exporters + // Get a handle for the traces receiver and both Exporters tracesReceiver := allReceivers[component.DataTypeTraces][rcvrID].(*testcomponents.ExampleReceiver) tracesRight := allExporters[component.DataTypeTraces][expRightID].(*testcomponents.ExampleExporter) tracesLeft := allExporters[component.DataTypeTraces][expLeftID].(*testcomponents.ExampleExporter) @@ -1164,7 +1166,7 @@ func TestConnectorRouter(t *testing.T) { assert.Equal(t, 3, len(tracesRight.Traces)) assert.Equal(t, 2, len(tracesLeft.Traces)) - // Get a handle for the metrics receiver and both exporters + // Get a handle for the metrics receiver and both Exporters metricsReceiver := allReceivers[component.DataTypeMetrics][rcvrID].(*testcomponents.ExampleReceiver) metricsRight := allExporters[component.DataTypeMetrics][expRightID].(*testcomponents.ExampleExporter) metricsLeft := allExporters[component.DataTypeMetrics][expLeftID].(*testcomponents.ExampleExporter) @@ -1186,7 +1188,7 @@ func TestConnectorRouter(t *testing.T) { assert.Equal(t, 3, len(metricsRight.Metrics)) assert.Equal(t, 2, len(metricsLeft.Metrics)) - // Get a handle for the logs receiver and both exporters + // Get a handle for the logs receiver and both Exporters logsReceiver := allReceivers[component.DataTypeLogs][rcvrID].(*testcomponents.ExampleReceiver) logsRight := allExporters[component.DataTypeLogs][expRightID].(*testcomponents.ExampleExporter) logsLeft := allExporters[component.DataTypeLogs][expLeftID].(*testcomponents.ExampleExporter) @@ -2095,25 +2097,25 @@ func TestGraphBuildErrors(t *testing.T) { set := Settings{ BuildInfo: component.NewDefaultBuildInfo(), Telemetry: componenttest.NewNopTelemetrySettings(), - ReceiverBuilder: receiver.NewBuilder( + ReceiverBuilder: builders.NewReceiver( test.receiverCfgs, map[component.Type]receiver.Factory{ nopReceiverFactory.Type(): nopReceiverFactory, badReceiverFactory.Type(): badReceiverFactory, }), - ProcessorBuilder: processor.NewBuilder( + ProcessorBuilder: builders.NewProcessor( test.processorCfgs, map[component.Type]processor.Factory{ nopProcessorFactory.Type(): nopProcessorFactory, badProcessorFactory.Type(): badProcessorFactory, }), - ExporterBuilder: exporter.NewBuilder( + ExporterBuilder: builders.NewExporter( test.exporterCfgs, map[component.Type]exporter.Factory{ nopExporterFactory.Type(): nopExporterFactory, badExporterFactory.Type(): badExporterFactory, }), - ConnectorBuilder: connector.NewBuilder( + ConnectorBuilder: builders.NewConnector( test.connectorCfgs, map[component.Type]connector.Factory{ nopConnectorFactory.Type(): nopConnectorFactory, @@ -2143,7 +2145,7 @@ func TestGraphFailToStartAndShutdown(t *testing.T) { set := Settings{ Telemetry: componenttest.NewNopTelemetrySettings(), BuildInfo: component.NewDefaultBuildInfo(), - ReceiverBuilder: receiver.NewBuilder( + ReceiverBuilder: builders.NewReceiver( map[component.ID]component.Config{ component.NewID(nopReceiverFactory.Type()): nopReceiverFactory.CreateDefaultConfig(), component.NewID(errReceiverFactory.Type()): errReceiverFactory.CreateDefaultConfig(), @@ -2152,7 +2154,7 @@ func TestGraphFailToStartAndShutdown(t *testing.T) { nopReceiverFactory.Type(): nopReceiverFactory, errReceiverFactory.Type(): errReceiverFactory, }), - ProcessorBuilder: processor.NewBuilder( + ProcessorBuilder: builders.NewProcessor( map[component.ID]component.Config{ component.NewID(nopProcessorFactory.Type()): nopProcessorFactory.CreateDefaultConfig(), component.NewID(errProcessorFactory.Type()): errProcessorFactory.CreateDefaultConfig(), @@ -2161,7 +2163,7 @@ func TestGraphFailToStartAndShutdown(t *testing.T) { nopProcessorFactory.Type(): nopProcessorFactory, errProcessorFactory.Type(): errProcessorFactory, }), - ExporterBuilder: exporter.NewBuilder( + ExporterBuilder: builders.NewExporter( map[component.ID]component.Config{ component.NewID(nopExporterFactory.Type()): nopExporterFactory.CreateDefaultConfig(), component.NewID(errExporterFactory.Type()): errExporterFactory.CreateDefaultConfig(), @@ -2170,7 +2172,7 @@ func TestGraphFailToStartAndShutdown(t *testing.T) { nopExporterFactory.Type(): nopExporterFactory, errExporterFactory.Type(): errExporterFactory, }), - ConnectorBuilder: connector.NewBuilder( + ConnectorBuilder: builders.NewConnector( map[component.ID]component.Config{ component.NewIDWithName(nopConnectorFactory.Type(), "conn"): nopConnectorFactory.CreateDefaultConfig(), component.NewIDWithName(errConnectorFactory.Type(), "conn"): errConnectorFactory.CreateDefaultConfig(), @@ -2193,7 +2195,7 @@ func TestGraphFailToStartAndShutdown(t *testing.T) { } pipelines, err := Build(context.Background(), set) assert.NoError(t, err) - assert.Error(t, pipelines.StartAll(context.Background(), componenttest.NewNopHost(), statustest.NewNopStatusReporter())) + assert.Error(t, pipelines.StartAll(context.Background(), &Host{Reporter: status.NewReporter(func(*componentstatus.InstanceID, *componentstatus.Event) {}, func(error) {})})) assert.Error(t, pipelines.ShutdownAll(context.Background(), statustest.NewNopStatusReporter())) }) @@ -2207,7 +2209,7 @@ func TestGraphFailToStartAndShutdown(t *testing.T) { } pipelines, err := Build(context.Background(), set) assert.NoError(t, err) - assert.Error(t, pipelines.StartAll(context.Background(), componenttest.NewNopHost(), statustest.NewNopStatusReporter())) + assert.Error(t, pipelines.StartAll(context.Background(), &Host{Reporter: status.NewReporter(func(*componentstatus.InstanceID, *componentstatus.Event) {}, func(error) {})})) assert.Error(t, pipelines.ShutdownAll(context.Background(), statustest.NewNopStatusReporter())) }) @@ -2221,7 +2223,7 @@ func TestGraphFailToStartAndShutdown(t *testing.T) { } pipelines, err := Build(context.Background(), set) assert.NoError(t, err) - assert.Error(t, pipelines.StartAll(context.Background(), componenttest.NewNopHost(), statustest.NewNopStatusReporter())) + assert.Error(t, pipelines.StartAll(context.Background(), &Host{Reporter: status.NewReporter(func(*componentstatus.InstanceID, *componentstatus.Event) {}, func(error) {})})) assert.Error(t, pipelines.ShutdownAll(context.Background(), statustest.NewNopStatusReporter())) }) @@ -2241,7 +2243,7 @@ func TestGraphFailToStartAndShutdown(t *testing.T) { } pipelines, err := Build(context.Background(), set) assert.NoError(t, err) - assert.Error(t, pipelines.StartAll(context.Background(), componenttest.NewNopHost(), statustest.NewNopStatusReporter())) + assert.Error(t, pipelines.StartAll(context.Background(), &Host{Reporter: status.NewReporter(func(*componentstatus.InstanceID, *componentstatus.Event) {}, func(error) {})})) assert.Error(t, pipelines.ShutdownAll(context.Background(), statustest.NewNopStatusReporter())) }) } @@ -2258,17 +2260,17 @@ func TestStatusReportedOnStartupShutdown(t *testing.T) { eStErr := &testNode{id: component.MustNewIDWithName("e_st_err", "1"), startErr: assert.AnError} eSdErr := &testNode{id: component.MustNewIDWithName("e_sd_err", "1"), shutdownErr: assert.AnError} - instanceIDs := map[*testNode]*component.InstanceID{ - rNoErr: {ID: rNoErr.id}, - rStErr: {ID: rStErr.id}, - rSdErr: {ID: rSdErr.id}, - eNoErr: {ID: eNoErr.id}, - eStErr: {ID: eStErr.id}, - eSdErr: {ID: eSdErr.id}, + instanceIDs := map[*testNode]*componentstatus.InstanceID{ + rNoErr: componentstatus.NewInstanceID(rNoErr.id, component.KindReceiver), + rStErr: componentstatus.NewInstanceID(rStErr.id, component.KindReceiver), + rSdErr: componentstatus.NewInstanceID(rSdErr.id, component.KindReceiver), + eNoErr: componentstatus.NewInstanceID(eNoErr.id, component.KindExporter), + eStErr: componentstatus.NewInstanceID(eStErr.id, component.KindExporter), + eSdErr: componentstatus.NewInstanceID(eSdErr.id, component.KindExporter), } // compare two maps of status events ignoring timestamp - assertEqualStatuses := func(t *testing.T, evMap1, evMap2 map[*component.InstanceID][]*component.StatusEvent) { + assertEqualStatuses := func(t *testing.T, evMap1, evMap2 map[*componentstatus.InstanceID][]*componentstatus.Event) { assert.Equal(t, len(evMap1), len(evMap2)) for id, evts1 := range evMap1 { evts2 := evMap2[id] @@ -2286,35 +2288,35 @@ func TestStatusReportedOnStartupShutdown(t *testing.T) { for _, tc := range []struct { name string edge [2]*testNode - expectedStatuses map[*component.InstanceID][]*component.StatusEvent + expectedStatuses map[*componentstatus.InstanceID][]*componentstatus.Event startupErr error shutdownErr error }{ { name: "successful startup/shutdown", edge: [2]*testNode{rNoErr, eNoErr}, - expectedStatuses: map[*component.InstanceID][]*component.StatusEvent{ + expectedStatuses: map[*componentstatus.InstanceID][]*componentstatus.Event{ instanceIDs[rNoErr]: { - component.NewStatusEvent(component.StatusStarting), - component.NewStatusEvent(component.StatusOK), - component.NewStatusEvent(component.StatusStopping), - component.NewStatusEvent(component.StatusStopped), + componentstatus.NewEvent(componentstatus.StatusStarting), + componentstatus.NewEvent(componentstatus.StatusOK), + componentstatus.NewEvent(componentstatus.StatusStopping), + componentstatus.NewEvent(componentstatus.StatusStopped), }, instanceIDs[eNoErr]: { - component.NewStatusEvent(component.StatusStarting), - component.NewStatusEvent(component.StatusOK), - component.NewStatusEvent(component.StatusStopping), - component.NewStatusEvent(component.StatusStopped), + componentstatus.NewEvent(componentstatus.StatusStarting), + componentstatus.NewEvent(componentstatus.StatusOK), + componentstatus.NewEvent(componentstatus.StatusStopping), + componentstatus.NewEvent(componentstatus.StatusStopped), }, }, }, { name: "early startup error", edge: [2]*testNode{rNoErr, eStErr}, - expectedStatuses: map[*component.InstanceID][]*component.StatusEvent{ + expectedStatuses: map[*componentstatus.InstanceID][]*componentstatus.Event{ instanceIDs[eStErr]: { - component.NewStatusEvent(component.StatusStarting), - component.NewPermanentErrorEvent(assert.AnError), + componentstatus.NewEvent(componentstatus.StatusStarting), + componentstatus.NewPermanentErrorEvent(assert.AnError), }, }, startupErr: assert.AnError, @@ -2322,16 +2324,16 @@ func TestStatusReportedOnStartupShutdown(t *testing.T) { { name: "late startup error", edge: [2]*testNode{rStErr, eNoErr}, - expectedStatuses: map[*component.InstanceID][]*component.StatusEvent{ + expectedStatuses: map[*componentstatus.InstanceID][]*componentstatus.Event{ instanceIDs[rStErr]: { - component.NewStatusEvent(component.StatusStarting), - component.NewPermanentErrorEvent(assert.AnError), + componentstatus.NewEvent(componentstatus.StatusStarting), + componentstatus.NewPermanentErrorEvent(assert.AnError), }, instanceIDs[eNoErr]: { - component.NewStatusEvent(component.StatusStarting), - component.NewStatusEvent(component.StatusOK), - component.NewStatusEvent(component.StatusStopping), - component.NewStatusEvent(component.StatusStopped), + componentstatus.NewEvent(componentstatus.StatusStarting), + componentstatus.NewEvent(componentstatus.StatusOK), + componentstatus.NewEvent(componentstatus.StatusStopping), + componentstatus.NewEvent(componentstatus.StatusStopped), }, }, startupErr: assert.AnError, @@ -2339,18 +2341,18 @@ func TestStatusReportedOnStartupShutdown(t *testing.T) { { name: "early shutdown error", edge: [2]*testNode{rSdErr, eNoErr}, - expectedStatuses: map[*component.InstanceID][]*component.StatusEvent{ + expectedStatuses: map[*componentstatus.InstanceID][]*componentstatus.Event{ instanceIDs[rSdErr]: { - component.NewStatusEvent(component.StatusStarting), - component.NewStatusEvent(component.StatusOK), - component.NewStatusEvent(component.StatusStopping), - component.NewPermanentErrorEvent(assert.AnError), + componentstatus.NewEvent(componentstatus.StatusStarting), + componentstatus.NewEvent(componentstatus.StatusOK), + componentstatus.NewEvent(componentstatus.StatusStopping), + componentstatus.NewPermanentErrorEvent(assert.AnError), }, instanceIDs[eNoErr]: { - component.NewStatusEvent(component.StatusStarting), - component.NewStatusEvent(component.StatusOK), - component.NewStatusEvent(component.StatusStopping), - component.NewStatusEvent(component.StatusStopped), + componentstatus.NewEvent(componentstatus.StatusStarting), + componentstatus.NewEvent(componentstatus.StatusOK), + componentstatus.NewEvent(componentstatus.StatusStopping), + componentstatus.NewEvent(componentstatus.StatusStopped), }, }, shutdownErr: assert.AnError, @@ -2358,18 +2360,18 @@ func TestStatusReportedOnStartupShutdown(t *testing.T) { { name: "late shutdown error", edge: [2]*testNode{rNoErr, eSdErr}, - expectedStatuses: map[*component.InstanceID][]*component.StatusEvent{ + expectedStatuses: map[*componentstatus.InstanceID][]*componentstatus.Event{ instanceIDs[rNoErr]: { - component.NewStatusEvent(component.StatusStarting), - component.NewStatusEvent(component.StatusOK), - component.NewStatusEvent(component.StatusStopping), - component.NewStatusEvent(component.StatusStopped), + componentstatus.NewEvent(componentstatus.StatusStarting), + componentstatus.NewEvent(componentstatus.StatusOK), + componentstatus.NewEvent(componentstatus.StatusStopping), + componentstatus.NewEvent(componentstatus.StatusStopped), }, instanceIDs[eSdErr]: { - component.NewStatusEvent(component.StatusStarting), - component.NewStatusEvent(component.StatusOK), - component.NewStatusEvent(component.StatusStopping), - component.NewPermanentErrorEvent(assert.AnError), + componentstatus.NewEvent(componentstatus.StatusStarting), + componentstatus.NewEvent(componentstatus.StatusOK), + componentstatus.NewEvent(componentstatus.StatusStopping), + componentstatus.NewPermanentErrorEvent(assert.AnError), }, }, shutdownErr: assert.AnError, @@ -2379,8 +2381,8 @@ func TestStatusReportedOnStartupShutdown(t *testing.T) { pg := &Graph{componentGraph: simple.NewDirectedGraph()} pg.telemetry = componenttest.NewNopTelemetrySettings() - actualStatuses := make(map[*component.InstanceID][]*component.StatusEvent) - rep := status.NewReporter(func(id *component.InstanceID, ev *component.StatusEvent) { + actualStatuses := make(map[*componentstatus.InstanceID][]*componentstatus.Event) + rep := status.NewReporter(func(id *componentstatus.InstanceID, ev *componentstatus.Event) { actualStatuses[id] = append(actualStatuses[id], ev) }, func(error) { }) @@ -2388,13 +2390,13 @@ func TestStatusReportedOnStartupShutdown(t *testing.T) { rep.Ready() e0, e1 := tc.edge[0], tc.edge[1] - pg.instanceIDs = map[int64]*component.InstanceID{ + pg.instanceIDs = map[int64]*componentstatus.InstanceID{ e0.ID(): instanceIDs[e0], e1.ID(): instanceIDs[e1], } pg.componentGraph.SetEdge(simple.Edge{F: e0, T: e1}) - assert.Equal(t, tc.startupErr, pg.StartAll(context.Background(), componenttest.NewNopHost(), rep)) + assert.Equal(t, tc.startupErr, pg.StartAll(context.Background(), &Host{Reporter: rep})) assert.Equal(t, tc.shutdownErr, pg.ShutdownAll(context.Background(), rep)) assertEqualStatuses(t, tc.expectedStatuses, actualStatuses) }) @@ -2424,7 +2426,7 @@ func (g *Graph) getReceivers() map[component.DataType]map[component.ID]component // // Expect one instance of each receiver and exporter, unless it is a connector. // -// For connectors: +// For Connectors: // - Let E equal the number of pipeline types in which the connector is used as an exporter. // - Let R equal the number of pipeline types in which the connector is used as a receiver. // diff --git a/service/internal/graph/host.go b/service/internal/graph/host.go new file mode 100644 index 00000000000..7cc85be6665 --- /dev/null +++ b/service/internal/graph/host.go @@ -0,0 +1,166 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package graph // import "go.opentelemetry.io/collector/service/internal/graph" + +import ( + "net/http" + "path" + "runtime" + "time" + + "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/component/componentstatus" + "go.opentelemetry.io/collector/extension" + "go.opentelemetry.io/collector/featuregate" + "go.opentelemetry.io/collector/service/extensions" + "go.opentelemetry.io/collector/service/internal/builders" + "go.opentelemetry.io/collector/service/internal/status" + "go.opentelemetry.io/collector/service/internal/zpages" +) + +// TODO: remove as part of https://github.com/open-telemetry/opentelemetry-collector/issues/7370 for service 1.0 +type getExporters interface { + GetExporters() map[component.DataType]map[component.ID]component.Component +} + +var _ getExporters = (*Host)(nil) +var _ component.Host = (*Host)(nil) + +type Host struct { + AsyncErrorChannel chan error + Receivers builders.Receiver + Processors builders.Processor + Exporters builders.Exporter + Connectors builders.Connector + Extensions builders.Extension + + ModuleInfo extension.ModuleInfo + BuildInfo component.BuildInfo + + Pipelines *Graph + ServiceExtensions *extensions.Extensions + + Reporter status.Reporter +} + +func (host *Host) GetFactory(kind component.Kind, componentType component.Type) component.Factory { + switch kind { + case component.KindReceiver: + return host.Receivers.Factory(componentType) + case component.KindProcessor: + return host.Processors.Factory(componentType) + case component.KindExporter: + return host.Exporters.Factory(componentType) + case component.KindConnector: + return host.Connectors.Factory(componentType) + case component.KindExtension: + return host.Extensions.Factory(componentType) + } + return nil +} + +func (host *Host) GetExtensions() map[component.ID]component.Component { + return host.ServiceExtensions.GetExtensions() +} + +// Deprecated: [0.79.0] This function will be removed in the future. +// Several components in the contrib repository use this function so it cannot be removed +// before those cases are removed. In most cases, use of this function can be replaced by a +// connector. See https://github.com/open-telemetry/opentelemetry-collector/issues/7370 and +// https://github.com/open-telemetry/opentelemetry-collector/pull/7390#issuecomment-1483710184 +// for additional information. +func (host *Host) GetExporters() map[component.DataType]map[component.ID]component.Component { + return host.Pipelines.GetExporters() +} + +func (host *Host) NotifyComponentStatusChange(source *componentstatus.InstanceID, event *componentstatus.Event) { + host.ServiceExtensions.NotifyComponentStatusChange(source, event) + if event.Status() == componentstatus.StatusFatalError { + host.AsyncErrorChannel <- event.Err() + } +} + +const ( + // Paths + zServicePath = "servicez" + zPipelinePath = "pipelinez" + zExtensionPath = "extensionz" + zFeaturePath = "featurez" +) + +var ( + // InfoVar is a singleton instance of the Info struct. + runtimeInfoVar [][2]string +) + +func init() { + runtimeInfoVar = [][2]string{ + {"StartTimestamp", time.Now().String()}, + {"Go", runtime.Version()}, + {"OS", runtime.GOOS}, + {"Arch", runtime.GOARCH}, + // Add other valuable runtime information here. + } +} + +func (host *Host) RegisterZPages(mux *http.ServeMux, pathPrefix string) { + mux.HandleFunc(path.Join(pathPrefix, zServicePath), host.zPagesRequest) + mux.HandleFunc(path.Join(pathPrefix, zPipelinePath), host.Pipelines.HandleZPages) + mux.HandleFunc(path.Join(pathPrefix, zExtensionPath), host.ServiceExtensions.HandleZPages) + mux.HandleFunc(path.Join(pathPrefix, zFeaturePath), handleFeaturezRequest) +} + +func (host *Host) zPagesRequest(w http.ResponseWriter, _ *http.Request) { + w.Header().Set("Content-Type", "text/html; charset=utf-8") + zpages.WriteHTMLPageHeader(w, zpages.HeaderData{Title: "Service " + host.BuildInfo.Command}) + zpages.WriteHTMLPropertiesTable(w, zpages.PropertiesTableData{Name: "Build Info", Properties: getBuildInfoProperties(host.BuildInfo)}) + zpages.WriteHTMLPropertiesTable(w, zpages.PropertiesTableData{Name: "Runtime Info", Properties: runtimeInfoVar}) + zpages.WriteHTMLComponentHeader(w, zpages.ComponentHeaderData{ + Name: "Pipelines", + ComponentEndpoint: zPipelinePath, + Link: true, + }) + zpages.WriteHTMLComponentHeader(w, zpages.ComponentHeaderData{ + Name: "Extensions", + ComponentEndpoint: zExtensionPath, + Link: true, + }) + zpages.WriteHTMLComponentHeader(w, zpages.ComponentHeaderData{ + Name: "Features", + ComponentEndpoint: zFeaturePath, + Link: true, + }) + zpages.WriteHTMLPageFooter(w) +} + +func handleFeaturezRequest(w http.ResponseWriter, _ *http.Request) { + w.Header().Set("Content-Type", "text/html; charset=utf-8") + zpages.WriteHTMLPageHeader(w, zpages.HeaderData{Title: "Feature Gates"}) + zpages.WriteHTMLFeaturesTable(w, getFeaturesTableData()) + zpages.WriteHTMLPageFooter(w) +} + +func getFeaturesTableData() zpages.FeatureGateTableData { + data := zpages.FeatureGateTableData{} + featuregate.GlobalRegistry().VisitAll(func(gate *featuregate.Gate) { + data.Rows = append(data.Rows, zpages.FeatureGateTableRowData{ + ID: gate.ID(), + Enabled: gate.IsEnabled(), + Description: gate.Description(), + Stage: gate.Stage().String(), + FromVersion: gate.FromVersion(), + ToVersion: gate.ToVersion(), + ReferenceURL: gate.ReferenceURL(), + }) + }) + return data +} + +func getBuildInfoProperties(buildInfo component.BuildInfo) [][2]string { + return [][2]string{ + {"Command", buildInfo.Command}, + {"Description", buildInfo.Description}, + {"Version", buildInfo.Version}, + } +} diff --git a/service/internal/graph/nodes.go b/service/internal/graph/nodes.go index 0fb19574e78..0a4e9ce4064 100644 --- a/service/internal/graph/nodes.go +++ b/service/internal/graph/nodes.go @@ -16,6 +16,7 @@ import ( "go.opentelemetry.io/collector/internal/fanoutconsumer" "go.opentelemetry.io/collector/processor" "go.opentelemetry.io/collector/receiver" + "go.opentelemetry.io/collector/service/internal/builders" "go.opentelemetry.io/collector/service/internal/capabilityconsumer" "go.opentelemetry.io/collector/service/internal/components" ) @@ -70,7 +71,7 @@ func newReceiverNode(pipelineType component.DataType, recvID component.ID) *rece func (n *receiverNode) buildComponent(ctx context.Context, tel component.TelemetrySettings, info component.BuildInfo, - builder *receiver.Builder, + builder builders.Receiver, nexts []baseConsumer, ) error { tel.Logger = components.ReceiverLogger(tel.Logger, n.componentID, n.pipelineType) @@ -130,7 +131,7 @@ func (n *processorNode) getConsumer() baseConsumer { func (n *processorNode) buildComponent(ctx context.Context, tel component.TelemetrySettings, info component.BuildInfo, - builder *processor.Builder, + builder builders.Processor, next baseConsumer, ) error { tel.Logger = components.ProcessorLogger(tel.Logger, n.componentID, n.pipelineID) @@ -179,7 +180,7 @@ func (n *exporterNode) buildComponent( ctx context.Context, tel component.TelemetrySettings, info component.BuildInfo, - builder *exporter.Builder, + builder builders.Exporter, ) error { tel.Logger = components.ExporterLogger(tel.Logger, n.componentID, n.pipelineType) set := exporter.Settings{ID: n.componentID, TelemetrySettings: tel, BuildInfo: info} @@ -230,7 +231,7 @@ func (n *connectorNode) buildComponent( ctx context.Context, tel component.TelemetrySettings, info component.BuildInfo, - builder *connector.Builder, + builder builders.Connector, nexts []baseConsumer, ) error { tel.Logger = components.ConnectorLogger(tel.Logger, n.componentID, n.exprPipelineType, n.rcvrPipelineType) diff --git a/service/internal/metadata/generated_telemetry.go b/service/internal/metadata/generated_telemetry.go index edefccd1a54..d398ccf34ec 100644 --- a/service/internal/metadata/generated_telemetry.go +++ b/service/internal/metadata/generated_telemetry.go @@ -14,10 +14,15 @@ import ( "go.opentelemetry.io/collector/config/configtelemetry" ) +// Deprecated: [v0.108.0] use LeveledMeter instead. func Meter(settings component.TelemetrySettings) metric.Meter { return settings.MeterProvider.Meter("go.opentelemetry.io/collector/service") } +func LeveledMeter(settings component.TelemetrySettings, level configtelemetry.Level) metric.Meter { + return settings.LeveledMeterProvider(level).Meter("go.opentelemetry.io/collector/service") +} + func Tracer(settings component.TelemetrySettings) trace.Tracer { return settings.TracerProvider.Tracer("go.opentelemetry.io/collector/service") } diff --git a/service/internal/metadata/generated_telemetry_test.go b/service/internal/metadata/generated_telemetry_test.go index 5e225295ba3..c8f5f6fb6e7 100644 --- a/service/internal/metadata/generated_telemetry_test.go +++ b/service/internal/metadata/generated_telemetry_test.go @@ -14,6 +14,7 @@ import ( nooptrace "go.opentelemetry.io/otel/trace/noop" "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/config/configtelemetry" ) type mockMeter struct { @@ -43,6 +44,9 @@ func (m mockTracerProvider) Tracer(name string, opts ...trace.TracerOption) trac func TestProviders(t *testing.T) { set := component.TelemetrySettings{ + LeveledMeterProvider: func(_ configtelemetry.Level) metric.MeterProvider { + return mockMeterProvider{} + }, MeterProvider: mockMeterProvider{}, TracerProvider: mockTracerProvider{}, } @@ -64,6 +68,9 @@ func TestProviders(t *testing.T) { func TestNewTelemetryBuilder(t *testing.T) { set := component.TelemetrySettings{ + LeveledMeterProvider: func(_ configtelemetry.Level) metric.MeterProvider { + return mockMeterProvider{} + }, MeterProvider: mockMeterProvider{}, TracerProvider: mockTracerProvider{}, } diff --git a/service/internal/proctelemetry/config.go b/service/internal/proctelemetry/config.go index 1bb86bb65b2..f36f9eb15c9 100644 --- a/service/internal/proctelemetry/config.go +++ b/service/internal/proctelemetry/config.go @@ -13,6 +13,7 @@ import ( "net/url" "os" "strings" + "sync" "time" "github.com/prometheus/client_golang/prometheus" @@ -63,9 +64,9 @@ var ( errNoValidMetricExporter = errors.New("no valid metric exporter") ) -func InitMetricReader(ctx context.Context, reader config.MetricReader, asyncErrorChannel chan error) (sdkmetric.Reader, *http.Server, error) { +func InitMetricReader(ctx context.Context, reader config.MetricReader, asyncErrorChannel chan error, serverWG *sync.WaitGroup) (sdkmetric.Reader, *http.Server, error) { if reader.Pull != nil { - return initPullExporter(reader.Pull.Exporter, asyncErrorChannel) + return initPullExporter(reader.Pull.Exporter, asyncErrorChannel, serverWG) } if reader.Periodic != nil { var opts []sdkmetric.PeriodicReaderOption @@ -93,7 +94,7 @@ func InitOpenTelemetry(res *resource.Resource, options []sdkmetric.Option, disab ), nil } -func InitPrometheusServer(registry *prometheus.Registry, address string, asyncErrorChannel chan error) *http.Server { +func InitPrometheusServer(registry *prometheus.Registry, address string, asyncErrorChannel chan error, serverWG *sync.WaitGroup) *http.Server { mux := http.NewServeMux() mux.Handle("/metrics", promhttp.HandlerFor(registry, promhttp.HandlerOpts{})) server := &http.Server{ @@ -101,9 +102,15 @@ func InitPrometheusServer(registry *prometheus.Registry, address string, asyncEr Handler: mux, ReadHeaderTimeout: defaultReadHeaderTimeout, } + + serverWG.Add(1) go func() { + defer serverWG.Done() if serveErr := server.ListenAndServe(); serveErr != nil && !errors.Is(serveErr, http.ErrServerClosed) { - asyncErrorChannel <- serveErr + select { + case asyncErrorChannel <- serveErr: + case <-time.After(1 * time.Second): + } } }() return server @@ -152,7 +159,7 @@ func cardinalityFilter(kvs ...attribute.KeyValue) attribute.Filter { } } -func initPrometheusExporter(prometheusConfig *config.Prometheus, asyncErrorChannel chan error) (sdkmetric.Reader, *http.Server, error) { +func initPrometheusExporter(prometheusConfig *config.Prometheus, asyncErrorChannel chan error, serverWG *sync.WaitGroup) (sdkmetric.Reader, *http.Server, error) { promRegistry := prometheus.NewRegistry() if prometheusConfig.Host == nil { return nil, nil, fmt.Errorf("host must be specified") @@ -176,12 +183,12 @@ func initPrometheusExporter(prometheusConfig *config.Prometheus, asyncErrorChann return nil, nil, fmt.Errorf("error creating otel prometheus exporter: %w", err) } - return exporter, InitPrometheusServer(promRegistry, net.JoinHostPort(*prometheusConfig.Host, fmt.Sprintf("%d", *prometheusConfig.Port)), asyncErrorChannel), nil + return exporter, InitPrometheusServer(promRegistry, net.JoinHostPort(*prometheusConfig.Host, fmt.Sprintf("%d", *prometheusConfig.Port)), asyncErrorChannel, serverWG), nil } -func initPullExporter(exporter config.MetricExporter, asyncErrorChannel chan error) (sdkmetric.Reader, *http.Server, error) { +func initPullExporter(exporter config.MetricExporter, asyncErrorChannel chan error, serverWG *sync.WaitGroup) (sdkmetric.Reader, *http.Server, error) { if exporter.Prometheus != nil { - return initPrometheusExporter(exporter.Prometheus, asyncErrorChannel) + return initPrometheusExporter(exporter.Prometheus, asyncErrorChannel, serverWG) } return nil, nil, errNoValidMetricExporter } diff --git a/service/internal/proctelemetry/config_test.go b/service/internal/proctelemetry/config_test.go index d0560ac9c8c..efb081be0d4 100644 --- a/service/internal/proctelemetry/config_test.go +++ b/service/internal/proctelemetry/config_test.go @@ -8,6 +8,7 @@ import ( "errors" "net/url" "reflect" + "sync" "testing" "github.com/stretchr/testify/assert" @@ -529,7 +530,7 @@ func TestMetricReader(t *testing.T) { } for _, tt := range testCases { t.Run(tt.name, func(t *testing.T) { - gotReader, server, err := InitMetricReader(context.Background(), tt.reader, make(chan error)) + gotReader, server, err := InitMetricReader(context.Background(), tt.reader, make(chan error), &sync.WaitGroup{}) defer func() { if gotReader != nil { diff --git a/service/internal/proctelemetry/process_telemetry_test.go b/service/internal/proctelemetry/process_telemetry_test.go index 5a1e2db24b4..1367192db0f 100644 --- a/service/internal/proctelemetry/process_telemetry_test.go +++ b/service/internal/proctelemetry/process_telemetry_test.go @@ -17,6 +17,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" otelprom "go.opentelemetry.io/otel/exporters/prometheus" + "go.opentelemetry.io/otel/metric" sdkmetric "go.opentelemetry.io/otel/sdk/metric" "go.opentelemetry.io/otel/sdk/resource" @@ -56,6 +57,10 @@ func setupTelemetry(t *testing.T) testTelemetry { ) settings.TelemetrySettings.MeterProvider = settings.meterProvider + settings.TelemetrySettings.LeveledMeterProvider = func(_ configtelemetry.Level) metric.MeterProvider { + return settings.meterProvider + } + settings.promHandler = promhttp.HandlerFor(promReg, promhttp.HandlerOpts{}) t.Cleanup(func() { assert.NoError(t, settings.meterProvider.Shutdown(context.Background())) }) diff --git a/service/internal/status/status.go b/service/internal/status/status.go index 9fac2a8d6bf..0fde07e774c 100644 --- a/service/internal/status/status.go +++ b/service/internal/status/status.go @@ -8,26 +8,26 @@ import ( "fmt" "sync" - "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/component/componentstatus" ) -// onTransitionFunc receives a component.StatusEvent on a successful state transition -type onTransitionFunc func(*component.StatusEvent) +// onTransitionFunc receives a componentstatus.Event on a successful state transition +type onTransitionFunc func(*componentstatus.Event) // errInvalidStateTransition is returned for invalid state transitions var errInvalidStateTransition = errors.New("invalid state transition") // fsm is a finite state machine that models transitions for component status type fsm struct { - current *component.StatusEvent - transitions map[component.Status]map[component.Status]struct{} + current *componentstatus.Event + transitions map[componentstatus.Status]map[componentstatus.Status]struct{} onTransition onTransitionFunc } // transition will attempt to execute a state transition. If it's successful, it calls the -// onTransitionFunc with a StatusEvent representing the new state. Returns an error if the arguments +// onTransitionFunc with a Event representing the new state. Returns an error if the arguments // result in an invalid status, or if the state transition is not valid. -func (m *fsm) transition(ev *component.StatusEvent) error { +func (m *fsm) transition(ev *componentstatus.Event) error { if _, ok := m.transitions[m.current.Status()][ev.Status()]; !ok { return fmt.Errorf( "cannot transition from %s to %s: %w", @@ -41,56 +41,56 @@ func (m *fsm) transition(ev *component.StatusEvent) error { return nil } -// newFSM creates a state machine with all valid transitions for component.Status. -// The initial state is set to component.StatusNone. +// newFSM creates a state machine with all valid transitions for componentstatus.Status. +// The initial state is set to componentstatus.StatusNone. func newFSM(onTransition onTransitionFunc) *fsm { return &fsm{ - current: component.NewStatusEvent(component.StatusNone), + current: componentstatus.NewEvent(componentstatus.StatusNone), onTransition: onTransition, - transitions: map[component.Status]map[component.Status]struct{}{ - component.StatusNone: { - component.StatusStarting: {}, + transitions: map[componentstatus.Status]map[componentstatus.Status]struct{}{ + componentstatus.StatusNone: { + componentstatus.StatusStarting: {}, }, - component.StatusStarting: { - component.StatusOK: {}, - component.StatusRecoverableError: {}, - component.StatusPermanentError: {}, - component.StatusFatalError: {}, - component.StatusStopping: {}, + componentstatus.StatusStarting: { + componentstatus.StatusOK: {}, + componentstatus.StatusRecoverableError: {}, + componentstatus.StatusPermanentError: {}, + componentstatus.StatusFatalError: {}, + componentstatus.StatusStopping: {}, }, - component.StatusOK: { - component.StatusRecoverableError: {}, - component.StatusPermanentError: {}, - component.StatusFatalError: {}, - component.StatusStopping: {}, + componentstatus.StatusOK: { + componentstatus.StatusRecoverableError: {}, + componentstatus.StatusPermanentError: {}, + componentstatus.StatusFatalError: {}, + componentstatus.StatusStopping: {}, }, - component.StatusRecoverableError: { - component.StatusOK: {}, - component.StatusPermanentError: {}, - component.StatusFatalError: {}, - component.StatusStopping: {}, + componentstatus.StatusRecoverableError: { + componentstatus.StatusOK: {}, + componentstatus.StatusPermanentError: {}, + componentstatus.StatusFatalError: {}, + componentstatus.StatusStopping: {}, }, - component.StatusPermanentError: {}, - component.StatusFatalError: {}, - component.StatusStopping: { - component.StatusRecoverableError: {}, - component.StatusPermanentError: {}, - component.StatusFatalError: {}, - component.StatusStopped: {}, + componentstatus.StatusPermanentError: {}, + componentstatus.StatusFatalError: {}, + componentstatus.StatusStopping: { + componentstatus.StatusRecoverableError: {}, + componentstatus.StatusPermanentError: {}, + componentstatus.StatusFatalError: {}, + componentstatus.StatusStopped: {}, }, - component.StatusStopped: {}, + componentstatus.StatusStopped: {}, }, } } // NotifyStatusFunc is the receiver of status events after successful state transitions -type NotifyStatusFunc func(*component.InstanceID, *component.StatusEvent) +type NotifyStatusFunc func(*componentstatus.InstanceID, *componentstatus.Event) // InvalidTransitionFunc is the receiver of invalid transition errors type InvalidTransitionFunc func(error) // ServiceStatusFunc is the expected type of ReportStatus -type ServiceStatusFunc func(*component.InstanceID, *component.StatusEvent) +type ServiceStatusFunc func(*componentstatus.InstanceID, *componentstatus.Event) // ErrStatusNotReady is returned when trying to report status before service start var ErrStatusNotReady = errors.New("report component status is not ready until service start") @@ -98,14 +98,14 @@ var ErrStatusNotReady = errors.New("report component status is not ready until s // Reporter handles component status reporting type Reporter interface { Ready() - ReportStatus(id *component.InstanceID, ev *component.StatusEvent) - ReportOKIfStarting(id *component.InstanceID) + ReportStatus(id *componentstatus.InstanceID, ev *componentstatus.Event) + ReportOKIfStarting(id *componentstatus.InstanceID) } type reporter struct { mu sync.Mutex ready bool - fsmMap map[*component.InstanceID]*fsm + fsmMap map[*componentstatus.InstanceID]*fsm onStatusChange NotifyStatusFunc onInvalidTransition InvalidTransitionFunc } @@ -114,7 +114,7 @@ type reporter struct { // has changed. func NewReporter(onStatusChange NotifyStatusFunc, onInvalidTransition InvalidTransitionFunc) Reporter { return &reporter{ - fsmMap: make(map[*component.InstanceID]*fsm), + fsmMap: make(map[*componentstatus.InstanceID]*fsm), onStatusChange: onStatusChange, onInvalidTransition: onInvalidTransition, } @@ -129,8 +129,8 @@ func (r *reporter) Ready() { // ReportStatus reports status for the given InstanceID func (r *reporter) ReportStatus( - id *component.InstanceID, - ev *component.StatusEvent, + id *componentstatus.InstanceID, + ev *componentstatus.Event, ) { r.mu.Lock() defer r.mu.Unlock() @@ -143,36 +143,36 @@ func (r *reporter) ReportStatus( } } -func (r *reporter) ReportOKIfStarting(id *component.InstanceID) { +func (r *reporter) ReportOKIfStarting(id *componentstatus.InstanceID) { r.mu.Lock() defer r.mu.Unlock() if !r.ready { r.onInvalidTransition(ErrStatusNotReady) } fsm := r.componentFSM(id) - if fsm.current.Status() == component.StatusStarting { - if err := fsm.transition(component.NewStatusEvent(component.StatusOK)); err != nil { + if fsm.current.Status() == componentstatus.StatusStarting { + if err := fsm.transition(componentstatus.NewEvent(componentstatus.StatusOK)); err != nil { r.onInvalidTransition(err) } } } // Note: a lock must be acquired before calling this method. -func (r *reporter) componentFSM(id *component.InstanceID) *fsm { +func (r *reporter) componentFSM(id *componentstatus.InstanceID) *fsm { fsm, ok := r.fsmMap[id] if !ok { - fsm = newFSM(func(ev *component.StatusEvent) { r.onStatusChange(id, ev) }) + fsm = newFSM(func(ev *componentstatus.Event) { r.onStatusChange(id, ev) }) r.fsmMap[id] = fsm } return fsm } -// NewReportStatusFunc returns a function to be used as ReportStatus for component.TelemetrySettings +// NewReportStatusFunc returns a function to be used as ReportStatus for componentstatus.TelemetrySettings func NewReportStatusFunc( - id *component.InstanceID, + id *componentstatus.InstanceID, srvStatus ServiceStatusFunc, -) func(*component.StatusEvent) { - return func(ev *component.StatusEvent) { +) func(*componentstatus.Event) { + return func(ev *componentstatus.Event) { srvStatus(id, ev) } } diff --git a/service/internal/status/status_test.go b/service/internal/status/status_test.go index c31c649e496..ff61e138242 100644 --- a/service/internal/status/status_test.go +++ b/service/internal/status/status_test.go @@ -10,129 +10,129 @@ import ( "github.com/stretchr/testify/require" - "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/component/componentstatus" ) func TestStatusFSM(t *testing.T) { for _, tc := range []struct { name string - reportedStatuses []component.Status - expectedStatuses []component.Status + reportedStatuses []componentstatus.Status + expectedStatuses []componentstatus.Status expectedErrorCount int }{ { name: "successful startup and shutdown", - reportedStatuses: []component.Status{ - component.StatusStarting, - component.StatusOK, - component.StatusStopping, - component.StatusStopped, + reportedStatuses: []componentstatus.Status{ + componentstatus.StatusStarting, + componentstatus.StatusOK, + componentstatus.StatusStopping, + componentstatus.StatusStopped, }, - expectedStatuses: []component.Status{ - component.StatusStarting, - component.StatusOK, - component.StatusStopping, - component.StatusStopped, + expectedStatuses: []componentstatus.Status{ + componentstatus.StatusStarting, + componentstatus.StatusOK, + componentstatus.StatusStopping, + componentstatus.StatusStopped, }, }, { name: "component recovered", - reportedStatuses: []component.Status{ - component.StatusStarting, - component.StatusRecoverableError, - component.StatusOK, - component.StatusStopping, - component.StatusStopped, + reportedStatuses: []componentstatus.Status{ + componentstatus.StatusStarting, + componentstatus.StatusRecoverableError, + componentstatus.StatusOK, + componentstatus.StatusStopping, + componentstatus.StatusStopped, }, - expectedStatuses: []component.Status{ - component.StatusStarting, - component.StatusRecoverableError, - component.StatusOK, - component.StatusStopping, - component.StatusStopped, + expectedStatuses: []componentstatus.Status{ + componentstatus.StatusStarting, + componentstatus.StatusRecoverableError, + componentstatus.StatusOK, + componentstatus.StatusStopping, + componentstatus.StatusStopped, }, }, { name: "repeated events are errors", - reportedStatuses: []component.Status{ - component.StatusStarting, - component.StatusOK, - component.StatusRecoverableError, - component.StatusRecoverableError, - component.StatusRecoverableError, - component.StatusOK, - component.StatusStopping, - component.StatusStopped, + reportedStatuses: []componentstatus.Status{ + componentstatus.StatusStarting, + componentstatus.StatusOK, + componentstatus.StatusRecoverableError, + componentstatus.StatusRecoverableError, + componentstatus.StatusRecoverableError, + componentstatus.StatusOK, + componentstatus.StatusStopping, + componentstatus.StatusStopped, }, - expectedStatuses: []component.Status{ - component.StatusStarting, - component.StatusOK, - component.StatusRecoverableError, - component.StatusOK, - component.StatusStopping, - component.StatusStopped, + expectedStatuses: []componentstatus.Status{ + componentstatus.StatusStarting, + componentstatus.StatusOK, + componentstatus.StatusRecoverableError, + componentstatus.StatusOK, + componentstatus.StatusStopping, + componentstatus.StatusStopped, }, expectedErrorCount: 2, }, { name: "PermanentError is terminal", - reportedStatuses: []component.Status{ - component.StatusStarting, - component.StatusOK, - component.StatusPermanentError, - component.StatusOK, + reportedStatuses: []componentstatus.Status{ + componentstatus.StatusStarting, + componentstatus.StatusOK, + componentstatus.StatusPermanentError, + componentstatus.StatusOK, }, - expectedStatuses: []component.Status{ - component.StatusStarting, - component.StatusOK, - component.StatusPermanentError, + expectedStatuses: []componentstatus.Status{ + componentstatus.StatusStarting, + componentstatus.StatusOK, + componentstatus.StatusPermanentError, }, expectedErrorCount: 1, }, { name: "FatalError is terminal", - reportedStatuses: []component.Status{ - component.StatusStarting, - component.StatusOK, - component.StatusFatalError, - component.StatusOK, + reportedStatuses: []componentstatus.Status{ + componentstatus.StatusStarting, + componentstatus.StatusOK, + componentstatus.StatusFatalError, + componentstatus.StatusOK, }, - expectedStatuses: []component.Status{ - component.StatusStarting, - component.StatusOK, - component.StatusFatalError, + expectedStatuses: []componentstatus.Status{ + componentstatus.StatusStarting, + componentstatus.StatusOK, + componentstatus.StatusFatalError, }, expectedErrorCount: 1, }, { name: "Stopped is terminal", - reportedStatuses: []component.Status{ - component.StatusStarting, - component.StatusOK, - component.StatusStopping, - component.StatusStopped, - component.StatusOK, + reportedStatuses: []componentstatus.Status{ + componentstatus.StatusStarting, + componentstatus.StatusOK, + componentstatus.StatusStopping, + componentstatus.StatusStopped, + componentstatus.StatusOK, }, - expectedStatuses: []component.Status{ - component.StatusStarting, - component.StatusOK, - component.StatusStopping, - component.StatusStopped, + expectedStatuses: []componentstatus.Status{ + componentstatus.StatusStarting, + componentstatus.StatusOK, + componentstatus.StatusStopping, + componentstatus.StatusStopped, }, expectedErrorCount: 1, }, } { t.Run(tc.name, func(t *testing.T) { - var receivedStatuses []component.Status + var receivedStatuses []componentstatus.Status fsm := newFSM( - func(ev *component.StatusEvent) { + func(ev *componentstatus.Event) { receivedStatuses = append(receivedStatuses, ev.Status()) }, ) errorCount := 0 for _, status := range tc.reportedStatuses { - if err := fsm.transition(component.NewStatusEvent(status)); err != nil { + if err := fsm.transition(componentstatus.NewEvent(status)); err != nil { errorCount++ require.ErrorIs(t, err, errInvalidStateTransition) } @@ -145,33 +145,33 @@ func TestStatusFSM(t *testing.T) { } func TestValidSeqsToStopped(t *testing.T) { - events := []*component.StatusEvent{ - component.NewStatusEvent(component.StatusStarting), - component.NewStatusEvent(component.StatusOK), - component.NewStatusEvent(component.StatusRecoverableError), - component.NewStatusEvent(component.StatusPermanentError), - component.NewStatusEvent(component.StatusFatalError), + events := []*componentstatus.Event{ + componentstatus.NewEvent(componentstatus.StatusStarting), + componentstatus.NewEvent(componentstatus.StatusOK), + componentstatus.NewEvent(componentstatus.StatusRecoverableError), + componentstatus.NewEvent(componentstatus.StatusPermanentError), + componentstatus.NewEvent(componentstatus.StatusFatalError), } for _, ev := range events { - name := fmt.Sprintf("transition from: %s to: %s invalid", ev.Status(), component.StatusStopped) + name := fmt.Sprintf("transition from: %s to: %s invalid", ev.Status(), componentstatus.StatusStopped) t.Run(name, func(t *testing.T) { - fsm := newFSM(func(*component.StatusEvent) {}) - if ev.Status() != component.StatusStarting { - require.NoError(t, fsm.transition(component.NewStatusEvent(component.StatusStarting))) + fsm := newFSM(func(*componentstatus.Event) {}) + if ev.Status() != componentstatus.StatusStarting { + require.NoError(t, fsm.transition(componentstatus.NewEvent(componentstatus.StatusStarting))) } require.NoError(t, fsm.transition(ev)) // skipping to stopped is not allowed - err := fsm.transition(component.NewStatusEvent(component.StatusStopped)) + err := fsm.transition(componentstatus.NewEvent(componentstatus.StatusStopped)) require.ErrorIs(t, err, errInvalidStateTransition) // stopping -> stopped is allowed for non-fatal, non-permanent errors - err = fsm.transition(component.NewStatusEvent(component.StatusStopping)) - if ev.Status() == component.StatusPermanentError || ev.Status() == component.StatusFatalError { + err = fsm.transition(componentstatus.NewEvent(componentstatus.StatusStopping)) + if ev.Status() == componentstatus.StatusPermanentError || ev.Status() == componentstatus.StatusFatalError { require.ErrorIs(t, err, errInvalidStateTransition) } else { require.NoError(t, err) - require.NoError(t, fsm.transition(component.NewStatusEvent(component.StatusStopped))) + require.NoError(t, fsm.transition(componentstatus.NewEvent(componentstatus.StatusStopped))) } }) } @@ -179,31 +179,31 @@ func TestValidSeqsToStopped(t *testing.T) { } func TestStatusFuncs(t *testing.T) { - id1 := &component.InstanceID{} - id2 := &component.InstanceID{} + id1 := &componentstatus.InstanceID{} + id2 := &componentstatus.InstanceID{} - actualStatuses := make(map[*component.InstanceID][]component.Status) - statusFunc := func(id *component.InstanceID, ev *component.StatusEvent) { + actualStatuses := make(map[*componentstatus.InstanceID][]componentstatus.Status) + statusFunc := func(id *componentstatus.InstanceID, ev *componentstatus.Event) { actualStatuses[id] = append(actualStatuses[id], ev.Status()) } - statuses1 := []component.Status{ - component.StatusStarting, - component.StatusOK, - component.StatusStopping, - component.StatusStopped, + statuses1 := []componentstatus.Status{ + componentstatus.StatusStarting, + componentstatus.StatusOK, + componentstatus.StatusStopping, + componentstatus.StatusStopped, } - statuses2 := []component.Status{ - component.StatusStarting, - component.StatusOK, - component.StatusRecoverableError, - component.StatusOK, - component.StatusStopping, - component.StatusStopped, + statuses2 := []componentstatus.Status{ + componentstatus.StatusStarting, + componentstatus.StatusOK, + componentstatus.StatusRecoverableError, + componentstatus.StatusOK, + componentstatus.StatusStopping, + componentstatus.StatusStopped, } - expectedStatuses := map[*component.InstanceID][]component.Status{ + expectedStatuses := map[*componentstatus.InstanceID][]componentstatus.Status{ id1: statuses1, id2: statuses2, } @@ -217,20 +217,20 @@ func TestStatusFuncs(t *testing.T) { rep.Ready() for _, st := range statuses1 { - comp1Func(component.NewStatusEvent(st)) + comp1Func(componentstatus.NewEvent(st)) } for _, st := range statuses2 { - comp2Func(component.NewStatusEvent(st)) + comp2Func(componentstatus.NewEvent(st)) } require.Equal(t, expectedStatuses, actualStatuses) } func TestStatusFuncsConcurrent(t *testing.T) { - ids := []*component.InstanceID{{}, {}, {}, {}} + ids := []*componentstatus.InstanceID{{}, {}, {}, {}} count := 0 - statusFunc := func(*component.InstanceID, *component.StatusEvent) { + statusFunc := func(*componentstatus.InstanceID, *componentstatus.Event) { count++ } rep := NewReporter(statusFunc, @@ -246,10 +246,10 @@ func TestStatusFuncsConcurrent(t *testing.T) { id := id go func() { compFn := NewReportStatusFunc(id, rep.ReportStatus) - compFn(component.NewStatusEvent(component.StatusStarting)) + compFn(componentstatus.NewEvent(componentstatus.StatusStarting)) for i := 0; i < 1000; i++ { - compFn(component.NewStatusEvent(component.StatusRecoverableError)) - compFn(component.NewStatusEvent(component.StatusOK)) + compFn(componentstatus.NewEvent(componentstatus.StatusRecoverableError)) + compFn(componentstatus.NewEvent(componentstatus.StatusOK)) } wg.Done() }() @@ -260,78 +260,78 @@ func TestStatusFuncsConcurrent(t *testing.T) { } func TestReporterReady(t *testing.T) { - statusFunc := func(*component.InstanceID, *component.StatusEvent) {} + statusFunc := func(*componentstatus.InstanceID, *componentstatus.Event) {} var err error rep := NewReporter(statusFunc, func(e error) { err = e }) - id := &component.InstanceID{} + id := &componentstatus.InstanceID{} - rep.ReportStatus(id, component.NewStatusEvent(component.StatusStarting)) + rep.ReportStatus(id, componentstatus.NewEvent(componentstatus.StatusStarting)) require.ErrorIs(t, err, ErrStatusNotReady) rep.Ready() err = nil - rep.ReportStatus(id, component.NewStatusEvent(component.StatusStarting)) + rep.ReportStatus(id, componentstatus.NewEvent(componentstatus.StatusStarting)) require.NoError(t, err) } func TestReportComponentOKIfStarting(t *testing.T) { for _, tc := range []struct { name string - initialStatuses []component.Status - expectedStatuses []component.Status + initialStatuses []componentstatus.Status + expectedStatuses []componentstatus.Status }{ { name: "matching condition: StatusStarting", - initialStatuses: []component.Status{ - component.StatusStarting, + initialStatuses: []componentstatus.Status{ + componentstatus.StatusStarting, }, - expectedStatuses: []component.Status{ - component.StatusStarting, - component.StatusOK, + expectedStatuses: []componentstatus.Status{ + componentstatus.StatusStarting, + componentstatus.StatusOK, }, }, { name: "non-matching condition StatusOK", - initialStatuses: []component.Status{ - component.StatusStarting, - component.StatusOK, + initialStatuses: []componentstatus.Status{ + componentstatus.StatusStarting, + componentstatus.StatusOK, }, - expectedStatuses: []component.Status{ - component.StatusStarting, - component.StatusOK, + expectedStatuses: []componentstatus.Status{ + componentstatus.StatusStarting, + componentstatus.StatusOK, }, }, { name: "non-matching condition RecoverableError", - initialStatuses: []component.Status{ - component.StatusStarting, - component.StatusRecoverableError, + initialStatuses: []componentstatus.Status{ + componentstatus.StatusStarting, + componentstatus.StatusRecoverableError, }, - expectedStatuses: []component.Status{ - component.StatusStarting, - component.StatusRecoverableError, + expectedStatuses: []componentstatus.Status{ + componentstatus.StatusStarting, + componentstatus.StatusRecoverableError, }, }, { name: "non-matching condition PermanentError", - initialStatuses: []component.Status{ - component.StatusStarting, - component.StatusPermanentError, + initialStatuses: []componentstatus.Status{ + componentstatus.StatusStarting, + componentstatus.StatusPermanentError, }, - expectedStatuses: []component.Status{ - component.StatusStarting, - component.StatusPermanentError, + expectedStatuses: []componentstatus.Status{ + componentstatus.StatusStarting, + componentstatus.StatusPermanentError, }, }, } { t.Run(tc.name, func(t *testing.T) { - var receivedStatuses []component.Status + var receivedStatuses []componentstatus.Status rep := NewReporter( - func(_ *component.InstanceID, ev *component.StatusEvent) { + func(_ *componentstatus.InstanceID, ev *componentstatus.Event) { receivedStatuses = append(receivedStatuses, ev.Status()) }, func(err error) { @@ -340,9 +340,9 @@ func TestReportComponentOKIfStarting(t *testing.T) { ) rep.Ready() - id := &component.InstanceID{} + id := &componentstatus.InstanceID{} for _, status := range tc.initialStatuses { - rep.ReportStatus(id, component.NewStatusEvent(status)) + rep.ReportStatus(id, componentstatus.NewEvent(status)) } rep.ReportOKIfStarting(id) diff --git a/service/internal/status/statustest/statustest.go b/service/internal/status/statustest/statustest.go index 3ba40a16298..881db196a49 100644 --- a/service/internal/status/statustest/statustest.go +++ b/service/internal/status/statustest/statustest.go @@ -4,7 +4,7 @@ package statustest // import "go.opentelemetry.io/collector/service/internal/status/statustest" import ( - "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/component/componentstatus" "go.opentelemetry.io/collector/service/internal/status" ) @@ -16,6 +16,6 @@ type nopStatusReporter struct{} func (r *nopStatusReporter) Ready() {} -func (r *nopStatusReporter) ReportStatus(*component.InstanceID, *component.StatusEvent) {} +func (r *nopStatusReporter) ReportStatus(*componentstatus.InstanceID, *componentstatus.Event) {} -func (r *nopStatusReporter) ReportOKIfStarting(*component.InstanceID) {} +func (r *nopStatusReporter) ReportOKIfStarting(*componentstatus.InstanceID) {} diff --git a/service/metadata.yaml b/service/metadata.yaml index 886f71549e0..96a9628d0c1 100644 --- a/service/metadata.yaml +++ b/service/metadata.yaml @@ -1,4 +1,5 @@ type: service +github_project: open-telemetry/opentelemetry-collector status: class: pkg @@ -6,12 +7,6 @@ status: development: [traces, metrics, logs] distributions: [core, contrib] -tests: - goleak: - ignore: - top: - - "go.opentelemetry.io/collector/service/internal/proctelemetry.InitPrometheusServer.func1" - telemetry: metrics: process_uptime: diff --git a/service/service.go b/service/service.go index 88efd1adb91..ab50e2d003c 100644 --- a/service/service.go +++ b/service/service.go @@ -12,6 +12,7 @@ import ( "runtime" "go.opentelemetry.io/otel/metric" + "go.opentelemetry.io/otel/metric/noop" sdkresource "go.opentelemetry.io/otel/sdk/resource" "go.uber.org/multierr" "go.uber.org/zap" @@ -28,6 +29,7 @@ import ( "go.opentelemetry.io/collector/processor" "go.opentelemetry.io/collector/receiver" "go.opentelemetry.io/collector/service/extensions" + "go.opentelemetry.io/collector/service/internal/builders" "go.opentelemetry.io/collector/service/internal/graph" "go.opentelemetry.io/collector/service/internal/proctelemetry" "go.opentelemetry.io/collector/service/internal/resource" @@ -44,19 +46,54 @@ type Settings struct { CollectorConf *confmap.Conf // Receivers builder for receivers. - Receivers *receiver.Builder + // + // Deprecated: [v0.108.0] use the [ReceiversConfigs] and [ReceiversFactories] options + // instead. + Receivers builders.Receiver + + // Receivers configuration to its builder. + ReceiversConfigs map[component.ID]component.Config + ReceiversFactories map[component.Type]receiver.Factory // Processors builder for processors. - Processors *processor.Builder + // + // Deprecated: [v0.108.0] use the [ProcessorsConfigs] and [ProcessorsFactories] options + // instead. + Processors builders.Processor + + // Processors configuration to its builder. + ProcessorsConfigs map[component.ID]component.Config + ProcessorsFactories map[component.Type]processor.Factory // Exporters builder for exporters. - Exporters *exporter.Builder + // + // Deprecated: [v0.108.0] use the [ReceiversConfigs] and [ReceiversFactories] options + // instead. + Exporters builders.Exporter + + // exporters configuration to its builder. + ExportersConfigs map[component.ID]component.Config + ExportersFactories map[component.Type]exporter.Factory // Connectors builder for connectors. - Connectors *connector.Builder + // + // Deprecated: [v0.108.0] use the [ConnectorsConfigs] and [ConnectorsFactories] options + // instead. + Connectors builders.Connector + + // Connectors configuration to its builder. + ConnectorsConfigs map[component.ID]component.Config + ConnectorsFactories map[component.Type]connector.Factory // Extensions builder for extensions. - Extensions *extension.Builder + Extensions builders.Extension + + // Extensions configuration to its builder. + ExtensionsConfigs map[component.ID]component.Config + ExtensionsFactories map[component.Type]extension.Factory + + // ModuleInfo describes the go module for each component. + ModuleInfo extension.ModuleInfo // AsyncErrorChannel is the channel that is used to report fatal errors. AsyncErrorChannel chan error @@ -69,26 +106,51 @@ type Settings struct { type Service struct { buildInfo component.BuildInfo telemetrySettings component.TelemetrySettings - host *serviceHost + host *graph.Host collectorConf *confmap.Conf - - reporter status.Reporter } // New creates a new Service, its telemetry, and Components. func New(ctx context.Context, set Settings, cfg Config) (*Service, error) { disableHighCard := obsreportconfig.DisableHighCardinalityMetricsfeatureGate.IsEnabled() extendedConfig := obsreportconfig.UseOtelWithSDKConfigurationForInternalTelemetryFeatureGate.IsEnabled() + + receivers := set.Receivers + if receivers == nil { + receivers = builders.NewReceiver(set.ReceiversConfigs, set.ReceiversFactories) + } + + processors := set.Processors + if processors == nil { + processors = builders.NewProcessor(set.ProcessorsConfigs, set.ProcessorsFactories) + } + + exporters := set.Exporters + if exporters == nil { + exporters = builders.NewExporter(set.ExportersConfigs, set.ExportersFactories) + } + + connectors := set.Connectors + if connectors == nil { + connectors = builders.NewConnector(set.ConnectorsConfigs, set.ConnectorsFactories) + } + + extensions := set.Extensions + if extensions == nil { + extensions = builders.NewExtension(set.ExtensionsConfigs, set.ExtensionsFactories) + } + srv := &Service{ buildInfo: set.BuildInfo, - host: &serviceHost{ - receivers: set.Receivers, - processors: set.Processors, - exporters: set.Exporters, - connectors: set.Connectors, - extensions: set.Extensions, - buildInfo: set.BuildInfo, - asyncErrorChannel: set.AsyncErrorChannel, + host: &graph.Host{ + Receivers: receivers, + Processors: processors, + Exporters: exporters, + Connectors: connectors, + Extensions: extensions, + ModuleInfo: set.ModuleInfo, + BuildInfo: set.BuildInfo, + AsyncErrorChannel: set.AsyncErrorChannel, }, collectorConf: set.CollectorConf, } @@ -129,6 +191,12 @@ func New(ctx context.Context, set Settings, cfg Config) (*Service, error) { logsAboutMeterProvider(logger, cfg.Telemetry.Metrics, mp, extendedConfig) srv.telemetrySettings = component.TelemetrySettings{ + LeveledMeterProvider: func(level configtelemetry.Level) metric.MeterProvider { + if level <= cfg.Telemetry.Metrics.Level { + return mp + } + return noop.MeterProvider{} + }, Logger: logger, MeterProvider: mp, TracerProvider: tracerProvider, @@ -136,14 +204,14 @@ func New(ctx context.Context, set Settings, cfg Config) (*Service, error) { // Construct telemetry attributes from build info and config's resource attributes. Resource: pcommonRes, } - srv.reporter = status.NewReporter(srv.host.notifyComponentStatusChange, func(err error) { + srv.host.Reporter = status.NewReporter(srv.host.NotifyComponentStatusChange, func(err error) { if errors.Is(err, status.ErrStatusNotReady) { logger.Warn("Invalid transition", zap.Error(err)) } // ignore other errors as they represent invalid state transitions and are considered benign. }) - if err = srv.initGraph(ctx, set, cfg); err != nil { + if err = srv.initGraph(ctx, cfg); err != nil { err = multierr.Append(err, srv.shutdownTelemetry(ctx)) return nil, err } @@ -198,23 +266,23 @@ func (srv *Service) Start(ctx context.Context) error { ) // enable status reporting - srv.reporter.Ready() + srv.host.Reporter.Ready() - if err := srv.host.serviceExtensions.Start(ctx, srv.host); err != nil { + if err := srv.host.ServiceExtensions.Start(ctx, srv.host); err != nil { return fmt.Errorf("failed to start extensions: %w", err) } if srv.collectorConf != nil { - if err := srv.host.serviceExtensions.NotifyConfig(ctx, srv.collectorConf); err != nil { + if err := srv.host.ServiceExtensions.NotifyConfig(ctx, srv.collectorConf); err != nil { return err } } - if err := srv.host.pipelines.StartAll(ctx, srv.host, srv.reporter); err != nil { + if err := srv.host.Pipelines.StartAll(ctx, srv.host); err != nil { return fmt.Errorf("cannot start pipelines: %w", err) } - if err := srv.host.serviceExtensions.NotifyPipelineReady(); err != nil { + if err := srv.host.ServiceExtensions.NotifyPipelineReady(); err != nil { return err } @@ -257,15 +325,15 @@ func (srv *Service) Shutdown(ctx context.Context) error { // Begin shutdown sequence. srv.telemetrySettings.Logger.Info("Starting shutdown...") - if err := srv.host.serviceExtensions.NotifyPipelineNotReady(); err != nil { + if err := srv.host.ServiceExtensions.NotifyPipelineNotReady(); err != nil { errs = multierr.Append(errs, fmt.Errorf("failed to notify that pipeline is not ready: %w", err)) } - if err := srv.host.pipelines.ShutdownAll(ctx, srv.reporter); err != nil { + if err := srv.host.Pipelines.ShutdownAll(ctx, srv.host.Reporter); err != nil { errs = multierr.Append(errs, fmt.Errorf("failed to shutdown pipelines: %w", err)) } - if err := srv.host.serviceExtensions.Shutdown(ctx); err != nil { + if err := srv.host.ServiceExtensions.Shutdown(ctx); err != nil { errs = multierr.Append(errs, fmt.Errorf("failed to shutdown extensions: %w", err)) } @@ -282,26 +350,27 @@ func (srv *Service) initExtensions(ctx context.Context, cfg extensions.Config) e extensionsSettings := extensions.Settings{ Telemetry: srv.telemetrySettings, BuildInfo: srv.buildInfo, - Extensions: srv.host.extensions, + Extensions: srv.host.Extensions, + ModuleInfo: srv.host.ModuleInfo, } - if srv.host.serviceExtensions, err = extensions.New(ctx, extensionsSettings, cfg, extensions.WithReporter(srv.reporter)); err != nil { + if srv.host.ServiceExtensions, err = extensions.New(ctx, extensionsSettings, cfg, extensions.WithReporter(srv.host.Reporter)); err != nil { return fmt.Errorf("failed to build extensions: %w", err) } return nil } // Creates the pipeline graph. -func (srv *Service) initGraph(ctx context.Context, set Settings, cfg Config) error { +func (srv *Service) initGraph(ctx context.Context, cfg Config) error { var err error - if srv.host.pipelines, err = graph.Build(ctx, graph.Settings{ + if srv.host.Pipelines, err = graph.Build(ctx, graph.Settings{ Telemetry: srv.telemetrySettings, BuildInfo: srv.buildInfo, - ReceiverBuilder: set.Receivers, - ProcessorBuilder: set.Processors, - ExporterBuilder: set.Exporters, - ConnectorBuilder: set.Connectors, + ReceiverBuilder: srv.host.Receivers, + ProcessorBuilder: srv.host.Processors, + ExporterBuilder: srv.host.Exporters, + ConnectorBuilder: srv.host.Connectors, PipelineConfigs: cfg.Pipelines, - ReportStatus: srv.reporter.ReportStatus, + ReportStatus: srv.host.Reporter.ReportStatus, }); err != nil { return fmt.Errorf("failed to build pipelines: %w", err) } diff --git a/service/service_test.go b/service/service_test.go index b0a952724be..325a6aa5899 100644 --- a/service/service_test.go +++ b/service/service_test.go @@ -21,19 +21,16 @@ import ( "go.uber.org/zap/zapcore" "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/component/componentstatus" "go.opentelemetry.io/collector/config/confighttp" "go.opentelemetry.io/collector/config/configtelemetry" "go.opentelemetry.io/collector/confmap" - "go.opentelemetry.io/collector/connector/connectortest" - "go.opentelemetry.io/collector/exporter/exportertest" "go.opentelemetry.io/collector/extension" - "go.opentelemetry.io/collector/extension/extensiontest" "go.opentelemetry.io/collector/extension/zpagesextension" "go.opentelemetry.io/collector/internal/testutil" "go.opentelemetry.io/collector/pdata/pcommon" - "go.opentelemetry.io/collector/processor/processortest" - "go.opentelemetry.io/collector/receiver/receivertest" "go.opentelemetry.io/collector/service/extensions" + "go.opentelemetry.io/collector/service/internal/builders" "go.opentelemetry.io/collector/service/pipelines" "go.opentelemetry.io/collector/service/telemetry" ) @@ -185,19 +182,19 @@ func TestServiceGetFactory(t *testing.T) { }) assert.Nil(t, srv.host.GetFactory(component.KindReceiver, wrongType)) - assert.Equal(t, set.Receivers.Factory(nopType), srv.host.GetFactory(component.KindReceiver, nopType)) + assert.Equal(t, srv.host.Receivers.Factory(nopType), srv.host.GetFactory(component.KindReceiver, nopType)) assert.Nil(t, srv.host.GetFactory(component.KindProcessor, wrongType)) - assert.Equal(t, set.Processors.Factory(nopType), srv.host.GetFactory(component.KindProcessor, nopType)) + assert.Equal(t, srv.host.Processors.Factory(nopType), srv.host.GetFactory(component.KindProcessor, nopType)) assert.Nil(t, srv.host.GetFactory(component.KindExporter, wrongType)) - assert.Equal(t, set.Exporters.Factory(nopType), srv.host.GetFactory(component.KindExporter, nopType)) + assert.Equal(t, srv.host.Exporters.Factory(nopType), srv.host.GetFactory(component.KindExporter, nopType)) assert.Nil(t, srv.host.GetFactory(component.KindConnector, wrongType)) - assert.Equal(t, set.Connectors.Factory(nopType), srv.host.GetFactory(component.KindConnector, nopType)) + assert.Equal(t, srv.host.Connectors.Factory(nopType), srv.host.GetFactory(component.KindConnector, nopType)) assert.Nil(t, srv.host.GetFactory(component.KindExtension, wrongType)) - assert.Equal(t, set.Extensions.Factory(nopType), srv.host.GetFactory(component.KindExtension, nopType)) + assert.Equal(t, srv.host.Extensions.Factory(nopType), srv.host.GetFactory(component.KindExtension, nopType)) // Try retrieve non existing component.Kind. assert.Nil(t, srv.host.GetFactory(42, nopType)) @@ -227,6 +224,7 @@ func TestServiceGetExporters(t *testing.T) { assert.NoError(t, srv.Shutdown(context.Background())) }) + // nolint expMap := srv.host.GetExporters() assert.Len(t, expMap, 3) assert.Len(t, expMap[component.DataTypeTraces], 1) @@ -290,9 +288,12 @@ func testCollectorStartHelper(t *testing.T, tc ownMetricsTestCase, network strin set := newNopSettings() set.BuildInfo = component.BuildInfo{Version: "test version", Command: otelCommand} - set.Extensions = extension.NewBuilder( - map[component.ID]component.Config{component.MustNewID("zpages"): &zpagesextension.Config{ServerConfig: confighttp.ServerConfig{Endpoint: zpagesAddr}}}, - map[component.Type]extension.Factory{component.MustNewType("zpages"): zpagesextension.NewFactory()}) + set.ExtensionsConfigs = map[component.ID]component.Config{ + component.MustNewID("zpages"): &zpagesextension.Config{ + ServerConfig: confighttp.ServerConfig{Endpoint: zpagesAddr}, + }, + } + set.ExtensionsFactories = map[component.Type]extension.Factory{component.MustNewType("zpages"): zpagesextension.NewFactory()} set.LoggingOptions = []zap.Option{zap.Hooks(hook)} cfg := newNopConfig() @@ -340,6 +341,10 @@ func TestServiceTelemetryRestart(t *testing.T) { assert.NoError(t, err) assert.NoError(t, resp.Body.Close()) assert.Equal(t, http.StatusOK, resp.StatusCode) + // Response body must be closed now instead of defer as the test + // restarts the server on the same port. Leaving response open + // leaks a goroutine. + resp.Body.Close() // Shutdown the service require.NoError(t, srvOne.Shutdown(context.Background())) @@ -362,6 +367,7 @@ func TestServiceTelemetryRestart(t *testing.T) { 100*time.Millisecond, "Must get a valid response from the service", ) + defer resp.Body.Close() assert.Equal(t, http.StatusOK, resp.StatusCode) // Shutdown the new service @@ -374,9 +380,8 @@ func TestExtensionNotificationFailure(t *testing.T) { var extName = component.MustNewType("configWatcher") configWatcherExtensionFactory := newConfigWatcherExtensionFactory(extName) - set.Extensions = extension.NewBuilder( - map[component.ID]component.Config{component.NewID(extName): configWatcherExtensionFactory.CreateDefaultConfig()}, - map[component.Type]extension.Factory{extName: configWatcherExtensionFactory}) + set.ExtensionsConfigs = map[component.ID]component.Config{component.NewID(extName): configWatcherExtensionFactory.CreateDefaultConfig()} + set.ExtensionsFactories = map[component.Type]extension.Factory{extName: configWatcherExtensionFactory} cfg.Extensions = []component.ID{component.NewID(extName)} // Create a service @@ -397,9 +402,8 @@ func TestNilCollectorEffectiveConfig(t *testing.T) { var extName = component.MustNewType("configWatcher") configWatcherExtensionFactory := newConfigWatcherExtensionFactory(extName) - set.Extensions = extension.NewBuilder( - map[component.ID]component.Config{component.NewID(extName): configWatcherExtensionFactory.CreateDefaultConfig()}, - map[component.Type]extension.Factory{extName: configWatcherExtensionFactory}) + set.ExtensionsConfigs = map[component.ID]component.Config{component.NewID(extName): configWatcherExtensionFactory.CreateDefaultConfig()} + set.ExtensionsFactories = map[component.Type]extension.Factory{extName: configWatcherExtensionFactory} cfg.Extensions = []component.ID{component.NewID(extName)} // Create a service @@ -437,11 +441,11 @@ func TestServiceFatalError(t *testing.T) { }) go func() { - ev := component.NewFatalErrorEvent(assert.AnError) - srv.host.notifyComponentStatusChange(&component.InstanceID{}, ev) + ev := componentstatus.NewFatalErrorEvent(assert.AnError) + srv.host.NotifyComponentStatusChange(&componentstatus.InstanceID{}, ev) }() - err = <-srv.host.asyncErrorChannel + err = <-srv.host.AsyncErrorChannel require.ErrorIs(t, err, assert.AnError) } @@ -535,14 +539,26 @@ func assertZPages(t *testing.T, zpagesAddr string) { } func newNopSettings() Settings { + receiversConfigs, receiversFactories := builders.NewNopReceiverConfigsAndFactories() + processorsConfigs, processorsFactories := builders.NewNopProcessorConfigsAndFactories() + connectorsConfigs, connectorsFactories := builders.NewNopConnectorConfigsAndFactories() + exportersConfigs, exportersFactories := builders.NewNopExporterConfigsAndFactories() + extensionsConfigs, extensionsFactories := builders.NewNopExtensionConfigsAndFactories() + return Settings{ - BuildInfo: component.NewDefaultBuildInfo(), - CollectorConf: confmap.New(), - Receivers: receivertest.NewNopBuilder(), - Processors: processortest.NewNopBuilder(), - Exporters: exportertest.NewNopBuilder(), - Connectors: connectortest.NewNopBuilder(), - Extensions: extensiontest.NewNopBuilder(), + BuildInfo: component.NewDefaultBuildInfo(), + CollectorConf: confmap.New(), + ReceiversConfigs: receiversConfigs, + ReceiversFactories: receiversFactories, + ProcessorsConfigs: processorsConfigs, + ProcessorsFactories: processorsFactories, + ExportersConfigs: exportersConfigs, + ExportersFactories: exportersFactories, + ConnectorsConfigs: connectorsConfigs, + ConnectorsFactories: connectorsFactories, + ExtensionsConfigs: extensionsConfigs, + ExtensionsFactories: extensionsFactories, + AsyncErrorChannel: make(chan error), } } diff --git a/service/telemetry.go b/service/telemetry.go index a44aaa4e4e4..7d3427e77bf 100644 --- a/service/telemetry.go +++ b/service/telemetry.go @@ -8,6 +8,7 @@ import ( "net" "net/http" "strconv" + "sync" "go.opentelemetry.io/contrib/config" "go.opentelemetry.io/otel/metric" @@ -29,7 +30,8 @@ const ( type meterProvider struct { *sdkmetric.MeterProvider - servers []*http.Server + servers []*http.Server + serverWG sync.WaitGroup } type meterProviderSettings struct { @@ -71,7 +73,7 @@ func newMeterProvider(set meterProviderSettings, disableHighCardinality bool) (m var opts []sdkmetric.Option for _, reader := range set.cfg.Readers { // https://github.com/open-telemetry/opentelemetry-collector/issues/8045 - r, server, err := proctelemetry.InitMetricReader(context.Background(), reader, set.asyncErrorChannel) + r, server, err := proctelemetry.InitMetricReader(context.Background(), reader, set.asyncErrorChannel, &mp.serverWG) if err != nil { return nil, err } @@ -110,5 +112,8 @@ func (mp *meterProvider) Shutdown(ctx context.Context) error { errs = multierr.Append(errs, server.Close()) } } - return multierr.Append(errs, mp.MeterProvider.Shutdown(ctx)) + errs = multierr.Append(errs, mp.MeterProvider.Shutdown(ctx)) + mp.serverWG.Wait() + + return errs } diff --git a/service/telemetry/tracer.go b/service/telemetry/tracer.go index 4434af2fc74..52068ec404e 100644 --- a/service/telemetry/tracer.go +++ b/service/telemetry/tracer.go @@ -13,6 +13,9 @@ import ( "go.opentelemetry.io/otel/propagation" semconv "go.opentelemetry.io/otel/semconv/v1.26.0" "go.opentelemetry.io/otel/trace" + "go.opentelemetry.io/otel/trace/noop" + + "go.opentelemetry.io/collector/internal/globalgates" ) const ( @@ -45,6 +48,9 @@ func attributes(set Settings, cfg Config) map[string]interface{} { // New creates a new Telemetry from Config. func newTracerProvider(ctx context.Context, set Settings, cfg Config) (trace.TracerProvider, error) { + if globalgates.NoopTracerProvider.IsEnabled() { + return noop.NewTracerProvider(), nil + } sch := semconv.SchemaURL res := config.Resource{ SchemaUrl: &sch, diff --git a/service/telemetry/tracer_test.go b/service/telemetry/tracer_test.go index 6a86d284b58..126f681c0b4 100644 --- a/service/telemetry/tracer_test.go +++ b/service/telemetry/tracer_test.go @@ -4,11 +4,16 @@ package telemetry // import "go.opentelemetry.io/collector/service/telemetry" import ( + "context" "testing" "github.com/stretchr/testify/require" + sdktrace "go.opentelemetry.io/otel/sdk/trace" + "go.opentelemetry.io/otel/trace/noop" "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/featuregate" + "go.opentelemetry.io/collector/internal/globalgates" "go.opentelemetry.io/collector/service/telemetry/internal" ) @@ -56,6 +61,38 @@ func TestAttributes(t *testing.T) { } } +func TestNewTracerProvider(t *testing.T) { + tests := []struct { + name string + wantTracerProvider any + noopTracer bool + }{ + { + name: "noop tracer provider", + noopTracer: true, + wantTracerProvider: noop.TracerProvider{}, + }, + { + name: "tracer provider", + wantTracerProvider: &sdktrace.TracerProvider{}, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + previousValue := globalgates.NoopTracerProvider.IsEnabled() + err := featuregate.GlobalRegistry().Set(globalgates.NoopTracerProvider.ID(), tt.noopTracer) + require.NoError(t, err) + defer func() { + err = featuregate.GlobalRegistry().Set(globalgates.NoopTracerProvider.ID(), previousValue) + require.NoError(t, err) + }() + provider, err := newTracerProvider(context.TODO(), internal.Settings{}, Config{}) + require.NoError(t, err) + require.IsType(t, tt.wantTracerProvider, provider) + }) + } +} + func ptr[T any](v T) *T { return &v } diff --git a/service/zpages.go b/service/zpages.go deleted file mode 100644 index c7f7b494ad3..00000000000 --- a/service/zpages.go +++ /dev/null @@ -1,99 +0,0 @@ -// Copyright The OpenTelemetry Authors -// SPDX-License-Identifier: Apache-2.0 - -package service // import "go.opentelemetry.io/collector/service" - -import ( - "net/http" - "path" - "runtime" - "time" - - "go.opentelemetry.io/collector/component" - "go.opentelemetry.io/collector/featuregate" - "go.opentelemetry.io/collector/service/internal/zpages" -) - -const ( - // Paths - zServicePath = "servicez" - zPipelinePath = "pipelinez" - zExtensionPath = "extensionz" - zFeaturePath = "featurez" -) - -var ( - // InfoVar is a singleton instance of the Info struct. - runtimeInfoVar [][2]string -) - -func init() { - runtimeInfoVar = [][2]string{ - {"StartTimestamp", time.Now().String()}, - {"Go", runtime.Version()}, - {"OS", runtime.GOOS}, - {"Arch", runtime.GOARCH}, - // Add other valuable runtime information here. - } -} - -func (host *serviceHost) RegisterZPages(mux *http.ServeMux, pathPrefix string) { - mux.HandleFunc(path.Join(pathPrefix, zServicePath), host.zPagesRequest) - mux.HandleFunc(path.Join(pathPrefix, zPipelinePath), host.pipelines.HandleZPages) - mux.HandleFunc(path.Join(pathPrefix, zExtensionPath), host.serviceExtensions.HandleZPages) - mux.HandleFunc(path.Join(pathPrefix, zFeaturePath), handleFeaturezRequest) -} - -func (host *serviceHost) zPagesRequest(w http.ResponseWriter, _ *http.Request) { - w.Header().Set("Content-Type", "text/html; charset=utf-8") - zpages.WriteHTMLPageHeader(w, zpages.HeaderData{Title: "Service " + host.buildInfo.Command}) - zpages.WriteHTMLPropertiesTable(w, zpages.PropertiesTableData{Name: "Build Info", Properties: getBuildInfoProperties(host.buildInfo)}) - zpages.WriteHTMLPropertiesTable(w, zpages.PropertiesTableData{Name: "Runtime Info", Properties: runtimeInfoVar}) - zpages.WriteHTMLComponentHeader(w, zpages.ComponentHeaderData{ - Name: "Pipelines", - ComponentEndpoint: zPipelinePath, - Link: true, - }) - zpages.WriteHTMLComponentHeader(w, zpages.ComponentHeaderData{ - Name: "Extensions", - ComponentEndpoint: zExtensionPath, - Link: true, - }) - zpages.WriteHTMLComponentHeader(w, zpages.ComponentHeaderData{ - Name: "Features", - ComponentEndpoint: zFeaturePath, - Link: true, - }) - zpages.WriteHTMLPageFooter(w) -} - -func handleFeaturezRequest(w http.ResponseWriter, _ *http.Request) { - w.Header().Set("Content-Type", "text/html; charset=utf-8") - zpages.WriteHTMLPageHeader(w, zpages.HeaderData{Title: "Feature Gates"}) - zpages.WriteHTMLFeaturesTable(w, getFeaturesTableData()) - zpages.WriteHTMLPageFooter(w) -} - -func getFeaturesTableData() zpages.FeatureGateTableData { - data := zpages.FeatureGateTableData{} - featuregate.GlobalRegistry().VisitAll(func(gate *featuregate.Gate) { - data.Rows = append(data.Rows, zpages.FeatureGateTableRowData{ - ID: gate.ID(), - Enabled: gate.IsEnabled(), - Description: gate.Description(), - Stage: gate.Stage().String(), - FromVersion: gate.FromVersion(), - ToVersion: gate.ToVersion(), - ReferenceURL: gate.ReferenceURL(), - }) - }) - return data -} - -func getBuildInfoProperties(buildInfo component.BuildInfo) [][2]string { - return [][2]string{ - {"Command", buildInfo.Command}, - {"Description", buildInfo.Description}, - {"Version", buildInfo.Version}, - } -} diff --git a/versions.yaml b/versions.yaml index f5f47a5f32f..b1ca12a3b20 100644 --- a/versions.yaml +++ b/versions.yaml @@ -3,7 +3,7 @@ module-sets: stable: - version: v1.12.0 + version: v1.13.0 modules: - go.opentelemetry.io/collector/client - go.opentelemetry.io/collector/featuregate @@ -13,7 +13,7 @@ module-sets: - go.opentelemetry.io/collector/config/configretry - go.opentelemetry.io/collector/config/configtls beta: - version: v0.106.1 + version: v0.107.0 modules: - go.opentelemetry.io/collector - go.opentelemetry.io/collector/internal/globalgates