diff --git a/.chloggen/6767-exporterhelper-rename-config.yaml b/.chloggen/6767-exporterhelper-rename-config.yaml deleted file mode 100644 index f81f1b28223..00000000000 --- a/.chloggen/6767-exporterhelper-rename-config.yaml +++ /dev/null @@ -1,20 +0,0 @@ -# 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: exporterhelper - -# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). -note: "Deprecate TimeoutSettings/QueueSettings in favor of TimeoutConfig/QueueConfig." - -# One or more tracking issues or pull requests related to the change -issues: [6767] - -# 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/add-map-moveto.yaml b/.chloggen/add-map-moveto.yaml deleted file mode 100644 index ecb169f5527..00000000000 --- a/.chloggen/add-map-moveto.yaml +++ /dev/null @@ -1,20 +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: pdata - -# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). -note: Add support to MoveTo for Map, allow avoiding copies - -# One or more tracking issues or pull requests related to the change -issues: [11175] - -# 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, user] diff --git a/.chloggen/avoid-internal-2.yaml b/.chloggen/avoid-internal-2.yaml deleted file mode 100644 index d52dab7c1d2..00000000000 --- a/.chloggen/avoid-internal-2.yaml +++ /dev/null @@ -1,20 +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: options - -# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). -note: Avoid using private types in public APIs and also protect options to be implemented outside this module. - -# One or more tracking issues or pull requests related to the change -issues: [11054] - -# 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/avoid-internal.yaml b/.chloggen/avoid-internal.yaml deleted file mode 100644 index 70bd015768b..00000000000 --- a/.chloggen/avoid-internal.yaml +++ /dev/null @@ -1,20 +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: mdatagen - -# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). -note: Avoid using private types in public APIs and also protect options to be implemented outside this module. - -# One or more tracking issues or pull requests related to the change -issues: [11040] - -# 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/add-pipeline-module.yaml b/.chloggen/change-prom-address-to-localhost.yaml similarity index 75% rename from .chloggen/add-pipeline-module.yaml rename to .chloggen/change-prom-address-to-localhost.yaml index 60819a20673..1aa4d229540 100644 --- a/.chloggen/add-pipeline-module.yaml +++ b/.chloggen/change-prom-address-to-localhost.yaml @@ -1,25 +1,25 @@ # 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: 'breaking' # The name of the component, or a single word describing the area of concern, (e.g. otlpreceiver) -component: pipeline +component: service/telemetry # A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). -note: Adds new `pipeline` module to house the concept of pipeline ID and Signal. +note: Change default metrics address to "localhost:8888" instead of ":8888" # One or more tracking issues or pull requests related to the change -issues: [11209] +issues: [11251] # (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: +subtext: This behavior can be disabled by disabling the feature gate 'telemetry.UseLocalHostAsDefaultMetricsAddress'. # 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] +change_logs: [user, api] diff --git a/.chloggen/codeboten_consolidate-inout-items.yaml b/.chloggen/codeboten_consolidate-inout-items.yaml deleted file mode 100644 index 067327f9e79..00000000000 --- a/.chloggen/codeboten_consolidate-inout-items.yaml +++ /dev/null @@ -1,36 +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: processorhelper - -# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). -note: "Update incoming/outgoing metrics to a single metric with a `otel.signal` attributes." - -# One or more tracking issues or pull requests related to the change -issues: [11144] - -# (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: | - The following metrics were added in the previous version - - otelcol_processor_incoming_spans - - otelcol_processor_outgoing_spans - - otelcol_processor_incoming_metric_points - - otelcol_processor_outgoing_metric_points - - otelcol_processor_incoming_log_records - - otelcol_processor_outgoing_log_records - - They are being replaced with the following to more closely align with OTEP 259: - - otelcol_processor_incoming_items - - otelcol_processor_outgoing_items - -# Optional: The change log or logs in which this entry should be included. -# e.g. '[user]' or '[user, api]' -# Include 'user' if the change is relevant to end users. -# Include 'api' if there is a change to a library API. -# Default: '[user]' -change_logs: [] diff --git a/.chloggen/codeboten_deprecate-metrics.yaml b/.chloggen/codeboten_deprecate-metrics.yaml deleted file mode 100644 index 6cd18940929..00000000000 --- a/.chloggen/codeboten_deprecate-metrics.yaml +++ /dev/null @@ -1,36 +0,0 @@ -# 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: processorhelper - -# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). -note: deprecate accepted/refused/dropped metrics - -# One or more tracking issues or pull requests related to the change -issues: [11201] - -# (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: | - The following metrics are being deprecated as they were only used in a single - processor: - - `otelcol_processor_accepted_log_records` - - `otelcol_processor_accepted_metric_points` - - `otelcol_processor_accepted_spans` - - `otelcol_processor_dropped_log_records` - - `otelcol_processor_dropped_metric_points` - - `otelcol_processor_dropped_spans` - - `otelcol_processor_refused_log_records` - - `otelcol_processor_refused_metric_points` - - `otelcol_processor_refused_spans` - -# Optional: The change log or logs in which this entry should be included. -# e.g. '[user]' or '[user, api]' -# Include 'user' if the change is relevant to end users. -# Include 'api' if there is a change to a library API. -# Default: '[user]' -change_logs: [] diff --git a/.chloggen/codeboten_fix-bug.yaml b/.chloggen/codeboten_fix-bug.yaml deleted file mode 100644 index 3faac735c42..00000000000 --- a/.chloggen/codeboten_fix-bug.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: Ensure process telemetry is registered when internal telemetry is configured with readers instead of an address. - -# One or more tracking issues or pull requests related to the change -issues: [11093] - -# (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/9480-configgrpc-option-wrapper.yaml b/.chloggen/configgrpc-option-refactor.yaml similarity index 64% rename from .chloggen/9480-configgrpc-option-wrapper.yaml rename to .chloggen/configgrpc-option-refactor.yaml index 22e14f870e3..23191cdc820 100644 --- a/.chloggen/9480-configgrpc-option-wrapper.yaml +++ b/.chloggen/configgrpc-option-refactor.yaml @@ -1,24 +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' +change_type: breaking # The name of the component, or a single word describing the area of concern, (e.g. otlpreceiver) component: configgrpc # A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). -note: "Deprecate `ClientConfig.ToClientConn`/`ServerConfig.ToServer` in favor of `ToClientConnWithOptions`/`ToServerWithOptions`" +note: Replace ToClientConn and ToServer with ToClientConnWithOptions and ToServerWithOptions. # One or more tracking issues or pull requests related to the change -issues: [9480] +issues: [11271, 9480] # (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: | - Users providing a grpc.DialOption/grpc.ServerOption should now wrap them into - a generic option with `WithGrpcDialOption`/`WithGrpcServerOption`. - + `ClientConfig.ToClientConn` and `ServerConfig.ToServer` were deprecated in v0.110.0 in favor of + `ClientConfig.ToClientConnWithOptions` and `ServerConfig.ToServerWithOptions` which use a more + flexible option type. The original functions are now removed, and the new ones are renamed to the + old names. The `WithOptions` names are kept as deprecated aliases for now. # Optional: The change log or logs in which this entry should be included. # e.g. '[user]' or '[user, api]' diff --git a/.chloggen/stable-useOtelWithSDKConfigurationForInternalTelemetry.yaml b/.chloggen/deprecate-address.yaml similarity index 83% rename from .chloggen/stable-useOtelWithSDKConfigurationForInternalTelemetry.yaml rename to .chloggen/deprecate-address.yaml index 6821ac307eb..2ebaab41b54 100644 --- a/.chloggen/stable-useOtelWithSDKConfigurationForInternalTelemetry.yaml +++ b/.chloggen/deprecate-address.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: 'enhancement' +change_type: 'deprecation' # The name of the component, or a single word describing the area of concern, (e.g. otlpreceiver) component: service/telemetry # A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). -note: Mark useOtelWithSDKConfigurationForInternalTelemetry as stable +note: Deprecate service::telemetry::metrics::address in favor of service::telemetry::metrics::readers. # One or more tracking issues or pull requests related to the change -issues: [7532] +issues: [11205] # Optional: The change log or logs in which this entry should be included. # e.g. '[user]' or '[user, api]' diff --git a/.chloggen/envprovider-default-value.yaml b/.chloggen/envprovider-default-value.yaml deleted file mode 100644 index 9528a2a41d0..00000000000 --- a/.chloggen/envprovider-default-value.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: enhancement - -# The name of the component, or a single word describing the area of concern, (e.g. otlpreceiver) -component: confmap/provider/envprovider - -# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). -note: Support default values when env var is empty - -# One or more tracking issues or pull requests related to the change -issues: [5228] - -# (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/6767-embedded-field-rename.yaml b/.chloggen/exporterhelper-remove-deprecated.yaml similarity index 78% rename from .chloggen/6767-embedded-field-rename.yaml rename to .chloggen/exporterhelper-remove-deprecated.yaml index bdc5b13883a..a025ed3fab3 100644 --- a/.chloggen/6767-embedded-field-rename.yaml +++ b/.chloggen/exporterhelper-remove-deprecated.yaml @@ -4,18 +4,18 @@ change_type: breaking # The name of the component, or a single word describing the area of concern, (e.g. otlpreceiver) -component: otlpexporter +component: exporterhelper # A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). -note: The `TimeoutSettings` field in `otlpexporter.Config` was renamed to `TimeoutConfig`. +note: Removed deprecated `QueueTimeout`/`TimeoutSettings` aliases in favor of `QueueConfig`/`TimeoutConfig`. # One or more tracking issues or pull requests related to the change -issues: [11132] +issues: [11264, 6767] # (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: +subtext: "`NewDefaultQueueSettings` and `NewDefaultTimeoutSettings` have been similarly renamed." # Optional: The change log or logs in which this entry should be included. # e.g. '[user]' or '[user, api]' diff --git a/.chloggen/fix-mdatagen-metrics-bool-attr.yaml b/.chloggen/fix-mdatagen-metrics-bool-attr.yaml deleted file mode 100644 index 5f78068bb71..00000000000 --- a/.chloggen/fix-mdatagen-metrics-bool-attr.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: mdatagen - -# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). -note: Fix incorrect generation of metric tests with boolean attributes. - -# One or more tracking issues or pull requests related to the change -issues: [11169] - -# (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/fix-metadatagen-validate.yaml b/.chloggen/fix-metadatagen-validate.yaml deleted file mode 100644 index 37d5122793f..00000000000 --- a/.chloggen/fix-metadatagen-validate.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: 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: mdatagen `validateMetrics()` support validate metrics in `telemetry.metric` - -# One or more tracking issues or pull requests related to the change -issues: [10925] - -# (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/fixbuildtags.yaml b/.chloggen/fixbuildtags.yaml deleted file mode 100644 index a439eaea449..00000000000 --- a/.chloggen/fixbuildtags.yaml +++ /dev/null @@ -1,20 +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: builder - -# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). -note: Honor build_tags in config - -# One or more tracking issues or pull requests related to the change -issues: [11156] - -# 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/fixdefaultcfg.yaml b/.chloggen/fixdefaultcfg.yaml deleted file mode 100644 index 29c328367d2..00000000000 --- a/.chloggen/fixdefaultcfg.yaml +++ /dev/null @@ -1,20 +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: builder - -# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). -note: Fix version for providers in the default config - -# One or more tracking issues or pull requests related to the change -issues: [11123] - -# 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/fix_windows_service_event_log_core.yaml b/.chloggen/jackgopack4-re-add-ocb-version-number.yaml similarity index 86% rename from .chloggen/fix_windows_service_event_log_core.yaml rename to .chloggen/jackgopack4-re-add-ocb-version-number.yaml index 7b33776084e..1a8bd5595d0 100644 --- a/.chloggen/fix_windows_service_event_log_core.yaml +++ b/.chloggen/jackgopack4-re-add-ocb-version-number.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: otelcol +component: cmd/builder # A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). -note: Fix the Windows Event Log configuration when running the Collector as a Windows service. +note: re-adds function to properly set and view version number of OpenTelemetry Collector Builder (ocb) binaries # One or more tracking issues or pull requests related to the change -issues: [5297, 11051] +issues: [11208] # (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/confignet-mark-stable.yaml b/.chloggen/json-decoded-flag.yaml similarity index 89% rename from .chloggen/confignet-mark-stable.yaml rename to .chloggen/json-decoded-flag.yaml index 9181b2d4010..05734f7ee31 100644 --- a/.chloggen/confignet-mark-stable.yaml +++ b/.chloggen/json-decoded-flag.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: enhancement +change_type: 'bug_fix' # The name of the component, or a single word describing the area of concern, (e.g. otlpreceiver) -component: confignet +component: 'pdata' # 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: "Unmarshal Span and SpanLink flags from JSON" # One or more tracking issues or pull requests related to the change -issues: [9801] +issues: [11267] # (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/main.yaml b/.chloggen/main.yaml deleted file mode 100644 index 506af46bb8c..00000000000 --- a/.chloggen/main.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: processorhelper - -# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). -note: "Remove deprecated `[Traces|Metrics|Logs]`Inserted funcs" - -# One or more tracking issues or pull requests related to the change -issues: [11151] - -# (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/otlpreceiver-profiles.yaml b/.chloggen/msg_fix-snappy-lazy-read.yaml similarity index 88% rename from .chloggen/otlpreceiver-profiles.yaml rename to .chloggen/msg_fix-snappy-lazy-read.yaml index e0d866fb92b..00c037f1528 100644 --- a/.chloggen/otlpreceiver-profiles.yaml +++ b/.chloggen/msg_fix-snappy-lazy-read.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: otlpreceiver +component: confighttp # A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). -note: Support profiles in the OTLP receiver +note: Snappy compression to lazy read for memory efficiency # One or more tracking issues or pull requests related to the change -issues: [11071] +issues: [11177] # (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: [user] diff --git a/.chloggen/mx-psi_disable-strict-versioning.yaml b/.chloggen/mx-psi_disable-strict-versioning.yaml deleted file mode 100644 index 677225ad0dc..00000000000 --- a/.chloggen/mx-psi_disable-strict-versioning.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: cmd/builder - -# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). -note: Temporarily disable strict versioning checks - -# One or more tracking issues or pull requests related to the change -issues: [11129, 11152] - -# (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: | - The strict versioning check may be enabled by default in a future version once all configuration providers are stabilized. - -# 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-sub-config.yaml b/.chloggen/mx-psi_fix-sub-config.yaml deleted file mode 100644 index af4c99bca09..00000000000 --- a/.chloggen/mx-psi_fix-sub-config.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: Fix loading config of a component from a different source. - -# One or more tracking issues or pull requests related to the change -issues: [11154] - -# (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 issue only affected loading the whole component config, loading parts of a component config from a different source was working correctly. - -# 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_remove-deprecated-interfaces.yaml b/.chloggen/mx-psi_remove-deprecated-interfaces.yaml deleted file mode 100644 index 95dc6020454..00000000000 --- a/.chloggen/mx-psi_remove-deprecated-interfaces.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: breaking - -# 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: Remove deprecated extension interfaces. - -# One or more tracking issues or pull requests related to the change -issues: [11043] - -# (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: | - They are now available in the `extensioncapabilities` module. - -# 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/replace-new-scraper.yaml b/.chloggen/replace-new-scraper.yaml deleted file mode 100644 index 676d41a9b20..00000000000 --- a/.chloggen/replace-new-scraper.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: deprecation - -# The name of the component, or a single word describing the area of concern, (e.g. otlpreceiver) -component: scraperhelper - -# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). -note: Deprecate NewScraperWithComponentType, should use NewScraper - -# One or more tracking issues or pull requests related to the change -issues: [11159] - -# (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/codeboten_stability-metrics.yaml b/.chloggen/support-time-envvar-expansion.yaml similarity index 79% rename from .chloggen/codeboten_stability-metrics.yaml rename to .chloggen/support-time-envvar-expansion.yaml index 162db04adac..c126c2fafee 100644 --- a/.chloggen/codeboten_stability-metrics.yaml +++ b/.chloggen/support-time-envvar-expansion.yaml @@ -4,18 +4,19 @@ change_type: enhancement # The name of the component, or a single word describing the area of concern, (e.g. otlpreceiver) -component: mdatagen +component: confmap # A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). -note: Add stability field to telemetry metrics, allowing the generated description to include a stability string. +note: Allow using any YAML structure as a string when loading configuration including time.Time formats # One or more tracking issues or pull requests related to the change -issues: [11160] +issues: [10659] # (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: +subtext: | + Previously, fields with time.Time formats could not be used as strings in configurations # Optional: The change log or logs in which this entry should be included. # e.g. '[user]' or '[user, api]' diff --git a/.chloggen/use-cobra-add-version.yaml b/.chloggen/use-cobra-add-version.yaml deleted file mode 100644 index 1d5eddf6b89..00000000000 --- a/.chloggen/use-cobra-add-version.yaml +++ /dev/null @@ -1,20 +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: mdatagen - -# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). -note: Use cobra for the command, add version flag - -# One or more tracking issues or pull requests related to the change -issues: [11196] - -# Optional: The change log or logs in which this entry should be included. -# e.g. '[user]' or '[user, api]' -# Include 'user' if the change is relevant to end users. -# Include 'api' if there is a change to a library API. -# Default: '[user]' -change_logs: [user] diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 4f6aa1638b2..7ff3b707ada 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -30,12 +30,12 @@ jobs: # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL - uses: github/codeql-action/init@8214744c546c1e5c8f03dde8fab3a7353211988d # v3.26.7 + uses: github/codeql-action/init@461ef6c76dfe95d5c364de2f431ddbd31a417628 # v3.26.9 with: languages: go - name: Autobuild - uses: github/codeql-action/autobuild@8214744c546c1e5c8f03dde8fab3a7353211988d # v3.26.7 + uses: github/codeql-action/autobuild@461ef6c76dfe95d5c364de2f431ddbd31a417628 # v3.26.9 - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@8214744c546c1e5c8f03dde8fab3a7353211988d # v3.26.7 + uses: github/codeql-action/analyze@461ef6c76dfe95d5c364de2f431ddbd31a417628 # v3.26.9 diff --git a/.github/workflows/scorecard.yml b/.github/workflows/scorecard.yml index 772945dcf26..a2165e2a95d 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@8214744c546c1e5c8f03dde8fab3a7353211988d # v3.26.7 + uses: github/codeql-action/upload-sarif@461ef6c76dfe95d5c364de2f431ddbd31a417628 # v3.26.9 with: sarif_file: results.sarif diff --git a/CHANGELOG-API.md b/CHANGELOG-API.md index ce3069291e2..4a57ee05a84 100644 --- a/CHANGELOG-API.md +++ b/CHANGELOG-API.md @@ -7,6 +7,43 @@ If you are looking for user-facing changes, check out [CHANGELOG.md](./CHANGELOG +## v1.16.0/v0.110.0 + +### 🛑 Breaking changes 🛑 + +- `otlpexporter`: The `TimeoutSettings` field in `otlpexporter.Config` was renamed to `TimeoutConfig`. (#11132) +- `connector`: Change `TracesRouterAndConsumer`, `NewTracesRouter`, `MetricsRouterAndConsumer`, `NewMetricsRouter`, `LogsRouterAndConsumer`, and `NewLogsRouter` to use `pipeline.ID` instead of `component.ID`. (#11204) +- `extension`: Remove deprecated extension interfaces. (#11043) + They are now available in the `extensioncapabilities` module. + + +### 🚩 Deprecations 🚩 + +- `exporterhelper`: Deprecate TimeoutSettings/QueueSettings in favor of TimeoutConfig/QueueConfig. (#6767) +- `configgrpc`: Deprecate `ClientConfig.ToClientConn`/`ServerConfig.ToServer` in favor of `ToClientConnWithOptions`/`ToServerWithOptions` (#9480) + Users providing a grpc.DialOption/grpc.ServerOption should now wrap them into + a generic option with `WithGrpcDialOption`/`WithGrpcServerOption`. + +- `componentprofiles`: Deprecates `DataTypeProfiles`. Use `SignalProfiles` instead. (#11204) +- `componentstatus`: Deprecates `NewInstanceID`, `AllPipelineIDs`, and `WithPipelines`. Use `NewInstanceIDWithPipelineIDs`, `AllPipelineIDsWithPipelineIDs`, and `WithPipelineIDs` instead. (#11204) +- `exporterqueue`: Deprecates `Settings.DataType`. Use `Settings.Signal` instead. (#11204) +- `service`: Deprecates `pipelines.Config`. Use `pipelines.ConfigWithPipelineID` instead. (#11204) +- `component`: Deprecates `DataType`, `DataTypeTraces`, `DataTypeMetrics`, and `DataTypeLogs`. Use `pipeline.Signal`, `SignalTraces`, `SignalMetrics`, and `SignalLogs` instead. (#11204) +- `service`: Deprecates service's implementation of `GetExporters` interface. Use `GetExportersWithSignal` instead. (#11249) +- `scraperhelper`: Deprecate NewScraperWithComponentType, should use NewScraper (#11159) + +### 🚀 New components 🚀 + +- `pipeline`: Adds new `pipeline` module to house the concept of pipeline ID and Signal. (#11209) + +### 💡 Enhancements 💡 + +- `pdata`: Add support to MoveTo for Map, allow avoiding copies (#11175) +- `options`: Avoid using private types in public APIs and also protect options to be implemented outside this module. (#11054) +- `mdatagen`: Avoid using private types in public APIs and also protect options to be implemented outside this module. (#11040) +- `consumertest`: Introduce SampleCount method in ProfilesSink struct. (#11225) +- `otlpreceiver`: Support profiles in the OTLP receiver (#11071) + ## v1.15.0/v0.109.0 ### 🛑 Breaking changes 🛑 diff --git a/CHANGELOG.md b/CHANGELOG.md index 67e004eb6df..fc4a2de994f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,66 @@ If you are looking for developer-facing changes, check out [CHANGELOG-API.md](./ +## v1.16.0/v0.110.0 + +### 🛑 Breaking changes 🛑 + +- `processorhelper`: Update incoming/outgoing metrics to a single metric with a `otel.signal` attributes. (#11144) + The following metrics were added in the previous version + - otelcol_processor_incoming_spans + - otelcol_processor_outgoing_spans + - otelcol_processor_incoming_metric_points + - otelcol_processor_outgoing_metric_points + - otelcol_processor_incoming_log_records + - otelcol_processor_outgoing_log_records + + They are being replaced with the following to more closely align with OTEP 259: + - otelcol_processor_incoming_items + - otelcol_processor_outgoing_items + +- `processorhelper`: Remove deprecated `[Traces|Metrics|Logs]`Inserted funcs (#11151) +- `config`: Mark UseLocalHostAsDefaultHostfeatureGate as stable (#11235) + +### 🚩 Deprecations 🚩 + +- `processorhelper`: deprecate accepted/refused/dropped metrics (#11201) + The following metrics are being deprecated as they were only used in a single + processor: + - `otelcol_processor_accepted_log_records` + - `otelcol_processor_accepted_metric_points` + - `otelcol_processor_accepted_spans` + - `otelcol_processor_dropped_log_records` + - `otelcol_processor_dropped_metric_points` + - `otelcol_processor_dropped_spans` + - `otelcol_processor_refused_log_records` + - `otelcol_processor_refused_metric_points` + - `otelcol_processor_refused_spans` + + +### 💡 Enhancements 💡 + +- `pdata`: Add support to MoveTo for Map, allow avoiding copies (#11175) +- `mdatagen`: Add stability field to telemetry metrics, allowing the generated description to include a stability string. (#11160) +- `confignet`: Mark module as Stable. (#9801) +- `confmap/provider/envprovider`: Support default values when env var is empty (#5228) +- `mdatagen`: mdatagen `validateMetrics()` support validate metrics in `telemetry.metric` (#10925) +- `service/telemetry`: Mark useOtelWithSDKConfigurationForInternalTelemetry as stable (#7532) +- `mdatagen`: Use cobra for the command, add version flag (#11196) + +### 🧰 Bug fixes 🧰 + +- `service`: Ensure process telemetry is registered when internal telemetry is configured with readers instead of an address. (#11093) +- `mdatagen`: Fix incorrect generation of metric tests with boolean attributes. (#11169) +- `otelcol`: Fix the Windows Event Log configuration when running the Collector as a Windows service. (#5297, #11051) +- `builder`: Honor build_tags in config (#11156) +- `builder`: Fix version for providers in the default config (#11123) +- `cmd/builder`: Temporarily disable strict versioning checks (#11129, #11152) + The strict versioning check may be enabled by default in a future version once all configuration providers are stabilized. + +- `confmap`: Fix loading config of a component from a different source. (#11154) + This issue only affected loading the whole component config, loading parts of a component config from a different source was working correctly. + + ## v1.15.0/v0.109.0 ### 🛑 Breaking changes 🛑 diff --git a/Makefile b/Makefile index 58b0335e895..404c97632a9 100644 --- a/Makefile +++ b/Makefile @@ -262,6 +262,7 @@ check-contrib: @$(MAKE) -C $(CONTRIB_PATH) for-all CMD="$(GOCMD) mod edit \ -replace go.opentelemetry.io/collector=$(CURDIR) \ -replace go.opentelemetry.io/collector/client=$(CURDIR)/client \ + -replace go.opentelemetry.io/collector/cmd/mdatagen=$(CURDIR)/cmd/mdatagen \ -replace go.opentelemetry.io/collector/component=$(CURDIR)/component \ -replace go.opentelemetry.io/collector/component/componentprofiles=$(CURDIR)/component/componentprofiles \ -replace go.opentelemetry.io/collector/component/componentstatus=$(CURDIR)/component/componentstatus \ @@ -333,6 +334,7 @@ restore-contrib: @$(MAKE) -C $(CONTRIB_PATH) for-all CMD="$(GOCMD) mod edit \ -dropreplace go.opentelemetry.io/collector \ -dropreplace go.opentelemetry.io/collector/client \ + -dropreplace go.opentelemetry.io/collector/cmd/mdatagen \ -dropreplace go.opentelemetry.io/collector/component \ -dropreplace go.opentelemetry.io/collector/component/componentprofiles \ -dropreplace go.opentelemetry.io/collector/component/componentstatus \ diff --git a/Makefile.Common b/Makefile.Common index 91cd57b2dc8..15c1407d446 100644 --- a/Makefile.Common +++ b/Makefile.Common @@ -36,9 +36,6 @@ MULTIMOD := $(TOOLS_BIN_DIR)/multimod PORTO := $(TOOLS_BIN_DIR)/porto SEMCONVGEN := $(TOOLS_BIN_DIR)/semconvgen SEMCONVKIT := $(TOOLS_BIN_DIR)/semconvkit -TESTIFYLINT := $(TOOLS_BIN_DIR)/testifylint - -TESTIFYLINT_OPT?= --enable-all .PHONY: install-tools install-tools: $(TOOLS_BIN_NAMES) @@ -91,9 +88,3 @@ impi: $(IMPI) .PHONY: moddownload moddownload: $(GOCMD) mod download - -.PHONY: testifylint-fix -testifylint-fix:$(TESTIFYLINT) - @echo "running $(TESTIFYLINT)" - @$(TESTIFYLINT) $(TESTIFYLINT_OPT) -fix ./... - diff --git a/VERSIONING.md b/VERSIONING.md index 8da5ba3ba23..68d69ee23fe 100644 --- a/VERSIONING.md +++ b/VERSIONING.md @@ -1,13 +1,42 @@ -# Versioning +# Versioning and stability -This document describes the versioning policy for this repository. This policy -is designed so that the following goal can be achieved: +The OpenTelemetry Collector SIG produces several artifacts for [a variety of audiences](CONTRIBUTING.md#target-audiences). This document describes the versioning and support policy for these artifacts. These policies are designed so that the following goal can be achieved: -**Users are provided a codebase of value that is stable and secure.** +**Users are provided software artifacts of value that are stable and secure.** -## Public API expectations +The policies are divided depending on the artifact's target audience. While an artifact is supported, [critical bugs](docs/release.md#bugfix-release-criteria) and security vulnerabilities MUST be addressed. The main criteria for the length of support for an artifact is how easy it is for an artifact's target audience to adapt to disruptive changes. -The following public API expectations apply to all modules in opentelemetry-collector and opentelemetry-collector-contrib. +These policies reflect the current consensus of the OpenTelemetry Collector SIG. They are subject to change as the project evolves. + +## Software artifacts for end users + +Software artifacts intended for [end users](CONTRIBUTING.md#end-users) of the OpenTelemetry Collector include +- Binary distributions of the OpenTelemetry Collector. +- Go modules that expose Collector components, such as receivers, processors, connectors, extensions and exporters. + +These artifacts are versioned according to the [semantic versioning v2.0.0](https://semver.org/) specification. + +### General considerations + +Binary distributions produced by the Collector SIG contain components and features with varying [levels of stability](README.md#stability-levels). We abide by the following principles to relate the Collector's version to the stability of its components and features: + +* The Collector's core framework behavior MUST be stable in order for a Collector distribution to be v1.0.0 or higher. +* Users can easily understand when they are opting in to use a component or feature that is not stable. + * The Collector MUST be configurable so that unstable components or features can be excluded ensuring that a fully stable configuration is possible. + * The Collector's telemetry (e.g. Collector logs) MUST provide the ability to identify usage of unstable components or features. + +### Long-term support after v1 + +The OpenTelemetry Collector SIG provides long-term support for stable binary distributions of the OpenTelemetry Collector and its components. The following policies apply to long-term support for any major version starting on v1: + +* A binary distribution of the OpenTelemetry Collector MUST be supported for a minimum of **one year** after the release of the next major version of said distribution. +* Components MUST be supported for a minimum of **6 months** after the release of the next major version of said component or after the component has been marked as deprecated. If a component has been deprecated for 6 months it MAY be removed from a binary distribution of the OpenTelemetry Collector. This does not imply a major version change in the Collector distribution. + +## Go modules + +Go modules are intended to be used by [component developers](CONTRIBUTING.md#component-developers) and [Collector library users](CONTRIBUTING.md#collector-library-users) of the OpenTelemetry Collector + +Unless otherwise specified, the following public API expectations apply to all modules in opentelemetry-collector and opentelemetry-collector-contrib. As a general rule, stability guarantees of modules versioned as `v1` or higher are aligned with [Go 1 compatibility promise](https://go.dev/doc/go1compat). ### General Go API considerations @@ -54,7 +83,7 @@ structure. must continue to be valid after a change to the validation rules, except when the configuration struct would cause an error on its intended usage (e.g. when calling a method or when passed to any method or function in any module under opentelemetry-collector). -## Versioning and module schema +### Module versioning and schema * Versioning of this project will be idiomatic of a Go project using [Go modules](https://golang.org/ref/mod#versions). @@ -135,3 +164,10 @@ on its intended usage (e.g. when calling a method or when passed to any method o * Contrib modules will be kept up to date with this project's releases. * GitHub releases will be made for all releases. * Go modules will be made available at Go package mirrors. + +### Long-term support after v1 + +The OpenTelemetry Collector SIG provides long-term support for stable Go modules. Support for modules depend on the module's [target audiences](CONTRIBUTING.md#target-audiences). The following policies apply to long-term support for any major version starting on v1: + +- Modules intended for **component developers** MUST be supported for a minimum of **1 year** after the release of the next major version of said module or after the module has been marked as deprecated. +- Modules intended for **Collector library users** MUST be supported for a minimum of **6 months** after the release of the next major version of said module or after the module has been marked as deprecated. diff --git a/client/go.mod b/client/go.mod index e657ff43e4f..f46dd128b60 100644 --- a/client/go.mod +++ b/client/go.mod @@ -4,8 +4,8 @@ go 1.22.0 require ( github.com/stretchr/testify v1.9.0 - go.opentelemetry.io/collector/consumer v0.109.0 - go.opentelemetry.io/collector/pdata v1.15.0 + go.opentelemetry.io/collector/consumer v0.110.0 + go.opentelemetry.io/collector/pdata v1.16.0 go.uber.org/goleak v1.3.0 ) @@ -18,11 +18,11 @@ require ( github.com/modern-go/reflect2 v1.0.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect go.uber.org/multierr v1.11.0 // indirect - golang.org/x/net v0.26.0 // indirect - golang.org/x/sys v0.21.0 // indirect - golang.org/x/text v0.16.0 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20240604185151-ef581f913117 // indirect - google.golang.org/grpc v1.66.2 // indirect + golang.org/x/net v0.28.0 // indirect + golang.org/x/sys v0.24.0 // indirect + golang.org/x/text v0.17.0 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240814211410-ddb44dafa142 // indirect + google.golang.org/grpc v1.67.0 // indirect google.golang.org/protobuf v1.34.2 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/client/go.sum b/client/go.sum index b0aa8e858e7..4a35b87c763 100644 --- a/client/go.sum +++ b/client/go.sum @@ -43,20 +43,20 @@ golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.26.0 h1:soB7SVo0PWrY4vPW/+ay0jKDNScG2X9wFeYlXIvJsOQ= -golang.org/x/net v0.26.0/go.mod h1:5YKkiSynbBIh3p6iOc/vibscux0x38BZDkn8sCUPxHE= +golang.org/x/net v0.28.0 h1:a9JDOJc5GMUJ0+UDqmLT86WiEy7iWyIhz8gz8E4e5hE= +golang.org/x/net v0.28.0/go.mod h1:yqtgsTWOOnlGLG9GFRrK3++bGOUEkNBoHZc8MEDWPNg= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.21.0 h1:rF+pYz3DAGSQAxAu1CbC7catZg4ebC4UIeIhKxBZvws= -golang.org/x/sys v0.21.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= -golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI= +golang.org/x/text v0.17.0 h1:XtiM5bkSOt+ewxlOE/aE/AKEHibwj/6gvWMl9Rsh0Qc= +golang.org/x/text v0.17.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= @@ -65,10 +65,10 @@ 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= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240604185151-ef581f913117 h1:1GBuWVLM/KMVUv1t1En5Gs+gFZCNd360GGb4sSxtrhU= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240604185151-ef581f913117/go.mod h1:EfXuqaE1J41VCDicxHzUDm+8rk+7ZdXzHV0IhO/I6s0= -google.golang.org/grpc v1.66.2 h1:3QdXkuq3Bkh7w+ywLdLvM56cmGvQHUMZpiCzt6Rqaoo= -google.golang.org/grpc v1.66.2/go.mod h1:s3/l6xSSCURdVfAnL+TqCNMyTDAGN6+lZeVxnZR128Y= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240814211410-ddb44dafa142 h1:e7S5W7MGGLaSu8j3YjdezkZ+m1/Nm0uRVRMEMGk26Xs= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240814211410-ddb44dafa142/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU= +google.golang.org/grpc v1.67.0 h1:IdH9y6PF5MPSdAntIcpjQ+tXO41pcQsfZV2RxtQgVcw= +google.golang.org/grpc v1.67.0/go.mod h1:1gLDyUQU7CTLJI90u3nXZ9ekeghjeM7pTDZlqFNg2AA= google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/cmd/builder/README.md b/cmd/builder/README.md index be4be596646..159ac167ae7 100644 --- a/cmd/builder/README.md +++ b/cmd/builder/README.md @@ -59,19 +59,19 @@ $ /tmp/dist/otelcol-custom --config=/tmp/otelcol.yaml There are two supported ways to install the builder: via the official releases (recommended) and through `go install`. -### Official releases +### Official releases -This is the recommended installation method. Download the binary for your respective platform under the ["Releases"](https://github.com/open-telemetry/opentelemetry-collector/releases?q=builder) page. +This is the recommended installation method. Download the binary for your respective platform from the ["Releases"](https://github.com/open-telemetry/opentelemetry-collector-releases/releases?q=cmd/builder) page. ### `go install` You need to have a `go` compiler in your PATH. Run the following command to install the latest version: -``` +```console go install go.opentelemetry.io/collector/cmd/builder@latest ``` -If installing through this method the binary will be called `builder`. Binaries installed through this method [will incorrectly show `dev` as their version](https://github.com/open-telemetry/opentelemetry-collector/issues/8691). +If installing through this method the binary will be called `builder`. ## Running @@ -80,7 +80,7 @@ You will need to specify at least one module (extension, exporter, receiver, pro To build a default collector configuration, you can use [this](../otelcorecol/builder-config.yaml) build configuration. ```console -$ ocb --config=builder-config.yaml +ocb --config=builder-config.yaml ``` Use `ocb --help` to learn about which flags are available. @@ -90,10 +90,12 @@ Use `ocb --help` to learn about which flags are available. To keep the debug symbols in the resulting OpenTelemetry Collector binary, set the configuration property `debug_compilation` to true. Then install `go-delve` and run OpenTelemetry Collector with `dlv` command as the following example: + ```bash # go install github.com/go-delve/delve/cmd/dlv@latest # ~/go/bin/dlv --listen=:2345 --headless=true --api-version=2 --accept-multiclient --log exec .otel-collector-binary -- --config otel-collector-config.yaml ``` + Finally, load the OpenTelemetry Collector as a project in the IDE, configure debug for Go ## Configuration @@ -101,7 +103,7 @@ Finally, load the OpenTelemetry Collector as a project in the IDE, configure deb The configuration file is composed of two main parts: `dist` and module types. All `dist` options can be specified via command line flags: ```console -$ ocb --config=config.yaml --name="my-otelcol" +ocb --config=config.yaml --name="my-otelcol" ``` The module types are specified at the top-level, and might be: `extensions`, `exporters`, `receivers` and `processors`. They all accept a list of components, and each component is required to have at least the `gomod` entry. When not specified, the `import` value is inferred from the `gomod`. When not specified, the `name` is inferred from the `import`. @@ -157,29 +159,32 @@ For instance, a code generation step could execute ```console ocb --skip-compilation --config=config.yaml ``` + then commit the code in a git repo. A CI can sync the code and execute + ```console ocb --skip-generate --skip-get-modules --config=config.yaml ``` + to only execute the compilation step. ### Strict versioning checks The builder checks the relevant `go.mod` -file for the following things after `go get`ing all components and calling +file for the following things after `go get`ing all components and calling `go mod tidy`: -1. The `dist::otelcol_version` field in the build configuration must have - matching major and minor versions as the core library version calculated by - the Go toolchain, considering all components. A mismatch could happen, for - example, when the builder or one of the components depends on a newer release +1. The `dist::otelcol_version` field in the build configuration must have + matching major and minor versions as the core library version calculated by + the Go toolchain, considering all components. A mismatch could happen, for + example, when the builder or one of the components depends on a newer release of the core collector library. -2. For each component in the build configuration, the major and minor versions +2. For each component in the build configuration, the major and minor versions included in the `gomod` module specifier must match the one calculated by the Go toolchain, considering all components. A mismatch could happen, for example, when the enclosing Go module uses a newer release of the core collector library. - -The `--skip-strict-versioning` flag disables these versioning checks. -This flag is available temporarily and + +The `--skip-strict-versioning` flag disables these versioning checks. +This flag is available temporarily and **will be removed in a future minor version**. diff --git a/cmd/builder/internal/builder/config.go b/cmd/builder/internal/builder/config.go index 8de7ed3d82c..d92806bac28 100644 --- a/cmd/builder/internal/builder/config.go +++ b/cmd/builder/internal/builder/config.go @@ -17,7 +17,7 @@ import ( "go.uber.org/zap" ) -const defaultOtelColVersion = "0.109.0" +const defaultOtelColVersion = "0.110.0" // ErrMissingGoMod indicates an empty gomod field var ErrMissingGoMod = errors.New("missing gomod specification for module") diff --git a/cmd/builder/internal/builder/main_test.go b/cmd/builder/internal/builder/main_test.go index fe7bb1c09f8..85a2eaf6ec5 100644 --- a/cmd/builder/internal/builder/main_test.go +++ b/cmd/builder/internal/builder/main_test.go @@ -78,6 +78,8 @@ var ( "/extension/zpagesextension", "/featuregate", "/internal/globalgates", + "/internal/globalsignal", + "/pipeline", "/processor", "/processor/batchprocessor", "/processor/memorylimiterprocessor", diff --git a/cmd/builder/internal/config/default.yaml b/cmd/builder/internal/config/default.yaml index 07c8a820a64..d7b7a011acd 100644 --- a/cmd/builder/internal/config/default.yaml +++ b/cmd/builder/internal/config/default.yaml @@ -10,30 +10,31 @@ dist: module: go.opentelemetry.io/collector/cmd/otelcorecol name: otelcorecol description: Local OpenTelemetry Collector binary, testing only. - version: 0.109.0-dev - otelcol_version: 0.109.0 + version: 0.110.0-dev + otelcol_version: 0.110.0 receivers: - - gomod: go.opentelemetry.io/collector/receiver/nopreceiver v0.109.0 - - gomod: go.opentelemetry.io/collector/receiver/otlpreceiver v0.109.0 + - gomod: go.opentelemetry.io/collector/receiver/nopreceiver v0.110.0 + - gomod: go.opentelemetry.io/collector/receiver/otlpreceiver v0.110.0 exporters: - - gomod: go.opentelemetry.io/collector/exporter/debugexporter v0.109.0 - - gomod: go.opentelemetry.io/collector/exporter/loggingexporter v0.109.0 - - gomod: go.opentelemetry.io/collector/exporter/nopexporter v0.109.0 - - gomod: go.opentelemetry.io/collector/exporter/otlpexporter v0.109.0 - - gomod: go.opentelemetry.io/collector/exporter/otlphttpexporter v0.109.0 + - gomod: go.opentelemetry.io/collector/exporter/debugexporter v0.110.0 + - gomod: go.opentelemetry.io/collector/exporter/loggingexporter v0.110.0 + - gomod: go.opentelemetry.io/collector/exporter/nopexporter v0.110.0 + - gomod: go.opentelemetry.io/collector/exporter/otlpexporter v0.110.0 + - gomod: go.opentelemetry.io/collector/exporter/otlphttpexporter v0.110.0 extensions: - - gomod: go.opentelemetry.io/collector/extension/memorylimiterextension v0.109.0 - - gomod: go.opentelemetry.io/collector/extension/zpagesextension v0.109.0 + - gomod: go.opentelemetry.io/collector/extension/memorylimiterextension v0.110.0 + - gomod: go.opentelemetry.io/collector/extension/zpagesextension v0.110.0 processors: - - gomod: go.opentelemetry.io/collector/processor/batchprocessor v0.109.0 - - gomod: go.opentelemetry.io/collector/processor/memorylimiterprocessor v0.109.0 + - gomod: go.opentelemetry.io/collector/processor/batchprocessor v0.110.0 + - gomod: go.opentelemetry.io/collector/processor/memorylimiterprocessor v0.110.0 connectors: - - gomod: go.opentelemetry.io/collector/connector/forwardconnector v0.109.0 + - gomod: go.opentelemetry.io/collector/connector/forwardconnector v0.110.0 providers: - - gomod: go.opentelemetry.io/collector/confmap/provider/envprovider v1.15.0 - - gomod: go.opentelemetry.io/collector/confmap/provider/fileprovider v1.15.0 - - gomod: go.opentelemetry.io/collector/confmap/provider/httpprovider v0.109.0 - - gomod: go.opentelemetry.io/collector/confmap/provider/httpsprovider v0.109.0 - - gomod: go.opentelemetry.io/collector/confmap/provider/yamlprovider v0.109.0 + - gomod: go.opentelemetry.io/collector/confmap/provider/envprovider v1.16.0 + - gomod: go.opentelemetry.io/collector/confmap/provider/fileprovider v1.16.0 + - gomod: go.opentelemetry.io/collector/confmap/provider/httpprovider v0.110.0 + - gomod: go.opentelemetry.io/collector/confmap/provider/httpsprovider v0.110.0 + - gomod: go.opentelemetry.io/collector/confmap/provider/yamlprovider v0.110.0 + diff --git a/cmd/builder/internal/version.go b/cmd/builder/internal/version.go index 2e1f39e9f44..9aa5e1511b7 100644 --- a/cmd/builder/internal/version.go +++ b/cmd/builder/internal/version.go @@ -16,8 +16,10 @@ var ( func init() { // the second returned value is a boolean, which is true if the binaries are built with module support. - info, _ := debug.ReadBuildInfo() - version = info.Main.Version + if version == "" { + info, _ := debug.ReadBuildInfo() + version = info.Main.Version + } } func versionCommand() *cobra.Command { diff --git a/cmd/builder/test/core.builder.yaml b/cmd/builder/test/core.builder.yaml index 866a625a91b..e6aab6c3c6b 100644 --- a/cmd/builder/test/core.builder.yaml +++ b/cmd/builder/test/core.builder.yaml @@ -1,15 +1,15 @@ dist: module: go.opentelemetry.io/collector/builder/test/core - otelcol_version: 0.109.0 + otelcol_version: 0.110.0 extensions: - - gomod: go.opentelemetry.io/collector/extension/zpagesextension v0.109.0 + - gomod: go.opentelemetry.io/collector/extension/zpagesextension v0.110.0 receivers: - - gomod: go.opentelemetry.io/collector/receiver/otlpreceiver v0.109.0 + - gomod: go.opentelemetry.io/collector/receiver/otlpreceiver v0.110.0 exporters: - - gomod: go.opentelemetry.io/collector/exporter/debugexporter v0.109.0 + - gomod: go.opentelemetry.io/collector/exporter/debugexporter v0.110.0 replaces: - go.opentelemetry.io/collector => ${WORKSPACE_DIR} @@ -49,11 +49,13 @@ replaces: - go.opentelemetry.io/collector/extension/zpagesextension => ${WORKSPACE_DIR}/extension/zpagesextension - go.opentelemetry.io/collector/featuregate => ${WORKSPACE_DIR}/featuregate - go.opentelemetry.io/collector/internal/globalgates => ${WORKSPACE_DIR}/internal/globalgates + - go.opentelemetry.io/collector/internal/globalsignal => ${WORKSPACE_DIR}/internal/globalsignal - go.opentelemetry.io/collector/otelcol => ${WORKSPACE_DIR}/otelcol - go.opentelemetry.io/collector/otelcol/otelcoltest => ${WORKSPACE_DIR}/otelcol/otelcoltest - go.opentelemetry.io/collector/pdata => ${WORKSPACE_DIR}/pdata - go.opentelemetry.io/collector/pdata/pprofile => ${WORKSPACE_DIR}/pdata/pprofile - go.opentelemetry.io/collector/pdata/testdata => ${WORKSPACE_DIR}/pdata/testdata + - go.opentelemetry.io/collector/pipeline => ${WORKSPACE_DIR}/pipeline - go.opentelemetry.io/collector/processor => ${WORKSPACE_DIR}/processor - go.opentelemetry.io/collector/processor/processorprofiles => ${WORKSPACE_DIR}/processor/processorprofiles - go.opentelemetry.io/collector/receiver => ${WORKSPACE_DIR}/receiver diff --git a/cmd/mdatagen/go.mod b/cmd/mdatagen/go.mod index 300b5c6a8d6..eaa0c31bf41 100644 --- a/cmd/mdatagen/go.mod +++ b/cmd/mdatagen/go.mod @@ -6,16 +6,16 @@ require ( github.com/google/go-cmp v0.6.0 github.com/spf13/cobra v1.8.1 github.com/stretchr/testify v1.9.0 - go.opentelemetry.io/collector/component v0.109.0 - go.opentelemetry.io/collector/config/configtelemetry v0.109.0 - go.opentelemetry.io/collector/confmap v1.15.0 - go.opentelemetry.io/collector/confmap/provider/fileprovider v1.15.0 - go.opentelemetry.io/collector/consumer v0.109.0 - go.opentelemetry.io/collector/consumer/consumertest v0.109.0 - go.opentelemetry.io/collector/filter v0.109.0 - go.opentelemetry.io/collector/pdata v1.15.0 - go.opentelemetry.io/collector/receiver v0.109.0 - go.opentelemetry.io/collector/semconv v0.109.0 + go.opentelemetry.io/collector/component v0.110.0 + go.opentelemetry.io/collector/config/configtelemetry v0.110.0 + go.opentelemetry.io/collector/confmap v1.16.0 + go.opentelemetry.io/collector/confmap/provider/fileprovider v1.16.0 + go.opentelemetry.io/collector/consumer v0.110.0 + go.opentelemetry.io/collector/consumer/consumertest v0.110.0 + go.opentelemetry.io/collector/filter v0.110.0 + go.opentelemetry.io/collector/pdata v1.16.0 + go.opentelemetry.io/collector/receiver v0.110.0 + go.opentelemetry.io/collector/semconv v0.110.0 go.opentelemetry.io/otel/metric v1.30.0 go.opentelemetry.io/otel/sdk/metric v1.30.0 go.opentelemetry.io/otel/trace v1.30.0 @@ -42,16 +42,19 @@ require ( github.com/modern-go/reflect2 v1.0.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/spf13/pflag v1.0.5 // indirect - go.opentelemetry.io/collector/consumer/consumerprofiles v0.109.0 // indirect - go.opentelemetry.io/collector/pdata/pprofile v0.109.0 // indirect - go.opentelemetry.io/collector/receiver/receiverprofiles v0.109.0 // indirect + go.opentelemetry.io/collector/component/componentprofiles v0.110.0 // indirect + go.opentelemetry.io/collector/consumer/consumerprofiles v0.110.0 // indirect + go.opentelemetry.io/collector/internal/globalsignal v0.110.0 // indirect + go.opentelemetry.io/collector/pdata/pprofile v0.110.0 // indirect + go.opentelemetry.io/collector/pipeline v0.110.0 // indirect + go.opentelemetry.io/collector/receiver/receiverprofiles v0.110.0 // indirect go.opentelemetry.io/otel v1.30.0 // indirect go.opentelemetry.io/otel/sdk v1.30.0 // indirect go.uber.org/multierr v1.11.0 // indirect golang.org/x/net v0.28.0 // indirect golang.org/x/sys v0.25.0 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240822170219-fc7c04adadcd // indirect - google.golang.org/grpc v1.66.2 // indirect + google.golang.org/grpc v1.67.0 // indirect google.golang.org/protobuf v1.34.2 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) @@ -89,3 +92,9 @@ replace go.opentelemetry.io/collector/consumer/consumerprofiles => ../../consume replace go.opentelemetry.io/collector/consumer/consumertest => ../../consumer/consumertest replace go.opentelemetry.io/collector/receiver/receiverprofiles => ../../receiver/receiverprofiles + +replace go.opentelemetry.io/collector/pipeline => ../../pipeline + +replace go.opentelemetry.io/collector/internal/globalsignal => ../../internal/globalsignal + +replace go.opentelemetry.io/collector/component/componentprofiles => ../../component/componentprofiles diff --git a/cmd/mdatagen/go.sum b/cmd/mdatagen/go.sum index 7dddf67f2b6..b953f43e22c 100644 --- a/cmd/mdatagen/go.sum +++ b/cmd/mdatagen/go.sum @@ -105,8 +105,8 @@ golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8T golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/genproto/googleapis/rpc v0.0.0-20240822170219-fc7c04adadcd h1:6TEm2ZxXoQmFWFlt1vNxvVOa1Q0dXFQD1m/rYjXmS0E= google.golang.org/genproto/googleapis/rpc v0.0.0-20240822170219-fc7c04adadcd/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU= -google.golang.org/grpc v1.66.2 h1:3QdXkuq3Bkh7w+ywLdLvM56cmGvQHUMZpiCzt6Rqaoo= -google.golang.org/grpc v1.66.2/go.mod h1:s3/l6xSSCURdVfAnL+TqCNMyTDAGN6+lZeVxnZR128Y= +google.golang.org/grpc v1.67.0 h1:IdH9y6PF5MPSdAntIcpjQ+tXO41pcQsfZV2RxtQgVcw= +google.golang.org/grpc v1.67.0/go.mod h1:1gLDyUQU7CTLJI90u3nXZ9ekeghjeM7pTDZlqFNg2AA= google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/cmd/mdatagen/internal/templates/component_test.go.tmpl b/cmd/mdatagen/internal/templates/component_test.go.tmpl index 734286ebff1..c40f3f39d07 100644 --- a/cmd/mdatagen/internal/templates/component_test.go.tmpl +++ b/cmd/mdatagen/internal/templates/component_test.go.tmpl @@ -44,6 +44,7 @@ import ( "go.opentelemetry.io/collector/connector/connectortest" "go.opentelemetry.io/collector/consumer" "go.opentelemetry.io/collector/consumer/consumertest" + "go.opentelemetry.io/collector/pipeline" {{- end }} {{- if or isExporter isProcessor }} "go.opentelemetry.io/collector/pdata/pcommon" @@ -372,7 +373,7 @@ func TestComponentLifecycle(t *testing.T) { { name: "logs_to_logs", createFn: func(ctx context.Context, set connector.Settings, cfg component.Config) (component.Component, error) { - router := connector.NewLogsRouter(map[component.ID]consumer.Logs{component.NewID(component.DataTypeLogs): consumertest.NewNop()}) + router := connector.NewLogsRouter(map[pipeline.ID]consumer.Logs{pipeline.NewID(pipeline.SignalLogs): consumertest.NewNop()}) return factory.CreateLogsToLogs(ctx, set, cfg, router) }, }, @@ -381,7 +382,7 @@ func TestComponentLifecycle(t *testing.T) { { name: "logs_to_metrics", createFn: func(ctx context.Context, set connector.Settings, cfg component.Config) (component.Component, error) { - router := connector.NewMetricsRouter(map[component.ID]consumer.Metrics{component.NewID(component.DataTypeMetrics): consumertest.NewNop()}) + router := connector.NewMetricsRouter(map[pipeline.ID]consumer.Metrics{pipeline.NewID(pipeline.SignalMetrics): consumertest.NewNop()}) return factory.CreateLogsToMetrics(ctx, set, cfg, router) }, }, @@ -390,7 +391,7 @@ func TestComponentLifecycle(t *testing.T) { { name: "logs_to_traces", createFn: func(ctx context.Context, set connector.Settings, cfg component.Config) (component.Component, error) { - router := connector.NewTracesRouter(map[component.ID]consumer.Traces{component.NewID(component.DataTypeTraces): consumertest.NewNop()}) + router := connector.NewTracesRouter(map[pipeline.ID]consumer.Traces{pipeline.NewID(pipeline.SignalTraces): consumertest.NewNop()}) return factory.CreateLogsToTraces(ctx, set, cfg, router) }, }, @@ -399,7 +400,7 @@ func TestComponentLifecycle(t *testing.T) { { name: "metrics_to_logs", createFn: func(ctx context.Context, set connector.Settings, cfg component.Config) (component.Component, error) { - router := connector.NewLogsRouter(map[component.ID]consumer.Logs{component.NewID(component.DataTypeLogs): consumertest.NewNop()}) + router := connector.NewLogsRouter(map[pipeline.ID]consumer.Logs{pipeline.NewID(pipeline.SignalLogs): consumertest.NewNop()}) return factory.CreateMetricsToLogs(ctx, set, cfg, router) }, }, @@ -408,7 +409,7 @@ func TestComponentLifecycle(t *testing.T) { { name: "metrics_to_metrics", createFn: func(ctx context.Context, set connector.Settings, cfg component.Config) (component.Component, error) { - router := connector.NewMetricsRouter(map[component.ID]consumer.Metrics{component.NewID(component.DataTypeMetrics): consumertest.NewNop()}) + router := connector.NewMetricsRouter(map[pipeline.ID]consumer.Metrics{pipeline.NewID(pipeline.SignalMetrics): consumertest.NewNop()}) return factory.CreateMetricsToMetrics(ctx, set, cfg, router) }, }, @@ -417,7 +418,7 @@ func TestComponentLifecycle(t *testing.T) { { name: "metrics_to_traces", createFn: func(ctx context.Context, set connector.Settings, cfg component.Config) (component.Component, error) { - router := connector.NewTracesRouter(map[component.ID]consumer.Traces{component.NewID(component.DataTypeTraces): consumertest.NewNop()}) + router := connector.NewTracesRouter(map[pipeline.ID]consumer.Traces{pipeline.NewID(pipeline.SignalTraces): consumertest.NewNop()}) return factory.CreateMetricsToTraces(ctx, set, cfg, router) }, }, @@ -426,7 +427,7 @@ func TestComponentLifecycle(t *testing.T) { { name: "traces_to_logs", createFn: func(ctx context.Context, set connector.Settings, cfg component.Config) (component.Component, error) { - router := connector.NewLogsRouter(map[component.ID]consumer.Logs{component.NewID(component.DataTypeLogs): consumertest.NewNop()}) + router := connector.NewLogsRouter(map[pipeline.ID]consumer.Logs{pipeline.NewID(pipeline.SignalLogs): consumertest.NewNop()}) return factory.CreateTracesToLogs(ctx, set, cfg, router) }, }, @@ -435,7 +436,7 @@ func TestComponentLifecycle(t *testing.T) { { name: "traces_to_metrics", createFn: func(ctx context.Context, set connector.Settings, cfg component.Config) (component.Component, error) { - router := connector.NewMetricsRouter(map[component.ID]consumer.Metrics{component.NewID(component.DataTypeMetrics): consumertest.NewNop()}) + router := connector.NewMetricsRouter(map[pipeline.ID]consumer.Metrics{pipeline.NewID(pipeline.SignalMetrics): consumertest.NewNop()}) return factory.CreateTracesToMetrics(ctx, set, cfg, router) }, }, @@ -444,7 +445,7 @@ func TestComponentLifecycle(t *testing.T) { { name: "traces_to_traces", createFn: func(ctx context.Context, set connector.Settings, cfg component.Config) (component.Component, error) { - router := connector.NewTracesRouter(map[component.ID]consumer.Traces{component.NewID(component.DataTypeTraces): consumertest.NewNop()}) + router := connector.NewTracesRouter(map[pipeline.ID]consumer.Traces{pipeline.NewID(pipeline.SignalTraces): consumertest.NewNop()}) return factory.CreateTracesToTraces(ctx, set, cfg, router) }, }, diff --git a/cmd/otelcorecol/builder-config.yaml b/cmd/otelcorecol/builder-config.yaml index b5a726e374b..e3f58c89e34 100644 --- a/cmd/otelcorecol/builder-config.yaml +++ b/cmd/otelcorecol/builder-config.yaml @@ -10,37 +10,38 @@ dist: module: go.opentelemetry.io/collector/cmd/otelcorecol name: otelcorecol description: Local OpenTelemetry Collector binary, testing only. - version: 0.109.0-dev - otelcol_version: 0.109.0 + version: 0.110.0-dev + otelcol_version: 0.110.0 receivers: - - gomod: go.opentelemetry.io/collector/receiver/nopreceiver v0.109.0 - - gomod: go.opentelemetry.io/collector/receiver/otlpreceiver v0.109.0 + - gomod: go.opentelemetry.io/collector/receiver/nopreceiver v0.110.0 + - gomod: go.opentelemetry.io/collector/receiver/otlpreceiver v0.110.0 exporters: - - gomod: go.opentelemetry.io/collector/exporter/debugexporter v0.109.0 - - gomod: go.opentelemetry.io/collector/exporter/loggingexporter v0.109.0 - - gomod: go.opentelemetry.io/collector/exporter/nopexporter v0.109.0 - - gomod: go.opentelemetry.io/collector/exporter/otlpexporter v0.109.0 - - gomod: go.opentelemetry.io/collector/exporter/otlphttpexporter v0.109.0 + - gomod: go.opentelemetry.io/collector/exporter/debugexporter v0.110.0 + - gomod: go.opentelemetry.io/collector/exporter/loggingexporter v0.110.0 + - gomod: go.opentelemetry.io/collector/exporter/nopexporter v0.110.0 + - gomod: go.opentelemetry.io/collector/exporter/otlpexporter v0.110.0 + - gomod: go.opentelemetry.io/collector/exporter/otlphttpexporter v0.110.0 extensions: - - gomod: go.opentelemetry.io/collector/extension/memorylimiterextension v0.109.0 - - gomod: go.opentelemetry.io/collector/extension/zpagesextension v0.109.0 + - gomod: go.opentelemetry.io/collector/extension/memorylimiterextension v0.110.0 + - gomod: go.opentelemetry.io/collector/extension/zpagesextension v0.110.0 processors: - - gomod: go.opentelemetry.io/collector/processor/batchprocessor v0.109.0 - - gomod: go.opentelemetry.io/collector/processor/memorylimiterprocessor v0.109.0 + - gomod: go.opentelemetry.io/collector/processor/batchprocessor v0.110.0 + - gomod: go.opentelemetry.io/collector/processor/memorylimiterprocessor v0.110.0 connectors: - - gomod: go.opentelemetry.io/collector/connector/forwardconnector v0.109.0 + - gomod: go.opentelemetry.io/collector/connector/forwardconnector v0.110.0 providers: - - gomod: go.opentelemetry.io/collector/confmap/provider/envprovider v1.15.0 - - gomod: go.opentelemetry.io/collector/confmap/provider/fileprovider v1.15.0 - - gomod: go.opentelemetry.io/collector/confmap/provider/httpprovider v0.109.0 - - gomod: go.opentelemetry.io/collector/confmap/provider/httpsprovider v0.109.0 - - gomod: go.opentelemetry.io/collector/confmap/provider/yamlprovider v0.109.0 + - gomod: go.opentelemetry.io/collector/confmap/provider/envprovider v1.16.0 + - gomod: go.opentelemetry.io/collector/confmap/provider/fileprovider v1.16.0 + - gomod: go.opentelemetry.io/collector/confmap/provider/httpprovider v0.110.0 + - gomod: go.opentelemetry.io/collector/confmap/provider/httpsprovider v0.110.0 + - gomod: go.opentelemetry.io/collector/confmap/provider/yamlprovider v0.110.0 replaces: - go.opentelemetry.io/collector => ../../ - go.opentelemetry.io/collector/internal/globalgates => ../../internal/globalgates + - go.opentelemetry.io/collector/internal/globalsignal => ../../internal/globalsignal - go.opentelemetry.io/collector/client => ../../client - go.opentelemetry.io/collector/otelcol => ../../otelcol - go.opentelemetry.io/collector/component => ../../component @@ -85,6 +86,7 @@ replaces: - go.opentelemetry.io/collector/pdata => ../../pdata - go.opentelemetry.io/collector/pdata/testdata => ../../pdata/testdata - go.opentelemetry.io/collector/pdata/pprofile => ../../pdata/pprofile + - go.opentelemetry.io/collector/pipeline => ../../pipeline - go.opentelemetry.io/collector/processor => ../../processor - go.opentelemetry.io/collector/processor/batchprocessor => ../../processor/batchprocessor - go.opentelemetry.io/collector/processor/memorylimiterprocessor => ../../processor/memorylimiterprocessor diff --git a/cmd/otelcorecol/components.go b/cmd/otelcorecol/components.go index 0340fe55519..aa0858060ef 100644 --- a/cmd/otelcorecol/components.go +++ b/cmd/otelcorecol/components.go @@ -36,8 +36,8 @@ func components() (otelcol.Factories, error) { return otelcol.Factories{}, err } factories.ExtensionModules = make(map[component.Type]string, len(factories.Extensions)) - factories.ExtensionModules[memorylimiterextension.NewFactory().Type()] = "go.opentelemetry.io/collector/extension/memorylimiterextension v0.109.0" - factories.ExtensionModules[zpagesextension.NewFactory().Type()] = "go.opentelemetry.io/collector/extension/zpagesextension v0.109.0" + factories.ExtensionModules[memorylimiterextension.NewFactory().Type()] = "go.opentelemetry.io/collector/extension/memorylimiterextension v0.110.0" + factories.ExtensionModules[zpagesextension.NewFactory().Type()] = "go.opentelemetry.io/collector/extension/zpagesextension v0.110.0" factories.Receivers, err = receiver.MakeFactoryMap( nopreceiver.NewFactory(), @@ -47,8 +47,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.109.0" - factories.ReceiverModules[otlpreceiver.NewFactory().Type()] = "go.opentelemetry.io/collector/receiver/otlpreceiver v0.109.0" + factories.ReceiverModules[nopreceiver.NewFactory().Type()] = "go.opentelemetry.io/collector/receiver/nopreceiver v0.110.0" + factories.ReceiverModules[otlpreceiver.NewFactory().Type()] = "go.opentelemetry.io/collector/receiver/otlpreceiver v0.110.0" factories.Exporters, err = exporter.MakeFactoryMap( debugexporter.NewFactory(), @@ -61,11 +61,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.109.0" - factories.ExporterModules[loggingexporter.NewFactory().Type()] = "go.opentelemetry.io/collector/exporter/loggingexporter v0.109.0" - factories.ExporterModules[nopexporter.NewFactory().Type()] = "go.opentelemetry.io/collector/exporter/nopexporter v0.109.0" - factories.ExporterModules[otlpexporter.NewFactory().Type()] = "go.opentelemetry.io/collector/exporter/otlpexporter v0.109.0" - factories.ExporterModules[otlphttpexporter.NewFactory().Type()] = "go.opentelemetry.io/collector/exporter/otlphttpexporter v0.109.0" + factories.ExporterModules[debugexporter.NewFactory().Type()] = "go.opentelemetry.io/collector/exporter/debugexporter v0.110.0" + factories.ExporterModules[loggingexporter.NewFactory().Type()] = "go.opentelemetry.io/collector/exporter/loggingexporter v0.110.0" + factories.ExporterModules[nopexporter.NewFactory().Type()] = "go.opentelemetry.io/collector/exporter/nopexporter v0.110.0" + factories.ExporterModules[otlpexporter.NewFactory().Type()] = "go.opentelemetry.io/collector/exporter/otlpexporter v0.110.0" + factories.ExporterModules[otlphttpexporter.NewFactory().Type()] = "go.opentelemetry.io/collector/exporter/otlphttpexporter v0.110.0" factories.Processors, err = processor.MakeFactoryMap( batchprocessor.NewFactory(), @@ -75,8 +75,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.109.0" - factories.ProcessorModules[memorylimiterprocessor.NewFactory().Type()] = "go.opentelemetry.io/collector/processor/memorylimiterprocessor v0.109.0" + factories.ProcessorModules[batchprocessor.NewFactory().Type()] = "go.opentelemetry.io/collector/processor/batchprocessor v0.110.0" + factories.ProcessorModules[memorylimiterprocessor.NewFactory().Type()] = "go.opentelemetry.io/collector/processor/memorylimiterprocessor v0.110.0" factories.Connectors, err = connector.MakeFactoryMap( forwardconnector.NewFactory(), @@ -85,7 +85,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.109.0" + factories.ConnectorModules[forwardconnector.NewFactory().Type()] = "go.opentelemetry.io/collector/connector/forwardconnector v0.110.0" return factories, nil } diff --git a/cmd/otelcorecol/go.mod b/cmd/otelcorecol/go.mod index cc72b0ca351..0854c01ffad 100644 --- a/cmd/otelcorecol/go.mod +++ b/cmd/otelcorecol/go.mod @@ -7,31 +7,31 @@ go 1.22.0 toolchain go1.22.7 require ( - go.opentelemetry.io/collector/component v0.109.0 - go.opentelemetry.io/collector/confmap v1.15.0 - go.opentelemetry.io/collector/confmap/provider/envprovider v1.15.0 - go.opentelemetry.io/collector/confmap/provider/fileprovider v1.15.0 - go.opentelemetry.io/collector/confmap/provider/httpprovider v0.109.0 - go.opentelemetry.io/collector/confmap/provider/httpsprovider v0.109.0 - go.opentelemetry.io/collector/confmap/provider/yamlprovider v0.109.0 - go.opentelemetry.io/collector/connector v0.109.0 - go.opentelemetry.io/collector/connector/forwardconnector v0.109.0 - go.opentelemetry.io/collector/exporter v0.109.0 - go.opentelemetry.io/collector/exporter/debugexporter v0.109.0 - go.opentelemetry.io/collector/exporter/loggingexporter v0.109.0 - go.opentelemetry.io/collector/exporter/nopexporter v0.109.0 - go.opentelemetry.io/collector/exporter/otlpexporter v0.109.0 - go.opentelemetry.io/collector/exporter/otlphttpexporter v0.109.0 - go.opentelemetry.io/collector/extension v0.109.0 - go.opentelemetry.io/collector/extension/memorylimiterextension v0.109.0 - go.opentelemetry.io/collector/extension/zpagesextension v0.109.0 - go.opentelemetry.io/collector/otelcol v0.109.0 - go.opentelemetry.io/collector/processor v0.109.0 - go.opentelemetry.io/collector/processor/batchprocessor v0.109.0 - go.opentelemetry.io/collector/processor/memorylimiterprocessor v0.109.0 - go.opentelemetry.io/collector/receiver v0.109.0 - go.opentelemetry.io/collector/receiver/nopreceiver v0.109.0 - go.opentelemetry.io/collector/receiver/otlpreceiver v0.109.0 + go.opentelemetry.io/collector/component v0.110.0 + go.opentelemetry.io/collector/confmap v1.16.0 + go.opentelemetry.io/collector/confmap/provider/envprovider v1.16.0 + go.opentelemetry.io/collector/confmap/provider/fileprovider v1.16.0 + go.opentelemetry.io/collector/confmap/provider/httpprovider v0.110.0 + go.opentelemetry.io/collector/confmap/provider/httpsprovider v0.110.0 + go.opentelemetry.io/collector/confmap/provider/yamlprovider v0.110.0 + go.opentelemetry.io/collector/connector v0.110.0 + go.opentelemetry.io/collector/connector/forwardconnector v0.110.0 + go.opentelemetry.io/collector/exporter v0.110.0 + go.opentelemetry.io/collector/exporter/debugexporter v0.110.0 + go.opentelemetry.io/collector/exporter/loggingexporter v0.110.0 + go.opentelemetry.io/collector/exporter/nopexporter v0.110.0 + go.opentelemetry.io/collector/exporter/otlpexporter v0.110.0 + go.opentelemetry.io/collector/exporter/otlphttpexporter v0.110.0 + go.opentelemetry.io/collector/extension v0.110.0 + go.opentelemetry.io/collector/extension/memorylimiterextension v0.110.0 + go.opentelemetry.io/collector/extension/zpagesextension v0.110.0 + go.opentelemetry.io/collector/otelcol v0.110.0 + go.opentelemetry.io/collector/processor v0.110.0 + go.opentelemetry.io/collector/processor/batchprocessor v0.110.0 + go.opentelemetry.io/collector/processor/memorylimiterprocessor v0.110.0 + go.opentelemetry.io/collector/receiver v0.110.0 + go.opentelemetry.io/collector/receiver/nopreceiver v0.110.0 + go.opentelemetry.io/collector/receiver/otlpreceiver v0.110.0 golang.org/x/sys v0.25.0 ) @@ -53,7 +53,7 @@ require ( 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/klauspost/compress v1.17.10 // 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 @@ -79,37 +79,39 @@ 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.109.0 // indirect - go.opentelemetry.io/collector/client v1.15.0 // indirect - go.opentelemetry.io/collector/component/componentprofiles v0.109.0 // indirect - go.opentelemetry.io/collector/component/componentstatus v0.109.0 // indirect - go.opentelemetry.io/collector/config/configauth v0.109.0 // indirect - go.opentelemetry.io/collector/config/configcompression v1.15.0 // indirect - go.opentelemetry.io/collector/config/configgrpc v0.109.0 // indirect - go.opentelemetry.io/collector/config/confighttp v0.109.0 // indirect - go.opentelemetry.io/collector/config/confignet v0.109.0 // indirect - go.opentelemetry.io/collector/config/configopaque v1.15.0 // indirect - go.opentelemetry.io/collector/config/configretry v1.15.0 // indirect - go.opentelemetry.io/collector/config/configtelemetry v0.109.0 // indirect - go.opentelemetry.io/collector/config/configtls v1.15.0 // indirect - go.opentelemetry.io/collector/config/internal v0.109.1-0.20240916143658-74729e731d3b // indirect - go.opentelemetry.io/collector/connector/connectorprofiles v0.109.0 // indirect - go.opentelemetry.io/collector/consumer v0.109.0 // indirect - go.opentelemetry.io/collector/consumer/consumerprofiles v0.109.0 // indirect - go.opentelemetry.io/collector/consumer/consumertest v0.109.0 // indirect - go.opentelemetry.io/collector/exporter/exporterprofiles v0.109.0 // indirect - go.opentelemetry.io/collector/extension/auth v0.109.0 // indirect - go.opentelemetry.io/collector/extension/experimental/storage v0.109.0 // indirect - go.opentelemetry.io/collector/extension/extensioncapabilities v0.109.0 // indirect - go.opentelemetry.io/collector/featuregate v1.15.0 // indirect - go.opentelemetry.io/collector/internal/globalgates v0.109.0 // indirect - go.opentelemetry.io/collector/pdata v1.15.0 // indirect - go.opentelemetry.io/collector/pdata/pprofile v0.109.0 // indirect - go.opentelemetry.io/collector/pdata/testdata v0.109.0 // indirect - go.opentelemetry.io/collector/processor/processorprofiles v0.109.0 // indirect - go.opentelemetry.io/collector/receiver/receiverprofiles v0.109.0 // indirect - go.opentelemetry.io/collector/semconv v0.109.0 // indirect - go.opentelemetry.io/collector/service v0.109.0 // indirect + go.opentelemetry.io/collector v0.110.0 // indirect + go.opentelemetry.io/collector/client v1.16.0 // indirect + go.opentelemetry.io/collector/component/componentprofiles v0.110.0 // indirect + go.opentelemetry.io/collector/component/componentstatus v0.110.0 // indirect + go.opentelemetry.io/collector/config/configauth v0.110.0 // indirect + go.opentelemetry.io/collector/config/configcompression v1.16.0 // indirect + go.opentelemetry.io/collector/config/configgrpc v0.110.0 // indirect + go.opentelemetry.io/collector/config/confighttp v0.110.0 // indirect + go.opentelemetry.io/collector/config/confignet v1.16.0 // indirect + go.opentelemetry.io/collector/config/configopaque v1.16.0 // indirect + go.opentelemetry.io/collector/config/configretry v1.16.0 // indirect + go.opentelemetry.io/collector/config/configtelemetry v0.110.0 // indirect + go.opentelemetry.io/collector/config/configtls v1.16.0 // indirect + go.opentelemetry.io/collector/config/internal v0.110.0 // indirect + go.opentelemetry.io/collector/connector/connectorprofiles v0.110.0 // indirect + go.opentelemetry.io/collector/consumer v0.110.0 // indirect + go.opentelemetry.io/collector/consumer/consumerprofiles v0.110.0 // indirect + go.opentelemetry.io/collector/consumer/consumertest v0.110.0 // indirect + go.opentelemetry.io/collector/exporter/exporterprofiles v0.110.0 // indirect + go.opentelemetry.io/collector/extension/auth v0.110.0 // indirect + go.opentelemetry.io/collector/extension/experimental/storage v0.110.0 // indirect + go.opentelemetry.io/collector/extension/extensioncapabilities v0.110.0 // indirect + go.opentelemetry.io/collector/featuregate v1.16.0 // indirect + go.opentelemetry.io/collector/internal/globalgates v0.110.0 // indirect + go.opentelemetry.io/collector/internal/globalsignal v0.110.0 // indirect + go.opentelemetry.io/collector/pdata v1.16.0 // indirect + go.opentelemetry.io/collector/pdata/pprofile v0.110.0 // indirect + go.opentelemetry.io/collector/pdata/testdata v0.110.0 // indirect + go.opentelemetry.io/collector/pipeline v0.110.0 // indirect + go.opentelemetry.io/collector/processor/processorprofiles v0.110.0 // indirect + go.opentelemetry.io/collector/receiver/receiverprofiles v0.110.0 // indirect + go.opentelemetry.io/collector/semconv v0.110.0 // indirect + go.opentelemetry.io/collector/service v0.110.0 // indirect go.opentelemetry.io/contrib/config v0.10.0 // indirect go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.55.0 // indirect go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.55.0 // indirect @@ -141,7 +143,7 @@ require ( gonum.org/v1/gonum v0.15.1 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20240903143218-8af14fe29dc1 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1 // indirect - google.golang.org/grpc v1.66.2 // indirect + google.golang.org/grpc v1.67.0 // indirect google.golang.org/protobuf v1.34.2 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) @@ -150,6 +152,8 @@ replace go.opentelemetry.io/collector => ../../ replace go.opentelemetry.io/collector/internal/globalgates => ../../internal/globalgates +replace go.opentelemetry.io/collector/internal/globalsignal => ../../internal/globalsignal + replace go.opentelemetry.io/collector/client => ../../client replace go.opentelemetry.io/collector/otelcol => ../../otelcol @@ -238,6 +242,8 @@ replace go.opentelemetry.io/collector/pdata/testdata => ../../pdata/testdata replace go.opentelemetry.io/collector/pdata/pprofile => ../../pdata/pprofile +replace go.opentelemetry.io/collector/pipeline => ../../pipeline + replace go.opentelemetry.io/collector/processor => ../../processor replace go.opentelemetry.io/collector/processor/batchprocessor => ../../processor/batchprocessor diff --git a/cmd/otelcorecol/go.sum b/cmd/otelcorecol/go.sum index b23c613e973..6bd3b9a6443 100644 --- a/cmd/otelcorecol/go.sum +++ b/cmd/otelcorecol/go.sum @@ -41,8 +41,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/klauspost/compress v1.17.10 h1:oXAz+Vh0PMUvJczoi+flxpnBEPxoER1IaAnU/NMPtT0= +github.com/klauspost/compress v1.17.10/go.mod h1:pMDklpSncoRMuLFrf1W9Ss9KT+0rH90U12bZKk7uwG0= 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= @@ -204,8 +204,8 @@ google.golang.org/genproto/googleapis/api v0.0.0-20240903143218-8af14fe29dc1 h1: google.golang.org/genproto/googleapis/api v0.0.0-20240903143218-8af14fe29dc1/go.mod h1:qpvKtACPCQhAdu3PyQgV4l3LMXZEtft7y8QcarRsp9I= google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1 h1:pPJltXNxVzT4pK9yD8vR9X75DaWYYmLGMsEvBfFQZzQ= google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU= -google.golang.org/grpc v1.66.2 h1:3QdXkuq3Bkh7w+ywLdLvM56cmGvQHUMZpiCzt6Rqaoo= -google.golang.org/grpc v1.66.2/go.mod h1:s3/l6xSSCURdVfAnL+TqCNMyTDAGN6+lZeVxnZR128Y= +google.golang.org/grpc v1.67.0 h1:IdH9y6PF5MPSdAntIcpjQ+tXO41pcQsfZV2RxtQgVcw= +google.golang.org/grpc v1.67.0/go.mod h1:1gLDyUQU7CTLJI90u3nXZ9ekeghjeM7pTDZlqFNg2AA= google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/cmd/otelcorecol/main.go b/cmd/otelcorecol/main.go index 212d2120d73..786be8ced3d 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.109.0-dev", + Version: "0.110.0-dev", } set := otelcol.CollectorSettings{ diff --git a/component/component.go b/component/component.go index 2f2da6f098f..40267a416ab 100644 --- a/component/component.go +++ b/component/component.go @@ -7,13 +7,16 @@ package component // import "go.opentelemetry.io/collector/component" import ( "context" - "errors" + + "go.opentelemetry.io/collector/pipeline" ) var ( // ErrDataTypeIsNotSupported can be returned by receiver, exporter, processor or connector factory funcs that create the // Component if the particular telemetry data type is not supported by the receiver, exporter, processor or connector factory. - ErrDataTypeIsNotSupported = errors.New("telemetry type is not supported") + // + // Deprecated: [v0.110.0] Use pipeline.ErrSignalNotSupported instead + ErrDataTypeIsNotSupported = pipeline.ErrSignalNotSupported ) // Component is either a receiver, exporter, processor, connector, or an extension. diff --git a/component/componentprofiles/config.go b/component/componentprofiles/config.go index 85b4e90ca80..1a8152b1192 100644 --- a/component/componentprofiles/config.go +++ b/component/componentprofiles/config.go @@ -3,13 +3,21 @@ package componentprofiles // import "go.opentelemetry.io/collector/component/componentprofiles" -import "go.opentelemetry.io/collector/component" +import ( + "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/internal/globalsignal" +) +// nolint func mustNewDataType(strType string) component.DataType { return component.MustNewType(strType) } var ( // DataTypeProfiles is the data type tag for profiles. + // + // Deprecated: [v0.110.0] Use SignalProfiles instead DataTypeProfiles = mustNewDataType("profiles") + + SignalProfiles = globalsignal.MustNewSignal("profiles") ) diff --git a/component/componentprofiles/go.mod b/component/componentprofiles/go.mod index a4ef0dde22b..96500d50fd2 100644 --- a/component/componentprofiles/go.mod +++ b/component/componentprofiles/go.mod @@ -2,12 +2,16 @@ module go.opentelemetry.io/collector/component/componentprofiles go 1.22.0 -require go.opentelemetry.io/collector/component v0.109.0 +require ( + go.opentelemetry.io/collector/component v0.110.0 + go.opentelemetry.io/collector/internal/globalsignal v0.110.0 +) require ( github.com/gogo/protobuf v1.3.2 // indirect - go.opentelemetry.io/collector/config/configtelemetry v0.109.0 // indirect - go.opentelemetry.io/collector/pdata v1.15.0 // indirect + go.opentelemetry.io/collector/config/configtelemetry v0.110.0 // indirect + go.opentelemetry.io/collector/pdata v1.16.0 // indirect + go.opentelemetry.io/collector/pipeline v0.110.0 // indirect go.opentelemetry.io/otel v1.30.0 // indirect go.opentelemetry.io/otel/metric v1.30.0 // indirect go.opentelemetry.io/otel/trace v1.30.0 // indirect @@ -16,8 +20,8 @@ require ( golang.org/x/net v0.28.0 // indirect golang.org/x/sys v0.25.0 // indirect golang.org/x/text v0.17.0 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20240604185151-ef581f913117 // indirect - google.golang.org/grpc v1.66.2 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240814211410-ddb44dafa142 // indirect + google.golang.org/grpc v1.67.0 // indirect google.golang.org/protobuf v1.34.2 // indirect ) @@ -26,3 +30,7 @@ replace go.opentelemetry.io/collector/pdata => ../../pdata replace go.opentelemetry.io/collector/config/configtelemetry => ../../config/configtelemetry replace go.opentelemetry.io/collector/component => ../ + +replace go.opentelemetry.io/collector/internal/globalsignal => ../../internal/globalsignal + +replace go.opentelemetry.io/collector/pipeline => ../../pipeline diff --git a/component/componentprofiles/go.sum b/component/componentprofiles/go.sum index 1c35fd4214a..2b795808461 100644 --- a/component/componentprofiles/go.sum +++ b/component/componentprofiles/go.sum @@ -59,10 +59,10 @@ 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= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240604185151-ef581f913117 h1:1GBuWVLM/KMVUv1t1En5Gs+gFZCNd360GGb4sSxtrhU= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240604185151-ef581f913117/go.mod h1:EfXuqaE1J41VCDicxHzUDm+8rk+7ZdXzHV0IhO/I6s0= -google.golang.org/grpc v1.66.2 h1:3QdXkuq3Bkh7w+ywLdLvM56cmGvQHUMZpiCzt6Rqaoo= -google.golang.org/grpc v1.66.2/go.mod h1:s3/l6xSSCURdVfAnL+TqCNMyTDAGN6+lZeVxnZR128Y= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240814211410-ddb44dafa142 h1:e7S5W7MGGLaSu8j3YjdezkZ+m1/Nm0uRVRMEMGk26Xs= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240814211410-ddb44dafa142/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU= +google.golang.org/grpc v1.67.0 h1:IdH9y6PF5MPSdAntIcpjQ+tXO41pcQsfZV2RxtQgVcw= +google.golang.org/grpc v1.67.0/go.mod h1:1gLDyUQU7CTLJI90u3nXZ9ekeghjeM7pTDZlqFNg2AA= google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/component/componentstatus/go.mod b/component/componentstatus/go.mod index b7e239d2831..88f2e5e2b1a 100644 --- a/component/componentstatus/go.mod +++ b/component/componentstatus/go.mod @@ -4,15 +4,17 @@ go 1.22.0 require ( github.com/stretchr/testify v1.9.0 - go.opentelemetry.io/collector/component v0.109.0 + go.opentelemetry.io/collector/component v0.110.0 + go.opentelemetry.io/collector/pipeline v0.110.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.109.0 // indirect - go.opentelemetry.io/collector/pdata v1.15.0 // indirect + go.opentelemetry.io/collector/config/configtelemetry v0.110.0 // indirect + go.opentelemetry.io/collector/internal/globalsignal v0.110.0 // indirect + go.opentelemetry.io/collector/pdata v1.16.0 // indirect go.opentelemetry.io/otel v1.30.0 // indirect go.opentelemetry.io/otel/metric v1.30.0 // indirect go.opentelemetry.io/otel/trace v1.30.0 // indirect @@ -21,8 +23,8 @@ require ( golang.org/x/net v0.28.0 // indirect golang.org/x/sys v0.25.0 // indirect golang.org/x/text v0.17.0 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20240604185151-ef581f913117 // indirect - google.golang.org/grpc v1.66.2 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240814211410-ddb44dafa142 // indirect + google.golang.org/grpc v1.67.0 // indirect google.golang.org/protobuf v1.34.2 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) @@ -32,3 +34,7 @@ replace go.opentelemetry.io/collector/config/configtelemetry => ../../config/con replace go.opentelemetry.io/collector/component => ../ replace go.opentelemetry.io/collector/pdata => ../../pdata + +replace go.opentelemetry.io/collector/pipeline => ../../pipeline + +replace go.opentelemetry.io/collector/internal/globalsignal => ../../internal/globalsignal diff --git a/component/componentstatus/go.sum b/component/componentstatus/go.sum index 980648f94ed..be183fa9a98 100644 --- a/component/componentstatus/go.sum +++ b/component/componentstatus/go.sum @@ -65,10 +65,10 @@ 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= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240604185151-ef581f913117 h1:1GBuWVLM/KMVUv1t1En5Gs+gFZCNd360GGb4sSxtrhU= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240604185151-ef581f913117/go.mod h1:EfXuqaE1J41VCDicxHzUDm+8rk+7ZdXzHV0IhO/I6s0= -google.golang.org/grpc v1.66.2 h1:3QdXkuq3Bkh7w+ywLdLvM56cmGvQHUMZpiCzt6Rqaoo= -google.golang.org/grpc v1.66.2/go.mod h1:s3/l6xSSCURdVfAnL+TqCNMyTDAGN6+lZeVxnZR128Y= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240814211410-ddb44dafa142 h1:e7S5W7MGGLaSu8j3YjdezkZ+m1/Nm0uRVRMEMGk26Xs= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240814211410-ddb44dafa142/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU= +google.golang.org/grpc v1.67.0 h1:IdH9y6PF5MPSdAntIcpjQ+tXO41pcQsfZV2RxtQgVcw= +google.golang.org/grpc v1.67.0/go.mod h1:1gLDyUQU7CTLJI90u3nXZ9ekeghjeM7pTDZlqFNg2AA= google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/component/componentstatus/instance.go b/component/componentstatus/instance.go index 71668b6d351..96475510fef 100644 --- a/component/componentstatus/instance.go +++ b/component/componentstatus/instance.go @@ -9,6 +9,7 @@ import ( "strings" "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/pipeline" ) // pipelineDelim is the delimiter for internal representation of pipeline @@ -26,7 +27,19 @@ type InstanceID struct { } // NewInstanceID returns an ID that uniquely identifies a component. +// +// Deprecated: [v0.110.0] Use NewInstanceIDWithPipelineID instead func NewInstanceID(componentID component.ID, kind component.Kind, pipelineIDs ...component.ID) *InstanceID { + instanceID := &InstanceID{ + componentID: componentID, + kind: kind, + } + instanceID.addPipelines(convertToPipelineIDs(pipelineIDs)) + return instanceID +} + +// NewInstanceIDWithPipelineIDs returns an InstanceID that uniquely identifies a component. +func NewInstanceIDWithPipelineIDs(componentID component.ID, kind component.Kind, pipelineIDs ...pipeline.ID) *InstanceID { instanceID := &InstanceID{ componentID: componentID, kind: kind, @@ -47,6 +60,8 @@ func (id *InstanceID) Kind() component.Kind { // AllPipelineIDs calls f for each pipeline this instance is associated with. If // f returns false it will stop iteration. +// +// Deprecated: [v0.110.0] Use AllPipelineIDsWithPipelineIDs instead. func (id *InstanceID) AllPipelineIDs(f func(component.ID) bool) { var bs []byte for _, b := range []byte(id.pipelineIDs) { @@ -66,9 +81,44 @@ func (id *InstanceID) AllPipelineIDs(f func(component.ID) bool) { } } +// AllPipelineIDsWithPipelineIDs calls f for each pipeline this instance is associated with. If +// f returns false it will stop iteration. +func (id *InstanceID) AllPipelineIDsWithPipelineIDs(f func(pipeline.ID) bool) { + var bs []byte + for _, b := range []byte(id.pipelineIDs) { + if b != pipelineDelim { + bs = append(bs, b) + continue + } + pipelineID := pipeline.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. +// +// Deprecated: [v0.110.0] Use WithPipelineIDs instead func (id *InstanceID) WithPipelines(pipelineIDs ...component.ID) *InstanceID { + instanceID := &InstanceID{ + componentID: id.componentID, + kind: id.kind, + pipelineIDs: id.pipelineIDs, + } + instanceID.addPipelines(convertToPipelineIDs(pipelineIDs)) + return instanceID +} + +// WithPipelineIDs returns a new InstanceID updated to include the given +// pipelineIDs. +func (id *InstanceID) WithPipelineIDs(pipelineIDs ...pipeline.ID) *InstanceID { instanceID := &InstanceID{ componentID: id.componentID, kind: id.kind, @@ -78,7 +128,7 @@ func (id *InstanceID) WithPipelines(pipelineIDs ...component.ID) *InstanceID { return instanceID } -func (id *InstanceID) addPipelines(pipelineIDs []component.ID) { +func (id *InstanceID) addPipelines(pipelineIDs []pipeline.ID) { delim := string(pipelineDelim) strIDs := strings.Split(id.pipelineIDs, delim) for _, pID := range pipelineIDs { @@ -88,3 +138,16 @@ func (id *InstanceID) addPipelines(pipelineIDs []component.ID) { strIDs = slices.Compact(strIDs) id.pipelineIDs = strings.Join(strIDs, delim) + delim } + +func convertToPipelineIDs(ids []component.ID) []pipeline.ID { + pipelineIDs := make([]pipeline.ID, len(ids)) + for i, id := range ids { + if id.Name() != "" { + pipelineIDs[i] = pipeline.MustNewIDWithName(id.Type().String(), id.Name()) + } else { + pipelineIDs[i] = pipeline.MustNewID(id.Type().String()) + } + + } + return pipelineIDs +} diff --git a/component/componentstatus/instance_test.go b/component/componentstatus/instance_test.go index 486607ae8dd..7c8b0d4691a 100644 --- a/component/componentstatus/instance_test.go +++ b/component/componentstatus/instance_test.go @@ -9,21 +9,22 @@ import ( "github.com/stretchr/testify/assert" "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/pipeline" ) func TestInstanceID(t *testing.T) { traces := component.MustNewID("traces") - tracesA := component.MustNewIDWithName("traces", "a") - tracesB := component.MustNewIDWithName("traces", "b") - tracesC := component.MustNewIDWithName("traces", "c") + tracesA := pipeline.MustNewIDWithName("traces", "a") + tracesB := pipeline.MustNewIDWithName("traces", "b") + tracesC := pipeline.MustNewIDWithName("traces", "c") - idTracesA := NewInstanceID(traces, component.KindReceiver, tracesA) - idTracesAll := NewInstanceID(traces, component.KindReceiver, tracesA, tracesB, tracesC) + idTracesA := NewInstanceIDWithPipelineIDs(traces, component.KindReceiver, tracesA) + idTracesAll := NewInstanceIDWithPipelineIDs(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 { + assertHasPipelines := func(t *testing.T, instanceID *InstanceID, expectedPipelineIDs []pipeline.ID) { + var pipelineIDs []pipeline.ID + instanceID.AllPipelineIDsWithPipelineIDs(func(id pipeline.ID) bool { pipelineIDs = append(pipelineIDs, id) return true }) @@ -34,31 +35,31 @@ func TestInstanceID(t *testing.T) { name string id1 *InstanceID id2 *InstanceID - pipelineIDs []component.ID + pipelineIDs []pipeline.ID }{ { name: "equal instances", id1: idTracesA, - id2: NewInstanceID(traces, component.KindReceiver, tracesA), - pipelineIDs: []component.ID{tracesA}, + id2: NewInstanceIDWithPipelineIDs(traces, component.KindReceiver, tracesA), + pipelineIDs: []pipeline.ID{tracesA}, }, { name: "equal instances - out of order", id1: idTracesAll, - id2: NewInstanceID(traces, component.KindReceiver, tracesC, tracesB, tracesA), - pipelineIDs: []component.ID{tracesA, tracesB, tracesC}, + id2: NewInstanceIDWithPipelineIDs(traces, component.KindReceiver, tracesC, tracesB, tracesA), + pipelineIDs: []pipeline.ID{tracesA, tracesB, tracesC}, }, { name: "with pipelines", id1: idTracesAll, - id2: idTracesA.WithPipelines(tracesB, tracesC), - pipelineIDs: []component.ID{tracesA, tracesB, tracesC}, + id2: idTracesA.WithPipelineIDs(tracesB, tracesC), + pipelineIDs: []pipeline.ID{tracesA, tracesB, tracesC}, }, { name: "with pipelines - out of order", id1: idTracesAll, - id2: idTracesA.WithPipelines(tracesC, tracesB), - pipelineIDs: []component.ID{tracesA, tracesB, tracesC}, + id2: idTracesA.WithPipelineIDs(tracesC, tracesB), + pipelineIDs: []pipeline.ID{tracesA, tracesB, tracesC}, }, } { t.Run(tc.name, func(t *testing.T) { @@ -69,24 +70,24 @@ func TestInstanceID(t *testing.T) { } } -func TestAllPipelineIDs(t *testing.T) { - instanceID := NewInstanceID( +func TestAllPipelineIDsWithPipelineIDs(t *testing.T) { + instanceID := NewInstanceIDWithPipelineIDs( component.MustNewID("traces"), component.KindReceiver, - component.MustNewIDWithName("traces", "a"), - component.MustNewIDWithName("traces", "b"), - component.MustNewIDWithName("traces", "c"), + pipeline.MustNewIDWithName("traces", "a"), + pipeline.MustNewIDWithName("traces", "b"), + pipeline.MustNewIDWithName("traces", "c"), ) count := 0 - instanceID.AllPipelineIDs(func(component.ID) bool { + instanceID.AllPipelineIDsWithPipelineIDs(func(pipeline.ID) bool { count++ return true }) assert.Equal(t, 3, count) count = 0 - instanceID.AllPipelineIDs(func(component.ID) bool { + instanceID.AllPipelineIDsWithPipelineIDs(func(pipeline.ID) bool { count++ return false }) diff --git a/component/config.go b/component/config.go index 8eadee0c1f5..001b18916cd 100644 --- a/component/config.go +++ b/component/config.go @@ -147,6 +147,8 @@ func MustNewType(strType string) Type { // DataType is a special Type that represents the data types supported by the collector. We currently support // collecting metrics, traces and logs, this can expand in the future. +// +// Deprecated: [v0.110.0] Use pipeline.Signal instead. type DataType = Type func mustNewDataType(strType string) DataType { @@ -156,12 +158,18 @@ func mustNewDataType(strType string) DataType { // Currently supported data types. Add new data types here when new types are supported in the future. var ( // DataTypeTraces is the data type tag for traces. + // + // Deprecated: [v0.110.0] Use pipeline.SignalTraces instead. DataTypeTraces = mustNewDataType("traces") // DataTypeMetrics is the data type tag for metrics. + // + // Deprecated: [v0.110.0] Use pipeline.SignalMetrics instead. DataTypeMetrics = mustNewDataType("metrics") // DataTypeLogs is the data type tag for logs. + // + // Deprecated: [v0.110.0] Use pipeline.SignalLogs instead. DataTypeLogs = mustNewDataType("logs") ) diff --git a/component/go.mod b/component/go.mod index 13cf8958d1c..70cbe55ed34 100644 --- a/component/go.mod +++ b/component/go.mod @@ -4,8 +4,9 @@ go 1.22.0 require ( github.com/stretchr/testify v1.9.0 - go.opentelemetry.io/collector/config/configtelemetry v0.109.0 - go.opentelemetry.io/collector/pdata v1.15.0 + go.opentelemetry.io/collector/config/configtelemetry v0.110.0 + go.opentelemetry.io/collector/pdata v1.16.0 + go.opentelemetry.io/collector/pipeline v0.110.0 go.opentelemetry.io/otel v1.30.0 go.opentelemetry.io/otel/metric v1.30.0 go.opentelemetry.io/otel/sdk v1.30.0 @@ -23,11 +24,12 @@ require ( github.com/gogo/protobuf v1.3.2 // indirect github.com/google/uuid v1.6.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect + go.opentelemetry.io/collector/internal/globalsignal v0.110.0 // indirect golang.org/x/net v0.28.0 // indirect golang.org/x/sys v0.25.0 // indirect golang.org/x/text v0.17.0 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20240604185151-ef581f913117 // indirect - google.golang.org/grpc v1.66.2 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240814211410-ddb44dafa142 // indirect + google.golang.org/grpc v1.67.0 // indirect google.golang.org/protobuf v1.34.2 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) @@ -40,3 +42,7 @@ 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/pipeline => ../pipeline + +replace go.opentelemetry.io/collector/internal/globalsignal => ../internal/globalsignal diff --git a/component/go.sum b/component/go.sum index a80371fce1e..e10837b9943 100644 --- a/component/go.sum +++ b/component/go.sum @@ -72,10 +72,10 @@ 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= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240604185151-ef581f913117 h1:1GBuWVLM/KMVUv1t1En5Gs+gFZCNd360GGb4sSxtrhU= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240604185151-ef581f913117/go.mod h1:EfXuqaE1J41VCDicxHzUDm+8rk+7ZdXzHV0IhO/I6s0= -google.golang.org/grpc v1.66.2 h1:3QdXkuq3Bkh7w+ywLdLvM56cmGvQHUMZpiCzt6Rqaoo= -google.golang.org/grpc v1.66.2/go.mod h1:s3/l6xSSCURdVfAnL+TqCNMyTDAGN6+lZeVxnZR128Y= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240814211410-ddb44dafa142 h1:e7S5W7MGGLaSu8j3YjdezkZ+m1/Nm0uRVRMEMGk26Xs= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240814211410-ddb44dafa142/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU= +google.golang.org/grpc v1.67.0 h1:IdH9y6PF5MPSdAntIcpjQ+tXO41pcQsfZV2RxtQgVcw= +google.golang.org/grpc v1.67.0/go.mod h1:1gLDyUQU7CTLJI90u3nXZ9ekeghjeM7pTDZlqFNg2AA= google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/config/configauth/go.mod b/config/configauth/go.mod index 6ed0d7dc393..b05e248bcab 100644 --- a/config/configauth/go.mod +++ b/config/configauth/go.mod @@ -4,9 +4,9 @@ go 1.22.0 require ( github.com/stretchr/testify v1.9.0 - go.opentelemetry.io/collector/component v0.109.0 - go.opentelemetry.io/collector/extension v0.109.0 - go.opentelemetry.io/collector/extension/auth v0.109.0 + go.opentelemetry.io/collector/component v0.110.0 + go.opentelemetry.io/collector/extension v0.110.0 + go.opentelemetry.io/collector/extension/auth v0.110.0 go.uber.org/goleak v1.3.0 ) @@ -14,8 +14,10 @@ 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.109.0 // indirect - go.opentelemetry.io/collector/pdata v1.15.0 // indirect + go.opentelemetry.io/collector/config/configtelemetry v0.110.0 // indirect + go.opentelemetry.io/collector/internal/globalsignal v0.110.0 // indirect + go.opentelemetry.io/collector/pdata v1.16.0 // indirect + go.opentelemetry.io/collector/pipeline v0.110.0 // indirect go.opentelemetry.io/otel v1.30.0 // indirect go.opentelemetry.io/otel/metric v1.30.0 // indirect go.opentelemetry.io/otel/trace v1.30.0 // indirect @@ -24,8 +26,8 @@ require ( golang.org/x/net v0.28.0 // indirect golang.org/x/sys v0.25.0 // indirect golang.org/x/text v0.17.0 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20240604185151-ef581f913117 // indirect - google.golang.org/grpc v1.66.2 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240814211410-ddb44dafa142 // indirect + google.golang.org/grpc v1.67.0 // indirect google.golang.org/protobuf v1.34.2 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) @@ -39,3 +41,7 @@ replace go.opentelemetry.io/collector/config/configtelemetry => ../configtelemet replace go.opentelemetry.io/collector/extension => ../../extension replace go.opentelemetry.io/collector/extension/auth => ../../extension/auth + +replace go.opentelemetry.io/collector/pipeline => ../../pipeline + +replace go.opentelemetry.io/collector/internal/globalsignal => ../../internal/globalsignal diff --git a/config/configauth/go.sum b/config/configauth/go.sum index be9532a21b3..24a4c4d97dd 100644 --- a/config/configauth/go.sum +++ b/config/configauth/go.sum @@ -71,10 +71,10 @@ 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= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240604185151-ef581f913117 h1:1GBuWVLM/KMVUv1t1En5Gs+gFZCNd360GGb4sSxtrhU= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240604185151-ef581f913117/go.mod h1:EfXuqaE1J41VCDicxHzUDm+8rk+7ZdXzHV0IhO/I6s0= -google.golang.org/grpc v1.66.2 h1:3QdXkuq3Bkh7w+ywLdLvM56cmGvQHUMZpiCzt6Rqaoo= -google.golang.org/grpc v1.66.2/go.mod h1:s3/l6xSSCURdVfAnL+TqCNMyTDAGN6+lZeVxnZR128Y= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240814211410-ddb44dafa142 h1:e7S5W7MGGLaSu8j3YjdezkZ+m1/Nm0uRVRMEMGk26Xs= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240814211410-ddb44dafa142/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU= +google.golang.org/grpc v1.67.0 h1:IdH9y6PF5MPSdAntIcpjQ+tXO41pcQsfZV2RxtQgVcw= +google.golang.org/grpc v1.67.0/go.mod h1:1gLDyUQU7CTLJI90u3nXZ9ekeghjeM7pTDZlqFNg2AA= google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/config/configgrpc/configgrpc.go b/config/configgrpc/configgrpc.go index 2bf15063c57..53bfbf79e69 100644 --- a/config/configgrpc/configgrpc.go +++ b/config/configgrpc/configgrpc.go @@ -202,6 +202,16 @@ func NewDefaultServerConfig() *ServerConfig { } } +func (gcs *ClientConfig) Validate() error { + if gcs.BalancerName != "" { + if balancer.Get(gcs.BalancerName) == nil { + return fmt.Errorf("invalid balancer_name: %s", gcs.BalancerName) + } + } + + return nil +} + // sanitizedEndpoint strips the prefix of either http:// or https:// from configgrpc.ClientConfig.Endpoint. func (gcs *ClientConfig) sanitizedEndpoint() string { switch { @@ -222,27 +232,7 @@ func (gcs *ClientConfig) isSchemeHTTPS() bool { return strings.HasPrefix(gcs.Endpoint, "https://") } -// ToClientConn creates a client connection to the given target. By default, it's -// a non-blocking dial (the function won't wait for connections to be -// established, and connecting happens in the background). To make it a blocking -// dial, use grpc.WithBlock() dial option. -// -// Deprecated: [v0.110.0] If providing a [grpc.DialOption], use [ClientConfig.ToClientConnWithOptions] -// with [WithGrpcDialOption] instead. -func (gcs *ClientConfig) ToClientConn( - ctx context.Context, - host component.Host, - settings component.TelemetrySettings, - grpcOpts ...grpc.DialOption, -) (*grpc.ClientConn, error) { - var extraOpts []ToClientConnOption - for _, grpcOpt := range grpcOpts { - extraOpts = append(extraOpts, WithGrpcDialOption(grpcOpt)) - } - return gcs.ToClientConnWithOptions(ctx, host, settings, extraOpts...) -} - -// ToClientConnOption is a sealed interface wrapping options for [ClientConfig.ToClientConnWithOptions]. +// ToClientConnOption is a sealed interface wrapping options for [ClientConfig.ToClientConn]. type ToClientConnOption interface { isToClientConnOption() } @@ -257,9 +247,11 @@ func WithGrpcDialOption(opt grpc.DialOption) ToClientConnOption { } func (grpcDialOptionWrapper) isToClientConnOption() {} -// ToClientConnWithOptions is the same as [ClientConfig.ToClientConn], but uses the [ToClientConnOption] interface for options. -// This method will eventually replace [ClientConfig.ToClientConn]. -func (gcs *ClientConfig) ToClientConnWithOptions( +// ToClientConn creates a client connection to the given target. By default, it's +// a non-blocking dial (the function won't wait for connections to be +// established, and connecting happens in the background). To make it a blocking +// dial, use the WithGrpcDiqlOption(grpc.WithBlock()) option. +func (gcs *ClientConfig) ToClientConn( ctx context.Context, host component.Host, settings component.TelemetrySettings, @@ -272,6 +264,18 @@ func (gcs *ClientConfig) ToClientConnWithOptions( return grpc.NewClient(gcs.sanitizedEndpoint(), grpcOpts...) } +// ToClientConnWithOptions is the same as [ClientConfig.ToClientConn]. +// +// Deprecated: [v0.111.0] Use [ClientConfig.ToClientConn] instead. +func (gcs *ClientConfig) ToClientConnWithOptions( + ctx context.Context, + host component.Host, + settings component.TelemetrySettings, + extraOpts ...ToClientConnOption, +) (*grpc.ClientConn, error) { + return gcs.ToClientConn(ctx, host, settings, extraOpts...) +} + func (gcs *ClientConfig) getGrpcDialOptions( ctx context.Context, host component.Host, @@ -334,10 +338,6 @@ func (gcs *ClientConfig) getGrpcDialOptions( } if gcs.BalancerName != "" { - valid := validateBalancerName(gcs.BalancerName) - if !valid { - return nil, fmt.Errorf("invalid balancer_name: %s", gcs.BalancerName) - } opts = append(opts, grpc.WithDefaultServiceConfig(fmt.Sprintf(`{"loadBalancingPolicy":"%s"}`, gcs.BalancerName))) } @@ -363,10 +363,6 @@ func (gcs *ClientConfig) getGrpcDialOptions( return opts, nil } -func validateBalancerName(balancerName string) bool { - return balancer.Get(balancerName) != nil -} - func (gss *ServerConfig) Validate() error { if gss.MaxRecvMsgSizeMiB*1024*1024 < 0 { return fmt.Errorf("invalid max_recv_msg_size_mib value, must be between 1 and %d: %d", math.MaxInt/1024/1024, gss.MaxRecvMsgSizeMiB) @@ -383,24 +379,7 @@ func (gss *ServerConfig) Validate() error { return nil } -// ToServer returns a [grpc.Server] for the configuration -// -// Deprecated: [v0.110.0] If providing a [grpc.ServerOption], use [ServerConfig.ToServerWithOptions] -// with [WithGrpcServerOption] instead. -func (gss *ServerConfig) ToServer( - ctx context.Context, - host component.Host, - settings component.TelemetrySettings, - grpcOpts ...grpc.ServerOption, -) (*grpc.Server, error) { - var extraOpts []ToServerOption - for _, grpcOpt := range grpcOpts { - extraOpts = append(extraOpts, WithGrpcServerOption(grpcOpt)) - } - return gss.ToServerWithOptions(ctx, host, settings, extraOpts...) -} - -// ToServerOption is a sealed interface wrapping options for [ServerConfig.ToServerWithOptions]. +// ToServerOption is a sealed interface wrapping options for [ServerConfig.ToServer]. type ToServerOption interface { isToServerOption() } @@ -415,9 +394,8 @@ func WithGrpcServerOption(opt grpc.ServerOption) ToServerOption { } func (grpcServerOptionWrapper) isToServerOption() {} -// ToServerWithOptions is the same as [ServerConfig.ToServer], but uses the [ToServerOption] interface for options. -// This method will eventually replace [ServerConfig.ToServer]. -func (gss *ServerConfig) ToServerWithOptions( +// ToServer returns a [grpc.Server] for the configuration. +func (gss *ServerConfig) ToServer( _ context.Context, host component.Host, settings component.TelemetrySettings, @@ -430,6 +408,18 @@ func (gss *ServerConfig) ToServerWithOptions( return grpc.NewServer(grpcOpts...), nil } +// ToServerWithOptions is the same as [ServerConfig.ToServer]. +// +// Deprecated: [v0.111.0] Use [ServerConfig.ToServer] instead. +func (gss *ServerConfig) ToServerWithOptions( + ctx context.Context, + host component.Host, + settings component.TelemetrySettings, + extraOpts ...ToServerOption, +) (*grpc.Server, error) { + return gss.ToServer(ctx, host, settings, extraOpts...) +} + func (gss *ServerConfig) getGrpcServerOptions( host component.Host, settings component.TelemetrySettings, diff --git a/config/configgrpc/configgrpc_test.go b/config/configgrpc/configgrpc_test.go index 585b0c6d7c1..6f7398ceac6 100644 --- a/config/configgrpc/configgrpc_test.go +++ b/config/configgrpc/configgrpc_test.go @@ -18,7 +18,6 @@ import ( "go.uber.org/zap" "go.uber.org/zap/zaptest/observer" "google.golang.org/grpc" - "google.golang.org/grpc/balancer" "google.golang.org/grpc/codes" "google.golang.org/grpc/metadata" "google.golang.org/grpc/peer" @@ -34,8 +33,6 @@ import ( "go.opentelemetry.io/collector/config/configtls" "go.opentelemetry.io/collector/extension/auth" "go.opentelemetry.io/collector/extension/auth/authtest" - "go.opentelemetry.io/collector/featuregate" - "go.opentelemetry.io/collector/internal/globalgates" "go.opentelemetry.io/collector/pdata/ptrace/ptraceotlp" ) @@ -94,21 +91,6 @@ func TestNewDefaultServerConfig(t *testing.T) { assert.Equal(t, expected, result) } -// testBalancerBuilder facilitates testing validateBalancerName(). -type testBalancerBuilder struct{} - -func (testBalancerBuilder) Build(balancer.ClientConn, balancer.BuildOptions) balancer.Balancer { - return nil -} - -func (testBalancerBuilder) Name() string { - return "configgrpc_balancer_test" -} - -func init() { - balancer.Register(testBalancerBuilder{}) -} - var ( componentID = component.MustNewID("component") testAuthID = component.MustNewID("testauth") @@ -335,7 +317,7 @@ func TestGrpcServerValidate(t *testing.T) { t.Run(tt.err, func(t *testing.T) { err := tt.gss.Validate() require.Error(t, err) - assert.Regexp(t, tt.err, err) + assert.ErrorContains(t, err, tt.err) }) } } @@ -392,18 +374,37 @@ func TestGrpcServerAuthSettings(t *testing.T) { assert.NotNil(t, srv) } -func TestGRPCClientSettingsError(t *testing.T) { - tt, err := componenttest.SetupTelemetry(componentID) - require.NoError(t, err) - t.Cleanup(func() { require.NoError(t, tt.Shutdown(context.Background())) }) +func TestGrpcClientConfigInvalidBalancer(t *testing.T) { + settings := ClientConfig{ + Headers: map[string]configopaque.String{ + "test": "test", + }, + Endpoint: "localhost:1234", + Compression: "gzip", + TLSSetting: configtls.ClientConfig{ + Insecure: false, + }, + Keepalive: &KeepaliveClientConfig{ + Time: time.Second, + Timeout: time.Second, + PermitWithoutStream: true, + }, + ReadBufferSize: 1024, + WriteBufferSize: 1024, + WaitForReady: true, + BalancerName: "test", + } + assert.ErrorContains(t, settings.Validate(), "invalid balancer_name: test") +} +func TestGRPCClientSettingsError(t *testing.T) { tests := []struct { settings ClientConfig err string host component.Host }{ { - err: "^failed to load TLS config: failed to load CA CertPool File: failed to load cert /doesnt/exist:", + err: "failed to load TLS config: failed to load CA CertPool File: failed to load cert /doesnt/exist:", settings: ClientConfig{ Headers: nil, Endpoint: "", @@ -419,7 +420,7 @@ func TestGRPCClientSettingsError(t *testing.T) { }, }, { - err: "^failed to load TLS config: failed to load TLS cert and key: for auth via TLS, provide both certificate and key, or neither", + err: "failed to load TLS config: failed to load TLS cert and key: for auth via TLS, provide both certificate and key, or neither", settings: ClientConfig{ Headers: nil, Endpoint: "", @@ -434,28 +435,6 @@ func TestGRPCClientSettingsError(t *testing.T) { Keepalive: nil, }, }, - { - err: "invalid balancer_name: test", - settings: ClientConfig{ - Headers: map[string]configopaque.String{ - "test": "test", - }, - Endpoint: "localhost:1234", - Compression: "gzip", - TLSSetting: configtls.ClientConfig{ - Insecure: false, - }, - Keepalive: &KeepaliveClientConfig{ - Time: time.Second, - Timeout: time.Second, - PermitWithoutStream: true, - }, - ReadBufferSize: 1024, - WriteBufferSize: 1024, - WaitForReady: true, - BalancerName: "test", - }, - }, { err: "failed to resolve authenticator \"doesntexist\": authenticator not found", settings: ClientConfig{ @@ -508,9 +487,10 @@ func TestGRPCClientSettingsError(t *testing.T) { } for _, test := range tests { t.Run(test.err, func(t *testing.T) { - _, err := test.settings.ToClientConn(context.Background(), test.host, tt.TelemetrySettings()) + require.NoError(t, test.settings.Validate()) + _, err := test.settings.ToClientConn(context.Background(), test.host, componenttest.NewNopTelemetrySettings()) require.Error(t, err) - assert.Regexp(t, test.err, err) + assert.ErrorContains(t, err, test.err) }) } } @@ -533,13 +513,6 @@ func TestUseSecure(t *testing.T) { } func TestGRPCServerWarning(t *testing.T) { - prev := globalgates.UseLocalHostAsDefaultHostfeatureGate.IsEnabled() - require.NoError(t, featuregate.GlobalRegistry().Set(globalgates.UseLocalHostAsDefaultHostID, false)) - defer func() { - // Restore previous value. - require.NoError(t, featuregate.GlobalRegistry().Set(globalgates.UseLocalHostAsDefaultHostID, prev)) - }() - tests := []struct { name string settings ServerConfig @@ -596,7 +569,7 @@ func TestGRPCServerSettingsError(t *testing.T) { err string }{ { - err: "^failed to load TLS config: failed to load CA CertPool File: failed to load cert /doesnt/exist:", + err: "failed to load TLS config: failed to load CA CertPool File: failed to load cert /doesnt/exist:", settings: ServerConfig{ NetAddr: confignet.AddrConfig{ Endpoint: "127.0.0.1:1234", @@ -610,7 +583,7 @@ func TestGRPCServerSettingsError(t *testing.T) { }, }, { - err: "^failed to load TLS config: failed to load TLS cert and key: for auth via TLS, provide both certificate and key, or neither", + err: "failed to load TLS config: failed to load TLS cert and key: for auth via TLS, provide both certificate and key, or neither", settings: ServerConfig{ NetAddr: confignet.AddrConfig{ Endpoint: "127.0.0.1:1234", @@ -624,7 +597,7 @@ func TestGRPCServerSettingsError(t *testing.T) { }, }, { - err: "^failed to load client CA CertPool: failed to load CA /doesnt/exist:", + err: "failed to load client CA CertPool: failed to load CA /doesnt/exist:", settings: ServerConfig{ NetAddr: confignet.AddrConfig{ Endpoint: "127.0.0.1:1234", @@ -639,7 +612,7 @@ func TestGRPCServerSettingsError(t *testing.T) { for _, test := range tests { t.Run(test.err, func(t *testing.T) { _, err := test.settings.ToServer(context.Background(), componenttest.NewNopHost(), componenttest.NewNopTelemetrySettings()) - assert.Regexp(t, test.err, err) + assert.ErrorContains(t, err, test.err) }) } } diff --git a/config/configgrpc/go.mod b/config/configgrpc/go.mod index a79022764cb..a7e0fa5d571 100644 --- a/config/configgrpc/go.mod +++ b/config/configgrpc/go.mod @@ -5,25 +5,23 @@ 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/client v1.15.0 - go.opentelemetry.io/collector/component v0.109.0 - go.opentelemetry.io/collector/config/configauth v0.109.0 - go.opentelemetry.io/collector/config/configcompression v1.15.0 - go.opentelemetry.io/collector/config/confignet v0.109.0 - go.opentelemetry.io/collector/config/configopaque v1.15.0 - go.opentelemetry.io/collector/config/configtelemetry v0.109.0 - go.opentelemetry.io/collector/config/configtls v1.15.0 - go.opentelemetry.io/collector/config/internal v0.109.1-0.20240916143658-74729e731d3b - go.opentelemetry.io/collector/extension/auth v0.109.0 - go.opentelemetry.io/collector/featuregate v1.15.0 - go.opentelemetry.io/collector/internal/globalgates v0.109.0 - go.opentelemetry.io/collector/pdata v1.15.0 - go.opentelemetry.io/collector/pdata/testdata v0.109.0 + go.opentelemetry.io/collector/client v1.16.0 + go.opentelemetry.io/collector/component v0.110.0 + go.opentelemetry.io/collector/config/configauth v0.110.0 + go.opentelemetry.io/collector/config/configcompression v1.16.0 + go.opentelemetry.io/collector/config/confignet v1.16.0 + go.opentelemetry.io/collector/config/configopaque v1.16.0 + go.opentelemetry.io/collector/config/configtelemetry v0.110.0 + go.opentelemetry.io/collector/config/configtls v1.16.0 + go.opentelemetry.io/collector/config/internal v0.110.0 + go.opentelemetry.io/collector/extension/auth v0.110.0 + go.opentelemetry.io/collector/pdata v1.16.0 + go.opentelemetry.io/collector/pdata/testdata v0.110.0 go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.55.0 go.opentelemetry.io/otel v1.30.0 go.uber.org/goleak v1.3.0 go.uber.org/zap v1.27.0 - google.golang.org/grpc v1.66.2 + google.golang.org/grpc v1.67.0 ) require ( @@ -34,14 +32,15 @@ require ( 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.9 // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/collector/extension v0.109.0 // indirect - go.opentelemetry.io/collector/pdata/pprofile v0.109.0 // indirect + go.opentelemetry.io/collector/extension v0.110.0 // indirect + go.opentelemetry.io/collector/internal/globalsignal v0.110.0 // indirect + go.opentelemetry.io/collector/pdata/pprofile v0.110.0 // indirect + go.opentelemetry.io/collector/pipeline v0.110.0 // indirect go.opentelemetry.io/otel/metric v1.30.0 // indirect go.opentelemetry.io/otel/sdk v1.30.0 // indirect go.opentelemetry.io/otel/sdk/metric v1.30.0 // indirect @@ -75,8 +74,6 @@ 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/pdata => ../../pdata replace go.opentelemetry.io/collector/pdata/testdata => ../../pdata/testdata @@ -87,4 +84,6 @@ replace go.opentelemetry.io/collector/component => ../../component replace go.opentelemetry.io/collector/consumer => ../../consumer -replace go.opentelemetry.io/collector/internal/globalgates => ../../internal/globalgates +replace go.opentelemetry.io/collector/internal/globalsignal => ../../internal/globalsignal + +replace go.opentelemetry.io/collector/pipeline => ../../pipeline diff --git a/config/configgrpc/go.sum b/config/configgrpc/go.sum index b5f8e6cb3b3..8c3c9a4209d 100644 --- a/config/configgrpc/go.sum +++ b/config/configgrpc/go.sum @@ -17,8 +17,6 @@ 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= @@ -97,8 +95,8 @@ golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8T golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1 h1:pPJltXNxVzT4pK9yD8vR9X75DaWYYmLGMsEvBfFQZzQ= google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU= -google.golang.org/grpc v1.66.2 h1:3QdXkuq3Bkh7w+ywLdLvM56cmGvQHUMZpiCzt6Rqaoo= -google.golang.org/grpc v1.66.2/go.mod h1:s3/l6xSSCURdVfAnL+TqCNMyTDAGN6+lZeVxnZR128Y= +google.golang.org/grpc v1.67.0 h1:IdH9y6PF5MPSdAntIcpjQ+tXO41pcQsfZV2RxtQgVcw= +google.golang.org/grpc v1.67.0/go.mod h1:1gLDyUQU7CTLJI90u3nXZ9ekeghjeM7pTDZlqFNg2AA= google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/config/confighttp/compress_readcloser.go b/config/confighttp/compress_readcloser.go new file mode 100644 index 00000000000..411a06a7f2b --- /dev/null +++ b/config/confighttp/compress_readcloser.go @@ -0,0 +1,23 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package confighttp // import "go.opentelemetry.io/collector/config/confighttp" + +import "io" + +// compressReadCloser couples the original compressed reader +// and the compression reader to ensure that the original body +// is correctly closed to ensure resources are freed. +type compressReadCloser struct { + io.Reader + orig io.ReadCloser +} + +var ( + _ io.Reader = (*compressReadCloser)(nil) + _ io.Closer = (*compressReadCloser)(nil) +) + +func (crc *compressReadCloser) Close() error { + return crc.orig.Close() +} diff --git a/config/confighttp/compress_readcloser_test.go b/config/confighttp/compress_readcloser_test.go new file mode 100644 index 00000000000..fd97a15e242 --- /dev/null +++ b/config/confighttp/compress_readcloser_test.go @@ -0,0 +1,77 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package confighttp + +import ( + "bytes" + "errors" + "io" + "testing" + "testing/iotest" + + "github.com/stretchr/testify/require" +) + +type errorReadCloser struct { + io.Reader + err error +} + +func (erc errorReadCloser) Close() error { + return erc.err +} + +func TestCompressReadCloser(t *testing.T) { + t.Parallel() + + for _, tc := range []struct { + name string + wrapper func(r io.Reader) io.ReadCloser + content []byte + errVal string + }{ + { + name: "non mutating wrapper", + wrapper: func(r io.Reader) io.ReadCloser { + return errorReadCloser{ + Reader: r, + err: nil, + } + }, + content: []byte("hello world"), + errVal: "", + }, + { + name: "failed reader", + wrapper: func(r io.Reader) io.ReadCloser { + return errorReadCloser{ + Reader: r, + err: errors.New("failed to close reader"), + } + }, + errVal: "failed to close reader", + }, + } { + tc := tc + t.Run(tc.name, func(t *testing.T) { + t.Parallel() + + orig := bytes.NewBuffer([]byte("hello world")) + + crc := &compressReadCloser{ + Reader: orig, + orig: tc.wrapper(orig), + } + + require.NoError(t, iotest.TestReader(crc, orig.Bytes()), "Must be able to read original content") + + err := crc.Close() + if tc.errVal != "" { + require.EqualError(t, err, tc.errVal, "Must match the expected error message") + } else { + require.NoError(t, err, "Must not error when closing reader") + } + }) + } +} diff --git a/config/confighttp/compression.go b/config/confighttp/compression.go index 4498fefe864..6680b61ff4f 100644 --- a/config/confighttp/compression.go +++ b/config/confighttp/compression.go @@ -58,17 +58,13 @@ var availableDecoders = map[string]func(body io.ReadCloser) (io.ReadCloser, erro } return zr, nil }, + //nolint:unparam // Ignoring the linter request to remove error return since it needs to match the method signature "snappy": func(body io.ReadCloser) (io.ReadCloser, error) { - sr := snappy.NewReader(body) - sb := new(bytes.Buffer) - _, err := io.Copy(sb, sr) - if err != nil { - return nil, err - } - if err = body.Close(); err != nil { - return nil, err - } - return io.NopCloser(sb), nil + // Lazy Reading content to improve memory efficiency + return &compressReadCloser{ + Reader: snappy.NewReader(body), + orig: body, + }, nil }, } diff --git a/config/confighttp/compression_test.go b/config/confighttp/compression_test.go index 9ebebfe4a7e..169120ad4fb 100644 --- a/config/confighttp/compression_test.go +++ b/config/confighttp/compression_test.go @@ -232,7 +232,7 @@ func TestHTTPContentDecompressionHandler(t *testing.T) { encoding: "snappy", reqBody: bytes.NewBuffer(testBody), respCode: http.StatusBadRequest, - respBody: "snappy: corrupt input\n", + respBody: "snappy: corrupt input", }, { name: "UnsupportedCompression", diff --git a/config/confighttp/confighttp_test.go b/config/confighttp/confighttp_test.go index 955e44cd081..486719bb375 100644 --- a/config/confighttp/confighttp_test.go +++ b/config/confighttp/confighttp_test.go @@ -37,8 +37,6 @@ import ( "go.opentelemetry.io/collector/config/configtls" "go.opentelemetry.io/collector/extension/auth" "go.opentelemetry.io/collector/extension/auth/authtest" - "go.opentelemetry.io/collector/featuregate" - "go.opentelemetry.io/collector/internal/globalgates" ) type customRoundTripper struct { @@ -523,13 +521,6 @@ func TestHTTPServerSettingsError(t *testing.T) { } func TestHTTPServerWarning(t *testing.T) { - prev := globalgates.UseLocalHostAsDefaultHostfeatureGate.IsEnabled() - require.NoError(t, featuregate.GlobalRegistry().Set(globalgates.UseLocalHostAsDefaultHostID, false)) - defer func() { - // Restore previous value. - require.NoError(t, featuregate.GlobalRegistry().Set(globalgates.UseLocalHostAsDefaultHostID, prev)) - }() - tests := []struct { name string settings ServerConfig diff --git a/config/confighttp/go.mod b/config/confighttp/go.mod index 40ac61fae23..ef7ff3018dd 100644 --- a/config/confighttp/go.mod +++ b/config/confighttp/go.mod @@ -4,20 +4,18 @@ go 1.22.0 require ( github.com/golang/snappy v0.0.4 - github.com/klauspost/compress v1.17.9 + github.com/klauspost/compress v1.17.10 github.com/rs/cors v1.11.1 github.com/stretchr/testify v1.9.0 - go.opentelemetry.io/collector/client v1.15.0 - go.opentelemetry.io/collector/component v0.109.0 - go.opentelemetry.io/collector/config/configauth v0.109.0 - go.opentelemetry.io/collector/config/configcompression v1.15.0 - go.opentelemetry.io/collector/config/configopaque v1.15.0 - go.opentelemetry.io/collector/config/configtelemetry v0.109.0 - go.opentelemetry.io/collector/config/configtls v1.15.0 - go.opentelemetry.io/collector/config/internal v0.109.1-0.20240916143658-74729e731d3b - go.opentelemetry.io/collector/extension/auth v0.109.0 - go.opentelemetry.io/collector/featuregate v1.15.0 - go.opentelemetry.io/collector/internal/globalgates v0.109.0 + go.opentelemetry.io/collector/client v1.16.0 + go.opentelemetry.io/collector/component v0.110.0 + go.opentelemetry.io/collector/config/configauth v0.110.0 + go.opentelemetry.io/collector/config/configcompression v1.16.0 + go.opentelemetry.io/collector/config/configopaque v1.16.0 + go.opentelemetry.io/collector/config/configtelemetry v0.110.0 + go.opentelemetry.io/collector/config/configtls v1.16.0 + go.opentelemetry.io/collector/config/internal v0.110.0 + go.opentelemetry.io/collector/extension/auth v0.110.0 go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.55.0 go.opentelemetry.io/otel v1.30.0 go.opentelemetry.io/otel/metric v1.30.0 @@ -35,17 +33,18 @@ 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/hashicorp/go-version v1.7.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/collector/extension v0.109.0 // indirect - go.opentelemetry.io/collector/pdata v1.15.0 // indirect + go.opentelemetry.io/collector/extension v0.110.0 // indirect + go.opentelemetry.io/collector/internal/globalsignal v0.110.0 // indirect + go.opentelemetry.io/collector/pdata v1.16.0 // indirect + go.opentelemetry.io/collector/pipeline v0.110.0 // indirect go.opentelemetry.io/otel/sdk v1.30.0 // indirect go.opentelemetry.io/otel/sdk/metric v1.30.0 // indirect go.uber.org/multierr v1.11.0 // indirect golang.org/x/sys v0.25.0 // indirect golang.org/x/text v0.18.0 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240822170219-fc7c04adadcd // indirect - google.golang.org/grpc v1.66.2 // indirect + google.golang.org/grpc v1.67.0 // indirect google.golang.org/protobuf v1.34.2 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) @@ -66,8 +65,6 @@ 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/pdata => ../../pdata replace go.opentelemetry.io/collector/component => ../../component @@ -80,4 +77,6 @@ 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/internal/globalsignal => ../../internal/globalsignal + +replace go.opentelemetry.io/collector/pipeline => ../../pipeline diff --git a/config/confighttp/go.sum b/config/confighttp/go.sum index 3a725581531..458ef317748 100644 --- a/config/confighttp/go.sum +++ b/config/confighttp/go.sum @@ -17,14 +17,12 @@ 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/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/klauspost/compress v1.17.10 h1:oXAz+Vh0PMUvJczoi+flxpnBEPxoER1IaAnU/NMPtT0= +github.com/klauspost/compress v1.17.10/go.mod h1:pMDklpSncoRMuLFrf1W9Ss9KT+0rH90U12bZKk7uwG0= 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= @@ -94,8 +92,8 @@ golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8T golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/genproto/googleapis/rpc v0.0.0-20240822170219-fc7c04adadcd h1:6TEm2ZxXoQmFWFlt1vNxvVOa1Q0dXFQD1m/rYjXmS0E= google.golang.org/genproto/googleapis/rpc v0.0.0-20240822170219-fc7c04adadcd/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU= -google.golang.org/grpc v1.66.2 h1:3QdXkuq3Bkh7w+ywLdLvM56cmGvQHUMZpiCzt6Rqaoo= -google.golang.org/grpc v1.66.2/go.mod h1:s3/l6xSSCURdVfAnL+TqCNMyTDAGN6+lZeVxnZR128Y= +google.golang.org/grpc v1.67.0 h1:IdH9y6PF5MPSdAntIcpjQ+tXO41pcQsfZV2RxtQgVcw= +google.golang.org/grpc v1.67.0/go.mod h1:1gLDyUQU7CTLJI90u3nXZ9ekeghjeM7pTDZlqFNg2AA= google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/config/configtls/go.mod b/config/configtls/go.mod index f1f71f3bd3a..a9f43eea758 100644 --- a/config/configtls/go.mod +++ b/config/configtls/go.mod @@ -5,7 +5,7 @@ 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.15.0 + go.opentelemetry.io/collector/config/configopaque v1.16.0 ) require ( diff --git a/config/internal/go.mod b/config/internal/go.mod index 8fad43d6125..789a39e4a7f 100644 --- a/config/internal/go.mod +++ b/config/internal/go.mod @@ -4,21 +4,16 @@ go 1.22.0 require ( github.com/stretchr/testify v1.9.0 - go.opentelemetry.io/collector/internal/globalgates v0.109.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/hashicorp/go-version v1.7.0 // indirect + github.com/kr/pretty v0.3.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/rogpeppe/go-internal v1.12.0 // indirect - go.opentelemetry.io/collector/featuregate v1.15.0 // indirect go.uber.org/multierr v1.11.0 // indirect + gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) - -replace go.opentelemetry.io/collector/internal/globalgates => ../../internal/globalgates - -replace go.opentelemetry.io/collector/featuregate => ../../featuregate diff --git a/config/internal/go.sum b/config/internal/go.sum index 9e6446c034d..fa6db793021 100644 --- a/config/internal/go.sum +++ b/config/internal/go.sum @@ -1,13 +1,17 @@ +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/hashicorp/go-version v1.7.0 h1:5tqGy27NaOTB8yJKUZELlFAS/LTKJkrmONwQKeRZfjY= -github.com/hashicorp/go-version v1.7.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= +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/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.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8= github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4= github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= diff --git a/config/internal/warning.go b/config/internal/warning.go index 26eca49a7bb..0f5f6363431 100644 --- a/config/internal/warning.go +++ b/config/internal/warning.go @@ -9,8 +9,6 @@ import ( "strings" "go.uber.org/zap" - - "go.opentelemetry.io/collector/internal/globalgates" ) func shouldWarn(endpoint string) bool { @@ -38,14 +36,13 @@ func shouldWarn(endpoint string) bool { // WarnOnUnspecifiedHost emits a warning if an endpoint has an unspecified host. func WarnOnUnspecifiedHost(logger *zap.Logger, endpoint string) { - if !globalgates.UseLocalHostAsDefaultHostfeatureGate.IsEnabled() && shouldWarn(endpoint) { + if shouldWarn(endpoint) { logger.Warn( - "Using the 0.0.0.0 address exposes this server to every network interface, which may facilitate Denial of Service attacks. Enable the feature gate to change the default and remove this warning.", + "Using the 0.0.0.0 address exposes this server to every network interface, which may facilitate Denial of Service attacks.", zap.String( "documentation", "https://github.com/open-telemetry/opentelemetry-collector/blob/main/docs/security-best-practices.md#safeguards-against-denial-of-service-attacks", ), - zap.String("feature gate ID", globalgates.UseLocalHostAsDefaultHostID), ) } } diff --git a/confmap/converter/expandconverter/go.mod b/confmap/converter/expandconverter/go.mod index be326dccce9..4bbbb70215f 100644 --- a/confmap/converter/expandconverter/go.mod +++ b/confmap/converter/expandconverter/go.mod @@ -6,7 +6,7 @@ go 1.22.0 require ( github.com/stretchr/testify v1.9.0 - go.opentelemetry.io/collector/confmap v1.15.0 + go.opentelemetry.io/collector/confmap v1.16.0 go.uber.org/goleak v1.3.0 go.uber.org/zap v1.27.0 ) diff --git a/confmap/expand_test.go b/confmap/expand_test.go index a9a3b49b850..d634564d5b6 100644 --- a/confmap/expand_test.go +++ b/confmap/expand_test.go @@ -185,6 +185,11 @@ func TestResolverExpandStringValues(t *testing.T) { input: "test_${env:BOOL}", output: "test_true", }, + { + name: "Timestamp", + input: "test_${env:TIMESTAMP}", + output: "test_2023-03-20T03:17:55.432328Z", + }, { name: "MultipleSameMatches", input: "test_${env:BOOL}_test_${env:BOOL}", @@ -414,6 +419,8 @@ func newEnvProvider() ProviderFactory { return NewRetrievedFromYAML([]byte("[localhost:3042]")) case "env:HOST": return NewRetrievedFromYAML([]byte("localhost")) + case "env:TIMESTAMP": + return NewRetrievedFromYAML([]byte("2023-03-20T03:17:55.432328Z")) case "env:OS": return NewRetrievedFromYAML([]byte("ubuntu")) case "env:PR": diff --git a/confmap/internal/e2e/go.mod b/confmap/internal/e2e/go.mod index 158020f33ec..ea8fba82422 100644 --- a/confmap/internal/e2e/go.mod +++ b/confmap/internal/e2e/go.mod @@ -4,10 +4,10 @@ go 1.22.0 require ( github.com/stretchr/testify v1.9.0 - go.opentelemetry.io/collector/config/configopaque v1.15.0 - go.opentelemetry.io/collector/confmap v1.15.0 - go.opentelemetry.io/collector/confmap/provider/envprovider v1.15.0 - go.opentelemetry.io/collector/confmap/provider/fileprovider v1.15.0 + go.opentelemetry.io/collector/config/configopaque v1.16.0 + go.opentelemetry.io/collector/confmap v1.16.0 + go.opentelemetry.io/collector/confmap/provider/envprovider v1.16.0 + go.opentelemetry.io/collector/confmap/provider/fileprovider v1.16.0 ) require ( diff --git a/confmap/internal/e2e/types_test.go b/confmap/internal/e2e/types_test.go index 6085ba0a438..6e335daaa6c 100644 --- a/confmap/internal/e2e/types_test.go +++ b/confmap/internal/e2e/types_test.go @@ -197,6 +197,16 @@ func TestStrictTypeCasting(t *testing.T) { targetField: TargetFieldInlineString, expected: "inline field with 2006-01-02T15:04:05Z07:00 expansion", }, + { + value: "2023-03-20T03:17:55.432328Z", + targetField: TargetFieldString, + expected: "2023-03-20T03:17:55.432328Z", + }, + { + value: "2023-03-20T03:17:55.432328Z", + targetField: TargetFieldInlineString, + expected: "inline field with 2023-03-20T03:17:55.432328Z expansion", + }, // issue 10787 { value: "true # comment with a ${env:hello.world} reference", diff --git a/confmap/provider.go b/confmap/provider.go index daf508bf925..c462b9bb6fe 100644 --- a/confmap/provider.go +++ b/confmap/provider.go @@ -6,6 +6,7 @@ package confmap // import "go.opentelemetry.io/collector/confmap" import ( "context" "fmt" + "time" "go.uber.org/zap" "gopkg.in/yaml.v3" @@ -235,7 +236,7 @@ func checkRawConfType(rawConf any) error { return nil } switch rawConf.(type) { - case int, int32, int64, float32, float64, bool, string, []any, map[string]any: + case int, int32, int64, float32, float64, bool, string, []any, map[string]any, time.Time: return nil default: return fmt.Errorf( diff --git a/confmap/provider/envprovider/go.mod b/confmap/provider/envprovider/go.mod index 0199fb72936..5f37650647c 100644 --- a/confmap/provider/envprovider/go.mod +++ b/confmap/provider/envprovider/go.mod @@ -4,7 +4,7 @@ go 1.22.0 require ( github.com/stretchr/testify v1.9.0 - go.opentelemetry.io/collector/confmap v1.15.0 + go.opentelemetry.io/collector/confmap v1.16.0 go.uber.org/goleak v1.3.0 go.uber.org/zap v1.27.0 ) diff --git a/confmap/provider/fileprovider/go.mod b/confmap/provider/fileprovider/go.mod index 1e2d279397a..7aa1090b9c6 100644 --- a/confmap/provider/fileprovider/go.mod +++ b/confmap/provider/fileprovider/go.mod @@ -4,7 +4,7 @@ go 1.22.0 require ( github.com/stretchr/testify v1.9.0 - go.opentelemetry.io/collector/confmap v1.15.0 + go.opentelemetry.io/collector/confmap v1.16.0 go.uber.org/goleak v1.3.0 ) diff --git a/confmap/provider/httpprovider/go.mod b/confmap/provider/httpprovider/go.mod index fe05d95f1b0..5292c64364b 100644 --- a/confmap/provider/httpprovider/go.mod +++ b/confmap/provider/httpprovider/go.mod @@ -4,7 +4,7 @@ go 1.22.0 require ( github.com/stretchr/testify v1.9.0 - go.opentelemetry.io/collector/confmap v1.15.0 + go.opentelemetry.io/collector/confmap v1.16.0 go.uber.org/goleak v1.3.0 ) diff --git a/confmap/provider/httpsprovider/go.mod b/confmap/provider/httpsprovider/go.mod index 1b83510df6c..ef6786dcf0f 100644 --- a/confmap/provider/httpsprovider/go.mod +++ b/confmap/provider/httpsprovider/go.mod @@ -4,7 +4,7 @@ go 1.22.0 require ( github.com/stretchr/testify v1.9.0 - go.opentelemetry.io/collector/confmap v1.15.0 + go.opentelemetry.io/collector/confmap v1.16.0 go.uber.org/goleak v1.3.0 ) diff --git a/confmap/provider/yamlprovider/go.mod b/confmap/provider/yamlprovider/go.mod index 6a3bf4e458e..6d9c8d07c93 100644 --- a/confmap/provider/yamlprovider/go.mod +++ b/confmap/provider/yamlprovider/go.mod @@ -4,7 +4,7 @@ go 1.22.0 require ( github.com/stretchr/testify v1.9.0 - go.opentelemetry.io/collector/confmap v1.15.0 + go.opentelemetry.io/collector/confmap v1.16.0 go.uber.org/goleak v1.3.0 ) diff --git a/confmap/provider_test.go b/confmap/provider_test.go index e82ddf90355..3877222865c 100644 --- a/confmap/provider_test.go +++ b/confmap/provider_test.go @@ -7,6 +7,7 @@ import ( "context" "errors" "testing" + "time" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" @@ -103,6 +104,10 @@ func TestNewRetrievedFromYAMLString(t *testing.T) { yaml: "123", value: 123, }, + { + yaml: "2023-03-20T03:17:55.432328Z", + value: time.Date(2023, 3, 20, 3, 17, 55, 432328000, time.UTC), + }, { yaml: "true", value: true, diff --git a/connector/connector_test.go b/connector/connector_test.go index 9b94cee7636..6dcff6d6a97 100644 --- a/connector/connector_test.go +++ b/connector/connector_test.go @@ -14,6 +14,7 @@ import ( "go.opentelemetry.io/collector/connector/internal" "go.opentelemetry.io/collector/consumer" "go.opentelemetry.io/collector/consumer/consumertest" + "go.opentelemetry.io/collector/pipeline" ) var ( @@ -28,25 +29,25 @@ func TestNewFactoryNoOptions(t *testing.T) { assert.EqualValues(t, &defaultCfg, factory.CreateDefaultConfig()) _, err := factory.CreateTracesToTraces(context.Background(), Settings{ID: testID}, &defaultCfg, consumertest.NewNop()) - assert.Equal(t, err, internal.ErrDataTypes(testID, component.DataTypeTraces, component.DataTypeTraces)) + assert.Equal(t, err, internal.ErrDataTypes(testID, pipeline.SignalTraces, pipeline.SignalTraces)) _, err = factory.CreateTracesToMetrics(context.Background(), Settings{ID: testID}, &defaultCfg, consumertest.NewNop()) - assert.Equal(t, err, internal.ErrDataTypes(testID, component.DataTypeTraces, component.DataTypeMetrics)) + assert.Equal(t, err, internal.ErrDataTypes(testID, pipeline.SignalTraces, pipeline.SignalMetrics)) _, err = factory.CreateTracesToLogs(context.Background(), Settings{ID: testID}, &defaultCfg, consumertest.NewNop()) - assert.Equal(t, err, internal.ErrDataTypes(testID, component.DataTypeTraces, component.DataTypeLogs)) + assert.Equal(t, err, internal.ErrDataTypes(testID, pipeline.SignalTraces, pipeline.SignalLogs)) _, err = factory.CreateMetricsToTraces(context.Background(), Settings{ID: testID}, &defaultCfg, consumertest.NewNop()) - assert.Equal(t, err, internal.ErrDataTypes(testID, component.DataTypeMetrics, component.DataTypeTraces)) + assert.Equal(t, err, internal.ErrDataTypes(testID, pipeline.SignalMetrics, pipeline.SignalTraces)) _, err = factory.CreateMetricsToMetrics(context.Background(), Settings{ID: testID}, &defaultCfg, consumertest.NewNop()) - assert.Equal(t, err, internal.ErrDataTypes(testID, component.DataTypeMetrics, component.DataTypeMetrics)) + assert.Equal(t, err, internal.ErrDataTypes(testID, pipeline.SignalMetrics, pipeline.SignalMetrics)) _, err = factory.CreateMetricsToLogs(context.Background(), Settings{ID: testID}, &defaultCfg, consumertest.NewNop()) - assert.Equal(t, err, internal.ErrDataTypes(testID, component.DataTypeMetrics, component.DataTypeLogs)) + assert.Equal(t, err, internal.ErrDataTypes(testID, pipeline.SignalMetrics, pipeline.SignalLogs)) _, err = factory.CreateLogsToTraces(context.Background(), Settings{ID: testID}, &defaultCfg, consumertest.NewNop()) - assert.Equal(t, err, internal.ErrDataTypes(testID, component.DataTypeLogs, component.DataTypeTraces)) + assert.Equal(t, err, internal.ErrDataTypes(testID, pipeline.SignalLogs, pipeline.SignalTraces)) _, err = factory.CreateLogsToMetrics(context.Background(), Settings{ID: testID}, &defaultCfg, consumertest.NewNop()) - assert.Equal(t, err, internal.ErrDataTypes(testID, component.DataTypeLogs, component.DataTypeMetrics)) + assert.Equal(t, err, internal.ErrDataTypes(testID, pipeline.SignalLogs, pipeline.SignalMetrics)) _, err = factory.CreateLogsToLogs(context.Background(), Settings{ID: testID}, &defaultCfg, consumertest.NewNop()) - assert.Equal(t, err, internal.ErrDataTypes(testID, component.DataTypeLogs, component.DataTypeLogs)) + assert.Equal(t, err, internal.ErrDataTypes(testID, pipeline.SignalLogs, pipeline.SignalLogs)) } func TestNewFactoryWithSameTypes(t *testing.T) { @@ -71,19 +72,19 @@ func TestNewFactoryWithSameTypes(t *testing.T) { require.NoError(t, err) _, err = factory.CreateTracesToMetrics(context.Background(), Settings{ID: testID}, &defaultCfg, consumertest.NewNop()) - assert.Equal(t, err, internal.ErrDataTypes(testID, component.DataTypeTraces, component.DataTypeMetrics)) + assert.Equal(t, err, internal.ErrDataTypes(testID, pipeline.SignalTraces, pipeline.SignalMetrics)) _, err = factory.CreateTracesToLogs(context.Background(), Settings{ID: testID}, &defaultCfg, consumertest.NewNop()) - assert.Equal(t, err, internal.ErrDataTypes(testID, component.DataTypeTraces, component.DataTypeLogs)) + assert.Equal(t, err, internal.ErrDataTypes(testID, pipeline.SignalTraces, pipeline.SignalLogs)) _, err = factory.CreateMetricsToTraces(context.Background(), Settings{ID: testID}, &defaultCfg, consumertest.NewNop()) - assert.Equal(t, err, internal.ErrDataTypes(testID, component.DataTypeMetrics, component.DataTypeTraces)) + assert.Equal(t, err, internal.ErrDataTypes(testID, pipeline.SignalMetrics, pipeline.SignalTraces)) _, err = factory.CreateMetricsToLogs(context.Background(), Settings{ID: testID}, &defaultCfg, consumertest.NewNop()) - assert.Equal(t, err, internal.ErrDataTypes(testID, component.DataTypeMetrics, component.DataTypeLogs)) + assert.Equal(t, err, internal.ErrDataTypes(testID, pipeline.SignalMetrics, pipeline.SignalLogs)) _, err = factory.CreateLogsToTraces(context.Background(), Settings{ID: testID}, &defaultCfg, consumertest.NewNop()) - assert.Equal(t, err, internal.ErrDataTypes(testID, component.DataTypeLogs, component.DataTypeTraces)) + assert.Equal(t, err, internal.ErrDataTypes(testID, pipeline.SignalLogs, pipeline.SignalTraces)) _, err = factory.CreateLogsToMetrics(context.Background(), Settings{ID: testID}, &defaultCfg, consumertest.NewNop()) - assert.Equal(t, err, internal.ErrDataTypes(testID, component.DataTypeLogs, component.DataTypeMetrics)) + assert.Equal(t, err, internal.ErrDataTypes(testID, pipeline.SignalLogs, pipeline.SignalMetrics)) } func TestNewFactoryWithTranslateTypes(t *testing.T) { @@ -99,11 +100,11 @@ func TestNewFactoryWithTranslateTypes(t *testing.T) { assert.EqualValues(t, &defaultCfg, factory.CreateDefaultConfig()) _, err := factory.CreateTracesToTraces(context.Background(), Settings{ID: testID}, &defaultCfg, consumertest.NewNop()) - assert.Equal(t, err, internal.ErrDataTypes(testID, component.DataTypeTraces, component.DataTypeTraces)) + assert.Equal(t, err, internal.ErrDataTypes(testID, pipeline.SignalTraces, pipeline.SignalTraces)) _, err = factory.CreateMetricsToMetrics(context.Background(), Settings{ID: testID}, &defaultCfg, consumertest.NewNop()) - assert.Equal(t, err, internal.ErrDataTypes(testID, component.DataTypeMetrics, component.DataTypeMetrics)) + assert.Equal(t, err, internal.ErrDataTypes(testID, pipeline.SignalMetrics, pipeline.SignalMetrics)) _, err = factory.CreateLogsToLogs(context.Background(), Settings{ID: testID}, &defaultCfg, consumertest.NewNop()) - assert.Equal(t, err, internal.ErrDataTypes(testID, component.DataTypeLogs, component.DataTypeLogs)) + assert.Equal(t, err, internal.ErrDataTypes(testID, pipeline.SignalLogs, pipeline.SignalLogs)) assert.Equal(t, component.StabilityLevelDevelopment, factory.TracesToMetricsStability()) _, err = factory.CreateTracesToMetrics(context.Background(), Settings{ID: testID}, &defaultCfg, consumertest.NewNop()) diff --git a/connector/connectorprofiles/connector_test.go b/connector/connectorprofiles/connector_test.go index 93493213c79..e50374fa657 100644 --- a/connector/connectorprofiles/connector_test.go +++ b/connector/connectorprofiles/connector_test.go @@ -17,6 +17,7 @@ import ( "go.opentelemetry.io/collector/consumer" "go.opentelemetry.io/collector/consumer/consumerprofiles" "go.opentelemetry.io/collector/consumer/consumertest" + "go.opentelemetry.io/collector/pipeline" ) var ( @@ -31,18 +32,18 @@ func TestNewFactoryNoOptions(t *testing.T) { assert.EqualValues(t, &defaultCfg, factory.CreateDefaultConfig()) _, err := factory.CreateTracesToProfiles(context.Background(), connector.Settings{ID: testID}, &defaultCfg, consumertest.NewNop()) - assert.Equal(t, err, internal.ErrDataTypes(testID, component.DataTypeTraces, componentprofiles.DataTypeProfiles)) + assert.Equal(t, err, internal.ErrDataTypes(testID, pipeline.SignalTraces, componentprofiles.SignalProfiles)) _, err = factory.CreateMetricsToProfiles(context.Background(), connector.Settings{ID: testID}, &defaultCfg, consumertest.NewNop()) - assert.Equal(t, err, internal.ErrDataTypes(testID, component.DataTypeMetrics, componentprofiles.DataTypeProfiles)) + assert.Equal(t, err, internal.ErrDataTypes(testID, pipeline.SignalMetrics, componentprofiles.SignalProfiles)) _, err = factory.CreateLogsToProfiles(context.Background(), connector.Settings{ID: testID}, &defaultCfg, consumertest.NewNop()) - assert.Equal(t, err, internal.ErrDataTypes(testID, component.DataTypeLogs, componentprofiles.DataTypeProfiles)) + assert.Equal(t, err, internal.ErrDataTypes(testID, pipeline.SignalLogs, componentprofiles.SignalProfiles)) _, err = factory.CreateProfilesToTraces(context.Background(), connector.Settings{ID: testID}, &defaultCfg, consumertest.NewNop()) - assert.Equal(t, err, internal.ErrDataTypes(testID, componentprofiles.DataTypeProfiles, component.DataTypeTraces)) + assert.Equal(t, err, internal.ErrDataTypes(testID, componentprofiles.SignalProfiles, pipeline.SignalTraces)) _, err = factory.CreateProfilesToMetrics(context.Background(), connector.Settings{ID: testID}, &defaultCfg, consumertest.NewNop()) - assert.Equal(t, err, internal.ErrDataTypes(testID, componentprofiles.DataTypeProfiles, component.DataTypeMetrics)) + assert.Equal(t, err, internal.ErrDataTypes(testID, componentprofiles.SignalProfiles, pipeline.SignalMetrics)) _, err = factory.CreateProfilesToLogs(context.Background(), connector.Settings{ID: testID}, &defaultCfg, consumertest.NewNop()) - assert.Equal(t, err, internal.ErrDataTypes(testID, componentprofiles.DataTypeProfiles, component.DataTypeLogs)) + assert.Equal(t, err, internal.ErrDataTypes(testID, componentprofiles.SignalProfiles, pipeline.SignalLogs)) } func TestNewFactoryWithSameTypes(t *testing.T) { @@ -58,11 +59,11 @@ func TestNewFactoryWithSameTypes(t *testing.T) { require.NoError(t, err) _, err = factory.CreateProfilesToTraces(context.Background(), connector.Settings{ID: testID}, &defaultCfg, consumertest.NewNop()) - assert.Equal(t, err, internal.ErrDataTypes(testID, componentprofiles.DataTypeProfiles, component.DataTypeTraces)) + assert.Equal(t, err, internal.ErrDataTypes(testID, componentprofiles.SignalProfiles, pipeline.SignalTraces)) _, err = factory.CreateProfilesToMetrics(context.Background(), connector.Settings{ID: testID}, &defaultCfg, consumertest.NewNop()) - assert.Equal(t, err, internal.ErrDataTypes(testID, componentprofiles.DataTypeProfiles, component.DataTypeMetrics)) + assert.Equal(t, err, internal.ErrDataTypes(testID, componentprofiles.SignalProfiles, pipeline.SignalMetrics)) _, err = factory.CreateProfilesToLogs(context.Background(), connector.Settings{ID: testID}, &defaultCfg, consumertest.NewNop()) - assert.Equal(t, err, internal.ErrDataTypes(testID, componentprofiles.DataTypeProfiles, component.DataTypeLogs)) + assert.Equal(t, err, internal.ErrDataTypes(testID, componentprofiles.SignalProfiles, pipeline.SignalLogs)) } func TestNewFactoryWithTranslateTypes(t *testing.T) { @@ -80,7 +81,7 @@ func TestNewFactoryWithTranslateTypes(t *testing.T) { assert.EqualValues(t, &defaultCfg, factory.CreateDefaultConfig()) _, err := factory.CreateProfilesToProfiles(context.Background(), connector.Settings{ID: testID}, &defaultCfg, consumertest.NewNop()) - assert.Equal(t, err, internal.ErrDataTypes(testID, componentprofiles.DataTypeProfiles, componentprofiles.DataTypeProfiles)) + assert.Equal(t, err, internal.ErrDataTypes(testID, componentprofiles.SignalProfiles, componentprofiles.SignalProfiles)) assert.Equal(t, component.StabilityLevelBeta, factory.TracesToProfilesStability()) _, err = factory.CreateTracesToProfiles(context.Background(), connector.Settings{ID: testID}, &defaultCfg, consumertest.NewNop()) diff --git a/connector/connectorprofiles/go.mod b/connector/connectorprofiles/go.mod index 00df565781f..c981f4a2c5b 100644 --- a/connector/connectorprofiles/go.mod +++ b/connector/connectorprofiles/go.mod @@ -4,15 +4,16 @@ go 1.22.0 require ( github.com/stretchr/testify v1.9.0 - go.opentelemetry.io/collector v0.109.0 - go.opentelemetry.io/collector/component v0.109.0 - go.opentelemetry.io/collector/component/componentprofiles v0.109.0 - go.opentelemetry.io/collector/connector v0.109.0 - go.opentelemetry.io/collector/consumer v0.109.0 - go.opentelemetry.io/collector/consumer/consumerprofiles v0.109.0 - go.opentelemetry.io/collector/consumer/consumertest v0.109.0 - go.opentelemetry.io/collector/pdata/pprofile v0.109.0 - go.opentelemetry.io/collector/pdata/testdata v0.109.0 + go.opentelemetry.io/collector v0.110.0 + go.opentelemetry.io/collector/component v0.110.0 + go.opentelemetry.io/collector/component/componentprofiles v0.110.0 + go.opentelemetry.io/collector/connector v0.110.0 + go.opentelemetry.io/collector/consumer v0.110.0 + go.opentelemetry.io/collector/consumer/consumerprofiles v0.110.0 + go.opentelemetry.io/collector/consumer/consumertest v0.110.0 + go.opentelemetry.io/collector/pdata/pprofile v0.110.0 + go.opentelemetry.io/collector/pdata/testdata v0.110.0 + go.opentelemetry.io/collector/pipeline v0.110.0 ) require ( @@ -22,8 +23,9 @@ 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.109.0 // indirect - go.opentelemetry.io/collector/pdata v1.15.0 // indirect + go.opentelemetry.io/collector/config/configtelemetry v0.110.0 // indirect + go.opentelemetry.io/collector/internal/globalsignal v0.110.0 // indirect + go.opentelemetry.io/collector/pdata v1.16.0 // indirect go.opentelemetry.io/otel v1.30.0 // indirect go.opentelemetry.io/otel/metric v1.30.0 // indirect go.opentelemetry.io/otel/trace v1.30.0 // indirect @@ -33,7 +35,7 @@ require ( golang.org/x/sys v0.25.0 // indirect golang.org/x/text v0.17.0 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240822170219-fc7c04adadcd // indirect - google.golang.org/grpc v1.66.2 // indirect + google.golang.org/grpc v1.67.0 // indirect google.golang.org/protobuf v1.34.2 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) @@ -63,3 +65,7 @@ replace go.opentelemetry.io/collector/config/configtelemetry => ../../config/con replace go.opentelemetry.io/collector/pdata/testdata => ../../pdata/testdata replace go.opentelemetry.io/collector/component/componentstatus => ../../component/componentstatus + +replace go.opentelemetry.io/collector/pipeline => ../../pipeline + +replace go.opentelemetry.io/collector/internal/globalsignal => ../../internal/globalsignal diff --git a/connector/connectorprofiles/go.sum b/connector/connectorprofiles/go.sum index 3fe17284658..83ace7ad16c 100644 --- a/connector/connectorprofiles/go.sum +++ b/connector/connectorprofiles/go.sum @@ -78,8 +78,8 @@ golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8T golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/genproto/googleapis/rpc v0.0.0-20240822170219-fc7c04adadcd h1:6TEm2ZxXoQmFWFlt1vNxvVOa1Q0dXFQD1m/rYjXmS0E= google.golang.org/genproto/googleapis/rpc v0.0.0-20240822170219-fc7c04adadcd/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU= -google.golang.org/grpc v1.66.2 h1:3QdXkuq3Bkh7w+ywLdLvM56cmGvQHUMZpiCzt6Rqaoo= -google.golang.org/grpc v1.66.2/go.mod h1:s3/l6xSSCURdVfAnL+TqCNMyTDAGN6+lZeVxnZR128Y= +google.golang.org/grpc v1.67.0 h1:IdH9y6PF5MPSdAntIcpjQ+tXO41pcQsfZV2RxtQgVcw= +google.golang.org/grpc v1.67.0/go.mod h1:1gLDyUQU7CTLJI90u3nXZ9ekeghjeM7pTDZlqFNg2AA= google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/connector/connectorprofiles/profiles_router.go b/connector/connectorprofiles/profiles_router.go index 73e427f1d52..c171d166ef2 100644 --- a/connector/connectorprofiles/profiles_router.go +++ b/connector/connectorprofiles/profiles_router.go @@ -4,17 +4,16 @@ package connectorprofiles // import "go.opentelemetry.io/collector/connector/connectorprofiles" import ( - "go.opentelemetry.io/collector/component" "go.opentelemetry.io/collector/connector/internal" "go.opentelemetry.io/collector/consumer/consumerprofiles" "go.opentelemetry.io/collector/internal/fanoutconsumer" + "go.opentelemetry.io/collector/pipeline" ) -// ProfilesRouterAndConsumer feeds the first consumerprofiles.Profiles in each of the specified pipelines. type ProfilesRouterAndConsumer interface { consumerprofiles.Profiles - Consumer(...component.ID) (consumerprofiles.Profiles, error) - PipelineIDs() []component.ID + Consumer(...pipeline.ID) (consumerprofiles.Profiles, error) + PipelineIDs() []pipeline.ID privateFunc() } @@ -23,7 +22,7 @@ type profilesRouter struct { internal.BaseRouter[consumerprofiles.Profiles] } -func NewProfilesRouter(cm map[component.ID]consumerprofiles.Profiles) ProfilesRouterAndConsumer { +func NewProfilesRouter(cm map[pipeline.ID]consumerprofiles.Profiles) ProfilesRouterAndConsumer { consumers := make([]consumerprofiles.Profiles, 0, len(cm)) for _, cons := range cm { consumers = append(consumers, cons) diff --git a/connector/connectorprofiles/profiles_router_test.go b/connector/connectorprofiles/profiles_router_test.go index 0eb69a12be9..b28fc1a581e 100644 --- a/connector/connectorprofiles/profiles_router_test.go +++ b/connector/connectorprofiles/profiles_router_test.go @@ -12,12 +12,12 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "go.opentelemetry.io/collector/component" "go.opentelemetry.io/collector/consumer" "go.opentelemetry.io/collector/consumer/consumerprofiles" "go.opentelemetry.io/collector/consumer/consumertest" "go.opentelemetry.io/collector/pdata/pprofile" "go.opentelemetry.io/collector/pdata/testdata" + "go.opentelemetry.io/collector/pipeline" ) type mutatingProfilesSink struct { @@ -44,13 +44,13 @@ func TestProfilesRouterMultiplexing(t *testing.T) { func fuzzProfiles(numIDs, numCons, numProfiles int) func(*testing.T) { return func(t *testing.T) { - allIDs := make([]component.ID, 0, numCons) + allIDs := make([]pipeline.ID, 0, numCons) allCons := make([]consumerprofiles.Profiles, 0, numCons) - allConsMap := make(map[component.ID]consumerprofiles.Profiles) + allConsMap := make(map[pipeline.ID]consumerprofiles.Profiles) // If any consumer is mutating, the router must report mutating for i := 0; i < numCons; i++ { - allIDs = append(allIDs, component.MustNewIDWithName("sink", strconv.Itoa(numCons))) + allIDs = append(allIDs, pipeline.MustNewIDWithName("sink", strconv.Itoa(numCons))) // Random chance for each consumer to be mutating if (numCons+numProfiles+i)%4 == 0 { allCons = append(allCons, &mutatingProfilesSink{ProfilesSink: new(consumertest.ProfilesSink)}) @@ -65,11 +65,11 @@ func fuzzProfiles(numIDs, numCons, numProfiles int) func(*testing.T) { // Keep track of how many logs each consumer should receive. // This will be validated after every call to RouteProfiles. - expected := make(map[component.ID]int, numCons) + expected := make(map[pipeline.ID]int, numCons) for i := 0; i < numProfiles; i++ { // Build a random set of ids (no duplicates) - randCons := make(map[component.ID]bool, numIDs) + randCons := make(map[pipeline.ID]bool, numIDs) for j := 0; j < numIDs; j++ { // This number should be pretty random and less than numCons conNum := (numCons + numIDs + i + j) % numCons @@ -77,7 +77,7 @@ func fuzzProfiles(numIDs, numCons, numProfiles int) func(*testing.T) { } // Convert to slice, update expectations - conIDs := make([]component.ID, 0, len(randCons)) + conIDs := make([]pipeline.ID, 0, len(randCons)) for id := range randCons { conIDs = append(conIDs, id) expected[id]++ @@ -110,16 +110,16 @@ func TestProfilessRouterConsumer(t *testing.T) { ctx := context.Background() td := testdata.GenerateProfiles(1) - fooID := component.MustNewID("foo") - barID := component.MustNewID("bar") + fooID := pipeline.MustNewID("foo") + barID := pipeline.MustNewID("bar") foo := new(consumertest.ProfilesSink) bar := new(consumertest.ProfilesSink) - r := NewProfilesRouter(map[component.ID]consumerprofiles.Profiles{fooID: foo, barID: bar}) + r := NewProfilesRouter(map[pipeline.ID]consumerprofiles.Profiles{fooID: foo, barID: bar}) rcs := r.PipelineIDs() assert.Len(t, rcs, 2) - assert.ElementsMatch(t, []component.ID{fooID, barID}, rcs) + assert.ElementsMatch(t, []pipeline.ID{fooID, barID}, rcs) assert.Empty(t, foo.AllProfiles()) assert.Empty(t, bar.AllProfiles()) @@ -152,7 +152,7 @@ func TestProfilessRouterConsumer(t *testing.T) { assert.Nil(t, none) require.Error(t, err) - fake, err := r.Consumer(component.MustNewID("fake")) + fake, err := r.Consumer(pipeline.MustNewID("fake")) assert.Nil(t, fake) assert.Error(t, err) } diff --git a/connector/forwardconnector/generated_component_test.go b/connector/forwardconnector/generated_component_test.go index 8c7da3bc1fb..dcab04cfe6b 100644 --- a/connector/forwardconnector/generated_component_test.go +++ b/connector/forwardconnector/generated_component_test.go @@ -15,6 +15,7 @@ import ( "go.opentelemetry.io/collector/connector/connectortest" "go.opentelemetry.io/collector/consumer" "go.opentelemetry.io/collector/consumer/consumertest" + "go.opentelemetry.io/collector/pipeline" ) func TestComponentFactoryType(t *testing.T) { @@ -36,7 +37,7 @@ func TestComponentLifecycle(t *testing.T) { { name: "logs_to_logs", createFn: func(ctx context.Context, set connector.Settings, cfg component.Config) (component.Component, error) { - router := connector.NewLogsRouter(map[component.ID]consumer.Logs{component.NewID(component.DataTypeLogs): consumertest.NewNop()}) + router := connector.NewLogsRouter(map[pipeline.ID]consumer.Logs{pipeline.NewID(pipeline.SignalLogs): consumertest.NewNop()}) return factory.CreateLogsToLogs(ctx, set, cfg, router) }, }, @@ -44,7 +45,7 @@ func TestComponentLifecycle(t *testing.T) { { name: "metrics_to_metrics", createFn: func(ctx context.Context, set connector.Settings, cfg component.Config) (component.Component, error) { - router := connector.NewMetricsRouter(map[component.ID]consumer.Metrics{component.NewID(component.DataTypeMetrics): consumertest.NewNop()}) + router := connector.NewMetricsRouter(map[pipeline.ID]consumer.Metrics{pipeline.NewID(pipeline.SignalMetrics): consumertest.NewNop()}) return factory.CreateMetricsToMetrics(ctx, set, cfg, router) }, }, @@ -52,7 +53,7 @@ func TestComponentLifecycle(t *testing.T) { { name: "traces_to_traces", createFn: func(ctx context.Context, set connector.Settings, cfg component.Config) (component.Component, error) { - router := connector.NewTracesRouter(map[component.ID]consumer.Traces{component.NewID(component.DataTypeTraces): consumertest.NewNop()}) + router := connector.NewTracesRouter(map[pipeline.ID]consumer.Traces{pipeline.NewID(pipeline.SignalTraces): consumertest.NewNop()}) return factory.CreateTracesToTraces(ctx, set, cfg, router) }, }, diff --git a/connector/forwardconnector/go.mod b/connector/forwardconnector/go.mod index 4811873feff..43f5c02f75d 100644 --- a/connector/forwardconnector/go.mod +++ b/connector/forwardconnector/go.mod @@ -4,12 +4,13 @@ go 1.22.0 require ( github.com/stretchr/testify v1.9.0 - go.opentelemetry.io/collector/component v0.109.0 - go.opentelemetry.io/collector/confmap v1.15.0 - go.opentelemetry.io/collector/connector v0.109.0 - go.opentelemetry.io/collector/consumer v0.109.0 - go.opentelemetry.io/collector/consumer/consumertest v0.109.0 - go.opentelemetry.io/collector/pdata v1.15.0 + go.opentelemetry.io/collector/component v0.110.0 + go.opentelemetry.io/collector/confmap v1.16.0 + go.opentelemetry.io/collector/connector v0.110.0 + go.opentelemetry.io/collector/consumer v0.110.0 + go.opentelemetry.io/collector/consumer/consumertest v0.110.0 + go.opentelemetry.io/collector/pdata v1.16.0 + go.opentelemetry.io/collector/pipeline v0.110.0 go.uber.org/goleak v1.3.0 ) @@ -29,12 +30,13 @@ 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.109.0 // indirect - go.opentelemetry.io/collector/component/componentprofiles v0.109.0 // indirect - go.opentelemetry.io/collector/config/configtelemetry v0.109.0 // indirect - go.opentelemetry.io/collector/connector/connectorprofiles v0.109.0 // indirect - go.opentelemetry.io/collector/consumer/consumerprofiles v0.109.0 // indirect - go.opentelemetry.io/collector/pdata/pprofile v0.109.0 // indirect + go.opentelemetry.io/collector v0.110.0 // indirect + go.opentelemetry.io/collector/component/componentprofiles v0.110.0 // indirect + go.opentelemetry.io/collector/config/configtelemetry v0.110.0 // indirect + go.opentelemetry.io/collector/connector/connectorprofiles v0.110.0 // indirect + go.opentelemetry.io/collector/consumer/consumerprofiles v0.110.0 // indirect + go.opentelemetry.io/collector/internal/globalsignal v0.110.0 // indirect + go.opentelemetry.io/collector/pdata/pprofile v0.110.0 // indirect go.opentelemetry.io/otel v1.30.0 // indirect go.opentelemetry.io/otel/metric v1.30.0 // indirect go.opentelemetry.io/otel/sdk v1.30.0 // indirect @@ -46,7 +48,7 @@ require ( golang.org/x/sys v0.25.0 // indirect golang.org/x/text v0.17.0 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240822170219-fc7c04adadcd // indirect - google.golang.org/grpc v1.66.2 // indirect + google.golang.org/grpc v1.67.0 // indirect google.golang.org/protobuf v1.34.2 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) @@ -83,3 +85,7 @@ replace go.opentelemetry.io/collector/component/componentprofiles => ../../compo replace go.opentelemetry.io/collector/component/componentstatus => ../../component/componentstatus replace go.opentelemetry.io/collector/connector/connectorprofiles => ../connectorprofiles + +replace go.opentelemetry.io/collector/pipeline => ../../pipeline + +replace go.opentelemetry.io/collector/internal/globalsignal => ../../internal/globalsignal diff --git a/connector/forwardconnector/go.sum b/connector/forwardconnector/go.sum index cbe4ee901e5..b60fd1872d4 100644 --- a/connector/forwardconnector/go.sum +++ b/connector/forwardconnector/go.sum @@ -97,8 +97,8 @@ golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8T golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/genproto/googleapis/rpc v0.0.0-20240822170219-fc7c04adadcd h1:6TEm2ZxXoQmFWFlt1vNxvVOa1Q0dXFQD1m/rYjXmS0E= google.golang.org/genproto/googleapis/rpc v0.0.0-20240822170219-fc7c04adadcd/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU= -google.golang.org/grpc v1.66.2 h1:3QdXkuq3Bkh7w+ywLdLvM56cmGvQHUMZpiCzt6Rqaoo= -google.golang.org/grpc v1.66.2/go.mod h1:s3/l6xSSCURdVfAnL+TqCNMyTDAGN6+lZeVxnZR128Y= +google.golang.org/grpc v1.67.0 h1:IdH9y6PF5MPSdAntIcpjQ+tXO41pcQsfZV2RxtQgVcw= +google.golang.org/grpc v1.67.0/go.mod h1:1gLDyUQU7CTLJI90u3nXZ9ekeghjeM7pTDZlqFNg2AA= google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/connector/go.mod b/connector/go.mod index 15b5727cf76..d4a3f2ac1ea 100644 --- a/connector/go.mod +++ b/connector/go.mod @@ -5,16 +5,17 @@ go 1.22.0 require ( github.com/google/uuid v1.6.0 github.com/stretchr/testify v1.9.0 - go.opentelemetry.io/collector v0.109.0 - go.opentelemetry.io/collector/component v0.109.0 - go.opentelemetry.io/collector/component/componentprofiles v0.109.0 - go.opentelemetry.io/collector/connector/connectorprofiles v0.109.0 - go.opentelemetry.io/collector/consumer v0.109.0 - go.opentelemetry.io/collector/consumer/consumerprofiles v0.109.0 - go.opentelemetry.io/collector/consumer/consumertest v0.109.0 - go.opentelemetry.io/collector/pdata v1.15.0 - go.opentelemetry.io/collector/pdata/pprofile v0.109.0 - go.opentelemetry.io/collector/pdata/testdata v0.109.0 + go.opentelemetry.io/collector v0.110.0 + go.opentelemetry.io/collector/component v0.110.0 + go.opentelemetry.io/collector/component/componentprofiles v0.110.0 + go.opentelemetry.io/collector/connector/connectorprofiles v0.110.0 + go.opentelemetry.io/collector/consumer v0.110.0 + go.opentelemetry.io/collector/consumer/consumerprofiles v0.110.0 + go.opentelemetry.io/collector/consumer/consumertest v0.110.0 + go.opentelemetry.io/collector/pdata v1.16.0 + go.opentelemetry.io/collector/pdata/pprofile v0.110.0 + go.opentelemetry.io/collector/pdata/testdata v0.110.0 + go.opentelemetry.io/collector/pipeline v0.110.0 go.uber.org/goleak v1.3.0 go.uber.org/multierr v1.11.0 ) @@ -28,7 +29,8 @@ 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.109.0 // indirect + go.opentelemetry.io/collector/config/configtelemetry v0.110.0 // indirect + go.opentelemetry.io/collector/internal/globalsignal v0.110.0 // indirect go.opentelemetry.io/otel v1.30.0 // indirect go.opentelemetry.io/otel/metric v1.30.0 // indirect go.opentelemetry.io/otel/sdk v1.30.0 // indirect @@ -39,7 +41,7 @@ require ( golang.org/x/sys v0.25.0 // indirect golang.org/x/text v0.17.0 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240822170219-fc7c04adadcd // indirect - google.golang.org/grpc v1.66.2 // indirect + google.golang.org/grpc v1.67.0 // indirect google.golang.org/protobuf v1.34.2 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) @@ -69,3 +71,7 @@ replace go.opentelemetry.io/collector/component/componentprofiles => ../componen replace go.opentelemetry.io/collector/component/componentstatus => ../component/componentstatus replace go.opentelemetry.io/collector/connector/connectorprofiles => ./connectorprofiles + +replace go.opentelemetry.io/collector/pipeline => ../pipeline + +replace go.opentelemetry.io/collector/internal/globalsignal => ../internal/globalsignal diff --git a/connector/go.sum b/connector/go.sum index 1191e73f8dc..624552cb110 100644 --- a/connector/go.sum +++ b/connector/go.sum @@ -85,8 +85,8 @@ golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8T golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/genproto/googleapis/rpc v0.0.0-20240822170219-fc7c04adadcd h1:6TEm2ZxXoQmFWFlt1vNxvVOa1Q0dXFQD1m/rYjXmS0E= google.golang.org/genproto/googleapis/rpc v0.0.0-20240822170219-fc7c04adadcd/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU= -google.golang.org/grpc v1.66.2 h1:3QdXkuq3Bkh7w+ywLdLvM56cmGvQHUMZpiCzt6Rqaoo= -google.golang.org/grpc v1.66.2/go.mod h1:s3/l6xSSCURdVfAnL+TqCNMyTDAGN6+lZeVxnZR128Y= +google.golang.org/grpc v1.67.0 h1:IdH9y6PF5MPSdAntIcpjQ+tXO41pcQsfZV2RxtQgVcw= +google.golang.org/grpc v1.67.0/go.mod h1:1gLDyUQU7CTLJI90u3nXZ9ekeghjeM7pTDZlqFNg2AA= google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/connector/internal/factory.go b/connector/internal/factory.go index 09f6c2ddbf5..df09ab6e5a6 100644 --- a/connector/internal/factory.go +++ b/connector/internal/factory.go @@ -11,6 +11,7 @@ import ( "go.opentelemetry.io/collector/component/componentprofiles" "go.opentelemetry.io/collector/consumer" "go.opentelemetry.io/collector/consumer/consumerprofiles" + "go.opentelemetry.io/collector/pipeline" ) // Factory is a factory interface for connectors. @@ -143,7 +144,7 @@ func (f CreateTracesToTracesFunc) CreateTracesToTraces( cfg component.Config, nextConsumer consumer.Traces) (Traces, error) { if f == nil { - return nil, ErrDataTypes(set.ID, component.DataTypeTraces, component.DataTypeTraces) + return nil, ErrDataTypes(set.ID, pipeline.SignalTraces, pipeline.SignalTraces) } return f(ctx, set, cfg, nextConsumer) } @@ -159,7 +160,7 @@ func (f CreateTracesToMetricsFunc) CreateTracesToMetrics( nextConsumer consumer.Metrics, ) (Traces, error) { if f == nil { - return nil, ErrDataTypes(set.ID, component.DataTypeTraces, component.DataTypeMetrics) + return nil, ErrDataTypes(set.ID, pipeline.SignalTraces, pipeline.SignalMetrics) } return f(ctx, set, cfg, nextConsumer) } @@ -175,7 +176,7 @@ func (f CreateTracesToLogsFunc) CreateTracesToLogs( nextConsumer consumer.Logs, ) (Traces, error) { if f == nil { - return nil, ErrDataTypes(set.ID, component.DataTypeTraces, component.DataTypeLogs) + return nil, ErrDataTypes(set.ID, pipeline.SignalTraces, pipeline.SignalLogs) } return f(ctx, set, cfg, nextConsumer) } @@ -191,7 +192,7 @@ func (f CreateTracesToProfilesFunc) CreateTracesToProfiles( nextConsumer consumerprofiles.Profiles, ) (Traces, error) { if f == nil { - return nil, ErrDataTypes(set.ID, component.DataTypeTraces, componentprofiles.DataTypeProfiles) + return nil, ErrDataTypes(set.ID, pipeline.SignalTraces, componentprofiles.SignalProfiles) } return f(ctx, set, cfg, nextConsumer) } @@ -207,7 +208,7 @@ func (f CreateMetricsToTracesFunc) CreateMetricsToTraces( nextConsumer consumer.Traces, ) (Metrics, error) { if f == nil { - return nil, ErrDataTypes(set.ID, component.DataTypeMetrics, component.DataTypeTraces) + return nil, ErrDataTypes(set.ID, pipeline.SignalMetrics, pipeline.SignalTraces) } return f(ctx, set, cfg, nextConsumer) } @@ -223,7 +224,7 @@ func (f CreateMetricsToMetricsFunc) CreateMetricsToMetrics( nextConsumer consumer.Metrics, ) (Metrics, error) { if f == nil { - return nil, ErrDataTypes(set.ID, component.DataTypeMetrics, component.DataTypeMetrics) + return nil, ErrDataTypes(set.ID, pipeline.SignalMetrics, pipeline.SignalMetrics) } return f(ctx, set, cfg, nextConsumer) } @@ -239,7 +240,7 @@ func (f CreateMetricsToLogsFunc) CreateMetricsToLogs( nextConsumer consumer.Logs, ) (Metrics, error) { if f == nil { - return nil, ErrDataTypes(set.ID, component.DataTypeMetrics, component.DataTypeLogs) + return nil, ErrDataTypes(set.ID, pipeline.SignalMetrics, pipeline.SignalLogs) } return f(ctx, set, cfg, nextConsumer) } @@ -255,7 +256,7 @@ func (f CreateMetricsToProfilesFunc) CreateMetricsToProfiles( nextConsumer consumerprofiles.Profiles, ) (Metrics, error) { if f == nil { - return nil, ErrDataTypes(set.ID, component.DataTypeMetrics, componentprofiles.DataTypeProfiles) + return nil, ErrDataTypes(set.ID, pipeline.SignalMetrics, componentprofiles.SignalProfiles) } return f(ctx, set, cfg, nextConsumer) } @@ -271,7 +272,7 @@ func (f CreateLogsToTracesFunc) CreateLogsToTraces( nextConsumer consumer.Traces, ) (Logs, error) { if f == nil { - return nil, ErrDataTypes(set.ID, component.DataTypeLogs, component.DataTypeTraces) + return nil, ErrDataTypes(set.ID, pipeline.SignalLogs, pipeline.SignalTraces) } return f(ctx, set, cfg, nextConsumer) } @@ -287,7 +288,7 @@ func (f CreateLogsToMetricsFunc) CreateLogsToMetrics( nextConsumer consumer.Metrics, ) (Logs, error) { if f == nil { - return nil, ErrDataTypes(set.ID, component.DataTypeLogs, component.DataTypeMetrics) + return nil, ErrDataTypes(set.ID, pipeline.SignalLogs, pipeline.SignalMetrics) } return f(ctx, set, cfg, nextConsumer) } @@ -303,7 +304,7 @@ func (f CreateLogsToLogsFunc) CreateLogsToLogs( nextConsumer consumer.Logs, ) (Logs, error) { if f == nil { - return nil, ErrDataTypes(set.ID, component.DataTypeLogs, component.DataTypeLogs) + return nil, ErrDataTypes(set.ID, pipeline.SignalLogs, pipeline.SignalLogs) } return f(ctx, set, cfg, nextConsumer) } @@ -319,7 +320,7 @@ func (f CreateLogsToProfilesFunc) CreateLogsToProfiles( nextConsumer consumerprofiles.Profiles, ) (Logs, error) { if f == nil { - return nil, ErrDataTypes(set.ID, component.DataTypeLogs, componentprofiles.DataTypeProfiles) + return nil, ErrDataTypes(set.ID, pipeline.SignalLogs, componentprofiles.SignalProfiles) } return f(ctx, set, cfg, nextConsumer) } @@ -335,7 +336,7 @@ func (f CreateProfilesToProfilesFunc) CreateProfilesToProfiles( nextConsumer consumerprofiles.Profiles, ) (Profiles, error) { if f == nil { - return nil, ErrDataTypes(set.ID, componentprofiles.DataTypeProfiles, componentprofiles.DataTypeProfiles) + return nil, ErrDataTypes(set.ID, componentprofiles.SignalProfiles, componentprofiles.SignalProfiles) } return f(ctx, set, cfg, nextConsumer) } @@ -351,7 +352,7 @@ func (f CreateProfilesToTracesFunc) CreateProfilesToTraces( nextConsumer consumer.Traces, ) (Profiles, error) { if f == nil { - return nil, ErrDataTypes(set.ID, componentprofiles.DataTypeProfiles, component.DataTypeTraces) + return nil, ErrDataTypes(set.ID, componentprofiles.SignalProfiles, pipeline.SignalTraces) } return f(ctx, set, cfg, nextConsumer) } @@ -367,7 +368,7 @@ func (f CreateProfilesToMetricsFunc) CreateProfilesToMetrics( nextConsumer consumer.Metrics, ) (Profiles, error) { if f == nil { - return nil, ErrDataTypes(set.ID, componentprofiles.DataTypeProfiles, component.DataTypeMetrics) + return nil, ErrDataTypes(set.ID, componentprofiles.SignalProfiles, pipeline.SignalMetrics) } return f(ctx, set, cfg, nextConsumer) } @@ -383,7 +384,7 @@ func (f CreateProfilesToLogsFunc) CreateProfilesToLogs( nextConsumer consumer.Logs, ) (Profiles, error) { if f == nil { - return nil, ErrDataTypes(set.ID, componentprofiles.DataTypeProfiles, component.DataTypeLogs) + return nil, ErrDataTypes(set.ID, componentprofiles.SignalProfiles, pipeline.SignalLogs) } return f(ctx, set, cfg, nextConsumer) } @@ -599,6 +600,6 @@ func WithProfilesToLogs(createProfilesToLogs CreateProfilesToLogsFunc, sl compon }) } -func ErrDataTypes(id component.ID, from, to component.DataType) error { - return fmt.Errorf("connector %q cannot connect from %s to %s: %w", id, from, to, component.ErrDataTypeIsNotSupported) +func ErrDataTypes(id component.ID, from, to pipeline.Signal) error { + return fmt.Errorf("connector %q cannot connect from %s to %s: %w", id, from, to, pipeline.ErrSignalNotSupported) } diff --git a/connector/internal/router.go b/connector/internal/router.go index 18c684807cb..9360ff948a8 100644 --- a/connector/internal/router.go +++ b/connector/internal/router.go @@ -8,31 +8,31 @@ import ( "go.uber.org/multierr" - "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/pipeline" ) type BaseRouter[T any] struct { fanout func([]T) T - Consumers map[component.ID]T + Consumers map[pipeline.ID]T } -func NewBaseRouter[T any](fanout func([]T) T, cm map[component.ID]T) BaseRouter[T] { - consumers := make(map[component.ID]T, len(cm)) +func NewBaseRouter[T any](fanout func([]T) T, cm map[pipeline.ID]T) BaseRouter[T] { + consumers := make(map[pipeline.ID]T, len(cm)) for k, v := range cm { consumers[k] = v } return BaseRouter[T]{fanout: fanout, Consumers: consumers} } -func (r *BaseRouter[T]) PipelineIDs() []component.ID { - ids := make([]component.ID, 0, len(r.Consumers)) +func (r *BaseRouter[T]) PipelineIDs() []pipeline.ID { + ids := make([]pipeline.ID, 0, len(r.Consumers)) for id := range r.Consumers { ids = append(ids, id) } return ids } -func (r *BaseRouter[T]) Consumer(pipelineIDs ...component.ID) (T, error) { +func (r *BaseRouter[T]) Consumer(pipelineIDs ...pipeline.ID) (T, error) { var ret T if len(pipelineIDs) == 0 { return ret, fmt.Errorf("missing consumers") diff --git a/connector/logs_router.go b/connector/logs_router.go index 37a3831038e..ff6190aa643 100644 --- a/connector/logs_router.go +++ b/connector/logs_router.go @@ -8,17 +8,17 @@ import ( "go.uber.org/multierr" - "go.opentelemetry.io/collector/component" "go.opentelemetry.io/collector/connector/internal" "go.opentelemetry.io/collector/consumer" "go.opentelemetry.io/collector/internal/fanoutconsumer" + "go.opentelemetry.io/collector/pipeline" ) // LogsRouterAndConsumer feeds the first consumer.Logs in each of the specified pipelines. type LogsRouterAndConsumer interface { consumer.Logs - Consumer(...component.ID) (consumer.Logs, error) - PipelineIDs() []component.ID + Consumer(...pipeline.ID) (consumer.Logs, error) + PipelineIDs() []pipeline.ID privateFunc() } @@ -27,7 +27,7 @@ type logsRouter struct { internal.BaseRouter[consumer.Logs] } -func NewLogsRouter(cm map[component.ID]consumer.Logs) LogsRouterAndConsumer { +func NewLogsRouter(cm map[pipeline.ID]consumer.Logs) LogsRouterAndConsumer { consumers := make([]consumer.Logs, 0, len(cm)) for _, cons := range cm { consumers = append(consumers, cons) @@ -38,15 +38,15 @@ func NewLogsRouter(cm map[component.ID]consumer.Logs) LogsRouterAndConsumer { } } -func (r *logsRouter) PipelineIDs() []component.ID { - ids := make([]component.ID, 0, len(r.Consumers)) +func (r *logsRouter) PipelineIDs() []pipeline.ID { + ids := make([]pipeline.ID, 0, len(r.Consumers)) for id := range r.Consumers { ids = append(ids, id) } return ids } -func (r *logsRouter) Consumer(pipelineIDs ...component.ID) (consumer.Logs, error) { +func (r *logsRouter) Consumer(pipelineIDs ...pipeline.ID) (consumer.Logs, error) { if len(pipelineIDs) == 0 { return nil, fmt.Errorf("missing consumers") } diff --git a/connector/logs_router_test.go b/connector/logs_router_test.go index d4d70c3fec2..591c25e6a7c 100644 --- a/connector/logs_router_test.go +++ b/connector/logs_router_test.go @@ -12,11 +12,11 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "go.opentelemetry.io/collector/component" "go.opentelemetry.io/collector/consumer" "go.opentelemetry.io/collector/consumer/consumertest" "go.opentelemetry.io/collector/pdata/plog" "go.opentelemetry.io/collector/pdata/testdata" + "go.opentelemetry.io/collector/pipeline" ) type mutatingLogsSink struct { @@ -43,13 +43,13 @@ func TestLogsRouterMultiplexing(t *testing.T) { func fuzzLogs(numIDs, numCons, numLogs int) func(*testing.T) { return func(t *testing.T) { - allIDs := make([]component.ID, 0, numCons) + allIDs := make([]pipeline.ID, 0, numCons) allCons := make([]consumer.Logs, 0, numCons) - allConsMap := make(map[component.ID]consumer.Logs) + allConsMap := make(map[pipeline.ID]consumer.Logs) // If any consumer is mutating, the router must report mutating for i := 0; i < numCons; i++ { - allIDs = append(allIDs, component.MustNewIDWithName("sink", strconv.Itoa(numCons))) + allIDs = append(allIDs, pipeline.MustNewIDWithName("sink", strconv.Itoa(numCons))) // Random chance for each consumer to be mutating if (numCons+numLogs+i)%4 == 0 { allCons = append(allCons, &mutatingLogsSink{LogsSink: new(consumertest.LogsSink)}) @@ -64,11 +64,11 @@ func fuzzLogs(numIDs, numCons, numLogs int) func(*testing.T) { // Keep track of how many logs each consumer should receive. // This will be validated after every call to RouteLogs. - expected := make(map[component.ID]int, numCons) + expected := make(map[pipeline.ID]int, numCons) for i := 0; i < numLogs; i++ { // Build a random set of ids (no duplicates) - randCons := make(map[component.ID]bool, numIDs) + randCons := make(map[pipeline.ID]bool, numIDs) for j := 0; j < numIDs; j++ { // This number should be pretty random and less than numCons conNum := (numCons + numIDs + i + j) % numCons @@ -76,7 +76,7 @@ func fuzzLogs(numIDs, numCons, numLogs int) func(*testing.T) { } // Convert to slice, update expectations - conIDs := make([]component.ID, 0, len(randCons)) + conIDs := make([]pipeline.ID, 0, len(randCons)) for id := range randCons { conIDs = append(conIDs, id) expected[id]++ @@ -109,16 +109,16 @@ func TestLogsRouterConsumers(t *testing.T) { ctx := context.Background() ld := testdata.GenerateLogs(1) - fooID := component.MustNewID("foo") - barID := component.MustNewID("bar") + fooID := pipeline.MustNewID("foo") + barID := pipeline.MustNewID("bar") foo := new(consumertest.LogsSink) bar := new(consumertest.LogsSink) - r := NewLogsRouter(map[component.ID]consumer.Logs{fooID: foo, barID: bar}) + r := NewLogsRouter(map[pipeline.ID]consumer.Logs{fooID: foo, barID: bar}) rcs := r.PipelineIDs() assert.Len(t, rcs, 2) - assert.ElementsMatch(t, []component.ID{fooID, barID}, rcs) + assert.ElementsMatch(t, []pipeline.ID{fooID, barID}, rcs) assert.Empty(t, foo.AllLogs()) assert.Empty(t, bar.AllLogs()) @@ -151,7 +151,7 @@ func TestLogsRouterConsumers(t *testing.T) { assert.Nil(t, none) require.Error(t, err) - fake, err := r.Consumer(component.MustNewID("fake")) + fake, err := r.Consumer(pipeline.MustNewID("fake")) assert.Nil(t, fake) assert.Error(t, err) } diff --git a/connector/metrics_router.go b/connector/metrics_router.go index 67ba27f86a0..a45a6397fe0 100644 --- a/connector/metrics_router.go +++ b/connector/metrics_router.go @@ -4,17 +4,17 @@ package connector // import "go.opentelemetry.io/collector/connector" import ( - "go.opentelemetry.io/collector/component" "go.opentelemetry.io/collector/connector/internal" "go.opentelemetry.io/collector/consumer" "go.opentelemetry.io/collector/internal/fanoutconsumer" + "go.opentelemetry.io/collector/pipeline" ) // MetricsRouterAndConsumer feeds the first consumer.Metrics in each of the specified pipelines. type MetricsRouterAndConsumer interface { consumer.Metrics - Consumer(...component.ID) (consumer.Metrics, error) - PipelineIDs() []component.ID + Consumer(...pipeline.ID) (consumer.Metrics, error) + PipelineIDs() []pipeline.ID privateFunc() } @@ -23,7 +23,7 @@ type metricsRouter struct { internal.BaseRouter[consumer.Metrics] } -func NewMetricsRouter(cm map[component.ID]consumer.Metrics) MetricsRouterAndConsumer { +func NewMetricsRouter(cm map[pipeline.ID]consumer.Metrics) MetricsRouterAndConsumer { consumers := make([]consumer.Metrics, 0, len(cm)) for _, cons := range cm { consumers = append(consumers, cons) diff --git a/connector/metrics_router_test.go b/connector/metrics_router_test.go index 7fb12de9b1d..728174a3d41 100644 --- a/connector/metrics_router_test.go +++ b/connector/metrics_router_test.go @@ -12,11 +12,11 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "go.opentelemetry.io/collector/component" "go.opentelemetry.io/collector/consumer" "go.opentelemetry.io/collector/consumer/consumertest" "go.opentelemetry.io/collector/pdata/pmetric" "go.opentelemetry.io/collector/pdata/testdata" + "go.opentelemetry.io/collector/pipeline" ) type mutatingMetricsSink struct { @@ -43,13 +43,13 @@ func TestMetricsRouterMultiplexing(t *testing.T) { func fuzzMetrics(numIDs, numCons, numMetrics int) func(*testing.T) { return func(t *testing.T) { - allIDs := make([]component.ID, 0, numCons) + allIDs := make([]pipeline.ID, 0, numCons) allCons := make([]consumer.Metrics, 0, numCons) - allConsMap := make(map[component.ID]consumer.Metrics) + allConsMap := make(map[pipeline.ID]consumer.Metrics) // If any consumer is mutating, the router must report mutating for i := 0; i < numCons; i++ { - allIDs = append(allIDs, component.MustNewIDWithName("sink", strconv.Itoa(numCons))) + allIDs = append(allIDs, pipeline.MustNewIDWithName("sink", strconv.Itoa(numCons))) // Random chance for each consumer to be mutating if (numCons+numMetrics+i)%4 == 0 { allCons = append(allCons, &mutatingMetricsSink{MetricsSink: new(consumertest.MetricsSink)}) @@ -64,11 +64,11 @@ func fuzzMetrics(numIDs, numCons, numMetrics int) func(*testing.T) { // Keep track of how many logs each consumer should receive. // This will be validated after every call to RouteMetrics. - expected := make(map[component.ID]int, numCons) + expected := make(map[pipeline.ID]int, numCons) for i := 0; i < numMetrics; i++ { // Build a random set of ids (no duplicates) - randCons := make(map[component.ID]bool, numIDs) + randCons := make(map[pipeline.ID]bool, numIDs) for j := 0; j < numIDs; j++ { // This number should be pretty random and less than numCons conNum := (numCons + numIDs + i + j) % numCons @@ -76,7 +76,7 @@ func fuzzMetrics(numIDs, numCons, numMetrics int) func(*testing.T) { } // Convert to slice, update expectations - conIDs := make([]component.ID, 0, len(randCons)) + conIDs := make([]pipeline.ID, 0, len(randCons)) for id := range randCons { conIDs = append(conIDs, id) expected[id]++ @@ -109,16 +109,16 @@ func TestMetricsRouterConsumers(t *testing.T) { ctx := context.Background() md := testdata.GenerateMetrics(1) - fooID := component.MustNewID("foo") - barID := component.MustNewID("bar") + fooID := pipeline.MustNewID("foo") + barID := pipeline.MustNewID("bar") foo := new(consumertest.MetricsSink) bar := new(consumertest.MetricsSink) - r := NewMetricsRouter(map[component.ID]consumer.Metrics{fooID: foo, barID: bar}) + r := NewMetricsRouter(map[pipeline.ID]consumer.Metrics{fooID: foo, barID: bar}) rcs := r.PipelineIDs() assert.Len(t, rcs, 2) - assert.ElementsMatch(t, []component.ID{fooID, barID}, rcs) + assert.ElementsMatch(t, []pipeline.ID{fooID, barID}, rcs) assert.Empty(t, foo.AllMetrics()) assert.Empty(t, bar.AllMetrics()) @@ -151,7 +151,7 @@ func TestMetricsRouterConsumers(t *testing.T) { assert.Nil(t, none) require.Error(t, err) - fake, err := r.Consumer(component.MustNewID("fake")) + fake, err := r.Consumer(pipeline.MustNewID("fake")) assert.Nil(t, fake) assert.Error(t, err) } diff --git a/connector/traces_router.go b/connector/traces_router.go index 40cfbdd18a0..5622b78bf94 100644 --- a/connector/traces_router.go +++ b/connector/traces_router.go @@ -4,17 +4,17 @@ package connector // import "go.opentelemetry.io/collector/connector" import ( - "go.opentelemetry.io/collector/component" "go.opentelemetry.io/collector/connector/internal" "go.opentelemetry.io/collector/consumer" "go.opentelemetry.io/collector/internal/fanoutconsumer" + "go.opentelemetry.io/collector/pipeline" ) // TracesRouterAndConsumer feeds the first consumer.Traces in each of the specified pipelines. type TracesRouterAndConsumer interface { consumer.Traces - Consumer(...component.ID) (consumer.Traces, error) - PipelineIDs() []component.ID + Consumer(...pipeline.ID) (consumer.Traces, error) + PipelineIDs() []pipeline.ID privateFunc() } @@ -23,7 +23,7 @@ type tracesRouter struct { internal.BaseRouter[consumer.Traces] } -func NewTracesRouter(cm map[component.ID]consumer.Traces) TracesRouterAndConsumer { +func NewTracesRouter(cm map[pipeline.ID]consumer.Traces) TracesRouterAndConsumer { consumers := make([]consumer.Traces, 0, len(cm)) for _, cons := range cm { consumers = append(consumers, cons) diff --git a/connector/traces_router_test.go b/connector/traces_router_test.go index a54b1006012..125d159cabf 100644 --- a/connector/traces_router_test.go +++ b/connector/traces_router_test.go @@ -12,11 +12,11 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "go.opentelemetry.io/collector/component" "go.opentelemetry.io/collector/consumer" "go.opentelemetry.io/collector/consumer/consumertest" "go.opentelemetry.io/collector/pdata/ptrace" "go.opentelemetry.io/collector/pdata/testdata" + "go.opentelemetry.io/collector/pipeline" ) type mutatingTracesSink struct { @@ -43,13 +43,13 @@ func TestTracesRouterMultiplexing(t *testing.T) { func fuzzTraces(numIDs, numCons, numTraces int) func(*testing.T) { return func(t *testing.T) { - allIDs := make([]component.ID, 0, numCons) + allIDs := make([]pipeline.ID, 0, numCons) allCons := make([]consumer.Traces, 0, numCons) - allConsMap := make(map[component.ID]consumer.Traces) + allConsMap := make(map[pipeline.ID]consumer.Traces) // If any consumer is mutating, the router must report mutating for i := 0; i < numCons; i++ { - allIDs = append(allIDs, component.MustNewIDWithName("sink", strconv.Itoa(numCons))) + allIDs = append(allIDs, pipeline.MustNewIDWithName("sink", strconv.Itoa(numCons))) // Random chance for each consumer to be mutating if (numCons+numTraces+i)%4 == 0 { allCons = append(allCons, &mutatingTracesSink{TracesSink: new(consumertest.TracesSink)}) @@ -64,11 +64,11 @@ func fuzzTraces(numIDs, numCons, numTraces int) func(*testing.T) { // Keep track of how many logs each consumer should receive. // This will be validated after every call to RouteTraces. - expected := make(map[component.ID]int, numCons) + expected := make(map[pipeline.ID]int, numCons) for i := 0; i < numTraces; i++ { // Build a random set of ids (no duplicates) - randCons := make(map[component.ID]bool, numIDs) + randCons := make(map[pipeline.ID]bool, numIDs) for j := 0; j < numIDs; j++ { // This number should be pretty random and less than numCons conNum := (numCons + numIDs + i + j) % numCons @@ -76,7 +76,7 @@ func fuzzTraces(numIDs, numCons, numTraces int) func(*testing.T) { } // Convert to slice, update expectations - conIDs := make([]component.ID, 0, len(randCons)) + conIDs := make([]pipeline.ID, 0, len(randCons)) for id := range randCons { conIDs = append(conIDs, id) expected[id]++ @@ -109,16 +109,16 @@ func TestTracesRouterConsumer(t *testing.T) { ctx := context.Background() td := testdata.GenerateTraces(1) - fooID := component.MustNewID("foo") - barID := component.MustNewID("bar") + fooID := pipeline.MustNewID("foo") + barID := pipeline.MustNewID("bar") foo := new(consumertest.TracesSink) bar := new(consumertest.TracesSink) - r := NewTracesRouter(map[component.ID]consumer.Traces{fooID: foo, barID: bar}) + r := NewTracesRouter(map[pipeline.ID]consumer.Traces{fooID: foo, barID: bar}) rcs := r.PipelineIDs() assert.Len(t, rcs, 2) - assert.ElementsMatch(t, []component.ID{fooID, barID}, rcs) + assert.ElementsMatch(t, []pipeline.ID{fooID, barID}, rcs) assert.Empty(t, foo.AllTraces()) assert.Empty(t, bar.AllTraces()) @@ -151,7 +151,7 @@ func TestTracesRouterConsumer(t *testing.T) { assert.Nil(t, none) require.Error(t, err) - fake, err := r.Consumer(component.MustNewID("fake")) + fake, err := r.Consumer(pipeline.MustNewID("fake")) assert.Nil(t, fake) assert.Error(t, err) } diff --git a/consumer/consumerprofiles/go.mod b/consumer/consumerprofiles/go.mod index fe5ce5d9c11..0c48f96fdda 100644 --- a/consumer/consumerprofiles/go.mod +++ b/consumer/consumerprofiles/go.mod @@ -10,8 +10,8 @@ replace go.opentelemetry.io/collector/consumer => ../ require ( github.com/stretchr/testify v1.9.0 - go.opentelemetry.io/collector/consumer v0.109.0 - go.opentelemetry.io/collector/pdata/pprofile v0.109.0 + go.opentelemetry.io/collector/consumer v0.110.0 + go.opentelemetry.io/collector/pdata/pprofile v0.110.0 ) require ( @@ -21,13 +21,13 @@ 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.15.0 // indirect + go.opentelemetry.io/collector/pdata v1.16.0 // indirect go.uber.org/multierr v1.11.0 // indirect - golang.org/x/net v0.26.0 // indirect - golang.org/x/sys v0.21.0 // indirect - golang.org/x/text v0.16.0 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20240604185151-ef581f913117 // indirect - google.golang.org/grpc v1.66.2 // indirect + golang.org/x/net v0.28.0 // indirect + golang.org/x/sys v0.24.0 // indirect + golang.org/x/text v0.17.0 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240814211410-ddb44dafa142 // indirect + google.golang.org/grpc v1.67.0 // indirect google.golang.org/protobuf v1.34.2 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/consumer/consumerprofiles/go.sum b/consumer/consumerprofiles/go.sum index 480aed29046..5febf65ed01 100644 --- a/consumer/consumerprofiles/go.sum +++ b/consumer/consumerprofiles/go.sum @@ -42,20 +42,20 @@ golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.26.0 h1:soB7SVo0PWrY4vPW/+ay0jKDNScG2X9wFeYlXIvJsOQ= -golang.org/x/net v0.26.0/go.mod h1:5YKkiSynbBIh3p6iOc/vibscux0x38BZDkn8sCUPxHE= +golang.org/x/net v0.28.0 h1:a9JDOJc5GMUJ0+UDqmLT86WiEy7iWyIhz8gz8E4e5hE= +golang.org/x/net v0.28.0/go.mod h1:yqtgsTWOOnlGLG9GFRrK3++bGOUEkNBoHZc8MEDWPNg= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.21.0 h1:rF+pYz3DAGSQAxAu1CbC7catZg4ebC4UIeIhKxBZvws= -golang.org/x/sys v0.21.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= -golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI= +golang.org/x/text v0.17.0 h1:XtiM5bkSOt+ewxlOE/aE/AKEHibwj/6gvWMl9Rsh0Qc= +golang.org/x/text v0.17.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= @@ -64,10 +64,10 @@ 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= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240604185151-ef581f913117 h1:1GBuWVLM/KMVUv1t1En5Gs+gFZCNd360GGb4sSxtrhU= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240604185151-ef581f913117/go.mod h1:EfXuqaE1J41VCDicxHzUDm+8rk+7ZdXzHV0IhO/I6s0= -google.golang.org/grpc v1.66.2 h1:3QdXkuq3Bkh7w+ywLdLvM56cmGvQHUMZpiCzt6Rqaoo= -google.golang.org/grpc v1.66.2/go.mod h1:s3/l6xSSCURdVfAnL+TqCNMyTDAGN6+lZeVxnZR128Y= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240814211410-ddb44dafa142 h1:e7S5W7MGGLaSu8j3YjdezkZ+m1/Nm0uRVRMEMGk26Xs= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240814211410-ddb44dafa142/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU= +google.golang.org/grpc v1.67.0 h1:IdH9y6PF5MPSdAntIcpjQ+tXO41pcQsfZV2RxtQgVcw= +google.golang.org/grpc v1.67.0/go.mod h1:1gLDyUQU7CTLJI90u3nXZ9ekeghjeM7pTDZlqFNg2AA= google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/consumer/consumertest/go.mod b/consumer/consumertest/go.mod index bfeed308f17..b657a709f2a 100644 --- a/consumer/consumertest/go.mod +++ b/consumer/consumertest/go.mod @@ -6,11 +6,11 @@ replace go.opentelemetry.io/collector/consumer => ../ require ( github.com/stretchr/testify v1.9.0 - go.opentelemetry.io/collector/consumer v0.109.0 - go.opentelemetry.io/collector/consumer/consumerprofiles v0.109.0 - go.opentelemetry.io/collector/pdata v1.15.0 - go.opentelemetry.io/collector/pdata/pprofile v0.109.0 - go.opentelemetry.io/collector/pdata/testdata v0.109.0 + go.opentelemetry.io/collector/consumer v0.110.0 + go.opentelemetry.io/collector/consumer/consumerprofiles v0.110.0 + go.opentelemetry.io/collector/pdata v1.16.0 + go.opentelemetry.io/collector/pdata/pprofile v0.110.0 + go.opentelemetry.io/collector/pdata/testdata v0.110.0 go.uber.org/goleak v1.3.0 ) @@ -22,11 +22,11 @@ require ( github.com/modern-go/reflect2 v1.0.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect go.uber.org/multierr v1.11.0 // indirect - golang.org/x/net v0.26.0 // indirect - golang.org/x/sys v0.21.0 // indirect - golang.org/x/text v0.16.0 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20240604185151-ef581f913117 // indirect - google.golang.org/grpc v1.66.2 // indirect + golang.org/x/net v0.28.0 // indirect + golang.org/x/sys v0.24.0 // indirect + golang.org/x/text v0.17.0 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240814211410-ddb44dafa142 // indirect + google.golang.org/grpc v1.67.0 // indirect google.golang.org/protobuf v1.34.2 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/consumer/consumertest/go.sum b/consumer/consumertest/go.sum index 480aed29046..5febf65ed01 100644 --- a/consumer/consumertest/go.sum +++ b/consumer/consumertest/go.sum @@ -42,20 +42,20 @@ golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.26.0 h1:soB7SVo0PWrY4vPW/+ay0jKDNScG2X9wFeYlXIvJsOQ= -golang.org/x/net v0.26.0/go.mod h1:5YKkiSynbBIh3p6iOc/vibscux0x38BZDkn8sCUPxHE= +golang.org/x/net v0.28.0 h1:a9JDOJc5GMUJ0+UDqmLT86WiEy7iWyIhz8gz8E4e5hE= +golang.org/x/net v0.28.0/go.mod h1:yqtgsTWOOnlGLG9GFRrK3++bGOUEkNBoHZc8MEDWPNg= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.21.0 h1:rF+pYz3DAGSQAxAu1CbC7catZg4ebC4UIeIhKxBZvws= -golang.org/x/sys v0.21.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= -golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI= +golang.org/x/text v0.17.0 h1:XtiM5bkSOt+ewxlOE/aE/AKEHibwj/6gvWMl9Rsh0Qc= +golang.org/x/text v0.17.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= @@ -64,10 +64,10 @@ 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= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240604185151-ef581f913117 h1:1GBuWVLM/KMVUv1t1En5Gs+gFZCNd360GGb4sSxtrhU= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240604185151-ef581f913117/go.mod h1:EfXuqaE1J41VCDicxHzUDm+8rk+7ZdXzHV0IhO/I6s0= -google.golang.org/grpc v1.66.2 h1:3QdXkuq3Bkh7w+ywLdLvM56cmGvQHUMZpiCzt6Rqaoo= -google.golang.org/grpc v1.66.2/go.mod h1:s3/l6xSSCURdVfAnL+TqCNMyTDAGN6+lZeVxnZR128Y= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240814211410-ddb44dafa142 h1:e7S5W7MGGLaSu8j3YjdezkZ+m1/Nm0uRVRMEMGk26Xs= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240814211410-ddb44dafa142/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU= +google.golang.org/grpc v1.67.0 h1:IdH9y6PF5MPSdAntIcpjQ+tXO41pcQsfZV2RxtQgVcw= +google.golang.org/grpc v1.67.0/go.mod h1:1gLDyUQU7CTLJI90u3nXZ9ekeghjeM7pTDZlqFNg2AA= google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/consumer/consumertest/sink.go b/consumer/consumertest/sink.go index ec35e717ae0..a6d2a424ee1 100644 --- a/consumer/consumertest/sink.go +++ b/consumer/consumertest/sink.go @@ -163,8 +163,9 @@ func (sle *LogsSink) Reset() { // stores all profiles and allows querying them for testing. type ProfilesSink struct { nonMutatingConsumer - mu sync.Mutex - profiles []pprofile.Profiles + mu sync.Mutex + profiles []pprofile.Profiles + sampleCount int } var _ consumerprofiles.Profiles = (*ProfilesSink)(nil) @@ -175,6 +176,7 @@ func (ste *ProfilesSink) ConsumeProfiles(_ context.Context, td pprofile.Profiles defer ste.mu.Unlock() ste.profiles = append(ste.profiles, td) + ste.sampleCount += td.SampleCount() return nil } @@ -189,10 +191,18 @@ func (ste *ProfilesSink) AllProfiles() []pprofile.Profiles { return copyProfiles } +// ProfileRecordCount returns the number of profiles stored by this sink since last Reset. +func (ste *ProfilesSink) SampleCount() int { + ste.mu.Lock() + defer ste.mu.Unlock() + return ste.sampleCount +} + // Reset deletes any stored data. func (ste *ProfilesSink) Reset() { ste.mu.Lock() defer ste.mu.Unlock() ste.profiles = nil + ste.sampleCount = 0 } diff --git a/consumer/consumertest/sink_test.go b/consumer/consumertest/sink_test.go index 3a377345fc4..5d7f7f3bf8a 100644 --- a/consumer/consumertest/sink_test.go +++ b/consumer/consumertest/sink_test.go @@ -71,6 +71,8 @@ func TestProfilesSink(t *testing.T) { want = append(want, td) } assert.Equal(t, want, sink.AllProfiles()) + assert.Equal(t, len(want), sink.SampleCount()) sink.Reset() assert.Empty(t, sink.AllProfiles()) + assert.Empty(t, sink.SampleCount()) } diff --git a/consumer/go.mod b/consumer/go.mod index 2832bd8a766..e4733cc24ad 100644 --- a/consumer/go.mod +++ b/consumer/go.mod @@ -4,8 +4,8 @@ go 1.22.0 require ( github.com/stretchr/testify v1.9.0 - go.opentelemetry.io/collector/pdata v1.15.0 - go.opentelemetry.io/collector/pdata/testdata v0.109.0 + go.opentelemetry.io/collector/pdata v1.16.0 + go.opentelemetry.io/collector/pdata/testdata v0.110.0 go.uber.org/goleak v1.3.0 ) @@ -16,13 +16,13 @@ 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.109.0 // indirect + go.opentelemetry.io/collector/pdata/pprofile v0.110.0 // indirect go.uber.org/multierr v1.11.0 // indirect - golang.org/x/net v0.26.0 // indirect - golang.org/x/sys v0.21.0 // indirect - golang.org/x/text v0.16.0 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20240604185151-ef581f913117 // indirect - google.golang.org/grpc v1.66.2 // indirect + golang.org/x/net v0.28.0 // indirect + golang.org/x/sys v0.24.0 // indirect + golang.org/x/text v0.17.0 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240814211410-ddb44dafa142 // indirect + google.golang.org/grpc v1.67.0 // indirect google.golang.org/protobuf v1.34.2 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/consumer/go.sum b/consumer/go.sum index 480aed29046..5febf65ed01 100644 --- a/consumer/go.sum +++ b/consumer/go.sum @@ -42,20 +42,20 @@ golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.26.0 h1:soB7SVo0PWrY4vPW/+ay0jKDNScG2X9wFeYlXIvJsOQ= -golang.org/x/net v0.26.0/go.mod h1:5YKkiSynbBIh3p6iOc/vibscux0x38BZDkn8sCUPxHE= +golang.org/x/net v0.28.0 h1:a9JDOJc5GMUJ0+UDqmLT86WiEy7iWyIhz8gz8E4e5hE= +golang.org/x/net v0.28.0/go.mod h1:yqtgsTWOOnlGLG9GFRrK3++bGOUEkNBoHZc8MEDWPNg= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.21.0 h1:rF+pYz3DAGSQAxAu1CbC7catZg4ebC4UIeIhKxBZvws= -golang.org/x/sys v0.21.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= -golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI= +golang.org/x/text v0.17.0 h1:XtiM5bkSOt+ewxlOE/aE/AKEHibwj/6gvWMl9Rsh0Qc= +golang.org/x/text v0.17.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= @@ -64,10 +64,10 @@ 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= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240604185151-ef581f913117 h1:1GBuWVLM/KMVUv1t1En5Gs+gFZCNd360GGb4sSxtrhU= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240604185151-ef581f913117/go.mod h1:EfXuqaE1J41VCDicxHzUDm+8rk+7ZdXzHV0IhO/I6s0= -google.golang.org/grpc v1.66.2 h1:3QdXkuq3Bkh7w+ywLdLvM56cmGvQHUMZpiCzt6Rqaoo= -google.golang.org/grpc v1.66.2/go.mod h1:s3/l6xSSCURdVfAnL+TqCNMyTDAGN6+lZeVxnZR128Y= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240814211410-ddb44dafa142 h1:e7S5W7MGGLaSu8j3YjdezkZ+m1/Nm0uRVRMEMGk26Xs= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240814211410-ddb44dafa142/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU= +google.golang.org/grpc v1.67.0 h1:IdH9y6PF5MPSdAntIcpjQ+tXO41pcQsfZV2RxtQgVcw= +google.golang.org/grpc v1.67.0/go.mod h1:1gLDyUQU7CTLJI90u3nXZ9ekeghjeM7pTDZlqFNg2AA= google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/exporter/debugexporter/go.mod b/exporter/debugexporter/go.mod index 4570dd859ad..034f7c67c39 100644 --- a/exporter/debugexporter/go.mod +++ b/exporter/debugexporter/go.mod @@ -4,13 +4,13 @@ go 1.22.0 require ( github.com/stretchr/testify v1.9.0 - go.opentelemetry.io/collector/component v0.109.0 - go.opentelemetry.io/collector/config/configtelemetry v0.109.0 - go.opentelemetry.io/collector/confmap v1.15.0 - go.opentelemetry.io/collector/consumer v0.109.0 - go.opentelemetry.io/collector/exporter v0.109.0 - go.opentelemetry.io/collector/pdata v1.15.0 - go.opentelemetry.io/collector/pdata/testdata v0.109.0 + go.opentelemetry.io/collector/component v0.110.0 + go.opentelemetry.io/collector/config/configtelemetry v0.110.0 + go.opentelemetry.io/collector/confmap v1.16.0 + go.opentelemetry.io/collector/consumer v0.110.0 + go.opentelemetry.io/collector/exporter v0.110.0 + go.opentelemetry.io/collector/pdata v1.16.0 + go.opentelemetry.io/collector/pdata/testdata v0.110.0 go.uber.org/goleak v1.3.0 go.uber.org/zap v1.27.0 ) @@ -32,15 +32,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/configretry v1.15.0 // indirect - go.opentelemetry.io/collector/consumer/consumerprofiles v0.109.0 // indirect - go.opentelemetry.io/collector/consumer/consumertest v0.109.0 // indirect - go.opentelemetry.io/collector/exporter/exporterprofiles v0.109.0 // indirect - go.opentelemetry.io/collector/extension v0.109.0 // indirect - go.opentelemetry.io/collector/extension/experimental/storage v0.109.0 // indirect - go.opentelemetry.io/collector/pdata/pprofile v0.109.0 // indirect - go.opentelemetry.io/collector/receiver v0.109.0 // indirect - go.opentelemetry.io/collector/receiver/receiverprofiles v0.109.0 // indirect + go.opentelemetry.io/collector/component/componentprofiles v0.110.0 // indirect + go.opentelemetry.io/collector/config/configretry v1.16.0 // indirect + go.opentelemetry.io/collector/consumer/consumerprofiles v0.110.0 // indirect + go.opentelemetry.io/collector/consumer/consumertest v0.110.0 // indirect + go.opentelemetry.io/collector/exporter/exporterprofiles v0.110.0 // indirect + go.opentelemetry.io/collector/extension v0.110.0 // indirect + go.opentelemetry.io/collector/extension/experimental/storage v0.110.0 // indirect + go.opentelemetry.io/collector/internal/globalsignal v0.110.0 // indirect + go.opentelemetry.io/collector/pdata/pprofile v0.110.0 // indirect + go.opentelemetry.io/collector/pipeline v0.110.0 // indirect + go.opentelemetry.io/collector/receiver v0.110.0 // indirect + go.opentelemetry.io/collector/receiver/receiverprofiles v0.110.0 // indirect go.opentelemetry.io/otel v1.30.0 // indirect go.opentelemetry.io/otel/metric v1.30.0 // indirect go.opentelemetry.io/otel/sdk v1.30.0 // indirect @@ -51,7 +54,7 @@ require ( golang.org/x/sys v0.25.0 // indirect golang.org/x/text v0.17.0 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240822170219-fc7c04adadcd // indirect - google.golang.org/grpc v1.66.2 // indirect + google.golang.org/grpc v1.67.0 // indirect google.golang.org/protobuf v1.34.2 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) @@ -87,3 +90,9 @@ replace go.opentelemetry.io/collector/consumer/consumertest => ../../consumer/co replace go.opentelemetry.io/collector/receiver/receiverprofiles => ../../receiver/receiverprofiles replace go.opentelemetry.io/collector/exporter/exporterprofiles => ../exporterprofiles + +replace go.opentelemetry.io/collector/pipeline => ../../pipeline + +replace go.opentelemetry.io/collector/internal/globalsignal => ../../internal/globalsignal + +replace go.opentelemetry.io/collector/component/componentprofiles => ../../component/componentprofiles diff --git a/exporter/debugexporter/go.sum b/exporter/debugexporter/go.sum index 3229c18e498..5df87556447 100644 --- a/exporter/debugexporter/go.sum +++ b/exporter/debugexporter/go.sum @@ -99,8 +99,8 @@ golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8T golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/genproto/googleapis/rpc v0.0.0-20240822170219-fc7c04adadcd h1:6TEm2ZxXoQmFWFlt1vNxvVOa1Q0dXFQD1m/rYjXmS0E= google.golang.org/genproto/googleapis/rpc v0.0.0-20240822170219-fc7c04adadcd/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU= -google.golang.org/grpc v1.66.2 h1:3QdXkuq3Bkh7w+ywLdLvM56cmGvQHUMZpiCzt6Rqaoo= -google.golang.org/grpc v1.66.2/go.mod h1:s3/l6xSSCURdVfAnL+TqCNMyTDAGN6+lZeVxnZR128Y= +google.golang.org/grpc v1.67.0 h1:IdH9y6PF5MPSdAntIcpjQ+tXO41pcQsfZV2RxtQgVcw= +google.golang.org/grpc v1.67.0/go.mod h1:1gLDyUQU7CTLJI90u3nXZ9ekeghjeM7pTDZlqFNg2AA= google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/exporter/exporterhelper/common.go b/exporter/exporterhelper/common.go index f3e9f06b2ec..de9822ee6aa 100644 --- a/exporter/exporterhelper/common.go +++ b/exporter/exporterhelper/common.go @@ -27,8 +27,8 @@ func WithShutdown(shutdown component.ShutdownFunc) Option { return internal.WithShutdown(shutdown) } -// WithTimeout overrides the default TimeoutSettings for an exporter. -// The default TimeoutSettings is 5 seconds. +// WithTimeout overrides the default TimeoutConfig for an exporter. +// The default TimeoutConfig is 5 seconds. func WithTimeout(timeoutConfig TimeoutConfig) Option { return internal.WithTimeout(timeoutConfig) } diff --git a/exporter/exporterhelper/internal/base_exporter.go b/exporter/exporterhelper/internal/base_exporter.go index 922dbc9b34a..0155cb53298 100644 --- a/exporter/exporterhelper/internal/base_exporter.go +++ b/exporter/exporterhelper/internal/base_exporter.go @@ -21,6 +21,7 @@ import ( "go.opentelemetry.io/collector/exporter/exporterbatcher" "go.opentelemetry.io/collector/exporter/exporterqueue" // BaseExporter contains common fields between different exporter types. "go.opentelemetry.io/collector/exporter/internal" + "go.opentelemetry.io/collector/pipeline" ) type ObsrepSenderFactory = func(obsrep *ObsReport) RequestSender @@ -35,7 +36,7 @@ type BaseExporter struct { component.StartFunc component.ShutdownFunc - Signal component.DataType + Signal pipeline.Signal BatchMergeFunc exporterbatcher.BatchMergeFunc[internal.Request] BatchMergeSplitfunc exporterbatcher.BatchMergeSplitFunc[internal.Request] @@ -60,14 +61,15 @@ type BaseExporter struct { ConsumerOptions []consumer.Option - QueueCfg exporterqueue.Config - QueueFactory exporterqueue.Factory[internal.Request] - BatcherCfg exporterbatcher.Config - BatcherOpts []BatcherOption + QueueCfg QueueConfig + ExporterQueueCfg exporterqueue.Config + QueueFactory exporterqueue.Factory[internal.Request] + BatcherCfg exporterbatcher.Config + BatcherOpts []BatcherOption } -func NewBaseExporter(set exporter.Settings, signal component.DataType, osf ObsrepSenderFactory, options ...Option) (*BaseExporter, error) { - obsReport, err := NewExporter(ObsReportSettings{ExporterID: set.ID, ExporterCreateSettings: set, DataType: signal}) +func NewBaseExporter(set exporter.Settings, signal pipeline.Signal, osf ObsrepSenderFactory, options ...Option) (*BaseExporter, error) { + obsReport, err := NewExporter(ObsReportSettings{ExporterID: set.ID, ExporterCreateSettings: set, Signal: signal}) if err != nil { return nil, err } @@ -92,6 +94,29 @@ func NewBaseExporter(set exporter.Settings, signal component.DataType, osf Obsre return nil, err } + if be.QueueCfg.Enabled { + q := be.QueueFactory(context.Background(), exporterqueue.Settings{ + Signal: be.Signal, + ExporterSettings: be.Set, + }, exporterqueue.Config{ + Enabled: be.QueueCfg.Enabled, + NumConsumers: be.QueueCfg.NumConsumers, + QueueSize: be.QueueCfg.QueueSize, + }) + be.QueueSender = NewQueueSender(q, be.Set, be.QueueCfg.NumConsumers, be.ExportFailureMessage, be.Obsrep) + } + + if be.ExporterQueueCfg.Enabled { + set := exporterqueue.Settings{ + Signal: be.Signal, + ExporterSettings: be.Set, + } + be.QueueSender = NewQueueSender(be.QueueFactory(context.Background(), set, be.ExporterQueueCfg), be.Set, be.ExporterQueueCfg.NumConsumers, be.ExportFailureMessage, be.Obsrep) + for _, op := range options { + err = multierr.Append(err, op(be)) + } + } + if be.BatcherCfg.Enabled { bs := NewBatchSender(be.BatcherCfg, be.Set, be.BatchMergeFunc, be.BatchMergeSplitfunc) for _, opt := range be.BatcherOpts { @@ -103,17 +128,6 @@ func NewBaseExporter(set exporter.Settings, signal component.DataType, osf Obsre be.BatchSender = bs } - if be.QueueCfg.Enabled { - set := exporterqueue.Settings{ - DataType: be.Signal, - ExporterSettings: be.Set, - } - be.QueueSender = NewQueueSender(be.QueueFactory(context.Background(), set, be.QueueCfg), be.Set, be.QueueCfg.NumConsumers, be.ExportFailureMessage, be.Obsrep) - for _, op := range options { - err = multierr.Append(err, op(be)) - } - } - if err != nil { return nil, err } @@ -229,19 +243,11 @@ func WithQueue(config QueueConfig) Option { o.ExportFailureMessage += " Try enabling sending_queue to survive temporary failures." return nil } - qf := exporterqueue.NewPersistentQueueFactory[internal.Request](config.StorageID, exporterqueue.PersistentQueueSettings[internal.Request]{ + o.QueueCfg = config + o.QueueFactory = exporterqueue.NewPersistentQueueFactory[internal.Request](config.StorageID, exporterqueue.PersistentQueueSettings[internal.Request]{ Marshaler: o.Marshaler, Unmarshaler: o.Unmarshaler, }) - q := qf(context.Background(), exporterqueue.Settings{ - DataType: o.Signal, - ExporterSettings: o.Set, - }, exporterqueue.Config{ - Enabled: config.Enabled, - NumConsumers: config.NumConsumers, - QueueSize: config.QueueSize, - }) - o.QueueSender = NewQueueSender(q, o.Set, config.NumConsumers, o.ExportFailureMessage, o.Obsrep) return nil } } @@ -259,7 +265,7 @@ func WithRequestQueue(cfg exporterqueue.Config, queueFactory exporterqueue.Facto o.ExportFailureMessage += " Try enabling sending_queue to survive temporary failures." return nil } - o.QueueCfg = cfg + o.ExporterQueueCfg = cfg o.QueueFactory = queueFactory return nil } diff --git a/exporter/exporterhelper/internal/base_exporter_test.go b/exporter/exporterhelper/internal/base_exporter_test.go index f9c5975a171..028b0127627 100644 --- a/exporter/exporterhelper/internal/base_exporter_test.go +++ b/exporter/exporterhelper/internal/base_exporter_test.go @@ -19,11 +19,12 @@ import ( "go.opentelemetry.io/collector/exporter/exporterqueue" "go.opentelemetry.io/collector/exporter/exportertest" "go.opentelemetry.io/collector/exporter/internal" + "go.opentelemetry.io/collector/pipeline" ) var ( defaultType = component.MustNewType("test") - defaultDataType = component.DataTypeMetrics + defaultSignal = pipeline.SignalMetrics defaultID = component.NewID(defaultType) defaultSettings = func() exporter.Settings { set := exportertest.NewNopSettings() @@ -37,7 +38,7 @@ func newNoopObsrepSender(*ObsReport) RequestSender { } func TestBaseExporter(t *testing.T) { - be, err := NewBaseExporter(defaultSettings, defaultDataType, newNoopObsrepSender) + be, err := NewBaseExporter(defaultSettings, defaultSignal, newNoopObsrepSender) require.NoError(t, err) require.NoError(t, be.Start(context.Background(), componenttest.NewNopHost())) require.NoError(t, be.Shutdown(context.Background())) @@ -46,7 +47,7 @@ func TestBaseExporter(t *testing.T) { func TestBaseExporterWithOptions(t *testing.T) { want := errors.New("my error") be, err := NewBaseExporter( - defaultSettings, defaultDataType, newNoopObsrepSender, + defaultSettings, defaultSignal, newNoopObsrepSender, WithStart(func(context.Context, component.Host) error { return want }), WithShutdown(func(context.Context) error { return want }), WithTimeout(NewDefaultTimeoutConfig()), @@ -57,16 +58,16 @@ func TestBaseExporterWithOptions(t *testing.T) { } func TestQueueOptionsWithRequestExporter(t *testing.T) { - bs, err := NewBaseExporter(exportertest.NewNopSettings(), defaultDataType, newNoopObsrepSender, + bs, err := NewBaseExporter(exportertest.NewNopSettings(), defaultSignal, newNoopObsrepSender, WithRetry(configretry.NewDefaultBackOffConfig())) require.NoError(t, err) require.Nil(t, bs.Marshaler) require.Nil(t, bs.Unmarshaler) - _, err = NewBaseExporter(exportertest.NewNopSettings(), defaultDataType, newNoopObsrepSender, + _, err = NewBaseExporter(exportertest.NewNopSettings(), defaultSignal, newNoopObsrepSender, WithRetry(configretry.NewDefaultBackOffConfig()), WithQueue(NewDefaultQueueConfig())) require.Error(t, err) - _, err = NewBaseExporter(exportertest.NewNopSettings(), defaultDataType, newNoopObsrepSender, + _, err = NewBaseExporter(exportertest.NewNopSettings(), defaultSignal, newNoopObsrepSender, WithMarshaler(mockRequestMarshaler), WithUnmarshaler(mockRequestUnmarshaler(&mockRequest{})), WithRetry(configretry.NewDefaultBackOffConfig()), WithRequestQueue(exporterqueue.NewDefaultConfig(), exporterqueue.NewMemoryQueueFactory[internal.Request]())) @@ -79,7 +80,7 @@ func TestBaseExporterLogging(t *testing.T) { set.Logger = zap.New(logger) rCfg := configretry.NewDefaultBackOffConfig() rCfg.Enabled = false - bs, err := NewBaseExporter(set, defaultDataType, newNoopObsrepSender, WithRetry(rCfg)) + bs, err := NewBaseExporter(set, defaultSignal, newNoopObsrepSender, WithRetry(rCfg)) require.NoError(t, err) sendErr := bs.Send(context.Background(), newErrorRequest()) require.Error(t, sendErr) diff --git a/exporter/exporterhelper/internal/batch_sender_test.go b/exporter/exporterhelper/internal/batch_sender_test.go index 53ef9451137..c9f6cc084e2 100644 --- a/exporter/exporterhelper/internal/batch_sender_test.go +++ b/exporter/exporterhelper/internal/batch_sender_test.go @@ -211,7 +211,7 @@ func TestBatchSender_Disabled(t *testing.T) { cfg := exporterbatcher.NewDefaultConfig() cfg.Enabled = false cfg.MaxSizeItems = 5 - be, err := NewBaseExporter(defaultSettings, defaultDataType, newNoopObsrepSender, + be, err := NewBaseExporter(defaultSettings, defaultSignal, newNoopObsrepSender, WithBatcher(cfg, WithRequestBatchFuncs(fakeBatchMergeFunc, fakeBatchMergeSplitFunc))) require.NotNil(t, be) require.NoError(t, err) @@ -259,7 +259,7 @@ func TestBatchSender_InvalidMergeSplitFunc(t *testing.T) { } func TestBatchSender_PostShutdown(t *testing.T) { - be, err := NewBaseExporter(defaultSettings, defaultDataType, newNoopObsrepSender, + be, err := NewBaseExporter(defaultSettings, defaultSignal, newNoopObsrepSender, WithBatcher(exporterbatcher.NewDefaultConfig(), WithRequestBatchFuncs(fakeBatchMergeFunc, fakeBatchMergeSplitFunc))) require.NotNil(t, be) @@ -322,7 +322,7 @@ func TestBatchSender_ConcurrencyLimitReached(t *testing.T) { t.Run(tt.name, func(t *testing.T) { qCfg := exporterqueue.NewDefaultConfig() qCfg.NumConsumers = 2 - be, err := NewBaseExporter(defaultSettings, defaultDataType, newNoopObsrepSender, + be, err := NewBaseExporter(defaultSettings, defaultSignal, newNoopObsrepSender, WithBatcher(tt.batcherCfg, WithRequestBatchFuncs(fakeBatchMergeFunc, fakeBatchMergeSplitFunc)), WithRequestQueue(qCfg, exporterqueue.NewMemoryQueueFactory[internal.Request]())) require.NotNil(t, be) @@ -377,7 +377,7 @@ func TestBatchSender_ConcurrencyLimitReached(t *testing.T) { func TestBatchSender_BatchBlocking(t *testing.T) { bCfg := exporterbatcher.NewDefaultConfig() bCfg.MinSizeItems = 3 - be, err := NewBaseExporter(defaultSettings, defaultDataType, newNoopObsrepSender, + be, err := NewBaseExporter(defaultSettings, defaultSignal, newNoopObsrepSender, WithBatcher(bCfg, WithRequestBatchFuncs(fakeBatchMergeFunc, fakeBatchMergeSplitFunc))) require.NotNil(t, be) require.NoError(t, err) @@ -407,7 +407,7 @@ func TestBatchSender_BatchBlocking(t *testing.T) { func TestBatchSender_BatchCancelled(t *testing.T) { bCfg := exporterbatcher.NewDefaultConfig() bCfg.MinSizeItems = 2 - be, err := NewBaseExporter(defaultSettings, defaultDataType, newNoopObsrepSender, + be, err := NewBaseExporter(defaultSettings, defaultSignal, newNoopObsrepSender, WithBatcher(bCfg, WithRequestBatchFuncs(fakeBatchMergeFunc, fakeBatchMergeSplitFunc))) require.NotNil(t, be) require.NoError(t, err) @@ -442,7 +442,7 @@ func TestBatchSender_BatchCancelled(t *testing.T) { func TestBatchSender_DrainActiveRequests(t *testing.T) { bCfg := exporterbatcher.NewDefaultConfig() bCfg.MinSizeItems = 2 - be, err := NewBaseExporter(defaultSettings, defaultDataType, newNoopObsrepSender, + be, err := NewBaseExporter(defaultSettings, defaultSignal, newNoopObsrepSender, WithBatcher(bCfg, WithRequestBatchFuncs(fakeBatchMergeFunc, fakeBatchMergeSplitFunc))) require.NotNil(t, be) require.NoError(t, err) @@ -505,7 +505,7 @@ func TestBatchSender_WithBatcherOption(t *testing.T) { } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - be, err := NewBaseExporter(defaultSettings, defaultDataType, newNoopObsrepSender, tt.opts...) + be, err := NewBaseExporter(defaultSettings, defaultSignal, newNoopObsrepSender, tt.opts...) if tt.expectedErr { assert.Nil(t, be) assert.Error(t, err) @@ -518,7 +518,7 @@ func TestBatchSender_WithBatcherOption(t *testing.T) { } func TestBatchSender_UnstartedShutdown(t *testing.T) { - be, err := NewBaseExporter(defaultSettings, defaultDataType, newNoopObsrepSender, + be, err := NewBaseExporter(defaultSettings, defaultSignal, newNoopObsrepSender, WithBatcher(exporterbatcher.NewDefaultConfig(), WithRequestBatchFuncs(fakeBatchMergeFunc, fakeBatchMergeSplitFunc))) require.NoError(t, err) @@ -542,7 +542,7 @@ func TestBatchSender_ShutdownDeadlock(t *testing.T) { bCfg := exporterbatcher.NewDefaultConfig() bCfg.FlushTimeout = 10 * time.Minute // high timeout to avoid the timeout to trigger - be, err := NewBaseExporter(defaultSettings, defaultDataType, newNoopObsrepSender, + be, err := NewBaseExporter(defaultSettings, defaultSignal, newNoopObsrepSender, WithBatcher(bCfg, WithRequestBatchFuncs(blockedBatchMergeFunc, fakeBatchMergeSplitFunc))) require.NoError(t, err) require.NoError(t, be.Start(context.Background(), componenttest.NewNopHost())) @@ -578,7 +578,7 @@ func TestBatchSenderWithTimeout(t *testing.T) { bCfg.MinSizeItems = 10 tCfg := NewDefaultTimeoutConfig() tCfg.Timeout = 50 * time.Millisecond - be, err := NewBaseExporter(defaultSettings, defaultDataType, newNoopObsrepSender, + be, err := NewBaseExporter(defaultSettings, defaultSignal, newNoopObsrepSender, WithBatcher(bCfg, WithRequestBatchFuncs(fakeBatchMergeFunc, fakeBatchMergeSplitFunc)), WithTimeout(tCfg)) require.NoError(t, err) @@ -637,7 +637,7 @@ func TestBatchSenderTimerResetNoConflict(t *testing.T) { bCfg := exporterbatcher.NewDefaultConfig() bCfg.MinSizeItems = 8 bCfg.FlushTimeout = 50 * time.Millisecond - be, err := NewBaseExporter(defaultSettings, defaultDataType, newNoopObsrepSender, + be, err := NewBaseExporter(defaultSettings, defaultSignal, newNoopObsrepSender, WithBatcher(bCfg, WithRequestBatchFuncs(delayBatchMergeFunc, fakeBatchMergeSplitFunc))) require.NoError(t, err) require.NoError(t, be.Start(context.Background(), componenttest.NewNopHost())) @@ -668,7 +668,7 @@ func TestBatchSenderTimerFlush(t *testing.T) { bCfg := exporterbatcher.NewDefaultConfig() bCfg.MinSizeItems = 8 bCfg.FlushTimeout = 100 * time.Millisecond - be, err := NewBaseExporter(defaultSettings, defaultDataType, newNoopObsrepSender, + be, err := NewBaseExporter(defaultSettings, defaultSignal, newNoopObsrepSender, WithBatcher(bCfg, WithRequestBatchFuncs(fakeBatchMergeFunc, fakeBatchMergeSplitFunc))) require.NoError(t, err) require.NoError(t, be.Start(context.Background(), componenttest.NewNopHost())) @@ -705,7 +705,7 @@ func TestBatchSenderTimerFlush(t *testing.T) { } func queueBatchExporter(t *testing.T, batchOption Option) *BaseExporter { - be, err := NewBaseExporter(defaultSettings, defaultDataType, newNoopObsrepSender, batchOption, + be, err := NewBaseExporter(defaultSettings, defaultSignal, newNoopObsrepSender, batchOption, WithRequestQueue(exporterqueue.NewDefaultConfig(), exporterqueue.NewMemoryQueueFactory[internal.Request]())) require.NotNil(t, be) require.NoError(t, err) diff --git a/exporter/exporterhelper/internal/obsexporter.go b/exporter/exporterhelper/internal/obsexporter.go index 2bb60f13544..0805c5ac542 100644 --- a/exporter/exporterhelper/internal/obsexporter.go +++ b/exporter/exporterhelper/internal/obsexporter.go @@ -14,13 +14,14 @@ import ( "go.opentelemetry.io/collector/component" "go.opentelemetry.io/collector/exporter" "go.opentelemetry.io/collector/exporter/exporterhelper/internal/metadata" + "go.opentelemetry.io/collector/pipeline" ) // ObsReport is a helper to add observability to an exporter. type ObsReport struct { spanNamePrefix string tracer trace.Tracer - DataType component.DataType + Signal pipeline.Signal otelAttrs []attribute.KeyValue TelemetryBuilder *metadata.TelemetryBuilder @@ -30,7 +31,7 @@ type ObsReport struct { type ObsReportSettings struct { ExporterID component.ID ExporterCreateSettings exporter.Settings - DataType component.DataType + Signal pipeline.Signal } func NewExporter(cfg ObsReportSettings) (*ObsReport, error) { @@ -42,7 +43,7 @@ func NewExporter(cfg ObsReportSettings) (*ObsReport, error) { return &ObsReport{ spanNamePrefix: ExporterPrefix + cfg.ExporterID.String(), tracer: cfg.ExporterCreateSettings.TracerProvider.Tracer(cfg.ExporterID.String()), - DataType: cfg.DataType, + Signal: cfg.Signal, otelAttrs: []attribute.KeyValue{ attribute.String(ExporterKey, cfg.ExporterID.String()), }, @@ -60,7 +61,7 @@ func (or *ObsReport) StartTracesOp(ctx context.Context) context.Context { // EndTracesOp completes the export operation that was started with startTracesOp. func (or *ObsReport) EndTracesOp(ctx context.Context, numSpans int, err error) { numSent, numFailedToSend := toNumItems(numSpans, err) - or.recordMetrics(context.WithoutCancel(ctx), component.DataTypeTraces, numSent, numFailedToSend) + or.recordMetrics(context.WithoutCancel(ctx), pipeline.SignalTraces, numSent, numFailedToSend) endSpan(ctx, err, numSent, numFailedToSend, SentSpansKey, FailedToSendSpansKey) } @@ -77,7 +78,7 @@ func (or *ObsReport) StartMetricsOp(ctx context.Context) context.Context { // If needed, report your use case in https://github.com/open-telemetry/opentelemetry-collector/issues/10592. func (or *ObsReport) EndMetricsOp(ctx context.Context, numMetricPoints int, err error) { numSent, numFailedToSend := toNumItems(numMetricPoints, err) - or.recordMetrics(context.WithoutCancel(ctx), component.DataTypeMetrics, numSent, numFailedToSend) + or.recordMetrics(context.WithoutCancel(ctx), pipeline.SignalMetrics, numSent, numFailedToSend) endSpan(ctx, err, numSent, numFailedToSend, SentMetricPointsKey, FailedToSendMetricPointsKey) } @@ -91,7 +92,7 @@ func (or *ObsReport) StartLogsOp(ctx context.Context) context.Context { // EndLogsOp completes the export operation that was started with startLogsOp. func (or *ObsReport) EndLogsOp(ctx context.Context, numLogRecords int, err error) { numSent, numFailedToSend := toNumItems(numLogRecords, err) - or.recordMetrics(context.WithoutCancel(ctx), component.DataTypeLogs, numSent, numFailedToSend) + or.recordMetrics(context.WithoutCancel(ctx), pipeline.SignalLogs, numSent, numFailedToSend) endSpan(ctx, err, numSent, numFailedToSend, SentLogRecordsKey, FailedToSendLogRecordsKey) } @@ -103,16 +104,16 @@ func (or *ObsReport) startOp(ctx context.Context, operationSuffix string) contex return ctx } -func (or *ObsReport) recordMetrics(ctx context.Context, dataType component.DataType, sent, failed int64) { +func (or *ObsReport) recordMetrics(ctx context.Context, signal pipeline.Signal, sent, failed int64) { var sentMeasure, failedMeasure metric.Int64Counter - switch dataType { - case component.DataTypeTraces: + switch signal { + case pipeline.SignalTraces: sentMeasure = or.TelemetryBuilder.ExporterSentSpans failedMeasure = or.TelemetryBuilder.ExporterSendFailedSpans - case component.DataTypeMetrics: + case pipeline.SignalMetrics: sentMeasure = or.TelemetryBuilder.ExporterSentMetricPoints failedMeasure = or.TelemetryBuilder.ExporterSendFailedMetricPoints - case component.DataTypeLogs: + case pipeline.SignalLogs: sentMeasure = or.TelemetryBuilder.ExporterSentLogRecords failedMeasure = or.TelemetryBuilder.ExporterSendFailedLogRecords } @@ -143,14 +144,14 @@ func toNumItems(numExportedItems int, err error) (int64, int64) { return int64(numExportedItems), 0 } -func (or *ObsReport) RecordEnqueueFailure(ctx context.Context, dataType component.DataType, failed int64) { +func (or *ObsReport) RecordEnqueueFailure(ctx context.Context, signal pipeline.Signal, failed int64) { var enqueueFailedMeasure metric.Int64Counter - switch dataType { - case component.DataTypeTraces: + switch signal { + case pipeline.SignalTraces: enqueueFailedMeasure = or.TelemetryBuilder.ExporterEnqueueFailedSpans - case component.DataTypeMetrics: + case pipeline.SignalMetrics: enqueueFailedMeasure = or.TelemetryBuilder.ExporterEnqueueFailedMetricPoints - case component.DataTypeLogs: + case pipeline.SignalLogs: enqueueFailedMeasure = or.TelemetryBuilder.ExporterEnqueueFailedLogRecords } diff --git a/exporter/exporterhelper/internal/queue_sender.go b/exporter/exporterhelper/internal/queue_sender.go index 60a94966336..4e78b670b55 100644 --- a/exporter/exporterhelper/internal/queue_sender.go +++ b/exporter/exporterhelper/internal/queue_sender.go @@ -22,9 +22,6 @@ import ( const defaultQueueSize = 1000 -// Deprecated: [v0.110.0] Use QueueConfig instead. -type QueueSettings = QueueConfig - // QueueConfig defines configuration for queueing batches before sending to the consumerSender. type QueueConfig struct { // Enabled indicates whether to not enqueue batches before sending to the consumerSender. @@ -40,11 +37,6 @@ type QueueConfig struct { StorageID *component.ID `mapstructure:"storage"` } -// Deprecated: [v0.110.0] Use NewDefaultQueueConfig instead. -func NewDefaultQueueSettings() QueueSettings { - return NewDefaultQueueConfig() -} - // NewDefaultQueueConfig returns the default config for QueueConfig. func NewDefaultQueueConfig() QueueConfig { return QueueConfig{ @@ -112,7 +104,7 @@ func (qs *QueueSender) Start(ctx context.Context, host component.Host) error { return err } - dataTypeAttr := attribute.String(DataTypeKey, qs.obsrep.DataType.String()) + dataTypeAttr := attribute.String(DataTypeKey, qs.obsrep.Signal.String()) return multierr.Append( qs.obsrep.TelemetryBuilder.InitExporterQueueSize(func() int64 { return int64(qs.queue.Size()) }, metric.WithAttributeSet(attribute.NewSet(qs.traceAttribute, dataTypeAttr))), diff --git a/exporter/exporterhelper/internal/queue_sender_test.go b/exporter/exporterhelper/internal/queue_sender_test.go index a9dd5ab7cea..30b8f28745f 100644 --- a/exporter/exporterhelper/internal/queue_sender_test.go +++ b/exporter/exporterhelper/internal/queue_sender_test.go @@ -23,13 +23,14 @@ import ( "go.opentelemetry.io/collector/exporter/exportertest" "go.opentelemetry.io/collector/exporter/internal" "go.opentelemetry.io/collector/exporter/internal/queue" + "go.opentelemetry.io/collector/pipeline" ) func TestQueuedRetry_StopWhileWaiting(t *testing.T) { qCfg := NewDefaultQueueConfig() qCfg.NumConsumers = 1 rCfg := configretry.NewDefaultBackOffConfig() - be, err := NewBaseExporter(defaultSettings, defaultDataType, newObservabilityConsumerSender, + be, err := NewBaseExporter(defaultSettings, defaultSignal, newObservabilityConsumerSender, WithMarshaler(mockRequestMarshaler), WithUnmarshaler(mockRequestUnmarshaler(&mockRequest{})), WithRetry(rCfg), WithQueue(qCfg)) require.NoError(t, err) @@ -63,7 +64,7 @@ func TestQueuedRetry_DoNotPreserveCancellation(t *testing.T) { qCfg := NewDefaultQueueConfig() qCfg.NumConsumers = 1 rCfg := configretry.NewDefaultBackOffConfig() - be, err := NewBaseExporter(defaultSettings, defaultDataType, newObservabilityConsumerSender, + be, err := NewBaseExporter(defaultSettings, defaultSignal, newObservabilityConsumerSender, WithMarshaler(mockRequestMarshaler), WithUnmarshaler(mockRequestUnmarshaler(&mockRequest{})), WithRetry(rCfg), WithQueue(qCfg)) require.NoError(t, err) @@ -95,7 +96,7 @@ func TestQueuedRetry_RejectOnFull(t *testing.T) { set := exportertest.NewNopSettings() logger, observed := observer.New(zap.ErrorLevel) set.Logger = zap.New(logger) - be, err := NewBaseExporter(set, defaultDataType, newNoopObsrepSender, + be, err := NewBaseExporter(set, defaultSignal, newNoopObsrepSender, WithMarshaler(mockRequestMarshaler), WithUnmarshaler(mockRequestUnmarshaler(&mockRequest{})), WithQueue(qCfg)) require.NoError(t, err) @@ -168,7 +169,7 @@ func TestQueuedRetryHappyPath(t *testing.T) { t.Cleanup(func() { require.NoError(t, tel.Shutdown(context.Background())) }) set := exporter.Settings{ID: defaultID, TelemetrySettings: tel.TelemetrySettings(), BuildInfo: component.NewDefaultBuildInfo()} - be, err := NewBaseExporter(set, defaultDataType, newObservabilityConsumerSender, tt.queueOptions...) + be, err := NewBaseExporter(set, defaultSignal, newObservabilityConsumerSender, tt.queueOptions...) require.NoError(t, err) ocs := be.ObsrepSender.(*observabilityConsumerSender) @@ -205,7 +206,7 @@ func TestQueuedRetryHappyPath(t *testing.T) { } func TestQueuedRetry_QueueMetricsReported(t *testing.T) { - dataTypes := []component.DataType{component.DataTypeLogs, component.DataTypeTraces, component.DataTypeMetrics} + dataTypes := []pipeline.Signal{pipeline.SignalLogs, pipeline.SignalTraces, pipeline.SignalMetrics} for _, dataType := range dataTypes { tt, err := componenttest.SetupTelemetry(defaultID) require.NoError(t, err) @@ -299,7 +300,7 @@ func TestQueueRetryWithDisabledQueue(t *testing.T) { set := exportertest.NewNopSettings() logger, observed := observer.New(zap.ErrorLevel) set.Logger = zap.New(logger) - be, err := NewBaseExporter(set, component.DataTypeLogs, newObservabilityConsumerSender, tt.queueOptions...) + be, err := NewBaseExporter(set, pipeline.SignalLogs, newObservabilityConsumerSender, tt.queueOptions...) require.NoError(t, err) require.NoError(t, be.Start(context.Background(), componenttest.NewNopHost())) ocs := be.ObsrepSender.(*observabilityConsumerSender) @@ -323,7 +324,7 @@ func TestQueueFailedRequestDropped(t *testing.T) { set := exportertest.NewNopSettings() logger, observed := observer.New(zap.ErrorLevel) set.Logger = zap.New(logger) - be, err := NewBaseExporter(set, component.DataTypeLogs, newNoopObsrepSender, + be, err := NewBaseExporter(set, pipeline.SignalLogs, newNoopObsrepSender, WithRequestQueue(exporterqueue.NewDefaultConfig(), exporterqueue.NewMemoryQueueFactory[internal.Request]())) require.NoError(t, err) require.NoError(t, be.Start(context.Background(), componenttest.NewNopHost())) @@ -345,7 +346,7 @@ func TestQueuedRetryPersistenceEnabled(t *testing.T) { qCfg.StorageID = &storageID // enable persistence rCfg := configretry.NewDefaultBackOffConfig() set := exporter.Settings{ID: defaultID, TelemetrySettings: tt.TelemetrySettings(), BuildInfo: component.NewDefaultBuildInfo()} - be, err := NewBaseExporter(set, defaultDataType, newObservabilityConsumerSender, + be, err := NewBaseExporter(set, defaultSignal, newObservabilityConsumerSender, WithMarshaler(mockRequestMarshaler), WithUnmarshaler(mockRequestUnmarshaler(&mockRequest{})), WithRetry(rCfg), WithQueue(qCfg)) require.NoError(t, err) @@ -371,7 +372,7 @@ func TestQueuedRetryPersistenceEnabledStorageError(t *testing.T) { qCfg.StorageID = &storageID // enable persistence rCfg := configretry.NewDefaultBackOffConfig() set := exporter.Settings{ID: defaultID, TelemetrySettings: tt.TelemetrySettings(), BuildInfo: component.NewDefaultBuildInfo()} - be, err := NewBaseExporter(set, defaultDataType, newObservabilityConsumerSender, WithMarshaler(mockRequestMarshaler), + be, err := NewBaseExporter(set, defaultSignal, newObservabilityConsumerSender, WithMarshaler(mockRequestMarshaler), WithUnmarshaler(mockRequestUnmarshaler(&mockRequest{})), WithRetry(rCfg), WithQueue(qCfg)) require.NoError(t, err) @@ -395,7 +396,7 @@ func TestQueuedRetryPersistentEnabled_NoDataLossOnShutdown(t *testing.T) { rCfg.MaxElapsedTime = 0 // retry infinitely so shutdown can be triggered mockReq := newErrorRequest() - be, err := NewBaseExporter(defaultSettings, defaultDataType, newNoopObsrepSender, WithMarshaler(mockRequestMarshaler), + be, err := NewBaseExporter(defaultSettings, defaultSignal, newNoopObsrepSender, WithMarshaler(mockRequestMarshaler), WithUnmarshaler(mockRequestUnmarshaler(mockReq)), WithRetry(rCfg), WithQueue(qCfg)) require.NoError(t, err) @@ -419,7 +420,7 @@ func TestQueuedRetryPersistentEnabled_NoDataLossOnShutdown(t *testing.T) { // start the exporter again replacing the preserved mockRequest in the unmarshaler with a new one that doesn't fail. replacedReq := newMockRequest(1, nil) - be, err = NewBaseExporter(defaultSettings, defaultDataType, newNoopObsrepSender, WithMarshaler(mockRequestMarshaler), + be, err = NewBaseExporter(defaultSettings, defaultSignal, newNoopObsrepSender, WithMarshaler(mockRequestMarshaler), WithUnmarshaler(mockRequestUnmarshaler(replacedReq)), WithRetry(rCfg), WithQueue(qCfg)) require.NoError(t, err) require.NoError(t, be.Start(context.Background(), host)) diff --git a/exporter/exporterhelper/internal/retry_sender_test.go b/exporter/exporterhelper/internal/retry_sender_test.go index f4cc0f5ee0b..13d8acd0732 100644 --- a/exporter/exporterhelper/internal/retry_sender_test.go +++ b/exporter/exporterhelper/internal/retry_sender_test.go @@ -16,7 +16,6 @@ import ( "go.uber.org/zap" "go.uber.org/zap/zaptest/observer" - "go.opentelemetry.io/collector/component" "go.opentelemetry.io/collector/component/componenttest" "go.opentelemetry.io/collector/config/configretry" "go.opentelemetry.io/collector/consumer/consumererror" @@ -24,6 +23,7 @@ import ( "go.opentelemetry.io/collector/exporter/exportertest" "go.opentelemetry.io/collector/exporter/internal" "go.opentelemetry.io/collector/pdata/testdata" + "go.opentelemetry.io/collector/pipeline" ) func mockRequestUnmarshaler(mr internal.Request) exporterqueue.Unmarshaler[internal.Request] { @@ -40,7 +40,7 @@ func TestQueuedRetry_DropOnPermanentError(t *testing.T) { qCfg := NewDefaultQueueConfig() rCfg := configretry.NewDefaultBackOffConfig() mockR := newMockRequest(2, consumererror.NewPermanent(errors.New("bad data"))) - be, err := NewBaseExporter(defaultSettings, defaultDataType, newObservabilityConsumerSender, + be, err := NewBaseExporter(defaultSettings, defaultSignal, newObservabilityConsumerSender, WithMarshaler(mockRequestMarshaler), WithUnmarshaler(mockRequestUnmarshaler(mockR)), WithRetry(rCfg), WithQueue(qCfg)) require.NoError(t, err) ocs := be.ObsrepSender.(*observabilityConsumerSender) @@ -64,7 +64,7 @@ func TestQueuedRetry_DropOnNoRetry(t *testing.T) { qCfg := NewDefaultQueueConfig() rCfg := configretry.NewDefaultBackOffConfig() rCfg.Enabled = false - be, err := NewBaseExporter(defaultSettings, defaultDataType, newObservabilityConsumerSender, WithMarshaler(mockRequestMarshaler), + be, err := NewBaseExporter(defaultSettings, defaultSignal, newObservabilityConsumerSender, WithMarshaler(mockRequestMarshaler), WithUnmarshaler(mockRequestUnmarshaler(newMockRequest(2, errors.New("transient error")))), WithQueue(qCfg), WithRetry(rCfg)) require.NoError(t, err) @@ -91,7 +91,7 @@ func TestQueuedRetry_OnError(t *testing.T) { qCfg.NumConsumers = 1 rCfg := configretry.NewDefaultBackOffConfig() rCfg.InitialInterval = 0 - be, err := NewBaseExporter(defaultSettings, defaultDataType, newObservabilityConsumerSender, + be, err := NewBaseExporter(defaultSettings, defaultSignal, newObservabilityConsumerSender, WithMarshaler(mockRequestMarshaler), WithUnmarshaler(mockRequestUnmarshaler(&mockRequest{})), WithRetry(rCfg), WithQueue(qCfg)) require.NoError(t, err) @@ -121,7 +121,7 @@ func TestQueuedRetry_MaxElapsedTime(t *testing.T) { rCfg := configretry.NewDefaultBackOffConfig() rCfg.InitialInterval = time.Millisecond rCfg.MaxElapsedTime = 100 * time.Millisecond - be, err := NewBaseExporter(defaultSettings, defaultDataType, newObservabilityConsumerSender, + be, err := NewBaseExporter(defaultSettings, defaultSignal, newObservabilityConsumerSender, WithMarshaler(mockRequestMarshaler), WithUnmarshaler(mockRequestUnmarshaler(&mockRequest{})), WithRetry(rCfg), WithQueue(qCfg)) require.NoError(t, err) @@ -169,7 +169,7 @@ func TestQueuedRetry_ThrottleError(t *testing.T) { qCfg.NumConsumers = 1 rCfg := configretry.NewDefaultBackOffConfig() rCfg.InitialInterval = 10 * time.Millisecond - be, err := NewBaseExporter(defaultSettings, defaultDataType, newObservabilityConsumerSender, + be, err := NewBaseExporter(defaultSettings, defaultSignal, newObservabilityConsumerSender, WithMarshaler(mockRequestMarshaler), WithUnmarshaler(mockRequestUnmarshaler(&mockRequest{})), WithRetry(rCfg), WithQueue(qCfg)) require.NoError(t, err) @@ -203,7 +203,7 @@ func TestQueuedRetry_RetryOnError(t *testing.T) { qCfg.QueueSize = 1 rCfg := configretry.NewDefaultBackOffConfig() rCfg.InitialInterval = 0 - be, err := NewBaseExporter(defaultSettings, defaultDataType, newObservabilityConsumerSender, + be, err := NewBaseExporter(defaultSettings, defaultSignal, newObservabilityConsumerSender, WithMarshaler(mockRequestMarshaler), WithUnmarshaler(mockRequestUnmarshaler(&mockRequest{})), WithRetry(rCfg), WithQueue(qCfg)) require.NoError(t, err) @@ -230,7 +230,7 @@ func TestQueuedRetry_RetryOnError(t *testing.T) { func TestQueueRetryWithNoQueue(t *testing.T) { rCfg := configretry.NewDefaultBackOffConfig() rCfg.MaxElapsedTime = time.Nanosecond // fail fast - be, err := NewBaseExporter(exportertest.NewNopSettings(), component.DataTypeLogs, newObservabilityConsumerSender, WithRetry(rCfg)) + be, err := NewBaseExporter(exportertest.NewNopSettings(), pipeline.SignalLogs, newObservabilityConsumerSender, WithRetry(rCfg)) require.NoError(t, err) require.NoError(t, be.Start(context.Background(), componenttest.NewNopHost())) ocs := be.ObsrepSender.(*observabilityConsumerSender) @@ -251,7 +251,7 @@ func TestQueueRetryWithDisabledRetires(t *testing.T) { set := exportertest.NewNopSettings() logger, observed := observer.New(zap.ErrorLevel) set.Logger = zap.New(logger) - be, err := NewBaseExporter(set, component.DataTypeLogs, newObservabilityConsumerSender, WithRetry(rCfg)) + be, err := NewBaseExporter(set, pipeline.SignalLogs, newObservabilityConsumerSender, WithRetry(rCfg)) require.NoError(t, err) require.NoError(t, be.Start(context.Background(), componenttest.NewNopHost())) ocs := be.ObsrepSender.(*observabilityConsumerSender) diff --git a/exporter/exporterhelper/logs.go b/exporter/exporterhelper/logs.go index 795bf91408e..f2219f4db8c 100644 --- a/exporter/exporterhelper/logs.go +++ b/exporter/exporterhelper/logs.go @@ -17,6 +17,7 @@ import ( "go.opentelemetry.io/collector/exporter/exporterqueue" "go.opentelemetry.io/collector/exporter/internal/queue" "go.opentelemetry.io/collector/pdata/plog" + "go.opentelemetry.io/collector/pipeline" ) var logsMarshaler = &plog.ProtoMarshaler{} @@ -119,7 +120,7 @@ func NewLogsRequestExporter( return nil, errNilLogsConverter } - be, err := internal.NewBaseExporter(set, component.DataTypeLogs, newLogsExporterWithObservability, options...) + be, err := internal.NewBaseExporter(set, pipeline.SignalLogs, newLogsExporterWithObservability, options...) if err != nil { return nil, err } @@ -134,7 +135,7 @@ func NewLogsRequestExporter( } sErr := be.Send(ctx, req) if errors.Is(sErr, queue.ErrQueueIsFull) { - be.Obsrep.RecordEnqueueFailure(ctx, component.DataTypeLogs, int64(req.ItemsCount())) + be.Obsrep.RecordEnqueueFailure(ctx, pipeline.SignalLogs, int64(req.ItemsCount())) } return sErr }, be.ConsumerOptions...) diff --git a/exporter/exporterhelper/metrics.go b/exporter/exporterhelper/metrics.go index f78fc2fc972..cbc76d81a54 100644 --- a/exporter/exporterhelper/metrics.go +++ b/exporter/exporterhelper/metrics.go @@ -17,6 +17,7 @@ import ( "go.opentelemetry.io/collector/exporter/exporterqueue" "go.opentelemetry.io/collector/exporter/internal/queue" "go.opentelemetry.io/collector/pdata/pmetric" + "go.opentelemetry.io/collector/pipeline" ) var metricsMarshaler = &pmetric.ProtoMarshaler{} @@ -119,7 +120,7 @@ func NewMetricsRequestExporter( return nil, errNilMetricsConverter } - be, err := internal.NewBaseExporter(set, component.DataTypeMetrics, newMetricsSenderWithObservability, options...) + be, err := internal.NewBaseExporter(set, pipeline.SignalMetrics, newMetricsSenderWithObservability, options...) if err != nil { return nil, err } @@ -134,7 +135,7 @@ func NewMetricsRequestExporter( } sErr := be.Send(ctx, req) if errors.Is(sErr, queue.ErrQueueIsFull) { - be.Obsrep.RecordEnqueueFailure(ctx, component.DataTypeMetrics, int64(req.ItemsCount())) + be.Obsrep.RecordEnqueueFailure(ctx, pipeline.SignalMetrics, int64(req.ItemsCount())) } return sErr }, be.ConsumerOptions...) diff --git a/exporter/exporterhelper/obsreport_test.go b/exporter/exporterhelper/obsreport_test.go index 80134bc8a62..38d34a15c23 100644 --- a/exporter/exporterhelper/obsreport_test.go +++ b/exporter/exporterhelper/obsreport_test.go @@ -13,6 +13,7 @@ import ( "go.opentelemetry.io/collector/component/componenttest" "go.opentelemetry.io/collector/exporter" "go.opentelemetry.io/collector/exporter/exporterhelper/internal" + "go.opentelemetry.io/collector/pipeline" ) var exporterID = component.MustNewID("fakeExporter") @@ -29,14 +30,14 @@ func TestExportEnqueueFailure(t *testing.T) { require.NoError(t, err) logRecords := int64(7) - obsrep.RecordEnqueueFailure(context.Background(), component.DataTypeLogs, logRecords) + obsrep.RecordEnqueueFailure(context.Background(), pipeline.SignalLogs, logRecords) require.NoError(t, tt.CheckExporterEnqueueFailedLogs(logRecords)) spans := int64(12) - obsrep.RecordEnqueueFailure(context.Background(), component.DataTypeTraces, spans) + obsrep.RecordEnqueueFailure(context.Background(), pipeline.SignalTraces, spans) require.NoError(t, tt.CheckExporterEnqueueFailedTraces(spans)) metricPoints := int64(21) - obsrep.RecordEnqueueFailure(context.Background(), component.DataTypeMetrics, metricPoints) + obsrep.RecordEnqueueFailure(context.Background(), pipeline.SignalMetrics, metricPoints) require.NoError(t, tt.CheckExporterEnqueueFailedMetrics(metricPoints)) } diff --git a/exporter/exporterhelper/queue_sender.go b/exporter/exporterhelper/queue_sender.go index b81e2036fab..f09932c5b86 100644 --- a/exporter/exporterhelper/queue_sender.go +++ b/exporter/exporterhelper/queue_sender.go @@ -5,17 +5,9 @@ package exporterhelper // import "go.opentelemetry.io/collector/exporter/exporte import "go.opentelemetry.io/collector/exporter/exporterhelper/internal" -// Deprecated: [v0.110.0] Use QueueConfig instead. -type QueueSettings = internal.QueueConfig - // QueueConfig defines configuration for queueing batches before sending to the consumerSender. type QueueConfig = internal.QueueConfig -// Deprecated: [v0.110.0] Use NewDefaultQueueConfig instead. -func NewDefaultQueueSettings() QueueSettings { - return internal.NewDefaultQueueConfig() -} - // NewDefaultQueueConfig returns the default config for QueueConfig. func NewDefaultQueueConfig() QueueConfig { return internal.NewDefaultQueueConfig() diff --git a/exporter/exporterhelper/timeout_sender.go b/exporter/exporterhelper/timeout_sender.go index 9788397b7d2..090caf2d7d9 100644 --- a/exporter/exporterhelper/timeout_sender.go +++ b/exporter/exporterhelper/timeout_sender.go @@ -7,16 +7,8 @@ import ( "go.opentelemetry.io/collector/exporter/exporterhelper/internal" ) -// Deprecated: [v0.110.0] Use TimeoutConfig instead. -type TimeoutSettings = TimeoutConfig - type TimeoutConfig = internal.TimeoutConfig -// Deprecated: [v0.110.0] Use NewDefaultTimeoutConfig instead. -func NewDefaultTimeoutSettings() TimeoutSettings { - return internal.NewDefaultTimeoutConfig() -} - // NewDefaultTimeoutConfig returns the default config for TimeoutConfig. func NewDefaultTimeoutConfig() TimeoutConfig { return internal.NewDefaultTimeoutConfig() diff --git a/exporter/exporterhelper/traces.go b/exporter/exporterhelper/traces.go index da057a861bf..32cb45fd879 100644 --- a/exporter/exporterhelper/traces.go +++ b/exporter/exporterhelper/traces.go @@ -17,6 +17,7 @@ import ( "go.opentelemetry.io/collector/exporter/exporterqueue" "go.opentelemetry.io/collector/exporter/internal/queue" "go.opentelemetry.io/collector/pdata/ptrace" + "go.opentelemetry.io/collector/pipeline" ) var tracesMarshaler = &ptrace.ProtoMarshaler{} @@ -119,7 +120,7 @@ func NewTracesRequestExporter( return nil, errNilTracesConverter } - be, err := internal.NewBaseExporter(set, component.DataTypeTraces, newTracesExporterWithObservability, options...) + be, err := internal.NewBaseExporter(set, pipeline.SignalTraces, newTracesExporterWithObservability, options...) if err != nil { return nil, err } @@ -134,7 +135,7 @@ func NewTracesRequestExporter( } sErr := be.Send(ctx, req) if errors.Is(sErr, queue.ErrQueueIsFull) { - be.Obsrep.RecordEnqueueFailure(ctx, component.DataTypeTraces, int64(req.ItemsCount())) + be.Obsrep.RecordEnqueueFailure(ctx, pipeline.SignalTraces, int64(req.ItemsCount())) } return sErr }, be.ConsumerOptions...) diff --git a/exporter/exporterprofiles/go.mod b/exporter/exporterprofiles/go.mod index c839aad6b28..c5a4909a994 100644 --- a/exporter/exporterprofiles/go.mod +++ b/exporter/exporterprofiles/go.mod @@ -4,9 +4,9 @@ go 1.22.0 require ( github.com/stretchr/testify v1.9.0 - go.opentelemetry.io/collector/component v0.109.0 - go.opentelemetry.io/collector/consumer/consumertest v0.109.0 - go.opentelemetry.io/collector/exporter v0.109.0 + go.opentelemetry.io/collector/component v0.110.0 + go.opentelemetry.io/collector/consumer/consumertest v0.110.0 + go.opentelemetry.io/collector/exporter v0.110.0 ) require ( @@ -16,11 +16,13 @@ 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.109.0 // indirect - go.opentelemetry.io/collector/consumer v0.109.0 // indirect - go.opentelemetry.io/collector/consumer/consumerprofiles v0.109.0 // indirect - go.opentelemetry.io/collector/pdata v1.15.0 // indirect - go.opentelemetry.io/collector/pdata/pprofile v0.109.0 // indirect + go.opentelemetry.io/collector/config/configtelemetry v0.110.0 // indirect + go.opentelemetry.io/collector/consumer v0.110.0 // indirect + go.opentelemetry.io/collector/consumer/consumerprofiles v0.110.0 // indirect + go.opentelemetry.io/collector/internal/globalsignal v0.110.0 // indirect + go.opentelemetry.io/collector/pdata v1.16.0 // indirect + go.opentelemetry.io/collector/pdata/pprofile v0.110.0 // indirect + go.opentelemetry.io/collector/pipeline v0.110.0 // indirect go.opentelemetry.io/otel v1.30.0 // indirect go.opentelemetry.io/otel/metric v1.30.0 // indirect go.opentelemetry.io/otel/trace v1.30.0 // indirect @@ -30,7 +32,7 @@ require ( golang.org/x/sys v0.25.0 // indirect golang.org/x/text v0.17.0 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240822170219-fc7c04adadcd // indirect - google.golang.org/grpc v1.66.2 // indirect + google.golang.org/grpc v1.67.0 // indirect google.golang.org/protobuf v1.34.2 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) @@ -62,3 +64,9 @@ replace go.opentelemetry.io/collector/consumer => ../../consumer replace go.opentelemetry.io/collector/exporter => ../ replace go.opentelemetry.io/collector/receiver/receiverprofiles => ../../receiver/receiverprofiles + +replace go.opentelemetry.io/collector/pipeline => ../../pipeline + +replace go.opentelemetry.io/collector/internal/globalsignal => ../../internal/globalsignal + +replace go.opentelemetry.io/collector/component/componentprofiles => ../../component/componentprofiles diff --git a/exporter/exporterprofiles/go.sum b/exporter/exporterprofiles/go.sum index 233d0fd2ec2..5065b82d011 100644 --- a/exporter/exporterprofiles/go.sum +++ b/exporter/exporterprofiles/go.sum @@ -78,8 +78,8 @@ golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8T golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/genproto/googleapis/rpc v0.0.0-20240822170219-fc7c04adadcd h1:6TEm2ZxXoQmFWFlt1vNxvVOa1Q0dXFQD1m/rYjXmS0E= google.golang.org/genproto/googleapis/rpc v0.0.0-20240822170219-fc7c04adadcd/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU= -google.golang.org/grpc v1.66.2 h1:3QdXkuq3Bkh7w+ywLdLvM56cmGvQHUMZpiCzt6Rqaoo= -google.golang.org/grpc v1.66.2/go.mod h1:s3/l6xSSCURdVfAnL+TqCNMyTDAGN6+lZeVxnZR128Y= +google.golang.org/grpc v1.67.0 h1:IdH9y6PF5MPSdAntIcpjQ+tXO41pcQsfZV2RxtQgVcw= +google.golang.org/grpc v1.67.0/go.mod h1:1gLDyUQU7CTLJI90u3nXZ9ekeghjeM7pTDZlqFNg2AA= google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/exporter/exporterqueue/queue.go b/exporter/exporterqueue/queue.go index f47196ba124..58e0b1eab74 100644 --- a/exporter/exporterqueue/queue.go +++ b/exporter/exporterqueue/queue.go @@ -9,6 +9,8 @@ import ( "go.opentelemetry.io/collector/component" "go.opentelemetry.io/collector/exporter" "go.opentelemetry.io/collector/exporter/internal/queue" + "go.opentelemetry.io/collector/internal/globalsignal" + "go.opentelemetry.io/collector/pipeline" ) // ErrQueueIsFull is the error that Queue returns when full. @@ -24,7 +26,11 @@ type Queue[T any] queue.Queue[T] // Settings defines settings for creating a queue. type Settings struct { - DataType component.DataType + + // Deprecated: [v0.110.0] Use Signal instead + DataType component.DataType // nolint + + Signal pipeline.Signal ExporterSettings exporter.Settings } @@ -74,10 +80,14 @@ func NewPersistentQueueFactory[T itemsCounter](storageID *component.ID, factoryS return NewMemoryQueueFactory[T]() } return func(_ context.Context, set Settings, cfg Config) Queue[T] { + signal := set.Signal + if set.DataType.String() != "" { + signal = globalsignal.MustNewSignal(set.DataType.String()) + } return queue.NewPersistentQueue[T](queue.PersistentQueueSettings[T]{ Sizer: sizerFromConfig[T](cfg), Capacity: capacityFromConfig(cfg), - DataType: set.DataType, + Signal: signal, StorageID: *storageID, Marshaler: factorySettings.Marshaler, Unmarshaler: factorySettings.Unmarshaler, diff --git a/exporter/exportertest/contract_checker.go b/exporter/exportertest/contract_checker.go index 58c74b55118..52c85c33a0f 100644 --- a/exporter/exportertest/contract_checker.go +++ b/exporter/exportertest/contract_checker.go @@ -19,6 +19,7 @@ import ( "go.opentelemetry.io/collector/pdata/plog" "go.opentelemetry.io/collector/pdata/pmetric" "go.opentelemetry.io/collector/pdata/ptrace" + "go.opentelemetry.io/collector/pipeline" "go.opentelemetry.io/collector/receiver" "go.opentelemetry.io/collector/receiver/receivertest" ) @@ -33,7 +34,12 @@ type CheckConsumeContractParams struct { T *testing.T NumberOfTestElements int // DataType to test for. + // + // Deprecated: [v0.110.0] Use Signal instead + // nolint DataType component.DataType + + Signal pipeline.Signal // ExporterFactory to create an exporter to be tested. ExporterFactory exporter.Factory ExporterConfig component.Config @@ -84,18 +90,18 @@ func CheckConsumeContract(params CheckConsumeContractParams) { func checkConsumeContractScenario(t *testing.T, params CheckConsumeContractParams, decisionFunc func() error, checkIfTestPassed func(*testing.T, int, requestCounter)) { mockConsumerInstance := newMockConsumer(decisionFunc) - switch params.DataType { - case component.DataTypeLogs: + switch params.Signal { + case pipeline.SignalLogs: r, err := params.ReceiverFactory.CreateLogsReceiver(context.Background(), receivertest.NewNopSettings(), params.ReceiverConfig, &mockConsumerInstance) require.NoError(t, err) require.NoError(t, r.Start(context.Background(), componenttest.NewNopHost())) checkLogs(t, params, r, &mockConsumerInstance, checkIfTestPassed) - case component.DataTypeTraces: + case pipeline.SignalTraces: r, err := params.ReceiverFactory.CreateTracesReceiver(context.Background(), receivertest.NewNopSettings(), params.ReceiverConfig, &mockConsumerInstance) require.NoError(t, err) require.NoError(t, r.Start(context.Background(), componenttest.NewNopHost())) checkTraces(t, params, r, &mockConsumerInstance, checkIfTestPassed) - case component.DataTypeMetrics: + case pipeline.SignalMetrics: r, err := params.ReceiverFactory.CreateMetricsReceiver(context.Background(), receivertest.NewNopSettings(), params.ReceiverConfig, &mockConsumerInstance) require.NoError(t, err) require.NoError(t, r.Start(context.Background(), componenttest.NewNopHost())) diff --git a/exporter/exportertest/contract_checker_test.go b/exporter/exportertest/contract_checker_test.go index 652f6bc5ac9..1d2ffb73314 100644 --- a/exporter/exportertest/contract_checker_test.go +++ b/exporter/exportertest/contract_checker_test.go @@ -13,6 +13,7 @@ import ( "go.opentelemetry.io/collector/consumer" "go.opentelemetry.io/collector/exporter" "go.opentelemetry.io/collector/exporter/exporterhelper" + "go.opentelemetry.io/collector/pipeline" "go.opentelemetry.io/collector/receiver" ) @@ -109,7 +110,7 @@ func TestCheckConsumeContractLogs(t *testing.T) { params := CheckConsumeContractParams{ T: t, ExporterFactory: newMockExporterFactory(mr), - DataType: component.DataTypeLogs, + Signal: pipeline.SignalLogs, ExporterConfig: nopConfig{}, NumberOfTestElements: 10, ReceiverFactory: newMockReceiverFactory(mr), @@ -123,7 +124,7 @@ func TestCheckConsumeContractMetrics(t *testing.T) { CheckConsumeContract(CheckConsumeContractParams{ T: t, ExporterFactory: newMockExporterFactory(mr), - DataType: component.DataTypeMetrics, // Change to the appropriate data type + Signal: pipeline.SignalMetrics, // Change to the appropriate data type ExporterConfig: nopConfig{}, NumberOfTestElements: 10, ReceiverFactory: newMockReceiverFactory(mr), @@ -135,7 +136,7 @@ func TestCheckConsumeContractTraces(t *testing.T) { CheckConsumeContract(CheckConsumeContractParams{ T: t, ExporterFactory: newMockExporterFactory(mr), - DataType: component.DataTypeTraces, + Signal: pipeline.SignalTraces, ExporterConfig: nopConfig{}, NumberOfTestElements: 10, ReceiverFactory: newMockReceiverFactory(mr), diff --git a/exporter/go.mod b/exporter/go.mod index b8e888b4c4c..c0dba644b89 100644 --- a/exporter/go.mod +++ b/exporter/go.mod @@ -6,19 +6,21 @@ 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/component v0.109.0 - go.opentelemetry.io/collector/config/configretry v1.15.0 - go.opentelemetry.io/collector/config/configtelemetry v0.109.0 - go.opentelemetry.io/collector/consumer v0.109.0 - go.opentelemetry.io/collector/consumer/consumerprofiles v0.109.0 - go.opentelemetry.io/collector/consumer/consumertest v0.109.0 - go.opentelemetry.io/collector/exporter/exporterprofiles v0.109.0 - go.opentelemetry.io/collector/extension v0.109.0 - go.opentelemetry.io/collector/extension/experimental/storage v0.109.0 - go.opentelemetry.io/collector/pdata v1.15.0 - go.opentelemetry.io/collector/pdata/pprofile v0.109.0 - go.opentelemetry.io/collector/pdata/testdata v0.109.0 - go.opentelemetry.io/collector/receiver v0.109.0 + go.opentelemetry.io/collector/component v0.110.0 + go.opentelemetry.io/collector/config/configretry v1.16.0 + go.opentelemetry.io/collector/config/configtelemetry v0.110.0 + go.opentelemetry.io/collector/consumer v0.110.0 + go.opentelemetry.io/collector/consumer/consumerprofiles v0.110.0 + go.opentelemetry.io/collector/consumer/consumertest v0.110.0 + go.opentelemetry.io/collector/exporter/exporterprofiles v0.110.0 + go.opentelemetry.io/collector/extension v0.110.0 + go.opentelemetry.io/collector/extension/experimental/storage v0.110.0 + go.opentelemetry.io/collector/internal/globalsignal v0.110.0 + go.opentelemetry.io/collector/pdata v1.16.0 + go.opentelemetry.io/collector/pdata/pprofile v0.110.0 + go.opentelemetry.io/collector/pdata/testdata v0.110.0 + go.opentelemetry.io/collector/pipeline v0.110.0 + go.opentelemetry.io/collector/receiver v0.110.0 go.opentelemetry.io/otel v1.30.0 go.opentelemetry.io/otel/metric v1.30.0 go.opentelemetry.io/otel/sdk v1.30.0 @@ -28,7 +30,7 @@ require ( go.uber.org/multierr v1.11.0 go.uber.org/zap v1.27.0 golang.org/x/sys v0.25.0 - google.golang.org/grpc v1.66.2 + google.golang.org/grpc v1.67.0 ) require ( @@ -40,7 +42,8 @@ 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/receiver/receiverprofiles v0.109.0 // indirect + go.opentelemetry.io/collector/component/componentprofiles v0.110.0 // indirect + go.opentelemetry.io/collector/receiver/receiverprofiles v0.110.0 // indirect golang.org/x/net v0.28.0 // indirect golang.org/x/text v0.17.0 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240822170219-fc7c04adadcd // indirect @@ -62,6 +65,8 @@ replace go.opentelemetry.io/collector/pdata/testdata => ../pdata/testdata replace go.opentelemetry.io/collector/pdata/pprofile => ../pdata/pprofile +replace go.opentelemetry.io/collector/pipeline => ../pipeline + replace go.opentelemetry.io/collector/receiver => ../receiver retract v0.76.0 // Depends on retracted pdata v1.0.0-rc10 module @@ -77,3 +82,7 @@ replace go.opentelemetry.io/collector/consumer/consumertest => ../consumer/consu replace go.opentelemetry.io/collector/receiver/receiverprofiles => ../receiver/receiverprofiles replace go.opentelemetry.io/collector/exporter/exporterprofiles => ./exporterprofiles + +replace go.opentelemetry.io/collector/internal/globalsignal => ../internal/globalsignal + +replace go.opentelemetry.io/collector/component/componentprofiles => ../component/componentprofiles diff --git a/exporter/go.sum b/exporter/go.sum index 06005d39a38..fd1c3940614 100644 --- a/exporter/go.sum +++ b/exporter/go.sum @@ -87,8 +87,8 @@ golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8T golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/genproto/googleapis/rpc v0.0.0-20240822170219-fc7c04adadcd h1:6TEm2ZxXoQmFWFlt1vNxvVOa1Q0dXFQD1m/rYjXmS0E= google.golang.org/genproto/googleapis/rpc v0.0.0-20240822170219-fc7c04adadcd/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU= -google.golang.org/grpc v1.66.2 h1:3QdXkuq3Bkh7w+ywLdLvM56cmGvQHUMZpiCzt6Rqaoo= -google.golang.org/grpc v1.66.2/go.mod h1:s3/l6xSSCURdVfAnL+TqCNMyTDAGN6+lZeVxnZR128Y= +google.golang.org/grpc v1.67.0 h1:IdH9y6PF5MPSdAntIcpjQ+tXO41pcQsfZV2RxtQgVcw= +google.golang.org/grpc v1.67.0/go.mod h1:1gLDyUQU7CTLJI90u3nXZ9ekeghjeM7pTDZlqFNg2AA= google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/exporter/internal/factory.go b/exporter/internal/factory.go index 65bbe36b62f..b30f2ebdddf 100644 --- a/exporter/internal/factory.go +++ b/exporter/internal/factory.go @@ -7,6 +7,7 @@ import ( "context" "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/pipeline" ) // Factory is a factory interface for exporters. @@ -17,7 +18,7 @@ type Factory interface { // CreateTracesExporter creates a TracesExporter based on this config. // If the exporter type does not support tracing, - // this function returns the error [component.ErrDataTypeIsNotSupported]. + // this function returns the error [pipeline.ErrSignalNotSupported]. CreateTracesExporter(ctx context.Context, set Settings, cfg component.Config) (Traces, error) // TracesExporterStability gets the stability level of the TracesExporter. @@ -25,7 +26,7 @@ type Factory interface { // CreateMetricsExporter creates a MetricsExporter based on this config. // If the exporter type does not support metrics, - // this function returns the error [component.ErrDataTypeIsNotSupported]. + // this function returns the error [pipeline.ErrSignalNotSupported]. CreateMetricsExporter(ctx context.Context, set Settings, cfg component.Config) (Metrics, error) // MetricsExporterStability gets the stability level of the MetricsExporter. @@ -33,7 +34,7 @@ type Factory interface { // CreateLogsExporter creates a LogsExporter based on the config. // If the exporter type does not support logs, - // this function returns the error [component.ErrDataTypeIsNotSupported]. + // this function returns the error [pipeline.ErrSignalNotSupported]. CreateLogsExporter(ctx context.Context, set Settings, cfg component.Config) (Logs, error) // LogsExporterStability gets the stability level of the LogsExporter. @@ -41,7 +42,7 @@ type Factory interface { // CreateProfilesExporter creates a ProfilesExporter based on this config. // If the exporter type does not support tracing, - // this function returns the error [component.ErrDataTypeIsNotSupported]. + // this function returns the error [pipeline.ErrSignalNotSupported]. CreateProfilesExporter(ctx context.Context, set Settings, cfg component.Config) (Profiles, error) // ProfilesExporterStability gets the stability level of the ProfilesExporter. @@ -71,7 +72,7 @@ type CreateTracesFunc func(context.Context, Settings, component.Config) (Traces, // CreateTracesExporter implements ExporterFactory.CreateTracesExporter(). func (f CreateTracesFunc) CreateTracesExporter(ctx context.Context, set Settings, cfg component.Config) (Traces, error) { if f == nil { - return nil, component.ErrDataTypeIsNotSupported + return nil, pipeline.ErrSignalNotSupported } return f(ctx, set, cfg) } @@ -82,7 +83,7 @@ type CreateMetricsFunc func(context.Context, Settings, component.Config) (Metric // CreateMetricsExporter implements ExporterFactory.CreateMetricsExporter(). func (f CreateMetricsFunc) CreateMetricsExporter(ctx context.Context, set Settings, cfg component.Config) (Metrics, error) { if f == nil { - return nil, component.ErrDataTypeIsNotSupported + return nil, pipeline.ErrSignalNotSupported } return f(ctx, set, cfg) } @@ -93,7 +94,7 @@ type CreateLogsFunc func(context.Context, Settings, component.Config) (Logs, err // CreateLogsExporter implements Factory.CreateLogsExporter(). func (f CreateLogsFunc) CreateLogsExporter(ctx context.Context, set Settings, cfg component.Config) (Logs, error) { if f == nil { - return nil, component.ErrDataTypeIsNotSupported + return nil, pipeline.ErrSignalNotSupported } return f(ctx, set, cfg) } @@ -104,7 +105,7 @@ type CreateProfilesFunc func(context.Context, Settings, component.Config) (Profi // CreateProfilesExporter implements ExporterFactory.CreateProfilesExporter(). func (f CreateProfilesFunc) CreateProfilesExporter(ctx context.Context, set Settings, cfg component.Config) (Profiles, error) { if f == nil { - return nil, component.ErrDataTypeIsNotSupported + return nil, pipeline.ErrSignalNotSupported } return f(ctx, set, cfg) } diff --git a/exporter/internal/queue/persistent_queue.go b/exporter/internal/queue/persistent_queue.go index 7dd646c6ef3..71fb910c78f 100644 --- a/exporter/internal/queue/persistent_queue.go +++ b/exporter/internal/queue/persistent_queue.go @@ -18,6 +18,7 @@ import ( "go.opentelemetry.io/collector/exporter" "go.opentelemetry.io/collector/exporter/internal/experr" "go.opentelemetry.io/collector/extension/experimental/storage" + "go.opentelemetry.io/collector/pipeline" ) // persistentQueue provides a persistent queue implementation backed by file storage extension @@ -85,7 +86,7 @@ var ( type PersistentQueueSettings[T any] struct { Sizer Sizer[T] Capacity int64 - DataType component.DataType + Signal pipeline.Signal StorageID component.ID Marshaler func(req T) ([]byte, error) Unmarshaler func([]byte) (T, error) @@ -104,7 +105,7 @@ func NewPersistentQueue[T any](set PersistentQueueSettings[T]) Queue[T] { // Start starts the persistentQueue with the given number of consumers. func (pq *persistentQueue[T]) Start(ctx context.Context, host component.Host) error { - storageClient, err := toStorageClient(ctx, pq.set.StorageID, host, pq.set.ExporterSettings.ID, pq.set.DataType) + storageClient, err := toStorageClient(ctx, pq.set.StorageID, host, pq.set.ExporterSettings.ID, pq.set.Signal) if err != nil { return err } @@ -485,7 +486,7 @@ func (pq *persistentQueue[T]) itemDispatchingFinish(ctx context.Context, index u return nil } -func toStorageClient(ctx context.Context, storageID component.ID, host component.Host, ownerID component.ID, signal component.DataType) (storage.Client, error) { +func toStorageClient(ctx context.Context, storageID component.ID, host component.Host, ownerID component.ID, signal pipeline.Signal) (storage.Client, error) { ext, found := host.GetExtensions()[storageID] if !found { return nil, errNoStorageClient diff --git a/exporter/internal/queue/persistent_queue_test.go b/exporter/internal/queue/persistent_queue_test.go index 8c825e0d5cb..88c65de666a 100644 --- a/exporter/internal/queue/persistent_queue_test.go +++ b/exporter/internal/queue/persistent_queue_test.go @@ -24,6 +24,7 @@ import ( "go.opentelemetry.io/collector/extension/extensiontest" "go.opentelemetry.io/collector/pdata/pcommon" "go.opentelemetry.io/collector/pdata/ptrace" + "go.opentelemetry.io/collector/pipeline" ) type tracesRequest struct { @@ -60,7 +61,7 @@ func createAndStartTestPersistentQueue(t *testing.T, sizer Sizer[tracesRequest], pq := NewPersistentQueue[tracesRequest](PersistentQueueSettings[tracesRequest]{ Sizer: sizer, Capacity: capacity, - DataType: component.DataTypeTraces, + Signal: pipeline.SignalTraces, StorageID: component.ID{}, Marshaler: marshalTracesRequest, Unmarshaler: unmarshalTracesRequest, @@ -81,7 +82,7 @@ func createTestPersistentQueueWithClient(client storage.Client) *persistentQueue pq := NewPersistentQueue[tracesRequest](PersistentQueueSettings[tracesRequest]{ Sizer: &RequestSizer[tracesRequest]{}, Capacity: 1000, - DataType: component.DataTypeTraces, + Signal: pipeline.SignalTraces, StorageID: component.ID{}, Marshaler: marshalTracesRequest, Unmarshaler: unmarshalTracesRequest, @@ -104,7 +105,7 @@ func createTestPersistentQueueWithCapacityLimiter(t testing.TB, ext storage.Exte pq := NewPersistentQueue[tracesRequest](PersistentQueueSettings[tracesRequest]{ Sizer: sizer, Capacity: capacity, - DataType: component.DataTypeTraces, + Signal: pipeline.SignalTraces, StorageID: component.ID{}, Marshaler: marshalTracesRequest, Unmarshaler: unmarshalTracesRequest, @@ -305,7 +306,7 @@ func TestToStorageClient(t *testing.T) { ownerID := component.MustNewID("foo_exporter") // execute - client, err := toStorageClient(context.Background(), storageID, host, ownerID, component.DataTypeTraces) + client, err := toStorageClient(context.Background(), storageID, host, ownerID, pipeline.SignalTraces) // verify if tt.expectedError != nil { @@ -335,7 +336,7 @@ func TestInvalidStorageExtensionType(t *testing.T) { ownerID := component.MustNewID("foo_exporter") // execute - client, err := toStorageClient(context.Background(), storageID, host, ownerID, component.DataTypeTraces) + client, err := toStorageClient(context.Background(), storageID, host, ownerID, pipeline.SignalTraces) // we should get an error about the extension type require.ErrorIs(t, err, errWrongExtensionType) diff --git a/exporter/loggingexporter/go.mod b/exporter/loggingexporter/go.mod index a0cf6641972..fdb97d7d3eb 100644 --- a/exporter/loggingexporter/go.mod +++ b/exporter/loggingexporter/go.mod @@ -5,11 +5,11 @@ go 1.22.0 require ( github.com/stretchr/testify v1.9.0 - go.opentelemetry.io/collector/component v0.109.0 - go.opentelemetry.io/collector/config/configtelemetry v0.109.0 - go.opentelemetry.io/collector/confmap v1.15.0 - go.opentelemetry.io/collector/exporter v0.109.0 - go.opentelemetry.io/collector/pdata v1.15.0 + go.opentelemetry.io/collector/component v0.110.0 + go.opentelemetry.io/collector/config/configtelemetry v0.110.0 + go.opentelemetry.io/collector/confmap v1.16.0 + go.opentelemetry.io/collector/exporter v0.110.0 + go.opentelemetry.io/collector/pdata v1.16.0 go.uber.org/goleak v1.3.0 go.uber.org/zap v1.27.0 ) @@ -31,16 +31,19 @@ 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/configretry v1.15.0 // indirect - go.opentelemetry.io/collector/consumer v0.109.0 // indirect - go.opentelemetry.io/collector/consumer/consumerprofiles v0.109.0 // indirect - go.opentelemetry.io/collector/consumer/consumertest v0.109.0 // indirect - go.opentelemetry.io/collector/exporter/exporterprofiles v0.109.0 // indirect - go.opentelemetry.io/collector/extension v0.109.0 // indirect - go.opentelemetry.io/collector/extension/experimental/storage v0.109.0 // indirect - go.opentelemetry.io/collector/pdata/pprofile v0.109.0 // indirect - go.opentelemetry.io/collector/receiver v0.109.0 // indirect - go.opentelemetry.io/collector/receiver/receiverprofiles v0.109.0 // indirect + go.opentelemetry.io/collector/component/componentprofiles v0.110.0 // indirect + go.opentelemetry.io/collector/config/configretry v1.16.0 // indirect + go.opentelemetry.io/collector/consumer v0.110.0 // indirect + go.opentelemetry.io/collector/consumer/consumerprofiles v0.110.0 // indirect + go.opentelemetry.io/collector/consumer/consumertest v0.110.0 // indirect + go.opentelemetry.io/collector/exporter/exporterprofiles v0.110.0 // indirect + go.opentelemetry.io/collector/extension v0.110.0 // indirect + go.opentelemetry.io/collector/extension/experimental/storage v0.110.0 // indirect + go.opentelemetry.io/collector/internal/globalsignal v0.110.0 // indirect + go.opentelemetry.io/collector/pdata/pprofile v0.110.0 // indirect + go.opentelemetry.io/collector/pipeline v0.110.0 // indirect + go.opentelemetry.io/collector/receiver v0.110.0 // indirect + go.opentelemetry.io/collector/receiver/receiverprofiles v0.110.0 // indirect go.opentelemetry.io/otel v1.30.0 // indirect go.opentelemetry.io/otel/metric v1.30.0 // indirect go.opentelemetry.io/otel/sdk v1.30.0 // indirect @@ -51,7 +54,7 @@ require ( golang.org/x/sys v0.25.0 // indirect golang.org/x/text v0.17.0 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240822170219-fc7c04adadcd // indirect - google.golang.org/grpc v1.66.2 // indirect + google.golang.org/grpc v1.67.0 // indirect google.golang.org/protobuf v1.34.2 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) @@ -92,3 +95,9 @@ replace go.opentelemetry.io/collector/consumer/consumertest => ../../consumer/co replace go.opentelemetry.io/collector/receiver/receiverprofiles => ../../receiver/receiverprofiles replace go.opentelemetry.io/collector/exporter/exporterprofiles => ../exporterprofiles + +replace go.opentelemetry.io/collector/pipeline => ../../pipeline + +replace go.opentelemetry.io/collector/internal/globalsignal => ../../internal/globalsignal + +replace go.opentelemetry.io/collector/component/componentprofiles => ../../component/componentprofiles diff --git a/exporter/loggingexporter/go.sum b/exporter/loggingexporter/go.sum index 3229c18e498..5df87556447 100644 --- a/exporter/loggingexporter/go.sum +++ b/exporter/loggingexporter/go.sum @@ -99,8 +99,8 @@ golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8T golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/genproto/googleapis/rpc v0.0.0-20240822170219-fc7c04adadcd h1:6TEm2ZxXoQmFWFlt1vNxvVOa1Q0dXFQD1m/rYjXmS0E= google.golang.org/genproto/googleapis/rpc v0.0.0-20240822170219-fc7c04adadcd/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU= -google.golang.org/grpc v1.66.2 h1:3QdXkuq3Bkh7w+ywLdLvM56cmGvQHUMZpiCzt6Rqaoo= -google.golang.org/grpc v1.66.2/go.mod h1:s3/l6xSSCURdVfAnL+TqCNMyTDAGN6+lZeVxnZR128Y= +google.golang.org/grpc v1.67.0 h1:IdH9y6PF5MPSdAntIcpjQ+tXO41pcQsfZV2RxtQgVcw= +google.golang.org/grpc v1.67.0/go.mod h1:1gLDyUQU7CTLJI90u3nXZ9ekeghjeM7pTDZlqFNg2AA= google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/exporter/nopexporter/go.mod b/exporter/nopexporter/go.mod index a25b1a44c71..590b8ab7a06 100644 --- a/exporter/nopexporter/go.mod +++ b/exporter/nopexporter/go.mod @@ -4,11 +4,11 @@ go 1.22.0 require ( github.com/stretchr/testify v1.9.0 - go.opentelemetry.io/collector/component v0.109.0 - go.opentelemetry.io/collector/confmap v1.15.0 - go.opentelemetry.io/collector/consumer/consumertest v0.109.0 - go.opentelemetry.io/collector/exporter v0.109.0 - go.opentelemetry.io/collector/pdata v1.15.0 + go.opentelemetry.io/collector/component v0.110.0 + go.opentelemetry.io/collector/confmap v1.16.0 + go.opentelemetry.io/collector/consumer/consumertest v0.110.0 + go.opentelemetry.io/collector/exporter v0.110.0 + go.opentelemetry.io/collector/pdata v1.16.0 go.uber.org/goleak v1.3.0 ) @@ -28,13 +28,16 @@ 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.109.0 // indirect - go.opentelemetry.io/collector/consumer v0.109.0 // indirect - go.opentelemetry.io/collector/consumer/consumerprofiles v0.109.0 // indirect - go.opentelemetry.io/collector/exporter/exporterprofiles v0.109.0 // indirect - go.opentelemetry.io/collector/pdata/pprofile v0.109.0 // indirect - go.opentelemetry.io/collector/receiver v0.109.0 // indirect - go.opentelemetry.io/collector/receiver/receiverprofiles v0.109.0 // indirect + go.opentelemetry.io/collector/component/componentprofiles v0.110.0 // indirect + go.opentelemetry.io/collector/config/configtelemetry v0.110.0 // indirect + go.opentelemetry.io/collector/consumer v0.110.0 // indirect + go.opentelemetry.io/collector/consumer/consumerprofiles v0.110.0 // indirect + go.opentelemetry.io/collector/exporter/exporterprofiles v0.110.0 // indirect + go.opentelemetry.io/collector/internal/globalsignal v0.110.0 // indirect + go.opentelemetry.io/collector/pdata/pprofile v0.110.0 // indirect + go.opentelemetry.io/collector/pipeline v0.110.0 // indirect + go.opentelemetry.io/collector/receiver v0.110.0 // indirect + go.opentelemetry.io/collector/receiver/receiverprofiles v0.110.0 // indirect go.opentelemetry.io/otel v1.30.0 // indirect go.opentelemetry.io/otel/metric v1.30.0 // indirect go.opentelemetry.io/otel/sdk v1.30.0 // indirect @@ -46,7 +49,7 @@ require ( golang.org/x/sys v0.25.0 // indirect golang.org/x/text v0.17.0 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240822170219-fc7c04adadcd // indirect - google.golang.org/grpc v1.66.2 // indirect + google.golang.org/grpc v1.67.0 // indirect google.golang.org/protobuf v1.34.2 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) @@ -82,3 +85,9 @@ replace go.opentelemetry.io/collector/consumer/consumertest => ../../consumer/co replace go.opentelemetry.io/collector/receiver/receiverprofiles => ../../receiver/receiverprofiles replace go.opentelemetry.io/collector/exporter/exporterprofiles => ../exporterprofiles + +replace go.opentelemetry.io/collector/pipeline => ../../pipeline + +replace go.opentelemetry.io/collector/internal/globalsignal => ../../internal/globalsignal + +replace go.opentelemetry.io/collector/component/componentprofiles => ../../component/componentprofiles diff --git a/exporter/nopexporter/go.sum b/exporter/nopexporter/go.sum index 3229c18e498..5df87556447 100644 --- a/exporter/nopexporter/go.sum +++ b/exporter/nopexporter/go.sum @@ -99,8 +99,8 @@ golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8T golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/genproto/googleapis/rpc v0.0.0-20240822170219-fc7c04adadcd h1:6TEm2ZxXoQmFWFlt1vNxvVOa1Q0dXFQD1m/rYjXmS0E= google.golang.org/genproto/googleapis/rpc v0.0.0-20240822170219-fc7c04adadcd/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU= -google.golang.org/grpc v1.66.2 h1:3QdXkuq3Bkh7w+ywLdLvM56cmGvQHUMZpiCzt6Rqaoo= -google.golang.org/grpc v1.66.2/go.mod h1:s3/l6xSSCURdVfAnL+TqCNMyTDAGN6+lZeVxnZR128Y= +google.golang.org/grpc v1.67.0 h1:IdH9y6PF5MPSdAntIcpjQ+tXO41pcQsfZV2RxtQgVcw= +google.golang.org/grpc v1.67.0/go.mod h1:1gLDyUQU7CTLJI90u3nXZ9ekeghjeM7pTDZlqFNg2AA= google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/exporter/otlpexporter/go.mod b/exporter/otlpexporter/go.mod index 2eea2738b61..449f37f45bb 100644 --- a/exporter/otlpexporter/go.mod +++ b/exporter/otlpexporter/go.mod @@ -4,23 +4,23 @@ go 1.22.0 require ( github.com/stretchr/testify v1.9.0 - go.opentelemetry.io/collector v0.109.0 - go.opentelemetry.io/collector/component v0.109.0 - go.opentelemetry.io/collector/config/configauth v0.109.0 - go.opentelemetry.io/collector/config/configcompression v1.15.0 - go.opentelemetry.io/collector/config/configgrpc v0.109.0 - go.opentelemetry.io/collector/config/configopaque v1.15.0 - go.opentelemetry.io/collector/config/configretry v1.15.0 - go.opentelemetry.io/collector/config/configtls v1.15.0 - go.opentelemetry.io/collector/confmap v1.15.0 - go.opentelemetry.io/collector/consumer v0.109.0 - go.opentelemetry.io/collector/exporter v0.109.0 - go.opentelemetry.io/collector/pdata v1.15.0 - go.opentelemetry.io/collector/pdata/testdata v0.109.0 + go.opentelemetry.io/collector v0.110.0 + go.opentelemetry.io/collector/component v0.110.0 + go.opentelemetry.io/collector/config/configauth v0.110.0 + go.opentelemetry.io/collector/config/configcompression v1.16.0 + go.opentelemetry.io/collector/config/configgrpc v0.110.0 + go.opentelemetry.io/collector/config/configopaque v1.16.0 + go.opentelemetry.io/collector/config/configretry v1.16.0 + go.opentelemetry.io/collector/config/configtls v1.16.0 + go.opentelemetry.io/collector/confmap v1.16.0 + go.opentelemetry.io/collector/consumer v0.110.0 + go.opentelemetry.io/collector/exporter v0.110.0 + go.opentelemetry.io/collector/pdata v1.16.0 + go.opentelemetry.io/collector/pdata/testdata v0.110.0 go.uber.org/goleak v1.3.0 go.uber.org/zap v1.27.0 google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1 - google.golang.org/grpc v1.66.2 + google.golang.org/grpc v1.67.0 google.golang.org/protobuf v1.34.2 ) @@ -34,7 +34,6 @@ require ( 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.9 // indirect github.com/knadh/koanf/maps v0.1.1 // indirect @@ -46,21 +45,22 @@ require ( github.com/modern-go/reflect2 v1.0.2 // indirect github.com/mostynb/go-grpc-compression v1.2.3 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/collector/client v1.15.0 // indirect - go.opentelemetry.io/collector/config/confignet v0.109.0 // indirect - go.opentelemetry.io/collector/config/configtelemetry v0.109.0 // indirect - go.opentelemetry.io/collector/config/internal v0.109.1-0.20240916143658-74729e731d3b // indirect - go.opentelemetry.io/collector/consumer/consumerprofiles v0.109.0 // indirect - go.opentelemetry.io/collector/consumer/consumertest v0.109.0 // indirect - go.opentelemetry.io/collector/exporter/exporterprofiles v0.109.0 // indirect - go.opentelemetry.io/collector/extension v0.109.0 // indirect - go.opentelemetry.io/collector/extension/auth v0.109.0 // indirect - go.opentelemetry.io/collector/extension/experimental/storage v0.109.0 // indirect - go.opentelemetry.io/collector/featuregate v1.15.0 // indirect - go.opentelemetry.io/collector/internal/globalgates v0.109.0 // indirect - go.opentelemetry.io/collector/pdata/pprofile v0.109.0 // indirect - go.opentelemetry.io/collector/receiver v0.109.0 // indirect - go.opentelemetry.io/collector/receiver/receiverprofiles v0.109.0 // indirect + go.opentelemetry.io/collector/client v1.16.0 // indirect + go.opentelemetry.io/collector/component/componentprofiles v0.110.0 // indirect + go.opentelemetry.io/collector/config/confignet v1.16.0 // indirect + go.opentelemetry.io/collector/config/configtelemetry v0.110.0 // indirect + go.opentelemetry.io/collector/config/internal v0.110.0 // indirect + go.opentelemetry.io/collector/consumer/consumerprofiles v0.110.0 // indirect + go.opentelemetry.io/collector/consumer/consumertest v0.110.0 // indirect + go.opentelemetry.io/collector/exporter/exporterprofiles v0.110.0 // indirect + go.opentelemetry.io/collector/extension v0.110.0 // indirect + go.opentelemetry.io/collector/extension/auth v0.110.0 // indirect + go.opentelemetry.io/collector/extension/experimental/storage v0.110.0 // indirect + go.opentelemetry.io/collector/internal/globalsignal v0.110.0 // indirect + go.opentelemetry.io/collector/pdata/pprofile v0.110.0 // indirect + go.opentelemetry.io/collector/pipeline v0.110.0 // indirect + go.opentelemetry.io/collector/receiver v0.110.0 // indirect + go.opentelemetry.io/collector/receiver/receiverprofiles v0.110.0 // indirect go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.55.0 // indirect go.opentelemetry.io/otel v1.30.0 // indirect go.opentelemetry.io/otel/metric v1.30.0 // indirect @@ -74,8 +74,6 @@ require ( gopkg.in/yaml.v3 v3.0.1 // indirect ) -replace go.opentelemetry.io/collector => ../../ - replace go.opentelemetry.io/collector/component => ../../component replace go.opentelemetry.io/collector/config/configcompression => ../../config/configcompression @@ -102,8 +100,6 @@ replace go.opentelemetry.io/collector/extension/auth => ../../extension/auth replace go.opentelemetry.io/collector/extension/experimental/storage => ../../extension/experimental/storage -replace go.opentelemetry.io/collector/featuregate => ../../featuregate - replace go.opentelemetry.io/collector/pdata => ../../pdata replace go.opentelemetry.io/collector/pdata/testdata => ../../pdata/testdata @@ -116,11 +112,6 @@ replace go.opentelemetry.io/collector/consumer => ../../consumer replace go.opentelemetry.io/collector/client => ../../client -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/config/configtelemetry => ../../config/configtelemetry replace go.opentelemetry.io/collector/config/configretry => ../../config/configretry @@ -129,10 +120,21 @@ replace go.opentelemetry.io/collector/consumer/consumerprofiles => ../../consume replace go.opentelemetry.io/collector/consumer/consumertest => ../../consumer/consumertest -replace go.opentelemetry.io/collector/component/componentstatus => ../../component/componentstatus - replace go.opentelemetry.io/collector/receiver/receiverprofiles => ../../receiver/receiverprofiles replace go.opentelemetry.io/collector/exporter/exporterprofiles => ../exporterprofiles -replace go.opentelemetry.io/collector/internal/globalgates => ../../internal/globalgates +replace go.opentelemetry.io/collector/pipeline => ../../pipeline + +replace go.opentelemetry.io/collector/internal/globalsignal => ../../internal/globalsignal + +replace go.opentelemetry.io/collector/component/componentprofiles => ../../component/componentprofiles + +replace go.opentelemetry.io/collector => ../.. + +replace go.opentelemetry.io/collector/component/componentstatus => ../../component/componentstatus + +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 +) diff --git a/exporter/otlpexporter/go.sum b/exporter/otlpexporter/go.sum index 54f9125b5cb..8386a0607eb 100644 --- a/exporter/otlpexporter/go.sum +++ b/exporter/otlpexporter/go.sum @@ -21,8 +21,6 @@ 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= @@ -111,8 +109,8 @@ golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8T golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1 h1:pPJltXNxVzT4pK9yD8vR9X75DaWYYmLGMsEvBfFQZzQ= google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU= -google.golang.org/grpc v1.66.2 h1:3QdXkuq3Bkh7w+ywLdLvM56cmGvQHUMZpiCzt6Rqaoo= -google.golang.org/grpc v1.66.2/go.mod h1:s3/l6xSSCURdVfAnL+TqCNMyTDAGN6+lZeVxnZR128Y= +google.golang.org/grpc v1.67.0 h1:IdH9y6PF5MPSdAntIcpjQ+tXO41pcQsfZV2RxtQgVcw= +google.golang.org/grpc v1.67.0/go.mod h1:1gLDyUQU7CTLJI90u3nXZ9ekeghjeM7pTDZlqFNg2AA= google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/exporter/otlpexporter/otlp.go b/exporter/otlpexporter/otlp.go index ecda0e93add..89e4930d00f 100644 --- a/exporter/otlpexporter/otlp.go +++ b/exporter/otlpexporter/otlp.go @@ -60,7 +60,7 @@ func newExporter(cfg component.Config, set exporter.Settings) *baseExporter { // is the only place we get hold of Extensions which are required to construct auth round tripper. func (e *baseExporter) start(ctx context.Context, host component.Host) (err error) { agentOpt := configgrpc.WithGrpcDialOption(grpc.WithUserAgent(e.userAgent)) - if e.clientConn, err = e.config.ClientConfig.ToClientConnWithOptions(ctx, host, e.settings, agentOpt); err != nil { + if e.clientConn, err = e.config.ClientConfig.ToClientConn(ctx, host, e.settings, agentOpt); err != nil { return err } e.traceExporter = ptraceotlp.NewGRPCClient(e.clientConn) diff --git a/exporter/otlphttpexporter/factory.go b/exporter/otlphttpexporter/factory.go index 8b7ec9dc807..1417f354a70 100644 --- a/exporter/otlphttpexporter/factory.go +++ b/exporter/otlphttpexporter/factory.go @@ -13,7 +13,6 @@ import ( "go.opentelemetry.io/collector/component" "go.opentelemetry.io/collector/config/configcompression" "go.opentelemetry.io/collector/config/confighttp" - "go.opentelemetry.io/collector/config/configopaque" "go.opentelemetry.io/collector/config/configretry" "go.opentelemetry.io/collector/consumer" "go.opentelemetry.io/collector/exporter" @@ -33,19 +32,22 @@ func NewFactory() exporter.Factory { } func createDefaultConfig() component.Config { + clientConfig := confighttp.NewDefaultClientConfig() + clientConfig.Timeout = 30 * time.Second + // Default to gzip compression + clientConfig.Compression = configcompression.TypeGzip + // We almost read 0 bytes, so no need to tune ReadBufferSize. + clientConfig.WriteBufferSize = 512 * 1024 + clientConfig.MaxIdleConns = nil + clientConfig.MaxIdleConnsPerHost = nil + clientConfig.MaxConnsPerHost = nil + clientConfig.IdleConnTimeout = nil + return &Config{ - RetryConfig: configretry.NewDefaultBackOffConfig(), - QueueConfig: exporterhelper.NewDefaultQueueConfig(), - Encoding: EncodingProto, - ClientConfig: confighttp.ClientConfig{ - Endpoint: "", - Timeout: 30 * time.Second, - Headers: map[string]configopaque.String{}, - // Default to gzip compression - Compression: configcompression.TypeGzip, - // We almost read 0 bytes, so no need to tune ReadBufferSize. - WriteBufferSize: 512 * 1024, - }, + RetryConfig: configretry.NewDefaultBackOffConfig(), + QueueConfig: exporterhelper.NewDefaultQueueConfig(), + Encoding: EncodingProto, + ClientConfig: clientConfig, } } diff --git a/exporter/otlphttpexporter/go.mod b/exporter/otlphttpexporter/go.mod index 52e7733bee7..49c6432e1b2 100644 --- a/exporter/otlphttpexporter/go.mod +++ b/exporter/otlphttpexporter/go.mod @@ -4,21 +4,21 @@ go 1.22.0 require ( github.com/stretchr/testify v1.9.0 - go.opentelemetry.io/collector v0.109.0 - go.opentelemetry.io/collector/component v0.109.0 - go.opentelemetry.io/collector/config/configcompression v1.15.0 - go.opentelemetry.io/collector/config/confighttp v0.109.0 - go.opentelemetry.io/collector/config/configopaque v1.15.0 - go.opentelemetry.io/collector/config/configretry v1.15.0 - go.opentelemetry.io/collector/config/configtls v1.15.0 - go.opentelemetry.io/collector/confmap v1.15.0 - go.opentelemetry.io/collector/consumer v0.109.0 - go.opentelemetry.io/collector/exporter v0.109.0 - go.opentelemetry.io/collector/pdata v1.15.0 + go.opentelemetry.io/collector v0.110.0 + go.opentelemetry.io/collector/component v0.110.0 + go.opentelemetry.io/collector/config/configcompression v1.16.0 + go.opentelemetry.io/collector/config/confighttp v0.110.0 + go.opentelemetry.io/collector/config/configopaque v1.16.0 + go.opentelemetry.io/collector/config/configretry v1.16.0 + go.opentelemetry.io/collector/config/configtls v1.16.0 + go.opentelemetry.io/collector/confmap v1.16.0 + go.opentelemetry.io/collector/consumer v0.110.0 + go.opentelemetry.io/collector/exporter v0.110.0 + go.opentelemetry.io/collector/pdata v1.16.0 go.uber.org/goleak v1.3.0 go.uber.org/zap v1.27.0 google.golang.org/genproto/googleapis/rpc v0.0.0-20240822170219-fc7c04adadcd - google.golang.org/grpc v1.66.2 + google.golang.org/grpc v1.67.0 google.golang.org/protobuf v1.34.2 ) @@ -33,9 +33,8 @@ require ( 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.9 // indirect + github.com/klauspost/compress v1.17.10 // 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 @@ -45,21 +44,22 @@ require ( github.com/modern-go/reflect2 v1.0.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/rs/cors v1.11.1 // indirect - go.opentelemetry.io/collector/client v1.15.0 // indirect - go.opentelemetry.io/collector/config/configauth v0.109.0 // indirect - go.opentelemetry.io/collector/config/configtelemetry v0.109.0 // indirect - go.opentelemetry.io/collector/config/internal v0.109.1-0.20240916143658-74729e731d3b // indirect - go.opentelemetry.io/collector/consumer/consumerprofiles v0.109.0 // indirect - go.opentelemetry.io/collector/consumer/consumertest v0.109.0 // indirect - go.opentelemetry.io/collector/exporter/exporterprofiles v0.109.0 // indirect - go.opentelemetry.io/collector/extension v0.109.0 // indirect - go.opentelemetry.io/collector/extension/auth v0.109.0 // indirect - go.opentelemetry.io/collector/extension/experimental/storage v0.109.0 // indirect - go.opentelemetry.io/collector/featuregate v1.15.0 // indirect - go.opentelemetry.io/collector/internal/globalgates v0.109.0 // indirect - go.opentelemetry.io/collector/pdata/pprofile v0.109.0 // indirect - go.opentelemetry.io/collector/receiver v0.109.0 // indirect - go.opentelemetry.io/collector/receiver/receiverprofiles v0.109.0 // indirect + go.opentelemetry.io/collector/client v1.16.0 // indirect + go.opentelemetry.io/collector/component/componentprofiles v0.110.0 // indirect + go.opentelemetry.io/collector/config/configauth v0.110.0 // indirect + go.opentelemetry.io/collector/config/configtelemetry v0.110.0 // indirect + go.opentelemetry.io/collector/config/internal v0.110.0 // indirect + go.opentelemetry.io/collector/consumer/consumerprofiles v0.110.0 // indirect + go.opentelemetry.io/collector/consumer/consumertest v0.110.0 // indirect + go.opentelemetry.io/collector/exporter/exporterprofiles v0.110.0 // indirect + go.opentelemetry.io/collector/extension v0.110.0 // indirect + go.opentelemetry.io/collector/extension/auth v0.110.0 // indirect + go.opentelemetry.io/collector/extension/experimental/storage v0.110.0 // indirect + go.opentelemetry.io/collector/internal/globalsignal v0.110.0 // indirect + go.opentelemetry.io/collector/pdata/pprofile v0.110.0 // indirect + go.opentelemetry.io/collector/pipeline v0.110.0 // indirect + go.opentelemetry.io/collector/receiver v0.110.0 // indirect + go.opentelemetry.io/collector/receiver/receiverprofiles v0.110.0 // indirect go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.55.0 // indirect go.opentelemetry.io/otel v1.30.0 // indirect go.opentelemetry.io/otel/metric v1.30.0 // indirect @@ -101,8 +101,6 @@ replace go.opentelemetry.io/collector/extension/auth => ../../extension/auth replace go.opentelemetry.io/collector/extension/experimental/storage => ../../extension/experimental/storage -replace go.opentelemetry.io/collector/featuregate => ../../featuregate - replace go.opentelemetry.io/collector/pdata => ../../pdata replace go.opentelemetry.io/collector/pdata/testdata => ../../pdata/testdata @@ -113,11 +111,6 @@ replace go.opentelemetry.io/collector/receiver => ../../receiver replace go.opentelemetry.io/collector/consumer => ../../consumer -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/config/configretry => ../../config/configretry replace go.opentelemetry.io/collector/consumer/consumerprofiles => ../../consumer/consumerprofiles @@ -132,4 +125,13 @@ replace go.opentelemetry.io/collector/receiver/receiverprofiles => ../../receive replace go.opentelemetry.io/collector/exporter/exporterprofiles => ../exporterprofiles -replace go.opentelemetry.io/collector/internal/globalgates => ../../internal/globalgates +replace go.opentelemetry.io/collector/pipeline => ../../pipeline + +replace go.opentelemetry.io/collector/internal/globalsignal => ../../internal/globalsignal + +replace go.opentelemetry.io/collector/component/componentprofiles => ../../component/componentprofiles + +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 +) diff --git a/exporter/otlphttpexporter/go.sum b/exporter/otlphttpexporter/go.sum index ccdfca7a8ba..758cd0b1e91 100644 --- a/exporter/otlphttpexporter/go.sum +++ b/exporter/otlphttpexporter/go.sum @@ -23,14 +23,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/klauspost/compress v1.17.10 h1:oXAz+Vh0PMUvJczoi+flxpnBEPxoER1IaAnU/NMPtT0= +github.com/klauspost/compress v1.17.10/go.mod h1:pMDklpSncoRMuLFrf1W9Ss9KT+0rH90U12bZKk7uwG0= 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= @@ -113,8 +111,8 @@ golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8T golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/genproto/googleapis/rpc v0.0.0-20240822170219-fc7c04adadcd h1:6TEm2ZxXoQmFWFlt1vNxvVOa1Q0dXFQD1m/rYjXmS0E= google.golang.org/genproto/googleapis/rpc v0.0.0-20240822170219-fc7c04adadcd/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU= -google.golang.org/grpc v1.66.2 h1:3QdXkuq3Bkh7w+ywLdLvM56cmGvQHUMZpiCzt6Rqaoo= -google.golang.org/grpc v1.66.2/go.mod h1:s3/l6xSSCURdVfAnL+TqCNMyTDAGN6+lZeVxnZR128Y= +google.golang.org/grpc v1.67.0 h1:IdH9y6PF5MPSdAntIcpjQ+tXO41pcQsfZV2RxtQgVcw= +google.golang.org/grpc v1.67.0/go.mod h1:1gLDyUQU7CTLJI90u3nXZ9ekeghjeM7pTDZlqFNg2AA= google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/extension/auth/go.mod b/extension/auth/go.mod index 026871eb7b7..bd72bce4b85 100644 --- a/extension/auth/go.mod +++ b/extension/auth/go.mod @@ -4,10 +4,10 @@ go 1.22.0 require ( github.com/stretchr/testify v1.9.0 - go.opentelemetry.io/collector/component v0.109.0 - go.opentelemetry.io/collector/extension v0.109.0 + go.opentelemetry.io/collector/component v0.110.0 + go.opentelemetry.io/collector/extension v0.110.0 go.uber.org/goleak v1.3.0 - google.golang.org/grpc v1.66.2 + google.golang.org/grpc v1.67.0 ) require ( @@ -17,8 +17,10 @@ require ( github.com/gogo/protobuf v1.3.2 // indirect github.com/google/uuid v1.6.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/collector/config/configtelemetry v0.109.0 // indirect - go.opentelemetry.io/collector/pdata v1.15.0 // indirect + go.opentelemetry.io/collector/config/configtelemetry v0.110.0 // indirect + go.opentelemetry.io/collector/internal/globalsignal v0.110.0 // indirect + go.opentelemetry.io/collector/pdata v1.16.0 // indirect + go.opentelemetry.io/collector/pipeline v0.110.0 // indirect go.opentelemetry.io/otel v1.30.0 // indirect go.opentelemetry.io/otel/metric v1.30.0 // indirect go.opentelemetry.io/otel/sdk v1.30.0 // indirect @@ -29,7 +31,7 @@ require ( golang.org/x/net v0.28.0 // indirect golang.org/x/sys v0.25.0 // indirect golang.org/x/text v0.17.0 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20240604185151-ef581f913117 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240814211410-ddb44dafa142 // indirect google.golang.org/protobuf v1.34.2 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) @@ -41,3 +43,7 @@ replace go.opentelemetry.io/collector/extension => ../ replace go.opentelemetry.io/collector/pdata => ../../pdata replace go.opentelemetry.io/collector/config/configtelemetry => ../../config/configtelemetry + +replace go.opentelemetry.io/collector/pipeline => ../../pipeline + +replace go.opentelemetry.io/collector/internal/globalsignal => ../../internal/globalsignal diff --git a/extension/auth/go.sum b/extension/auth/go.sum index a80371fce1e..e10837b9943 100644 --- a/extension/auth/go.sum +++ b/extension/auth/go.sum @@ -72,10 +72,10 @@ 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= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240604185151-ef581f913117 h1:1GBuWVLM/KMVUv1t1En5Gs+gFZCNd360GGb4sSxtrhU= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240604185151-ef581f913117/go.mod h1:EfXuqaE1J41VCDicxHzUDm+8rk+7ZdXzHV0IhO/I6s0= -google.golang.org/grpc v1.66.2 h1:3QdXkuq3Bkh7w+ywLdLvM56cmGvQHUMZpiCzt6Rqaoo= -google.golang.org/grpc v1.66.2/go.mod h1:s3/l6xSSCURdVfAnL+TqCNMyTDAGN6+lZeVxnZR128Y= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240814211410-ddb44dafa142 h1:e7S5W7MGGLaSu8j3YjdezkZ+m1/Nm0uRVRMEMGk26Xs= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240814211410-ddb44dafa142/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU= +google.golang.org/grpc v1.67.0 h1:IdH9y6PF5MPSdAntIcpjQ+tXO41pcQsfZV2RxtQgVcw= +google.golang.org/grpc v1.67.0/go.mod h1:1gLDyUQU7CTLJI90u3nXZ9ekeghjeM7pTDZlqFNg2AA= google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/extension/experimental/storage/go.mod b/extension/experimental/storage/go.mod index 62d2e3e2e60..16ed1de6ae9 100644 --- a/extension/experimental/storage/go.mod +++ b/extension/experimental/storage/go.mod @@ -3,14 +3,16 @@ module go.opentelemetry.io/collector/extension/experimental/storage go 1.22.0 require ( - go.opentelemetry.io/collector/component v0.109.0 - go.opentelemetry.io/collector/extension v0.109.0 + go.opentelemetry.io/collector/component v0.110.0 + go.opentelemetry.io/collector/extension v0.110.0 ) require ( github.com/gogo/protobuf v1.3.2 // indirect - go.opentelemetry.io/collector/config/configtelemetry v0.109.0 // indirect - go.opentelemetry.io/collector/pdata v1.15.0 // indirect + go.opentelemetry.io/collector/config/configtelemetry v0.110.0 // indirect + go.opentelemetry.io/collector/internal/globalsignal v0.110.0 // indirect + go.opentelemetry.io/collector/pdata v1.16.0 // indirect + go.opentelemetry.io/collector/pipeline v0.110.0 // indirect go.opentelemetry.io/otel v1.30.0 // indirect go.opentelemetry.io/otel/metric v1.30.0 // indirect go.opentelemetry.io/otel/trace v1.30.0 // indirect @@ -19,8 +21,8 @@ require ( golang.org/x/net v0.28.0 // indirect golang.org/x/sys v0.25.0 // indirect golang.org/x/text v0.17.0 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20240604185151-ef581f913117 // indirect - google.golang.org/grpc v1.66.2 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240814211410-ddb44dafa142 // indirect + google.golang.org/grpc v1.67.0 // indirect google.golang.org/protobuf v1.34.2 // indirect ) @@ -31,3 +33,7 @@ replace go.opentelemetry.io/collector/component => ../../../component replace go.opentelemetry.io/collector/pdata => ../../../pdata replace go.opentelemetry.io/collector/config/configtelemetry => ../../../config/configtelemetry + +replace go.opentelemetry.io/collector/internal/globalsignal => ../../../internal/globalsignal + +replace go.opentelemetry.io/collector/pipeline => ../../../pipeline diff --git a/extension/experimental/storage/go.sum b/extension/experimental/storage/go.sum index 1c35fd4214a..2b795808461 100644 --- a/extension/experimental/storage/go.sum +++ b/extension/experimental/storage/go.sum @@ -59,10 +59,10 @@ 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= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240604185151-ef581f913117 h1:1GBuWVLM/KMVUv1t1En5Gs+gFZCNd360GGb4sSxtrhU= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240604185151-ef581f913117/go.mod h1:EfXuqaE1J41VCDicxHzUDm+8rk+7ZdXzHV0IhO/I6s0= -google.golang.org/grpc v1.66.2 h1:3QdXkuq3Bkh7w+ywLdLvM56cmGvQHUMZpiCzt6Rqaoo= -google.golang.org/grpc v1.66.2/go.mod h1:s3/l6xSSCURdVfAnL+TqCNMyTDAGN6+lZeVxnZR128Y= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240814211410-ddb44dafa142 h1:e7S5W7MGGLaSu8j3YjdezkZ+m1/Nm0uRVRMEMGk26Xs= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240814211410-ddb44dafa142/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU= +google.golang.org/grpc v1.67.0 h1:IdH9y6PF5MPSdAntIcpjQ+tXO41pcQsfZV2RxtQgVcw= +google.golang.org/grpc v1.67.0/go.mod h1:1gLDyUQU7CTLJI90u3nXZ9ekeghjeM7pTDZlqFNg2AA= google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/extension/extensioncapabilities/go.mod b/extension/extensioncapabilities/go.mod index 7a4c8143639..e787c9ffeae 100644 --- a/extension/extensioncapabilities/go.mod +++ b/extension/extensioncapabilities/go.mod @@ -3,9 +3,9 @@ module go.opentelemetry.io/collector/extension/extensioncapabilities go 1.22.0 require ( - go.opentelemetry.io/collector/component v0.109.0 - go.opentelemetry.io/collector/confmap v1.15.0 - go.opentelemetry.io/collector/extension v0.109.0 + go.opentelemetry.io/collector/component v0.110.0 + go.opentelemetry.io/collector/confmap v1.16.0 + go.opentelemetry.io/collector/extension v0.110.0 ) require ( @@ -16,8 +16,10 @@ require ( 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 - go.opentelemetry.io/collector/config/configtelemetry v0.109.0 // indirect - go.opentelemetry.io/collector/pdata v1.15.0 // indirect + go.opentelemetry.io/collector/config/configtelemetry v0.110.0 // indirect + go.opentelemetry.io/collector/internal/globalsignal v0.110.0 // indirect + go.opentelemetry.io/collector/pdata v1.16.0 // indirect + go.opentelemetry.io/collector/pipeline v0.110.0 // indirect go.opentelemetry.io/otel v1.30.0 // indirect go.opentelemetry.io/otel/metric v1.30.0 // indirect go.opentelemetry.io/otel/trace v1.30.0 // indirect @@ -26,8 +28,8 @@ require ( golang.org/x/net v0.28.0 // indirect golang.org/x/sys v0.25.0 // indirect golang.org/x/text v0.17.0 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20240604185151-ef581f913117 // indirect - google.golang.org/grpc v1.66.2 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240814211410-ddb44dafa142 // indirect + google.golang.org/grpc v1.67.0 // indirect google.golang.org/protobuf v1.34.2 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) @@ -41,3 +43,7 @@ replace go.opentelemetry.io/collector/confmap => ../../confmap replace go.opentelemetry.io/collector/config/configtelemetry => ../../config/configtelemetry replace go.opentelemetry.io/collector/component => ../../component + +replace go.opentelemetry.io/collector/pipeline => ../../pipeline + +replace go.opentelemetry.io/collector/internal/globalsignal => ../../internal/globalsignal diff --git a/extension/extensioncapabilities/go.sum b/extension/extensioncapabilities/go.sum index d7875acdd6c..7b9779ee104 100644 --- a/extension/extensioncapabilities/go.sum +++ b/extension/extensioncapabilities/go.sum @@ -77,10 +77,10 @@ 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= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240604185151-ef581f913117 h1:1GBuWVLM/KMVUv1t1En5Gs+gFZCNd360GGb4sSxtrhU= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240604185151-ef581f913117/go.mod h1:EfXuqaE1J41VCDicxHzUDm+8rk+7ZdXzHV0IhO/I6s0= -google.golang.org/grpc v1.66.2 h1:3QdXkuq3Bkh7w+ywLdLvM56cmGvQHUMZpiCzt6Rqaoo= -google.golang.org/grpc v1.66.2/go.mod h1:s3/l6xSSCURdVfAnL+TqCNMyTDAGN6+lZeVxnZR128Y= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240814211410-ddb44dafa142 h1:e7S5W7MGGLaSu8j3YjdezkZ+m1/Nm0uRVRMEMGk26Xs= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240814211410-ddb44dafa142/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU= +google.golang.org/grpc v1.67.0 h1:IdH9y6PF5MPSdAntIcpjQ+tXO41pcQsfZV2RxtQgVcw= +google.golang.org/grpc v1.67.0/go.mod h1:1gLDyUQU7CTLJI90u3nXZ9ekeghjeM7pTDZlqFNg2AA= google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/extension/go.mod b/extension/go.mod index f6ea19672ff..afe18f891ab 100644 --- a/extension/go.mod +++ b/extension/go.mod @@ -5,7 +5,7 @@ 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.109.0 + go.opentelemetry.io/collector/component v0.110.0 go.uber.org/goleak v1.3.0 ) @@ -15,8 +15,10 @@ require ( github.com/go-logr/stdr v1.2.2 // 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.109.0 // indirect - go.opentelemetry.io/collector/pdata v1.15.0 // indirect + go.opentelemetry.io/collector/config/configtelemetry v0.110.0 // indirect + go.opentelemetry.io/collector/internal/globalsignal v0.110.0 // indirect + go.opentelemetry.io/collector/pdata v1.16.0 // indirect + go.opentelemetry.io/collector/pipeline v0.110.0 // indirect go.opentelemetry.io/otel v1.30.0 // indirect go.opentelemetry.io/otel/metric v1.30.0 // indirect go.opentelemetry.io/otel/sdk v1.30.0 // indirect @@ -27,8 +29,8 @@ require ( golang.org/x/net v0.28.0 // indirect golang.org/x/sys v0.25.0 // indirect golang.org/x/text v0.17.0 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20240604185151-ef581f913117 // indirect - google.golang.org/grpc v1.66.2 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240814211410-ddb44dafa142 // indirect + google.golang.org/grpc v1.67.0 // indirect google.golang.org/protobuf v1.34.2 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) @@ -38,3 +40,7 @@ replace go.opentelemetry.io/collector/component => ../component replace go.opentelemetry.io/collector/pdata => ../pdata replace go.opentelemetry.io/collector/config/configtelemetry => ../config/configtelemetry + +replace go.opentelemetry.io/collector/pipeline => ../pipeline + +replace go.opentelemetry.io/collector/internal/globalsignal => ../internal/globalsignal diff --git a/extension/go.sum b/extension/go.sum index a80371fce1e..e10837b9943 100644 --- a/extension/go.sum +++ b/extension/go.sum @@ -72,10 +72,10 @@ 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= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240604185151-ef581f913117 h1:1GBuWVLM/KMVUv1t1En5Gs+gFZCNd360GGb4sSxtrhU= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240604185151-ef581f913117/go.mod h1:EfXuqaE1J41VCDicxHzUDm+8rk+7ZdXzHV0IhO/I6s0= -google.golang.org/grpc v1.66.2 h1:3QdXkuq3Bkh7w+ywLdLvM56cmGvQHUMZpiCzt6Rqaoo= -google.golang.org/grpc v1.66.2/go.mod h1:s3/l6xSSCURdVfAnL+TqCNMyTDAGN6+lZeVxnZR128Y= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240814211410-ddb44dafa142 h1:e7S5W7MGGLaSu8j3YjdezkZ+m1/Nm0uRVRMEMGk26Xs= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240814211410-ddb44dafa142/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU= +google.golang.org/grpc v1.67.0 h1:IdH9y6PF5MPSdAntIcpjQ+tXO41pcQsfZV2RxtQgVcw= +google.golang.org/grpc v1.67.0/go.mod h1:1gLDyUQU7CTLJI90u3nXZ9ekeghjeM7pTDZlqFNg2AA= google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/extension/memorylimiterextension/go.mod b/extension/memorylimiterextension/go.mod index 984be879f91..4645c9ea3eb 100644 --- a/extension/memorylimiterextension/go.mod +++ b/extension/memorylimiterextension/go.mod @@ -4,10 +4,10 @@ go 1.22.0 require ( github.com/stretchr/testify v1.9.0 - go.opentelemetry.io/collector v0.109.0 - go.opentelemetry.io/collector/component v0.109.0 - go.opentelemetry.io/collector/confmap v1.15.0 - go.opentelemetry.io/collector/extension v0.109.0 + go.opentelemetry.io/collector v0.110.0 + go.opentelemetry.io/collector/component v0.110.0 + go.opentelemetry.io/collector/confmap v1.16.0 + go.opentelemetry.io/collector/extension v0.110.0 go.uber.org/goleak v1.3.0 go.uber.org/zap v1.27.0 ) @@ -32,8 +32,10 @@ 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.109.0 // indirect - go.opentelemetry.io/collector/pdata v1.15.0 // indirect + go.opentelemetry.io/collector/config/configtelemetry v0.110.0 // indirect + go.opentelemetry.io/collector/internal/globalsignal v0.110.0 // indirect + go.opentelemetry.io/collector/pdata v1.16.0 // indirect + go.opentelemetry.io/collector/pipeline v0.110.0 // indirect go.opentelemetry.io/otel v1.30.0 // indirect go.opentelemetry.io/otel/metric v1.30.0 // indirect go.opentelemetry.io/otel/sdk v1.30.0 // indirect @@ -44,7 +46,7 @@ require ( golang.org/x/sys v0.25.0 // indirect golang.org/x/text v0.17.0 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240822170219-fc7c04adadcd // indirect - google.golang.org/grpc v1.66.2 // indirect + google.golang.org/grpc v1.67.0 // indirect google.golang.org/protobuf v1.34.2 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) @@ -72,3 +74,7 @@ replace go.opentelemetry.io/collector/consumer/consumerprofiles => ../../consume replace go.opentelemetry.io/collector/consumer/consumertest => ../../consumer/consumertest replace go.opentelemetry.io/collector/component/componentstatus => ../../component/componentstatus + +replace go.opentelemetry.io/collector/pipeline => ../../pipeline + +replace go.opentelemetry.io/collector/internal/globalsignal => ../../internal/globalsignal diff --git a/extension/memorylimiterextension/go.sum b/extension/memorylimiterextension/go.sum index 8abb1e9d6b5..76b315e38b1 100644 --- a/extension/memorylimiterextension/go.sum +++ b/extension/memorylimiterextension/go.sum @@ -105,8 +105,8 @@ golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8T golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/genproto/googleapis/rpc v0.0.0-20240822170219-fc7c04adadcd h1:6TEm2ZxXoQmFWFlt1vNxvVOa1Q0dXFQD1m/rYjXmS0E= google.golang.org/genproto/googleapis/rpc v0.0.0-20240822170219-fc7c04adadcd/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU= -google.golang.org/grpc v1.66.2 h1:3QdXkuq3Bkh7w+ywLdLvM56cmGvQHUMZpiCzt6Rqaoo= -google.golang.org/grpc v1.66.2/go.mod h1:s3/l6xSSCURdVfAnL+TqCNMyTDAGN6+lZeVxnZR128Y= +google.golang.org/grpc v1.67.0 h1:IdH9y6PF5MPSdAntIcpjQ+tXO41pcQsfZV2RxtQgVcw= +google.golang.org/grpc v1.67.0/go.mod h1:1gLDyUQU7CTLJI90u3nXZ9ekeghjeM7pTDZlqFNg2AA= google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/extension/zpagesextension/go.mod b/extension/zpagesextension/go.mod index 5ed935d0d35..89f53fe8eec 100644 --- a/extension/zpagesextension/go.mod +++ b/extension/zpagesextension/go.mod @@ -4,13 +4,13 @@ go 1.22.0 require ( github.com/stretchr/testify v1.9.0 - go.opentelemetry.io/collector v0.109.0 - go.opentelemetry.io/collector/component v0.109.0 - go.opentelemetry.io/collector/component/componentstatus v0.109.0 - go.opentelemetry.io/collector/config/configauth v0.109.0 - go.opentelemetry.io/collector/config/confighttp v0.109.0 - go.opentelemetry.io/collector/confmap v1.15.0 - go.opentelemetry.io/collector/extension v0.109.0 + go.opentelemetry.io/collector v0.110.0 + go.opentelemetry.io/collector/component v0.110.0 + go.opentelemetry.io/collector/component/componentstatus v0.110.0 + go.opentelemetry.io/collector/config/configauth v0.110.0 + go.opentelemetry.io/collector/config/confighttp v0.110.0 + go.opentelemetry.io/collector/confmap v1.16.0 + go.opentelemetry.io/collector/extension v0.110.0 go.opentelemetry.io/contrib/zpages v0.55.0 go.opentelemetry.io/otel/sdk v1.30.0 go.opentelemetry.io/otel/trace v1.30.0 @@ -28,8 +28,7 @@ require ( 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/klauspost/compress v1.17.9 // indirect + github.com/klauspost/compress v1.17.10 // 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,16 +36,16 @@ require ( github.com/mitchellh/reflectwalk v1.0.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/rs/cors v1.11.1 // indirect - go.opentelemetry.io/collector/client v1.15.0 // indirect - go.opentelemetry.io/collector/config/configcompression v1.15.0 // indirect - go.opentelemetry.io/collector/config/configopaque v1.15.0 // indirect - go.opentelemetry.io/collector/config/configtelemetry v0.109.0 // indirect - go.opentelemetry.io/collector/config/configtls v1.15.0 // indirect - go.opentelemetry.io/collector/config/internal v0.109.1-0.20240916143658-74729e731d3b // indirect - go.opentelemetry.io/collector/extension/auth v0.109.0 // indirect - go.opentelemetry.io/collector/featuregate v1.15.0 // indirect - go.opentelemetry.io/collector/internal/globalgates v0.109.0 // indirect - go.opentelemetry.io/collector/pdata v1.15.0 // indirect + go.opentelemetry.io/collector/client v1.16.0 // indirect + go.opentelemetry.io/collector/config/configcompression v1.16.0 // indirect + go.opentelemetry.io/collector/config/configopaque v1.16.0 // indirect + go.opentelemetry.io/collector/config/configtelemetry v0.110.0 // indirect + go.opentelemetry.io/collector/config/configtls v1.16.0 // indirect + go.opentelemetry.io/collector/config/internal v0.110.0 // indirect + go.opentelemetry.io/collector/extension/auth v0.110.0 // indirect + go.opentelemetry.io/collector/internal/globalsignal v0.110.0 // indirect + go.opentelemetry.io/collector/pdata v1.16.0 // indirect + go.opentelemetry.io/collector/pipeline v0.110.0 // indirect go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.55.0 // indirect go.opentelemetry.io/otel v1.30.0 // indirect go.opentelemetry.io/otel/metric v1.30.0 // indirect @@ -56,7 +55,7 @@ require ( golang.org/x/sys v0.25.0 // indirect golang.org/x/text v0.18.0 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240822170219-fc7c04adadcd // indirect - google.golang.org/grpc v1.66.2 // indirect + google.golang.org/grpc v1.67.0 // indirect google.golang.org/protobuf v1.34.2 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) @@ -69,17 +68,10 @@ replace go.opentelemetry.io/collector/confmap => ../../confmap replace go.opentelemetry.io/collector/extension => ../ -replace go.opentelemetry.io/collector/featuregate => ../../featuregate - replace go.opentelemetry.io/collector/pdata => ../../pdata replace go.opentelemetry.io/collector/consumer => ../../consumer -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/config/configtelemetry => ../../config/configtelemetry replace go.opentelemetry.io/collector/pdata/testdata => ../../pdata/testdata @@ -108,4 +100,11 @@ replace go.opentelemetry.io/collector/client => ../../client replace go.opentelemetry.io/collector/component/componentstatus => ../../component/componentstatus -replace go.opentelemetry.io/collector/internal/globalgates => ../../internal/globalgates +replace go.opentelemetry.io/collector/pipeline => ../../pipeline + +replace go.opentelemetry.io/collector/internal/globalsignal => ../../internal/globalsignal + +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 +) diff --git a/extension/zpagesextension/go.sum b/extension/zpagesextension/go.sum index 9e98e8064a1..c5e3b84f83a 100644 --- a/extension/zpagesextension/go.sum +++ b/extension/zpagesextension/go.sum @@ -19,14 +19,12 @@ 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/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/klauspost/compress v1.17.10 h1:oXAz+Vh0PMUvJczoi+flxpnBEPxoER1IaAnU/NMPtT0= +github.com/klauspost/compress v1.17.10/go.mod h1:pMDklpSncoRMuLFrf1W9Ss9KT+0rH90U12bZKk7uwG0= 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= @@ -108,8 +106,8 @@ golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8T golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/genproto/googleapis/rpc v0.0.0-20240822170219-fc7c04adadcd h1:6TEm2ZxXoQmFWFlt1vNxvVOa1Q0dXFQD1m/rYjXmS0E= google.golang.org/genproto/googleapis/rpc v0.0.0-20240822170219-fc7c04adadcd/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU= -google.golang.org/grpc v1.66.2 h1:3QdXkuq3Bkh7w+ywLdLvM56cmGvQHUMZpiCzt6Rqaoo= -google.golang.org/grpc v1.66.2/go.mod h1:s3/l6xSSCURdVfAnL+TqCNMyTDAGN6+lZeVxnZR128Y= +google.golang.org/grpc v1.67.0 h1:IdH9y6PF5MPSdAntIcpjQ+tXO41pcQsfZV2RxtQgVcw= +google.golang.org/grpc v1.67.0/go.mod h1:1gLDyUQU7CTLJI90u3nXZ9ekeghjeM7pTDZlqFNg2AA= google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/filter/go.mod b/filter/go.mod index d023219f32b..4c2f52e2260 100644 --- a/filter/go.mod +++ b/filter/go.mod @@ -4,7 +4,7 @@ go 1.22.0 require ( github.com/stretchr/testify v1.9.0 - go.opentelemetry.io/collector/confmap v1.15.0 + go.opentelemetry.io/collector/confmap v1.16.0 ) require ( diff --git a/go.mod b/go.mod index 2f3a995a25b..7cdecb7d018 100644 --- a/go.mod +++ b/go.mod @@ -13,19 +13,19 @@ go 1.22.0 require ( github.com/shirou/gopsutil/v4 v4.24.8 github.com/stretchr/testify v1.9.0 - go.opentelemetry.io/collector/component v0.109.0 - go.opentelemetry.io/collector/component/componentstatus v0.109.0 - go.opentelemetry.io/collector/confmap v1.15.0 - go.opentelemetry.io/collector/consumer v0.109.0 - go.opentelemetry.io/collector/consumer/consumerprofiles v0.109.0 - go.opentelemetry.io/collector/consumer/consumertest v0.109.0 - go.opentelemetry.io/collector/pdata v1.15.0 - go.opentelemetry.io/collector/pdata/pprofile v0.109.0 - go.opentelemetry.io/collector/pdata/testdata v0.109.0 + go.opentelemetry.io/collector/component v0.110.0 + go.opentelemetry.io/collector/component/componentstatus v0.110.0 + go.opentelemetry.io/collector/confmap v1.16.0 + go.opentelemetry.io/collector/consumer v0.110.0 + go.opentelemetry.io/collector/consumer/consumerprofiles v0.110.0 + go.opentelemetry.io/collector/consumer/consumertest v0.110.0 + go.opentelemetry.io/collector/pdata v1.16.0 + go.opentelemetry.io/collector/pdata/pprofile v0.110.0 + go.opentelemetry.io/collector/pdata/testdata v0.110.0 go.uber.org/goleak v1.3.0 go.uber.org/multierr v1.11.0 go.uber.org/zap v1.27.0 - google.golang.org/grpc v1.66.2 + google.golang.org/grpc v1.67.0 ) require ( @@ -51,7 +51,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.109.0 // indirect + go.opentelemetry.io/collector/config/configtelemetry v0.110.0 // indirect + go.opentelemetry.io/collector/internal/globalsignal v0.110.0 // indirect + go.opentelemetry.io/collector/pipeline v0.110.0 // indirect go.opentelemetry.io/otel v1.30.0 // indirect go.opentelemetry.io/otel/metric v1.30.0 // indirect go.opentelemetry.io/otel/sdk v1.30.0 // indirect @@ -92,3 +94,7 @@ retract ( replace go.opentelemetry.io/collector/pdata/pprofile => ./pdata/pprofile replace go.opentelemetry.io/collector/consumer/consumerprofiles => ./consumer/consumerprofiles + +replace go.opentelemetry.io/collector/pipeline => ./pipeline + +replace go.opentelemetry.io/collector/internal/globalsignal => ./internal/globalsignal diff --git a/go.sum b/go.sum index 4e25b66ac02..fa890dba0c9 100644 --- a/go.sum +++ b/go.sum @@ -116,8 +116,8 @@ golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8T golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/genproto/googleapis/rpc v0.0.0-20240822170219-fc7c04adadcd h1:6TEm2ZxXoQmFWFlt1vNxvVOa1Q0dXFQD1m/rYjXmS0E= google.golang.org/genproto/googleapis/rpc v0.0.0-20240822170219-fc7c04adadcd/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU= -google.golang.org/grpc v1.66.2 h1:3QdXkuq3Bkh7w+ywLdLvM56cmGvQHUMZpiCzt6Rqaoo= -google.golang.org/grpc v1.66.2/go.mod h1:s3/l6xSSCURdVfAnL+TqCNMyTDAGN6+lZeVxnZR128Y= +google.golang.org/grpc v1.67.0 h1:IdH9y6PF5MPSdAntIcpjQ+tXO41pcQsfZV2RxtQgVcw= +google.golang.org/grpc v1.67.0/go.mod h1:1gLDyUQU7CTLJI90u3nXZ9ekeghjeM7pTDZlqFNg2AA= google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/internal/e2e/consume_contract_test.go b/internal/e2e/consume_contract_test.go index 98beb5cd361..88ddfc3eb4d 100644 --- a/internal/e2e/consume_contract_test.go +++ b/internal/e2e/consume_contract_test.go @@ -15,6 +15,7 @@ import ( "go.opentelemetry.io/collector/exporter/exportertest" "go.opentelemetry.io/collector/exporter/otlpexporter" "go.opentelemetry.io/collector/internal/testutil" + "go.opentelemetry.io/collector/pipeline" "go.opentelemetry.io/collector/receiver/otlpreceiver" ) @@ -48,7 +49,7 @@ func TestConsumeContractOtlpLogs(t *testing.T) { T: t, NumberOfTestElements: 10, ExporterFactory: otlpexporter.NewFactory(), - DataType: component.DataTypeLogs, + Signal: pipeline.SignalLogs, ExporterConfig: testExporterConfig(addr), ReceiverFactory: otlpreceiver.NewFactory(), ReceiverConfig: testReceiverConfig(addr), @@ -60,7 +61,7 @@ func TestConsumeContractOtlpTraces(t *testing.T) { exportertest.CheckConsumeContract(exportertest.CheckConsumeContractParams{ T: t, NumberOfTestElements: 10, - DataType: component.DataTypeTraces, + Signal: pipeline.SignalTraces, ExporterFactory: otlpexporter.NewFactory(), ExporterConfig: testExporterConfig(addr), ReceiverFactory: otlpreceiver.NewFactory(), @@ -74,7 +75,7 @@ func TestConsumeContractOtlpMetrics(t *testing.T) { T: t, NumberOfTestElements: 10, ExporterFactory: otlpexporter.NewFactory(), - DataType: component.DataTypeMetrics, + Signal: pipeline.SignalMetrics, ExporterConfig: testExporterConfig(addr), ReceiverFactory: otlpreceiver.NewFactory(), ReceiverConfig: testReceiverConfig(addr), diff --git a/internal/e2e/go.mod b/internal/e2e/go.mod index 26f9adfc491..9ed67742dae 100644 --- a/internal/e2e/go.mod +++ b/internal/e2e/go.mod @@ -4,28 +4,29 @@ go 1.22.0 require ( github.com/stretchr/testify v1.9.0 - go.opentelemetry.io/collector v0.109.0 - go.opentelemetry.io/collector/component v0.109.0 - go.opentelemetry.io/collector/component/componentstatus v0.109.0 - go.opentelemetry.io/collector/config/configgrpc v0.109.0 - go.opentelemetry.io/collector/config/confighttp v0.109.0 - go.opentelemetry.io/collector/config/configopaque v1.15.0 - go.opentelemetry.io/collector/config/configretry v1.15.0 - go.opentelemetry.io/collector/config/configtelemetry v0.109.0 - go.opentelemetry.io/collector/config/configtls v1.15.0 - go.opentelemetry.io/collector/confmap v1.15.0 - go.opentelemetry.io/collector/connector v0.109.0 - go.opentelemetry.io/collector/consumer v0.109.0 - go.opentelemetry.io/collector/consumer/consumertest v0.109.0 - go.opentelemetry.io/collector/exporter v0.109.0 - go.opentelemetry.io/collector/exporter/otlpexporter v0.109.0 - go.opentelemetry.io/collector/exporter/otlphttpexporter v0.109.0 - go.opentelemetry.io/collector/extension v0.109.0 - go.opentelemetry.io/collector/pdata v1.15.0 - go.opentelemetry.io/collector/pdata/testdata v0.109.0 - go.opentelemetry.io/collector/receiver v0.109.0 - go.opentelemetry.io/collector/receiver/otlpreceiver v0.109.0 - go.opentelemetry.io/collector/service v0.109.0 + go.opentelemetry.io/collector v0.110.0 + go.opentelemetry.io/collector/component v0.110.0 + go.opentelemetry.io/collector/component/componentstatus v0.110.0 + go.opentelemetry.io/collector/config/configgrpc v0.110.0 + go.opentelemetry.io/collector/config/confighttp v0.110.0 + go.opentelemetry.io/collector/config/configopaque v1.16.0 + go.opentelemetry.io/collector/config/configretry v1.16.0 + go.opentelemetry.io/collector/config/configtelemetry v0.110.0 + go.opentelemetry.io/collector/config/configtls v1.16.0 + go.opentelemetry.io/collector/confmap v1.16.0 + go.opentelemetry.io/collector/connector v0.110.0 + go.opentelemetry.io/collector/consumer v0.110.0 + go.opentelemetry.io/collector/consumer/consumertest v0.110.0 + go.opentelemetry.io/collector/exporter v0.110.0 + go.opentelemetry.io/collector/exporter/otlpexporter v0.110.0 + go.opentelemetry.io/collector/exporter/otlphttpexporter v0.110.0 + go.opentelemetry.io/collector/extension v0.110.0 + go.opentelemetry.io/collector/pdata v1.16.0 + go.opentelemetry.io/collector/pdata/testdata v0.110.0 + go.opentelemetry.io/collector/pipeline v0.110.0 + go.opentelemetry.io/collector/receiver v0.110.0 + go.opentelemetry.io/collector/receiver/otlpreceiver v0.110.0 + go.opentelemetry.io/collector/service v0.110.0 go.uber.org/goleak v1.3.0 go.uber.org/zap v1.27.0 ) @@ -47,7 +48,7 @@ require ( github.com/grpc-ecosystem/grpc-gateway/v2 v2.22.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/klauspost/compress v1.17.10 // 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 @@ -70,25 +71,26 @@ 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 v1.15.0 // indirect - go.opentelemetry.io/collector/component/componentprofiles v0.109.0 // indirect - go.opentelemetry.io/collector/config/configauth v0.109.0 // indirect - go.opentelemetry.io/collector/config/configcompression v1.15.0 // indirect - go.opentelemetry.io/collector/config/confignet v0.109.0 // indirect - go.opentelemetry.io/collector/config/internal v0.109.1-0.20240916143658-74729e731d3b // indirect - go.opentelemetry.io/collector/connector/connectorprofiles v0.109.0 // indirect - go.opentelemetry.io/collector/consumer/consumerprofiles v0.109.0 // indirect - go.opentelemetry.io/collector/exporter/exporterprofiles v0.109.0 // indirect - go.opentelemetry.io/collector/extension/auth v0.109.0 // indirect - go.opentelemetry.io/collector/extension/experimental/storage v0.109.0 // indirect - go.opentelemetry.io/collector/extension/extensioncapabilities v0.109.0 // indirect - go.opentelemetry.io/collector/featuregate v1.15.0 // indirect - go.opentelemetry.io/collector/internal/globalgates v0.109.0 // indirect - go.opentelemetry.io/collector/pdata/pprofile v0.109.0 // indirect - go.opentelemetry.io/collector/processor v0.109.0 // indirect - go.opentelemetry.io/collector/processor/processorprofiles v0.109.0 // indirect - go.opentelemetry.io/collector/receiver/receiverprofiles v0.109.0 // indirect - go.opentelemetry.io/collector/semconv v0.109.0 // indirect + go.opentelemetry.io/collector/client v1.16.0 // indirect + go.opentelemetry.io/collector/component/componentprofiles v0.110.0 // indirect + go.opentelemetry.io/collector/config/configauth v0.110.0 // indirect + go.opentelemetry.io/collector/config/configcompression v1.16.0 // indirect + go.opentelemetry.io/collector/config/confignet v1.16.0 // indirect + go.opentelemetry.io/collector/config/internal v0.110.0 // indirect + go.opentelemetry.io/collector/connector/connectorprofiles v0.110.0 // indirect + go.opentelemetry.io/collector/consumer/consumerprofiles v0.110.0 // indirect + go.opentelemetry.io/collector/exporter/exporterprofiles v0.110.0 // indirect + go.opentelemetry.io/collector/extension/auth v0.110.0 // indirect + go.opentelemetry.io/collector/extension/experimental/storage v0.110.0 // indirect + go.opentelemetry.io/collector/extension/extensioncapabilities v0.110.0 // indirect + go.opentelemetry.io/collector/featuregate v1.16.0 // indirect + go.opentelemetry.io/collector/internal/globalgates v0.110.0 // indirect + go.opentelemetry.io/collector/internal/globalsignal v0.110.0 // indirect + go.opentelemetry.io/collector/pdata/pprofile v0.110.0 // indirect + go.opentelemetry.io/collector/processor v0.110.0 // indirect + go.opentelemetry.io/collector/processor/processorprofiles v0.110.0 // indirect + go.opentelemetry.io/collector/receiver/receiverprofiles v0.110.0 // indirect + go.opentelemetry.io/collector/semconv v0.110.0 // indirect go.opentelemetry.io/contrib/config v0.10.0 // indirect go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.55.0 // indirect go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.55.0 // indirect @@ -118,7 +120,7 @@ require ( gonum.org/v1/gonum v0.15.1 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20240903143218-8af14fe29dc1 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1 // indirect - google.golang.org/grpc v1.66.2 // indirect + google.golang.org/grpc v1.67.0 // indirect google.golang.org/protobuf v1.34.2 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) @@ -206,3 +208,7 @@ replace go.opentelemetry.io/collector/processor/processorprofiles => ../../proce replace go.opentelemetry.io/collector/connector/connectorprofiles => ../../connector/connectorprofiles replace go.opentelemetry.io/collector/exporter/exporterprofiles => ../../exporter/exporterprofiles + +replace go.opentelemetry.io/collector/pipeline => ../../pipeline + +replace go.opentelemetry.io/collector/internal/globalsignal => ../globalsignal diff --git a/internal/e2e/go.sum b/internal/e2e/go.sum index 1a4822928db..d6c012b8b50 100644 --- a/internal/e2e/go.sum +++ b/internal/e2e/go.sum @@ -38,8 +38,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/klauspost/compress v1.17.10 h1:oXAz+Vh0PMUvJczoi+flxpnBEPxoER1IaAnU/NMPtT0= +github.com/klauspost/compress v1.17.10/go.mod h1:pMDklpSncoRMuLFrf1W9Ss9KT+0rH90U12bZKk7uwG0= 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= @@ -196,8 +196,8 @@ google.golang.org/genproto/googleapis/api v0.0.0-20240903143218-8af14fe29dc1 h1: google.golang.org/genproto/googleapis/api v0.0.0-20240903143218-8af14fe29dc1/go.mod h1:qpvKtACPCQhAdu3PyQgV4l3LMXZEtft7y8QcarRsp9I= google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1 h1:pPJltXNxVzT4pK9yD8vR9X75DaWYYmLGMsEvBfFQZzQ= google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU= -google.golang.org/grpc v1.66.2 h1:3QdXkuq3Bkh7w+ywLdLvM56cmGvQHUMZpiCzt6Rqaoo= -google.golang.org/grpc v1.66.2/go.mod h1:s3/l6xSSCURdVfAnL+TqCNMyTDAGN6+lZeVxnZR128Y= +google.golang.org/grpc v1.67.0 h1:IdH9y6PF5MPSdAntIcpjQ+tXO41pcQsfZV2RxtQgVcw= +google.golang.org/grpc v1.67.0/go.mod h1:1gLDyUQU7CTLJI90u3nXZ9ekeghjeM7pTDZlqFNg2AA= google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/internal/e2e/status_test.go b/internal/e2e/status_test.go index 6cb3fd40ce5..78ba605a1df 100644 --- a/internal/e2e/status_test.go +++ b/internal/e2e/status_test.go @@ -26,6 +26,7 @@ import ( "go.opentelemetry.io/collector/exporter/exportertest" "go.opentelemetry.io/collector/extension" "go.opentelemetry.io/collector/internal/sharedcomponent" + "go.opentelemetry.io/collector/pipeline" "go.opentelemetry.io/collector/receiver" "go.opentelemetry.io/collector/service" "go.opentelemetry.io/collector/service/extensions" @@ -100,12 +101,12 @@ func Test_ComponentStatusReporting_SharedInstance(t *testing.T) { Level: configtelemetry.LevelNone, }, }, - Pipelines: pipelines.Config{ - component.MustNewID("traces"): { + PipelinesWithPipelineID: pipelines.ConfigWithPipelineID{ + pipeline.MustNewID("traces"): { Receivers: []component.ID{component.NewID(component.MustNewType("test"))}, Exporters: []component.ID{component.NewID(nopType)}, }, - component.MustNewID("metrics"): { + pipeline.MustNewID("metrics"): { Receivers: []component.ID{component.NewID(component.MustNewType("test"))}, Exporters: []component.ID{component.NewID(nopType)}, }, @@ -127,7 +128,7 @@ func Test_ComponentStatusReporting_SharedInstance(t *testing.T) { for instanceID, events := range eventsReceived { pipelineIDs := "" - instanceID.AllPipelineIDs(func(id component.ID) bool { + instanceID.AllPipelineIDsWithPipelineIDs(func(id pipeline.ID) bool { pipelineIDs += id.String() + "," return true }) diff --git a/internal/globalgates/globalgates.go b/internal/globalgates/globalgates.go index 3a44f1fdb61..5aef63077c9 100644 --- a/internal/globalgates/globalgates.go +++ b/internal/globalgates/globalgates.go @@ -15,14 +15,13 @@ var NoopTracerProvider = featuregate.GlobalRegistry().MustRegister("service.noop featuregate.WithRegisterToVersion("v0.109.0"), featuregate.WithRegisterDescription("Sets a Noop OpenTelemetry TracerProvider to reduce memory allocations. This featuregate is incompatible with the zPages extension.")) -const UseLocalHostAsDefaultHostID = "component.UseLocalHostAsDefaultHost" - // UseLocalHostAsDefaultHostfeatureGate is the feature gate that controls whether // server-like receivers and extensions such as the OTLP receiver use localhost as the default host for their endpoints. -var UseLocalHostAsDefaultHostfeatureGate = mustRegisterOrLoad( +var _ = mustRegisterOrLoad( featuregate.GlobalRegistry(), - UseLocalHostAsDefaultHostID, - featuregate.StageBeta, + "component.UseLocalHostAsDefaultHost", + featuregate.StageStable, + featuregate.WithRegisterToVersion("v0.110.0"), featuregate.WithRegisterDescription("controls whether server-like receivers and extensions such as the OTLP receiver use localhost as the default host for their endpoints"), ) diff --git a/internal/globalgates/go.mod b/internal/globalgates/go.mod index 66f58f46597..84556ee8ada 100644 --- a/internal/globalgates/go.mod +++ b/internal/globalgates/go.mod @@ -2,7 +2,7 @@ module go.opentelemetry.io/collector/internal/globalgates go 1.22.0 -require go.opentelemetry.io/collector/featuregate v1.15.0 +require go.opentelemetry.io/collector/featuregate v1.16.0 require ( github.com/hashicorp/go-version v1.7.0 // indirect diff --git a/internal/iruntime/total_memory_other_test.go b/internal/iruntime/total_memory_other_test.go index 195dc1f196a..edaa4d9708e 100644 --- a/internal/iruntime/total_memory_other_test.go +++ b/internal/iruntime/total_memory_other_test.go @@ -9,10 +9,11 @@ import ( "testing" "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" ) func TestTotalMemory(t *testing.T) { totalMemory, err := TotalMemory() - assert.NoError(t, err) + require.NoError(t, err) assert.Positive(t, totalMemory) } diff --git a/internal/tools/go.mod b/internal/tools/go.mod index 5f480c043e5..13180710ed7 100644 --- a/internal/tools/go.mod +++ b/internal/tools/go.mod @@ -5,7 +5,6 @@ go 1.22.1 toolchain go1.22.7 require ( - github.com/Antonboom/testifylint v1.4.3 github.com/a8m/envsubst v1.4.2 github.com/client9/misspell v0.3.4 github.com/golangci/golangci-lint v1.60.1 @@ -30,6 +29,7 @@ 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.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 diff --git a/internal/tools/tools.go b/internal/tools/tools.go index 1abe8027c5a..06f143c3701 100644 --- a/internal/tools/tools.go +++ b/internal/tools/tools.go @@ -11,7 +11,6 @@ package tools // import "go.opentelemetry.io/collector/internal/tools" // This ensures that all systems use the same version of tools in addition to regular dependencies. import ( - _ "github.com/Antonboom/testifylint" _ "github.com/a8m/envsubst/cmd/envsubst" _ "github.com/client9/misspell/cmd/misspell" _ "github.com/golangci/golangci-lint/cmd/golangci-lint" diff --git a/otelcol/collector_test.go b/otelcol/collector_test.go index 7db8215eb39..2e84e32b876 100644 --- a/otelcol/collector_test.go +++ b/otelcol/collector_test.go @@ -389,8 +389,8 @@ func TestCollectorRun(t *testing.T) { tests := []struct { file string }{ - {file: "otelcol-nometrics.yaml"}, - {file: "otelcol-noaddress.yaml"}, + {file: "otelcol-noreaders.yaml"}, + {file: "otelcol-emptyreaders.yaml"}, } for _, tt := range tests { diff --git a/otelcol/config.go b/otelcol/config.go index e622617721b..64973418b0d 100644 --- a/otelcol/config.go +++ b/otelcol/config.go @@ -119,6 +119,7 @@ func (cfg *Config) Validate() error { } // Check that all pipelines reference only configured components. + // nolint for pipelineID, pipeline := range cfg.Service.Pipelines { // Validate pipeline receiver name references. for _, ref := range pipeline.Receivers { @@ -153,5 +154,41 @@ func (cfg *Config) Validate() error { return fmt.Errorf("service::pipelines::%s: references exporter %q which is not configured", pipelineID, ref) } } + + // Check that all pipelines reference only configured components. + for pipelineID, pipeline := range cfg.Service.PipelinesWithPipelineID { + // Validate pipeline receiver name references. + for _, ref := range pipeline.Receivers { + // Check that the name referenced in the pipeline's receivers exists in the top-level receivers. + if _, ok := cfg.Receivers[ref]; ok { + continue + } + + if _, ok := cfg.Connectors[ref]; ok { + continue + } + return fmt.Errorf("service::pipelines::%s: references receiver %q which is not configured", pipelineID.String(), ref) + } + + // Validate pipeline processor name references. + for _, ref := range pipeline.Processors { + // Check that the name referenced in the pipeline's processors exists in the top-level processors. + if cfg.Processors[ref] == nil { + return fmt.Errorf("service::pipelines::%s: references processor %q which is not configured", pipelineID.String(), ref) + } + } + + // Validate pipeline exporter name references. + for _, ref := range pipeline.Exporters { + // Check that the name referenced in the pipeline's Exporters exists in the top-level Exporters. + if _, ok := cfg.Exporters[ref]; ok { + continue + } + if _, ok := cfg.Connectors[ref]; ok { + continue + } + return fmt.Errorf("service::pipelines::%s: references exporter %q which is not configured", pipelineID.String(), ref) + } + } return nil } diff --git a/otelcol/config_test.go b/otelcol/config_test.go index 1de5369759c..c1e43afba69 100644 --- a/otelcol/config_test.go +++ b/otelcol/config_test.go @@ -9,10 +9,12 @@ import ( "testing" "github.com/stretchr/testify/assert" + "go.opentelemetry.io/contrib/config" "go.uber.org/zap/zapcore" "go.opentelemetry.io/collector/component" "go.opentelemetry.io/collector/config/configtelemetry" + "go.opentelemetry.io/collector/pipeline" "go.opentelemetry.io/collector/service" "go.opentelemetry.io/collector/service/pipelines" "go.opentelemetry.io/collector/service/telemetry" @@ -98,7 +100,7 @@ func TestConfigValidate(t *testing.T) { name: "invalid-receiver-reference", cfgFn: func() *Config { cfg := generateConfig() - pipe := cfg.Service.Pipelines[component.MustNewID("traces")] + pipe := cfg.Service.PipelinesWithPipelineID[pipeline.MustNewID("traces")] pipe.Receivers = append(pipe.Receivers, component.MustNewIDWithName("nop", "2")) return cfg }, @@ -108,7 +110,7 @@ func TestConfigValidate(t *testing.T) { name: "invalid-processor-reference", cfgFn: func() *Config { cfg := generateConfig() - pipe := cfg.Service.Pipelines[component.MustNewID("traces")] + pipe := cfg.Service.PipelinesWithPipelineID[pipeline.MustNewID("traces")] pipe.Processors = append(pipe.Processors, component.MustNewIDWithName("nop", "2")) return cfg }, @@ -118,7 +120,7 @@ func TestConfigValidate(t *testing.T) { name: "invalid-exporter-reference", cfgFn: func() *Config { cfg := generateConfig() - pipe := cfg.Service.Pipelines[component.MustNewID("traces")] + pipe := cfg.Service.PipelinesWithPipelineID[pipeline.MustNewID("traces")] pipe.Exporters = append(pipe.Exporters, component.MustNewIDWithName("nop", "2")) return cfg }, @@ -185,7 +187,7 @@ func TestConfigValidate(t *testing.T) { cfg := generateConfig() cfg.Receivers[component.MustNewID("nop2")] = &errConfig{} cfg.Connectors[component.MustNewID("nop2")] = &errConfig{} - pipe := cfg.Service.Pipelines[component.MustNewID("traces")] + pipe := cfg.Service.PipelinesWithPipelineID[pipeline.MustNewID("traces")] pipe.Receivers = append(pipe.Receivers, component.MustNewIDWithName("nop", "2")) pipe.Exporters = append(pipe.Exporters, component.MustNewIDWithName("nop", "2")) return cfg @@ -198,7 +200,7 @@ func TestConfigValidate(t *testing.T) { cfg := generateConfig() cfg.Exporters[component.MustNewID("nop2")] = &errConfig{} cfg.Connectors[component.MustNewID("nop2")] = &errConfig{} - pipe := cfg.Service.Pipelines[component.MustNewID("traces")] + pipe := cfg.Service.PipelinesWithPipelineID[pipeline.MustNewID("traces")] pipe.Receivers = append(pipe.Receivers, component.MustNewIDWithName("nop", "2")) pipe.Exporters = append(pipe.Exporters, component.MustNewIDWithName("nop", "2")) return cfg @@ -209,7 +211,7 @@ func TestConfigValidate(t *testing.T) { name: "invalid-connector-reference-as-receiver", cfgFn: func() *Config { cfg := generateConfig() - pipe := cfg.Service.Pipelines[component.MustNewID("traces")] + pipe := cfg.Service.PipelinesWithPipelineID[pipeline.MustNewID("traces")] pipe.Receivers = append(pipe.Receivers, component.MustNewIDWithName("nop", "conn2")) return cfg }, @@ -219,7 +221,7 @@ func TestConfigValidate(t *testing.T) { name: "invalid-connector-reference-as-receiver", cfgFn: func() *Config { cfg := generateConfig() - pipe := cfg.Service.Pipelines[component.MustNewID("traces")] + pipe := cfg.Service.PipelinesWithPipelineID[pipeline.MustNewID("traces")] pipe.Exporters = append(pipe.Exporters, component.MustNewIDWithName("nop", "conn2")) return cfg }, @@ -229,7 +231,7 @@ func TestConfigValidate(t *testing.T) { name: "invalid-service-config", cfgFn: func() *Config { cfg := generateConfig() - cfg.Service.Pipelines = nil + cfg.Service.PipelinesWithPipelineID = nil return cfg }, expected: fmt.Errorf(`service::pipelines config validation failed: %w`, errors.New(`service must have at least one pipeline`)), @@ -274,13 +276,22 @@ func generateConfig() *Config { InitialFields: map[string]any{"fieldKey": "filed-value"}, }, Metrics: telemetry.MetricsConfig{ - Level: configtelemetry.LevelNormal, - Address: ":8080", + Level: configtelemetry.LevelNormal, + Readers: []config.MetricReader{ + { + Pull: &config.PullMetricReader{Exporter: config.MetricExporter{ + Prometheus: &config.Prometheus{ + Host: newPtr("localhost"), + Port: newPtr(8080), + }, + }}, + }, + }, }, }, Extensions: []component.ID{component.MustNewID("nop")}, - Pipelines: pipelines.Config{ - component.MustNewID("traces"): { + PipelinesWithPipelineID: pipelines.ConfigWithPipelineID{ + pipeline.MustNewID("traces"): { Receivers: []component.ID{component.MustNewID("nop")}, Processors: []component.ID{component.MustNewID("nop")}, Exporters: []component.ID{component.MustNewID("nop")}, @@ -289,3 +300,7 @@ func generateConfig() *Config { }, } } + +func newPtr[T int | string](str T) *T { + return &str +} diff --git a/otelcol/factories_test.go b/otelcol/factories_test.go index 19d6fe6accc..fb0b67d1402 100644 --- a/otelcol/factories_test.go +++ b/otelcol/factories_test.go @@ -11,6 +11,7 @@ import ( "go.opentelemetry.io/collector/exporter/exportertest" "go.opentelemetry.io/collector/extension" "go.opentelemetry.io/collector/extension/extensiontest" + "go.opentelemetry.io/collector/pipeline" "go.opentelemetry.io/collector/processor" "go.opentelemetry.io/collector/processor/processortest" "go.opentelemetry.io/collector/receiver" @@ -37,7 +38,7 @@ func nopFactories() (Factories, error) { factories.ExtensionModules[ext.Type()] = "go.opentelemetry.io/collector/extension/extensiontest v1.2.3" } - if factories.Receivers, err = receiver.MakeFactoryMap(receivertest.NewNopFactory(), receivertest.NewNopFactoryForType(component.DataTypeLogs)); err != nil { + if factories.Receivers, err = receiver.MakeFactoryMap(receivertest.NewNopFactory(), receivertest.NewNopFactoryForTypeWithSignal(pipeline.SignalLogs)); err != nil { return Factories{}, err } factories.ReceiverModules = make(map[component.Type]string, len(factories.Receivers)) diff --git a/otelcol/go.mod b/otelcol/go.mod index 449265ef8e1..685d785e5ed 100644 --- a/otelcol/go.mod +++ b/otelcol/go.mod @@ -5,23 +5,25 @@ 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.109.0 - go.opentelemetry.io/collector/component/componentstatus v0.109.0 - go.opentelemetry.io/collector/config/configtelemetry v0.109.0 - go.opentelemetry.io/collector/confmap v1.15.0 - go.opentelemetry.io/collector/connector v0.109.0 - go.opentelemetry.io/collector/exporter v0.109.0 - go.opentelemetry.io/collector/extension v0.109.0 - go.opentelemetry.io/collector/featuregate v1.15.0 - go.opentelemetry.io/collector/processor v0.109.0 - go.opentelemetry.io/collector/receiver v0.109.0 - go.opentelemetry.io/collector/service v0.109.0 + go.opentelemetry.io/collector/component v0.110.0 + go.opentelemetry.io/collector/component/componentstatus v0.110.0 + go.opentelemetry.io/collector/config/configtelemetry v0.110.0 + go.opentelemetry.io/collector/confmap v1.16.0 + go.opentelemetry.io/collector/connector v0.110.0 + go.opentelemetry.io/collector/exporter v0.110.0 + go.opentelemetry.io/collector/extension v0.110.0 + go.opentelemetry.io/collector/featuregate v1.16.0 + go.opentelemetry.io/collector/pipeline v0.110.0 + go.opentelemetry.io/collector/processor v0.110.0 + go.opentelemetry.io/collector/receiver v0.110.0 + go.opentelemetry.io/collector/service v0.110.0 + go.opentelemetry.io/contrib/config v0.10.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.25.0 - google.golang.org/grpc v1.66.2 + google.golang.org/grpc v1.67.0 gopkg.in/yaml.v3 v3.0.1 ) @@ -40,7 +42,7 @@ require ( 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/klauspost/compress v1.17.10 // 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 @@ -62,22 +64,22 @@ 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.109.0 // indirect - go.opentelemetry.io/collector/component/componentprofiles v0.109.0 // indirect - go.opentelemetry.io/collector/connector/connectorprofiles v0.109.0 // indirect - go.opentelemetry.io/collector/consumer v0.109.0 // indirect - go.opentelemetry.io/collector/consumer/consumerprofiles v0.109.0 // indirect - go.opentelemetry.io/collector/consumer/consumertest v0.109.0 // indirect - go.opentelemetry.io/collector/exporter/exporterprofiles v0.109.0 // indirect - go.opentelemetry.io/collector/extension/extensioncapabilities v0.109.0 // indirect - go.opentelemetry.io/collector/internal/globalgates v0.109.0 // indirect - go.opentelemetry.io/collector/pdata v1.15.0 // indirect - go.opentelemetry.io/collector/pdata/pprofile v0.109.0 // indirect - go.opentelemetry.io/collector/pdata/testdata v0.109.0 // indirect - go.opentelemetry.io/collector/processor/processorprofiles v0.109.0 // indirect - go.opentelemetry.io/collector/receiver/receiverprofiles v0.109.0 // indirect - go.opentelemetry.io/collector/semconv v0.109.0 // indirect - go.opentelemetry.io/contrib/config v0.10.0 // indirect + go.opentelemetry.io/collector v0.110.0 // indirect + go.opentelemetry.io/collector/component/componentprofiles v0.110.0 // indirect + go.opentelemetry.io/collector/connector/connectorprofiles v0.110.0 // indirect + go.opentelemetry.io/collector/consumer v0.110.0 // indirect + go.opentelemetry.io/collector/consumer/consumerprofiles v0.110.0 // indirect + go.opentelemetry.io/collector/consumer/consumertest v0.110.0 // indirect + go.opentelemetry.io/collector/exporter/exporterprofiles v0.110.0 // indirect + go.opentelemetry.io/collector/extension/extensioncapabilities v0.110.0 // indirect + go.opentelemetry.io/collector/internal/globalgates v0.110.0 // indirect + go.opentelemetry.io/collector/internal/globalsignal v0.110.0 // indirect + go.opentelemetry.io/collector/pdata v1.16.0 // indirect + go.opentelemetry.io/collector/pdata/pprofile v0.110.0 // indirect + go.opentelemetry.io/collector/pdata/testdata v0.110.0 // indirect + go.opentelemetry.io/collector/processor/processorprofiles v0.110.0 // indirect + go.opentelemetry.io/collector/receiver/receiverprofiles v0.110.0 // indirect + go.opentelemetry.io/collector/semconv v0.110.0 // indirect go.opentelemetry.io/contrib/propagators/b3 v1.30.0 // indirect go.opentelemetry.io/otel v1.30.0 // indirect go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp v0.6.0 // indirect @@ -178,3 +180,7 @@ replace go.opentelemetry.io/collector/processor/processorprofiles => ../processo replace go.opentelemetry.io/collector/connector/connectorprofiles => ../connector/connectorprofiles replace go.opentelemetry.io/collector/exporter/exporterprofiles => ../exporter/exporterprofiles + +replace go.opentelemetry.io/collector/pipeline => ../pipeline + +replace go.opentelemetry.io/collector/internal/globalsignal => ../internal/globalsignal diff --git a/otelcol/go.sum b/otelcol/go.sum index 0a2b3b976b8..bef55f1b14a 100644 --- a/otelcol/go.sum +++ b/otelcol/go.sum @@ -41,8 +41,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/klauspost/compress v1.17.10 h1:oXAz+Vh0PMUvJczoi+flxpnBEPxoER1IaAnU/NMPtT0= +github.com/klauspost/compress v1.17.10/go.mod h1:pMDklpSncoRMuLFrf1W9Ss9KT+0rH90U12bZKk7uwG0= 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= @@ -200,8 +200,8 @@ google.golang.org/genproto/googleapis/api v0.0.0-20240903143218-8af14fe29dc1 h1: google.golang.org/genproto/googleapis/api v0.0.0-20240903143218-8af14fe29dc1/go.mod h1:qpvKtACPCQhAdu3PyQgV4l3LMXZEtft7y8QcarRsp9I= google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1 h1:pPJltXNxVzT4pK9yD8vR9X75DaWYYmLGMsEvBfFQZzQ= google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU= -google.golang.org/grpc v1.66.2 h1:3QdXkuq3Bkh7w+ywLdLvM56cmGvQHUMZpiCzt6Rqaoo= -google.golang.org/grpc v1.66.2/go.mod h1:s3/l6xSSCURdVfAnL+TqCNMyTDAGN6+lZeVxnZR128Y= +google.golang.org/grpc v1.67.0 h1:IdH9y6PF5MPSdAntIcpjQ+tXO41pcQsfZV2RxtQgVcw= +google.golang.org/grpc v1.67.0/go.mod h1:1gLDyUQU7CTLJI90u3nXZ9ekeghjeM7pTDZlqFNg2AA= google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/otelcol/otelcoltest/config_test.go b/otelcol/otelcoltest/config_test.go index ba259ddc663..94d8c616e94 100644 --- a/otelcol/otelcoltest/config_test.go +++ b/otelcol/otelcoltest/config_test.go @@ -11,6 +11,7 @@ import ( "github.com/stretchr/testify/require" "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/pipeline" "go.opentelemetry.io/collector/service/pipelines" ) @@ -48,14 +49,14 @@ func TestLoadConfig(t *testing.T) { // Verify service. require.Len(t, cfg.Service.Extensions, 1) assert.Contains(t, cfg.Service.Extensions, component.MustNewID("nop")) - require.Len(t, cfg.Service.Pipelines, 1) + require.Len(t, cfg.Service.PipelinesWithPipelineID, 1) assert.Equal(t, &pipelines.PipelineConfig{ Receivers: []component.ID{component.MustNewID("nop")}, Processors: []component.ID{component.MustNewID("nop")}, Exporters: []component.ID{component.MustNewID("nop")}, }, - cfg.Service.Pipelines[component.MustNewID("traces")], + cfg.Service.PipelinesWithPipelineID[pipeline.MustNewID("traces")], "Did not load pipeline config correctly") } diff --git a/otelcol/otelcoltest/go.mod b/otelcol/otelcoltest/go.mod index c971bd377bb..1a3cc5422dc 100644 --- a/otelcol/otelcoltest/go.mod +++ b/otelcol/otelcoltest/go.mod @@ -4,19 +4,20 @@ go 1.22.0 require ( github.com/stretchr/testify v1.9.0 - go.opentelemetry.io/collector/component v0.109.0 - go.opentelemetry.io/collector/confmap v1.15.0 - go.opentelemetry.io/collector/confmap/provider/envprovider v1.15.0 - go.opentelemetry.io/collector/confmap/provider/fileprovider v1.15.0 - go.opentelemetry.io/collector/confmap/provider/httpprovider v0.109.0 - go.opentelemetry.io/collector/confmap/provider/yamlprovider v0.109.0 - go.opentelemetry.io/collector/connector v0.109.0 - go.opentelemetry.io/collector/exporter v0.109.0 - go.opentelemetry.io/collector/extension v0.109.0 - go.opentelemetry.io/collector/otelcol v0.109.0 - go.opentelemetry.io/collector/processor v0.109.0 - go.opentelemetry.io/collector/receiver v0.109.0 - go.opentelemetry.io/collector/service v0.109.0 + go.opentelemetry.io/collector/component v0.110.0 + go.opentelemetry.io/collector/confmap v1.16.0 + go.opentelemetry.io/collector/confmap/provider/envprovider v1.16.0 + go.opentelemetry.io/collector/confmap/provider/fileprovider v1.16.0 + go.opentelemetry.io/collector/confmap/provider/httpprovider v0.110.0 + go.opentelemetry.io/collector/confmap/provider/yamlprovider v0.110.0 + go.opentelemetry.io/collector/connector v0.110.0 + go.opentelemetry.io/collector/exporter v0.110.0 + go.opentelemetry.io/collector/extension v0.110.0 + go.opentelemetry.io/collector/otelcol v0.110.0 + go.opentelemetry.io/collector/pipeline v0.110.0 + go.opentelemetry.io/collector/processor v0.110.0 + go.opentelemetry.io/collector/receiver v0.110.0 + go.opentelemetry.io/collector/service v0.110.0 go.uber.org/goleak v1.3.0 ) @@ -35,7 +36,7 @@ require ( 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/klauspost/compress v1.17.10 // 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 @@ -58,24 +59,25 @@ 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.109.0 // indirect - go.opentelemetry.io/collector/component/componentprofiles v0.109.0 // indirect - go.opentelemetry.io/collector/component/componentstatus v0.109.0 // indirect - go.opentelemetry.io/collector/config/configtelemetry v0.109.0 // indirect - go.opentelemetry.io/collector/connector/connectorprofiles v0.109.0 // indirect - go.opentelemetry.io/collector/consumer v0.109.0 // indirect - go.opentelemetry.io/collector/consumer/consumerprofiles v0.109.0 // indirect - go.opentelemetry.io/collector/consumer/consumertest v0.109.0 // indirect - go.opentelemetry.io/collector/exporter/exporterprofiles v0.109.0 // indirect - go.opentelemetry.io/collector/extension/extensioncapabilities v0.109.0 // indirect - go.opentelemetry.io/collector/featuregate v1.15.0 // indirect - go.opentelemetry.io/collector/internal/globalgates v0.109.0 // indirect - go.opentelemetry.io/collector/pdata v1.15.0 // indirect - go.opentelemetry.io/collector/pdata/pprofile v0.109.0 // indirect - go.opentelemetry.io/collector/pdata/testdata v0.109.0 // indirect - go.opentelemetry.io/collector/processor/processorprofiles v0.109.0 // indirect - go.opentelemetry.io/collector/receiver/receiverprofiles v0.109.0 // indirect - go.opentelemetry.io/collector/semconv v0.109.0 // indirect + go.opentelemetry.io/collector v0.110.0 // indirect + go.opentelemetry.io/collector/component/componentprofiles v0.110.0 // indirect + go.opentelemetry.io/collector/component/componentstatus v0.110.0 // indirect + go.opentelemetry.io/collector/config/configtelemetry v0.110.0 // indirect + go.opentelemetry.io/collector/connector/connectorprofiles v0.110.0 // indirect + go.opentelemetry.io/collector/consumer v0.110.0 // indirect + go.opentelemetry.io/collector/consumer/consumerprofiles v0.110.0 // indirect + go.opentelemetry.io/collector/consumer/consumertest v0.110.0 // indirect + go.opentelemetry.io/collector/exporter/exporterprofiles v0.110.0 // indirect + go.opentelemetry.io/collector/extension/extensioncapabilities v0.110.0 // indirect + go.opentelemetry.io/collector/featuregate v1.16.0 // indirect + go.opentelemetry.io/collector/internal/globalgates v0.110.0 // indirect + go.opentelemetry.io/collector/internal/globalsignal v0.110.0 // indirect + go.opentelemetry.io/collector/pdata v1.16.0 // indirect + go.opentelemetry.io/collector/pdata/pprofile v0.110.0 // indirect + go.opentelemetry.io/collector/pdata/testdata v0.110.0 // indirect + go.opentelemetry.io/collector/processor/processorprofiles v0.110.0 // indirect + go.opentelemetry.io/collector/receiver/receiverprofiles v0.110.0 // indirect + go.opentelemetry.io/collector/semconv v0.110.0 // indirect go.opentelemetry.io/contrib/config v0.10.0 // indirect go.opentelemetry.io/contrib/propagators/b3 v1.30.0 // indirect go.opentelemetry.io/otel v1.30.0 // indirect @@ -105,7 +107,7 @@ require ( gonum.org/v1/gonum v0.15.1 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20240903143218-8af14fe29dc1 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1 // indirect - google.golang.org/grpc v1.66.2 // indirect + google.golang.org/grpc v1.67.0 // indirect google.golang.org/protobuf v1.34.2 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) @@ -193,3 +195,7 @@ replace go.opentelemetry.io/collector/processor/processorprofiles => ../../proce replace go.opentelemetry.io/collector/connector/connectorprofiles => ../../connector/connectorprofiles replace go.opentelemetry.io/collector/exporter/exporterprofiles => ../../exporter/exporterprofiles + +replace go.opentelemetry.io/collector/pipeline => ../../pipeline + +replace go.opentelemetry.io/collector/internal/globalsignal => ../../internal/globalsignal diff --git a/otelcol/otelcoltest/go.sum b/otelcol/otelcoltest/go.sum index 0a2b3b976b8..bef55f1b14a 100644 --- a/otelcol/otelcoltest/go.sum +++ b/otelcol/otelcoltest/go.sum @@ -41,8 +41,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/klauspost/compress v1.17.10 h1:oXAz+Vh0PMUvJczoi+flxpnBEPxoER1IaAnU/NMPtT0= +github.com/klauspost/compress v1.17.10/go.mod h1:pMDklpSncoRMuLFrf1W9Ss9KT+0rH90U12bZKk7uwG0= 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= @@ -200,8 +200,8 @@ google.golang.org/genproto/googleapis/api v0.0.0-20240903143218-8af14fe29dc1 h1: google.golang.org/genproto/googleapis/api v0.0.0-20240903143218-8af14fe29dc1/go.mod h1:qpvKtACPCQhAdu3PyQgV4l3LMXZEtft7y8QcarRsp9I= google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1 h1:pPJltXNxVzT4pK9yD8vR9X75DaWYYmLGMsEvBfFQZzQ= google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU= -google.golang.org/grpc v1.66.2 h1:3QdXkuq3Bkh7w+ywLdLvM56cmGvQHUMZpiCzt6Rqaoo= -google.golang.org/grpc v1.66.2/go.mod h1:s3/l6xSSCURdVfAnL+TqCNMyTDAGN6+lZeVxnZR128Y= +google.golang.org/grpc v1.67.0 h1:IdH9y6PF5MPSdAntIcpjQ+tXO41pcQsfZV2RxtQgVcw= +google.golang.org/grpc v1.67.0/go.mod h1:1gLDyUQU7CTLJI90u3nXZ9ekeghjeM7pTDZlqFNg2AA= google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/otelcol/testdata/otelcol-noaddress.yaml b/otelcol/testdata/otelcol-emptyreaders.yaml similarity index 88% rename from otelcol/testdata/otelcol-noaddress.yaml rename to otelcol/testdata/otelcol-emptyreaders.yaml index c363f848e53..3a71b541f1a 100644 --- a/otelcol/testdata/otelcol-noaddress.yaml +++ b/otelcol/testdata/otelcol-emptyreaders.yaml @@ -7,7 +7,7 @@ exporters: service: telemetry: metrics: - address: "" + readers: [] pipelines: metrics: receivers: [nop] diff --git a/otelcol/testdata/otelcol-invalid-receiver-type.yaml b/otelcol/testdata/otelcol-invalid-receiver-type.yaml index 5837810fcca..7bcad410bb9 100644 --- a/otelcol/testdata/otelcol-invalid-receiver-type.yaml +++ b/otelcol/testdata/otelcol-invalid-receiver-type.yaml @@ -10,7 +10,12 @@ exporters: service: telemetry: metrics: - address: localhost:8888 + readers: + - pull: + exporter: + prometheus: + host: "localhost" + port: 8888 pipelines: traces: receivers: [nop_logs] diff --git a/otelcol/testdata/otelcol-invalid.yaml b/otelcol/testdata/otelcol-invalid.yaml index 133ce74d85b..dc48aee782f 100644 --- a/otelcol/testdata/otelcol-invalid.yaml +++ b/otelcol/testdata/otelcol-invalid.yaml @@ -10,7 +10,12 @@ exporters: service: telemetry: metrics: - address: localhost:8888 + readers: + - pull: + exporter: + prometheus: + host: "localhost" + port: 8888 pipelines: traces: receivers: [nop] diff --git a/otelcol/testdata/otelcol-invalidprop.yaml b/otelcol/testdata/otelcol-invalidprop.yaml index c84fbdbd017..4022c90cbea 100644 --- a/otelcol/testdata/otelcol-invalidprop.yaml +++ b/otelcol/testdata/otelcol-invalidprop.yaml @@ -14,7 +14,12 @@ service: - "unknown" - "tracecontext" metrics: - address: localhost:8888 + readers: + - pull: + exporter: + prometheus: + host: "localhost" + port: 8888 pipelines: traces: receivers: [nop] diff --git a/otelcol/testdata/otelcol-nop.yaml b/otelcol/testdata/otelcol-nop.yaml index c83a07c536c..3d361b0afdd 100644 --- a/otelcol/testdata/otelcol-nop.yaml +++ b/otelcol/testdata/otelcol-nop.yaml @@ -16,7 +16,12 @@ connectors: service: telemetry: metrics: - address: localhost:8888 + readers: + - pull: + exporter: + prometheus: + host: "localhost" + port: 8888 extensions: [nop] pipelines: traces: diff --git a/otelcol/testdata/otelcol-nometrics.yaml b/otelcol/testdata/otelcol-noreaders.yaml similarity index 100% rename from otelcol/testdata/otelcol-nometrics.yaml rename to otelcol/testdata/otelcol-noreaders.yaml diff --git a/otelcol/testdata/otelcol-statuswatcher.yaml b/otelcol/testdata/otelcol-statuswatcher.yaml index 2dcc322d341..90970a234d7 100644 --- a/otelcol/testdata/otelcol-statuswatcher.yaml +++ b/otelcol/testdata/otelcol-statuswatcher.yaml @@ -14,7 +14,12 @@ extensions: service: telemetry: metrics: - address: localhost:8888 + readers: + - pull: + exporter: + prometheus: + host: "localhost" + port: 8888 extensions: [statuswatcher] pipelines: traces: diff --git a/otelcol/testdata/otelcol-validprop.yaml b/otelcol/testdata/otelcol-validprop.yaml index 5c611333c17..1d478cabae9 100644 --- a/otelcol/testdata/otelcol-validprop.yaml +++ b/otelcol/testdata/otelcol-validprop.yaml @@ -14,7 +14,12 @@ service: - "b3" - "tracecontext" metrics: - address: localhost:8888 + readers: + - pull: + exporter: + prometheus: + host: "localhost" + port: 8888 pipelines: traces: receivers: [nop] diff --git a/otelcol/unmarshaler_test.go b/otelcol/unmarshaler_test.go index 3885abc38dc..9fdb0832491 100644 --- a/otelcol/unmarshaler_test.go +++ b/otelcol/unmarshaler_test.go @@ -134,7 +134,7 @@ func TestPipelineConfigUnmarshalError(t *testing.T) { for _, tt := range testCases { t.Run(tt.name, func(t *testing.T) { - pips := new(pipelines.Config) + pips := new(pipelines.ConfigWithPipelineID) err := tt.conf.Unmarshal(&pips) require.Error(t, err) assert.Contains(t, err.Error(), tt.expectError) @@ -159,7 +159,7 @@ func TestServiceUnmarshalError(t *testing.T) { }, }, }), - expectError: "error decoding 'telemetry.logs.level': unrecognized level: \"UNKNOWN\"", + expectError: "error decoding 'telemetry': decoding failed due to the following error(s):\n\nerror decoding 'logs.level': unrecognized level: \"UNKNOWN\"", }, { name: "invalid-metrics-level", @@ -170,7 +170,7 @@ func TestServiceUnmarshalError(t *testing.T) { }, }, }), - expectError: "error decoding 'telemetry.metrics.level': unknown metrics level \"unknown\"", + expectError: "error decoding 'telemetry': decoding failed due to the following error(s):\n\nerror decoding 'metrics.level': unknown metrics level \"unknown\"", }, { name: "invalid-service-extensions-section", @@ -204,8 +204,7 @@ func TestServiceUnmarshalError(t *testing.T) { for _, tt := range testCases { t.Run(tt.name, func(t *testing.T) { err := tt.conf.Unmarshal(&service.Config{}) - require.Error(t, err) - assert.Contains(t, err.Error(), tt.expectError) + require.ErrorContains(t, err, tt.expectError) }) } } diff --git a/pdata/go.mod b/pdata/go.mod index a42f31e4af1..2a696920b56 100644 --- a/pdata/go.mod +++ b/pdata/go.mod @@ -8,7 +8,7 @@ require ( github.com/stretchr/testify v1.9.0 go.uber.org/goleak v1.3.0 go.uber.org/multierr v1.11.0 - google.golang.org/grpc v1.66.2 + google.golang.org/grpc v1.67.0 google.golang.org/protobuf v1.34.2 ) @@ -19,10 +19,10 @@ require ( github.com/modern-go/reflect2 v1.0.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/rogpeppe/go-internal v1.10.0 // indirect - golang.org/x/net v0.26.0 // indirect - golang.org/x/sys v0.21.0 // indirect - golang.org/x/text v0.16.0 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20240604185151-ef581f913117 // indirect + golang.org/x/net v0.28.0 // indirect + golang.org/x/sys v0.24.0 // indirect + golang.org/x/text v0.17.0 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240814211410-ddb44dafa142 // indirect gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/pdata/go.sum b/pdata/go.sum index 0ffcc32800c..7f02dae99f6 100644 --- a/pdata/go.sum +++ b/pdata/go.sum @@ -48,20 +48,20 @@ golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.26.0 h1:soB7SVo0PWrY4vPW/+ay0jKDNScG2X9wFeYlXIvJsOQ= -golang.org/x/net v0.26.0/go.mod h1:5YKkiSynbBIh3p6iOc/vibscux0x38BZDkn8sCUPxHE= +golang.org/x/net v0.28.0 h1:a9JDOJc5GMUJ0+UDqmLT86WiEy7iWyIhz8gz8E4e5hE= +golang.org/x/net v0.28.0/go.mod h1:yqtgsTWOOnlGLG9GFRrK3++bGOUEkNBoHZc8MEDWPNg= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.21.0 h1:rF+pYz3DAGSQAxAu1CbC7catZg4ebC4UIeIhKxBZvws= -golang.org/x/sys v0.21.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= -golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI= +golang.org/x/text v0.17.0 h1:XtiM5bkSOt+ewxlOE/aE/AKEHibwj/6gvWMl9Rsh0Qc= +golang.org/x/text v0.17.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= @@ -70,10 +70,10 @@ 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= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240604185151-ef581f913117 h1:1GBuWVLM/KMVUv1t1En5Gs+gFZCNd360GGb4sSxtrhU= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240604185151-ef581f913117/go.mod h1:EfXuqaE1J41VCDicxHzUDm+8rk+7ZdXzHV0IhO/I6s0= -google.golang.org/grpc v1.66.2 h1:3QdXkuq3Bkh7w+ywLdLvM56cmGvQHUMZpiCzt6Rqaoo= -google.golang.org/grpc v1.66.2/go.mod h1:s3/l6xSSCURdVfAnL+TqCNMyTDAGN6+lZeVxnZR128Y= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240814211410-ddb44dafa142 h1:e7S5W7MGGLaSu8j3YjdezkZ+m1/Nm0uRVRMEMGk26Xs= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240814211410-ddb44dafa142/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU= +google.golang.org/grpc v1.67.0 h1:IdH9y6PF5MPSdAntIcpjQ+tXO41pcQsfZV2RxtQgVcw= +google.golang.org/grpc v1.67.0/go.mod h1:1gLDyUQU7CTLJI90u3nXZ9ekeghjeM7pTDZlqFNg2AA= google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/pdata/pprofile/go.mod b/pdata/pprofile/go.mod index 1db7208e1ee..d22399e1a00 100644 --- a/pdata/pprofile/go.mod +++ b/pdata/pprofile/go.mod @@ -5,9 +5,9 @@ go 1.22.0 require ( github.com/json-iterator/go v1.1.12 github.com/stretchr/testify v1.9.0 - go.opentelemetry.io/collector/pdata v1.15.0 + go.opentelemetry.io/collector/pdata v1.16.0 go.uber.org/goleak v1.3.0 - google.golang.org/grpc v1.66.2 + google.golang.org/grpc v1.67.0 ) require ( @@ -18,10 +18,10 @@ require ( github.com/modern-go/reflect2 v1.0.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect go.uber.org/multierr v1.11.0 // indirect - golang.org/x/net v0.26.0 // indirect - golang.org/x/sys v0.21.0 // indirect - golang.org/x/text v0.16.0 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20240604185151-ef581f913117 // indirect + golang.org/x/net v0.28.0 // indirect + golang.org/x/sys v0.24.0 // indirect + golang.org/x/text v0.17.0 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240814211410-ddb44dafa142 // indirect google.golang.org/protobuf v1.34.2 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/pdata/pprofile/go.sum b/pdata/pprofile/go.sum index b0aa8e858e7..4a35b87c763 100644 --- a/pdata/pprofile/go.sum +++ b/pdata/pprofile/go.sum @@ -43,20 +43,20 @@ golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.26.0 h1:soB7SVo0PWrY4vPW/+ay0jKDNScG2X9wFeYlXIvJsOQ= -golang.org/x/net v0.26.0/go.mod h1:5YKkiSynbBIh3p6iOc/vibscux0x38BZDkn8sCUPxHE= +golang.org/x/net v0.28.0 h1:a9JDOJc5GMUJ0+UDqmLT86WiEy7iWyIhz8gz8E4e5hE= +golang.org/x/net v0.28.0/go.mod h1:yqtgsTWOOnlGLG9GFRrK3++bGOUEkNBoHZc8MEDWPNg= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.21.0 h1:rF+pYz3DAGSQAxAu1CbC7catZg4ebC4UIeIhKxBZvws= -golang.org/x/sys v0.21.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= -golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI= +golang.org/x/text v0.17.0 h1:XtiM5bkSOt+ewxlOE/aE/AKEHibwj/6gvWMl9Rsh0Qc= +golang.org/x/text v0.17.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= @@ -65,10 +65,10 @@ 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= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240604185151-ef581f913117 h1:1GBuWVLM/KMVUv1t1En5Gs+gFZCNd360GGb4sSxtrhU= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240604185151-ef581f913117/go.mod h1:EfXuqaE1J41VCDicxHzUDm+8rk+7ZdXzHV0IhO/I6s0= -google.golang.org/grpc v1.66.2 h1:3QdXkuq3Bkh7w+ywLdLvM56cmGvQHUMZpiCzt6Rqaoo= -google.golang.org/grpc v1.66.2/go.mod h1:s3/l6xSSCURdVfAnL+TqCNMyTDAGN6+lZeVxnZR128Y= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240814211410-ddb44dafa142 h1:e7S5W7MGGLaSu8j3YjdezkZ+m1/Nm0uRVRMEMGk26Xs= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240814211410-ddb44dafa142/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU= +google.golang.org/grpc v1.67.0 h1:IdH9y6PF5MPSdAntIcpjQ+tXO41pcQsfZV2RxtQgVcw= +google.golang.org/grpc v1.67.0/go.mod h1:1gLDyUQU7CTLJI90u3nXZ9ekeghjeM7pTDZlqFNg2AA= google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/pdata/ptrace/json.go b/pdata/ptrace/json.go index 64bd273ba96..2e35a95913a 100644 --- a/pdata/ptrace/json.go +++ b/pdata/ptrace/json.go @@ -112,6 +112,8 @@ func (dest Span) unmarshalJsoniter(iter *jsoniter.Iterator) { if err := dest.orig.ParentSpanId.UnmarshalJSON([]byte(iter.ReadString())); err != nil { iter.ReportError("readSpan.parentSpanId", fmt.Sprintf("parse parent_span_id:%v", err)) } + case "flags": + dest.orig.Flags = json.ReadUint32(iter) case "name": dest.orig.Name = iter.ReadString() case "kind": @@ -184,6 +186,8 @@ func (dest SpanLink) unmarshalJsoniter(iter *jsoniter.Iterator) { }) case "droppedAttributesCount", "dropped_attributes_count": dest.orig.DroppedAttributesCount = json.ReadUint32(iter) + case "flags": + dest.orig.Flags = json.ReadUint32(iter) default: iter.Skip() } diff --git a/pdata/ptrace/json_test.go b/pdata/ptrace/json_test.go index e0441760800..1be7d0061c0 100644 --- a/pdata/ptrace/json_test.go +++ b/pdata/ptrace/json_test.go @@ -37,6 +37,7 @@ var tracesOTLP = func() Traces { il.SetSchemaUrl("schemaURL") // Add spans. sp := il.Spans().AppendEmpty() + sp.SetFlags(1) sp.SetName("testSpan") sp.SetKind(SpanKindClient) sp.SetDroppedAttributesCount(1) @@ -83,13 +84,14 @@ var tracesOTLP = func() Traces { link.Attributes().PutInt("int", 1) link.Attributes().PutDouble("double", 1.1) link.Attributes().PutEmptyBytes("bytes").FromRaw([]byte("foo")) + link.SetFlags(1) // Add another span. sp2 := il.Spans().AppendEmpty() sp2.SetName("testSpan2") return td }() -var tracesJSON = `{"resourceSpans":[{"resource":{"attributes":[{"key":"host.name","value":{"stringValue":"testHost"}},{"key":"service.name","value":{"stringValue":"testService"}}],"droppedAttributesCount":1},"scopeSpans":[{"scope":{"name":"scope name","version":"scope version"},"spans":[{"traceId":"0102030405060708090a0b0c0d0e0f10","spanId":"1112131415161718","traceState":"state","parentSpanId":"1112131415161718","name":"testSpan","kind":3,"startTimeUnixNano":"1684617382541971000","endTimeUnixNano":"1684623646539558000","attributes":[{"key":"string","value":{"stringValue":"value"}},{"key":"bool","value":{"boolValue":true}},{"key":"int","value":{"intValue":"1"}},{"key":"double","value":{"doubleValue":1.1}},{"key":"bytes","value":{"bytesValue":"Zm9v"}},{"key":"array","value":{"arrayValue":{"values":[{"intValue":"1"},{"stringValue":"str"}]}}},{"key":"kvList","value":{"kvlistValue":{"values":[{"key":"int","value":{"intValue":"1"}},{"key":"string","value":{"stringValue":"string"}}]}}}],"droppedAttributesCount":1,"events":[{"timeUnixNano":"1684620382541971000","name":"eventName","attributes":[{"key":"string","value":{"stringValue":"value"}},{"key":"bool","value":{"boolValue":true}},{"key":"int","value":{"intValue":"1"}},{"key":"double","value":{"doubleValue":1.1}},{"key":"bytes","value":{"bytesValue":"Zm9v"}}],"droppedAttributesCount":1}],"droppedEventsCount":1,"links":[{"traceId":"0102030405060708090a0b0c0d0e0f10","spanId":"1112131415161718","traceState":"state","attributes":[{"key":"string","value":{"stringValue":"value"}},{"key":"bool","value":{"boolValue":true}},{"key":"int","value":{"intValue":"1"}},{"key":"double","value":{"doubleValue":1.1}},{"key":"bytes","value":{"bytesValue":"Zm9v"}}],"droppedAttributesCount":1}],"droppedLinksCount":1,"status":{"message":"message","code":1}},{"traceId":"","spanId":"","parentSpanId":"","name":"testSpan2","status":{}}],"schemaUrl":"schemaURL"}],"schemaUrl":"schemaURL"}]}` +var tracesJSON = `{"resourceSpans":[{"resource":{"attributes":[{"key":"host.name","value":{"stringValue":"testHost"}},{"key":"service.name","value":{"stringValue":"testService"}}],"droppedAttributesCount":1},"scopeSpans":[{"scope":{"name":"scope name","version":"scope version"},"spans":[{"traceId":"0102030405060708090a0b0c0d0e0f10","spanId":"1112131415161718","traceState":"state","parentSpanId":"1112131415161718","flags":1,"name":"testSpan","kind":3,"startTimeUnixNano":"1684617382541971000","endTimeUnixNano":"1684623646539558000","attributes":[{"key":"string","value":{"stringValue":"value"}},{"key":"bool","value":{"boolValue":true}},{"key":"int","value":{"intValue":"1"}},{"key":"double","value":{"doubleValue":1.1}},{"key":"bytes","value":{"bytesValue":"Zm9v"}},{"key":"array","value":{"arrayValue":{"values":[{"intValue":"1"},{"stringValue":"str"}]}}},{"key":"kvList","value":{"kvlistValue":{"values":[{"key":"int","value":{"intValue":"1"}},{"key":"string","value":{"stringValue":"string"}}]}}}],"droppedAttributesCount":1,"events":[{"timeUnixNano":"1684620382541971000","name":"eventName","attributes":[{"key":"string","value":{"stringValue":"value"}},{"key":"bool","value":{"boolValue":true}},{"key":"int","value":{"intValue":"1"}},{"key":"double","value":{"doubleValue":1.1}},{"key":"bytes","value":{"bytesValue":"Zm9v"}}],"droppedAttributesCount":1}],"droppedEventsCount":1,"links":[{"traceId":"0102030405060708090a0b0c0d0e0f10","spanId":"1112131415161718","traceState":"state","attributes":[{"key":"string","value":{"stringValue":"value"}},{"key":"bool","value":{"boolValue":true}},{"key":"int","value":{"intValue":"1"}},{"key":"double","value":{"doubleValue":1.1}},{"key":"bytes","value":{"bytesValue":"Zm9v"}}],"droppedAttributesCount":1,"flags":1}],"droppedLinksCount":1,"status":{"message":"message","code":1}},{"traceId":"","spanId":"","parentSpanId":"","name":"testSpan2","status":{}}],"schemaUrl":"schemaURL"}],"schemaUrl":"schemaURL"}]}` func TestJSONUnmarshal(t *testing.T) { decoder := &JSONUnmarshaler{} diff --git a/pdata/testdata/go.mod b/pdata/testdata/go.mod index e6ee1cddeb9..3211bbeb398 100644 --- a/pdata/testdata/go.mod +++ b/pdata/testdata/go.mod @@ -3,8 +3,8 @@ module go.opentelemetry.io/collector/pdata/testdata go 1.22.0 require ( - go.opentelemetry.io/collector/pdata v1.15.0 - go.opentelemetry.io/collector/pdata/pprofile v0.109.0 + go.opentelemetry.io/collector/pdata v1.16.0 + go.opentelemetry.io/collector/pdata/pprofile v0.110.0 ) require ( @@ -13,11 +13,11 @@ require ( github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.2 // indirect go.uber.org/multierr v1.11.0 // indirect - golang.org/x/net v0.26.0 // indirect - golang.org/x/sys v0.21.0 // indirect - golang.org/x/text v0.16.0 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20240604185151-ef581f913117 // indirect - google.golang.org/grpc v1.66.2 // indirect + golang.org/x/net v0.28.0 // indirect + golang.org/x/sys v0.24.0 // indirect + golang.org/x/text v0.17.0 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240814211410-ddb44dafa142 // indirect + google.golang.org/grpc v1.67.0 // indirect google.golang.org/protobuf v1.34.2 // indirect ) diff --git a/pdata/testdata/go.sum b/pdata/testdata/go.sum index 9ff2a11435c..b67110efaf5 100644 --- a/pdata/testdata/go.sum +++ b/pdata/testdata/go.sum @@ -36,20 +36,20 @@ golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.26.0 h1:soB7SVo0PWrY4vPW/+ay0jKDNScG2X9wFeYlXIvJsOQ= -golang.org/x/net v0.26.0/go.mod h1:5YKkiSynbBIh3p6iOc/vibscux0x38BZDkn8sCUPxHE= +golang.org/x/net v0.28.0 h1:a9JDOJc5GMUJ0+UDqmLT86WiEy7iWyIhz8gz8E4e5hE= +golang.org/x/net v0.28.0/go.mod h1:yqtgsTWOOnlGLG9GFRrK3++bGOUEkNBoHZc8MEDWPNg= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.21.0 h1:rF+pYz3DAGSQAxAu1CbC7catZg4ebC4UIeIhKxBZvws= -golang.org/x/sys v0.21.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= -golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI= +golang.org/x/text v0.17.0 h1:XtiM5bkSOt+ewxlOE/aE/AKEHibwj/6gvWMl9Rsh0Qc= +golang.org/x/text v0.17.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= @@ -58,10 +58,10 @@ 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= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240604185151-ef581f913117 h1:1GBuWVLM/KMVUv1t1En5Gs+gFZCNd360GGb4sSxtrhU= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240604185151-ef581f913117/go.mod h1:EfXuqaE1J41VCDicxHzUDm+8rk+7ZdXzHV0IhO/I6s0= -google.golang.org/grpc v1.66.2 h1:3QdXkuq3Bkh7w+ywLdLvM56cmGvQHUMZpiCzt6Rqaoo= -google.golang.org/grpc v1.66.2/go.mod h1:s3/l6xSSCURdVfAnL+TqCNMyTDAGN6+lZeVxnZR128Y= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240814211410-ddb44dafa142 h1:e7S5W7MGGLaSu8j3YjdezkZ+m1/Nm0uRVRMEMGk26Xs= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240814211410-ddb44dafa142/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU= +google.golang.org/grpc v1.67.0 h1:IdH9y6PF5MPSdAntIcpjQ+tXO41pcQsfZV2RxtQgVcw= +google.golang.org/grpc v1.67.0/go.mod h1:1gLDyUQU7CTLJI90u3nXZ9ekeghjeM7pTDZlqFNg2AA= google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/pipeline/go.mod b/pipeline/go.mod index d033db037c3..41c0c198acc 100644 --- a/pipeline/go.mod +++ b/pipeline/go.mod @@ -4,7 +4,7 @@ go 1.22.0 require ( github.com/stretchr/testify v1.9.0 - go.opentelemetry.io/collector/internal/globalsignal v0.109.0 + go.opentelemetry.io/collector/internal/globalsignal v0.110.0 ) require ( diff --git a/pipeline/signal.go b/pipeline/signal.go index eaa2c75b331..69b3d527952 100644 --- a/pipeline/signal.go +++ b/pipeline/signal.go @@ -4,6 +4,8 @@ package pipeline // import "go.opentelemetry.io/collector/pipeline" import ( + "errors" + "go.opentelemetry.io/collector/internal/globalsignal" ) @@ -11,6 +13,8 @@ import ( // collecting metrics, traces and logs, this can expand in the future. type Signal = globalsignal.Signal +var ErrSignalNotSupported = errors.New("telemetry type is not supported") + var ( SignalTraces = globalsignal.MustNewSignal("traces") SignalMetrics = globalsignal.MustNewSignal("metrics") diff --git a/processor/batchprocessor/go.mod b/processor/batchprocessor/go.mod index 8cfa442b63b..3966c3d18bb 100644 --- a/processor/batchprocessor/go.mod +++ b/processor/batchprocessor/go.mod @@ -4,15 +4,15 @@ go 1.22.0 require ( github.com/stretchr/testify v1.9.0 - go.opentelemetry.io/collector/client v1.15.0 - go.opentelemetry.io/collector/component v0.109.0 - go.opentelemetry.io/collector/config/configtelemetry v0.109.0 - go.opentelemetry.io/collector/confmap v1.15.0 - go.opentelemetry.io/collector/consumer v0.109.0 - go.opentelemetry.io/collector/consumer/consumertest v0.109.0 - go.opentelemetry.io/collector/pdata v1.15.0 - go.opentelemetry.io/collector/pdata/testdata v0.109.0 - go.opentelemetry.io/collector/processor v0.109.0 + go.opentelemetry.io/collector/client v1.16.0 + go.opentelemetry.io/collector/component v0.110.0 + go.opentelemetry.io/collector/config/configtelemetry v0.110.0 + go.opentelemetry.io/collector/confmap v1.16.0 + go.opentelemetry.io/collector/consumer v0.110.0 + go.opentelemetry.io/collector/consumer/consumertest v0.110.0 + go.opentelemetry.io/collector/pdata v1.16.0 + go.opentelemetry.io/collector/pdata/testdata v0.110.0 + go.opentelemetry.io/collector/processor v0.110.0 go.opentelemetry.io/otel v1.30.0 go.opentelemetry.io/otel/metric v1.30.0 go.opentelemetry.io/otel/sdk/metric v1.30.0 @@ -37,17 +37,19 @@ 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/component/componentstatus v0.109.0 // indirect - go.opentelemetry.io/collector/consumer/consumerprofiles v0.109.0 // indirect - go.opentelemetry.io/collector/pdata/pprofile v0.109.0 // indirect - go.opentelemetry.io/collector/processor/processorprofiles v0.109.0 // indirect + go.opentelemetry.io/collector/component/componentstatus v0.110.0 // indirect + go.opentelemetry.io/collector/consumer/consumerprofiles v0.110.0 // indirect + go.opentelemetry.io/collector/internal/globalsignal v0.110.0 // indirect + go.opentelemetry.io/collector/pdata/pprofile v0.110.0 // indirect + go.opentelemetry.io/collector/pipeline v0.110.0 // indirect + go.opentelemetry.io/collector/processor/processorprofiles v0.110.0 // indirect go.opentelemetry.io/otel/sdk v1.30.0 // indirect go.uber.org/multierr v1.11.0 // indirect golang.org/x/net v0.28.0 // indirect golang.org/x/sys v0.25.0 // indirect golang.org/x/text v0.17.0 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240822170219-fc7c04adadcd // indirect - google.golang.org/grpc v1.66.2 // indirect + google.golang.org/grpc v1.67.0 // indirect google.golang.org/protobuf v1.34.2 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) @@ -82,3 +84,7 @@ replace go.opentelemetry.io/collector/consumer/consumertest => ../../consumer/co replace go.opentelemetry.io/collector/component/componentstatus => ../../component/componentstatus replace go.opentelemetry.io/collector/processor/processorprofiles => ../processorprofiles + +replace go.opentelemetry.io/collector/pipeline => ../../pipeline + +replace go.opentelemetry.io/collector/internal/globalsignal => ../../internal/globalsignal diff --git a/processor/batchprocessor/go.sum b/processor/batchprocessor/go.sum index 90440acee84..a66d321512b 100644 --- a/processor/batchprocessor/go.sum +++ b/processor/batchprocessor/go.sum @@ -97,8 +97,8 @@ golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8T golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/genproto/googleapis/rpc v0.0.0-20240822170219-fc7c04adadcd h1:6TEm2ZxXoQmFWFlt1vNxvVOa1Q0dXFQD1m/rYjXmS0E= google.golang.org/genproto/googleapis/rpc v0.0.0-20240822170219-fc7c04adadcd/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU= -google.golang.org/grpc v1.66.2 h1:3QdXkuq3Bkh7w+ywLdLvM56cmGvQHUMZpiCzt6Rqaoo= -google.golang.org/grpc v1.66.2/go.mod h1:s3/l6xSSCURdVfAnL+TqCNMyTDAGN6+lZeVxnZR128Y= +google.golang.org/grpc v1.67.0 h1:IdH9y6PF5MPSdAntIcpjQ+tXO41pcQsfZV2RxtQgVcw= +google.golang.org/grpc v1.67.0/go.mod h1:1gLDyUQU7CTLJI90u3nXZ9ekeghjeM7pTDZlqFNg2AA= google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/processor/go.mod b/processor/go.mod index a079c19436b..34347c0a8d6 100644 --- a/processor/go.mod +++ b/processor/go.mod @@ -5,16 +5,17 @@ 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.109.0 - go.opentelemetry.io/collector/component/componentstatus v0.109.0 - go.opentelemetry.io/collector/config/configtelemetry v0.109.0 - go.opentelemetry.io/collector/consumer v0.109.0 - go.opentelemetry.io/collector/consumer/consumerprofiles v0.109.0 - go.opentelemetry.io/collector/consumer/consumertest v0.109.0 - go.opentelemetry.io/collector/pdata v1.15.0 - go.opentelemetry.io/collector/pdata/pprofile v0.109.0 - go.opentelemetry.io/collector/pdata/testdata v0.109.0 - go.opentelemetry.io/collector/processor/processorprofiles v0.109.0 + go.opentelemetry.io/collector/component v0.110.0 + go.opentelemetry.io/collector/component/componentstatus v0.110.0 + go.opentelemetry.io/collector/config/configtelemetry v0.110.0 + go.opentelemetry.io/collector/consumer v0.110.0 + go.opentelemetry.io/collector/consumer/consumerprofiles v0.110.0 + go.opentelemetry.io/collector/consumer/consumertest v0.110.0 + go.opentelemetry.io/collector/pdata v1.16.0 + go.opentelemetry.io/collector/pdata/pprofile v0.110.0 + go.opentelemetry.io/collector/pdata/testdata v0.110.0 + go.opentelemetry.io/collector/pipeline v0.110.0 + go.opentelemetry.io/collector/processor/processorprofiles v0.110.0 go.opentelemetry.io/otel v1.30.0 go.opentelemetry.io/otel/metric v1.30.0 go.opentelemetry.io/otel/sdk/metric v1.30.0 @@ -31,6 +32,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/internal/globalsignal v0.110.0 // indirect go.opentelemetry.io/otel/sdk v1.30.0 // indirect go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.27.0 // indirect @@ -38,7 +40,7 @@ require ( golang.org/x/sys v0.25.0 // indirect golang.org/x/text v0.17.0 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240822170219-fc7c04adadcd // indirect - google.golang.org/grpc v1.66.2 // indirect + google.golang.org/grpc v1.67.0 // indirect google.golang.org/protobuf v1.34.2 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) @@ -62,3 +64,7 @@ replace go.opentelemetry.io/collector/consumer/consumertest => ../consumer/consu replace go.opentelemetry.io/collector/component/componentstatus => ../component/componentstatus replace go.opentelemetry.io/collector/processor/processorprofiles => ./processorprofiles + +replace go.opentelemetry.io/collector/pipeline => ../pipeline + +replace go.opentelemetry.io/collector/internal/globalsignal => ../internal/globalsignal diff --git a/processor/go.sum b/processor/go.sum index 7d20180c30f..93424b94ea3 100644 --- a/processor/go.sum +++ b/processor/go.sum @@ -85,8 +85,8 @@ golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8T golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/genproto/googleapis/rpc v0.0.0-20240822170219-fc7c04adadcd h1:6TEm2ZxXoQmFWFlt1vNxvVOa1Q0dXFQD1m/rYjXmS0E= google.golang.org/genproto/googleapis/rpc v0.0.0-20240822170219-fc7c04adadcd/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU= -google.golang.org/grpc v1.66.2 h1:3QdXkuq3Bkh7w+ywLdLvM56cmGvQHUMZpiCzt6Rqaoo= -google.golang.org/grpc v1.66.2/go.mod h1:s3/l6xSSCURdVfAnL+TqCNMyTDAGN6+lZeVxnZR128Y= +google.golang.org/grpc v1.67.0 h1:IdH9y6PF5MPSdAntIcpjQ+tXO41pcQsfZV2RxtQgVcw= +google.golang.org/grpc v1.67.0/go.mod h1:1gLDyUQU7CTLJI90u3nXZ9ekeghjeM7pTDZlqFNg2AA= google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/processor/internal/factory.go b/processor/internal/factory.go deleted file mode 100644 index b08a9e97d24..00000000000 --- a/processor/internal/factory.go +++ /dev/null @@ -1,213 +0,0 @@ -// Copyright The OpenTelemetry Authors -// SPDX-License-Identifier: Apache-2.0 - -package internal // import "go.opentelemetry.io/collector/processor/internal" - -import ( - "context" - - "go.opentelemetry.io/collector/component" - "go.opentelemetry.io/collector/consumer" - "go.opentelemetry.io/collector/consumer/consumerprofiles" -) - -// Factory is a Factory interface for processors. -// -// This interface cannot be directly implemented. Implementations must -// use the NewProcessorFactory to implement it. -type Factory interface { - component.Factory - - // CreateTracesProcessor creates a TracesProcessor based on this config. - // If the processor type does not support traces, - // this function returns the error [component.ErrDataTypeIsNotSupported]. - // Implementers can assume `nextConsumer` is never nil. - CreateTracesProcessor(ctx context.Context, set Settings, cfg component.Config, nextConsumer consumer.Traces) (Traces, error) - - // TracesProcessorStability gets the stability level of the TracesProcessor. - TracesProcessorStability() component.StabilityLevel - - // CreateMetricsProcessor creates a MetricsProcessor based on this config. - // If the processor type does not support metrics, - // this function returns the error [component.ErrDataTypeIsNotSupported]. - // Implementers can assume `nextConsumer` is never nil. - CreateMetricsProcessor(ctx context.Context, set Settings, cfg component.Config, nextConsumer consumer.Metrics) (Metrics, error) - - // MetricsProcessorStability gets the stability level of the MetricsProcessor. - MetricsProcessorStability() component.StabilityLevel - - // CreateLogsProcessor creates a LogsProcessor based on the config. - // If the processor type does not support logs, - // this function returns the error [component.ErrDataTypeIsNotSupported]. - // Implementers can assume `nextConsumer` is never nil. - CreateLogsProcessor(ctx context.Context, set Settings, cfg component.Config, nextConsumer consumer.Logs) (Logs, error) - - // LogsProcessorStability gets the stability level of the LogsProcessor. - LogsProcessorStability() component.StabilityLevel - - // CreateProfilesProcessor creates a ProfilesProcessor based on this config. - // If the processor type does not support tracing or if the config is not valid, - // an error will be returned instead. - CreateProfilesProcessor(ctx context.Context, set Settings, cfg component.Config, nextConsumer consumerprofiles.Profiles) (Profiles, error) - - // ProfilesProcessorStability gets the stability level of the ProfilesProcessor. - ProfilesProcessorStability() component.StabilityLevel - - unexportedFactoryFunc() -} - -// FactoryOption apply changes to Options. -type FactoryOption interface { - // applyProcessorFactoryOption applies the option. - applyProcessorFactoryOption(o *factory) -} - -var _ FactoryOption = (*factoryOptionFunc)(nil) - -// factoryOptionFunc is a FactoryOption created through a function. -type factoryOptionFunc func(*factory) - -func (f factoryOptionFunc) applyProcessorFactoryOption(o *factory) { - f(o) -} - -// CreateTracesFunc is the equivalent of Factory.CreateTraces(). -type CreateTracesFunc func(context.Context, Settings, component.Config, consumer.Traces) (Traces, error) - -// CreateTracesProcessor implements Factory.CreateTracesProcessor(). -func (f CreateTracesFunc) CreateTracesProcessor( - ctx context.Context, - set Settings, - cfg component.Config, - nextConsumer consumer.Traces) (Traces, error) { - if f == nil { - return nil, component.ErrDataTypeIsNotSupported - } - return f(ctx, set, cfg, nextConsumer) -} - -// CreateMetricsFunc is the equivalent of Factory.CreateMetrics(). -type CreateMetricsFunc func(context.Context, Settings, component.Config, consumer.Metrics) (Metrics, error) - -// CreateMetricsProcessor implements Factory.CreateMetricsProcessor(). -func (f CreateMetricsFunc) CreateMetricsProcessor( - ctx context.Context, - set Settings, - cfg component.Config, - nextConsumer consumer.Metrics, -) (Metrics, error) { - if f == nil { - return nil, component.ErrDataTypeIsNotSupported - } - return f(ctx, set, cfg, nextConsumer) -} - -// CreateLogsFunc is the equivalent of Factory.CreateLogs(). -type CreateLogsFunc func(context.Context, Settings, component.Config, consumer.Logs) (Logs, error) - -// CreateLogsProcessor implements Factory.CreateLogsProcessor(). -func (f CreateLogsFunc) CreateLogsProcessor( - ctx context.Context, - set Settings, - cfg component.Config, - nextConsumer consumer.Logs, -) (Logs, error) { - if f == nil { - return nil, component.ErrDataTypeIsNotSupported - } - return f(ctx, set, cfg, nextConsumer) -} - -// CreateProfilesFunc is the equivalent of Factory.CreateProfiles(). -type CreateProfilesFunc func(context.Context, Settings, component.Config, consumerprofiles.Profiles) (Profiles, error) - -// CreateProfilesProcessor implements Factory.CreateProfilesProcessor(). -func (f CreateProfilesFunc) CreateProfilesProcessor( - ctx context.Context, - set Settings, - cfg component.Config, - nextConsumer consumerprofiles.Profiles) (Profiles, error) { - if f == nil { - return nil, component.ErrDataTypeIsNotSupported - } - return f(ctx, set, cfg, nextConsumer) -} - -type factory struct { - cfgType component.Type - component.CreateDefaultConfigFunc - CreateTracesFunc - tracesStabilityLevel component.StabilityLevel - CreateMetricsFunc - metricsStabilityLevel component.StabilityLevel - CreateLogsFunc - logsStabilityLevel component.StabilityLevel - CreateProfilesFunc - profilesStabilityLevel component.StabilityLevel -} - -func (f *factory) Type() component.Type { - return f.cfgType -} - -func (f *factory) unexportedFactoryFunc() {} - -func (f factory) TracesProcessorStability() component.StabilityLevel { - return f.tracesStabilityLevel -} - -func (f factory) MetricsProcessorStability() component.StabilityLevel { - return f.metricsStabilityLevel -} - -func (f factory) LogsProcessorStability() component.StabilityLevel { - return f.logsStabilityLevel -} - -func (f factory) ProfilesProcessorStability() component.StabilityLevel { - return f.profilesStabilityLevel -} - -// WithTraces overrides the default "error not supported" implementation for CreateTraces and the default "undefined" stability level. -func WithTraces(createTraces CreateTracesFunc, sl component.StabilityLevel) FactoryOption { - return factoryOptionFunc(func(o *factory) { - o.tracesStabilityLevel = sl - o.CreateTracesFunc = createTraces - }) -} - -// WithMetrics overrides the default "error not supported" implementation for CreateMetrics and the default "undefined" stability level. -func WithMetrics(createMetrics CreateMetricsFunc, sl component.StabilityLevel) FactoryOption { - return factoryOptionFunc(func(o *factory) { - o.metricsStabilityLevel = sl - o.CreateMetricsFunc = createMetrics - }) -} - -// WithLogs overrides the default "error not supported" implementation for CreateLogs and the default "undefined" stability level. -func WithLogs(createLogs CreateLogsFunc, sl component.StabilityLevel) FactoryOption { - return factoryOptionFunc(func(o *factory) { - o.logsStabilityLevel = sl - o.CreateLogsFunc = createLogs - }) -} - -// WithProfiles overrides the default "error not supported" implementation for CreateProfiles and the default "undefined" stability level. -func WithProfiles(createProfiles CreateProfilesFunc, sl component.StabilityLevel) FactoryOption { - return factoryOptionFunc(func(o *factory) { - o.profilesStabilityLevel = sl - o.CreateProfilesFunc = createProfiles - }) -} - -// NewFactory returns a Factory. -func NewFactory(cfgType component.Type, createDefaultConfig component.CreateDefaultConfigFunc, options ...FactoryOption) Factory { - f := &factory{ - cfgType: cfgType, - CreateDefaultConfigFunc: createDefaultConfig, - } - for _, opt := range options { - opt.applyProcessorFactoryOption(f) - } - return f -} diff --git a/processor/internal/logs.go b/processor/internal/logs.go deleted file mode 100644 index defced909ad..00000000000 --- a/processor/internal/logs.go +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright The OpenTelemetry Authors -// SPDX-License-Identifier: Apache-2.0 - -package internal // import "go.opentelemetry.io/collector/processor/internal" - -import ( - "go.opentelemetry.io/collector/component" - "go.opentelemetry.io/collector/consumer" -) - -// Logs is a processor that can consume logs. -type Logs interface { - component.Component - consumer.Logs -} diff --git a/processor/internal/metrics.go b/processor/internal/metrics.go deleted file mode 100644 index b1265e43b1a..00000000000 --- a/processor/internal/metrics.go +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright The OpenTelemetry Authors -// SPDX-License-Identifier: Apache-2.0 - -package internal // import "go.opentelemetry.io/collector/processor/internal" - -import ( - "go.opentelemetry.io/collector/component" - "go.opentelemetry.io/collector/consumer" -) - -// Metrics is a processor that can consume metrics. -type Metrics interface { - component.Component - consumer.Metrics -} diff --git a/processor/internal/processor.go b/processor/internal/processor.go deleted file mode 100644 index 4e7a07a18b8..00000000000 --- a/processor/internal/processor.go +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright The OpenTelemetry Authors -// SPDX-License-Identifier: Apache-2.0 - -package internal // import "go.opentelemetry.io/collector/processor/internal" - -import "go.opentelemetry.io/collector/component" - -// Settings is passed to Create* functions in Factory. -type Settings struct { - // ID returns the ID of the component that will be created. - ID component.ID - - component.TelemetrySettings - - // BuildInfo can be used by components for informational purposes - BuildInfo component.BuildInfo -} diff --git a/processor/internal/profiles.go b/processor/internal/profiles.go deleted file mode 100644 index e5e955e06e6..00000000000 --- a/processor/internal/profiles.go +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright The OpenTelemetry Authors -// SPDX-License-Identifier: Apache-2.0 - -package internal // import "go.opentelemetry.io/collector/processor/internal" - -import ( - "go.opentelemetry.io/collector/component" - "go.opentelemetry.io/collector/consumer/consumerprofiles" -) - -// Profiles is a processor that can consume profiles. -type Profiles interface { - component.Component - consumerprofiles.Profiles -} diff --git a/processor/internal/traces.go b/processor/internal/traces.go deleted file mode 100644 index a1fe0ced3cb..00000000000 --- a/processor/internal/traces.go +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright The OpenTelemetry Authors -// SPDX-License-Identifier: Apache-2.0 - -package internal // import "go.opentelemetry.io/collector/processor/internal" - -import ( - "go.opentelemetry.io/collector/component" - "go.opentelemetry.io/collector/consumer" -) - -// Traces is a processor that can consume traces. -type Traces interface { - component.Component - consumer.Traces -} diff --git a/processor/memorylimiterprocessor/go.mod b/processor/memorylimiterprocessor/go.mod index 00c31eb5444..acbec8a4df7 100644 --- a/processor/memorylimiterprocessor/go.mod +++ b/processor/memorylimiterprocessor/go.mod @@ -4,13 +4,13 @@ go 1.22.0 require ( github.com/stretchr/testify v1.9.0 - go.opentelemetry.io/collector v0.109.0 - go.opentelemetry.io/collector/component v0.109.0 - go.opentelemetry.io/collector/confmap v1.15.0 - go.opentelemetry.io/collector/consumer v0.109.0 - go.opentelemetry.io/collector/consumer/consumertest v0.109.0 - go.opentelemetry.io/collector/pdata v1.15.0 - go.opentelemetry.io/collector/processor v0.109.0 + go.opentelemetry.io/collector v0.110.0 + go.opentelemetry.io/collector/component v0.110.0 + go.opentelemetry.io/collector/confmap v1.16.0 + go.opentelemetry.io/collector/consumer v0.110.0 + go.opentelemetry.io/collector/consumer/consumertest v0.110.0 + go.opentelemetry.io/collector/pdata v1.16.0 + go.opentelemetry.io/collector/processor v0.110.0 go.uber.org/goleak v1.3.0 ) @@ -37,12 +37,14 @@ 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/component/componentstatus v0.109.0 // indirect - go.opentelemetry.io/collector/config/configtelemetry v0.109.0 // indirect - go.opentelemetry.io/collector/consumer/consumerprofiles v0.109.0 // indirect - go.opentelemetry.io/collector/pdata/pprofile v0.109.0 // indirect - go.opentelemetry.io/collector/pdata/testdata v0.109.0 // indirect - go.opentelemetry.io/collector/processor/processorprofiles v0.109.0 // indirect + go.opentelemetry.io/collector/component/componentstatus v0.110.0 // indirect + go.opentelemetry.io/collector/config/configtelemetry v0.110.0 // indirect + go.opentelemetry.io/collector/consumer/consumerprofiles v0.110.0 // indirect + go.opentelemetry.io/collector/internal/globalsignal v0.110.0 // indirect + go.opentelemetry.io/collector/pdata/pprofile v0.110.0 // indirect + go.opentelemetry.io/collector/pdata/testdata v0.110.0 // indirect + go.opentelemetry.io/collector/pipeline v0.110.0 // indirect + go.opentelemetry.io/collector/processor/processorprofiles v0.110.0 // indirect go.opentelemetry.io/otel v1.30.0 // indirect go.opentelemetry.io/otel/metric v1.30.0 // indirect go.opentelemetry.io/otel/sdk v1.30.0 // indirect @@ -54,7 +56,7 @@ require ( golang.org/x/sys v0.25.0 // indirect golang.org/x/text v0.17.0 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240822170219-fc7c04adadcd // indirect - google.golang.org/grpc v1.66.2 // indirect + google.golang.org/grpc v1.67.0 // indirect google.golang.org/protobuf v1.34.2 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) @@ -89,3 +91,7 @@ replace go.opentelemetry.io/collector/consumer/consumertest => ../../consumer/co replace go.opentelemetry.io/collector/component/componentstatus => ../../component/componentstatus replace go.opentelemetry.io/collector/processor/processorprofiles => ../processorprofiles + +replace go.opentelemetry.io/collector/pipeline => ../../pipeline + +replace go.opentelemetry.io/collector/internal/globalsignal => ../../internal/globalsignal diff --git a/processor/memorylimiterprocessor/go.sum b/processor/memorylimiterprocessor/go.sum index 4e25b66ac02..fa890dba0c9 100644 --- a/processor/memorylimiterprocessor/go.sum +++ b/processor/memorylimiterprocessor/go.sum @@ -116,8 +116,8 @@ golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8T golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/genproto/googleapis/rpc v0.0.0-20240822170219-fc7c04adadcd h1:6TEm2ZxXoQmFWFlt1vNxvVOa1Q0dXFQD1m/rYjXmS0E= google.golang.org/genproto/googleapis/rpc v0.0.0-20240822170219-fc7c04adadcd/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU= -google.golang.org/grpc v1.66.2 h1:3QdXkuq3Bkh7w+ywLdLvM56cmGvQHUMZpiCzt6Rqaoo= -google.golang.org/grpc v1.66.2/go.mod h1:s3/l6xSSCURdVfAnL+TqCNMyTDAGN6+lZeVxnZR128Y= +google.golang.org/grpc v1.67.0 h1:IdH9y6PF5MPSdAntIcpjQ+tXO41pcQsfZV2RxtQgVcw= +google.golang.org/grpc v1.67.0/go.mod h1:1gLDyUQU7CTLJI90u3nXZ9ekeghjeM7pTDZlqFNg2AA= google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/processor/processor.go b/processor/processor.go index 72233b425b3..6ded6505e2c 100644 --- a/processor/processor.go +++ b/processor/processor.go @@ -4,60 +4,205 @@ package processor // import "go.opentelemetry.io/collector/processor" import ( + "context" "fmt" "go.opentelemetry.io/collector/component" - "go.opentelemetry.io/collector/processor/internal" + "go.opentelemetry.io/collector/consumer" + "go.opentelemetry.io/collector/pipeline" ) // Traces is a processor that can consume traces. -type Traces = internal.Traces +type Traces interface { + component.Component + consumer.Traces +} // Metrics is a processor that can consume metrics. -type Metrics = internal.Metrics +type Metrics interface { + component.Component + consumer.Metrics +} // Logs is a processor that can consume logs. -type Logs = internal.Logs +type Logs interface { + component.Component + consumer.Logs +} // Settings is passed to Create* functions in Factory. -type Settings = internal.Settings +type Settings struct { + // ID returns the ID of the component that will be created. + ID component.ID + + component.TelemetrySettings + + // BuildInfo can be used by components for informational purposes + BuildInfo component.BuildInfo +} // Factory is Factory interface for processors. // // This interface cannot be directly implemented. Implementations must -// use the NewProcessorFactory to implement it. -type Factory = internal.Factory +// use the NewFactory to implement it. +type Factory interface { + component.Factory + + // CreateTracesProcessor creates a TracesProcessor based on this config. + // If the processor type does not support traces, + // this function returns the error [pipeline.ErrSignalNotSupported]. + // Implementers can assume `nextConsumer` is never nil. + CreateTracesProcessor(ctx context.Context, set Settings, cfg component.Config, nextConsumer consumer.Traces) (Traces, error) + + // TracesProcessorStability gets the stability level of the TracesProcessor. + TracesProcessorStability() component.StabilityLevel + + // CreateMetricsProcessor creates a MetricsProcessor based on this config. + // If the processor type does not support metrics, + // this function returns the error [pipeline.ErrSignalNotSupported]. + // Implementers can assume `nextConsumer` is never nil. + CreateMetricsProcessor(ctx context.Context, set Settings, cfg component.Config, nextConsumer consumer.Metrics) (Metrics, error) + + // MetricsProcessorStability gets the stability level of the MetricsProcessor. + MetricsProcessorStability() component.StabilityLevel + + // CreateLogsProcessor creates a LogsProcessor based on the config. + // If the processor type does not support logs, + // this function returns the error [pipeline.ErrSignalNotSupported]. + // Implementers can assume `nextConsumer` is never nil. + CreateLogsProcessor(ctx context.Context, set Settings, cfg component.Config, nextConsumer consumer.Logs) (Logs, error) + + // LogsProcessorStability gets the stability level of the LogsProcessor. + LogsProcessorStability() component.StabilityLevel + + unexportedFactoryFunc() +} // FactoryOption apply changes to Options. -type FactoryOption = internal.FactoryOption +type FactoryOption interface { + // applyProcessorFactoryOption applies the option. + applyProcessorFactoryOption(o *factory) +} + +var _ FactoryOption = (*factoryOptionFunc)(nil) + +// factoryOptionFunc is a FactoryOption created through a function. +type factoryOptionFunc func(*factory) + +func (f factoryOptionFunc) applyProcessorFactoryOption(o *factory) { + f(o) +} + +type factory struct { + cfgType component.Type + component.CreateDefaultConfigFunc + CreateTracesFunc + tracesStabilityLevel component.StabilityLevel + CreateMetricsFunc + metricsStabilityLevel component.StabilityLevel + CreateLogsFunc + logsStabilityLevel component.StabilityLevel +} + +func (f *factory) Type() component.Type { + return f.cfgType +} + +func (f *factory) unexportedFactoryFunc() {} + +func (f factory) TracesProcessorStability() component.StabilityLevel { + return f.tracesStabilityLevel +} + +func (f factory) MetricsProcessorStability() component.StabilityLevel { + return f.metricsStabilityLevel +} + +func (f factory) LogsProcessorStability() component.StabilityLevel { + return f.logsStabilityLevel +} // CreateTracesFunc is the equivalent of Factory.CreateTraces(). -type CreateTracesFunc = internal.CreateTracesFunc +type CreateTracesFunc func(context.Context, Settings, component.Config, consumer.Traces) (Traces, error) + +// CreateTracesProcessor implements Factory.CreateTracesProcessor(). +func (f CreateTracesFunc) CreateTracesProcessor( + ctx context.Context, + set Settings, + cfg component.Config, + nextConsumer consumer.Traces) (Traces, error) { + if f == nil { + return nil, pipeline.ErrSignalNotSupported + } + return f(ctx, set, cfg, nextConsumer) +} // CreateMetricsFunc is the equivalent of Factory.CreateMetrics(). -type CreateMetricsFunc = internal.CreateMetricsFunc +type CreateMetricsFunc func(context.Context, Settings, component.Config, consumer.Metrics) (Metrics, error) + +// CreateMetricsProcessor implements Factory.CreateMetricsProcessor(). +func (f CreateMetricsFunc) CreateMetricsProcessor( + ctx context.Context, + set Settings, + cfg component.Config, + nextConsumer consumer.Metrics, +) (Metrics, error) { + if f == nil { + return nil, pipeline.ErrSignalNotSupported + } + return f(ctx, set, cfg, nextConsumer) +} // CreateLogsFunc is the equivalent of Factory.CreateLogs(). -type CreateLogsFunc = internal.CreateLogsFunc +type CreateLogsFunc func(context.Context, Settings, component.Config, consumer.Logs) (Logs, error) + +// CreateLogsProcessor implements Factory.CreateLogsProcessor(). +func (f CreateLogsFunc) CreateLogsProcessor( + ctx context.Context, + set Settings, + cfg component.Config, + nextConsumer consumer.Logs, +) (Logs, error) { + if f == nil { + return nil, pipeline.ErrSignalNotSupported + } + return f(ctx, set, cfg, nextConsumer) +} // WithTraces overrides the default "error not supported" implementation for CreateTraces and the default "undefined" stability level. func WithTraces(createTraces CreateTracesFunc, sl component.StabilityLevel) FactoryOption { - return internal.WithTraces(createTraces, sl) + return factoryOptionFunc(func(o *factory) { + o.tracesStabilityLevel = sl + o.CreateTracesFunc = createTraces + }) } // WithMetrics overrides the default "error not supported" implementation for CreateMetrics and the default "undefined" stability level. func WithMetrics(createMetrics CreateMetricsFunc, sl component.StabilityLevel) FactoryOption { - return internal.WithMetrics(createMetrics, sl) + return factoryOptionFunc(func(o *factory) { + o.metricsStabilityLevel = sl + o.CreateMetricsFunc = createMetrics + }) } // WithLogs overrides the default "error not supported" implementation for CreateLogs and the default "undefined" stability level. func WithLogs(createLogs CreateLogsFunc, sl component.StabilityLevel) FactoryOption { - return internal.WithLogs(createLogs, sl) + return factoryOptionFunc(func(o *factory) { + o.logsStabilityLevel = sl + o.CreateLogsFunc = createLogs + }) } // NewFactory returns a Factory. func NewFactory(cfgType component.Type, createDefaultConfig component.CreateDefaultConfigFunc, options ...FactoryOption) Factory { - return internal.NewFactory(cfgType, createDefaultConfig, options...) + f := &factory{ + cfgType: cfgType, + CreateDefaultConfigFunc: createDefaultConfig, + } + for _, opt := range options { + opt.applyProcessorFactoryOption(f) + } + return f } // MakeFactoryMap takes a list of factories and returns a map with Factory type as keys. diff --git a/processor/processorhelper/obsreport.go b/processor/processorhelper/obsreport.go index dfbc2971ec5..d1445a3ee05 100644 --- a/processor/processorhelper/obsreport.go +++ b/processor/processorhelper/obsreport.go @@ -11,6 +11,7 @@ import ( "go.opentelemetry.io/otel/metric" "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/pipeline" "go.opentelemetry.io/collector/processor" "go.opentelemetry.io/collector/processor/internal" "go.opentelemetry.io/collector/processor/processorhelper/internal/metadata" @@ -65,18 +66,18 @@ func (or *ObsReport) recordInOut(ctx context.Context, incoming, outgoing int) { or.telemetryBuilder.ProcessorOutgoingItems.Add(ctx, int64(outgoing), metric.WithAttributes(or.otelAttrs...)) } -func (or *ObsReport) recordData(ctx context.Context, dataType component.DataType, accepted, refused, dropped int64) { +func (or *ObsReport) recordData(ctx context.Context, signal pipeline.Signal, accepted, refused, dropped int64) { var acceptedCount, refusedCount, droppedCount metric.Int64Counter - switch dataType { - case component.DataTypeTraces: + switch signal { + case pipeline.SignalTraces: acceptedCount = or.telemetryBuilder.ProcessorAcceptedSpans refusedCount = or.telemetryBuilder.ProcessorRefusedSpans droppedCount = or.telemetryBuilder.ProcessorDroppedSpans - case component.DataTypeMetrics: + case pipeline.SignalMetrics: acceptedCount = or.telemetryBuilder.ProcessorAcceptedMetricPoints refusedCount = or.telemetryBuilder.ProcessorRefusedMetricPoints droppedCount = or.telemetryBuilder.ProcessorDroppedMetricPoints - case component.DataTypeLogs: + case pipeline.SignalLogs: acceptedCount = or.telemetryBuilder.ProcessorAcceptedLogRecords refusedCount = or.telemetryBuilder.ProcessorRefusedLogRecords droppedCount = or.telemetryBuilder.ProcessorDroppedLogRecords @@ -91,61 +92,61 @@ func (or *ObsReport) recordData(ctx context.Context, dataType component.DataType // // Deprecated: [v0.110.0] Processor helper automatically calculates incoming/outgoing metrics only. func (or *ObsReport) TracesAccepted(ctx context.Context, numSpans int) { - or.recordData(ctx, component.DataTypeTraces, int64(numSpans), int64(0), int64(0)) + or.recordData(ctx, pipeline.SignalTraces, int64(numSpans), int64(0), int64(0)) } // TracesRefused reports that the trace data was refused. // // Deprecated: [v0.110.0] Processor helper automatically calculates incoming/outgoing metrics only. func (or *ObsReport) TracesRefused(ctx context.Context, numSpans int) { - or.recordData(ctx, component.DataTypeTraces, int64(0), int64(numSpans), int64(0)) + or.recordData(ctx, pipeline.SignalTraces, int64(0), int64(numSpans), int64(0)) } // TracesDropped reports that the trace data was dropped. // // Deprecated: [v0.110.0] Processor helper automatically calculates incoming/outgoing metrics only. func (or *ObsReport) TracesDropped(ctx context.Context, numSpans int) { - or.recordData(ctx, component.DataTypeTraces, int64(0), int64(0), int64(numSpans)) + or.recordData(ctx, pipeline.SignalTraces, int64(0), int64(0), int64(numSpans)) } // MetricsAccepted reports that the metrics were accepted. // // Deprecated: [v0.110.0] Processor helper automatically calculates incoming/outgoing metrics only. func (or *ObsReport) MetricsAccepted(ctx context.Context, numPoints int) { - or.recordData(ctx, component.DataTypeMetrics, int64(numPoints), int64(0), int64(0)) + or.recordData(ctx, pipeline.SignalMetrics, int64(numPoints), int64(0), int64(0)) } // MetricsRefused reports that the metrics were refused. // // Deprecated: [v0.110.0] Processor helper automatically calculates incoming/outgoing metrics only. func (or *ObsReport) MetricsRefused(ctx context.Context, numPoints int) { - or.recordData(ctx, component.DataTypeMetrics, int64(0), int64(numPoints), int64(0)) + or.recordData(ctx, pipeline.SignalMetrics, int64(0), int64(numPoints), int64(0)) } // MetricsDropped reports that the metrics were dropped. // // Deprecated: [v0.110.0] Processor helper automatically calculates incoming/outgoing metrics only. func (or *ObsReport) MetricsDropped(ctx context.Context, numPoints int) { - or.recordData(ctx, component.DataTypeMetrics, int64(0), int64(0), int64(numPoints)) + or.recordData(ctx, pipeline.SignalMetrics, int64(0), int64(0), int64(numPoints)) } // LogsAccepted reports that the logs were accepted. // // Deprecated: [v0.110.0] Processor helper automatically calculates incoming/outgoing metrics only. func (or *ObsReport) LogsAccepted(ctx context.Context, numRecords int) { - or.recordData(ctx, component.DataTypeLogs, int64(numRecords), int64(0), int64(0)) + or.recordData(ctx, pipeline.SignalLogs, int64(numRecords), int64(0), int64(0)) } // LogsRefused reports that the logs were refused. // // Deprecated: [v0.110.0] Processor helper automatically calculates incoming/outgoing metrics only. func (or *ObsReport) LogsRefused(ctx context.Context, numRecords int) { - or.recordData(ctx, component.DataTypeLogs, int64(0), int64(numRecords), int64(0)) + or.recordData(ctx, pipeline.SignalLogs, int64(0), int64(numRecords), int64(0)) } // LogsDropped reports that the logs were dropped. // // Deprecated: [v0.110.0] Processor helper automatically calculates incoming/outgoing metrics only. func (or *ObsReport) LogsDropped(ctx context.Context, numRecords int) { - or.recordData(ctx, component.DataTypeLogs, int64(0), int64(0), int64(numRecords)) + or.recordData(ctx, pipeline.SignalLogs, int64(0), int64(0), int64(numRecords)) } diff --git a/processor/processorprofiles/go.mod b/processor/processorprofiles/go.mod index 89b1a2edc21..1db82b94993 100644 --- a/processor/processorprofiles/go.mod +++ b/processor/processorprofiles/go.mod @@ -4,10 +4,11 @@ go 1.22.0 require ( github.com/stretchr/testify v1.9.0 - go.opentelemetry.io/collector/component v0.109.0 - go.opentelemetry.io/collector/consumer/consumerprofiles v0.109.0 - go.opentelemetry.io/collector/consumer/consumertest v0.109.0 - go.opentelemetry.io/collector/processor v0.109.0 + go.opentelemetry.io/collector/component v0.110.0 + go.opentelemetry.io/collector/consumer/consumerprofiles v0.110.0 + go.opentelemetry.io/collector/consumer/consumertest v0.110.0 + go.opentelemetry.io/collector/pipeline v0.110.0 + go.opentelemetry.io/collector/processor v0.110.0 ) require ( @@ -17,10 +18,11 @@ 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.109.0 // indirect - go.opentelemetry.io/collector/consumer v0.109.0 // indirect - go.opentelemetry.io/collector/pdata v1.15.0 // indirect - go.opentelemetry.io/collector/pdata/pprofile v0.109.0 // indirect + go.opentelemetry.io/collector/config/configtelemetry v0.110.0 // indirect + go.opentelemetry.io/collector/consumer v0.110.0 // indirect + go.opentelemetry.io/collector/internal/globalsignal v0.110.0 // indirect + go.opentelemetry.io/collector/pdata v1.16.0 // indirect + go.opentelemetry.io/collector/pdata/pprofile v0.110.0 // indirect go.opentelemetry.io/otel v1.30.0 // indirect go.opentelemetry.io/otel/metric v1.30.0 // indirect go.opentelemetry.io/otel/trace v1.30.0 // indirect @@ -30,7 +32,7 @@ require ( golang.org/x/sys v0.25.0 // indirect golang.org/x/text v0.17.0 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240822170219-fc7c04adadcd // indirect - google.golang.org/grpc v1.66.2 // indirect + google.golang.org/grpc v1.67.0 // indirect google.golang.org/protobuf v1.34.2 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) @@ -54,3 +56,7 @@ replace go.opentelemetry.io/collector/consumer/consumerprofiles => ../../consume replace go.opentelemetry.io/collector/consumer/consumertest => ../../consumer/consumertest replace go.opentelemetry.io/collector/component/componentstatus => ../../component/componentstatus + +replace go.opentelemetry.io/collector/pipeline => ../../pipeline + +replace go.opentelemetry.io/collector/internal/globalsignal => ../../internal/globalsignal diff --git a/processor/processorprofiles/go.sum b/processor/processorprofiles/go.sum index 233d0fd2ec2..5065b82d011 100644 --- a/processor/processorprofiles/go.sum +++ b/processor/processorprofiles/go.sum @@ -78,8 +78,8 @@ golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8T golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/genproto/googleapis/rpc v0.0.0-20240822170219-fc7c04adadcd h1:6TEm2ZxXoQmFWFlt1vNxvVOa1Q0dXFQD1m/rYjXmS0E= google.golang.org/genproto/googleapis/rpc v0.0.0-20240822170219-fc7c04adadcd/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU= -google.golang.org/grpc v1.66.2 h1:3QdXkuq3Bkh7w+ywLdLvM56cmGvQHUMZpiCzt6Rqaoo= -google.golang.org/grpc v1.66.2/go.mod h1:s3/l6xSSCURdVfAnL+TqCNMyTDAGN6+lZeVxnZR128Y= +google.golang.org/grpc v1.67.0 h1:IdH9y6PF5MPSdAntIcpjQ+tXO41pcQsfZV2RxtQgVcw= +google.golang.org/grpc v1.67.0/go.mod h1:1gLDyUQU7CTLJI90u3nXZ9ekeghjeM7pTDZlqFNg2AA= google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/processor/processorprofiles/processor.go b/processor/processorprofiles/processor.go index f9ec83e00a4..85c61f941b1 100644 --- a/processor/processorprofiles/processor.go +++ b/processor/processorprofiles/processor.go @@ -4,18 +4,124 @@ package processorprofiles // import "go.opentelemetry.io/collector/processor/processorprofiles" import ( + "context" + "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/consumer/consumerprofiles" + "go.opentelemetry.io/collector/pipeline" "go.opentelemetry.io/collector/processor" - "go.opentelemetry.io/collector/processor/internal" ) +// Factory is a component.Factory interface for processors. +// +// This interface cannot be directly implemented. Implementations must +// use the NewFactory to implement it. +type Factory interface { + processor.Factory + + // CreateProfilesProcessor creates a ProfilesProcessor based on this config. + // If the processor type does not support tracing or if the config is not valid, + // an error will be returned instead. + CreateProfilesProcessor(ctx context.Context, set processor.Settings, cfg component.Config, nextConsumer consumerprofiles.Profiles) (Profiles, error) + + // ProfilesProcessorStability gets the stability level of the ProfilesProcessor. + ProfilesProcessorStability() component.StabilityLevel +} + // Profiles is a processor that can consume profiles. -type Profiles = internal.Profiles +type Profiles interface { + component.Component + consumerprofiles.Profiles +} // CreateProfilesFunc is the equivalent of Factory.CreateProfiles(). -type CreateProfilesFunc = internal.CreateProfilesFunc +// CreateProfilesFunc is the equivalent of Factory.CreateProfiles(). +type CreateProfilesFunc func(context.Context, processor.Settings, component.Config, consumerprofiles.Profiles) (Profiles, error) + +// CreateProfilesProcessor implements Factory.CreateProfilesProcessor(). +func (f CreateProfilesFunc) CreateProfilesProcessor( + ctx context.Context, + set processor.Settings, + cfg component.Config, + nextConsumer consumerprofiles.Profiles) (Profiles, error) { + if f == nil { + return nil, pipeline.ErrSignalNotSupported + } + return f(ctx, set, cfg, nextConsumer) +} + +// FactoryOption apply changes to ReceiverOptions. +type FactoryOption interface { + // applyOption applies the option. + applyOption(o *factoryOpts) +} + +// factoryOptionFunc is an ReceiverFactoryOption created through a function. +type factoryOptionFunc func(*factoryOpts) + +func (f factoryOptionFunc) applyOption(o *factoryOpts) { + f(o) +} + +type factory struct { + processor.Factory + CreateProfilesFunc + profilesStabilityLevel component.StabilityLevel +} + +func (f factory) ProfilesProcessorStability() component.StabilityLevel { + return f.profilesStabilityLevel +} + +type factoryOpts struct { + cfgType component.Type + component.CreateDefaultConfigFunc + opts []processor.FactoryOption + CreateProfilesFunc + profilesStabilityLevel component.StabilityLevel +} + +// WithTraces overrides the default "error not supported" implementation for CreateTraces and the default "undefined" stability level. +func WithTraces(createTraces processor.CreateTracesFunc, sl component.StabilityLevel) FactoryOption { + return factoryOptionFunc(func(o *factoryOpts) { + o.opts = append(o.opts, processor.WithTraces(createTraces, sl)) + }) +} + +// WithMetrics overrides the default "error not supported" implementation for CreateMetrics and the default "undefined" stability level. +func WithMetrics(createMetrics processor.CreateMetricsFunc, sl component.StabilityLevel) FactoryOption { + return factoryOptionFunc(func(o *factoryOpts) { + o.opts = append(o.opts, processor.WithMetrics(createMetrics, sl)) + }) +} + +// WithLogs overrides the default "error not supported" implementation for CreateLogs and the default "undefined" stability level. +func WithLogs(createLogs processor.CreateLogsFunc, sl component.StabilityLevel) FactoryOption { + return factoryOptionFunc(func(o *factoryOpts) { + o.opts = append(o.opts, processor.WithLogs(createLogs, sl)) + }) +} // WithProfiles overrides the default "error not supported" implementation for CreateProfiles and the default "undefined" stability level. -func WithProfiles(createProfiles CreateProfilesFunc, sl component.StabilityLevel) processor.FactoryOption { - return internal.WithProfiles(createProfiles, sl) +func WithProfiles(createProfiles CreateProfilesFunc, sl component.StabilityLevel) FactoryOption { + return factoryOptionFunc(func(o *factoryOpts) { + o.profilesStabilityLevel = sl + o.CreateProfilesFunc = createProfiles + }) +} + +// NewFactory returns a Factory. +func NewFactory(cfgType component.Type, createDefaultConfig component.CreateDefaultConfigFunc, options ...FactoryOption) Factory { + opts := factoryOpts{ + cfgType: cfgType, + CreateDefaultConfigFunc: createDefaultConfig, + } + for _, opt := range options { + opt.applyOption(&opts) + } + return &factory{ + Factory: processor.NewFactory(opts.cfgType, opts.CreateDefaultConfig, opts.opts...), + CreateProfilesFunc: opts.CreateProfilesFunc, + profilesStabilityLevel: opts.profilesStabilityLevel, + } } diff --git a/processor/processorprofiles/processor_test.go b/processor/processorprofiles/processor_test.go index 05b1c592ce9..672e5f2c9fc 100644 --- a/processor/processorprofiles/processor_test.go +++ b/processor/processorprofiles/processor_test.go @@ -18,7 +18,7 @@ import ( func TestNewFactoryWithProfiles(t *testing.T) { var testType = component.MustNewType("test") defaultCfg := struct{}{} - factory := processor.NewFactory( + factory := NewFactory( testType, func() component.Config { return &defaultCfg }, WithProfiles(createProfiles, component.StabilityLevelAlpha), diff --git a/processor/processortest/nop_processor.go b/processor/processortest/nop_processor.go index f1dd64bfd52..4d2e1fd4c50 100644 --- a/processor/processortest/nop_processor.go +++ b/processor/processortest/nop_processor.go @@ -30,12 +30,12 @@ func NewNopSettings() processor.Settings { // NewNopFactory returns a component.ProcessorFactory that constructs nop processors. func NewNopFactory() processor.Factory { - return processor.NewFactory( + return processorprofiles.NewFactory( nopType, func() component.Config { return &nopConfig{} }, - processor.WithTraces(createTracesProcessor, component.StabilityLevelStable), - processor.WithMetrics(createMetricsProcessor, component.StabilityLevelStable), - processor.WithLogs(createLogsProcessor, component.StabilityLevelStable), + processorprofiles.WithTraces(createTracesProcessor, component.StabilityLevelStable), + processorprofiles.WithMetrics(createMetricsProcessor, component.StabilityLevelStable), + processorprofiles.WithLogs(createLogsProcessor, component.StabilityLevelStable), processorprofiles.WithProfiles(createProfilesProcessor, component.StabilityLevelAlpha), ) } diff --git a/processor/processortest/nop_processor_test.go b/processor/processortest/nop_processor_test.go index fcf902e552d..35b17c94d14 100644 --- a/processor/processortest/nop_processor_test.go +++ b/processor/processortest/nop_processor_test.go @@ -18,6 +18,7 @@ import ( "go.opentelemetry.io/collector/pdata/pmetric" "go.opentelemetry.io/collector/pdata/pprofile" "go.opentelemetry.io/collector/pdata/ptrace" + "go.opentelemetry.io/collector/processor/processorprofiles" ) func TestNewNopFactory(t *testing.T) { @@ -48,7 +49,7 @@ func TestNewNopFactory(t *testing.T) { assert.NoError(t, logs.ConsumeLogs(context.Background(), plog.NewLogs())) assert.NoError(t, logs.Shutdown(context.Background())) - profiles, err := factory.CreateProfilesProcessor(context.Background(), NewNopSettings(), cfg, consumertest.NewNop()) + profiles, err := factory.(processorprofiles.Factory).CreateProfilesProcessor(context.Background(), NewNopSettings(), cfg, consumertest.NewNop()) require.NoError(t, err) assert.Equal(t, consumer.Capabilities{MutatesData: false}, profiles.Capabilities()) assert.NoError(t, profiles.Start(context.Background(), componenttest.NewNopHost())) diff --git a/processor/processortest/shutdown_verifier.go b/processor/processortest/shutdown_verifier.go index d020f6e4f8a..5561991f576 100644 --- a/processor/processortest/shutdown_verifier.go +++ b/processor/processortest/shutdown_verifier.go @@ -15,6 +15,7 @@ import ( "go.opentelemetry.io/collector/component/componenttest" "go.opentelemetry.io/collector/consumer/consumertest" "go.opentelemetry.io/collector/pdata/testdata" + "go.opentelemetry.io/collector/pipeline" "go.opentelemetry.io/collector/processor" ) @@ -22,7 +23,7 @@ func verifyTracesDoesNotProduceAfterShutdown(t *testing.T, factory processor.Fac // Create a proc and output its produce to a sink. nextSink := new(consumertest.TracesSink) proc, err := factory.CreateTracesProcessor(context.Background(), NewNopSettings(), cfg, nextSink) - if errors.Is(err, component.ErrDataTypeIsNotSupported) { + if errors.Is(err, pipeline.ErrSignalNotSupported) { return } require.NoError(t, err) @@ -46,7 +47,7 @@ func verifyLogsDoesNotProduceAfterShutdown(t *testing.T, factory processor.Facto // Create a proc and output its produce to a sink. nextSink := new(consumertest.LogsSink) proc, err := factory.CreateLogsProcessor(context.Background(), NewNopSettings(), cfg, nextSink) - if errors.Is(err, component.ErrDataTypeIsNotSupported) { + if errors.Is(err, pipeline.ErrSignalNotSupported) { return } require.NoError(t, err) @@ -70,7 +71,7 @@ func verifyMetricsDoesNotProduceAfterShutdown(t *testing.T, factory processor.Fa // Create a proc and output its produce to a sink. nextSink := new(consumertest.MetricsSink) proc, err := factory.CreateMetricsProcessor(context.Background(), NewNopSettings(), cfg, nextSink) - if errors.Is(err, component.ErrDataTypeIsNotSupported) { + if errors.Is(err, pipeline.ErrSignalNotSupported) { return } require.NoError(t, err) diff --git a/receiver/go.mod b/receiver/go.mod index 15f9281da3d..5143a456cb7 100644 --- a/receiver/go.mod +++ b/receiver/go.mod @@ -5,13 +5,16 @@ 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.109.0 - go.opentelemetry.io/collector/config/configtelemetry v0.109.0 - go.opentelemetry.io/collector/consumer v0.109.0 - go.opentelemetry.io/collector/consumer/consumerprofiles v0.109.0 - go.opentelemetry.io/collector/consumer/consumertest v0.109.0 - go.opentelemetry.io/collector/pdata v1.15.0 - go.opentelemetry.io/collector/receiver/receiverprofiles v0.109.0 + go.opentelemetry.io/collector/component v0.110.0 + go.opentelemetry.io/collector/component/componentprofiles v0.110.0 + go.opentelemetry.io/collector/config/configtelemetry v0.110.0 + go.opentelemetry.io/collector/consumer v0.110.0 + go.opentelemetry.io/collector/consumer/consumerprofiles v0.110.0 + go.opentelemetry.io/collector/consumer/consumertest v0.110.0 + go.opentelemetry.io/collector/internal/globalsignal v0.110.0 + go.opentelemetry.io/collector/pdata v1.16.0 + go.opentelemetry.io/collector/pipeline v0.110.0 + go.opentelemetry.io/collector/receiver/receiverprofiles v0.110.0 go.opentelemetry.io/otel v1.30.0 go.opentelemetry.io/otel/metric v1.30.0 go.opentelemetry.io/otel/sdk v1.30.0 @@ -31,12 +34,12 @@ 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.109.0 // indirect + go.opentelemetry.io/collector/pdata/pprofile v0.110.0 // indirect golang.org/x/net v0.28.0 // indirect golang.org/x/sys v0.25.0 // indirect golang.org/x/text v0.17.0 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240822170219-fc7c04adadcd // indirect - google.golang.org/grpc v1.66.2 // indirect + google.golang.org/grpc v1.67.0 // indirect google.golang.org/protobuf v1.34.2 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) @@ -60,3 +63,9 @@ replace go.opentelemetry.io/collector/consumer/consumertest => ../consumer/consu replace go.opentelemetry.io/collector/receiver/receiverprofiles => ./receiverprofiles retract v0.76.0 // Depends on retracted pdata v1.0.0-rc10 module + +replace go.opentelemetry.io/collector/pipeline => ../pipeline + +replace go.opentelemetry.io/collector/internal/globalsignal => ../internal/globalsignal + +replace go.opentelemetry.io/collector/component/componentprofiles => ../component/componentprofiles diff --git a/receiver/go.sum b/receiver/go.sum index 7d20180c30f..93424b94ea3 100644 --- a/receiver/go.sum +++ b/receiver/go.sum @@ -85,8 +85,8 @@ golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8T golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/genproto/googleapis/rpc v0.0.0-20240822170219-fc7c04adadcd h1:6TEm2ZxXoQmFWFlt1vNxvVOa1Q0dXFQD1m/rYjXmS0E= google.golang.org/genproto/googleapis/rpc v0.0.0-20240822170219-fc7c04adadcd/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU= -google.golang.org/grpc v1.66.2 h1:3QdXkuq3Bkh7w+ywLdLvM56cmGvQHUMZpiCzt6Rqaoo= -google.golang.org/grpc v1.66.2/go.mod h1:s3/l6xSSCURdVfAnL+TqCNMyTDAGN6+lZeVxnZR128Y= +google.golang.org/grpc v1.67.0 h1:IdH9y6PF5MPSdAntIcpjQ+tXO41pcQsfZV2RxtQgVcw= +google.golang.org/grpc v1.67.0/go.mod h1:1gLDyUQU7CTLJI90u3nXZ9ekeghjeM7pTDZlqFNg2AA= google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/receiver/internal/factory.go b/receiver/internal/factory.go deleted file mode 100644 index bd7f581e382..00000000000 --- a/receiver/internal/factory.go +++ /dev/null @@ -1,211 +0,0 @@ -// Copyright The OpenTelemetry Authors -// SPDX-License-Identifier: Apache-2.0 - -package internal // import "go.opentelemetry.io/collector/receiver/internal" - -import ( - "context" - - "go.opentelemetry.io/collector/component" - "go.opentelemetry.io/collector/consumer" - "go.opentelemetry.io/collector/consumer/consumerprofiles" -) - -// Factory is a factory interface for receivers. -// -// This interface cannot be directly implemented. Implementations must -// use the NewReceiverFactory to implement it. -type Factory interface { - component.Factory - - // CreateTracesReceiver creates a TracesReceiver based on this config. - // If the receiver type does not support traces, - // this function returns the error [component.ErrDataTypeIsNotSupported]. - // Implementers can assume `nextConsumer` is never nil. - CreateTracesReceiver(ctx context.Context, set Settings, cfg component.Config, nextConsumer consumer.Traces) (Traces, error) - - // TracesReceiverStability gets the stability level of the TracesReceiver. - TracesReceiverStability() component.StabilityLevel - - // CreateMetricsReceiver creates a MetricsReceiver based on this config. - // If the receiver type does not support metrics, - // this function returns the error [component.ErrDataTypeIsNotSupported]. - // Implementers can assume `nextConsumer` is never nil. - CreateMetricsReceiver(ctx context.Context, set Settings, cfg component.Config, nextConsumer consumer.Metrics) (Metrics, error) - - // MetricsReceiverStability gets the stability level of the MetricsReceiver. - MetricsReceiverStability() component.StabilityLevel - - // CreateLogsReceiver creates a LogsReceiver based on this config. - // If the receiver type does not support logs, - // this function returns the error [component.ErrDataTypeIsNotSupported]. - // Implementers can assume `nextConsumer` is never nil. - CreateLogsReceiver(ctx context.Context, set Settings, cfg component.Config, nextConsumer consumer.Logs) (Logs, error) - - // LogsReceiverStability gets the stability level of the LogsReceiver. - LogsReceiverStability() component.StabilityLevel - - // CreateProfilesReceiver creates a ProfilesReceiver based on this config. - // If the receiver type does not support tracing or if the config is not valid - // an error will be returned instead. `nextConsumer` is never nil. - CreateProfilesReceiver(ctx context.Context, set Settings, cfg component.Config, nextConsumer consumerprofiles.Profiles) (Profiles, error) - - // ProfilesReceiverStability gets the stability level of the ProfilesReceiver. - ProfilesReceiverStability() component.StabilityLevel - - unexportedFactoryFunc() -} - -// FactoryOption apply changes to ReceiverOptions. -type FactoryOption interface { - // applyOption applies the option. - applyOption(o *factory) -} - -// factoryOptionFunc is an ReceiverFactoryOption created through a function. -type factoryOptionFunc func(*factory) - -func (f factoryOptionFunc) applyOption(o *factory) { - f(o) -} - -// CreateTracesFunc is the equivalent of Factory.CreateTraces. -type CreateTracesFunc func(context.Context, Settings, component.Config, consumer.Traces) (Traces, error) - -// CreateTracesReceiver implements Factory.CreateTracesReceiver(). -func (f CreateTracesFunc) CreateTracesReceiver( - ctx context.Context, - set Settings, - cfg component.Config, - nextConsumer consumer.Traces) (Traces, error) { - if f == nil { - return nil, component.ErrDataTypeIsNotSupported - } - return f(ctx, set, cfg, nextConsumer) -} - -// CreateMetricsFunc is the equivalent of Factory.CreateMetrics. -type CreateMetricsFunc func(context.Context, Settings, component.Config, consumer.Metrics) (Metrics, error) - -// CreateMetricsReceiver implements Factory.CreateMetricsReceiver(). -func (f CreateMetricsFunc) CreateMetricsReceiver( - ctx context.Context, - set Settings, - cfg component.Config, - nextConsumer consumer.Metrics, -) (Metrics, error) { - if f == nil { - return nil, component.ErrDataTypeIsNotSupported - } - return f(ctx, set, cfg, nextConsumer) -} - -// CreateLogsFunc is the equivalent of ReceiverFactory.CreateLogsReceiver(). -type CreateLogsFunc func(context.Context, Settings, component.Config, consumer.Logs) (Logs, error) - -// CreateLogsReceiver implements Factory.CreateLogsReceiver(). -func (f CreateLogsFunc) CreateLogsReceiver( - ctx context.Context, - set Settings, - cfg component.Config, - nextConsumer consumer.Logs, -) (Logs, error) { - if f == nil { - return nil, component.ErrDataTypeIsNotSupported - } - return f(ctx, set, cfg, nextConsumer) -} - -// CreateProfilesFunc is the equivalent of Factory.CreateProfiles. -type CreateProfilesFunc func(context.Context, Settings, component.Config, consumerprofiles.Profiles) (Profiles, error) - -// CreateProfilesReceiver implements Factory.CreateProfilesReceiver(). -func (f CreateProfilesFunc) CreateProfilesReceiver( - ctx context.Context, - set Settings, - cfg component.Config, - nextConsumer consumerprofiles.Profiles) (Profiles, error) { - if f == nil { - return nil, component.ErrDataTypeIsNotSupported - } - return f(ctx, set, cfg, nextConsumer) -} - -type factory struct { - cfgType component.Type - component.CreateDefaultConfigFunc - CreateTracesFunc - tracesStabilityLevel component.StabilityLevel - CreateMetricsFunc - metricsStabilityLevel component.StabilityLevel - CreateLogsFunc - logsStabilityLevel component.StabilityLevel - CreateProfilesFunc - profilesStabilityLevel component.StabilityLevel -} - -func (f *factory) Type() component.Type { - return f.cfgType -} - -func (f *factory) unexportedFactoryFunc() {} - -func (f *factory) TracesReceiverStability() component.StabilityLevel { - return f.tracesStabilityLevel -} - -func (f *factory) MetricsReceiverStability() component.StabilityLevel { - return f.metricsStabilityLevel -} - -func (f *factory) LogsReceiverStability() component.StabilityLevel { - return f.logsStabilityLevel -} - -func (f *factory) ProfilesReceiverStability() component.StabilityLevel { - return f.profilesStabilityLevel -} - -// WithTraces overrides the default "error not supported" implementation for CreateTracesReceiver and the default "undefined" stability level. -func WithTraces(createTracesReceiver CreateTracesFunc, sl component.StabilityLevel) FactoryOption { - return factoryOptionFunc(func(o *factory) { - o.tracesStabilityLevel = sl - o.CreateTracesFunc = createTracesReceiver - }) -} - -// WithMetrics overrides the default "error not supported" implementation for CreateMetricsReceiver and the default "undefined" stability level. -func WithMetrics(createMetricsReceiver CreateMetricsFunc, sl component.StabilityLevel) FactoryOption { - return factoryOptionFunc(func(o *factory) { - o.metricsStabilityLevel = sl - o.CreateMetricsFunc = createMetricsReceiver - }) -} - -// WithLogs overrides the default "error not supported" implementation for CreateLogsReceiver and the default "undefined" stability level. -func WithLogs(createLogsReceiver CreateLogsFunc, sl component.StabilityLevel) FactoryOption { - return factoryOptionFunc(func(o *factory) { - o.logsStabilityLevel = sl - o.CreateLogsFunc = createLogsReceiver - }) -} - -// WithProfiles overrides the default "error not supported" implementation for CreateProfilesReceiver and the default "undefined" stability level. -func WithProfiles(createProfilesReceiver CreateProfilesFunc, sl component.StabilityLevel) FactoryOption { - return factoryOptionFunc(func(o *factory) { - o.profilesStabilityLevel = sl - o.CreateProfilesFunc = createProfilesReceiver - }) -} - -// NewFactory returns a Factory. -func NewFactory(cfgType component.Type, createDefaultConfig component.CreateDefaultConfigFunc, options ...FactoryOption) Factory { - f := &factory{ - cfgType: cfgType, - CreateDefaultConfigFunc: createDefaultConfig, - } - for _, opt := range options { - opt.applyOption(f) - } - return f -} diff --git a/receiver/internal/logs.go b/receiver/internal/logs.go deleted file mode 100644 index e72bb1ad84a..00000000000 --- a/receiver/internal/logs.go +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright The OpenTelemetry Authors -// SPDX-License-Identifier: Apache-2.0 - -package internal // import "go.opentelemetry.io/collector/receiver/internal" - -import "go.opentelemetry.io/collector/component" - -// Logs receiver receives logs. -// Its purpose is to translate data from any format to the collector's internal logs data format. -// LogsReceiver feeds a consumer.Logs with data. -// -// For example, it could be a receiver that reads syslogs and convert them into plog.Logs. -type Logs interface { - component.Component -} diff --git a/receiver/internal/metrics.go b/receiver/internal/metrics.go deleted file mode 100644 index 3f5dbd25b0e..00000000000 --- a/receiver/internal/metrics.go +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright The OpenTelemetry Authors -// SPDX-License-Identifier: Apache-2.0 - -package internal // import "go.opentelemetry.io/collector/receiver/internal" - -import "go.opentelemetry.io/collector/component" - -// Metrics receiver receives metrics. -// Its purpose is to translate data from any format to the collector's internal metrics format. -// MetricsReceiver feeds a consumer.Metrics with data. -// -// For example, it could be Prometheus data source which translates Prometheus metrics into pmetric.Metrics. -type Metrics interface { - component.Component -} diff --git a/receiver/internal/profiles.go b/receiver/internal/profiles.go deleted file mode 100644 index 04c784247f5..00000000000 --- a/receiver/internal/profiles.go +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright The OpenTelemetry Authors -// SPDX-License-Identifier: Apache-2.0 - -package internal // import "go.opentelemetry.io/collector/receiver/internal" - -import "go.opentelemetry.io/collector/component" - -// Profiless receiver receives profiles. -// Its purpose is to translate data from any format to the collector's internal profile format. -// ProfilesReceiver feeds a consumer.Profiles with data. -// -// For example, it could be a pprof data source which translates pprof profiles into pprofile.Profiles. -type Profiles interface { - component.Component -} diff --git a/receiver/internal/receiver.go b/receiver/internal/receiver.go deleted file mode 100644 index bbfeaffae35..00000000000 --- a/receiver/internal/receiver.go +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright The OpenTelemetry Authors -// SPDX-License-Identifier: Apache-2.0 - -package internal // import "go.opentelemetry.io/collector/receiver/internal" - -import "go.opentelemetry.io/collector/component" - -// Settings configures Receiver creators. -type Settings struct { - // ID returns the ID of the component that will be created. - ID component.ID - - component.TelemetrySettings - - // BuildInfo can be used by components for informational purposes. - BuildInfo component.BuildInfo -} diff --git a/receiver/internal/traces.go b/receiver/internal/traces.go deleted file mode 100644 index 8b1a1b37eda..00000000000 --- a/receiver/internal/traces.go +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright The OpenTelemetry Authors -// SPDX-License-Identifier: Apache-2.0 - -package internal // import "go.opentelemetry.io/collector/receiver/internal" - -import "go.opentelemetry.io/collector/component" - -// 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. -// -// For example, it could be Zipkin data source which translates Zipkin spans into ptrace.Traces. -type Traces interface { - component.Component -} diff --git a/receiver/nopreceiver/go.mod b/receiver/nopreceiver/go.mod index 9261058011e..e64cf99fbf0 100644 --- a/receiver/nopreceiver/go.mod +++ b/receiver/nopreceiver/go.mod @@ -4,11 +4,11 @@ go 1.22.0 require ( github.com/stretchr/testify v1.9.0 - go.opentelemetry.io/collector/component v0.109.0 - go.opentelemetry.io/collector/confmap v1.15.0 - go.opentelemetry.io/collector/consumer v0.109.0 - go.opentelemetry.io/collector/consumer/consumertest v0.109.0 - go.opentelemetry.io/collector/receiver v0.109.0 + go.opentelemetry.io/collector/component v0.110.0 + go.opentelemetry.io/collector/confmap v1.16.0 + go.opentelemetry.io/collector/consumer v0.110.0 + go.opentelemetry.io/collector/consumer/consumertest v0.110.0 + go.opentelemetry.io/collector/receiver v0.110.0 go.uber.org/goleak v1.3.0 ) @@ -28,11 +28,14 @@ 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.109.0 // indirect - go.opentelemetry.io/collector/consumer/consumerprofiles v0.109.0 // indirect - go.opentelemetry.io/collector/pdata v1.15.0 // indirect - go.opentelemetry.io/collector/pdata/pprofile v0.109.0 // indirect - go.opentelemetry.io/collector/receiver/receiverprofiles v0.109.0 // indirect + go.opentelemetry.io/collector/component/componentprofiles v0.110.0 // indirect + go.opentelemetry.io/collector/config/configtelemetry v0.110.0 // indirect + go.opentelemetry.io/collector/consumer/consumerprofiles v0.110.0 // indirect + go.opentelemetry.io/collector/internal/globalsignal v0.110.0 // indirect + go.opentelemetry.io/collector/pdata v1.16.0 // indirect + go.opentelemetry.io/collector/pdata/pprofile v0.110.0 // indirect + go.opentelemetry.io/collector/pipeline v0.110.0 // indirect + go.opentelemetry.io/collector/receiver/receiverprofiles v0.110.0 // indirect go.opentelemetry.io/otel v1.30.0 // indirect go.opentelemetry.io/otel/metric v1.30.0 // indirect go.opentelemetry.io/otel/sdk v1.30.0 // indirect @@ -44,7 +47,7 @@ require ( golang.org/x/sys v0.25.0 // indirect golang.org/x/text v0.17.0 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240822170219-fc7c04adadcd // indirect - google.golang.org/grpc v1.66.2 // indirect + google.golang.org/grpc v1.67.0 // indirect google.golang.org/protobuf v1.34.2 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) @@ -70,3 +73,9 @@ replace go.opentelemetry.io/collector/consumer/consumerprofiles => ../../consume replace go.opentelemetry.io/collector/consumer/consumertest => ../../consumer/consumertest replace go.opentelemetry.io/collector/receiver/receiverprofiles => ../receiverprofiles + +replace go.opentelemetry.io/collector/pipeline => ../../pipeline + +replace go.opentelemetry.io/collector/internal/globalsignal => ../../internal/globalsignal + +replace go.opentelemetry.io/collector/component/componentprofiles => ../../component/componentprofiles diff --git a/receiver/nopreceiver/go.sum b/receiver/nopreceiver/go.sum index 90440acee84..a66d321512b 100644 --- a/receiver/nopreceiver/go.sum +++ b/receiver/nopreceiver/go.sum @@ -97,8 +97,8 @@ golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8T golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/genproto/googleapis/rpc v0.0.0-20240822170219-fc7c04adadcd h1:6TEm2ZxXoQmFWFlt1vNxvVOa1Q0dXFQD1m/rYjXmS0E= google.golang.org/genproto/googleapis/rpc v0.0.0-20240822170219-fc7c04adadcd/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU= -google.golang.org/grpc v1.66.2 h1:3QdXkuq3Bkh7w+ywLdLvM56cmGvQHUMZpiCzt6Rqaoo= -google.golang.org/grpc v1.66.2/go.mod h1:s3/l6xSSCURdVfAnL+TqCNMyTDAGN6+lZeVxnZR128Y= +google.golang.org/grpc v1.67.0 h1:IdH9y6PF5MPSdAntIcpjQ+tXO41pcQsfZV2RxtQgVcw= +google.golang.org/grpc v1.67.0/go.mod h1:1gLDyUQU7CTLJI90u3nXZ9ekeghjeM7pTDZlqFNg2AA= google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/receiver/otlpreceiver/factory.go b/receiver/otlpreceiver/factory.go index 465dd7dc676..aebdffafad0 100644 --- a/receiver/otlpreceiver/factory.go +++ b/receiver/otlpreceiver/factory.go @@ -5,7 +5,6 @@ package otlpreceiver // import "go.opentelemetry.io/collector/receiver/otlprecei import ( "context" - "fmt" "go.opentelemetry.io/collector/component" "go.opentelemetry.io/collector/config/configgrpc" @@ -13,7 +12,6 @@ import ( "go.opentelemetry.io/collector/config/confignet" "go.opentelemetry.io/collector/consumer" "go.opentelemetry.io/collector/consumer/consumerprofiles" - "go.opentelemetry.io/collector/internal/globalgates" "go.opentelemetry.io/collector/internal/sharedcomponent" "go.opentelemetry.io/collector/receiver" "go.opentelemetry.io/collector/receiver/otlpreceiver/internal/metadata" @@ -21,9 +19,6 @@ import ( ) const ( - grpcPort = 4317 - httpPort = 4318 - defaultTracesURLPath = "/v1/traces" defaultMetricsURLPath = "/v1/metrics" defaultLogsURLPath = "/v1/logs" @@ -32,12 +27,12 @@ const ( // NewFactory creates a new OTLP receiver factory. func NewFactory() receiver.Factory { - return receiver.NewFactory( + return receiverprofiles.NewFactory( metadata.Type, createDefaultConfig, - receiver.WithTraces(createTraces, metadata.TracesStability), - receiver.WithMetrics(createMetrics, metadata.MetricsStability), - receiver.WithLogs(createLog, metadata.LogsStability), + receiverprofiles.WithTraces(createTraces, metadata.TracesStability), + receiverprofiles.WithMetrics(createMetrics, metadata.MetricsStability), + receiverprofiles.WithLogs(createLog, metadata.LogsStability), receiverprofiles.WithProfiles(createProfiles, metadata.ProfilesStability), ) } @@ -48,7 +43,7 @@ func createDefaultConfig() component.Config { Protocols: Protocols{ GRPC: &configgrpc.ServerConfig{ NetAddr: confignet.AddrConfig{ - Endpoint: endpointForPort(globalgates.UseLocalHostAsDefaultHostfeatureGate.IsEnabled(), grpcPort), + Endpoint: "localhost:4317", Transport: confignet.TransportTypeTCP, }, // We almost write 0 bytes, so no need to tune WriteBufferSize. @@ -56,7 +51,7 @@ func createDefaultConfig() component.Config { }, HTTP: &HTTPConfig{ ServerConfig: &confighttp.ServerConfig{ - Endpoint: endpointForPort(globalgates.UseLocalHostAsDefaultHostfeatureGate.IsEnabled(), httpPort), + Endpoint: "localhost:4318", }, TracesURLPath: defaultTracesURLPath, MetricsURLPath: defaultMetricsURLPath, @@ -165,12 +160,3 @@ func createProfiles( // When the receiver is shutdown it should be removed from this map so the same configuration // can be recreated successfully. var receivers = sharedcomponent.NewMap[*Config, *otlpReceiver]() - -// endpointForPort gets the endpoint for a given port using localhost or 0.0.0.0 depending on the feature gate. -func endpointForPort(useLocalHostAsDefault bool, port int) string { - host := "localhost" - if !useLocalHostAsDefault { - host = "0.0.0.0" - } - return fmt.Sprintf("%s:%d", host, port) -} diff --git a/receiver/otlpreceiver/factory_test.go b/receiver/otlpreceiver/factory_test.go index c77b19514b0..10afd012da6 100644 --- a/receiver/otlpreceiver/factory_test.go +++ b/receiver/otlpreceiver/factory_test.go @@ -18,6 +18,7 @@ import ( "go.opentelemetry.io/collector/consumer/consumerprofiles" "go.opentelemetry.io/collector/consumer/consumertest" "go.opentelemetry.io/collector/internal/testutil" + "go.opentelemetry.io/collector/receiver/receiverprofiles" "go.opentelemetry.io/collector/receiver/receivertest" ) @@ -47,7 +48,7 @@ func TestCreateSameReceiver(t *testing.T) { assert.NotNil(t, lReceiver) require.NoError(t, err) - pReceiver, err := factory.CreateProfilesReceiver(context.Background(), creationSet, cfg, consumertest.NewNop()) + pReceiver, err := factory.(receiverprofiles.Factory).CreateProfilesReceiver(context.Background(), creationSet, cfg, consumertest.NewNop()) assert.NotNil(t, pReceiver) require.NoError(t, err) @@ -415,7 +416,7 @@ func TestCreateProfilesReceiver(t *testing.T) { creationSet := receivertest.NewNopSettings() for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - tr, err := factory.CreateProfilesReceiver(ctx, creationSet, tt.cfg, tt.sink) + tr, err := factory.(receiverprofiles.Factory).CreateProfilesReceiver(ctx, creationSet, tt.cfg, tt.sink) if tt.wantErr { assert.Error(t, err) return @@ -430,38 +431,3 @@ func TestCreateProfilesReceiver(t *testing.T) { }) } } - -func TestEndpointForPort(t *testing.T) { - tests := []struct { - port int - enabled bool - endpoint string - }{ - { - port: 4317, - enabled: false, - endpoint: "0.0.0.0:4317", - }, - { - port: 4317, - enabled: true, - endpoint: "localhost:4317", - }, - { - port: 0, - enabled: false, - endpoint: "0.0.0.0:0", - }, - { - port: 0, - enabled: true, - endpoint: "localhost:0", - }, - } - - for _, tt := range tests { - t.Run(tt.endpoint, func(t *testing.T) { - assert.Equal(t, endpointForPort(tt.enabled, tt.port), tt.endpoint) - }) - } -} diff --git a/receiver/otlpreceiver/go.mod b/receiver/otlpreceiver/go.mod index 7e82c33b361..cf328b26bb6 100644 --- a/receiver/otlpreceiver/go.mod +++ b/receiver/otlpreceiver/go.mod @@ -4,30 +4,29 @@ go 1.22.0 require ( github.com/gogo/protobuf v1.3.2 - github.com/klauspost/compress v1.17.9 + github.com/klauspost/compress v1.17.10 github.com/stretchr/testify v1.9.0 - go.opentelemetry.io/collector v0.109.0 - go.opentelemetry.io/collector/component v0.109.0 - go.opentelemetry.io/collector/component/componentstatus v0.109.0 - go.opentelemetry.io/collector/config/configauth v0.109.0 - go.opentelemetry.io/collector/config/configgrpc v0.109.0 - go.opentelemetry.io/collector/config/confighttp v0.109.0 - go.opentelemetry.io/collector/config/confignet v0.109.0 - go.opentelemetry.io/collector/config/configtls v1.15.0 - go.opentelemetry.io/collector/confmap v1.15.0 - go.opentelemetry.io/collector/consumer v0.109.0 - go.opentelemetry.io/collector/consumer/consumerprofiles v0.109.0 - go.opentelemetry.io/collector/consumer/consumertest v0.109.0 - go.opentelemetry.io/collector/internal/globalgates v0.109.0 - go.opentelemetry.io/collector/pdata v1.15.0 - go.opentelemetry.io/collector/pdata/pprofile v0.109.0 - go.opentelemetry.io/collector/pdata/testdata v0.109.0 - go.opentelemetry.io/collector/receiver v0.109.0 - go.opentelemetry.io/collector/receiver/receiverprofiles v0.109.0 + go.opentelemetry.io/collector v0.110.0 + go.opentelemetry.io/collector/component v0.110.0 + go.opentelemetry.io/collector/component/componentstatus v0.110.0 + go.opentelemetry.io/collector/config/configauth v0.110.0 + go.opentelemetry.io/collector/config/configgrpc v0.110.0 + go.opentelemetry.io/collector/config/confighttp v0.110.0 + go.opentelemetry.io/collector/config/confignet v1.16.0 + go.opentelemetry.io/collector/config/configtls v1.16.0 + go.opentelemetry.io/collector/confmap v1.16.0 + go.opentelemetry.io/collector/consumer v0.110.0 + go.opentelemetry.io/collector/consumer/consumerprofiles v0.110.0 + go.opentelemetry.io/collector/consumer/consumertest v0.110.0 + go.opentelemetry.io/collector/pdata v1.16.0 + go.opentelemetry.io/collector/pdata/pprofile v0.110.0 + go.opentelemetry.io/collector/pdata/testdata v0.110.0 + go.opentelemetry.io/collector/receiver v0.110.0 + go.opentelemetry.io/collector/receiver/receiverprofiles v0.110.0 go.uber.org/goleak v1.3.0 go.uber.org/zap v1.27.0 google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1 - google.golang.org/grpc v1.66.2 + google.golang.org/grpc v1.67.0 google.golang.org/protobuf v1.34.2 ) @@ -40,7 +39,6 @@ require ( 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/hashicorp/go-version v1.7.0 // indirect github.com/json-iterator/go v1.1.12 // indirect github.com/knadh/koanf/maps v0.1.1 // indirect github.com/knadh/koanf/providers/confmap v0.1.0 // indirect @@ -52,14 +50,16 @@ require ( github.com/mostynb/go-grpc-compression v1.2.3 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/rs/cors v1.11.1 // indirect - go.opentelemetry.io/collector/client v1.15.0 // indirect - go.opentelemetry.io/collector/config/configcompression v1.15.0 // indirect - go.opentelemetry.io/collector/config/configopaque v1.15.0 // indirect - go.opentelemetry.io/collector/config/configtelemetry v0.109.0 // indirect - go.opentelemetry.io/collector/config/internal v0.109.1-0.20240916143658-74729e731d3b // indirect - go.opentelemetry.io/collector/extension v0.109.0 // indirect - go.opentelemetry.io/collector/extension/auth v0.109.0 // indirect - go.opentelemetry.io/collector/featuregate v1.15.0 // indirect + go.opentelemetry.io/collector/client v1.16.0 // indirect + go.opentelemetry.io/collector/component/componentprofiles v0.110.0 // indirect + go.opentelemetry.io/collector/config/configcompression v1.16.0 // indirect + go.opentelemetry.io/collector/config/configopaque v1.16.0 // indirect + go.opentelemetry.io/collector/config/configtelemetry v0.110.0 // indirect + go.opentelemetry.io/collector/config/internal v0.110.0 // indirect + go.opentelemetry.io/collector/extension v0.110.0 // indirect + go.opentelemetry.io/collector/extension/auth v0.110.0 // indirect + go.opentelemetry.io/collector/internal/globalsignal v0.110.0 // indirect + go.opentelemetry.io/collector/pipeline v0.110.0 // indirect go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.55.0 // indirect go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.55.0 // indirect go.opentelemetry.io/otel v1.30.0 // indirect @@ -102,10 +102,6 @@ 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/pdata => ../../pdata replace go.opentelemetry.io/collector/pdata/testdata => ../../pdata/testdata @@ -126,6 +122,12 @@ replace go.opentelemetry.io/collector/component/componentstatus => ../../compone replace go.opentelemetry.io/collector/receiver/receiverprofiles => ../receiverprofiles +replace go.opentelemetry.io/collector/pipeline => ../../pipeline + +replace go.opentelemetry.io/collector/internal/globalsignal => ../../internal/globalsignal + +replace go.opentelemetry.io/collector/component/componentprofiles => ../../component/componentprofiles + 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 diff --git a/receiver/otlpreceiver/go.sum b/receiver/otlpreceiver/go.sum index adff47b38ed..92a37bd1384 100644 --- a/receiver/otlpreceiver/go.sum +++ b/receiver/otlpreceiver/go.sum @@ -21,14 +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/klauspost/compress v1.17.10 h1:oXAz+Vh0PMUvJczoi+flxpnBEPxoER1IaAnU/NMPtT0= +github.com/klauspost/compress v1.17.10/go.mod h1:pMDklpSncoRMuLFrf1W9Ss9KT+0rH90U12bZKk7uwG0= 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= @@ -115,8 +113,8 @@ golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8T golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1 h1:pPJltXNxVzT4pK9yD8vR9X75DaWYYmLGMsEvBfFQZzQ= google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU= -google.golang.org/grpc v1.66.2 h1:3QdXkuq3Bkh7w+ywLdLvM56cmGvQHUMZpiCzt6Rqaoo= -google.golang.org/grpc v1.66.2/go.mod h1:s3/l6xSSCURdVfAnL+TqCNMyTDAGN6+lZeVxnZR128Y= +google.golang.org/grpc v1.67.0 h1:IdH9y6PF5MPSdAntIcpjQ+tXO41pcQsfZV2RxtQgVcw= +google.golang.org/grpc v1.67.0/go.mod h1:1gLDyUQU7CTLJI90u3nXZ9ekeghjeM7pTDZlqFNg2AA= google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/receiver/otlpreceiver/otlp.go b/receiver/otlpreceiver/otlp.go index 1254f3a4a1f..7bcb01fa208 100644 --- a/receiver/otlpreceiver/otlp.go +++ b/receiver/otlpreceiver/otlp.go @@ -89,7 +89,7 @@ func (r *otlpReceiver) startGRPCServer(host component.Host) error { } var err error - if r.serverGRPC, err = r.cfg.GRPC.ToServerWithOptions(context.Background(), host, r.settings.TelemetrySettings); err != nil { + if r.serverGRPC, err = r.cfg.GRPC.ToServer(context.Background(), host, r.settings.TelemetrySettings); err != nil { return err } diff --git a/receiver/receiver.go b/receiver/receiver.go index 0f3b5a886fb..010a87735d3 100644 --- a/receiver/receiver.go +++ b/receiver/receiver.go @@ -4,10 +4,12 @@ package receiver // import "go.opentelemetry.io/collector/receiver" import ( + "context" "fmt" "go.opentelemetry.io/collector/component" - "go.opentelemetry.io/collector/receiver/internal" + "go.opentelemetry.io/collector/consumer" + "go.opentelemetry.io/collector/pipeline" ) // Traces receiver receives traces. @@ -15,61 +17,199 @@ import ( // TracesReceiver feeds a consumer.Traces with data. // // For example, it could be Zipkin data source which translates Zipkin spans into ptrace.Traces. -type Traces = internal.Traces +type Traces interface { + component.Component +} // Metrics receiver receives metrics. // Its purpose is to translate data from any format to the collector's internal metrics format. // MetricsReceiver feeds a consumer.Metrics with data. // // For example, it could be Prometheus data source which translates Prometheus metrics into pmetric.Metrics. -type Metrics = internal.Metrics +type Metrics interface { + component.Component +} // Logs receiver receives logs. // Its purpose is to translate data from any format to the collector's internal logs data format. // LogsReceiver feeds a consumer.Logs with data. // // For example, it could be a receiver that reads syslogs and convert them into plog.Logs. -type Logs = internal.Logs +type Logs interface { + component.Component +} // Settings configures Receiver creators. -type Settings = internal.Settings +type Settings struct { + // ID returns the ID of the component that will be created. + ID component.ID + + component.TelemetrySettings + + // BuildInfo can be used by components for informational purposes. + BuildInfo component.BuildInfo +} -// Factory is factory interface for receivers. +// Factory is a factory interface for receivers. // // This interface cannot be directly implemented. Implementations must // use the NewReceiverFactory to implement it. -type Factory = internal.Factory +type Factory interface { + component.Factory + + // CreateTracesReceiver creates a TracesReceiver based on this config. + // If the receiver type does not support traces, + // this function returns the error [pipeline.ErrSignalNotSupported]. + // Implementers can assume `nextConsumer` is never nil. + CreateTracesReceiver(ctx context.Context, set Settings, cfg component.Config, nextConsumer consumer.Traces) (Traces, error) + + // TracesReceiverStability gets the stability level of the TracesReceiver. + TracesReceiverStability() component.StabilityLevel + + // CreateMetricsReceiver creates a MetricsReceiver based on this config. + // If the receiver type does not support metrics, + // this function returns the error [pipeline.ErrSignalNotSupported]. + // Implementers can assume `nextConsumer` is never nil. + CreateMetricsReceiver(ctx context.Context, set Settings, cfg component.Config, nextConsumer consumer.Metrics) (Metrics, error) + + // MetricsReceiverStability gets the stability level of the MetricsReceiver. + MetricsReceiverStability() component.StabilityLevel + + // CreateLogsReceiver creates a LogsReceiver based on this config. + // If the receiver type does not support logs, + // this function returns the error [pipeline.ErrSignalNotSupported]. + // Implementers can assume `nextConsumer` is never nil. + CreateLogsReceiver(ctx context.Context, set Settings, cfg component.Config, nextConsumer consumer.Logs) (Logs, error) + + // LogsReceiverStability gets the stability level of the LogsReceiver. + LogsReceiverStability() component.StabilityLevel + + unexportedFactoryFunc() +} // FactoryOption apply changes to ReceiverOptions. -type FactoryOption = internal.FactoryOption +type FactoryOption interface { + // applyOption applies the option. + applyOption(o *factory) +} + +// factoryOptionFunc is an ReceiverFactoryOption created through a function. +type factoryOptionFunc func(*factory) + +func (f factoryOptionFunc) applyOption(o *factory) { + f(o) +} // CreateTracesFunc is the equivalent of Factory.CreateTraces. -type CreateTracesFunc = internal.CreateTracesFunc +type CreateTracesFunc func(context.Context, Settings, component.Config, consumer.Traces) (Traces, error) + +// CreateTracesReceiver implements Factory.CreateTracesReceiver(). +func (f CreateTracesFunc) CreateTracesReceiver( + ctx context.Context, + set Settings, + cfg component.Config, + nextConsumer consumer.Traces) (Traces, error) { + if f == nil { + return nil, pipeline.ErrSignalNotSupported + } + return f(ctx, set, cfg, nextConsumer) +} // CreateMetricsFunc is the equivalent of Factory.CreateMetrics. -type CreateMetricsFunc = internal.CreateMetricsFunc +type CreateMetricsFunc func(context.Context, Settings, component.Config, consumer.Metrics) (Metrics, error) + +// CreateMetricsReceiver implements Factory.CreateMetricsReceiver(). +func (f CreateMetricsFunc) CreateMetricsReceiver( + ctx context.Context, + set Settings, + cfg component.Config, + nextConsumer consumer.Metrics, +) (Metrics, error) { + if f == nil { + return nil, pipeline.ErrSignalNotSupported + } + return f(ctx, set, cfg, nextConsumer) +} // CreateLogsFunc is the equivalent of ReceiverFactory.CreateLogsReceiver(). -type CreateLogsFunc = internal.CreateLogsFunc +type CreateLogsFunc func(context.Context, Settings, component.Config, consumer.Logs) (Logs, error) + +// CreateLogsReceiver implements Factory.CreateLogsReceiver(). +func (f CreateLogsFunc) CreateLogsReceiver( + ctx context.Context, + set Settings, + cfg component.Config, + nextConsumer consumer.Logs, +) (Logs, error) { + if f == nil { + return nil, pipeline.ErrSignalNotSupported + } + return f(ctx, set, cfg, nextConsumer) +} + +type factory struct { + cfgType component.Type + component.CreateDefaultConfigFunc + CreateTracesFunc + tracesStabilityLevel component.StabilityLevel + CreateMetricsFunc + metricsStabilityLevel component.StabilityLevel + CreateLogsFunc + logsStabilityLevel component.StabilityLevel +} + +func (f *factory) Type() component.Type { + return f.cfgType +} + +func (f *factory) unexportedFactoryFunc() {} + +func (f *factory) TracesReceiverStability() component.StabilityLevel { + return f.tracesStabilityLevel +} + +func (f *factory) MetricsReceiverStability() component.StabilityLevel { + return f.metricsStabilityLevel +} + +func (f *factory) LogsReceiverStability() component.StabilityLevel { + return f.logsStabilityLevel +} // WithTraces overrides the default "error not supported" implementation for CreateTracesReceiver and the default "undefined" stability level. func WithTraces(createTracesReceiver CreateTracesFunc, sl component.StabilityLevel) FactoryOption { - return internal.WithTraces(createTracesReceiver, sl) + return factoryOptionFunc(func(o *factory) { + o.tracesStabilityLevel = sl + o.CreateTracesFunc = createTracesReceiver + }) } // WithMetrics overrides the default "error not supported" implementation for CreateMetricsReceiver and the default "undefined" stability level. func WithMetrics(createMetricsReceiver CreateMetricsFunc, sl component.StabilityLevel) FactoryOption { - return internal.WithMetrics(createMetricsReceiver, sl) + return factoryOptionFunc(func(o *factory) { + o.metricsStabilityLevel = sl + o.CreateMetricsFunc = createMetricsReceiver + }) } // WithLogs overrides the default "error not supported" implementation for CreateLogsReceiver and the default "undefined" stability level. func WithLogs(createLogsReceiver CreateLogsFunc, sl component.StabilityLevel) FactoryOption { - return internal.WithLogs(createLogsReceiver, sl) + return factoryOptionFunc(func(o *factory) { + o.logsStabilityLevel = sl + o.CreateLogsFunc = createLogsReceiver + }) } // NewFactory returns a Factory. func NewFactory(cfgType component.Type, createDefaultConfig component.CreateDefaultConfigFunc, options ...FactoryOption) Factory { - return internal.NewFactory(cfgType, createDefaultConfig, options...) + f := &factory{ + cfgType: cfgType, + CreateDefaultConfigFunc: createDefaultConfig, + } + for _, opt := range options { + opt.applyOption(f) + } + return f } // MakeFactoryMap takes a list of receiver factories and returns a map with factory type as keys. diff --git a/receiver/receiverhelper/obsreport.go b/receiver/receiverhelper/obsreport.go index 790adb60f4c..c92c464ff53 100644 --- a/receiver/receiverhelper/obsreport.go +++ b/receiver/receiverhelper/obsreport.go @@ -14,6 +14,7 @@ import ( "go.opentelemetry.io/otel/trace" "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/pipeline" "go.opentelemetry.io/collector/receiver" "go.opentelemetry.io/collector/receiver/internal" "go.opentelemetry.io/collector/receiver/receiverhelper/internal/metadata" @@ -82,7 +83,7 @@ func (rec *ObsReport) EndTracesOp( numReceivedSpans int, err error, ) { - rec.endOp(receiverCtx, format, numReceivedSpans, err, component.DataTypeTraces) + rec.endOp(receiverCtx, format, numReceivedSpans, err, pipeline.SignalTraces) } // StartLogsOp is called when a request is received from a client. @@ -100,7 +101,7 @@ func (rec *ObsReport) EndLogsOp( numReceivedLogRecords int, err error, ) { - rec.endOp(receiverCtx, format, numReceivedLogRecords, err, component.DataTypeLogs) + rec.endOp(receiverCtx, format, numReceivedLogRecords, err, pipeline.SignalLogs) } // StartMetricsOp is called when a request is received from a client. @@ -118,7 +119,7 @@ func (rec *ObsReport) EndMetricsOp( numReceivedPoints int, err error, ) { - rec.endOp(receiverCtx, format, numReceivedPoints, err, component.DataTypeMetrics) + rec.endOp(receiverCtx, format, numReceivedPoints, err, pipeline.SignalMetrics) } // startOp creates the span used to trace the operation. Returning @@ -152,7 +153,7 @@ func (rec *ObsReport) endOp( format string, numReceivedItems int, err error, - dataType component.DataType, + signal pipeline.Signal, ) { numAccepted := numReceivedItems numRefused := 0 @@ -163,19 +164,19 @@ func (rec *ObsReport) endOp( span := trace.SpanFromContext(receiverCtx) - rec.recordMetrics(receiverCtx, dataType, numAccepted, numRefused) + rec.recordMetrics(receiverCtx, signal, numAccepted, numRefused) // end span according to errors if span.IsRecording() { var acceptedItemsKey, refusedItemsKey string - switch dataType { - case component.DataTypeTraces: + switch signal { + case pipeline.SignalTraces: acceptedItemsKey = internal.AcceptedSpansKey refusedItemsKey = internal.RefusedSpansKey - case component.DataTypeMetrics: + case pipeline.SignalMetrics: acceptedItemsKey = internal.AcceptedMetricPointsKey refusedItemsKey = internal.RefusedMetricPointsKey - case component.DataTypeLogs: + case pipeline.SignalLogs: acceptedItemsKey = internal.AcceptedLogRecordsKey refusedItemsKey = internal.RefusedLogRecordsKey } @@ -192,16 +193,16 @@ func (rec *ObsReport) endOp( span.End() } -func (rec *ObsReport) recordMetrics(receiverCtx context.Context, dataType component.DataType, numAccepted, numRefused int) { +func (rec *ObsReport) recordMetrics(receiverCtx context.Context, signal pipeline.Signal, numAccepted, numRefused int) { var acceptedMeasure, refusedMeasure metric.Int64Counter - switch dataType { - case component.DataTypeTraces: + switch signal { + case pipeline.SignalTraces: acceptedMeasure = rec.telemetryBuilder.ReceiverAcceptedSpans refusedMeasure = rec.telemetryBuilder.ReceiverRefusedSpans - case component.DataTypeMetrics: + case pipeline.SignalMetrics: acceptedMeasure = rec.telemetryBuilder.ReceiverAcceptedMetricPoints refusedMeasure = rec.telemetryBuilder.ReceiverRefusedMetricPoints - case component.DataTypeLogs: + case pipeline.SignalLogs: acceptedMeasure = rec.telemetryBuilder.ReceiverAcceptedLogRecords refusedMeasure = rec.telemetryBuilder.ReceiverRefusedLogRecords } diff --git a/receiver/receiverprofiles/go.mod b/receiver/receiverprofiles/go.mod index 283d25e5208..29829051221 100644 --- a/receiver/receiverprofiles/go.mod +++ b/receiver/receiverprofiles/go.mod @@ -4,10 +4,11 @@ go 1.22.0 require ( github.com/stretchr/testify v1.9.0 - go.opentelemetry.io/collector/component v0.109.0 - go.opentelemetry.io/collector/consumer/consumerprofiles v0.109.0 - go.opentelemetry.io/collector/consumer/consumertest v0.109.0 - go.opentelemetry.io/collector/receiver v0.109.0 + go.opentelemetry.io/collector/component v0.110.0 + go.opentelemetry.io/collector/consumer/consumerprofiles v0.110.0 + go.opentelemetry.io/collector/consumer/consumertest v0.110.0 + go.opentelemetry.io/collector/pipeline v0.110.0 + go.opentelemetry.io/collector/receiver v0.110.0 ) require ( @@ -17,10 +18,11 @@ 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.109.0 // indirect - go.opentelemetry.io/collector/consumer v0.109.0 // indirect - go.opentelemetry.io/collector/pdata v1.15.0 // indirect - go.opentelemetry.io/collector/pdata/pprofile v0.109.0 // indirect + go.opentelemetry.io/collector/config/configtelemetry v0.110.0 // indirect + go.opentelemetry.io/collector/consumer v0.110.0 // indirect + go.opentelemetry.io/collector/internal/globalsignal v0.110.0 // indirect + go.opentelemetry.io/collector/pdata v1.16.0 // indirect + go.opentelemetry.io/collector/pdata/pprofile v0.110.0 // indirect go.opentelemetry.io/otel v1.30.0 // indirect go.opentelemetry.io/otel/metric v1.30.0 // indirect go.opentelemetry.io/otel/trace v1.30.0 // indirect @@ -30,7 +32,7 @@ require ( golang.org/x/sys v0.25.0 // indirect golang.org/x/text v0.17.0 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240822170219-fc7c04adadcd // indirect - google.golang.org/grpc v1.66.2 // indirect + google.golang.org/grpc v1.67.0 // indirect google.golang.org/protobuf v1.34.2 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) @@ -52,3 +54,9 @@ 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/pipeline => ../../pipeline + +replace go.opentelemetry.io/collector/internal/globalsignal => ../../internal/globalsignal + +replace go.opentelemetry.io/collector/component/componentprofiles => ../../component/componentprofiles diff --git a/receiver/receiverprofiles/go.sum b/receiver/receiverprofiles/go.sum index 233d0fd2ec2..5065b82d011 100644 --- a/receiver/receiverprofiles/go.sum +++ b/receiver/receiverprofiles/go.sum @@ -78,8 +78,8 @@ golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8T golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/genproto/googleapis/rpc v0.0.0-20240822170219-fc7c04adadcd h1:6TEm2ZxXoQmFWFlt1vNxvVOa1Q0dXFQD1m/rYjXmS0E= google.golang.org/genproto/googleapis/rpc v0.0.0-20240822170219-fc7c04adadcd/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU= -google.golang.org/grpc v1.66.2 h1:3QdXkuq3Bkh7w+ywLdLvM56cmGvQHUMZpiCzt6Rqaoo= -google.golang.org/grpc v1.66.2/go.mod h1:s3/l6xSSCURdVfAnL+TqCNMyTDAGN6+lZeVxnZR128Y= +google.golang.org/grpc v1.67.0 h1:IdH9y6PF5MPSdAntIcpjQ+tXO41pcQsfZV2RxtQgVcw= +google.golang.org/grpc v1.67.0/go.mod h1:1gLDyUQU7CTLJI90u3nXZ9ekeghjeM7pTDZlqFNg2AA= google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/receiver/receiverprofiles/profiles.go b/receiver/receiverprofiles/profiles.go index a98668a04dc..d3c560bb398 100644 --- a/receiver/receiverprofiles/profiles.go +++ b/receiver/receiverprofiles/profiles.go @@ -4,9 +4,12 @@ package receiverprofiles // import "go.opentelemetry.io/collector/receiver/receiverprofiles" import ( + "context" + "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/consumer/consumerprofiles" + "go.opentelemetry.io/collector/pipeline" "go.opentelemetry.io/collector/receiver" - "go.opentelemetry.io/collector/receiver/internal" ) // Profiles receiver receives profiles. @@ -14,12 +17,113 @@ import ( // ProfilessReceiver feeds a consumerprofiles.Profiles with data. // // For example, it could be a pprof data source which translates pprof profiles into pprofile.Profiles. -type Profiles = internal.Profiles +type Profiles interface { + component.Component +} + +// Factory is a factory interface for receivers. +// +// This interface cannot be directly implemented. Implementations must +// use the NewReceiverFactory to implement it. +type Factory interface { + receiver.Factory + + // CreateProfilesReceiver creates a ProfilesReceiver based on this config. + // If the receiver type does not support tracing or if the config is not valid + // an error will be returned instead. `nextConsumer` is never nil. + CreateProfilesReceiver(ctx context.Context, set receiver.Settings, cfg component.Config, nextConsumer consumerprofiles.Profiles) (Profiles, error) + + // ProfilesReceiverStability gets the stability level of the ProfilesReceiver. + ProfilesReceiverStability() component.StabilityLevel +} // CreateProfilesFunc is the equivalent of Factory.CreateProfiles. -type CreateProfilesFunc = internal.CreateProfilesFunc +type CreateProfilesFunc func(context.Context, receiver.Settings, component.Config, consumerprofiles.Profiles) (Profiles, error) + +// CreateProfilesReceiver implements Factory.CreateProfilesReceiver(). +func (f CreateProfilesFunc) CreateProfilesReceiver( + ctx context.Context, + set receiver.Settings, + cfg component.Config, + nextConsumer consumerprofiles.Profiles) (Profiles, error) { + if f == nil { + return nil, pipeline.ErrSignalNotSupported + } + return f(ctx, set, cfg, nextConsumer) +} + +// FactoryOption apply changes to ReceiverOptions. +type FactoryOption interface { + // applyOption applies the option. + applyOption(o *factoryOpts) +} + +// factoryOptionFunc is an ReceiverFactoryOption created through a function. +type factoryOptionFunc func(*factoryOpts) + +func (f factoryOptionFunc) applyOption(o *factoryOpts) { + f(o) +} + +type factory struct { + receiver.Factory + CreateProfilesFunc + profilesStabilityLevel component.StabilityLevel +} + +func (f *factory) ProfilesReceiverStability() component.StabilityLevel { + return f.profilesStabilityLevel +} + +type factoryOpts struct { + cfgType component.Type + component.CreateDefaultConfigFunc + opts []receiver.FactoryOption + CreateProfilesFunc + profilesStabilityLevel component.StabilityLevel +} + +// WithTraces overrides the default "error not supported" implementation for CreateTracesReceiver and the default "undefined" stability level. +func WithTraces(createTracesReceiver receiver.CreateTracesFunc, sl component.StabilityLevel) FactoryOption { + return factoryOptionFunc(func(o *factoryOpts) { + o.opts = append(o.opts, receiver.WithTraces(createTracesReceiver, sl)) + }) +} + +// WithMetrics overrides the default "error not supported" implementation for CreateMetricsReceiver and the default "undefined" stability level. +func WithMetrics(createMetricsReceiver receiver.CreateMetricsFunc, sl component.StabilityLevel) FactoryOption { + return factoryOptionFunc(func(o *factoryOpts) { + o.opts = append(o.opts, receiver.WithMetrics(createMetricsReceiver, sl)) + }) +} + +// WithLogs overrides the default "error not supported" implementation for CreateLogsReceiver and the default "undefined" stability level. +func WithLogs(createLogsReceiver receiver.CreateLogsFunc, sl component.StabilityLevel) FactoryOption { + return factoryOptionFunc(func(o *factoryOpts) { + o.opts = append(o.opts, receiver.WithLogs(createLogsReceiver, sl)) + }) +} // WithProfiles overrides the default "error not supported" implementation for CreateProfilesReceiver and the default "undefined" stability level. -func WithProfiles(createProfilesReceiver CreateProfilesFunc, sl component.StabilityLevel) receiver.FactoryOption { - return internal.WithProfiles(createProfilesReceiver, sl) +func WithProfiles(createProfilesReceiver CreateProfilesFunc, sl component.StabilityLevel) FactoryOption { + return factoryOptionFunc(func(o *factoryOpts) { + o.profilesStabilityLevel = sl + o.CreateProfilesFunc = createProfilesReceiver + }) +} + +// NewFactory returns a Factory. +func NewFactory(cfgType component.Type, createDefaultConfig component.CreateDefaultConfigFunc, options ...FactoryOption) Factory { + opts := factoryOpts{ + cfgType: cfgType, + CreateDefaultConfigFunc: createDefaultConfig, + } + for _, opt := range options { + opt.applyOption(&opts) + } + return &factory{ + Factory: receiver.NewFactory(opts.cfgType, opts.CreateDefaultConfig, opts.opts...), + CreateProfilesFunc: opts.CreateProfilesFunc, + profilesStabilityLevel: opts.profilesStabilityLevel, + } } diff --git a/receiver/receiverprofiles/receiver_test.go b/receiver/receiverprofiles/receiver_test.go index 2ba69c6ac8b..eb094576756 100644 --- a/receiver/receiverprofiles/receiver_test.go +++ b/receiver/receiverprofiles/receiver_test.go @@ -18,7 +18,7 @@ import ( func TestNewFactoryWithProfiles(t *testing.T) { var testType = component.MustNewType("test") defaultCfg := struct{}{} - factory := receiver.NewFactory( + factory := NewFactory( testType, func() component.Config { return &defaultCfg }, WithProfiles(createProfiles, component.StabilityLevelAlpha), diff --git a/receiver/receivertest/contract_checker.go b/receiver/receivertest/contract_checker.go index a8b95e06b03..7e24b507f48 100644 --- a/receiver/receivertest/contract_checker.go +++ b/receiver/receivertest/contract_checker.go @@ -17,6 +17,7 @@ import ( "github.com/stretchr/testify/require" "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/component/componentprofiles" "go.opentelemetry.io/collector/component/componenttest" "go.opentelemetry.io/collector/consumer" "go.opentelemetry.io/collector/consumer/consumererror" @@ -24,6 +25,7 @@ import ( "go.opentelemetry.io/collector/pdata/plog" "go.opentelemetry.io/collector/pdata/pmetric" "go.opentelemetry.io/collector/pdata/ptrace" + "go.opentelemetry.io/collector/pipeline" "go.opentelemetry.io/collector/receiver" ) @@ -54,8 +56,13 @@ type CheckConsumeContractParams struct { T *testing.T // Factory that allows to create a receiver. Factory receiver.Factory + // DataType to test for. - DataType component.DataType + // + // Deprecated: [v0.110.0] Use Signal instead. + DataType component.DataType // nolint + + Signal pipeline.Signal // Config of the receiver to use. Config component.Config // Generator that can send data to the receiver. @@ -111,12 +118,26 @@ func checkConsumeContractScenario(params CheckConsumeContractParams, decisionFun // Create and start the receiver. var receiver component.Component var err error + + s := params.Signal + // nolint switch params.DataType { + case component.DataTypeTraces: + s = pipeline.SignalTraces + case component.DataTypeMetrics: + s = pipeline.SignalMetrics case component.DataTypeLogs: + s = pipeline.SignalLogs + case componentprofiles.DataTypeProfiles: + s = componentprofiles.SignalProfiles + } + + switch s { + case pipeline.SignalLogs: receiver, err = params.Factory.CreateLogsReceiver(ctx, NewNopSettings(), params.Config, consumer) - case component.DataTypeTraces: + case pipeline.SignalTraces: receiver, err = params.Factory.CreateTracesReceiver(ctx, NewNopSettings(), params.Config, consumer) - case component.DataTypeMetrics: + case pipeline.SignalMetrics: receiver, err = params.Factory.CreateMetricsReceiver(ctx, NewNopSettings(), params.Config, consumer) default: require.FailNow(params.T, "must specify a valid DataType to test for") diff --git a/receiver/receivertest/contract_checker_test.go b/receiver/receivertest/contract_checker_test.go index 9a646dde06f..da2fab0f675 100644 --- a/receiver/receivertest/contract_checker_test.go +++ b/receiver/receivertest/contract_checker_test.go @@ -18,6 +18,7 @@ import ( "go.opentelemetry.io/collector/pdata/plog" "go.opentelemetry.io/collector/pdata/pmetric" "go.opentelemetry.io/collector/pdata/ptrace" + "go.opentelemetry.io/collector/pipeline" "go.opentelemetry.io/collector/receiver" ) @@ -239,7 +240,7 @@ func TestConsumeContract(t *testing.T) { params := CheckConsumeContractParams{ T: t, Factory: newExampleFactory(), - DataType: component.DataTypeLogs, + Signal: pipeline.SignalLogs, Config: cfg, Generator: generator, GenerateCount: logsPerTest, @@ -262,7 +263,7 @@ func TestConsumeMetricsContract(t *testing.T) { params := CheckConsumeContractParams{ T: t, Factory: newExampleFactory(), - DataType: component.DataTypeMetrics, + Signal: pipeline.SignalMetrics, Config: cfg, Generator: generator, GenerateCount: metricsPerTest, @@ -285,7 +286,7 @@ func TestConsumeTracesContract(t *testing.T) { params := CheckConsumeContractParams{ T: t, Factory: newExampleFactory(), - DataType: component.DataTypeTraces, + Signal: pipeline.SignalTraces, Config: cfg, Generator: generator, GenerateCount: spansPerTest, diff --git a/receiver/receivertest/nop_receiver.go b/receiver/receivertest/nop_receiver.go index 2e7e8e7210b..c2225285250 100644 --- a/receiver/receivertest/nop_receiver.go +++ b/receiver/receivertest/nop_receiver.go @@ -12,6 +12,8 @@ import ( "go.opentelemetry.io/collector/component/componenttest" "go.opentelemetry.io/collector/consumer" "go.opentelemetry.io/collector/consumer/consumerprofiles" + "go.opentelemetry.io/collector/internal/globalsignal" + "go.opentelemetry.io/collector/pipeline" "go.opentelemetry.io/collector/receiver" "go.opentelemetry.io/collector/receiver/receiverprofiles" ) @@ -29,32 +31,40 @@ func NewNopSettings() receiver.Settings { // NewNopFactory returns a receiver.Factory that constructs nop receivers supporting all data types. func NewNopFactory() receiver.Factory { - return receiver.NewFactory( + return receiverprofiles.NewFactory( defaultComponentType, func() component.Config { return &nopConfig{} }, - receiver.WithTraces(createTraces, component.StabilityLevelStable), - receiver.WithMetrics(createMetrics, component.StabilityLevelStable), - receiver.WithLogs(createLogs, component.StabilityLevelStable), + receiverprofiles.WithTraces(createTraces, component.StabilityLevelStable), + receiverprofiles.WithMetrics(createMetrics, component.StabilityLevelStable), + receiverprofiles.WithLogs(createLogs, component.StabilityLevelStable), receiverprofiles.WithProfiles(createProfiles, component.StabilityLevelAlpha), ) } // NewNopFactoryForType returns a receiver.Factory that constructs nop receivers supporting only the // given data type. +// +// Deprecated: [v0.110.0] Use NewNopFactoryForTypeWithSignal instead func NewNopFactoryForType(dataType component.DataType) receiver.Factory { + return NewNopFactoryForTypeWithSignal(globalsignal.MustNewSignal(dataType.String())) +} + +// NewNopFactoryForTypeWithSignal returns a receiver.Factory that constructs nop receivers supporting only the +// given signal. +func NewNopFactoryForTypeWithSignal(signal pipeline.Signal) receiver.Factory { var factoryOpt receiver.FactoryOption - switch dataType { - case component.DataTypeTraces: + switch signal { + case pipeline.SignalTraces: factoryOpt = receiver.WithTraces(createTraces, component.StabilityLevelStable) - case component.DataTypeMetrics: + case pipeline.SignalMetrics: factoryOpt = receiver.WithMetrics(createMetrics, component.StabilityLevelStable) - case component.DataTypeLogs: + case pipeline.SignalLogs: factoryOpt = receiver.WithLogs(createLogs, component.StabilityLevelStable) default: - panic("unsupported data type for creating nop receiver factory: " + dataType.String()) + panic("unsupported data type for creating nop receiver factory: " + signal.String()) } - componentType := component.MustNewType(defaultComponentType.String() + "_" + dataType.String()) + componentType := component.MustNewType(defaultComponentType.String() + "_" + signal.String()) return receiver.NewFactory(componentType, func() component.Config { return &nopConfig{} }, factoryOpt) } diff --git a/receiver/receivertest/nop_receiver_test.go b/receiver/receivertest/nop_receiver_test.go index 35e7f0b1b18..51943f92d06 100644 --- a/receiver/receivertest/nop_receiver_test.go +++ b/receiver/receivertest/nop_receiver_test.go @@ -13,6 +13,7 @@ import ( "go.opentelemetry.io/collector/component" "go.opentelemetry.io/collector/component/componenttest" "go.opentelemetry.io/collector/consumer/consumertest" + "go.opentelemetry.io/collector/receiver/receiverprofiles" ) var nopType = component.MustNewType("nop") @@ -39,7 +40,7 @@ func TestNewNopFactory(t *testing.T) { assert.NoError(t, logs.Start(context.Background(), componenttest.NewNopHost())) assert.NoError(t, logs.Shutdown(context.Background())) - profiles, err := factory.CreateProfilesReceiver(context.Background(), NewNopSettings(), cfg, consumertest.NewNop()) + profiles, err := factory.(receiverprofiles.Factory).CreateProfilesReceiver(context.Background(), NewNopSettings(), cfg, consumertest.NewNop()) require.NoError(t, err) assert.NoError(t, profiles.Start(context.Background(), componenttest.NewNopHost())) assert.NoError(t, profiles.Shutdown(context.Background())) diff --git a/receiver/scraperhelper/obsreport.go b/receiver/scraperhelper/obsreport.go index 6c950a21711..cce7f49478e 100644 --- a/receiver/scraperhelper/obsreport.go +++ b/receiver/scraperhelper/obsreport.go @@ -13,6 +13,7 @@ import ( "go.opentelemetry.io/otel/trace" "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/pipeline" "go.opentelemetry.io/collector/receiver" "go.opentelemetry.io/collector/receiver/internal" "go.opentelemetry.io/collector/receiver/scrapererror" @@ -88,7 +89,7 @@ func (s *obsReport) EndMetricsOp( // end span according to errors if span.IsRecording() { span.SetAttributes( - attribute.String(internal.FormatKey, component.DataTypeMetrics.String()), + attribute.String(internal.FormatKey, pipeline.SignalMetrics.String()), attribute.Int64(internal.ScrapedMetricPointsKey, int64(numScrapedMetrics)), attribute.Int64(internal.ErroredMetricPointsKey, int64(numErroredMetrics)), ) diff --git a/service/config.go b/service/config.go index 9c3eb4d7d74..766edad9418 100644 --- a/service/config.go +++ b/service/config.go @@ -20,12 +20,28 @@ type Config struct { Extensions extensions.Config `mapstructure:"extensions"` // Pipelines are the set of data pipelines configured for the service. - Pipelines pipelines.Config `mapstructure:"pipelines"` + // + // Deprecated: [v0.110.0] Use PipelinesWithPipelineID instead + // nolint + Pipelines pipelines.Config `mapstructure:"-"` + + // Pipelines are the set of data pipelines configured for the service. + PipelinesWithPipelineID pipelines.ConfigWithPipelineID `mapstructure:"pipelines"` } func (cfg *Config) Validate() error { - if err := cfg.Pipelines.Validate(); err != nil { - return fmt.Errorf("service::pipelines config validation failed: %w", err) + if len(cfg.Pipelines) > 0 && len(cfg.PipelinesWithPipelineID) > 0 { + return fmt.Errorf("service::pipelines config validation failed: cannot configure both Pipelines and PipelinesWithPipelineID") + } + + if len(cfg.Pipelines) > 0 { + if err := cfg.Pipelines.Validate(); err != nil { + return fmt.Errorf("service::pipelines config validation failed: %w", err) + } + } else { + if err := cfg.PipelinesWithPipelineID.Validate(); err != nil { + return fmt.Errorf("service::pipelines config validation failed: %w", err) + } } if err := cfg.Telemetry.Validate(); err != nil { diff --git a/service/config_test.go b/service/config_test.go index efe4db66d1d..413887de731 100644 --- a/service/config_test.go +++ b/service/config_test.go @@ -9,10 +9,12 @@ import ( "testing" "github.com/stretchr/testify/assert" + "go.opentelemetry.io/contrib/config" "go.uber.org/zap/zapcore" "go.opentelemetry.io/collector/component" "go.opentelemetry.io/collector/config/configtelemetry" + "go.opentelemetry.io/collector/pipeline" "go.opentelemetry.io/collector/service/extensions" "go.opentelemetry.io/collector/service/pipelines" "go.opentelemetry.io/collector/service/telemetry" @@ -42,7 +44,7 @@ func TestConfigValidate(t *testing.T) { name: "duplicate-processor-reference", cfgFn: func() *Config { cfg := generateConfig() - pipe := cfg.Pipelines[component.MustNewID("traces")] + pipe := cfg.PipelinesWithPipelineID[pipeline.MustNewID("traces")] pipe.Processors = append(pipe.Processors, pipe.Processors...) return cfg }, @@ -52,21 +54,21 @@ func TestConfigValidate(t *testing.T) { name: "invalid-service-pipeline-type", cfgFn: func() *Config { cfg := generateConfig() - cfg.Pipelines[component.MustNewID("wrongtype")] = &pipelines.PipelineConfig{ + cfg.PipelinesWithPipelineID[pipeline.MustNewID("wrongtype")] = &pipelines.PipelineConfig{ Receivers: []component.ID{component.MustNewID("nop")}, Processors: []component.ID{component.MustNewID("nop")}, Exporters: []component.ID{component.MustNewID("nop")}, } return cfg }, - expected: fmt.Errorf(`service::pipelines config validation failed: %w`, errors.New(`pipeline "wrongtype": unknown datatype "wrongtype"`)), + expected: fmt.Errorf(`service::pipelines config validation failed: %w`, errors.New(`pipeline "wrongtype": unknown signal "wrongtype"`)), }, { name: "invalid-telemetry-metric-config", cfgFn: func() *Config { cfg := generateConfig() cfg.Telemetry.Metrics.Level = configtelemetry.LevelBasic - cfg.Telemetry.Metrics.Address = "" + cfg.Telemetry.Metrics.Readers = nil return cfg }, expected: nil, @@ -95,13 +97,18 @@ func generateConfig() *Config { InitialFields: map[string]any{"fieldKey": "filed-value"}, }, Metrics: telemetry.MetricsConfig{ - Level: configtelemetry.LevelNormal, - Address: ":8080", + Level: configtelemetry.LevelNormal, + Readers: []config.MetricReader{{ + Pull: &config.PullMetricReader{Exporter: config.MetricExporter{Prometheus: &config.Prometheus{ + Host: newPtr("localhost"), + Port: newPtr(8080), + }}}}, + }, }, }, Extensions: extensions.Config{component.MustNewID("nop")}, - Pipelines: pipelines.Config{ - component.MustNewID("traces"): { + PipelinesWithPipelineID: pipelines.ConfigWithPipelineID{ + pipeline.MustNewID("traces"): { Receivers: []component.ID{component.MustNewID("nop")}, Processors: []component.ID{component.MustNewID("nop")}, Exporters: []component.ID{component.MustNewID("nop")}, diff --git a/service/extensions/extensions.go b/service/extensions/extensions.go index fcefcb33f20..140d8b3b6ab 100644 --- a/service/extensions/extensions.go +++ b/service/extensions/extensions.go @@ -209,7 +209,7 @@ func New(ctx context.Context, set Settings, cfg Config, options ...Option) (*Ext } for _, extID := range cfg { - instanceID := componentstatus.NewInstanceID(extID, component.KindExtension) + instanceID := componentstatus.NewInstanceIDWithPipelineIDs(extID, component.KindExtension) extSet := extension.Settings{ ID: extID, TelemetrySettings: set.Telemetry, diff --git a/service/go.mod b/service/go.mod index 855e96c189a..440959196a7 100644 --- a/service/go.mod +++ b/service/go.mod @@ -9,33 +9,35 @@ require ( github.com/prometheus/common v0.59.1 github.com/shirou/gopsutil/v4 v4.24.8 github.com/stretchr/testify v1.9.0 - go.opentelemetry.io/collector v0.109.0 - go.opentelemetry.io/collector/component v0.109.0 - go.opentelemetry.io/collector/component/componentprofiles v0.109.0 - go.opentelemetry.io/collector/component/componentstatus v0.109.0 - go.opentelemetry.io/collector/config/confighttp v0.109.0 - go.opentelemetry.io/collector/config/configtelemetry v0.109.0 - go.opentelemetry.io/collector/confmap v1.15.0 - go.opentelemetry.io/collector/connector v0.109.0 - go.opentelemetry.io/collector/connector/connectorprofiles v0.109.0 - go.opentelemetry.io/collector/consumer v0.109.0 - go.opentelemetry.io/collector/consumer/consumerprofiles v0.109.0 - go.opentelemetry.io/collector/consumer/consumertest v0.109.0 - go.opentelemetry.io/collector/exporter v0.109.0 - go.opentelemetry.io/collector/exporter/exporterprofiles v0.109.0 - go.opentelemetry.io/collector/extension v0.109.0 - go.opentelemetry.io/collector/extension/extensioncapabilities v0.109.0 - go.opentelemetry.io/collector/extension/zpagesextension v0.109.0 - go.opentelemetry.io/collector/featuregate v1.15.0 - go.opentelemetry.io/collector/internal/globalgates v0.109.0 - go.opentelemetry.io/collector/pdata v1.15.0 - go.opentelemetry.io/collector/pdata/pprofile v0.109.0 - go.opentelemetry.io/collector/pdata/testdata v0.109.0 - go.opentelemetry.io/collector/processor v0.109.0 - go.opentelemetry.io/collector/processor/processorprofiles v0.109.0 - go.opentelemetry.io/collector/receiver v0.109.0 - go.opentelemetry.io/collector/receiver/receiverprofiles v0.109.0 - go.opentelemetry.io/collector/semconv v0.109.0 + go.opentelemetry.io/collector v0.110.0 + go.opentelemetry.io/collector/component v0.110.0 + go.opentelemetry.io/collector/component/componentprofiles v0.110.0 + go.opentelemetry.io/collector/component/componentstatus v0.110.0 + go.opentelemetry.io/collector/config/confighttp v0.110.0 + go.opentelemetry.io/collector/config/configtelemetry v0.110.0 + go.opentelemetry.io/collector/confmap v1.16.0 + go.opentelemetry.io/collector/connector v0.110.0 + go.opentelemetry.io/collector/connector/connectorprofiles v0.110.0 + go.opentelemetry.io/collector/consumer v0.110.0 + go.opentelemetry.io/collector/consumer/consumerprofiles v0.110.0 + go.opentelemetry.io/collector/consumer/consumertest v0.110.0 + go.opentelemetry.io/collector/exporter v0.110.0 + go.opentelemetry.io/collector/exporter/exporterprofiles v0.110.0 + go.opentelemetry.io/collector/extension v0.110.0 + go.opentelemetry.io/collector/extension/extensioncapabilities v0.110.0 + go.opentelemetry.io/collector/extension/zpagesextension v0.110.0 + go.opentelemetry.io/collector/featuregate v1.16.0 + go.opentelemetry.io/collector/internal/globalgates v0.110.0 + go.opentelemetry.io/collector/internal/globalsignal v0.110.0 + go.opentelemetry.io/collector/pdata v1.16.0 + go.opentelemetry.io/collector/pdata/pprofile v0.110.0 + go.opentelemetry.io/collector/pdata/testdata v0.110.0 + go.opentelemetry.io/collector/pipeline v0.110.0 + go.opentelemetry.io/collector/processor v0.110.0 + go.opentelemetry.io/collector/processor/processorprofiles v0.110.0 + go.opentelemetry.io/collector/receiver v0.110.0 + go.opentelemetry.io/collector/receiver/receiverprofiles v0.110.0 + go.opentelemetry.io/collector/semconv v0.110.0 go.opentelemetry.io/contrib/config v0.10.0 go.opentelemetry.io/contrib/propagators/b3 v1.30.0 go.opentelemetry.io/otel v1.30.0 @@ -69,7 +71,7 @@ require ( github.com/grpc-ecosystem/grpc-gateway/v2 v2.22.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/klauspost/compress v1.17.10 // 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 @@ -87,13 +89,13 @@ 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 v1.15.0 // indirect - go.opentelemetry.io/collector/config/configauth v0.109.0 // indirect - go.opentelemetry.io/collector/config/configcompression v1.15.0 // indirect - go.opentelemetry.io/collector/config/configopaque v1.15.0 // indirect - go.opentelemetry.io/collector/config/configtls v1.15.0 // indirect - go.opentelemetry.io/collector/config/internal v0.109.1-0.20240916143658-74729e731d3b // indirect - go.opentelemetry.io/collector/extension/auth v0.109.0 // indirect + go.opentelemetry.io/collector/client v1.16.0 // indirect + go.opentelemetry.io/collector/config/configauth v0.110.0 // indirect + go.opentelemetry.io/collector/config/configcompression v1.16.0 // indirect + go.opentelemetry.io/collector/config/configopaque v1.16.0 // indirect + go.opentelemetry.io/collector/config/configtls v1.16.0 // indirect + go.opentelemetry.io/collector/config/internal v0.110.0 // indirect + go.opentelemetry.io/collector/extension/auth v0.110.0 // indirect go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.55.0 // indirect go.opentelemetry.io/contrib/zpages v0.55.0 // indirect go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp v0.6.0 // indirect @@ -110,7 +112,7 @@ require ( golang.org/x/text v0.18.0 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20240903143218-8af14fe29dc1 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1 // indirect - google.golang.org/grpc v1.66.2 // indirect + google.golang.org/grpc v1.67.0 // indirect google.golang.org/protobuf v1.34.2 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) @@ -137,6 +139,8 @@ replace go.opentelemetry.io/collector/confmap => ../confmap replace go.opentelemetry.io/collector/config/configtelemetry => ../config/configtelemetry +replace go.opentelemetry.io/collector/pipeline => ../pipeline + replace go.opentelemetry.io/collector/processor => ../processor replace go.opentelemetry.io/collector/consumer => ../consumer @@ -186,3 +190,5 @@ replace go.opentelemetry.io/collector/processor/processorprofiles => ../processo replace go.opentelemetry.io/collector/connector/connectorprofiles => ../connector/connectorprofiles replace go.opentelemetry.io/collector/exporter/exporterprofiles => ../exporter/exporterprofiles + +replace go.opentelemetry.io/collector/internal/globalsignal => ../internal/globalsignal diff --git a/service/go.sum b/service/go.sum index 79514ec0d78..7d82be35898 100644 --- a/service/go.sum +++ b/service/go.sum @@ -38,8 +38,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/klauspost/compress v1.17.10 h1:oXAz+Vh0PMUvJczoi+flxpnBEPxoER1IaAnU/NMPtT0= +github.com/klauspost/compress v1.17.10/go.mod h1:pMDklpSncoRMuLFrf1W9Ss9KT+0rH90U12bZKk7uwG0= 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= @@ -192,8 +192,8 @@ google.golang.org/genproto/googleapis/api v0.0.0-20240903143218-8af14fe29dc1 h1: google.golang.org/genproto/googleapis/api v0.0.0-20240903143218-8af14fe29dc1/go.mod h1:qpvKtACPCQhAdu3PyQgV4l3LMXZEtft7y8QcarRsp9I= google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1 h1:pPJltXNxVzT4pK9yD8vR9X75DaWYYmLGMsEvBfFQZzQ= google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU= -google.golang.org/grpc v1.66.2 h1:3QdXkuq3Bkh7w+ywLdLvM56cmGvQHUMZpiCzt6Rqaoo= -google.golang.org/grpc v1.66.2/go.mod h1:s3/l6xSSCURdVfAnL+TqCNMyTDAGN6+lZeVxnZR128Y= +google.golang.org/grpc v1.67.0 h1:IdH9y6PF5MPSdAntIcpjQ+tXO41pcQsfZV2RxtQgVcw= +google.golang.org/grpc v1.67.0/go.mod h1:1gLDyUQU7CTLJI90u3nXZ9ekeghjeM7pTDZlqFNg2AA= google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/service/internal/builders/connector_test.go b/service/internal/builders/connector_test.go index 9f2fe018ba8..be756e4ae15 100644 --- a/service/internal/builders/connector_test.go +++ b/service/internal/builders/connector_test.go @@ -20,6 +20,7 @@ import ( "go.opentelemetry.io/collector/consumer" "go.opentelemetry.io/collector/consumer/consumerprofiles" "go.opentelemetry.io/collector/consumer/consumertest" + "go.opentelemetry.io/collector/pipeline" ) func TestConnectorBuilder(t *testing.T) { @@ -52,7 +53,7 @@ func TestConnectorBuilder(t *testing.T) { testCases := []struct { name string id component.ID - err func(component.DataType, component.DataType) string + err func(pipeline.Signal, pipeline.Signal) string nextTraces consumer.Traces nextLogs consumer.Logs nextMetrics consumer.Metrics @@ -61,7 +62,7 @@ func TestConnectorBuilder(t *testing.T) { { name: "unknown", id: component.MustNewID("unknown"), - err: func(component.DataType, component.DataType) string { + err: func(pipeline.Signal, pipeline.Signal) string { return "connector factory not available for: \"unknown\"" }, nextTraces: consumertest.NewNop(), @@ -72,7 +73,7 @@ func TestConnectorBuilder(t *testing.T) { { name: "err", id: component.MustNewID("err"), - err: func(expType, rcvType component.DataType) string { + err: func(expType, rcvType pipeline.Signal) string { return fmt.Sprintf("connector \"err\" cannot connect from %s to %s: telemetry type is not supported", expType, rcvType) }, nextTraces: consumertest.NewNop(), @@ -83,7 +84,7 @@ func TestConnectorBuilder(t *testing.T) { { name: "all", id: component.MustNewID("all"), - err: func(component.DataType, component.DataType) string { + err: func(pipeline.Signal, pipeline.Signal) string { return "" }, nextTraces: consumertest.NewNop(), @@ -94,7 +95,7 @@ func TestConnectorBuilder(t *testing.T) { { name: "all/named", id: component.MustNewIDWithName("all", "named"), - err: func(component.DataType, component.DataType) string { + err: func(pipeline.Signal, pipeline.Signal) string { return "" }, nextTraces: consumertest.NewNop(), @@ -105,7 +106,7 @@ func TestConnectorBuilder(t *testing.T) { { name: "no next consumer", id: component.MustNewID("unknown"), - err: func(_, _ component.DataType) string { + err: func(_, _ pipeline.Signal) string { return "nil next Consumer" }, nextTraces: nil, @@ -121,7 +122,7 @@ func TestConnectorBuilder(t *testing.T) { b := NewConnector(cfgs, factories) t2t, err := b.CreateTracesToTraces(context.Background(), createConnectorSettings(tt.id), tt.nextTraces) - if expectedErr := tt.err(component.DataTypeTraces, component.DataTypeTraces); expectedErr != "" { + if expectedErr := tt.err(pipeline.SignalTraces, pipeline.SignalTraces); expectedErr != "" { assert.EqualError(t, err, expectedErr) assert.Nil(t, t2t) } else { @@ -129,7 +130,7 @@ func TestConnectorBuilder(t *testing.T) { 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 != "" { + if expectedErr := tt.err(pipeline.SignalTraces, pipeline.SignalMetrics); expectedErr != "" { assert.EqualError(t, err, expectedErr) assert.Nil(t, t2m) } else { @@ -137,7 +138,7 @@ func TestConnectorBuilder(t *testing.T) { 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 != "" { + if expectedErr := tt.err(pipeline.SignalTraces, pipeline.SignalLogs); expectedErr != "" { assert.EqualError(t, err, expectedErr) assert.Nil(t, t2l) } else { @@ -145,7 +146,7 @@ func TestConnectorBuilder(t *testing.T) { assert.Equal(t, nopConnectorInstance, t2l) } t2p, err := b.CreateTracesToProfiles(context.Background(), createConnectorSettings(tt.id), tt.nextProfiles) - if expectedErr := tt.err(component.DataTypeTraces, componentprofiles.DataTypeProfiles); expectedErr != "" { + if expectedErr := tt.err(pipeline.SignalTraces, componentprofiles.SignalProfiles); expectedErr != "" { assert.EqualError(t, err, expectedErr) assert.Nil(t, t2p) } else { @@ -154,7 +155,7 @@ func TestConnectorBuilder(t *testing.T) { } m2t, err := b.CreateMetricsToTraces(context.Background(), createConnectorSettings(tt.id), tt.nextTraces) - if expectedErr := tt.err(component.DataTypeMetrics, component.DataTypeTraces); expectedErr != "" { + if expectedErr := tt.err(pipeline.SignalMetrics, pipeline.SignalTraces); expectedErr != "" { assert.EqualError(t, err, expectedErr) assert.Nil(t, m2t) } else { @@ -163,7 +164,7 @@ func TestConnectorBuilder(t *testing.T) { } m2m, err := b.CreateMetricsToMetrics(context.Background(), createConnectorSettings(tt.id), tt.nextMetrics) - if expectedErr := tt.err(component.DataTypeMetrics, component.DataTypeMetrics); expectedErr != "" { + if expectedErr := tt.err(pipeline.SignalMetrics, pipeline.SignalMetrics); expectedErr != "" { assert.EqualError(t, err, expectedErr) assert.Nil(t, m2m) } else { @@ -172,7 +173,7 @@ func TestConnectorBuilder(t *testing.T) { } m2l, err := b.CreateMetricsToLogs(context.Background(), createConnectorSettings(tt.id), tt.nextLogs) - if expectedErr := tt.err(component.DataTypeMetrics, component.DataTypeLogs); expectedErr != "" { + if expectedErr := tt.err(pipeline.SignalMetrics, pipeline.SignalLogs); expectedErr != "" { assert.EqualError(t, err, expectedErr) assert.Nil(t, m2l) } else { @@ -180,7 +181,7 @@ func TestConnectorBuilder(t *testing.T) { assert.Equal(t, nopConnectorInstance, m2l) } m2p, err := b.CreateMetricsToProfiles(context.Background(), createConnectorSettings(tt.id), tt.nextProfiles) - if expectedErr := tt.err(component.DataTypeMetrics, componentprofiles.DataTypeProfiles); expectedErr != "" { + if expectedErr := tt.err(pipeline.SignalMetrics, componentprofiles.SignalProfiles); expectedErr != "" { assert.EqualError(t, err, expectedErr) assert.Nil(t, m2p) } else { @@ -189,7 +190,7 @@ func TestConnectorBuilder(t *testing.T) { } l2t, err := b.CreateLogsToTraces(context.Background(), createConnectorSettings(tt.id), tt.nextTraces) - if expectedErr := tt.err(component.DataTypeLogs, component.DataTypeTraces); expectedErr != "" { + if expectedErr := tt.err(pipeline.SignalLogs, pipeline.SignalTraces); expectedErr != "" { assert.EqualError(t, err, expectedErr) assert.Nil(t, l2t) } else { @@ -198,7 +199,7 @@ func TestConnectorBuilder(t *testing.T) { } l2m, err := b.CreateLogsToMetrics(context.Background(), createConnectorSettings(tt.id), tt.nextMetrics) - if expectedErr := tt.err(component.DataTypeLogs, component.DataTypeMetrics); expectedErr != "" { + if expectedErr := tt.err(pipeline.SignalLogs, pipeline.SignalMetrics); expectedErr != "" { assert.EqualError(t, err, expectedErr) assert.Nil(t, l2m) } else { @@ -207,7 +208,7 @@ func TestConnectorBuilder(t *testing.T) { } l2l, err := b.CreateLogsToLogs(context.Background(), createConnectorSettings(tt.id), tt.nextLogs) - if expectedErr := tt.err(component.DataTypeLogs, component.DataTypeLogs); expectedErr != "" { + if expectedErr := tt.err(pipeline.SignalLogs, pipeline.SignalLogs); expectedErr != "" { assert.EqualError(t, err, expectedErr) assert.Nil(t, l2l) } else { @@ -215,7 +216,7 @@ func TestConnectorBuilder(t *testing.T) { assert.Equal(t, nopConnectorInstance, l2l) } l2p, err := b.CreateLogsToProfiles(context.Background(), createConnectorSettings(tt.id), tt.nextProfiles) - if expectedErr := tt.err(component.DataTypeLogs, componentprofiles.DataTypeProfiles); expectedErr != "" { + if expectedErr := tt.err(pipeline.SignalLogs, componentprofiles.SignalProfiles); expectedErr != "" { assert.EqualError(t, err, expectedErr) assert.Nil(t, l2p) } else { @@ -224,7 +225,7 @@ func TestConnectorBuilder(t *testing.T) { } p2t, err := b.CreateProfilesToTraces(context.Background(), createConnectorSettings(tt.id), tt.nextTraces) - if expectedErr := tt.err(componentprofiles.DataTypeProfiles, component.DataTypeTraces); expectedErr != "" { + if expectedErr := tt.err(componentprofiles.SignalProfiles, pipeline.SignalTraces); expectedErr != "" { assert.EqualError(t, err, expectedErr) assert.Nil(t, p2t) } else { @@ -232,7 +233,7 @@ func TestConnectorBuilder(t *testing.T) { assert.Equal(t, nopConnectorInstance, p2t) } p2m, err := b.CreateProfilesToMetrics(context.Background(), createConnectorSettings(tt.id), tt.nextMetrics) - if expectedErr := tt.err(componentprofiles.DataTypeProfiles, component.DataTypeMetrics); expectedErr != "" { + if expectedErr := tt.err(componentprofiles.SignalProfiles, pipeline.SignalMetrics); expectedErr != "" { assert.EqualError(t, err, expectedErr) assert.Nil(t, p2m) } else { @@ -240,7 +241,7 @@ func TestConnectorBuilder(t *testing.T) { assert.Equal(t, nopConnectorInstance, p2m) } p2l, err := b.CreateProfilesToLogs(context.Background(), createConnectorSettings(tt.id), tt.nextLogs) - if expectedErr := tt.err(componentprofiles.DataTypeProfiles, component.DataTypeLogs); expectedErr != "" { + if expectedErr := tt.err(componentprofiles.SignalProfiles, pipeline.SignalLogs); expectedErr != "" { assert.EqualError(t, err, expectedErr) assert.Nil(t, p2l) } else { @@ -248,7 +249,7 @@ func TestConnectorBuilder(t *testing.T) { assert.Equal(t, nopConnectorInstance, p2l) } p2p, err := b.CreateProfilesToProfiles(context.Background(), createConnectorSettings(tt.id), tt.nextProfiles) - if expectedErr := tt.err(componentprofiles.DataTypeProfiles, componentprofiles.DataTypeProfiles); expectedErr != "" { + if expectedErr := tt.err(componentprofiles.SignalProfiles, componentprofiles.SignalProfiles); expectedErr != "" { assert.EqualError(t, err, expectedErr) assert.Nil(t, p2p) } else { diff --git a/service/internal/builders/processor.go b/service/internal/builders/processor.go index 57dbff9e5ba..052d95063dc 100644 --- a/service/internal/builders/processor.go +++ b/service/internal/builders/processor.go @@ -10,6 +10,7 @@ import ( "go.opentelemetry.io/collector/component" "go.opentelemetry.io/collector/consumer" "go.opentelemetry.io/collector/consumer/consumerprofiles" + "go.opentelemetry.io/collector/pipeline" "go.opentelemetry.io/collector/processor" "go.opentelemetry.io/collector/processor/processorprofiles" "go.opentelemetry.io/collector/processor/processortest" @@ -94,11 +95,15 @@ func (b *ProcessorBuilder) CreateProfiles(ctx context.Context, set processor.Set return nil, fmt.Errorf("processor %q is not configured", set.ID) } - f, existsFactory := b.factories[set.ID.Type()] + procFact, existsFactory := b.factories[set.ID.Type()] if !existsFactory { return nil, fmt.Errorf("processor factory not available for: %q", set.ID) } + f, ok := procFact.(processorprofiles.Factory) + if !ok { + return nil, pipeline.ErrSignalNotSupported + } logStabilityLevel(set.Logger, f.ProfilesProcessorStability()) return f.CreateProfilesProcessor(ctx, set, cfg, next) } diff --git a/service/internal/builders/processor_test.go b/service/internal/builders/processor_test.go index 09443387817..425f3c89152 100644 --- a/service/internal/builders/processor_test.go +++ b/service/internal/builders/processor_test.go @@ -24,12 +24,12 @@ func TestProcessorBuilder(t *testing.T) { defaultCfg := struct{}{} factories, err := processor.MakeFactoryMap([]processor.Factory{ processor.NewFactory(component.MustNewType("err"), nil), - processor.NewFactory( + processorprofiles.NewFactory( component.MustNewType("all"), func() component.Config { return &defaultCfg }, - processor.WithTraces(createProcessorTraces, component.StabilityLevelDevelopment), - processor.WithMetrics(createProcessorMetrics, component.StabilityLevelAlpha), - processor.WithLogs(createProcessorLogs, component.StabilityLevelDeprecated), + processorprofiles.WithTraces(createProcessorTraces, component.StabilityLevelDevelopment), + processorprofiles.WithMetrics(createProcessorMetrics, component.StabilityLevelAlpha), + processorprofiles.WithLogs(createProcessorLogs, component.StabilityLevelDeprecated), processorprofiles.WithProfiles(createProcessorProfiles, component.StabilityLevelDevelopment), ), }...) @@ -136,12 +136,12 @@ func TestProcessorBuilder(t *testing.T) { func TestProcessorBuilderMissingConfig(t *testing.T) { defaultCfg := struct{}{} factories, err := processor.MakeFactoryMap([]processor.Factory{ - processor.NewFactory( + processorprofiles.NewFactory( component.MustNewType("all"), func() component.Config { return &defaultCfg }, - processor.WithTraces(createProcessorTraces, component.StabilityLevelDevelopment), - processor.WithMetrics(createProcessorMetrics, component.StabilityLevelAlpha), - processor.WithLogs(createProcessorLogs, component.StabilityLevelDeprecated), + processorprofiles.WithTraces(createProcessorTraces, component.StabilityLevelDevelopment), + processorprofiles.WithMetrics(createProcessorMetrics, component.StabilityLevelAlpha), + processorprofiles.WithLogs(createProcessorLogs, component.StabilityLevelDeprecated), processorprofiles.WithProfiles(createProcessorProfiles, component.StabilityLevelDevelopment), ), }...) @@ -207,7 +207,7 @@ func TestNewNopProcessorBuilder(t *testing.T) { require.NoError(t, err) assert.IsType(t, logs, bLogs) - profiles, err := factory.CreateProfilesProcessor(context.Background(), set, cfg, consumertest.NewNop()) + profiles, err := factory.(processorprofiles.Factory).CreateProfilesProcessor(context.Background(), set, cfg, consumertest.NewNop()) require.NoError(t, err) bProfiles, err := builder.CreateProfiles(context.Background(), set, consumertest.NewNop()) require.NoError(t, err) diff --git a/service/internal/builders/receiver.go b/service/internal/builders/receiver.go index 6f0caf7045c..5831993d4bb 100644 --- a/service/internal/builders/receiver.go +++ b/service/internal/builders/receiver.go @@ -10,6 +10,7 @@ import ( "go.opentelemetry.io/collector/component" "go.opentelemetry.io/collector/consumer" "go.opentelemetry.io/collector/consumer/consumerprofiles" + "go.opentelemetry.io/collector/pipeline" "go.opentelemetry.io/collector/receiver" "go.opentelemetry.io/collector/receiver/receiverprofiles" "go.opentelemetry.io/collector/receiver/receivertest" @@ -95,11 +96,16 @@ func (b *ReceiverBuilder) CreateProfiles(ctx context.Context, set receiver.Setti return nil, fmt.Errorf("receiver %q is not configured", set.ID) } - f, existsFactory := b.factories[set.ID.Type()] + recvFact, existsFactory := b.factories[set.ID.Type()] if !existsFactory { return nil, fmt.Errorf("receiver factory not available for: %q", set.ID) } + f, ok := recvFact.(receiverprofiles.Factory) + if !ok { + return nil, pipeline.ErrSignalNotSupported + } + logStabilityLevel(set.Logger, f.ProfilesReceiverStability()) return f.CreateProfilesReceiver(ctx, set, cfg, next) } diff --git a/service/internal/builders/receiver_test.go b/service/internal/builders/receiver_test.go index 488892a1310..2bce4185187 100644 --- a/service/internal/builders/receiver_test.go +++ b/service/internal/builders/receiver_test.go @@ -24,12 +24,12 @@ func TestReceiverBuilder(t *testing.T) { defaultCfg := struct{}{} factories, err := receiver.MakeFactoryMap([]receiver.Factory{ receiver.NewFactory(component.MustNewType("err"), nil), - receiver.NewFactory( + receiverprofiles.NewFactory( component.MustNewType("all"), func() component.Config { return &defaultCfg }, - receiver.WithTraces(createReceiverTraces, component.StabilityLevelDevelopment), - receiver.WithMetrics(createReceiverMetrics, component.StabilityLevelAlpha), - receiver.WithLogs(createReceiverLogs, component.StabilityLevelDeprecated), + receiverprofiles.WithTraces(createReceiverTraces, component.StabilityLevelDevelopment), + receiverprofiles.WithMetrics(createReceiverMetrics, component.StabilityLevelAlpha), + receiverprofiles.WithLogs(createReceiverLogs, component.StabilityLevelDeprecated), receiverprofiles.WithProfiles(createReceiverProfiles, component.StabilityLevelAlpha), ), }...) @@ -136,12 +136,12 @@ func TestReceiverBuilder(t *testing.T) { func TestReceiverBuilderMissingConfig(t *testing.T) { defaultCfg := struct{}{} factories, err := receiver.MakeFactoryMap([]receiver.Factory{ - receiver.NewFactory( + receiverprofiles.NewFactory( component.MustNewType("all"), func() component.Config { return &defaultCfg }, - receiver.WithTraces(createReceiverTraces, component.StabilityLevelDevelopment), - receiver.WithMetrics(createReceiverMetrics, component.StabilityLevelAlpha), - receiver.WithLogs(createReceiverLogs, component.StabilityLevelDeprecated), + receiverprofiles.WithTraces(createReceiverTraces, component.StabilityLevelDevelopment), + receiverprofiles.WithMetrics(createReceiverMetrics, component.StabilityLevelAlpha), + receiverprofiles.WithLogs(createReceiverLogs, component.StabilityLevelDeprecated), receiverprofiles.WithProfiles(createReceiverProfiles, component.StabilityLevelAlpha), ), }...) @@ -207,7 +207,7 @@ func TestNewNopReceiverConfigsAndFactories(t *testing.T) { require.NoError(t, err) assert.IsType(t, logs, bLogs) - profiles, err := factory.CreateProfilesReceiver(context.Background(), set, cfg, consumertest.NewNop()) + profiles, err := factory.(receiverprofiles.Factory).CreateProfilesReceiver(context.Background(), set, cfg, consumertest.NewNop()) require.NoError(t, err) bProfiles, err := builder.CreateProfiles(context.Background(), set, consumertest.NewNop()) require.NoError(t, err) diff --git a/service/internal/components/loggers.go b/service/internal/components/loggers.go index f4178977b2d..f02d19fb082 100644 --- a/service/internal/components/loggers.go +++ b/service/internal/components/loggers.go @@ -9,6 +9,7 @@ import ( "go.uber.org/zap" "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/pipeline" ) const ( @@ -21,21 +22,21 @@ const ( zapReceiverInPipeline = "receiver_in_pipeline" ) -func ReceiverLogger(logger *zap.Logger, id component.ID, dt component.DataType) *zap.Logger { +func ReceiverLogger(logger *zap.Logger, id component.ID, dt pipeline.Signal) *zap.Logger { return logger.With( zap.String(zapKindKey, strings.ToLower(component.KindReceiver.String())), zap.String(zapNameKey, id.String()), zap.String(zapDataTypeKey, dt.String())) } -func ProcessorLogger(logger *zap.Logger, id component.ID, pipelineID component.ID) *zap.Logger { +func ProcessorLogger(logger *zap.Logger, id component.ID, pipelineID pipeline.ID) *zap.Logger { return logger.With( zap.String(zapKindKey, strings.ToLower(component.KindProcessor.String())), zap.String(zapNameKey, id.String()), zap.String(zapPipelineKey, pipelineID.String())) } -func ExporterLogger(logger *zap.Logger, id component.ID, dt component.DataType) *zap.Logger { +func ExporterLogger(logger *zap.Logger, id component.ID, dt pipeline.Signal) *zap.Logger { return logger.With( zap.String(zapKindKey, strings.ToLower(component.KindExporter.String())), zap.String(zapDataTypeKey, dt.String()), @@ -48,7 +49,7 @@ func ExtensionLogger(logger *zap.Logger, id component.ID) *zap.Logger { zap.String(zapNameKey, id.String())) } -func ConnectorLogger(logger *zap.Logger, id component.ID, expDT, rcvDT component.DataType) *zap.Logger { +func ConnectorLogger(logger *zap.Logger, id component.ID, expDT, rcvDT pipeline.Signal) *zap.Logger { return logger.With( zap.String(zapKindKey, strings.ToLower(component.KindConnector.String())), zap.String(zapNameKey, id.String()), diff --git a/service/internal/graph/graph.go b/service/internal/graph/graph.go index 3adc1c568a2..4702e5832e8 100644 --- a/service/internal/graph/graph.go +++ b/service/internal/graph/graph.go @@ -31,6 +31,7 @@ import ( "go.opentelemetry.io/collector/consumer" "go.opentelemetry.io/collector/consumer/consumerprofiles" "go.opentelemetry.io/collector/internal/fanoutconsumer" + "go.opentelemetry.io/collector/pipeline" "go.opentelemetry.io/collector/service/internal/builders" "go.opentelemetry.io/collector/service/internal/capabilityconsumer" "go.opentelemetry.io/collector/service/internal/status" @@ -48,7 +49,7 @@ type Settings struct { ConnectorBuilder *builders.ConnectorBuilder // PipelineConfigs is a map of component.ID to PipelineConfig. - PipelineConfigs pipelines.Config + PipelineConfigs pipelines.ConfigWithPipelineID ReportStatus status.ServiceStatusFunc } @@ -58,7 +59,7 @@ type Graph struct { componentGraph *simple.DirectedGraph // Keep track of how nodes relate to pipelines, so we can declare edges in the graph. - pipelines map[component.ID]*pipelineNodes + pipelines map[pipeline.ID]*pipelineNodes // Keep track of status source per node instanceIDs map[int64]*componentstatus.InstanceID @@ -71,7 +72,7 @@ type Graph struct { func Build(ctx context.Context, set Settings) (*Graph, error) { pipelines := &Graph{ componentGraph: simple.NewDirectedGraph(), - pipelines: make(map[component.ID]*pipelineNodes, len(set.PipelineConfigs)), + pipelines: make(map[pipeline.ID]*pipelineNodes, len(set.PipelineConfigs)), instanceIDs: make(map[int64]*componentstatus.InstanceID), telemetry: set.Telemetry, } @@ -95,8 +96,8 @@ func (g *Graph) createNodes(set Settings) error { connectors := make(map[component.ID]struct{}) // Keep track of connectors and where they are used. (map[connectorID][]pipelineID). - connectorsAsExporter := make(map[component.ID][]component.ID) - connectorsAsReceiver := make(map[component.ID][]component.ID) + connectorsAsExporter := make(map[component.ID][]pipeline.ID) + connectorsAsReceiver := make(map[component.ID][]pipeline.ID) // Build each pipelineNodes struct for each pipeline by parsing the pipelineCfg. // Also populates the connectors, connectorsAsExporter and connectorsAsReceiver maps. @@ -140,19 +141,19 @@ func (g *Graph) createNodes(set Settings) error { } connFactory := factory.(connector.Factory) - expTypes := make(map[component.DataType]bool) + expTypes := make(map[pipeline.Signal]bool) for _, pipelineID := range connectorsAsExporter[connID] { // The presence of each key indicates how the connector is used as an exporter. // The value is initially set to false. Later we will set the value to true *if* we // confirm that there is a supported corresponding use as a receiver. - expTypes[pipelineID.Type()] = false + expTypes[pipelineID.Signal()] = false } - recTypes := make(map[component.DataType]bool) + recTypes := make(map[pipeline.Signal]bool) for _, pipelineID := range connectorsAsReceiver[connID] { // The presence of each key indicates how the connector is used as a receiver. // The value is initially set to false. Later we will set the value to true *if* we // confirm that there is a supported corresponding use as an exporter. - recTypes[pipelineID.Type()] = false + recTypes[pipelineID.Signal()] = false } for expType := range expTypes { @@ -180,7 +181,7 @@ func (g *Graph) createNodes(set Settings) error { for _, eID := range connectorsAsExporter[connID] { for _, rID := range connectorsAsReceiver[connID] { - if connectorStability(connFactory, eID.Type(), rID.Type()) == component.StabilityLevelUndefined { + if connectorStability(connFactory, eID.Signal(), rID.Signal()) == component.StabilityLevelUndefined { // Connector is not supported for this combination, but we know it is used correctly elsewhere continue } @@ -194,52 +195,52 @@ func (g *Graph) createNodes(set Settings) error { return nil } -func (g *Graph) createReceiver(pipelineID, recvID component.ID) *receiverNode { - rcvrNode := newReceiverNode(pipelineID.Type(), recvID) +func (g *Graph) createReceiver(pipelineID pipeline.ID, recvID component.ID) *receiverNode { + rcvrNode := newReceiverNode(pipelineID.Signal(), recvID) if node := g.componentGraph.Node(rcvrNode.ID()); node != nil { instanceID := g.instanceIDs[node.ID()] - g.instanceIDs[node.ID()] = instanceID.WithPipelines(pipelineID) + g.instanceIDs[node.ID()] = instanceID.WithPipelineIDs(pipelineID) return node.(*receiverNode) } g.componentGraph.AddNode(rcvrNode) - g.instanceIDs[rcvrNode.ID()] = componentstatus.NewInstanceID( + g.instanceIDs[rcvrNode.ID()] = componentstatus.NewInstanceIDWithPipelineIDs( recvID, component.KindReceiver, pipelineID, ) return rcvrNode } -func (g *Graph) createProcessor(pipelineID, procID component.ID) *processorNode { +func (g *Graph) createProcessor(pipelineID pipeline.ID, procID component.ID) *processorNode { procNode := newProcessorNode(pipelineID, procID) g.componentGraph.AddNode(procNode) - g.instanceIDs[procNode.ID()] = componentstatus.NewInstanceID( + g.instanceIDs[procNode.ID()] = componentstatus.NewInstanceIDWithPipelineIDs( procID, component.KindProcessor, pipelineID, ) return procNode } -func (g *Graph) createExporter(pipelineID, exprID component.ID) *exporterNode { - expNode := newExporterNode(pipelineID.Type(), exprID) +func (g *Graph) createExporter(pipelineID pipeline.ID, exprID component.ID) *exporterNode { + expNode := newExporterNode(pipelineID.Signal(), exprID) if node := g.componentGraph.Node(expNode.ID()); node != nil { instanceID := g.instanceIDs[expNode.ID()] - g.instanceIDs[expNode.ID()] = instanceID.WithPipelines(pipelineID) + g.instanceIDs[expNode.ID()] = instanceID.WithPipelineIDs(pipelineID) return node.(*exporterNode) } g.componentGraph.AddNode(expNode) - g.instanceIDs[expNode.ID()] = componentstatus.NewInstanceID( + g.instanceIDs[expNode.ID()] = componentstatus.NewInstanceIDWithPipelineIDs( expNode.componentID, component.KindExporter, pipelineID, ) return expNode } -func (g *Graph) createConnector(exprPipelineID, rcvrPipelineID, connID component.ID) *connectorNode { - connNode := newConnectorNode(exprPipelineID.Type(), rcvrPipelineID.Type(), connID) +func (g *Graph) createConnector(exprPipelineID, rcvrPipelineID pipeline.ID, connID component.ID) *connectorNode { + connNode := newConnectorNode(exprPipelineID.Signal(), rcvrPipelineID.Signal(), connID) if node := g.componentGraph.Node(connNode.ID()); node != nil { instanceID := g.instanceIDs[connNode.ID()] - g.instanceIDs[connNode.ID()] = instanceID.WithPipelines(exprPipelineID, rcvrPipelineID) + g.instanceIDs[connNode.ID()] = instanceID.WithPipelineIDs(exprPipelineID, rcvrPipelineID) return node.(*connectorNode) } g.componentGraph.AddNode(connNode) - g.instanceIDs[connNode.ID()] = componentstatus.NewInstanceID( + g.instanceIDs[connNode.ID()] = componentstatus.NewInstanceIDWithPipelineIDs( connNode.componentID, component.KindConnector, exprPipelineID, rcvrPipelineID, ) return connNode @@ -303,46 +304,46 @@ func (g *Graph) buildComponents(ctx context.Context, set Settings) error { capability.MutatesData = capability.MutatesData || proc.getConsumer().Capabilities().MutatesData } next := g.nextConsumers(n.ID())[0] - switch n.pipelineID.Type() { - case component.DataTypeTraces: + switch n.pipelineID.Signal() { + case pipeline.SignalTraces: cc := capabilityconsumer.NewTraces(next.(consumer.Traces), capability) n.baseConsumer = cc n.ConsumeTracesFunc = cc.ConsumeTraces - case component.DataTypeMetrics: + case pipeline.SignalMetrics: cc := capabilityconsumer.NewMetrics(next.(consumer.Metrics), capability) n.baseConsumer = cc n.ConsumeMetricsFunc = cc.ConsumeMetrics - case component.DataTypeLogs: + case pipeline.SignalLogs: cc := capabilityconsumer.NewLogs(next.(consumer.Logs), capability) n.baseConsumer = cc n.ConsumeLogsFunc = cc.ConsumeLogs - case componentprofiles.DataTypeProfiles: + case componentprofiles.SignalProfiles: cc := capabilityconsumer.NewProfiles(next.(consumerprofiles.Profiles), capability) n.baseConsumer = cc n.ConsumeProfilesFunc = cc.ConsumeProfiles } case *fanOutNode: nexts := g.nextConsumers(n.ID()) - switch n.pipelineID.Type() { - case component.DataTypeTraces: + switch n.pipelineID.Signal() { + case pipeline.SignalTraces: consumers := make([]consumer.Traces, 0, len(nexts)) for _, next := range nexts { consumers = append(consumers, next.(consumer.Traces)) } n.baseConsumer = fanoutconsumer.NewTraces(consumers) - case component.DataTypeMetrics: + case pipeline.SignalMetrics: consumers := make([]consumer.Metrics, 0, len(nexts)) for _, next := range nexts { consumers = append(consumers, next.(consumer.Metrics)) } n.baseConsumer = fanoutconsumer.NewMetrics(consumers) - case component.DataTypeLogs: + case pipeline.SignalLogs: consumers := make([]consumer.Logs, 0, len(nexts)) for _, next := range nexts { consumers = append(consumers, next.(consumer.Logs)) } n.baseConsumer = fanoutconsumer.NewLogs(consumers) - case componentprofiles.DataTypeProfiles: + case componentprofiles.SignalProfiles: consumers := make([]consumerprofiles.Profiles, 0, len(nexts)) for _, next := range nexts { consumers = append(consumers, next.(consumerprofiles.Profiles)) @@ -477,18 +478,12 @@ func (g *Graph) ShutdownAll(ctx context.Context, reporter status.Reporter) error return errs } -// 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 (g *Graph) GetExporters() map[component.DataType]map[component.ID]component.Component { - exportersMap := make(map[component.DataType]map[component.ID]component.Component) - exportersMap[component.DataTypeTraces] = make(map[component.ID]component.Component) - exportersMap[component.DataTypeMetrics] = make(map[component.ID]component.Component) - exportersMap[component.DataTypeLogs] = make(map[component.ID]component.Component) - exportersMap[componentprofiles.DataTypeProfiles] = make(map[component.ID]component.Component) +func (g *Graph) GetExporters() map[pipeline.Signal]map[component.ID]component.Component { + exportersMap := make(map[pipeline.Signal]map[component.ID]component.Component) + exportersMap[pipeline.SignalTraces] = make(map[component.ID]component.Component) + exportersMap[pipeline.SignalMetrics] = make(map[component.ID]component.Component) + exportersMap[pipeline.SignalLogs] = make(map[component.ID]component.Component) + exportersMap[componentprofiles.SignalProfiles] = make(map[component.ID]component.Component) for _, pg := range g.pipelines { for _, expNode := range pg.exporters { @@ -531,7 +526,7 @@ func cycleErr(err error, cycles [][]graph.Node) error { for _, node := range cycle { switch n := node.(type) { case *processorNode: - componentDetails = append(componentDetails, fmt.Sprintf("processor %q in pipeline %q", n.componentID, n.pipelineID)) + componentDetails = append(componentDetails, fmt.Sprintf("processor %q in pipeline %q", n.componentID, n.pipelineID.String())) case *connectorNode: componentDetails = append(componentDetails, fmt.Sprintf("connector %q (%s to %s)", n.componentID, n.exprPipelineType, n.rcvrPipelineType)) default: @@ -541,50 +536,50 @@ func cycleErr(err error, cycles [][]graph.Node) error { return fmt.Errorf("cycle detected: %s", strings.Join(componentDetails, " -> ")) } -func connectorStability(f connector.Factory, expType, recType component.Type) component.StabilityLevel { +func connectorStability(f connector.Factory, expType, recType pipeline.Signal) component.StabilityLevel { switch expType { - case component.DataTypeTraces: + case pipeline.SignalTraces: switch recType { - case component.DataTypeTraces: + case pipeline.SignalTraces: return f.TracesToTracesStability() - case component.DataTypeMetrics: + case pipeline.SignalMetrics: return f.TracesToMetricsStability() - case component.DataTypeLogs: + case pipeline.SignalLogs: return f.TracesToLogsStability() - case componentprofiles.DataTypeProfiles: + case componentprofiles.SignalProfiles: return f.TracesToProfilesStability() } - case component.DataTypeMetrics: + case pipeline.SignalMetrics: switch recType { - case component.DataTypeTraces: + case pipeline.SignalTraces: return f.MetricsToTracesStability() - case component.DataTypeMetrics: + case pipeline.SignalMetrics: return f.MetricsToMetricsStability() - case component.DataTypeLogs: + case pipeline.SignalLogs: return f.MetricsToLogsStability() - case componentprofiles.DataTypeProfiles: + case componentprofiles.SignalProfiles: return f.MetricsToProfilesStability() } - case component.DataTypeLogs: + case pipeline.SignalLogs: switch recType { - case component.DataTypeTraces: + case pipeline.SignalTraces: return f.LogsToTracesStability() - case component.DataTypeMetrics: + case pipeline.SignalMetrics: return f.LogsToMetricsStability() - case component.DataTypeLogs: + case pipeline.SignalLogs: return f.LogsToLogsStability() - case componentprofiles.DataTypeProfiles: + case componentprofiles.SignalProfiles: return f.LogsToProfilesStability() } - case componentprofiles.DataTypeProfiles: + case componentprofiles.SignalProfiles: switch recType { - case component.DataTypeTraces: + case pipeline.SignalTraces: return f.ProfilesToTracesStability() - case component.DataTypeMetrics: + case pipeline.SignalMetrics: return f.ProfilesToMetricsStability() - case component.DataTypeLogs: + case pipeline.SignalLogs: return f.ProfilesToLogsStability() - case componentprofiles.DataTypeProfiles: + case componentprofiles.SignalProfiles: return f.ProfilesToProfilesStability() } } diff --git a/service/internal/graph/graph_test.go b/service/internal/graph/graph_test.go index a6e636229fe..a430cb7882e 100644 --- a/service/internal/graph/graph_test.go +++ b/service/internal/graph/graph_test.go @@ -29,6 +29,7 @@ import ( "go.opentelemetry.io/collector/exporter/exporterprofiles" "go.opentelemetry.io/collector/exporter/exportertest" "go.opentelemetry.io/collector/pdata/testdata" + "go.opentelemetry.io/collector/pipeline" "go.opentelemetry.io/collector/processor" "go.opentelemetry.io/collector/processor/processorprofiles" "go.opentelemetry.io/collector/processor/processortest" @@ -231,28 +232,28 @@ func TestGraphStartStopComponentError(t *testing.T) { func TestConnectorPipelinesGraph(t *testing.T) { tests := []struct { name string - pipelineConfigs pipelines.Config + pipelineConfigs pipelines.ConfigWithPipelineID expectedPerExporter int // requires symmetry in Pipelines }{ { name: "pipelines_simple.yaml", - pipelineConfigs: pipelines.Config{ - component.MustNewID("traces"): { + pipelineConfigs: pipelines.ConfigWithPipelineID{ + pipeline.MustNewID("traces"): { Receivers: []component.ID{component.MustNewID("examplereceiver")}, Processors: []component.ID{component.MustNewID("exampleprocessor")}, Exporters: []component.ID{component.MustNewID("exampleexporter")}, }, - component.MustNewID("metrics"): { + pipeline.MustNewID("metrics"): { Receivers: []component.ID{component.MustNewID("examplereceiver")}, Processors: []component.ID{component.MustNewID("exampleprocessor")}, Exporters: []component.ID{component.MustNewID("exampleexporter")}, }, - component.MustNewID("logs"): { + pipeline.MustNewID("logs"): { Receivers: []component.ID{component.MustNewID("examplereceiver")}, Processors: []component.ID{component.MustNewID("exampleprocessor")}, Exporters: []component.ID{component.MustNewID("exampleexporter")}, }, - component.MustNewID("profiles"): { + pipeline.MustNewID("profiles"): { Receivers: []component.ID{component.MustNewID("examplereceiver")}, Processors: []component.ID{component.MustNewID("exampleprocessor")}, Exporters: []component.ID{component.MustNewID("exampleexporter")}, @@ -262,23 +263,23 @@ func TestConnectorPipelinesGraph(t *testing.T) { }, { name: "pipelines_simple_mutate.yaml", - pipelineConfigs: pipelines.Config{ - component.MustNewID("traces"): { + pipelineConfigs: pipelines.ConfigWithPipelineID{ + pipeline.MustNewID("traces"): { Receivers: []component.ID{component.MustNewID("examplereceiver")}, Processors: []component.ID{component.MustNewIDWithName("exampleprocessor", "mutate")}, Exporters: []component.ID{component.MustNewID("exampleexporter")}, }, - component.MustNewID("metrics"): { + pipeline.MustNewID("metrics"): { Receivers: []component.ID{component.MustNewID("examplereceiver")}, Processors: []component.ID{component.MustNewIDWithName("exampleprocessor", "mutate")}, Exporters: []component.ID{component.MustNewID("exampleexporter")}, }, - component.MustNewID("logs"): { + pipeline.MustNewID("logs"): { Receivers: []component.ID{component.MustNewID("examplereceiver")}, Processors: []component.ID{component.MustNewIDWithName("exampleprocessor", "mutate")}, Exporters: []component.ID{component.MustNewID("exampleexporter")}, }, - component.MustNewID("profiles"): { + pipeline.MustNewID("profiles"): { Receivers: []component.ID{component.MustNewID("examplereceiver")}, Processors: []component.ID{component.MustNewIDWithName("exampleprocessor", "mutate")}, Exporters: []component.ID{component.MustNewID("exampleexporter")}, @@ -288,23 +289,23 @@ func TestConnectorPipelinesGraph(t *testing.T) { }, { name: "pipelines_simple_multi_proc.yaml", - pipelineConfigs: pipelines.Config{ - component.MustNewID("traces"): { + pipelineConfigs: pipelines.ConfigWithPipelineID{ + pipeline.MustNewID("traces"): { Receivers: []component.ID{component.MustNewID("examplereceiver")}, Processors: []component.ID{component.MustNewID("exampleprocessor"), component.MustNewIDWithName("exampleprocessor", "mutate")}, Exporters: []component.ID{component.MustNewID("exampleexporter")}, }, - component.MustNewID("metrics"): { + pipeline.MustNewID("metrics"): { Receivers: []component.ID{component.MustNewID("examplereceiver")}, Processors: []component.ID{component.MustNewID("exampleprocessor"), component.MustNewIDWithName("exampleprocessor", "mutate")}, Exporters: []component.ID{component.MustNewID("exampleexporter")}, }, - component.MustNewID("logs"): { + pipeline.MustNewID("logs"): { Receivers: []component.ID{component.MustNewID("examplereceiver")}, Processors: []component.ID{component.MustNewID("exampleprocessor"), component.MustNewIDWithName("exampleprocessor", "mutate")}, Exporters: []component.ID{component.MustNewID("exampleexporter")}, }, - component.MustNewID("profiles"): { + pipeline.MustNewID("profiles"): { Receivers: []component.ID{component.MustNewID("examplereceiver")}, Processors: []component.ID{component.MustNewID("exampleprocessor"), component.MustNewIDWithName("exampleprocessor", "mutate")}, Exporters: []component.ID{component.MustNewID("exampleexporter")}, @@ -314,20 +315,20 @@ func TestConnectorPipelinesGraph(t *testing.T) { }, { name: "pipelines_simple_no_proc.yaml", - pipelineConfigs: pipelines.Config{ - component.MustNewID("traces"): { + pipelineConfigs: pipelines.ConfigWithPipelineID{ + pipeline.MustNewID("traces"): { Receivers: []component.ID{component.MustNewID("examplereceiver")}, Exporters: []component.ID{component.MustNewID("exampleexporter")}, }, - component.MustNewID("metrics"): { + pipeline.MustNewID("metrics"): { Receivers: []component.ID{component.MustNewID("examplereceiver")}, Exporters: []component.ID{component.MustNewID("exampleexporter")}, }, - component.MustNewID("logs"): { + pipeline.MustNewID("logs"): { Receivers: []component.ID{component.MustNewID("examplereceiver")}, Exporters: []component.ID{component.MustNewID("exampleexporter")}, }, - component.MustNewID("profiles"): { + pipeline.MustNewID("profiles"): { Receivers: []component.ID{component.MustNewID("examplereceiver")}, Exporters: []component.ID{component.MustNewID("exampleexporter")}, }, @@ -336,23 +337,23 @@ func TestConnectorPipelinesGraph(t *testing.T) { }, { name: "pipelines_multi.yaml", - pipelineConfigs: pipelines.Config{ - component.MustNewID("traces"): { + pipelineConfigs: pipelines.ConfigWithPipelineID{ + pipeline.MustNewID("traces"): { Receivers: []component.ID{component.MustNewID("examplereceiver"), component.MustNewIDWithName("examplereceiver", "1")}, Processors: []component.ID{component.MustNewIDWithName("exampleprocessor", "mutate"), component.MustNewID("exampleprocessor")}, Exporters: []component.ID{component.MustNewID("exampleexporter"), component.MustNewIDWithName("exampleexporter", "1")}, }, - component.MustNewID("metrics"): { + pipeline.MustNewID("metrics"): { Receivers: []component.ID{component.MustNewID("examplereceiver"), component.MustNewIDWithName("examplereceiver", "1")}, Processors: []component.ID{component.MustNewIDWithName("exampleprocessor", "mutate"), component.MustNewID("exampleprocessor")}, Exporters: []component.ID{component.MustNewID("exampleexporter"), component.MustNewIDWithName("exampleexporter", "1")}, }, - component.MustNewID("logs"): { + pipeline.MustNewID("logs"): { Receivers: []component.ID{component.MustNewID("examplereceiver"), component.MustNewIDWithName("examplereceiver", "1")}, Processors: []component.ID{component.MustNewIDWithName("exampleprocessor", "mutate"), component.MustNewID("exampleprocessor")}, Exporters: []component.ID{component.MustNewID("exampleexporter"), component.MustNewIDWithName("exampleexporter", "1")}, }, - component.MustNewID("profiles"): { + pipeline.MustNewID("profiles"): { Receivers: []component.ID{component.MustNewID("examplereceiver"), component.MustNewIDWithName("examplereceiver", "1")}, Processors: []component.ID{component.MustNewIDWithName("exampleprocessor", "mutate"), component.MustNewID("exampleprocessor")}, Exporters: []component.ID{component.MustNewID("exampleexporter"), component.MustNewIDWithName("exampleexporter", "1")}, @@ -362,20 +363,20 @@ func TestConnectorPipelinesGraph(t *testing.T) { }, { name: "pipelines_multi_no_proc.yaml", - pipelineConfigs: pipelines.Config{ - component.MustNewID("traces"): { + pipelineConfigs: pipelines.ConfigWithPipelineID{ + pipeline.MustNewID("traces"): { Receivers: []component.ID{component.MustNewID("examplereceiver"), component.MustNewIDWithName("examplereceiver", "1")}, Exporters: []component.ID{component.MustNewID("exampleexporter"), component.MustNewIDWithName("exampleexporter", "1")}, }, - component.MustNewID("metrics"): { + pipeline.MustNewID("metrics"): { Receivers: []component.ID{component.MustNewID("examplereceiver"), component.MustNewIDWithName("examplereceiver", "1")}, Exporters: []component.ID{component.MustNewID("exampleexporter"), component.MustNewIDWithName("exampleexporter", "1")}, }, - component.MustNewID("logs"): { + pipeline.MustNewID("logs"): { Receivers: []component.ID{component.MustNewID("examplereceiver"), component.MustNewIDWithName("examplereceiver", "1")}, Exporters: []component.ID{component.MustNewID("exampleexporter"), component.MustNewIDWithName("exampleexporter", "1")}, }, - component.MustNewID("profiles"): { + pipeline.MustNewID("profiles"): { Receivers: []component.ID{component.MustNewID("examplereceiver"), component.MustNewIDWithName("examplereceiver", "1")}, Exporters: []component.ID{component.MustNewID("exampleexporter"), component.MustNewIDWithName("exampleexporter", "1")}, }, @@ -384,40 +385,40 @@ func TestConnectorPipelinesGraph(t *testing.T) { }, { name: "multi_pipeline_receivers_and_exporters.yaml", - pipelineConfigs: pipelines.Config{ - component.MustNewID("traces"): { + pipelineConfigs: pipelines.ConfigWithPipelineID{ + pipeline.MustNewID("traces"): { Receivers: []component.ID{component.MustNewID("examplereceiver")}, Processors: []component.ID{component.MustNewIDWithName("exampleprocessor", "mutate")}, Exporters: []component.ID{component.MustNewID("exampleexporter")}, }, - component.MustNewIDWithName("traces", "1"): { + pipeline.MustNewIDWithName("traces", "1"): { Receivers: []component.ID{component.MustNewID("examplereceiver")}, Exporters: []component.ID{component.MustNewID("exampleexporter")}, }, - component.MustNewID("metrics"): { + pipeline.MustNewID("metrics"): { Receivers: []component.ID{component.MustNewID("examplereceiver")}, Processors: []component.ID{component.MustNewIDWithName("exampleprocessor", "mutate")}, Exporters: []component.ID{component.MustNewID("exampleexporter")}, }, - component.MustNewIDWithName("metrics", "1"): { + pipeline.MustNewIDWithName("metrics", "1"): { Receivers: []component.ID{component.MustNewID("examplereceiver")}, Exporters: []component.ID{component.MustNewID("exampleexporter")}, }, - component.MustNewID("logs"): { + pipeline.MustNewID("logs"): { Receivers: []component.ID{component.MustNewID("examplereceiver")}, Processors: []component.ID{component.MustNewIDWithName("exampleprocessor", "mutate")}, Exporters: []component.ID{component.MustNewID("exampleexporter")}, }, - component.MustNewIDWithName("logs", "1"): { + pipeline.MustNewIDWithName("logs", "1"): { Receivers: []component.ID{component.MustNewID("examplereceiver")}, Exporters: []component.ID{component.MustNewID("exampleexporter")}, }, - component.MustNewID("profiles"): { + pipeline.MustNewID("profiles"): { Receivers: []component.ID{component.MustNewID("examplereceiver")}, Processors: []component.ID{component.MustNewIDWithName("exampleprocessor", "mutate")}, Exporters: []component.ID{component.MustNewID("exampleexporter")}, }, - component.MustNewIDWithName("profiles", "1"): { + pipeline.MustNewIDWithName("profiles", "1"): { Receivers: []component.ID{component.MustNewID("examplereceiver")}, Exporters: []component.ID{component.MustNewID("exampleexporter")}, }, @@ -426,13 +427,13 @@ func TestConnectorPipelinesGraph(t *testing.T) { }, { name: "pipelines_conn_simple_traces.yaml", - pipelineConfigs: pipelines.Config{ - component.MustNewIDWithName("traces", "in"): { + pipelineConfigs: pipelines.ConfigWithPipelineID{ + pipeline.MustNewIDWithName("traces", "in"): { Receivers: []component.ID{component.MustNewID("examplereceiver")}, Processors: []component.ID{component.MustNewID("exampleprocessor")}, Exporters: []component.ID{component.MustNewIDWithName("exampleconnector", "inherit_mutate")}, }, - component.MustNewIDWithName("traces", "out"): { + pipeline.MustNewIDWithName("traces", "out"): { Receivers: []component.ID{component.MustNewIDWithName("exampleconnector", "inherit_mutate")}, Processors: []component.ID{component.MustNewIDWithName("exampleprocessor", "mutate")}, // mutate propagates upstream to connector Exporters: []component.ID{component.MustNewID("exampleexporter")}, @@ -442,13 +443,13 @@ func TestConnectorPipelinesGraph(t *testing.T) { }, { name: "pipelines_conn_simple_metrics.yaml", - pipelineConfigs: pipelines.Config{ - component.MustNewIDWithName("metrics", "in"): { + pipelineConfigs: pipelines.ConfigWithPipelineID{ + pipeline.MustNewIDWithName("metrics", "in"): { Receivers: []component.ID{component.MustNewID("examplereceiver")}, Processors: []component.ID{component.MustNewID("exampleprocessor")}, Exporters: []component.ID{component.MustNewIDWithName("exampleconnector", "inherit_mutate")}, }, - component.MustNewIDWithName("metrics", "out"): { + pipeline.MustNewIDWithName("metrics", "out"): { Receivers: []component.ID{component.MustNewIDWithName("exampleconnector", "inherit_mutate")}, Processors: []component.ID{component.MustNewIDWithName("exampleprocessor", "mutate")}, // mutate propagates upstream to connector Exporters: []component.ID{component.MustNewID("exampleexporter")}, @@ -458,13 +459,13 @@ func TestConnectorPipelinesGraph(t *testing.T) { }, { name: "pipelines_conn_simple_logs.yaml", - pipelineConfigs: pipelines.Config{ - component.MustNewIDWithName("logs", "in"): { + pipelineConfigs: pipelines.ConfigWithPipelineID{ + pipeline.MustNewIDWithName("logs", "in"): { Receivers: []component.ID{component.MustNewID("examplereceiver")}, Processors: []component.ID{component.MustNewID("exampleprocessor")}, Exporters: []component.ID{component.MustNewIDWithName("exampleconnector", "inherit_mutate")}, }, - component.MustNewIDWithName("logs", "out"): { + pipeline.MustNewIDWithName("logs", "out"): { Receivers: []component.ID{component.MustNewIDWithName("exampleconnector", "inherit_mutate")}, Processors: []component.ID{component.MustNewIDWithName("exampleprocessor", "mutate")}, // mutate propagates upstream to connector Exporters: []component.ID{component.MustNewID("exampleexporter")}, @@ -474,13 +475,13 @@ func TestConnectorPipelinesGraph(t *testing.T) { }, { name: "pipelines_conn_simple_profiles.yaml", - pipelineConfigs: pipelines.Config{ - component.MustNewIDWithName("profiles", "in"): { + pipelineConfigs: pipelines.ConfigWithPipelineID{ + pipeline.MustNewIDWithName("profiles", "in"): { Receivers: []component.ID{component.MustNewID("examplereceiver")}, Processors: []component.ID{component.MustNewID("exampleprocessor")}, Exporters: []component.ID{component.MustNewIDWithName("exampleconnector", "inherit_mutate")}, }, - component.MustNewIDWithName("profiles", "out"): { + pipeline.MustNewIDWithName("profiles", "out"): { Receivers: []component.ID{component.MustNewIDWithName("exampleconnector", "inherit_mutate")}, Processors: []component.ID{component.MustNewIDWithName("exampleprocessor", "mutate")}, // mutate propagates upstream to connector Exporters: []component.ID{component.MustNewID("exampleexporter")}, @@ -490,23 +491,23 @@ func TestConnectorPipelinesGraph(t *testing.T) { }, { name: "pipelines_conn_fork_merge_traces.yaml", - pipelineConfigs: pipelines.Config{ - component.MustNewIDWithName("traces", "in"): { + pipelineConfigs: pipelines.ConfigWithPipelineID{ + pipeline.MustNewIDWithName("traces", "in"): { Receivers: []component.ID{component.MustNewID("examplereceiver")}, Processors: []component.ID{component.MustNewID("exampleprocessor")}, Exporters: []component.ID{component.MustNewIDWithName("exampleconnector", "inherit_mutate")}, }, - component.MustNewIDWithName("traces", "type0"): { + pipeline.MustNewIDWithName("traces", "type0"): { Receivers: []component.ID{component.MustNewIDWithName("exampleconnector", "inherit_mutate")}, Processors: []component.ID{component.MustNewID("exampleprocessor")}, Exporters: []component.ID{component.MustNewIDWithName("exampleconnector", "merge")}, }, - component.MustNewIDWithName("traces", "type1"): { + pipeline.MustNewIDWithName("traces", "type1"): { Receivers: []component.ID{component.MustNewIDWithName("exampleconnector", "inherit_mutate")}, Processors: []component.ID{component.MustNewIDWithName("exampleprocessor", "mutate")}, // mutate propagates upstream to connector Exporters: []component.ID{component.MustNewIDWithName("exampleconnector", "merge")}, }, - component.MustNewIDWithName("traces", "out"): { + pipeline.MustNewIDWithName("traces", "out"): { Receivers: []component.ID{component.MustNewIDWithName("exampleconnector", "merge")}, Processors: []component.ID{component.MustNewID("exampleprocessor")}, Exporters: []component.ID{component.MustNewID("exampleexporter")}, @@ -516,23 +517,23 @@ func TestConnectorPipelinesGraph(t *testing.T) { }, { name: "pipelines_conn_fork_merge_metrics.yaml", - pipelineConfigs: pipelines.Config{ - component.MustNewIDWithName("metrics", "in"): { + pipelineConfigs: pipelines.ConfigWithPipelineID{ + pipeline.MustNewIDWithName("metrics", "in"): { Receivers: []component.ID{component.MustNewID("examplereceiver")}, Processors: []component.ID{component.MustNewID("exampleprocessor")}, Exporters: []component.ID{component.MustNewIDWithName("exampleconnector", "inherit_mutate")}, }, - component.MustNewIDWithName("metrics", "type0"): { + pipeline.MustNewIDWithName("metrics", "type0"): { Receivers: []component.ID{component.MustNewIDWithName("exampleconnector", "inherit_mutate")}, Processors: []component.ID{component.MustNewID("exampleprocessor")}, Exporters: []component.ID{component.MustNewIDWithName("exampleconnector", "merge")}, }, - component.MustNewIDWithName("metrics", "type1"): { + pipeline.MustNewIDWithName("metrics", "type1"): { Receivers: []component.ID{component.MustNewIDWithName("exampleconnector", "inherit_mutate")}, Processors: []component.ID{component.MustNewIDWithName("exampleprocessor", "mutate")}, // mutate propagates upstream to connector Exporters: []component.ID{component.MustNewIDWithName("exampleconnector", "merge")}, }, - component.MustNewIDWithName("metrics", "out"): { + pipeline.MustNewIDWithName("metrics", "out"): { Receivers: []component.ID{component.MustNewIDWithName("exampleconnector", "merge")}, Processors: []component.ID{component.MustNewID("exampleprocessor")}, Exporters: []component.ID{component.MustNewID("exampleexporter")}, @@ -542,23 +543,23 @@ func TestConnectorPipelinesGraph(t *testing.T) { }, { name: "pipelines_conn_fork_merge_logs.yaml", - pipelineConfigs: pipelines.Config{ - component.MustNewIDWithName("logs", "in"): { + pipelineConfigs: pipelines.ConfigWithPipelineID{ + pipeline.MustNewIDWithName("logs", "in"): { Receivers: []component.ID{component.MustNewID("examplereceiver")}, Processors: []component.ID{component.MustNewID("exampleprocessor")}, Exporters: []component.ID{component.MustNewIDWithName("exampleconnector", "inherit_mutate")}, }, - component.MustNewIDWithName("logs", "type0"): { + pipeline.MustNewIDWithName("logs", "type0"): { Receivers: []component.ID{component.MustNewIDWithName("exampleconnector", "inherit_mutate")}, Processors: []component.ID{component.MustNewID("exampleprocessor")}, Exporters: []component.ID{component.MustNewIDWithName("exampleconnector", "merge")}, }, - component.MustNewIDWithName("logs", "type1"): { + pipeline.MustNewIDWithName("logs", "type1"): { Receivers: []component.ID{component.MustNewIDWithName("exampleconnector", "inherit_mutate")}, Processors: []component.ID{component.MustNewIDWithName("exampleprocessor", "mutate")}, // mutate propagates upstream to connector Exporters: []component.ID{component.MustNewIDWithName("exampleconnector", "merge")}, }, - component.MustNewIDWithName("logs", "out"): { + pipeline.MustNewIDWithName("logs", "out"): { Receivers: []component.ID{component.MustNewIDWithName("exampleconnector", "merge")}, Processors: []component.ID{component.MustNewID("exampleprocessor")}, Exporters: []component.ID{component.MustNewID("exampleexporter")}, @@ -568,23 +569,23 @@ func TestConnectorPipelinesGraph(t *testing.T) { }, { name: "pipelines_conn_fork_merge_profiles.yaml", - pipelineConfigs: pipelines.Config{ - component.MustNewIDWithName("profiles", "in"): { + pipelineConfigs: pipelines.ConfigWithPipelineID{ + pipeline.MustNewIDWithName("profiles", "in"): { Receivers: []component.ID{component.MustNewID("examplereceiver")}, Processors: []component.ID{component.MustNewID("exampleprocessor")}, Exporters: []component.ID{component.MustNewIDWithName("exampleconnector", "inherit_mutate")}, }, - component.MustNewIDWithName("profiles", "type0"): { + pipeline.MustNewIDWithName("profiles", "type0"): { Receivers: []component.ID{component.MustNewIDWithName("exampleconnector", "inherit_mutate")}, Processors: []component.ID{component.MustNewID("exampleprocessor")}, Exporters: []component.ID{component.MustNewIDWithName("exampleconnector", "merge")}, }, - component.MustNewIDWithName("profiles", "type1"): { + pipeline.MustNewIDWithName("profiles", "type1"): { Receivers: []component.ID{component.MustNewIDWithName("exampleconnector", "inherit_mutate")}, Processors: []component.ID{component.MustNewIDWithName("exampleprocessor", "mutate")}, // mutate propagates upstream to connector Exporters: []component.ID{component.MustNewIDWithName("exampleconnector", "merge")}, }, - component.MustNewIDWithName("profiles", "out"): { + pipeline.MustNewIDWithName("profiles", "out"): { Receivers: []component.ID{component.MustNewIDWithName("exampleconnector", "merge")}, Processors: []component.ID{component.MustNewID("exampleprocessor")}, Exporters: []component.ID{component.MustNewID("exampleexporter")}, @@ -594,23 +595,23 @@ func TestConnectorPipelinesGraph(t *testing.T) { }, { name: "pipelines_conn_translate_from_traces.yaml", - pipelineConfigs: pipelines.Config{ - component.MustNewID("traces"): { + pipelineConfigs: pipelines.ConfigWithPipelineID{ + pipeline.MustNewID("traces"): { Receivers: []component.ID{component.MustNewID("examplereceiver")}, Processors: []component.ID{component.MustNewID("exampleprocessor")}, Exporters: []component.ID{component.MustNewID("exampleconnector")}, }, - component.MustNewID("metrics"): { + pipeline.MustNewID("metrics"): { Receivers: []component.ID{component.MustNewID("exampleconnector")}, Processors: []component.ID{component.MustNewID("exampleprocessor")}, Exporters: []component.ID{component.MustNewID("exampleexporter")}, }, - component.MustNewID("logs"): { + pipeline.MustNewID("logs"): { Receivers: []component.ID{component.MustNewID("exampleconnector")}, Processors: []component.ID{component.MustNewID("exampleprocessor")}, Exporters: []component.ID{component.MustNewID("exampleexporter")}, }, - component.MustNewID("profiles"): { + pipeline.MustNewID("profiles"): { Receivers: []component.ID{component.MustNewID("exampleconnector")}, Processors: []component.ID{component.MustNewID("exampleprocessor")}, Exporters: []component.ID{component.MustNewID("exampleexporter")}, @@ -620,23 +621,23 @@ func TestConnectorPipelinesGraph(t *testing.T) { }, { name: "pipelines_conn_translate_from_metrics.yaml", - pipelineConfigs: pipelines.Config{ - component.MustNewID("metrics"): { + pipelineConfigs: pipelines.ConfigWithPipelineID{ + pipeline.MustNewID("metrics"): { Receivers: []component.ID{component.MustNewID("examplereceiver")}, Processors: []component.ID{component.MustNewID("exampleprocessor")}, Exporters: []component.ID{component.MustNewID("exampleconnector")}, }, - component.MustNewID("traces"): { + pipeline.MustNewID("traces"): { Receivers: []component.ID{component.MustNewID("exampleconnector")}, Processors: []component.ID{component.MustNewID("exampleprocessor")}, Exporters: []component.ID{component.MustNewID("exampleexporter")}, }, - component.MustNewID("logs"): { + pipeline.MustNewID("logs"): { Receivers: []component.ID{component.MustNewID("exampleconnector")}, Processors: []component.ID{component.MustNewID("exampleprocessor")}, Exporters: []component.ID{component.MustNewID("exampleexporter")}, }, - component.MustNewID("profiles"): { + pipeline.MustNewID("profiles"): { Receivers: []component.ID{component.MustNewID("exampleconnector")}, Processors: []component.ID{component.MustNewID("exampleprocessor")}, Exporters: []component.ID{component.MustNewID("exampleexporter")}, @@ -646,23 +647,23 @@ func TestConnectorPipelinesGraph(t *testing.T) { }, { name: "pipelines_conn_translate_from_logs.yaml", - pipelineConfigs: pipelines.Config{ - component.MustNewID("logs"): { + pipelineConfigs: pipelines.ConfigWithPipelineID{ + pipeline.MustNewID("logs"): { Receivers: []component.ID{component.MustNewID("examplereceiver")}, Processors: []component.ID{component.MustNewID("exampleprocessor")}, Exporters: []component.ID{component.MustNewID("exampleconnector")}, }, - component.MustNewID("traces"): { + pipeline.MustNewID("traces"): { Receivers: []component.ID{component.MustNewID("exampleconnector")}, Processors: []component.ID{component.MustNewID("exampleprocessor")}, Exporters: []component.ID{component.MustNewID("exampleexporter")}, }, - component.MustNewID("metrics"): { + pipeline.MustNewID("metrics"): { Receivers: []component.ID{component.MustNewID("exampleconnector")}, Processors: []component.ID{component.MustNewID("exampleprocessor")}, Exporters: []component.ID{component.MustNewID("exampleexporter")}, }, - component.MustNewID("profiles"): { + pipeline.MustNewID("profiles"): { Receivers: []component.ID{component.MustNewID("exampleconnector")}, Processors: []component.ID{component.MustNewID("exampleprocessor")}, Exporters: []component.ID{component.MustNewID("exampleexporter")}, @@ -672,23 +673,23 @@ func TestConnectorPipelinesGraph(t *testing.T) { }, { name: "pipelines_conn_translate_from_profiles.yaml", - pipelineConfigs: pipelines.Config{ - component.MustNewID("traces"): { + pipelineConfigs: pipelines.ConfigWithPipelineID{ + pipeline.MustNewID("traces"): { Receivers: []component.ID{component.MustNewID("examplereceiver")}, Processors: []component.ID{component.MustNewID("exampleprocessor")}, Exporters: []component.ID{component.MustNewID("exampleconnector")}, }, - component.MustNewID("metrics"): { + pipeline.MustNewID("metrics"): { Receivers: []component.ID{component.MustNewID("exampleconnector")}, Processors: []component.ID{component.MustNewID("exampleprocessor")}, Exporters: []component.ID{component.MustNewID("exampleexporter")}, }, - component.MustNewID("logs"): { + pipeline.MustNewID("logs"): { Receivers: []component.ID{component.MustNewID("exampleconnector")}, Processors: []component.ID{component.MustNewID("exampleprocessor")}, Exporters: []component.ID{component.MustNewID("exampleexporter")}, }, - component.MustNewID("profiles"): { + pipeline.MustNewID("profiles"): { Receivers: []component.ID{component.MustNewID("exampleconnector")}, Processors: []component.ID{component.MustNewID("exampleprocessor")}, Exporters: []component.ID{component.MustNewID("exampleexporter")}, @@ -698,43 +699,43 @@ func TestConnectorPipelinesGraph(t *testing.T) { }, { name: "pipelines_conn_matrix_immutable.yaml", - pipelineConfigs: pipelines.Config{ - component.MustNewIDWithName("traces", "in"): { + pipelineConfigs: pipelines.ConfigWithPipelineID{ + pipeline.MustNewIDWithName("traces", "in"): { Receivers: []component.ID{component.MustNewID("examplereceiver")}, Processors: []component.ID{component.MustNewID("exampleprocessor")}, Exporters: []component.ID{component.MustNewID("exampleconnector")}, }, - component.MustNewIDWithName("metrics", "in"): { + pipeline.MustNewIDWithName("metrics", "in"): { Receivers: []component.ID{component.MustNewID("examplereceiver")}, Processors: []component.ID{component.MustNewID("exampleprocessor")}, Exporters: []component.ID{component.MustNewID("exampleconnector")}, }, - component.MustNewIDWithName("logs", "in"): { + pipeline.MustNewIDWithName("logs", "in"): { Receivers: []component.ID{component.MustNewID("examplereceiver")}, Processors: []component.ID{component.MustNewID("exampleprocessor")}, Exporters: []component.ID{component.MustNewID("exampleconnector")}, }, - component.MustNewIDWithName("profiles", "in"): { + pipeline.MustNewIDWithName("profiles", "in"): { Receivers: []component.ID{component.MustNewID("examplereceiver")}, Processors: []component.ID{component.MustNewID("exampleprocessor")}, Exporters: []component.ID{component.MustNewID("exampleconnector")}, }, - component.MustNewIDWithName("traces", "out"): { + pipeline.MustNewIDWithName("traces", "out"): { Receivers: []component.ID{component.MustNewID("exampleconnector")}, Processors: []component.ID{component.MustNewID("exampleprocessor")}, Exporters: []component.ID{component.MustNewID("exampleexporter")}, }, - component.MustNewIDWithName("metrics", "out"): { + pipeline.MustNewIDWithName("metrics", "out"): { Receivers: []component.ID{component.MustNewID("exampleconnector")}, Processors: []component.ID{component.MustNewID("exampleprocessor")}, Exporters: []component.ID{component.MustNewID("exampleexporter")}, }, - component.MustNewIDWithName("logs", "out"): { + pipeline.MustNewIDWithName("logs", "out"): { Receivers: []component.ID{component.MustNewID("exampleconnector")}, Processors: []component.ID{component.MustNewID("exampleprocessor")}, Exporters: []component.ID{component.MustNewID("exampleexporter")}, }, - component.MustNewIDWithName("profiles", "out"): { + pipeline.MustNewIDWithName("profiles", "out"): { Receivers: []component.ID{component.MustNewID("exampleconnector")}, Processors: []component.ID{component.MustNewID("exampleprocessor")}, Exporters: []component.ID{component.MustNewID("exampleexporter")}, @@ -744,43 +745,43 @@ func TestConnectorPipelinesGraph(t *testing.T) { }, { name: "pipelines_conn_matrix_mutable.yaml", - pipelineConfigs: pipelines.Config{ - component.MustNewIDWithName("traces", "in"): { + pipelineConfigs: pipelines.ConfigWithPipelineID{ + pipeline.MustNewIDWithName("traces", "in"): { Receivers: []component.ID{component.MustNewID("examplereceiver")}, Processors: []component.ID{component.MustNewIDWithName("exampleprocessor", "mutate")}, Exporters: []component.ID{component.MustNewIDWithName("exampleconnector", "inherit_mutate")}, }, - component.MustNewIDWithName("metrics", "in"): { + pipeline.MustNewIDWithName("metrics", "in"): { Receivers: []component.ID{component.MustNewID("examplereceiver")}, Processors: []component.ID{component.MustNewIDWithName("exampleprocessor", "mutate")}, Exporters: []component.ID{component.MustNewIDWithName("exampleconnector", "inherit_mutate")}, }, - component.MustNewIDWithName("logs", "in"): { + pipeline.MustNewIDWithName("logs", "in"): { Receivers: []component.ID{component.MustNewID("examplereceiver")}, Processors: []component.ID{component.MustNewIDWithName("exampleprocessor", "mutate")}, Exporters: []component.ID{component.MustNewIDWithName("exampleconnector", "inherit_mutate")}, }, - component.MustNewIDWithName("profiles", "in"): { + pipeline.MustNewIDWithName("profiles", "in"): { Receivers: []component.ID{component.MustNewID("examplereceiver")}, Processors: []component.ID{component.MustNewIDWithName("exampleprocessor", "mutate")}, Exporters: []component.ID{component.MustNewIDWithName("exampleconnector", "inherit_mutate")}, }, - component.MustNewIDWithName("traces", "out"): { + pipeline.MustNewIDWithName("traces", "out"): { Receivers: []component.ID{component.MustNewIDWithName("exampleconnector", "inherit_mutate")}, Processors: []component.ID{component.MustNewIDWithName("exampleprocessor", "mutate")}, // mutate propagates upstream to connector Exporters: []component.ID{component.MustNewID("exampleexporter")}, }, - component.MustNewIDWithName("metrics", "out"): { + pipeline.MustNewIDWithName("metrics", "out"): { Receivers: []component.ID{component.MustNewIDWithName("exampleconnector", "inherit_mutate")}, Processors: []component.ID{component.MustNewIDWithName("exampleprocessor", "mutate")}, // mutate propagates upstream to connector Exporters: []component.ID{component.MustNewID("exampleexporter")}, }, - component.MustNewIDWithName("logs", "out"): { + pipeline.MustNewIDWithName("logs", "out"): { Receivers: []component.ID{component.MustNewIDWithName("exampleconnector", "inherit_mutate")}, Processors: []component.ID{component.MustNewIDWithName("exampleprocessor", "mutate")}, // mutate propagates upstream to connector Exporters: []component.ID{component.MustNewID("exampleexporter")}, }, - component.MustNewIDWithName("profiles", "out"): { + pipeline.MustNewIDWithName("profiles", "out"): { Receivers: []component.ID{component.MustNewIDWithName("exampleconnector", "inherit_mutate")}, Processors: []component.ID{component.MustNewIDWithName("exampleprocessor", "mutate")}, // mutate propagates upstream to connector Exporters: []component.ID{component.MustNewID("exampleexporter")}, @@ -790,36 +791,36 @@ func TestConnectorPipelinesGraph(t *testing.T) { }, { name: "pipelines_conn_lanes.yaml", - pipelineConfigs: pipelines.Config{ - component.MustNewIDWithName("traces", "in"): { + pipelineConfigs: pipelines.ConfigWithPipelineID{ + pipeline.MustNewIDWithName("traces", "in"): { Receivers: []component.ID{component.MustNewID("examplereceiver")}, Exporters: []component.ID{component.MustNewID("mockforward")}, }, - component.MustNewIDWithName("traces", "out"): { + pipeline.MustNewIDWithName("traces", "out"): { Receivers: []component.ID{component.MustNewID("mockforward")}, Exporters: []component.ID{component.MustNewID("exampleexporter")}, }, - component.MustNewIDWithName("metrics", "in"): { + pipeline.MustNewIDWithName("metrics", "in"): { Receivers: []component.ID{component.MustNewID("examplereceiver")}, Exporters: []component.ID{component.MustNewID("mockforward")}, }, - component.MustNewIDWithName("metrics", "out"): { + pipeline.MustNewIDWithName("metrics", "out"): { Receivers: []component.ID{component.MustNewID("mockforward")}, Exporters: []component.ID{component.MustNewID("exampleexporter")}, }, - component.MustNewIDWithName("logs", "in"): { + pipeline.MustNewIDWithName("logs", "in"): { Receivers: []component.ID{component.MustNewID("examplereceiver")}, Exporters: []component.ID{component.MustNewID("mockforward")}, }, - component.MustNewIDWithName("logs", "out"): { + pipeline.MustNewIDWithName("logs", "out"): { Receivers: []component.ID{component.MustNewID("mockforward")}, Exporters: []component.ID{component.MustNewID("exampleexporter")}, }, - component.MustNewIDWithName("profiles", "in"): { + pipeline.MustNewIDWithName("profiles", "in"): { Receivers: []component.ID{component.MustNewID("examplereceiver")}, Exporters: []component.ID{component.MustNewID("mockforward")}, }, - component.MustNewIDWithName("profiles", "out"): { + pipeline.MustNewIDWithName("profiles", "out"): { Receivers: []component.ID{component.MustNewID("mockforward")}, Exporters: []component.ID{component.MustNewID("exampleexporter")}, }, @@ -828,23 +829,23 @@ func TestConnectorPipelinesGraph(t *testing.T) { }, { name: "pipelines_conn_mutate_traces.yaml", - pipelineConfigs: pipelines.Config{ - component.MustNewIDWithName("traces", "in"): { + pipelineConfigs: pipelines.ConfigWithPipelineID{ + pipeline.MustNewIDWithName("traces", "in"): { Receivers: []component.ID{component.MustNewID("examplereceiver")}, Processors: []component.ID{component.MustNewID("exampleprocessor")}, Exporters: []component.ID{component.MustNewIDWithName("exampleconnector", "inherit_mutate")}, }, - component.MustNewIDWithName("traces", "out0"): { + pipeline.MustNewIDWithName("traces", "out0"): { Receivers: []component.ID{component.MustNewIDWithName("exampleconnector", "inherit_mutate")}, Processors: []component.ID{component.MustNewID("exampleprocessor")}, Exporters: []component.ID{component.MustNewID("exampleexporter")}, }, - component.MustNewIDWithName("traces", "middle"): { + pipeline.MustNewIDWithName("traces", "middle"): { Receivers: []component.ID{component.MustNewIDWithName("exampleconnector", "inherit_mutate")}, Processors: []component.ID{component.MustNewID("exampleprocessor")}, Exporters: []component.ID{component.MustNewIDWithName("exampleconnector", "mutate")}, }, - component.MustNewIDWithName("traces", "out1"): { + pipeline.MustNewIDWithName("traces", "out1"): { Receivers: []component.ID{component.MustNewIDWithName("exampleconnector", "mutate")}, Processors: []component.ID{component.MustNewID("exampleprocessor")}, Exporters: []component.ID{component.MustNewID("exampleexporter")}, @@ -854,23 +855,23 @@ func TestConnectorPipelinesGraph(t *testing.T) { }, { name: "pipelines_conn_mutate_metrics.yaml", - pipelineConfigs: pipelines.Config{ - component.MustNewIDWithName("metrics", "in"): { + pipelineConfigs: pipelines.ConfigWithPipelineID{ + pipeline.MustNewIDWithName("metrics", "in"): { Receivers: []component.ID{component.MustNewID("examplereceiver")}, Processors: []component.ID{component.MustNewID("exampleprocessor")}, Exporters: []component.ID{component.MustNewIDWithName("exampleconnector", "inherit_mutate")}, }, - component.MustNewIDWithName("metrics", "out0"): { + pipeline.MustNewIDWithName("metrics", "out0"): { Receivers: []component.ID{component.MustNewIDWithName("exampleconnector", "inherit_mutate")}, Processors: []component.ID{component.MustNewID("exampleprocessor")}, Exporters: []component.ID{component.MustNewID("exampleexporter")}, }, - component.MustNewIDWithName("metrics", "middle"): { + pipeline.MustNewIDWithName("metrics", "middle"): { Receivers: []component.ID{component.MustNewIDWithName("exampleconnector", "inherit_mutate")}, Processors: []component.ID{component.MustNewID("exampleprocessor")}, Exporters: []component.ID{component.MustNewIDWithName("exampleconnector", "mutate")}, }, - component.MustNewIDWithName("metrics", "out1"): { + pipeline.MustNewIDWithName("metrics", "out1"): { Receivers: []component.ID{component.MustNewIDWithName("exampleconnector", "mutate")}, Processors: []component.ID{component.MustNewID("exampleprocessor")}, Exporters: []component.ID{component.MustNewID("exampleexporter")}, @@ -880,23 +881,23 @@ func TestConnectorPipelinesGraph(t *testing.T) { }, { name: "pipelines_conn_mutate_logs.yaml", - pipelineConfigs: pipelines.Config{ - component.MustNewIDWithName("logs", "in"): { + pipelineConfigs: pipelines.ConfigWithPipelineID{ + pipeline.MustNewIDWithName("logs", "in"): { Receivers: []component.ID{component.MustNewID("examplereceiver")}, Processors: []component.ID{component.MustNewID("exampleprocessor")}, Exporters: []component.ID{component.MustNewIDWithName("exampleconnector", "inherit_mutate")}, }, - component.MustNewIDWithName("logs", "out0"): { + pipeline.MustNewIDWithName("logs", "out0"): { Receivers: []component.ID{component.MustNewIDWithName("exampleconnector", "inherit_mutate")}, Processors: []component.ID{component.MustNewID("exampleprocessor")}, Exporters: []component.ID{component.MustNewID("exampleexporter")}, }, - component.MustNewIDWithName("logs", "middle"): { + pipeline.MustNewIDWithName("logs", "middle"): { Receivers: []component.ID{component.MustNewIDWithName("exampleconnector", "inherit_mutate")}, Processors: []component.ID{component.MustNewID("exampleprocessor")}, Exporters: []component.ID{component.MustNewIDWithName("exampleconnector", "mutate")}, }, - component.MustNewIDWithName("logs", "out1"): { + pipeline.MustNewIDWithName("logs", "out1"): { Receivers: []component.ID{component.MustNewIDWithName("exampleconnector", "mutate")}, Processors: []component.ID{component.MustNewID("exampleprocessor")}, Exporters: []component.ID{component.MustNewID("exampleexporter")}, @@ -906,23 +907,23 @@ func TestConnectorPipelinesGraph(t *testing.T) { }, { name: "pipelines_conn_mutate_profiles.yaml", - pipelineConfigs: pipelines.Config{ - component.MustNewIDWithName("profiles", "in"): { + pipelineConfigs: pipelines.ConfigWithPipelineID{ + pipeline.MustNewIDWithName("profiles", "in"): { Receivers: []component.ID{component.MustNewID("examplereceiver")}, Processors: []component.ID{component.MustNewID("exampleprocessor")}, Exporters: []component.ID{component.MustNewIDWithName("exampleconnector", "inherit_mutate")}, }, - component.MustNewIDWithName("profiles", "out0"): { + pipeline.MustNewIDWithName("profiles", "out0"): { Receivers: []component.ID{component.MustNewIDWithName("exampleconnector", "inherit_mutate")}, Processors: []component.ID{component.MustNewID("exampleprocessor")}, Exporters: []component.ID{component.MustNewID("exampleexporter")}, }, - component.MustNewIDWithName("profiles", "middle"): { + pipeline.MustNewIDWithName("profiles", "middle"): { Receivers: []component.ID{component.MustNewIDWithName("exampleconnector", "inherit_mutate")}, Processors: []component.ID{component.MustNewID("exampleprocessor")}, Exporters: []component.ID{component.MustNewIDWithName("exampleconnector", "mutate")}, }, - component.MustNewIDWithName("profiles", "out1"): { + pipeline.MustNewIDWithName("profiles", "out1"): { Receivers: []component.ID{component.MustNewIDWithName("exampleconnector", "mutate")}, Processors: []component.ID{component.MustNewID("exampleprocessor")}, Exporters: []component.ID{component.MustNewID("exampleexporter")}, @@ -988,7 +989,7 @@ func TestConnectorPipelinesGraph(t *testing.T) { require.NoError(t, pg.StartAll(context.Background(), &Host{Reporter: status.NewReporter(func(*componentstatus.InstanceID, *componentstatus.Event) {}, func(error) {})})) - mutatingPipelines := make(map[component.ID]bool, len(tt.pipelineConfigs)) + mutatingPipelines := make(map[pipeline.ID]bool, len(tt.pipelineConfigs)) // Check each pipeline individually, ensuring that all components are started // and that they have observed no signals yet. @@ -1081,7 +1082,7 @@ func TestConnectorPipelinesGraph(t *testing.T) { // 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() { + if recPipelineID == expPipelineID || recPipelineID.Signal() != expPipelineID.Signal() { continue } for _, rec := range recPipeline.receivers { @@ -1101,19 +1102,19 @@ func TestConnectorPipelinesGraph(t *testing.T) { // 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] { + for _, c := range allReceivers[pipeline.SignalTraces] { tracesReceiver := c.(*testcomponents.ExampleReceiver) require.NoError(t, tracesReceiver.ConsumeTraces(context.Background(), testdata.GenerateTraces(1))) } - for _, c := range allReceivers[component.DataTypeMetrics] { + for _, c := range allReceivers[pipeline.SignalMetrics] { metricsReceiver := c.(*testcomponents.ExampleReceiver) require.NoError(t, metricsReceiver.ConsumeMetrics(context.Background(), testdata.GenerateMetrics(1))) } - for _, c := range allReceivers[component.DataTypeLogs] { + for _, c := range allReceivers[pipeline.SignalLogs] { logsReceiver := c.(*testcomponents.ExampleReceiver) require.NoError(t, logsReceiver.ConsumeLogs(context.Background(), testdata.GenerateLogs(1))) } - for _, c := range allReceivers[componentprofiles.DataTypeProfiles] { + for _, c := range allReceivers[componentprofiles.SignalProfiles] { profilesReceiver := c.(*testcomponents.ExampleReceiver) require.NoError(t, profilesReceiver.ConsumeProfiles(context.Background(), testdata.GenerateProfiles(1))) } @@ -1177,7 +1178,7 @@ 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. allExporters := pg.GetExporters() - for _, e := range allExporters[component.DataTypeTraces] { + for _, e := range allExporters[pipeline.SignalTraces] { tracesExporter := e.(*testcomponents.ExampleExporter) assert.Len(t, tracesExporter.Traces, tt.expectedPerExporter) expectedMutable := testdata.GenerateTraces(1) @@ -1191,7 +1192,7 @@ func TestConnectorPipelinesGraph(t *testing.T) { } } } - for _, e := range allExporters[component.DataTypeMetrics] { + for _, e := range allExporters[pipeline.SignalMetrics] { metricsExporter := e.(*testcomponents.ExampleExporter) assert.Len(t, metricsExporter.Metrics, tt.expectedPerExporter) expectedMutable := testdata.GenerateMetrics(1) @@ -1205,7 +1206,7 @@ func TestConnectorPipelinesGraph(t *testing.T) { } } } - for _, e := range allExporters[component.DataTypeLogs] { + for _, e := range allExporters[pipeline.SignalLogs] { logsExporter := e.(*testcomponents.ExampleExporter) assert.Len(t, logsExporter.Logs, tt.expectedPerExporter) expectedMutable := testdata.GenerateLogs(1) @@ -1219,7 +1220,7 @@ func TestConnectorPipelinesGraph(t *testing.T) { } } } - for _, e := range allExporters[componentprofiles.DataTypeProfiles] { + for _, e := range allExporters[componentprofiles.SignalProfiles] { profilesExporter := e.(*testcomponents.ExampleExporter) assert.Len(t, profilesExporter.Profiles, tt.expectedPerExporter) expectedMutable := testdata.GenerateProfiles(1) @@ -1246,21 +1247,21 @@ func TestConnectorRouter(t *testing.T) { expRightID := component.MustNewIDWithName("exampleexporter", "right") expLeftID := component.MustNewIDWithName("exampleexporter", "left") - tracesInID := component.MustNewIDWithName("traces", "in") - tracesRightID := component.MustNewIDWithName("traces", "right") - tracesLeftID := component.MustNewIDWithName("traces", "left") + tracesInID := pipeline.MustNewIDWithName("traces", "in") + tracesRightID := pipeline.MustNewIDWithName("traces", "right") + tracesLeftID := pipeline.MustNewIDWithName("traces", "left") - metricsInID := component.MustNewIDWithName("metrics", "in") - metricsRightID := component.MustNewIDWithName("metrics", "right") - metricsLeftID := component.MustNewIDWithName("metrics", "left") + metricsInID := pipeline.MustNewIDWithName("metrics", "in") + metricsRightID := pipeline.MustNewIDWithName("metrics", "right") + metricsLeftID := pipeline.MustNewIDWithName("metrics", "left") - logsInID := component.MustNewIDWithName("logs", "in") - logsRightID := component.MustNewIDWithName("logs", "right") - logsLeftID := component.MustNewIDWithName("logs", "left") + logsInID := pipeline.MustNewIDWithName("logs", "in") + logsRightID := pipeline.MustNewIDWithName("logs", "right") + logsLeftID := pipeline.MustNewIDWithName("logs", "left") - profilesInID := component.MustNewIDWithName("profiles", "in") - profilesRightID := component.MustNewIDWithName("profiles", "right") - profilesLeftID := component.MustNewIDWithName("profiles", "left") + profilesInID := pipeline.MustNewIDWithName("profiles", "in") + profilesRightID := pipeline.MustNewIDWithName("profiles", "right") + profilesLeftID := pipeline.MustNewIDWithName("profiles", "left") ctx := context.Background() set := Settings{ @@ -1314,7 +1315,7 @@ func TestConnectorRouter(t *testing.T) { testcomponents.ExampleRouterFactory.Type(): testcomponents.ExampleRouterFactory, }, ), - PipelineConfigs: pipelines.Config{ + PipelineConfigs: pipelines.ConfigWithPipelineID{ tracesInID: { Receivers: []component.ID{rcvrID}, Exporters: []component.ID{routeTracesID}, @@ -1375,9 +1376,9 @@ func TestConnectorRouter(t *testing.T) { assert.Equal(t, len(set.PipelineConfigs), len(pg.pipelines)) // 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) + tracesReceiver := allReceivers[pipeline.SignalTraces][rcvrID].(*testcomponents.ExampleReceiver) + tracesRight := allExporters[pipeline.SignalTraces][expRightID].(*testcomponents.ExampleExporter) + tracesLeft := allExporters[pipeline.SignalTraces][expLeftID].(*testcomponents.ExampleExporter) // Consume 1, validate it went right require.NoError(t, tracesReceiver.ConsumeTraces(ctx, testdata.GenerateTraces(1))) @@ -1397,9 +1398,9 @@ func TestConnectorRouter(t *testing.T) { assert.Len(t, tracesLeft.Traces, 2) // 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) + metricsReceiver := allReceivers[pipeline.SignalMetrics][rcvrID].(*testcomponents.ExampleReceiver) + metricsRight := allExporters[pipeline.SignalMetrics][expRightID].(*testcomponents.ExampleExporter) + metricsLeft := allExporters[pipeline.SignalMetrics][expLeftID].(*testcomponents.ExampleExporter) // Consume 1, validate it went right require.NoError(t, metricsReceiver.ConsumeMetrics(ctx, testdata.GenerateMetrics(1))) @@ -1419,9 +1420,9 @@ func TestConnectorRouter(t *testing.T) { assert.Len(t, metricsLeft.Metrics, 2) // 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) + logsReceiver := allReceivers[pipeline.SignalLogs][rcvrID].(*testcomponents.ExampleReceiver) + logsRight := allExporters[pipeline.SignalLogs][expRightID].(*testcomponents.ExampleExporter) + logsLeft := allExporters[pipeline.SignalLogs][expLeftID].(*testcomponents.ExampleExporter) // Consume 1, validate it went right require.NoError(t, logsReceiver.ConsumeLogs(ctx, testdata.GenerateLogs(1))) @@ -1441,9 +1442,9 @@ func TestConnectorRouter(t *testing.T) { assert.Len(t, logsLeft.Logs, 2) // Get a handle for the profiles receiver and both Exporters - profilesReceiver := allReceivers[componentprofiles.DataTypeProfiles][rcvrID].(*testcomponents.ExampleReceiver) - profilesRight := allExporters[componentprofiles.DataTypeProfiles][expRightID].(*testcomponents.ExampleExporter) - profilesLeft := allExporters[componentprofiles.DataTypeProfiles][expLeftID].(*testcomponents.ExampleExporter) + profilesReceiver := allReceivers[componentprofiles.SignalProfiles][rcvrID].(*testcomponents.ExampleReceiver) + profilesRight := allExporters[componentprofiles.SignalProfiles][expRightID].(*testcomponents.ExampleExporter) + profilesLeft := allExporters[componentprofiles.SignalProfiles][expLeftID].(*testcomponents.ExampleExporter) // Consume 1, validate it went right require.NoError(t, profilesReceiver.ConsumeProfiles(ctx, testdata.GenerateProfiles(1))) @@ -1481,7 +1482,7 @@ func TestGraphBuildErrors(t *testing.T) { processorCfgs map[component.ID]component.Config exporterCfgs map[component.ID]component.Config connectorCfgs map[component.ID]component.Config - pipelineCfgs pipelines.Config + pipelineCfgs pipelines.ConfigWithPipelineID expected string }{ { @@ -1492,8 +1493,8 @@ func TestGraphBuildErrors(t *testing.T) { exporterCfgs: map[component.ID]component.Config{ component.MustNewID("bf"): badExporterFactory.CreateDefaultConfig(), }, - pipelineCfgs: pipelines.Config{ - component.MustNewID("logs"): { + pipelineCfgs: pipelines.ConfigWithPipelineID{ + pipeline.MustNewID("logs"): { Receivers: []component.ID{component.MustNewID("nop")}, Exporters: []component.ID{component.MustNewID("bf")}, }, @@ -1508,8 +1509,8 @@ func TestGraphBuildErrors(t *testing.T) { exporterCfgs: map[component.ID]component.Config{ component.MustNewID("bf"): badExporterFactory.CreateDefaultConfig(), }, - pipelineCfgs: pipelines.Config{ - component.MustNewID("metrics"): { + pipelineCfgs: pipelines.ConfigWithPipelineID{ + pipeline.MustNewID("metrics"): { Receivers: []component.ID{component.MustNewID("nop")}, Exporters: []component.ID{component.MustNewID("bf")}, }, @@ -1524,8 +1525,8 @@ func TestGraphBuildErrors(t *testing.T) { exporterCfgs: map[component.ID]component.Config{ component.MustNewID("bf"): badExporterFactory.CreateDefaultConfig(), }, - pipelineCfgs: pipelines.Config{ - component.MustNewID("traces"): { + pipelineCfgs: pipelines.ConfigWithPipelineID{ + pipeline.MustNewID("traces"): { Receivers: []component.ID{component.MustNewID("nop")}, Exporters: []component.ID{component.MustNewID("bf")}, }, @@ -1540,8 +1541,8 @@ func TestGraphBuildErrors(t *testing.T) { exporterCfgs: map[component.ID]component.Config{ component.MustNewID("bf"): badExporterFactory.CreateDefaultConfig(), }, - pipelineCfgs: pipelines.Config{ - component.MustNewID("profiles"): { + pipelineCfgs: pipelines.ConfigWithPipelineID{ + pipeline.MustNewID("profiles"): { Receivers: []component.ID{component.MustNewID("nop")}, Exporters: []component.ID{component.MustNewID("bf")}, }, @@ -1559,8 +1560,8 @@ func TestGraphBuildErrors(t *testing.T) { exporterCfgs: map[component.ID]component.Config{ component.MustNewID("nop"): nopReceiverFactory.CreateDefaultConfig(), }, - pipelineCfgs: pipelines.Config{ - component.MustNewID("logs"): { + pipelineCfgs: pipelines.ConfigWithPipelineID{ + pipeline.MustNewID("logs"): { Receivers: []component.ID{component.MustNewID("nop")}, Processors: []component.ID{component.MustNewID("bf")}, Exporters: []component.ID{component.MustNewID("nop")}, @@ -1579,8 +1580,8 @@ func TestGraphBuildErrors(t *testing.T) { exporterCfgs: map[component.ID]component.Config{ component.MustNewID("nop"): nopReceiverFactory.CreateDefaultConfig(), }, - pipelineCfgs: pipelines.Config{ - component.MustNewID("metrics"): { + pipelineCfgs: pipelines.ConfigWithPipelineID{ + pipeline.MustNewID("metrics"): { Receivers: []component.ID{component.MustNewID("nop")}, Processors: []component.ID{component.MustNewID("bf")}, Exporters: []component.ID{component.MustNewID("nop")}, @@ -1599,8 +1600,8 @@ func TestGraphBuildErrors(t *testing.T) { exporterCfgs: map[component.ID]component.Config{ component.MustNewID("nop"): nopReceiverFactory.CreateDefaultConfig(), }, - pipelineCfgs: pipelines.Config{ - component.MustNewID("traces"): { + pipelineCfgs: pipelines.ConfigWithPipelineID{ + pipeline.MustNewID("traces"): { Receivers: []component.ID{component.MustNewID("nop")}, Processors: []component.ID{component.MustNewID("bf")}, Exporters: []component.ID{component.MustNewID("nop")}, @@ -1619,8 +1620,8 @@ func TestGraphBuildErrors(t *testing.T) { exporterCfgs: map[component.ID]component.Config{ component.MustNewID("nop"): nopReceiverFactory.CreateDefaultConfig(), }, - pipelineCfgs: pipelines.Config{ - component.MustNewID("profiles"): { + pipelineCfgs: pipelines.ConfigWithPipelineID{ + pipeline.MustNewID("profiles"): { Receivers: []component.ID{component.MustNewID("nop")}, Processors: []component.ID{component.MustNewID("bf")}, Exporters: []component.ID{component.MustNewID("nop")}, @@ -1636,8 +1637,8 @@ func TestGraphBuildErrors(t *testing.T) { exporterCfgs: map[component.ID]component.Config{ component.MustNewID("nop"): nopReceiverFactory.CreateDefaultConfig(), }, - pipelineCfgs: pipelines.Config{ - component.MustNewID("logs"): { + pipelineCfgs: pipelines.ConfigWithPipelineID{ + pipeline.MustNewID("logs"): { Receivers: []component.ID{component.MustNewID("bf")}, Exporters: []component.ID{component.MustNewID("nop")}, }, @@ -1652,8 +1653,8 @@ func TestGraphBuildErrors(t *testing.T) { exporterCfgs: map[component.ID]component.Config{ component.MustNewID("nop"): nopReceiverFactory.CreateDefaultConfig(), }, - pipelineCfgs: pipelines.Config{ - component.MustNewID("metrics"): { + pipelineCfgs: pipelines.ConfigWithPipelineID{ + pipeline.MustNewID("metrics"): { Receivers: []component.ID{component.MustNewID("bf")}, Exporters: []component.ID{component.MustNewID("nop")}, }, @@ -1668,8 +1669,8 @@ func TestGraphBuildErrors(t *testing.T) { exporterCfgs: map[component.ID]component.Config{ component.MustNewID("nop"): nopReceiverFactory.CreateDefaultConfig(), }, - pipelineCfgs: pipelines.Config{ - component.MustNewID("traces"): { + pipelineCfgs: pipelines.ConfigWithPipelineID{ + pipeline.MustNewID("traces"): { Receivers: []component.ID{component.MustNewID("bf")}, Exporters: []component.ID{component.MustNewID("nop")}, }, @@ -1684,8 +1685,8 @@ func TestGraphBuildErrors(t *testing.T) { exporterCfgs: map[component.ID]component.Config{ component.MustNewID("nop"): nopReceiverFactory.CreateDefaultConfig(), }, - pipelineCfgs: pipelines.Config{ - component.MustNewID("profiles"): { + pipelineCfgs: pipelines.ConfigWithPipelineID{ + pipeline.MustNewID("profiles"): { Receivers: []component.ID{component.MustNewID("bf")}, Exporters: []component.ID{component.MustNewID("nop")}, }, @@ -1703,12 +1704,12 @@ func TestGraphBuildErrors(t *testing.T) { connectorCfgs: map[component.ID]component.Config{ component.MustNewID("bf"): nopConnectorFactory.CreateDefaultConfig(), }, - pipelineCfgs: pipelines.Config{ - component.MustNewIDWithName("traces", "in"): { + pipelineCfgs: pipelines.ConfigWithPipelineID{ + pipeline.MustNewIDWithName("traces", "in"): { Receivers: []component.ID{component.MustNewID("nop")}, Exporters: []component.ID{component.MustNewID("bf")}, }, - component.MustNewIDWithName("traces", "out"): { + pipeline.MustNewIDWithName("traces", "out"): { Receivers: []component.ID{component.MustNewID("bf")}, Exporters: []component.ID{component.MustNewID("nop")}, }, @@ -1726,12 +1727,12 @@ func TestGraphBuildErrors(t *testing.T) { connectorCfgs: map[component.ID]component.Config{ component.MustNewID("bf"): nopConnectorFactory.CreateDefaultConfig(), }, - pipelineCfgs: pipelines.Config{ - component.MustNewIDWithName("traces", "in"): { + pipelineCfgs: pipelines.ConfigWithPipelineID{ + pipeline.MustNewIDWithName("traces", "in"): { Receivers: []component.ID{component.MustNewID("nop")}, Exporters: []component.ID{component.MustNewID("bf")}, }, - component.MustNewIDWithName("metrics", "out"): { + pipeline.MustNewIDWithName("metrics", "out"): { Receivers: []component.ID{component.MustNewID("bf")}, Exporters: []component.ID{component.MustNewID("nop")}, }, @@ -1749,12 +1750,12 @@ func TestGraphBuildErrors(t *testing.T) { connectorCfgs: map[component.ID]component.Config{ component.MustNewID("bf"): nopConnectorFactory.CreateDefaultConfig(), }, - pipelineCfgs: pipelines.Config{ - component.MustNewIDWithName("traces", "in"): { + pipelineCfgs: pipelines.ConfigWithPipelineID{ + pipeline.MustNewIDWithName("traces", "in"): { Receivers: []component.ID{component.MustNewID("nop")}, Exporters: []component.ID{component.MustNewID("bf")}, }, - component.MustNewIDWithName("logs", "out"): { + pipeline.MustNewIDWithName("logs", "out"): { Receivers: []component.ID{component.MustNewID("bf")}, Exporters: []component.ID{component.MustNewID("nop")}, }, @@ -1772,12 +1773,12 @@ func TestGraphBuildErrors(t *testing.T) { connectorCfgs: map[component.ID]component.Config{ component.MustNewID("bf"): nopConnectorFactory.CreateDefaultConfig(), }, - pipelineCfgs: pipelines.Config{ - component.MustNewIDWithName("traces", "in"): { + pipelineCfgs: pipelines.ConfigWithPipelineID{ + pipeline.MustNewIDWithName("traces", "in"): { Receivers: []component.ID{component.MustNewID("nop")}, Exporters: []component.ID{component.MustNewID("bf")}, }, - component.MustNewIDWithName("profiles", "out"): { + pipeline.MustNewIDWithName("profiles", "out"): { Receivers: []component.ID{component.MustNewID("bf")}, Exporters: []component.ID{component.MustNewID("nop")}, }, @@ -1795,12 +1796,12 @@ func TestGraphBuildErrors(t *testing.T) { connectorCfgs: map[component.ID]component.Config{ component.MustNewID("bf"): nopConnectorFactory.CreateDefaultConfig(), }, - pipelineCfgs: pipelines.Config{ - component.MustNewIDWithName("metrics", "in"): { + pipelineCfgs: pipelines.ConfigWithPipelineID{ + pipeline.MustNewIDWithName("metrics", "in"): { Receivers: []component.ID{component.MustNewID("nop")}, Exporters: []component.ID{component.MustNewID("bf")}, }, - component.MustNewIDWithName("traces", "out"): { + pipeline.MustNewIDWithName("traces", "out"): { Receivers: []component.ID{component.MustNewID("bf")}, Exporters: []component.ID{component.MustNewID("nop")}, }, @@ -1818,12 +1819,12 @@ func TestGraphBuildErrors(t *testing.T) { connectorCfgs: map[component.ID]component.Config{ component.MustNewID("bf"): nopConnectorFactory.CreateDefaultConfig(), }, - pipelineCfgs: pipelines.Config{ - component.MustNewIDWithName("metrics", "in"): { + pipelineCfgs: pipelines.ConfigWithPipelineID{ + pipeline.MustNewIDWithName("metrics", "in"): { Receivers: []component.ID{component.MustNewID("nop")}, Exporters: []component.ID{component.MustNewID("bf")}, }, - component.MustNewIDWithName("metrics", "out"): { + pipeline.MustNewIDWithName("metrics", "out"): { Receivers: []component.ID{component.MustNewID("bf")}, Exporters: []component.ID{component.MustNewID("nop")}, }, @@ -1841,12 +1842,12 @@ func TestGraphBuildErrors(t *testing.T) { connectorCfgs: map[component.ID]component.Config{ component.MustNewID("bf"): nopConnectorFactory.CreateDefaultConfig(), }, - pipelineCfgs: pipelines.Config{ - component.MustNewIDWithName("metrics", "in"): { + pipelineCfgs: pipelines.ConfigWithPipelineID{ + pipeline.MustNewIDWithName("metrics", "in"): { Receivers: []component.ID{component.MustNewID("nop")}, Exporters: []component.ID{component.MustNewID("bf")}, }, - component.MustNewIDWithName("logs", "out"): { + pipeline.MustNewIDWithName("logs", "out"): { Receivers: []component.ID{component.MustNewID("bf")}, Exporters: []component.ID{component.MustNewID("nop")}, }, @@ -1864,12 +1865,12 @@ func TestGraphBuildErrors(t *testing.T) { connectorCfgs: map[component.ID]component.Config{ component.MustNewID("bf"): nopConnectorFactory.CreateDefaultConfig(), }, - pipelineCfgs: pipelines.Config{ - component.MustNewIDWithName("metrics", "in"): { + pipelineCfgs: pipelines.ConfigWithPipelineID{ + pipeline.MustNewIDWithName("metrics", "in"): { Receivers: []component.ID{component.MustNewID("nop")}, Exporters: []component.ID{component.MustNewID("bf")}, }, - component.MustNewIDWithName("profiles", "out"): { + pipeline.MustNewIDWithName("profiles", "out"): { Receivers: []component.ID{component.MustNewID("bf")}, Exporters: []component.ID{component.MustNewID("nop")}, }, @@ -1887,12 +1888,12 @@ func TestGraphBuildErrors(t *testing.T) { connectorCfgs: map[component.ID]component.Config{ component.MustNewID("bf"): nopConnectorFactory.CreateDefaultConfig(), }, - pipelineCfgs: pipelines.Config{ - component.MustNewIDWithName("logs", "in"): { + pipelineCfgs: pipelines.ConfigWithPipelineID{ + pipeline.MustNewIDWithName("logs", "in"): { Receivers: []component.ID{component.MustNewID("nop")}, Exporters: []component.ID{component.MustNewID("bf")}, }, - component.MustNewIDWithName("traces", "out"): { + pipeline.MustNewIDWithName("traces", "out"): { Receivers: []component.ID{component.MustNewID("bf")}, Exporters: []component.ID{component.MustNewID("nop")}, }, @@ -1910,12 +1911,12 @@ func TestGraphBuildErrors(t *testing.T) { connectorCfgs: map[component.ID]component.Config{ component.MustNewID("bf"): nopConnectorFactory.CreateDefaultConfig(), }, - pipelineCfgs: pipelines.Config{ - component.MustNewIDWithName("logs", "in"): { + pipelineCfgs: pipelines.ConfigWithPipelineID{ + pipeline.MustNewIDWithName("logs", "in"): { Receivers: []component.ID{component.MustNewID("nop")}, Exporters: []component.ID{component.MustNewID("bf")}, }, - component.MustNewIDWithName("metrics", "out"): { + pipeline.MustNewIDWithName("metrics", "out"): { Receivers: []component.ID{component.MustNewID("bf")}, Exporters: []component.ID{component.MustNewID("nop")}, }, @@ -1933,12 +1934,12 @@ func TestGraphBuildErrors(t *testing.T) { connectorCfgs: map[component.ID]component.Config{ component.MustNewID("bf"): nopConnectorFactory.CreateDefaultConfig(), }, - pipelineCfgs: pipelines.Config{ - component.MustNewIDWithName("logs", "in"): { + pipelineCfgs: pipelines.ConfigWithPipelineID{ + pipeline.MustNewIDWithName("logs", "in"): { Receivers: []component.ID{component.MustNewID("nop")}, Exporters: []component.ID{component.MustNewID("bf")}, }, - component.MustNewIDWithName("logs", "out"): { + pipeline.MustNewIDWithName("logs", "out"): { Receivers: []component.ID{component.MustNewID("bf")}, Exporters: []component.ID{component.MustNewID("nop")}, }, @@ -1956,12 +1957,12 @@ func TestGraphBuildErrors(t *testing.T) { connectorCfgs: map[component.ID]component.Config{ component.MustNewID("bf"): nopConnectorFactory.CreateDefaultConfig(), }, - pipelineCfgs: pipelines.Config{ - component.MustNewIDWithName("logs", "in"): { + pipelineCfgs: pipelines.ConfigWithPipelineID{ + pipeline.MustNewIDWithName("logs", "in"): { Receivers: []component.ID{component.MustNewID("nop")}, Exporters: []component.ID{component.MustNewID("bf")}, }, - component.MustNewIDWithName("profiles", "out"): { + pipeline.MustNewIDWithName("profiles", "out"): { Receivers: []component.ID{component.MustNewID("bf")}, Exporters: []component.ID{component.MustNewID("nop")}, }, @@ -1979,12 +1980,12 @@ func TestGraphBuildErrors(t *testing.T) { connectorCfgs: map[component.ID]component.Config{ component.MustNewID("bf"): nopConnectorFactory.CreateDefaultConfig(), }, - pipelineCfgs: pipelines.Config{ - component.MustNewIDWithName("profiles", "in"): { + pipelineCfgs: pipelines.ConfigWithPipelineID{ + pipeline.MustNewIDWithName("profiles", "in"): { Receivers: []component.ID{component.MustNewID("nop")}, Exporters: []component.ID{component.MustNewID("bf")}, }, - component.MustNewIDWithName("traces", "out"): { + pipeline.MustNewIDWithName("traces", "out"): { Receivers: []component.ID{component.MustNewID("bf")}, Exporters: []component.ID{component.MustNewID("nop")}, }, @@ -2002,12 +2003,12 @@ func TestGraphBuildErrors(t *testing.T) { connectorCfgs: map[component.ID]component.Config{ component.MustNewID("bf"): nopConnectorFactory.CreateDefaultConfig(), }, - pipelineCfgs: pipelines.Config{ - component.MustNewIDWithName("profiles", "in"): { + pipelineCfgs: pipelines.ConfigWithPipelineID{ + pipeline.MustNewIDWithName("profiles", "in"): { Receivers: []component.ID{component.MustNewID("nop")}, Exporters: []component.ID{component.MustNewID("bf")}, }, - component.MustNewIDWithName("metrics", "out"): { + pipeline.MustNewIDWithName("metrics", "out"): { Receivers: []component.ID{component.MustNewID("bf")}, Exporters: []component.ID{component.MustNewID("nop")}, }, @@ -2025,12 +2026,12 @@ func TestGraphBuildErrors(t *testing.T) { connectorCfgs: map[component.ID]component.Config{ component.MustNewID("bf"): nopConnectorFactory.CreateDefaultConfig(), }, - pipelineCfgs: pipelines.Config{ - component.MustNewIDWithName("profiles", "in"): { + pipelineCfgs: pipelines.ConfigWithPipelineID{ + pipeline.MustNewIDWithName("profiles", "in"): { Receivers: []component.ID{component.MustNewID("nop")}, Exporters: []component.ID{component.MustNewID("bf")}, }, - component.MustNewIDWithName("logs", "out"): { + pipeline.MustNewIDWithName("logs", "out"): { Receivers: []component.ID{component.MustNewID("bf")}, Exporters: []component.ID{component.MustNewID("nop")}, }, @@ -2048,12 +2049,12 @@ func TestGraphBuildErrors(t *testing.T) { connectorCfgs: map[component.ID]component.Config{ component.MustNewID("bf"): nopConnectorFactory.CreateDefaultConfig(), }, - pipelineCfgs: pipelines.Config{ - component.MustNewIDWithName("profiles", "in"): { + pipelineCfgs: pipelines.ConfigWithPipelineID{ + pipeline.MustNewIDWithName("profiles", "in"): { Receivers: []component.ID{component.MustNewID("nop")}, Exporters: []component.ID{component.MustNewID("bf")}, }, - component.MustNewIDWithName("profiles", "out"): { + pipeline.MustNewIDWithName("profiles", "out"): { Receivers: []component.ID{component.MustNewID("bf")}, Exporters: []component.ID{component.MustNewID("nop")}, }, @@ -2071,8 +2072,8 @@ func TestGraphBuildErrors(t *testing.T) { connectorCfgs: map[component.ID]component.Config{ component.MustNewIDWithName("nop", "conn"): nopConnectorFactory.CreateDefaultConfig(), }, - pipelineCfgs: pipelines.Config{ - component.MustNewIDWithName("metrics", "in"): { + pipelineCfgs: pipelines.ConfigWithPipelineID{ + pipeline.MustNewIDWithName("metrics", "in"): { Receivers: []component.ID{component.MustNewID("nop")}, Exporters: []component.ID{component.MustNewIDWithName("nop", "conn")}, }, @@ -2090,8 +2091,8 @@ func TestGraphBuildErrors(t *testing.T) { connectorCfgs: map[component.ID]component.Config{ component.MustNewIDWithName("nop", "conn"): nopConnectorFactory.CreateDefaultConfig(), }, - pipelineCfgs: pipelines.Config{ - component.MustNewIDWithName("traces", "out"): { + pipelineCfgs: pipelines.ConfigWithPipelineID{ + pipeline.MustNewIDWithName("traces", "out"): { Receivers: []component.ID{component.MustNewIDWithName("nop", "conn")}, Exporters: []component.ID{component.MustNewID("nop")}, }, @@ -2109,16 +2110,16 @@ func TestGraphBuildErrors(t *testing.T) { connectorCfgs: map[component.ID]component.Config{ component.MustNewID("mockforward"): mfConnectorFactory.CreateDefaultConfig(), }, - pipelineCfgs: pipelines.Config{ - component.MustNewIDWithName("traces", "in"): { + pipelineCfgs: pipelines.ConfigWithPipelineID{ + pipeline.MustNewIDWithName("traces", "in"): { Receivers: []component.ID{component.MustNewID("nop")}, Exporters: []component.ID{component.MustNewID("mockforward")}, }, - component.MustNewIDWithName("traces", "out"): { + pipeline.MustNewIDWithName("traces", "out"): { Receivers: []component.ID{component.MustNewID("mockforward")}, Exporters: []component.ID{component.MustNewID("nop")}, }, - component.MustNewIDWithName("metrics", "in"): { + pipeline.MustNewIDWithName("metrics", "in"): { Receivers: []component.ID{component.MustNewID("nop")}, Exporters: []component.ID{component.MustNewID("mockforward")}, }, @@ -2136,16 +2137,16 @@ func TestGraphBuildErrors(t *testing.T) { connectorCfgs: map[component.ID]component.Config{ component.MustNewID("mockforward"): mfConnectorFactory.CreateDefaultConfig(), }, - pipelineCfgs: pipelines.Config{ - component.MustNewIDWithName("metrics", "in"): { + pipelineCfgs: pipelines.ConfigWithPipelineID{ + pipeline.MustNewIDWithName("metrics", "in"): { Receivers: []component.ID{component.MustNewID("nop")}, Exporters: []component.ID{component.MustNewID("mockforward")}, }, - component.MustNewIDWithName("metrics", "out"): { + pipeline.MustNewIDWithName("metrics", "out"): { Receivers: []component.ID{component.MustNewID("mockforward")}, Exporters: []component.ID{component.MustNewID("nop")}, }, - component.MustNewIDWithName("traces", "out"): { + pipeline.MustNewIDWithName("traces", "out"): { Receivers: []component.ID{component.MustNewID("mockforward")}, Exporters: []component.ID{component.MustNewID("nop")}, }, @@ -2166,8 +2167,8 @@ func TestGraphBuildErrors(t *testing.T) { connectorCfgs: map[component.ID]component.Config{ component.MustNewIDWithName("nop", "conn"): nopConnectorFactory.CreateDefaultConfig(), }, - pipelineCfgs: pipelines.Config{ - component.MustNewID("traces"): { + pipelineCfgs: pipelines.ConfigWithPipelineID{ + pipeline.MustNewID("traces"): { Receivers: []component.ID{component.MustNewIDWithName("nop", "conn")}, Processors: []component.ID{component.MustNewID("nop")}, Exporters: []component.ID{component.MustNewIDWithName("nop", "conn")}, @@ -2192,8 +2193,8 @@ func TestGraphBuildErrors(t *testing.T) { connectorCfgs: map[component.ID]component.Config{ component.MustNewIDWithName("nop", "conn"): nopConnectorFactory.CreateDefaultConfig(), }, - pipelineCfgs: pipelines.Config{ - component.MustNewID("metrics"): { + pipelineCfgs: pipelines.ConfigWithPipelineID{ + pipeline.MustNewID("metrics"): { Receivers: []component.ID{component.MustNewIDWithName("nop", "conn")}, Processors: []component.ID{component.MustNewID("nop")}, Exporters: []component.ID{component.MustNewIDWithName("nop", "conn")}, @@ -2218,8 +2219,8 @@ func TestGraphBuildErrors(t *testing.T) { connectorCfgs: map[component.ID]component.Config{ component.MustNewIDWithName("nop", "conn"): nopConnectorFactory.CreateDefaultConfig(), }, - pipelineCfgs: pipelines.Config{ - component.MustNewID("logs"): { + pipelineCfgs: pipelines.ConfigWithPipelineID{ + pipeline.MustNewID("logs"): { Receivers: []component.ID{component.MustNewIDWithName("nop", "conn")}, Processors: []component.ID{component.MustNewID("nop")}, Exporters: []component.ID{component.MustNewIDWithName("nop", "conn")}, @@ -2244,8 +2245,8 @@ func TestGraphBuildErrors(t *testing.T) { connectorCfgs: map[component.ID]component.Config{ component.MustNewIDWithName("nop", "conn"): nopConnectorFactory.CreateDefaultConfig(), }, - pipelineCfgs: pipelines.Config{ - component.MustNewID("profiles"): { + pipelineCfgs: pipelines.ConfigWithPipelineID{ + pipeline.MustNewID("profiles"): { Receivers: []component.ID{component.MustNewIDWithName("nop", "conn")}, Processors: []component.ID{component.MustNewID("nop")}, Exporters: []component.ID{component.MustNewIDWithName("nop", "conn")}, @@ -2272,23 +2273,23 @@ func TestGraphBuildErrors(t *testing.T) { component.MustNewIDWithName("nop", "conn1"): nopConnectorFactory.CreateDefaultConfig(), component.MustNewIDWithName("nop", "conn2"): nopConnectorFactory.CreateDefaultConfig(), }, - pipelineCfgs: pipelines.Config{ - component.MustNewIDWithName("traces", "in"): { + pipelineCfgs: pipelines.ConfigWithPipelineID{ + pipeline.MustNewIDWithName("traces", "in"): { Receivers: []component.ID{component.MustNewID("nop")}, Processors: []component.ID{component.MustNewID("nop")}, Exporters: []component.ID{component.MustNewIDWithName("nop", "conn")}, }, - component.MustNewIDWithName("traces", "1"): { + pipeline.MustNewIDWithName("traces", "1"): { Receivers: []component.ID{component.MustNewIDWithName("nop", "conn")}, Processors: []component.ID{component.MustNewID("nop")}, Exporters: []component.ID{component.MustNewIDWithName("nop", "conn1")}, }, - component.MustNewIDWithName("traces", "2"): { + pipeline.MustNewIDWithName("traces", "2"): { Receivers: []component.ID{component.MustNewIDWithName("nop", "conn1")}, Processors: []component.ID{component.MustNewID("nop")}, Exporters: []component.ID{component.MustNewIDWithName("nop", "conn2"), component.MustNewIDWithName("nop", "conn")}, }, - component.MustNewIDWithName("traces", "out"): { + pipeline.MustNewIDWithName("traces", "out"): { Receivers: []component.ID{component.MustNewIDWithName("nop", "conn2")}, Processors: []component.ID{component.MustNewID("nop")}, Exporters: []component.ID{component.MustNewID("nop")}, @@ -2317,23 +2318,23 @@ func TestGraphBuildErrors(t *testing.T) { component.MustNewIDWithName("nop", "conn1"): nopConnectorFactory.CreateDefaultConfig(), component.MustNewIDWithName("nop", "conn2"): nopConnectorFactory.CreateDefaultConfig(), }, - pipelineCfgs: pipelines.Config{ - component.MustNewIDWithName("metrics", "in"): { + pipelineCfgs: pipelines.ConfigWithPipelineID{ + pipeline.MustNewIDWithName("metrics", "in"): { Receivers: []component.ID{component.MustNewID("nop")}, Processors: []component.ID{component.MustNewID("nop")}, Exporters: []component.ID{component.MustNewIDWithName("nop", "conn")}, }, - component.MustNewIDWithName("metrics", "1"): { + pipeline.MustNewIDWithName("metrics", "1"): { Receivers: []component.ID{component.MustNewIDWithName("nop", "conn")}, Processors: []component.ID{component.MustNewID("nop")}, Exporters: []component.ID{component.MustNewIDWithName("nop", "conn1")}, }, - component.MustNewIDWithName("metrics", "2"): { + pipeline.MustNewIDWithName("metrics", "2"): { Receivers: []component.ID{component.MustNewIDWithName("nop", "conn1")}, Processors: []component.ID{component.MustNewID("nop")}, Exporters: []component.ID{component.MustNewIDWithName("nop", "conn2"), component.MustNewIDWithName("nop", "conn")}, }, - component.MustNewIDWithName("metrics", "out"): { + pipeline.MustNewIDWithName("metrics", "out"): { Receivers: []component.ID{component.MustNewIDWithName("nop", "conn2")}, Processors: []component.ID{component.MustNewID("nop")}, Exporters: []component.ID{component.MustNewID("nop")}, @@ -2362,23 +2363,23 @@ func TestGraphBuildErrors(t *testing.T) { component.MustNewIDWithName("nop", "conn1"): nopConnectorFactory.CreateDefaultConfig(), component.MustNewIDWithName("nop", "conn2"): nopConnectorFactory.CreateDefaultConfig(), }, - pipelineCfgs: pipelines.Config{ - component.MustNewIDWithName("logs", "in"): { + pipelineCfgs: pipelines.ConfigWithPipelineID{ + pipeline.MustNewIDWithName("logs", "in"): { Receivers: []component.ID{component.MustNewID("nop")}, Processors: []component.ID{component.MustNewID("nop")}, Exporters: []component.ID{component.MustNewIDWithName("nop", "conn")}, }, - component.MustNewIDWithName("logs", "1"): { + pipeline.MustNewIDWithName("logs", "1"): { Receivers: []component.ID{component.MustNewIDWithName("nop", "conn")}, Processors: []component.ID{component.MustNewID("nop")}, Exporters: []component.ID{component.MustNewIDWithName("nop", "conn1")}, }, - component.MustNewIDWithName("logs", "2"): { + pipeline.MustNewIDWithName("logs", "2"): { Receivers: []component.ID{component.MustNewIDWithName("nop", "conn1")}, Processors: []component.ID{component.MustNewID("nop")}, Exporters: []component.ID{component.MustNewIDWithName("nop", "conn2"), component.MustNewIDWithName("nop", "conn")}, }, - component.MustNewIDWithName("logs", "out"): { + pipeline.MustNewIDWithName("logs", "out"): { Receivers: []component.ID{component.MustNewIDWithName("nop", "conn2")}, Processors: []component.ID{component.MustNewID("nop")}, Exporters: []component.ID{component.MustNewID("nop")}, @@ -2407,23 +2408,23 @@ func TestGraphBuildErrors(t *testing.T) { component.MustNewIDWithName("nop", "conn1"): nopConnectorFactory.CreateDefaultConfig(), component.MustNewIDWithName("nop", "conn2"): nopConnectorFactory.CreateDefaultConfig(), }, - pipelineCfgs: pipelines.Config{ - component.MustNewIDWithName("profiles", "in"): { + pipelineCfgs: pipelines.ConfigWithPipelineID{ + pipeline.MustNewIDWithName("profiles", "in"): { Receivers: []component.ID{component.MustNewID("nop")}, Processors: []component.ID{component.MustNewID("nop")}, Exporters: []component.ID{component.MustNewIDWithName("nop", "conn")}, }, - component.MustNewIDWithName("profiles", "1"): { + pipeline.MustNewIDWithName("profiles", "1"): { Receivers: []component.ID{component.MustNewIDWithName("nop", "conn")}, Processors: []component.ID{component.MustNewID("nop")}, Exporters: []component.ID{component.MustNewIDWithName("nop", "conn1")}, }, - component.MustNewIDWithName("profiles", "2"): { + pipeline.MustNewIDWithName("profiles", "2"): { Receivers: []component.ID{component.MustNewIDWithName("nop", "conn1")}, Processors: []component.ID{component.MustNewID("nop")}, Exporters: []component.ID{component.MustNewIDWithName("nop", "conn2"), component.MustNewIDWithName("nop", "conn")}, }, - component.MustNewIDWithName("profiles", "out"): { + pipeline.MustNewIDWithName("profiles", "out"): { Receivers: []component.ID{component.MustNewIDWithName("nop", "conn2")}, Processors: []component.ID{component.MustNewID("nop")}, Exporters: []component.ID{component.MustNewID("nop")}, @@ -2453,38 +2454,38 @@ func TestGraphBuildErrors(t *testing.T) { component.MustNewIDWithName("nop", "forkagain"): nopConnectorFactory.CreateDefaultConfig(), component.MustNewIDWithName("nop", "rawlog"): nopConnectorFactory.CreateDefaultConfig(), }, - pipelineCfgs: pipelines.Config{ - component.MustNewIDWithName("traces", "in"): { + pipelineCfgs: pipelines.ConfigWithPipelineID{ + pipeline.MustNewIDWithName("traces", "in"): { Receivers: []component.ID{component.MustNewID("nop")}, Processors: []component.ID{component.MustNewID("nop")}, Exporters: []component.ID{component.MustNewIDWithName("nop", "fork")}, }, - component.MustNewIDWithName("traces", "copy1"): { + pipeline.MustNewIDWithName("traces", "copy1"): { Receivers: []component.ID{component.MustNewIDWithName("nop", "fork")}, Processors: []component.ID{component.MustNewID("nop")}, Exporters: []component.ID{component.MustNewIDWithName("nop", "count")}, }, - component.MustNewIDWithName("traces", "copy2"): { + pipeline.MustNewIDWithName("traces", "copy2"): { Receivers: []component.ID{component.MustNewIDWithName("nop", "fork")}, Processors: []component.ID{component.MustNewID("nop")}, Exporters: []component.ID{component.MustNewIDWithName("nop", "forkagain")}, }, - component.MustNewIDWithName("traces", "copy2a"): { + pipeline.MustNewIDWithName("traces", "copy2a"): { Receivers: []component.ID{component.MustNewIDWithName("nop", "forkagain")}, Processors: []component.ID{component.MustNewID("nop")}, Exporters: []component.ID{component.MustNewIDWithName("nop", "count")}, }, - component.MustNewIDWithName("traces", "copy2b"): { + pipeline.MustNewIDWithName("traces", "copy2b"): { Receivers: []component.ID{component.MustNewIDWithName("nop", "forkagain")}, Processors: []component.ID{component.MustNewID("nop")}, Exporters: []component.ID{component.MustNewIDWithName("nop", "rawlog")}, }, - component.MustNewIDWithName("metrics", "count"): { + pipeline.MustNewIDWithName("metrics", "count"): { Receivers: []component.ID{component.MustNewIDWithName("nop", "count")}, Processors: []component.ID{component.MustNewID("nop")}, Exporters: []component.ID{component.MustNewID("nop")}, }, - component.MustNewIDWithName("logs", "raw"): { + pipeline.MustNewIDWithName("logs", "raw"): { Receivers: []component.ID{component.MustNewIDWithName("nop", "rawlog")}, Processors: []component.ID{component.MustNewID("nop")}, Exporters: []component.ID{component.MustNewIDWithName("nop", "fork")}, // cannot loop back to "nop/fork" @@ -2507,8 +2508,8 @@ func TestGraphBuildErrors(t *testing.T) { exporterCfgs: map[component.ID]component.Config{ component.MustNewID("nop"): nopReceiverFactory.CreateDefaultConfig(), }, - pipelineCfgs: pipelines.Config{ - component.MustNewID("traces"): { + pipelineCfgs: pipelines.ConfigWithPipelineID{ + pipeline.MustNewID("traces"): { Receivers: []component.ID{component.MustNewID("nop")}, Exporters: []component.ID{component.MustNewID("nop"), component.MustNewIDWithName("nop", "1")}, }, @@ -2523,8 +2524,8 @@ func TestGraphBuildErrors(t *testing.T) { exporterCfgs: map[component.ID]component.Config{ component.MustNewID("unknown"): nopReceiverFactory.CreateDefaultConfig(), }, - pipelineCfgs: pipelines.Config{ - component.MustNewID("traces"): { + pipelineCfgs: pipelines.ConfigWithPipelineID{ + pipeline.MustNewID("traces"): { Receivers: []component.ID{component.MustNewID("nop")}, Exporters: []component.ID{component.MustNewID("unknown")}, }, @@ -2542,8 +2543,8 @@ func TestGraphBuildErrors(t *testing.T) { exporterCfgs: map[component.ID]component.Config{ component.MustNewID("nop"): nopReceiverFactory.CreateDefaultConfig(), }, - pipelineCfgs: pipelines.Config{ - component.MustNewID("metrics"): { + pipelineCfgs: pipelines.ConfigWithPipelineID{ + pipeline.MustNewID("metrics"): { Receivers: []component.ID{component.MustNewID("nop")}, Processors: []component.ID{component.MustNewID("nop"), component.MustNewIDWithName("nop", "1")}, Exporters: []component.ID{component.MustNewID("nop")}, @@ -2562,8 +2563,8 @@ func TestGraphBuildErrors(t *testing.T) { exporterCfgs: map[component.ID]component.Config{ component.MustNewID("nop"): nopReceiverFactory.CreateDefaultConfig(), }, - pipelineCfgs: pipelines.Config{ - component.MustNewID("metrics"): { + pipelineCfgs: pipelines.ConfigWithPipelineID{ + pipeline.MustNewID("metrics"): { Receivers: []component.ID{component.MustNewID("nop")}, Processors: []component.ID{component.MustNewID("unknown")}, Exporters: []component.ID{component.MustNewID("nop")}, @@ -2579,8 +2580,8 @@ func TestGraphBuildErrors(t *testing.T) { exporterCfgs: map[component.ID]component.Config{ component.MustNewID("nop"): nopReceiverFactory.CreateDefaultConfig(), }, - pipelineCfgs: pipelines.Config{ - component.MustNewID("logs"): { + pipelineCfgs: pipelines.ConfigWithPipelineID{ + pipeline.MustNewID("logs"): { Receivers: []component.ID{component.MustNewID("nop"), component.MustNewIDWithName("nop", "1")}, Exporters: []component.ID{component.MustNewID("nop")}, }, @@ -2595,8 +2596,8 @@ func TestGraphBuildErrors(t *testing.T) { exporterCfgs: map[component.ID]component.Config{ component.MustNewID("nop"): nopReceiverFactory.CreateDefaultConfig(), }, - pipelineCfgs: pipelines.Config{ - component.MustNewID("logs"): { + pipelineCfgs: pipelines.ConfigWithPipelineID{ + pipeline.MustNewID("logs"): { Receivers: []component.ID{component.MustNewID("unknown")}, Exporters: []component.ID{component.MustNewID("nop")}, }, @@ -2614,12 +2615,12 @@ func TestGraphBuildErrors(t *testing.T) { connectorCfgs: map[component.ID]component.Config{ component.MustNewID("unknown"): nopConnectorFactory.CreateDefaultConfig(), }, - pipelineCfgs: pipelines.Config{ - component.MustNewIDWithName("traces", "in"): { + pipelineCfgs: pipelines.ConfigWithPipelineID{ + pipeline.MustNewIDWithName("traces", "in"): { Receivers: []component.ID{component.MustNewID("nop")}, Exporters: []component.ID{component.MustNewID("unknown")}, }, - component.MustNewIDWithName("traces", "out"): { + pipeline.MustNewIDWithName("traces", "out"): { Receivers: []component.ID{component.MustNewID("unknown")}, Exporters: []component.ID{component.MustNewID("nop")}, }, @@ -2719,11 +2720,11 @@ func TestGraphFailToStartAndShutdown(t *testing.T) { }), } - dataTypes := []component.DataType{component.DataTypeTraces, component.DataTypeMetrics, component.DataTypeLogs} + dataTypes := []pipeline.Signal{pipeline.SignalTraces, pipeline.SignalMetrics, pipeline.SignalLogs} for _, dt := range dataTypes { t.Run(dt.String()+"/receiver", func(t *testing.T) { - set.PipelineConfigs = pipelines.Config{ - component.NewID(dt): { + set.PipelineConfigs = pipelines.ConfigWithPipelineID{ + pipeline.NewID(dt): { Receivers: []component.ID{component.MustNewID("nop"), component.MustNewID("err")}, Processors: []component.ID{component.MustNewID("nop")}, Exporters: []component.ID{component.MustNewID("nop")}, @@ -2736,8 +2737,8 @@ func TestGraphFailToStartAndShutdown(t *testing.T) { }) t.Run(dt.String()+"/processor", func(t *testing.T) { - set.PipelineConfigs = pipelines.Config{ - component.NewID(dt): { + set.PipelineConfigs = pipelines.ConfigWithPipelineID{ + pipeline.NewID(dt): { Receivers: []component.ID{component.MustNewID("nop")}, Processors: []component.ID{component.MustNewID("nop"), component.MustNewID("err")}, Exporters: []component.ID{component.MustNewID("nop")}, @@ -2750,8 +2751,8 @@ func TestGraphFailToStartAndShutdown(t *testing.T) { }) t.Run(dt.String()+"/exporter", func(t *testing.T) { - set.PipelineConfigs = pipelines.Config{ - component.NewID(dt): { + set.PipelineConfigs = pipelines.ConfigWithPipelineID{ + pipeline.NewID(dt): { Receivers: []component.ID{component.MustNewID("nop")}, Processors: []component.ID{component.MustNewID("nop")}, Exporters: []component.ID{component.MustNewID("nop"), component.MustNewID("err")}, @@ -2765,13 +2766,13 @@ func TestGraphFailToStartAndShutdown(t *testing.T) { for _, dt2 := range dataTypes { t.Run(dt.String()+"/"+dt2.String()+"/connector", func(t *testing.T) { - set.PipelineConfigs = pipelines.Config{ - component.NewIDWithName(dt, "in"): { + set.PipelineConfigs = pipelines.ConfigWithPipelineID{ + pipeline.NewIDWithName(dt, "in"): { Receivers: []component.ID{component.MustNewID("nop")}, Processors: []component.ID{component.MustNewID("nop")}, Exporters: []component.ID{component.MustNewID("nop"), component.MustNewIDWithName("err", "conn")}, }, - component.NewIDWithName(dt2, "out"): { + pipeline.NewIDWithName(dt2, "out"): { Receivers: []component.ID{component.MustNewID("nop"), component.MustNewIDWithName("err", "conn")}, Processors: []component.ID{component.MustNewID("nop")}, Exporters: []component.ID{component.MustNewID("nop")}, @@ -2797,12 +2798,12 @@ func TestStatusReportedOnStartupShutdown(t *testing.T) { eSdErr := &testNode{id: component.MustNewIDWithName("e_sd_err", "1"), shutdownErr: assert.AnError} 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), + rNoErr: componentstatus.NewInstanceIDWithPipelineIDs(rNoErr.id, component.KindReceiver), + rStErr: componentstatus.NewInstanceIDWithPipelineIDs(rStErr.id, component.KindReceiver), + rSdErr: componentstatus.NewInstanceIDWithPipelineIDs(rSdErr.id, component.KindReceiver), + eNoErr: componentstatus.NewInstanceIDWithPipelineIDs(eNoErr.id, component.KindExporter), + eStErr: componentstatus.NewInstanceIDWithPipelineIDs(eStErr.id, component.KindExporter), + eSdErr: componentstatus.NewInstanceIDWithPipelineIDs(eSdErr.id, component.KindExporter), } // compare two maps of status events ignoring timestamp @@ -2939,12 +2940,12 @@ func TestStatusReportedOnStartupShutdown(t *testing.T) { } } -func (g *Graph) getReceivers() map[component.DataType]map[component.ID]component.Component { - receiversMap := make(map[component.DataType]map[component.ID]component.Component) - receiversMap[component.DataTypeTraces] = make(map[component.ID]component.Component) - receiversMap[component.DataTypeMetrics] = make(map[component.ID]component.Component) - receiversMap[component.DataTypeLogs] = make(map[component.ID]component.Component) - receiversMap[componentprofiles.DataTypeProfiles] = make(map[component.ID]component.Component) +func (g *Graph) getReceivers() map[pipeline.Signal]map[component.ID]component.Component { + receiversMap := make(map[pipeline.Signal]map[component.ID]component.Component) + receiversMap[pipeline.SignalTraces] = make(map[component.ID]component.Component) + receiversMap[pipeline.SignalMetrics] = make(map[component.ID]component.Component) + receiversMap[pipeline.SignalLogs] = make(map[component.ID]component.Component) + receiversMap[componentprofiles.SignalProfiles] = make(map[component.ID]component.Component) for _, pg := range g.pipelines { for _, rcvrNode := range pg.receivers { @@ -2972,7 +2973,7 @@ func (g *Graph) getReceivers() map[component.DataType]map[component.ID]component // However, within an individual pipeline, we expect: // - E instances of the connector as a receiver. // - R instances of the connector as an exporter. -func expectedInstances(m pipelines.Config, pID component.ID) (int, int) { +func expectedInstances(m pipelines.ConfigWithPipelineID, pID pipeline.ID) (int, int) { exConnectorType := component.MustNewType("exampleconnector") var r, e int for _, rID := range m[pID].Receivers { @@ -2982,11 +2983,11 @@ func expectedInstances(m pipelines.Config, pID component.ID) (int, int) { } // This is a connector. Count the pipeline types where it is an exporter. - typeMap := map[component.DataType]bool{} + typeMap := map[pipeline.Signal]bool{} for pID, pCfg := range m { for _, eID := range pCfg.Exporters { if eID == rID { - typeMap[pID.Type()] = true + typeMap[pID.Signal()] = true } } } @@ -2999,11 +3000,11 @@ func expectedInstances(m pipelines.Config, pID component.ID) (int, int) { } // This is a connector. Count the pipeline types where it is a receiver. - typeMap := map[component.DataType]bool{} + typeMap := map[pipeline.Signal]bool{} for pID, pCfg := range m { for _, rID := range pCfg.Receivers { if rID == eID { - typeMap[pID.Type()] = true + typeMap[pID.Signal()] = true } } } @@ -3037,15 +3038,15 @@ func newBadConnectorFactory() connector.Factory { } func newErrReceiverFactory() receiver.Factory { - return receiver.NewFactory(component.MustNewType("err"), + return receiverprofiles.NewFactory(component.MustNewType("err"), func() component.Config { return &struct{}{} }, - receiver.WithTraces(func(context.Context, receiver.Settings, component.Config, consumer.Traces) (receiver.Traces, error) { + receiverprofiles.WithTraces(func(context.Context, receiver.Settings, component.Config, consumer.Traces) (receiver.Traces, error) { return &errComponent{}, nil }, component.StabilityLevelUndefined), - receiver.WithLogs(func(context.Context, receiver.Settings, component.Config, consumer.Logs) (receiver.Logs, error) { + receiverprofiles.WithLogs(func(context.Context, receiver.Settings, component.Config, consumer.Logs) (receiver.Logs, error) { return &errComponent{}, nil }, component.StabilityLevelUndefined), - receiver.WithMetrics(func(context.Context, receiver.Settings, component.Config, consumer.Metrics) (receiver.Metrics, error) { + receiverprofiles.WithMetrics(func(context.Context, receiver.Settings, component.Config, consumer.Metrics) (receiver.Metrics, error) { return &errComponent{}, nil }, component.StabilityLevelUndefined), receiverprofiles.WithProfiles(func(context.Context, receiver.Settings, component.Config, consumerprofiles.Profiles) (receiverprofiles.Profiles, error) { @@ -3055,15 +3056,15 @@ func newErrReceiverFactory() receiver.Factory { } func newErrProcessorFactory() processor.Factory { - return processor.NewFactory(component.MustNewType("err"), + return processorprofiles.NewFactory(component.MustNewType("err"), func() component.Config { return &struct{}{} }, - processor.WithTraces(func(context.Context, processor.Settings, component.Config, consumer.Traces) (processor.Traces, error) { + processorprofiles.WithTraces(func(context.Context, processor.Settings, component.Config, consumer.Traces) (processor.Traces, error) { return &errComponent{}, nil }, component.StabilityLevelUndefined), - processor.WithLogs(func(context.Context, processor.Settings, component.Config, consumer.Logs) (processor.Logs, error) { + processorprofiles.WithLogs(func(context.Context, processor.Settings, component.Config, consumer.Logs) (processor.Logs, error) { return &errComponent{}, nil }, component.StabilityLevelUndefined), - processor.WithMetrics(func(context.Context, processor.Settings, component.Config, consumer.Metrics) (processor.Metrics, error) { + processorprofiles.WithMetrics(func(context.Context, processor.Settings, component.Config, consumer.Metrics) (processor.Metrics, error) { return &errComponent{}, nil }, component.StabilityLevelUndefined), processorprofiles.WithProfiles(func(context.Context, processor.Settings, component.Config, consumerprofiles.Profiles) (processorprofiles.Profiles, error) { diff --git a/service/internal/graph/host.go b/service/internal/graph/host.go index abadca4b4af..f1ed8994451 100644 --- a/service/internal/graph/host.go +++ b/service/internal/graph/host.go @@ -10,9 +10,12 @@ import ( "time" "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/component/componentprofiles" "go.opentelemetry.io/collector/component/componentstatus" "go.opentelemetry.io/collector/extension" "go.opentelemetry.io/collector/featuregate" + "go.opentelemetry.io/collector/internal/globalsignal" + "go.opentelemetry.io/collector/pipeline" "go.opentelemetry.io/collector/service/extensions" "go.opentelemetry.io/collector/service/internal/builders" "go.opentelemetry.io/collector/service/internal/status" @@ -20,11 +23,21 @@ import ( ) // TODO: remove as part of https://github.com/open-telemetry/opentelemetry-collector/issues/7370 for service 1.0 +// +// nolint type getExporters interface { GetExporters() map[component.DataType]map[component.ID]component.Component } +// TODO: remove as part of https://github.com/open-telemetry/opentelemetry-collector/issues/7370 for service 1.0 +// +// nolint +type getExportersWithSignal interface { + GetExportersWithSignal() map[globalsignal.Signal]map[component.ID]component.Component +} + var _ getExporters = (*Host)(nil) +var _ getExportersWithSignal = (*Host)(nil) var _ component.Host = (*Host)(nil) type Host struct { @@ -70,10 +83,43 @@ func (host *Host) GetExtensions() map[component.ID]component.Component { // 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. +// If you still need this, use GetExportersWithSignal instead. +// nolint func (host *Host) GetExporters() map[component.DataType]map[component.ID]component.Component { + exporters := host.Pipelines.GetExporters() + exportersMap := make(map[component.DataType]map[component.ID]component.Component) + for k, v := range exporters { + exportersMap[convertSignalToDataType(k)] = v + } + return exportersMap +} + +// 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) GetExportersWithSignal() map[pipeline.Signal]map[component.ID]component.Component { return host.Pipelines.GetExporters() } +// nolint +func convertSignalToDataType(signal pipeline.Signal) component.DataType { + switch signal { + case pipeline.SignalTraces: + return component.DataTypeTraces + case pipeline.SignalMetrics: + return component.DataTypeMetrics + case pipeline.SignalLogs: + return component.DataTypeLogs + case componentprofiles.SignalProfiles: + return componentprofiles.DataTypeProfiles + default: + return component.MustNewType(signal.String()) + } +} + func (host *Host) NotifyComponentStatusChange(source *componentstatus.InstanceID, event *componentstatus.Event) { host.ServiceExtensions.NotifyComponentStatusChange(source, event) if event.Status() == componentstatus.StatusFatalError { diff --git a/service/internal/graph/nodes.go b/service/internal/graph/nodes.go index f9cc3e6fa7a..89580dab487 100644 --- a/service/internal/graph/nodes.go +++ b/service/internal/graph/nodes.go @@ -17,6 +17,7 @@ import ( "go.opentelemetry.io/collector/consumer/consumerprofiles" "go.opentelemetry.io/collector/exporter" "go.opentelemetry.io/collector/internal/fanoutconsumer" + "go.opentelemetry.io/collector/pipeline" "go.opentelemetry.io/collector/processor" "go.opentelemetry.io/collector/receiver" "go.opentelemetry.io/collector/service/internal/builders" @@ -59,11 +60,11 @@ type consumerNode interface { type receiverNode struct { nodeID componentID component.ID - pipelineType component.DataType + pipelineType pipeline.Signal component.Component } -func newReceiverNode(pipelineType component.DataType, recvID component.ID) *receiverNode { +func newReceiverNode(pipelineType pipeline.Signal, recvID component.ID) *receiverNode { return &receiverNode{ nodeID: newNodeID(receiverSeed, pipelineType.String(), recvID.String()), componentID: recvID, @@ -81,25 +82,25 @@ func (n *receiverNode) buildComponent(ctx context.Context, set := receiver.Settings{ID: n.componentID, TelemetrySettings: tel, BuildInfo: info} var err error switch n.pipelineType { - case component.DataTypeTraces: + case pipeline.SignalTraces: var consumers []consumer.Traces for _, next := range nexts { consumers = append(consumers, next.(consumer.Traces)) } n.Component, err = builder.CreateTraces(ctx, set, fanoutconsumer.NewTraces(consumers)) - case component.DataTypeMetrics: + case pipeline.SignalMetrics: var consumers []consumer.Metrics for _, next := range nexts { consumers = append(consumers, next.(consumer.Metrics)) } n.Component, err = builder.CreateMetrics(ctx, set, fanoutconsumer.NewMetrics(consumers)) - case component.DataTypeLogs: + case pipeline.SignalLogs: var consumers []consumer.Logs for _, next := range nexts { consumers = append(consumers, next.(consumer.Logs)) } n.Component, err = builder.CreateLogs(ctx, set, fanoutconsumer.NewLogs(consumers)) - case componentprofiles.DataTypeProfiles: + case componentprofiles.SignalProfiles: var consumers []consumerprofiles.Profiles for _, next := range nexts { consumers = append(consumers, next.(consumerprofiles.Profiles)) @@ -121,11 +122,11 @@ var _ consumerNode = (*processorNode)(nil) type processorNode struct { nodeID componentID component.ID - pipelineID component.ID + pipelineID pipeline.ID component.Component } -func newProcessorNode(pipelineID, procID component.ID) *processorNode { +func newProcessorNode(pipelineID pipeline.ID, procID component.ID) *processorNode { return &processorNode{ nodeID: newNodeID(processorSeed, pipelineID.String(), procID.String()), componentID: procID, @@ -146,20 +147,20 @@ func (n *processorNode) buildComponent(ctx context.Context, tel.Logger = components.ProcessorLogger(tel.Logger, n.componentID, n.pipelineID) set := processor.Settings{ID: n.componentID, TelemetrySettings: tel, BuildInfo: info} var err error - switch n.pipelineID.Type() { - case component.DataTypeTraces: + switch n.pipelineID.Signal() { + case pipeline.SignalTraces: n.Component, err = builder.CreateTraces(ctx, set, next.(consumer.Traces)) - case component.DataTypeMetrics: + case pipeline.SignalMetrics: n.Component, err = builder.CreateMetrics(ctx, set, next.(consumer.Metrics)) - case component.DataTypeLogs: + case pipeline.SignalLogs: n.Component, err = builder.CreateLogs(ctx, set, next.(consumer.Logs)) - case componentprofiles.DataTypeProfiles: + case componentprofiles.SignalProfiles: n.Component, err = builder.CreateProfiles(ctx, set, next.(consumerprofiles.Profiles)) default: - return fmt.Errorf("error creating processor %q in pipeline %q, data type %q is not supported", set.ID, n.pipelineID, n.pipelineID.Type()) + return fmt.Errorf("error creating processor %q in pipeline %q, data type %q is not supported", set.ID, n.pipelineID.String(), n.pipelineID.Signal()) } if err != nil { - return fmt.Errorf("failed to create %q processor, in pipeline %q: %w", set.ID, n.pipelineID, err) + return fmt.Errorf("failed to create %q processor, in pipeline %q: %w", set.ID, n.pipelineID.String(), err) } return nil } @@ -171,11 +172,11 @@ var _ consumerNode = (*exporterNode)(nil) type exporterNode struct { nodeID componentID component.ID - pipelineType component.DataType + pipelineType pipeline.Signal component.Component } -func newExporterNode(pipelineType component.DataType, exprID component.ID) *exporterNode { +func newExporterNode(pipelineType pipeline.Signal, exprID component.ID) *exporterNode { return &exporterNode{ nodeID: newNodeID(exporterSeed, pipelineType.String(), exprID.String()), componentID: exprID, @@ -197,13 +198,13 @@ func (n *exporterNode) buildComponent( set := exporter.Settings{ID: n.componentID, TelemetrySettings: tel, BuildInfo: info} var err error switch n.pipelineType { - case component.DataTypeTraces: + case pipeline.SignalTraces: n.Component, err = builder.CreateTraces(ctx, set) - case component.DataTypeMetrics: + case pipeline.SignalMetrics: n.Component, err = builder.CreateMetrics(ctx, set) - case component.DataTypeLogs: + case pipeline.SignalLogs: n.Component, err = builder.CreateLogs(ctx, set) - case componentprofiles.DataTypeProfiles: + case componentprofiles.SignalProfiles: n.Component, err = builder.CreateProfiles(ctx, set) default: return fmt.Errorf("error creating exporter %q for data type %q is not supported", set.ID, n.pipelineType) @@ -221,13 +222,13 @@ var _ consumerNode = (*connectorNode)(nil) type connectorNode struct { nodeID componentID component.ID - exprPipelineType component.DataType - rcvrPipelineType component.DataType + exprPipelineType pipeline.Signal + rcvrPipelineType pipeline.Signal component.Component baseConsumer } -func newConnectorNode(exprPipelineType, rcvrPipelineType component.DataType, connID component.ID) *connectorNode { +func newConnectorNode(exprPipelineType, rcvrPipelineType pipeline.Signal, connID component.ID) *connectorNode { return &connectorNode{ nodeID: newNodeID(connectorSeed, connID.String(), exprPipelineType.String(), rcvrPipelineType.String()), componentID: connID, @@ -251,9 +252,9 @@ func (n *connectorNode) buildComponent( set := connector.Settings{ID: n.componentID, TelemetrySettings: tel, BuildInfo: info} switch n.rcvrPipelineType { - case component.DataTypeTraces: + case pipeline.SignalTraces: capability := consumer.Capabilities{MutatesData: false} - consumers := make(map[component.ID]consumer.Traces, len(nexts)) + consumers := make(map[pipeline.ID]consumer.Traces, len(nexts)) for _, next := range nexts { consumers[next.(*capabilitiesNode).pipelineID] = next.(consumer.Traces) capability.MutatesData = capability.MutatesData || next.Capabilities().MutatesData @@ -261,7 +262,7 @@ func (n *connectorNode) buildComponent( next := connector.NewTracesRouter(consumers) switch n.exprPipelineType { - case component.DataTypeTraces: + case pipeline.SignalTraces: conn, err := builder.CreateTracesToTraces(ctx, set, next) if err != nil { return err @@ -273,19 +274,19 @@ func (n *connectorNode) buildComponent( // that the connector itself may MutatesData. capability.MutatesData = capability.MutatesData || conn.Capabilities().MutatesData n.baseConsumer = capabilityconsumer.NewTraces(conn, capability) - case component.DataTypeMetrics: + case pipeline.SignalMetrics: conn, err := builder.CreateMetricsToTraces(ctx, set, next) if err != nil { return err } n.Component, n.baseConsumer = conn, conn - case component.DataTypeLogs: + case pipeline.SignalLogs: conn, err := builder.CreateLogsToTraces(ctx, set, next) if err != nil { return err } n.Component, n.baseConsumer = conn, conn - case componentprofiles.DataTypeProfiles: + case componentprofiles.SignalProfiles: conn, err := builder.CreateProfilesToTraces(ctx, set, next) if err != nil { return err @@ -293,9 +294,9 @@ func (n *connectorNode) buildComponent( n.Component, n.baseConsumer = conn, conn } - case component.DataTypeMetrics: + case pipeline.SignalMetrics: capability := consumer.Capabilities{MutatesData: false} - consumers := make(map[component.ID]consumer.Metrics, len(nexts)) + consumers := make(map[pipeline.ID]consumer.Metrics, len(nexts)) for _, next := range nexts { consumers[next.(*capabilitiesNode).pipelineID] = next.(consumer.Metrics) capability.MutatesData = capability.MutatesData || next.Capabilities().MutatesData @@ -303,13 +304,13 @@ func (n *connectorNode) buildComponent( next := connector.NewMetricsRouter(consumers) switch n.exprPipelineType { - case component.DataTypeTraces: + case pipeline.SignalTraces: conn, err := builder.CreateTracesToMetrics(ctx, set, next) if err != nil { return err } n.Component, n.baseConsumer = conn, conn - case component.DataTypeMetrics: + case pipeline.SignalMetrics: conn, err := builder.CreateMetricsToMetrics(ctx, set, next) if err != nil { return err @@ -321,22 +322,22 @@ func (n *connectorNode) buildComponent( // that the connector itself may MutatesData. capability.MutatesData = capability.MutatesData || conn.Capabilities().MutatesData n.baseConsumer = capabilityconsumer.NewMetrics(conn, capability) - case component.DataTypeLogs: + case pipeline.SignalLogs: conn, err := builder.CreateLogsToMetrics(ctx, set, next) if err != nil { return err } n.Component, n.baseConsumer = conn, conn - case componentprofiles.DataTypeProfiles: + case componentprofiles.SignalProfiles: conn, err := builder.CreateProfilesToMetrics(ctx, set, next) if err != nil { return err } n.Component, n.baseConsumer = conn, conn } - case component.DataTypeLogs: + case pipeline.SignalLogs: capability := consumer.Capabilities{MutatesData: false} - consumers := make(map[component.ID]consumer.Logs, len(nexts)) + consumers := make(map[pipeline.ID]consumer.Logs, len(nexts)) for _, next := range nexts { consumers[next.(*capabilitiesNode).pipelineID] = next.(consumer.Logs) capability.MutatesData = capability.MutatesData || next.Capabilities().MutatesData @@ -344,19 +345,19 @@ func (n *connectorNode) buildComponent( next := connector.NewLogsRouter(consumers) switch n.exprPipelineType { - case component.DataTypeTraces: + case pipeline.SignalTraces: conn, err := builder.CreateTracesToLogs(ctx, set, next) if err != nil { return err } n.Component, n.baseConsumer = conn, conn - case component.DataTypeMetrics: + case pipeline.SignalMetrics: conn, err := builder.CreateMetricsToLogs(ctx, set, next) if err != nil { return err } n.Component, n.baseConsumer = conn, conn - case component.DataTypeLogs: + case pipeline.SignalLogs: conn, err := builder.CreateLogsToLogs(ctx, set, next) if err != nil { return err @@ -368,16 +369,16 @@ func (n *connectorNode) buildComponent( // that the connector itself may MutatesData. capability.MutatesData = capability.MutatesData || conn.Capabilities().MutatesData n.baseConsumer = capabilityconsumer.NewLogs(conn, capability) - case componentprofiles.DataTypeProfiles: + case componentprofiles.SignalProfiles: conn, err := builder.CreateProfilesToLogs(ctx, set, next) if err != nil { return err } n.Component, n.baseConsumer = conn, conn } - case componentprofiles.DataTypeProfiles: + case componentprofiles.SignalProfiles: capability := consumer.Capabilities{MutatesData: false} - consumers := make(map[component.ID]consumerprofiles.Profiles, len(nexts)) + consumers := make(map[pipeline.ID]consumerprofiles.Profiles, len(nexts)) for _, next := range nexts { consumers[next.(*capabilitiesNode).pipelineID] = next.(consumerprofiles.Profiles) capability.MutatesData = capability.MutatesData || next.Capabilities().MutatesData @@ -385,25 +386,25 @@ func (n *connectorNode) buildComponent( next := connectorprofiles.NewProfilesRouter(consumers) switch n.exprPipelineType { - case component.DataTypeTraces: + case pipeline.SignalTraces: conn, err := builder.CreateTracesToProfiles(ctx, set, next) if err != nil { return err } n.Component, n.baseConsumer = conn, conn - case component.DataTypeMetrics: + case pipeline.SignalMetrics: conn, err := builder.CreateMetricsToProfiles(ctx, set, next) if err != nil { return err } n.Component, n.baseConsumer = conn, conn - case component.DataTypeLogs: + case pipeline.SignalLogs: conn, err := builder.CreateLogsToProfiles(ctx, set, next) if err != nil { return err } n.Component, n.baseConsumer = conn, conn - case componentprofiles.DataTypeProfiles: + case componentprofiles.SignalProfiles: conn, err := builder.CreateProfilesToProfiles(ctx, set, next) if err != nil { return err @@ -429,7 +430,7 @@ var _ consumerNode = (*capabilitiesNode)(nil) // The nodeID is derived from "pipeline ID". type capabilitiesNode struct { nodeID - pipelineID component.ID + pipelineID pipeline.ID baseConsumer consumer.ConsumeTracesFunc consumer.ConsumeMetricsFunc @@ -437,7 +438,7 @@ type capabilitiesNode struct { consumerprofiles.ConsumeProfilesFunc } -func newCapabilitiesNode(pipelineID component.ID) *capabilitiesNode { +func newCapabilitiesNode(pipelineID pipeline.ID) *capabilitiesNode { return &capabilitiesNode{ nodeID: newNodeID(capabilitiesSeed, pipelineID.String()), pipelineID: pipelineID, @@ -454,11 +455,11 @@ var _ consumerNode = (*fanOutNode)(nil) // Therefore, nodeID is derived from "pipeline ID". type fanOutNode struct { nodeID - pipelineID component.ID + pipelineID pipeline.ID baseConsumer } -func newFanOutNode(pipelineID component.ID) *fanOutNode { +func newFanOutNode(pipelineID pipeline.ID) *fanOutNode { return &fanOutNode{ nodeID: newNodeID(fanOutToExporters, pipelineID.String()), pipelineID: pipelineID, diff --git a/service/internal/graph/zpages.go b/service/internal/graph/zpages.go index 0f2793974e9..4b7f2c5ae6d 100644 --- a/service/internal/graph/zpages.go +++ b/service/internal/graph/zpages.go @@ -55,7 +55,7 @@ func (g *Graph) HandleZPages(w http.ResponseWriter, r *http.Request) { sumData.Rows = append(sumData.Rows, zpages.SummaryPipelinesTableRowData{ FullName: c.String(), - InputType: c.Type().String(), + InputType: c.Signal().String(), MutatesData: p.capabilitiesNode.getConsumer().Capabilities().MutatesData, Receivers: recvIDs, Processors: procIDs, diff --git a/service/internal/proctelemetry/process_telemetry_linux_test.go b/service/internal/proctelemetry/process_telemetry_linux_test.go index 2b848ad792d..3bdbc9cd74b 100644 --- a/service/internal/proctelemetry/process_telemetry_linux_test.go +++ b/service/internal/proctelemetry/process_telemetry_linux_test.go @@ -39,7 +39,7 @@ func TestProcessTelemetryWithHostProc(t *testing.T) { } else { metricValue = metric.Metric[0].GetGauge().GetValue() } - if strings.HasPrefix(metricName, "process_uptime") || strings.HasPrefix(metricName, "process_cpu_seconds") { + if strings.HasPrefix(metricName, "otelcol_process_uptime") || strings.HasPrefix(metricName, "otelcol_process_cpu_seconds") { // This likely will still be zero when running the test. assert.GreaterOrEqual(t, metricValue, float64(0), metricName) continue diff --git a/service/internal/testcomponents/example_processor.go b/service/internal/testcomponents/example_processor.go index 2634d6474b6..950c9ed8078 100644 --- a/service/internal/testcomponents/example_processor.go +++ b/service/internal/testcomponents/example_processor.go @@ -16,12 +16,12 @@ import ( var procType = component.MustNewType("exampleprocessor") // ExampleProcessorFactory is factory for ExampleProcessor. -var ExampleProcessorFactory = processor.NewFactory( +var ExampleProcessorFactory = processorprofiles.NewFactory( procType, createDefaultConfig, - processor.WithTraces(createTracesProcessor, component.StabilityLevelDevelopment), - processor.WithMetrics(createMetricsProcessor, component.StabilityLevelDevelopment), - processor.WithLogs(createLogsProcessor, component.StabilityLevelDevelopment), + processorprofiles.WithTraces(createTracesProcessor, component.StabilityLevelDevelopment), + processorprofiles.WithMetrics(createMetricsProcessor, component.StabilityLevelDevelopment), + processorprofiles.WithLogs(createLogsProcessor, component.StabilityLevelDevelopment), processorprofiles.WithProfiles(createProfilesProcessor, component.StabilityLevelDevelopment), ) diff --git a/service/internal/testcomponents/example_receiver.go b/service/internal/testcomponents/example_receiver.go index 2309c9837ec..698df6cc208 100644 --- a/service/internal/testcomponents/example_receiver.go +++ b/service/internal/testcomponents/example_receiver.go @@ -16,12 +16,12 @@ import ( var receiverType = component.MustNewType("examplereceiver") // ExampleReceiverFactory is factory for ExampleReceiver. -var ExampleReceiverFactory = receiver.NewFactory( +var ExampleReceiverFactory = receiverprofiles.NewFactory( receiverType, createReceiverDefaultConfig, - receiver.WithTraces(createTracesReceiver, component.StabilityLevelDevelopment), - receiver.WithMetrics(createMetricsReceiver, component.StabilityLevelDevelopment), - receiver.WithLogs(createLogsReceiver, component.StabilityLevelDevelopment), + receiverprofiles.WithTraces(createTracesReceiver, component.StabilityLevelDevelopment), + receiverprofiles.WithMetrics(createMetricsReceiver, component.StabilityLevelDevelopment), + receiverprofiles.WithLogs(createLogsReceiver, component.StabilityLevelDevelopment), receiverprofiles.WithProfiles(createProfilesReceiver, component.StabilityLevelDevelopment), ) diff --git a/service/internal/testcomponents/example_router.go b/service/internal/testcomponents/example_router.go index c8fd28f48e1..b3302580821 100644 --- a/service/internal/testcomponents/example_router.go +++ b/service/internal/testcomponents/example_router.go @@ -15,6 +15,7 @@ import ( "go.opentelemetry.io/collector/pdata/pmetric" "go.opentelemetry.io/collector/pdata/pprofile" "go.opentelemetry.io/collector/pdata/ptrace" + "go.opentelemetry.io/collector/pipeline" ) var routerType = component.MustNewType("examplerouter") @@ -30,8 +31,8 @@ var ExampleRouterFactory = connector.NewFactory( ) type LeftRightConfig struct { - Left component.ID `mapstructure:"left"` - Right component.ID `mapstructure:"right"` + Left pipeline.ID `mapstructure:"left"` + Right pipeline.ID `mapstructure:"right"` } type ExampleRouterConfig struct { diff --git a/service/internal/testcomponents/example_router_test.go b/service/internal/testcomponents/example_router_test.go index 123799e9213..f8c69e40f8a 100644 --- a/service/internal/testcomponents/example_router_test.go +++ b/service/internal/testcomponents/example_router_test.go @@ -10,7 +10,6 @@ import ( "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/connectorprofiles" @@ -19,6 +18,7 @@ import ( "go.opentelemetry.io/collector/consumer/consumerprofiles" "go.opentelemetry.io/collector/consumer/consumertest" "go.opentelemetry.io/collector/pdata/testdata" + "go.opentelemetry.io/collector/pipeline" ) func TestExampleRouter(t *testing.T) { @@ -34,8 +34,8 @@ func TestExampleRouter(t *testing.T) { } func TestTracesRouter(t *testing.T) { - leftID := component.MustNewIDWithName("sink", "left") - rightID := component.MustNewIDWithName("sink", "right") + leftID := pipeline.MustNewIDWithName("sink", "left") + rightID := pipeline.MustNewIDWithName("sink", "right") sinkLeft := new(consumertest.TracesSink) sinkRight := new(consumertest.TracesSink) @@ -44,7 +44,7 @@ func TestTracesRouter(t *testing.T) { // Many connectors will just call router.ConsumeTraces, // but some implementation will call RouteTraces instead. router := connector.NewTracesRouter( - map[component.ID]consumer.Traces{ + map[pipeline.ID]consumer.Traces{ leftID: sinkLeft, rightID: sinkRight, }) @@ -73,8 +73,8 @@ func TestTracesRouter(t *testing.T) { } func TestMetricsRouter(t *testing.T) { - leftID := component.MustNewIDWithName("sink", "left") - rightID := component.MustNewIDWithName("sink", "right") + leftID := pipeline.MustNewIDWithName("sink", "left") + rightID := pipeline.MustNewIDWithName("sink", "right") sinkLeft := new(consumertest.MetricsSink) sinkRight := new(consumertest.MetricsSink) @@ -83,7 +83,7 @@ func TestMetricsRouter(t *testing.T) { // Many connectors will just call router.ConsumeMetrics, // but some implementation will call RouteMetrics instead. router := connector.NewMetricsRouter( - map[component.ID]consumer.Metrics{ + map[pipeline.ID]consumer.Metrics{ leftID: sinkLeft, rightID: sinkRight, }) @@ -112,8 +112,8 @@ func TestMetricsRouter(t *testing.T) { } func TestLogsRouter(t *testing.T) { - leftID := component.MustNewIDWithName("sink", "left") - rightID := component.MustNewIDWithName("sink", "right") + leftID := pipeline.MustNewIDWithName("sink", "left") + rightID := pipeline.MustNewIDWithName("sink", "right") sinkLeft := new(consumertest.LogsSink) sinkRight := new(consumertest.LogsSink) @@ -122,7 +122,7 @@ func TestLogsRouter(t *testing.T) { // Many connectors will just call router.ConsumeLogs, // but some implementation will call RouteLogs instead. router := connector.NewLogsRouter( - map[component.ID]consumer.Logs{ + map[pipeline.ID]consumer.Logs{ leftID: sinkLeft, rightID: sinkRight, }) @@ -151,8 +151,8 @@ func TestLogsRouter(t *testing.T) { } func TestProfilesRouter(t *testing.T) { - leftID := component.MustNewIDWithName("sink", "left") - rightID := component.MustNewIDWithName("sink", "right") + leftID := pipeline.MustNewIDWithName("sink", "left") + rightID := pipeline.MustNewIDWithName("sink", "right") sinkLeft := new(consumertest.ProfilesSink) sinkRight := new(consumertest.ProfilesSink) @@ -161,7 +161,7 @@ func TestProfilesRouter(t *testing.T) { // Many connectors will just call router.ConsumeProfiles, // but some implementation will call RouteProfiles instead. router := connectorprofiles.NewProfilesRouter( - map[component.ID]consumerprofiles.Profiles{ + map[pipeline.ID]consumerprofiles.Profiles{ leftID: sinkLeft, rightID: sinkRight, }) diff --git a/service/pipelines/config.go b/service/pipelines/config.go index 66698539d5b..dd37e696039 100644 --- a/service/pipelines/config.go +++ b/service/pipelines/config.go @@ -9,6 +9,7 @@ import ( "go.opentelemetry.io/collector/component" "go.opentelemetry.io/collector/component/componentprofiles" + "go.opentelemetry.io/collector/pipeline" ) var ( @@ -18,6 +19,8 @@ var ( ) // Config defines the configurable settings for service telemetry. +// +// Deprecated: [v0.110.0] Use ConfigWithPipelineID instead type Config map[component.ID]*PipelineConfig func (cfg Config) Validate() error { @@ -28,8 +31,9 @@ func (cfg Config) Validate() error { // Check that all pipelines have at least one receiver and one exporter, and they reference // only configured components. - for pipelineID, pipeline := range cfg { + for pipelineID, p := range cfg { switch pipelineID.Type() { + // nolint case component.DataTypeTraces, component.DataTypeMetrics, component.DataTypeLogs, componentprofiles.DataTypeProfiles: // Continue default: @@ -37,7 +41,7 @@ func (cfg Config) Validate() error { } // Validate pipeline has at least one receiver. - if err := pipeline.Validate(); err != nil { + if err := p.Validate(); err != nil { return fmt.Errorf("pipeline %q: %w", pipelineID, err) } } @@ -45,6 +49,33 @@ func (cfg Config) Validate() error { return nil } +type ConfigWithPipelineID map[pipeline.ID]*PipelineConfig + +func (cfg ConfigWithPipelineID) Validate() error { + // Must have at least one pipeline. + if len(cfg) == 0 { + return errMissingServicePipelines + } + + // Check that all pipelines have at least one receiver and one exporter, and they reference + // only configured components. + for pipelineID, p := range cfg { + switch pipelineID.Signal() { + case pipeline.SignalTraces, pipeline.SignalMetrics, pipeline.SignalLogs, componentprofiles.SignalProfiles: + // Continue + default: + return fmt.Errorf("pipeline %q: unknown signal %q", pipelineID.String(), pipelineID.Signal()) + } + + // Validate pipeline has at least one receiver. + if err := p.Validate(); err != nil { + return fmt.Errorf("pipeline %q: %w", pipelineID.String(), err) + } + } + + return nil +} + // PipelineConfig defines the configuration of a Pipeline. type PipelineConfig struct { Receivers []component.ID `mapstructure:"receivers"` diff --git a/service/pipelines/config_test.go b/service/pipelines/config_test.go index d4b5503e3a9..2ec239ac54b 100644 --- a/service/pipelines/config_test.go +++ b/service/pipelines/config_test.go @@ -11,12 +11,13 @@ import ( "github.com/stretchr/testify/assert" "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/pipeline" ) func TestConfigValidate(t *testing.T) { var testCases = []struct { name string // test case name (also file name containing config yaml) - cfgFn func() Config + cfgFn func() ConfigWithPipelineID expected error }{ { @@ -26,9 +27,9 @@ func TestConfigValidate(t *testing.T) { }, { name: "duplicate-processor-reference", - cfgFn: func() Config { + cfgFn: func() ConfigWithPipelineID { cfg := generateConfig() - pipe := cfg[component.MustNewID("traces")] + pipe := cfg[pipeline.MustNewID("traces")] pipe.Processors = append(pipe.Processors, pipe.Processors...) return cfg }, @@ -36,41 +37,41 @@ func TestConfigValidate(t *testing.T) { }, { name: "missing-pipeline-receivers", - cfgFn: func() Config { + cfgFn: func() ConfigWithPipelineID { cfg := generateConfig() - cfg[component.MustNewID("traces")].Receivers = nil + cfg[pipeline.MustNewID("traces")].Receivers = nil return cfg }, expected: fmt.Errorf(`pipeline "traces": %w`, errMissingServicePipelineReceivers), }, { name: "missing-pipeline-exporters", - cfgFn: func() Config { + cfgFn: func() ConfigWithPipelineID { cfg := generateConfig() - cfg[component.MustNewID("traces")].Exporters = nil + cfg[pipeline.MustNewID("traces")].Exporters = nil return cfg }, expected: fmt.Errorf(`pipeline "traces": %w`, errMissingServicePipelineExporters), }, { name: "missing-pipelines", - cfgFn: func() Config { + cfgFn: func() ConfigWithPipelineID { return nil }, expected: errMissingServicePipelines, }, { name: "invalid-service-pipeline-type", - cfgFn: func() Config { + cfgFn: func() ConfigWithPipelineID { cfg := generateConfig() - cfg[component.MustNewID("wrongtype")] = &PipelineConfig{ + cfg[pipeline.MustNewID("wrongtype")] = &PipelineConfig{ Receivers: []component.ID{component.MustNewID("nop")}, Processors: []component.ID{component.MustNewID("nop")}, Exporters: []component.ID{component.MustNewID("nop")}, } return cfg }, - expected: errors.New(`pipeline "wrongtype": unknown datatype "wrongtype"`), + expected: errors.New(`pipeline "wrongtype": unknown signal "wrongtype"`), }, } @@ -82,9 +83,9 @@ func TestConfigValidate(t *testing.T) { } } -func generateConfig() Config { - return map[component.ID]*PipelineConfig{ - component.MustNewID("traces"): { +func generateConfig() ConfigWithPipelineID { + return map[pipeline.ID]*PipelineConfig{ + pipeline.MustNewID("traces"): { Receivers: []component.ID{component.MustNewID("nop")}, Processors: []component.ID{component.MustNewID("nop")}, Exporters: []component.ID{component.MustNewID("nop")}, diff --git a/service/service.go b/service/service.go index 5874b72f8d1..ada723b7c90 100644 --- a/service/service.go +++ b/service/service.go @@ -24,8 +24,8 @@ import ( "go.opentelemetry.io/collector/exporter" "go.opentelemetry.io/collector/extension" "go.opentelemetry.io/collector/featuregate" - "go.opentelemetry.io/collector/internal/globalgates" "go.opentelemetry.io/collector/pdata/pcommon" + "go.opentelemetry.io/collector/pipeline" "go.opentelemetry.io/collector/processor" "go.opentelemetry.io/collector/receiver" "go.opentelemetry.io/collector/service/extensions" @@ -34,6 +34,7 @@ import ( "go.opentelemetry.io/collector/service/internal/proctelemetry" "go.opentelemetry.io/collector/service/internal/resource" "go.opentelemetry.io/collector/service/internal/status" + "go.opentelemetry.io/collector/service/pipelines" "go.opentelemetry.io/collector/service/telemetry" ) @@ -186,6 +187,7 @@ func logsAboutMeterProvider(logger *zap.Logger, cfg telemetry.MetricsConfig, mp return } + //nolint if len(cfg.Address) != 0 { logger.Warn("service::telemetry::metrics::address is being deprecated in favor of service::telemetry::metrics::readers") } @@ -231,7 +233,6 @@ func (srv *Service) Start(ctx context.Context) error { } srv.telemetrySettings.Logger.Info("Everything is ready. Begin running and processing data.") - logAboutUseLocalHostAsDefault(srv.telemetrySettings.Logger) return nil } @@ -303,8 +304,19 @@ func (srv *Service) initExtensions(ctx context.Context, cfg extensions.Config) e return nil } +func convertFromComponentIDToPipelineID(id component.ID) pipeline.ID { + return pipeline.MustNewIDWithName(id.Type().String(), id.Name()) +} + // Creates the pipeline graph. func (srv *Service) initGraph(ctx context.Context, cfg Config) error { + if len(cfg.Pipelines) > 0 { + cfg.PipelinesWithPipelineID = make(pipelines.ConfigWithPipelineID, len(cfg.Pipelines)) + for k, v := range cfg.Pipelines { + cfg.PipelinesWithPipelineID[convertFromComponentIDToPipelineID(k)] = v + } + } + var err error if srv.host.Pipelines, err = graph.Build(ctx, graph.Settings{ Telemetry: srv.telemetrySettings, @@ -313,7 +325,7 @@ func (srv *Service) initGraph(ctx context.Context, cfg Config) error { ProcessorBuilder: srv.host.Processors, ExporterBuilder: srv.host.Exporters, ConnectorBuilder: srv.host.Connectors, - PipelineConfigs: cfg.Pipelines, + PipelineConfigs: cfg.PipelinesWithPipelineID, ReportStatus: srv.host.Reporter.ReportStatus, }); err != nil { return fmt.Errorf("failed to build pipelines: %w", err) @@ -337,13 +349,3 @@ func pdataFromSdk(res *sdkresource.Resource) pcommon.Resource { } return pcommonRes } - -// logAboutUseLocalHostAsDefault logs about the upcoming change from 0.0.0.0 to localhost on server-like components. -func logAboutUseLocalHostAsDefault(logger *zap.Logger) { - if globalgates.UseLocalHostAsDefaultHostfeatureGate.IsEnabled() { - logger.Info( - "The default endpoints for all servers in components have changed to use localhost instead of 0.0.0.0. Disable the feature gate to temporarily revert to the previous default.", - zap.String("feature gate ID", globalgates.UseLocalHostAsDefaultHostID), - ) - } -} diff --git a/service/service_test.go b/service/service_test.go index 41e5e046b61..23cbaa5509f 100644 --- a/service/service_test.go +++ b/service/service_test.go @@ -31,6 +31,7 @@ import ( "go.opentelemetry.io/collector/extension/zpagesextension" "go.opentelemetry.io/collector/internal/testutil" "go.opentelemetry.io/collector/pdata/pcommon" + "go.opentelemetry.io/collector/pipeline" "go.opentelemetry.io/collector/service/extensions" "go.opentelemetry.io/collector/service/internal/builders" "go.opentelemetry.io/collector/service/internal/promtest" @@ -218,6 +219,7 @@ func TestServiceGetExtensions(t *testing.T) { assert.Contains(t, extMap, component.NewID(nopType)) } +// nolint func TestServiceGetExporters(t *testing.T) { srv, err := New(context.Background(), newNopSettings(), newNopConfig()) require.NoError(t, err) @@ -227,8 +229,12 @@ func TestServiceGetExporters(t *testing.T) { assert.NoError(t, srv.Shutdown(context.Background())) }) - // nolint expMap := srv.host.GetExporters() + + v, ok := expMap[component.DataTypeTraces] + assert.True(t, ok) + assert.NotNil(t, v) + assert.Len(t, expMap, 4) assert.Len(t, expMap[component.DataTypeTraces], 1) assert.Contains(t, expMap[component.DataTypeTraces], component.NewID(nopType)) @@ -240,11 +246,38 @@ func TestServiceGetExporters(t *testing.T) { assert.Contains(t, expMap[componentprofiles.DataTypeProfiles], component.NewID(nopType)) } +// nolint +func TestServiceGetExportersWithSignal(t *testing.T) { + srv, err := New(context.Background(), newNopSettings(), newNopConfig()) + require.NoError(t, err) + + assert.NoError(t, srv.Start(context.Background())) + t.Cleanup(func() { + assert.NoError(t, srv.Shutdown(context.Background())) + }) + + expMap := srv.host.GetExportersWithSignal() + + v, ok := expMap[pipeline.SignalTraces] + assert.True(t, ok) + assert.NotNil(t, v) + + assert.Len(t, expMap, 4) + assert.Len(t, expMap[pipeline.SignalTraces], 1) + assert.Contains(t, expMap[pipeline.SignalTraces], component.NewID(nopType)) + assert.Len(t, expMap[pipeline.SignalMetrics], 1) + assert.Contains(t, expMap[pipeline.SignalMetrics], component.NewID(nopType)) + assert.Len(t, expMap[pipeline.SignalLogs], 1) + assert.Contains(t, expMap[pipeline.SignalLogs], component.NewID(nopType)) + assert.Len(t, expMap[componentprofiles.SignalProfiles], 1) + assert.Contains(t, expMap[componentprofiles.SignalProfiles], component.NewID(nopType)) +} + // TestServiceTelemetryCleanupOnError tests that if newService errors due to an invalid config telemetry is cleaned up // and another service with a valid config can be started right after. func TestServiceTelemetryCleanupOnError(t *testing.T) { invalidCfg := newNopConfig() - invalidCfg.Pipelines[component.MustNewID("traces")].Processors[0] = component.MustNewID("invalid") + invalidCfg.PipelinesWithPipelineID[pipeline.MustNewID("traces")].Processors[0] = component.MustNewID("invalid") // Create a service with an invalid config and expect an error _, err := New(context.Background(), newNopSettings(), invalidCfg) require.Error(t, err) @@ -256,78 +289,6 @@ func TestServiceTelemetryCleanupOnError(t *testing.T) { } func TestServiceTelemetry(t *testing.T) { - for _, tc := range ownMetricsTestCases() { - t.Run(fmt.Sprintf("ipv4_%s", tc.name), func(t *testing.T) { - testCollectorStartHelper(t, tc, "tcp4") - }) - t.Run(fmt.Sprintf("ipv6_%s", tc.name), func(t *testing.T) { - testCollectorStartHelper(t, tc, "tcp6") - }) - } -} - -func testCollectorStartHelper(t *testing.T, tc ownMetricsTestCase, network string) { - var once sync.Once - loggingHookCalled := false - hook := func(zapcore.Entry) error { - once.Do(func() { - loggingHookCalled = true - }) - return nil - } - - var ( - metricsAddr string - zpagesAddr string - ) - switch network { - case "tcp", "tcp4": - metricsAddr = testutil.GetAvailableLocalAddress(t) - zpagesAddr = testutil.GetAvailableLocalAddress(t) - case "tcp6": - metricsAddr = testutil.GetAvailableLocalIPv6Address(t) - zpagesAddr = testutil.GetAvailableLocalIPv6Address(t) - } - require.NotZero(t, metricsAddr, "network must be either of tcp, tcp4 or tcp6") - require.NotZero(t, zpagesAddr, "network must be either of tcp, tcp4 or tcp6") - - set := newNopSettings() - set.BuildInfo = component.BuildInfo{Version: "test version", Command: otelCommand} - 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() - cfg.Extensions = []component.ID{component.MustNewID("zpages")} - cfg.Telemetry.Metrics.Address = metricsAddr - cfg.Telemetry.Resource = make(map[string]*string) - // Include resource attributes under the service::telemetry::resource key. - for k, v := range tc.userDefinedResource { - cfg.Telemetry.Resource[k] = v - } - - // Create a service, check for metrics, shutdown and repeat to ensure that telemetry can be started/shutdown and started again. - for i := 0; i < 2; i++ { - srv, err := New(context.Background(), set, cfg) - require.NoError(t, err) - - require.NoError(t, srv.Start(context.Background())) - // Sleep for 1 second to ensure the http server is started. - time.Sleep(1 * time.Second) - assert.True(t, loggingHookCalled) - - assertResourceLabels(t, srv.telemetrySettings.Resource, tc.expectedLabels) - assertMetrics(t, metricsAddr, tc.expectedLabels) - assertZPages(t, zpagesAddr) - require.NoError(t, srv.Shutdown(context.Background())) - } -} - -func TestServiceTelemetryWithReaders(t *testing.T) { for _, tc := range ownMetricsTestCases() { t.Run(fmt.Sprintf("ipv4_%s", tc.name), func(t *testing.T) { testCollectorStartHelperWithReaders(t, tc, "tcp4") @@ -375,7 +336,6 @@ func testCollectorStartHelperWithReaders(t *testing.T, tc ownMetricsTestCase, ne cfg := newNopConfig() cfg.Extensions = []component.ID{component.MustNewID("zpages")} - cfg.Telemetry.Metrics.Address = "" cfg.Telemetry.Metrics.Readers = []config.MetricReader{ { Pull: &config.PullMetricReader{ @@ -663,23 +623,23 @@ func newNopSettings() Settings { } func newNopConfig() Config { - return newNopConfigPipelineConfigs(pipelines.Config{ - component.MustNewID("traces"): { + return newNopConfigPipelineConfigs(pipelines.ConfigWithPipelineID{ + pipeline.MustNewID("traces"): { Receivers: []component.ID{component.NewID(nopType)}, Processors: []component.ID{component.NewID(nopType)}, Exporters: []component.ID{component.NewID(nopType)}, }, - component.MustNewID("metrics"): { + pipeline.MustNewID("metrics"): { Receivers: []component.ID{component.NewID(nopType)}, Processors: []component.ID{component.NewID(nopType)}, Exporters: []component.ID{component.NewID(nopType)}, }, - component.MustNewID("logs"): { + pipeline.MustNewID("logs"): { Receivers: []component.ID{component.NewID(nopType)}, Processors: []component.ID{component.NewID(nopType)}, Exporters: []component.ID{component.NewID(nopType)}, }, - component.MustNewID("profiles"): { + pipeline.MustNewID("profiles"): { Receivers: []component.ID{component.NewID(nopType)}, Processors: []component.ID{component.NewID(nopType)}, Exporters: []component.ID{component.NewID(nopType)}, @@ -687,10 +647,10 @@ func newNopConfig() Config { }) } -func newNopConfigPipelineConfigs(pipelineCfgs pipelines.Config) Config { +func newNopConfigPipelineConfigs(pipelineCfgs pipelines.ConfigWithPipelineID) Config { return Config{ - Extensions: extensions.Config{component.NewID(nopType)}, - Pipelines: pipelineCfgs, + Extensions: extensions.Config{component.NewID(nopType)}, + PipelinesWithPipelineID: pipelineCfgs, Telemetry: telemetry.Config{ Logs: telemetry.LogsConfig{ Level: zapcore.InfoLevel, @@ -709,8 +669,13 @@ func newNopConfigPipelineConfigs(pipelineCfgs pipelines.Config) Config { InitialFields: map[string]any(nil), }, Metrics: telemetry.MetricsConfig{ - Level: configtelemetry.LevelBasic, - Address: "localhost:8888", + Level: configtelemetry.LevelBasic, + Readers: []config.MetricReader{{ + Pull: &config.PullMetricReader{Exporter: config.MetricExporter{Prometheus: &config.Prometheus{ + Host: newPtr("localhost"), + Port: newPtr(8888), + }}}}, + }, }, }, } @@ -742,3 +707,7 @@ func newConfigWatcherExtensionFactory(name component.Type) extension.Factory { component.StabilityLevelDevelopment, ) } + +func newPtr[T int | string](str T) *T { + return &str +} diff --git a/service/telemetry/attributes_test.go b/service/telemetry/attributes_test.go index 6ace1a887af..c40a21f11f1 100644 --- a/service/telemetry/attributes_test.go +++ b/service/telemetry/attributes_test.go @@ -9,7 +9,6 @@ import ( "github.com/stretchr/testify/require" "go.opentelemetry.io/collector/component" - "go.opentelemetry.io/collector/service/telemetry/internal" ) func TestAttributes(t *testing.T) { @@ -50,7 +49,7 @@ func TestAttributes(t *testing.T) { } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - attrs := attributes(internal.Settings{BuildInfo: tt.buildInfo}, tt.cfg) + attrs := attributes(Settings{BuildInfo: tt.buildInfo}, tt.cfg) require.Equal(t, tt.wantAttributes, attrs) }) } diff --git a/service/telemetry/config.go b/service/telemetry/config.go index 197adf491aa..29cfb7afb1a 100644 --- a/service/telemetry/config.go +++ b/service/telemetry/config.go @@ -5,14 +5,27 @@ package telemetry // import "go.opentelemetry.io/collector/service/telemetry" import ( "fmt" + "net" + "strconv" "time" "go.opentelemetry.io/contrib/config" "go.uber.org/zap/zapcore" "go.opentelemetry.io/collector/config/configtelemetry" + "go.opentelemetry.io/collector/confmap" + "go.opentelemetry.io/collector/featuregate" ) +var _ confmap.Unmarshaler = (*Config)(nil) + +var disableAddressFieldForInternalTelemetryFeatureGate = featuregate.GlobalRegistry().MustRegister( + "telemetry.disableAddressFieldForInternalTelemetry", + featuregate.StageAlpha, + featuregate.WithRegisterFromVersion("v0.111.0"), + featuregate.WithRegisterToVersion("v0.114.0"), + featuregate.WithRegisterDescription("controls whether the deprecated address field for internal telemetry is still supported")) + // Config defines the configurable settings for service telemetry. type Config struct { Logs LogsConfig `mapstructure:"logs"` @@ -119,7 +132,7 @@ type MetricsConfig struct { // - "detailed" adds dimensions and views to the previous levels. Level configtelemetry.Level `mapstructure:"level"` - // Address is the [address]:port that metrics exposition should be bound to. + // Deprecated: [v0.111.0] use readers configuration. Address string `mapstructure:"address"` // Readers allow configuration of metric readers to emit metrics to @@ -143,11 +156,52 @@ type TracesConfig struct { Processors []config.SpanProcessor `mapstructure:"processors"` } +func (c *Config) Unmarshal(conf *confmap.Conf) error { + if err := conf.Unmarshal(c); err != nil { + return err + } + + // If the support for "metrics::address" is disabled, nothing to do. + // TODO: when this gate is marked stable remove the whole Unmarshal definition. + if disableAddressFieldForInternalTelemetryFeatureGate.IsEnabled() { + return nil + } + + if len(c.Metrics.Address) != 0 { + host, port, err := net.SplitHostPort(c.Metrics.Address) + if err != nil { + return fmt.Errorf("failing to parse metrics address %q: %w", c.Metrics.Address, err) + } + portInt, err := strconv.Atoi(port) + if err != nil { + return fmt.Errorf("failing to extract the port from the metrics address %q: %w", c.Metrics.Address, err) + } + + // User did not overwrite readers, so we will remove the default configured reader. + if !conf.IsSet("metrics::readers") { + c.Metrics.Readers = nil + } + + c.Metrics.Readers = append(c.Metrics.Readers, config.MetricReader{ + Pull: &config.PullMetricReader{ + Exporter: config.MetricExporter{ + Prometheus: &config.Prometheus{ + Host: &host, + Port: &portInt, + }, + }, + }, + }) + } + + return nil +} + // Validate checks whether the current configuration is valid func (c *Config) Validate() error { - // Check when service telemetry metric level is not none, the metrics address should not be empty - if c.Metrics.Level != configtelemetry.LevelNone && c.Metrics.Address == "" && len(c.Metrics.Readers) == 0 { - return fmt.Errorf("collector telemetry metric address or reader should exist when metric level is not none") + // Check when service telemetry metric level is not none, the metrics readers should not be empty + if c.Metrics.Level != configtelemetry.LevelNone && len(c.Metrics.Readers) == 0 { + return fmt.Errorf("collector telemetry metrics reader should exist when metric level is not none") } return nil diff --git a/service/telemetry/config_test.go b/service/telemetry/config_test.go index 5417347c772..9f8f9da1efd 100644 --- a/service/telemetry/config_test.go +++ b/service/telemetry/config_test.go @@ -4,15 +4,109 @@ package telemetry import ( + "path/filepath" "testing" "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" "go.opentelemetry.io/contrib/config" + "go.opentelemetry.io/collector/component/componenttest" "go.opentelemetry.io/collector/config/configtelemetry" + "go.opentelemetry.io/collector/confmap" + "go.opentelemetry.io/collector/confmap/confmaptest" + "go.opentelemetry.io/collector/featuregate" ) -func TestLoadConfig(t *testing.T) { +func TestComponentConfigStruct(t *testing.T) { + require.NoError(t, componenttest.CheckConfigStruct(NewFactory().CreateDefaultConfig())) +} + +func TestUnmarshalDefaultConfig(t *testing.T) { + factory := NewFactory() + cfg := factory.CreateDefaultConfig() + require.NoError(t, confmap.New().Unmarshal(&cfg)) + assert.Equal(t, factory.CreateDefaultConfig(), cfg) +} + +func TestUnmarshalEmptyMetricReaders(t *testing.T) { + prev := disableAddressFieldForInternalTelemetryFeatureGate.IsEnabled() + require.NoError(t, featuregate.GlobalRegistry().Set(disableAddressFieldForInternalTelemetryFeatureGate.ID(), false)) + defer func() { + // Restore previous value. + require.NoError(t, featuregate.GlobalRegistry().Set(disableAddressFieldForInternalTelemetryFeatureGate.ID(), prev)) + }() + cm, err := confmaptest.LoadConf(filepath.Join("testdata", "config_empty_readers.yaml")) + require.NoError(t, err) + cfg := NewFactory().CreateDefaultConfig() + require.NoError(t, cm.Unmarshal(&cfg)) + require.Empty(t, cfg.(*Config).Metrics.Readers) +} + +func TestUnmarshalConfigDeprecatedAddress(t *testing.T) { + prev := disableAddressFieldForInternalTelemetryFeatureGate.IsEnabled() + require.NoError(t, featuregate.GlobalRegistry().Set(disableAddressFieldForInternalTelemetryFeatureGate.ID(), false)) + defer func() { + // Restore previous value. + require.NoError(t, featuregate.GlobalRegistry().Set(disableAddressFieldForInternalTelemetryFeatureGate.ID(), prev)) + }() + cm, err := confmaptest.LoadConf(filepath.Join("testdata", "config_deprecated_address.yaml")) + require.NoError(t, err) + cfg := NewFactory().CreateDefaultConfig() + require.NoError(t, cm.Unmarshal(&cfg)) + require.Len(t, cfg.(*Config).Metrics.Readers, 1) + assert.Equal(t, "localhost", *cfg.(*Config).Metrics.Readers[0].Pull.Exporter.Prometheus.Host) + assert.Equal(t, 6666, *cfg.(*Config).Metrics.Readers[0].Pull.Exporter.Prometheus.Port) +} + +func TestUnmarshalConfigDeprecatedAddressGateEnabled(t *testing.T) { + prev := disableAddressFieldForInternalTelemetryFeatureGate.IsEnabled() + require.NoError(t, featuregate.GlobalRegistry().Set(disableAddressFieldForInternalTelemetryFeatureGate.ID(), true)) + defer func() { + // Restore previous value. + require.NoError(t, featuregate.GlobalRegistry().Set(disableAddressFieldForInternalTelemetryFeatureGate.ID(), prev)) + }() + cm, err := confmaptest.LoadConf(filepath.Join("testdata", "config_deprecated_address.yaml")) + require.NoError(t, err) + cfg := NewFactory().CreateDefaultConfig() + require.NoError(t, cm.Unmarshal(&cfg)) + require.Len(t, cfg.(*Config).Metrics.Readers, 1) + assert.Equal(t, "localhost", *cfg.(*Config).Metrics.Readers[0].Pull.Exporter.Prometheus.Host) + assert.Equal(t, 8888, *cfg.(*Config).Metrics.Readers[0].Pull.Exporter.Prometheus.Port) +} + +func TestUnmarshalConfigInvalidDeprecatedAddress(t *testing.T) { + prev := disableAddressFieldForInternalTelemetryFeatureGate.IsEnabled() + require.NoError(t, featuregate.GlobalRegistry().Set(disableAddressFieldForInternalTelemetryFeatureGate.ID(), false)) + defer func() { + // Restore previous value. + require.NoError(t, featuregate.GlobalRegistry().Set(disableAddressFieldForInternalTelemetryFeatureGate.ID(), prev)) + }() + cm, err := confmaptest.LoadConf(filepath.Join("testdata", "config_invalid_deprecated_address.yaml")) + require.NoError(t, err) + cfg := NewFactory().CreateDefaultConfig() + require.Error(t, cm.Unmarshal(&cfg)) +} + +func TestUnmarshalConfigDeprecatedAddressAndReaders(t *testing.T) { + prev := disableAddressFieldForInternalTelemetryFeatureGate.IsEnabled() + require.NoError(t, featuregate.GlobalRegistry().Set(disableAddressFieldForInternalTelemetryFeatureGate.ID(), false)) + defer func() { + // Restore previous value. + require.NoError(t, featuregate.GlobalRegistry().Set(disableAddressFieldForInternalTelemetryFeatureGate.ID(), prev)) + }() + cm, err := confmaptest.LoadConf(filepath.Join("testdata", "config_deprecated_address_and_readers.yaml")) + require.NoError(t, err) + cfg := NewFactory().CreateDefaultConfig() + require.NoError(t, cm.Unmarshal(&cfg)) + require.Len(t, cfg.(*Config).Metrics.Readers, 2) + assert.Equal(t, "localhost", *cfg.(*Config).Metrics.Readers[0].Pull.Exporter.Prometheus.Host) + assert.Equal(t, 9999, *cfg.(*Config).Metrics.Readers[0].Pull.Exporter.Prometheus.Port) + assert.Equal(t, "192.168.0.1", *cfg.(*Config).Metrics.Readers[1].Pull.Exporter.Prometheus.Host) + assert.Equal(t, 6666, *cfg.(*Config).Metrics.Readers[1].Pull.Exporter.Prometheus.Port) +} + +func TestConfigValidate(t *testing.T) { tests := []struct { name string cfg *Config @@ -22,8 +116,13 @@ func TestLoadConfig(t *testing.T) { name: "basic metric telemetry", cfg: &Config{ Metrics: MetricsConfig{ - Level: configtelemetry.LevelBasic, - Address: "127.0.0.1:3333", + Level: configtelemetry.LevelBasic, + Readers: []config.MetricReader{{ + Pull: &config.PullMetricReader{Exporter: config.MetricExporter{Prometheus: &config.Prometheus{ + Host: newPtr("127.0.0.1"), + Port: newPtr(3333), + }}}}, + }, }, }, success: true, @@ -33,32 +132,20 @@ func TestLoadConfig(t *testing.T) { cfg: &Config{ Metrics: MetricsConfig{ Level: configtelemetry.LevelBasic, - Address: "", + Readers: nil, }, }, success: false, }, - { - name: "valid metric telemetry with metric readers", - cfg: &Config{ - Metrics: MetricsConfig{ - Level: configtelemetry.LevelBasic, - Readers: []config.MetricReader{ - {Pull: &config.PullMetricReader{}}, - }, - }, - }, - success: true, - }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { err := tt.cfg.Validate() if tt.success { - assert.NoError(t, err) + require.NoError(t, err) } else { - assert.Error(t, err) + require.Error(t, err) } }) } diff --git a/service/telemetry/factory.go b/service/telemetry/factory.go index 826c9cc8f74..9f25402adbe 100644 --- a/service/telemetry/factory.go +++ b/service/telemetry/factory.go @@ -7,6 +7,7 @@ import ( "context" "time" + "go.opentelemetry.io/contrib/config" "go.opentelemetry.io/otel/metric" "go.opentelemetry.io/otel/trace" "go.uber.org/zap" @@ -16,18 +17,83 @@ import ( "go.opentelemetry.io/collector/config/configtelemetry" "go.opentelemetry.io/collector/featuregate" "go.opentelemetry.io/collector/service/internal/resource" - "go.opentelemetry.io/collector/service/telemetry/internal" ) -// disableHighCardinalityMetricsfeatureGate is the feature gate that controls whether the collector should enable +var useLocalHostAsDefaultMetricsAddressFeatureGate = featuregate.GlobalRegistry().MustRegister( + "telemetry.UseLocalHostAsDefaultMetricsAddress", + featuregate.StageBeta, + featuregate.WithRegisterFromVersion("v0.111.0"), + featuregate.WithRegisterDescription("controls whether default Prometheus metrics server use localhost as the default host for their endpoints"), +) + +// disableHighCardinalityMetricsFeatureGate is the feature gate that controls whether the collector should enable // potentially high cardinality metrics. The gate will be removed when the collector allows for view configuration. -var disableHighCardinalityMetricsfeatureGate = featuregate.GlobalRegistry().MustRegister( +var disableHighCardinalityMetricsFeatureGate = featuregate.GlobalRegistry().MustRegister( "telemetry.disableHighCardinalityMetrics", featuregate.StageAlpha, featuregate.WithRegisterDescription("controls whether the collector should enable potentially high"+ "cardinality metrics. The gate will be removed when the collector allows for view configuration.")) +// Settings holds configuration for building Telemetry. +type Settings struct { + BuildInfo component.BuildInfo + AsyncErrorChannel chan error + ZapOptions []zap.Option +} + +// Factory is factory interface for telemetry. +// This interface cannot be directly implemented. Implementations must +// use the NewFactory to implement it. +type Factory interface { + // CreateDefaultConfig creates the default configuration for the telemetry. + // TODO: Should we just inherit from component.Factory? + CreateDefaultConfig() component.Config + + // CreateLogger creates a logger. + CreateLogger(ctx context.Context, set Settings, cfg component.Config) (*zap.Logger, error) + + // CreateTracerProvider creates a TracerProvider. + CreateTracerProvider(ctx context.Context, set Settings, cfg component.Config) (trace.TracerProvider, error) + + // CreateMeterProvider creates a MeterProvider. + CreateMeterProvider(ctx context.Context, set Settings, cfg component.Config) (metric.MeterProvider, error) + + // unexportedFactoryFunc is used to prevent external implementations of Factory. + unexportedFactoryFunc() +} + +// NewFactory creates a new Factory. +func NewFactory() Factory { + return newFactory(createDefaultConfig, + withLogger(func(_ context.Context, set Settings, cfg component.Config) (*zap.Logger, error) { + c := *cfg.(*Config) + return newLogger(c.Logs, set.ZapOptions) + }), + withTracerProvider(func(ctx context.Context, set Settings, cfg component.Config) (trace.TracerProvider, error) { + c := *cfg.(*Config) + return newTracerProvider(ctx, set, c) + }), + withMeterProvider(func(_ context.Context, set Settings, cfg component.Config) (metric.MeterProvider, error) { + c := *cfg.(*Config) + disableHighCard := disableHighCardinalityMetricsFeatureGate.IsEnabled() + return newMeterProvider( + meterProviderSettings{ + res: resource.New(set.BuildInfo, c.Resource), + cfg: c.Metrics, + asyncErrorChannel: set.AsyncErrorChannel, + }, + disableHighCard, + ) + }), + ) +} + func createDefaultConfig() component.Config { + metricsHost := "localhost" + if !useLocalHostAsDefaultMetricsAddressFeatureGate.IsEnabled() { + metricsHost = "" + } + return &Config{ Logs: LogsConfig{ Level: zapcore.InfoLevel, @@ -46,37 +112,17 @@ func createDefaultConfig() component.Config { InitialFields: map[string]any(nil), }, Metrics: MetricsConfig{ - Level: configtelemetry.LevelNormal, - Address: ":8888", + Level: configtelemetry.LevelNormal, + Readers: []config.MetricReader{{ + Pull: &config.PullMetricReader{Exporter: config.MetricExporter{Prometheus: &config.Prometheus{ + Host: &metricsHost, + Port: newPtr(8888), + }}}}, + }, }, } } -// Factory is a telemetry factory. -type Factory = internal.Factory - -// NewFactory creates a new Factory. -func NewFactory() Factory { - return internal.NewFactory(createDefaultConfig, - internal.WithLogger(func(_ context.Context, set Settings, cfg component.Config) (*zap.Logger, error) { - c := *cfg.(*Config) - return newLogger(c.Logs, set.ZapOptions) - }), - internal.WithTracerProvider(func(ctx context.Context, set Settings, cfg component.Config) (trace.TracerProvider, error) { - c := *cfg.(*Config) - return newTracerProvider(ctx, set, c) - }), - internal.WithMeterProvider(func(_ context.Context, set Settings, cfg component.Config) (metric.MeterProvider, error) { - c := *cfg.(*Config) - disableHighCard := disableHighCardinalityMetricsfeatureGate.IsEnabled() - return newMeterProvider( - meterProviderSettings{ - res: resource.New(set.BuildInfo, c.Resource), - cfg: c.Metrics, - asyncErrorChannel: set.AsyncErrorChannel, - }, - disableHighCard, - ) - }), - ) +func newPtr[T int | string](str T) *T { + return &str } diff --git a/service/telemetry/factory_impl.go b/service/telemetry/factory_impl.go new file mode 100644 index 00000000000..439012723a0 --- /dev/null +++ b/service/telemetry/factory_impl.go @@ -0,0 +1,109 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package telemetry // import "go.opentelemetry.io/collector/service/telemetry" + +import ( + "context" + + "go.opentelemetry.io/otel/metric" + metricnoop "go.opentelemetry.io/otel/metric/noop" + "go.opentelemetry.io/otel/trace" + tracenoop "go.opentelemetry.io/otel/trace/noop" + "go.uber.org/zap" + + "go.opentelemetry.io/collector/component" +) + +// factoryOption apply changes to Factory. +type factoryOption interface { + // applyTelemetryFactoryOption applies the option. + applyTelemetryFactoryOption(o *factory) +} + +var _ factoryOption = (*factoryOptionFunc)(nil) + +// factoryOptionFunc is an factoryOption created through a function. +type factoryOptionFunc func(*factory) + +func (f factoryOptionFunc) applyTelemetryFactoryOption(o *factory) { + f(o) +} + +var _ Factory = (*factory)(nil) + +// Factory is the implementation of Factory. +type factory struct { + createDefaultConfig component.CreateDefaultConfigFunc + createLoggerFunc + createTracerProviderFunc + createMeterProviderFunc +} + +func (f *factory) CreateDefaultConfig() component.Config { + return f.createDefaultConfig() +} + +// createLoggerFunc is the equivalent of Factory.CreateLogger. +type createLoggerFunc func(context.Context, Settings, component.Config) (*zap.Logger, error) + +// withLogger overrides the default no-op logger. +func withLogger(createLogger createLoggerFunc) factoryOption { + return factoryOptionFunc(func(o *factory) { + o.createLoggerFunc = createLogger + }) +} + +func (f *factory) CreateLogger(ctx context.Context, set Settings, cfg component.Config) (*zap.Logger, error) { + if f.createLoggerFunc == nil { + return zap.NewNop(), nil + } + return f.createLoggerFunc(ctx, set, cfg) +} + +// createTracerProviderFunc is the equivalent of Factory.CreateTracerProvider. +type createTracerProviderFunc func(context.Context, Settings, component.Config) (trace.TracerProvider, error) + +// withTracerProvider overrides the default no-op tracer provider. +func withTracerProvider(createTracerProvider createTracerProviderFunc) factoryOption { + return factoryOptionFunc(func(o *factory) { + o.createTracerProviderFunc = createTracerProvider + }) +} + +func (f *factory) CreateTracerProvider(ctx context.Context, set Settings, cfg component.Config) (trace.TracerProvider, error) { + if f.createTracerProviderFunc == nil { + return tracenoop.NewTracerProvider(), nil + } + return f.createTracerProviderFunc(ctx, set, cfg) +} + +// createMeterProviderFunc is the equivalent of Factory.CreateMeterProvider. +type createMeterProviderFunc func(context.Context, Settings, component.Config) (metric.MeterProvider, error) + +// withMeterProvider overrides the default no-op meter provider. +func withMeterProvider(createMeterProvider createMeterProviderFunc) factoryOption { + return factoryOptionFunc(func(o *factory) { + o.createMeterProviderFunc = createMeterProvider + }) +} + +func (f *factory) CreateMeterProvider(ctx context.Context, set Settings, cfg component.Config) (metric.MeterProvider, error) { + if f.createMeterProviderFunc == nil { + return metricnoop.NewMeterProvider(), nil + } + return f.createMeterProviderFunc(ctx, set, cfg) +} + +func (f *factory) unexportedFactoryFunc() {} + +// newFactory returns a new Factory. +func newFactory(createDefaultConfig component.CreateDefaultConfigFunc, options ...factoryOption) Factory { + f := &factory{ + createDefaultConfig: createDefaultConfig, + } + for _, op := range options { + op.applyTelemetryFactoryOption(f) + } + return f +} diff --git a/service/telemetry/telemetry_test.go b/service/telemetry/factory_test.go similarity index 57% rename from service/telemetry/telemetry_test.go rename to service/telemetry/factory_test.go index f777f8dbbdc..86ba38cd460 100644 --- a/service/telemetry/telemetry_test.go +++ b/service/telemetry/factory_test.go @@ -5,17 +5,51 @@ package telemetry import ( "context" + "strconv" "testing" "time" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + "go.opentelemetry.io/contrib/config" "go.uber.org/zap" "go.uber.org/zap/zapcore" "go.opentelemetry.io/collector/config/configtelemetry" + "go.opentelemetry.io/collector/featuregate" ) +func TestDefaultConfig(t *testing.T) { + tests := []struct { + expected string + gate bool + }{ + { + expected: "localhost", + gate: true, + }, + { + expected: "", + gate: false, + }, + } + + for _, tt := range tests { + t.Run("UseLocalHostAsDefaultMetricsAddress/"+strconv.FormatBool(tt.gate), func(t *testing.T) { + prev := useLocalHostAsDefaultMetricsAddressFeatureGate.IsEnabled() + require.NoError(t, featuregate.GlobalRegistry().Set(useLocalHostAsDefaultMetricsAddressFeatureGate.ID(), tt.gate)) + defer func() { + // Restore previous value. + require.NoError(t, featuregate.GlobalRegistry().Set(useLocalHostAsDefaultMetricsAddressFeatureGate.ID(), prev)) + }() + cfg := NewFactory().CreateDefaultConfig() + require.Len(t, cfg.(*Config).Metrics.Readers, 1) + assert.Equal(t, tt.expected, *cfg.(*Config).Metrics.Readers[0].Pull.Exporter.Prometheus.Host) + assert.Equal(t, 8888, *cfg.(*Config).Metrics.Readers[0].Pull.Exporter.Prometheus.Port) + }) + } +} + func TestTelemetryConfiguration(t *testing.T) { tests := []struct { name string @@ -30,8 +64,13 @@ func TestTelemetryConfiguration(t *testing.T) { Encoding: "console", }, Metrics: MetricsConfig{ - Level: configtelemetry.LevelBasic, - Address: "127.0.0.1:3333", + Level: configtelemetry.LevelBasic, + Readers: []config.MetricReader{{ + Pull: &config.PullMetricReader{Exporter: config.MetricExporter{Prometheus: &config.Prometheus{ + Host: newPtr("127.0.0.1"), + Port: newPtr(3333), + }}}}, + }, }, }, success: true, @@ -43,8 +82,13 @@ func TestTelemetryConfiguration(t *testing.T) { Level: zapcore.DebugLevel, }, Metrics: MetricsConfig{ - Level: configtelemetry.LevelBasic, - Address: "127.0.0.1:3333", + Level: configtelemetry.LevelBasic, + Readers: []config.MetricReader{{ + Pull: &config.PullMetricReader{Exporter: config.MetricExporter{Prometheus: &config.Prometheus{ + Host: newPtr("127.0.0.1"), + Port: newPtr(3333), + }}}}, + }, }, }, success: false, diff --git a/service/telemetry/internal/factory.go b/service/telemetry/internal/factory.go deleted file mode 100644 index 5e8149d7401..00000000000 --- a/service/telemetry/internal/factory.go +++ /dev/null @@ -1,137 +0,0 @@ -// Copyright The OpenTelemetry Authors -// SPDX-License-Identifier: Apache-2.0 - -package internal // import "go.opentelemetry.io/collector/service/telemetry/internal" - -import ( - "context" - - "go.opentelemetry.io/otel/metric" - metricnoop "go.opentelemetry.io/otel/metric/noop" - "go.opentelemetry.io/otel/trace" - tracenoop "go.opentelemetry.io/otel/trace/noop" - "go.uber.org/zap" - - "go.opentelemetry.io/collector/component" -) - -// Settings holds configuration for building Telemetry. -type Settings struct { - BuildInfo component.BuildInfo - AsyncErrorChannel chan error - ZapOptions []zap.Option -} - -// Factory is factory interface for telemetry. -// This interface cannot be directly implemented. Implementations must -// use the NewFactory to implement it. -type Factory interface { - // CreateDefaultConfig creates the default configuration for the telemetry. - // TODO: Should we just inherit from component.Factory? - CreateDefaultConfig() component.Config - - // CreateLogger creates a logger. - CreateLogger(ctx context.Context, set Settings, cfg component.Config) (*zap.Logger, error) - - // CreateTracerProvider creates a TracerProvider. - CreateTracerProvider(ctx context.Context, set Settings, cfg component.Config) (trace.TracerProvider, error) - - // CreateMeterProvider creates a MeterProvider. - CreateMeterProvider(ctx context.Context, set Settings, cfg component.Config) (metric.MeterProvider, error) - - // unexportedFactoryFunc is used to prevent external implementations of Factory. - unexportedFactoryFunc() -} - -// FactoryOption apply changes to Factory. -type FactoryOption interface { - // applyTelemetryFactoryOption applies the option. - applyTelemetryFactoryOption(o *factory) -} - -var _ FactoryOption = (*factoryOptionFunc)(nil) - -// factoryOptionFunc is an FactoryOption created through a function. -type factoryOptionFunc func(*factory) - -func (f factoryOptionFunc) applyTelemetryFactoryOption(o *factory) { - f(o) -} - -var _ Factory = (*factory)(nil) - -// factory is the implementation of Factory. -type factory struct { - createDefaultConfig component.CreateDefaultConfigFunc - CreateLoggerFunc - CreateTracerProviderFunc - CreateMeterProviderFunc -} - -func (f *factory) CreateDefaultConfig() component.Config { - return f.createDefaultConfig() -} - -// CreateLoggerFunc is the equivalent of Factory.CreateLogger. -type CreateLoggerFunc func(context.Context, Settings, component.Config) (*zap.Logger, error) - -// WithLogger overrides the default no-op logger. -func WithLogger(createLogger CreateLoggerFunc) FactoryOption { - return factoryOptionFunc(func(o *factory) { - o.CreateLoggerFunc = createLogger - }) -} - -func (f *factory) CreateLogger(ctx context.Context, set Settings, cfg component.Config) (*zap.Logger, error) { - if f.CreateLoggerFunc == nil { - return zap.NewNop(), nil - } - return f.CreateLoggerFunc(ctx, set, cfg) -} - -// CreateTracerProviderFunc is the equivalent of Factory.CreateTracerProvider. -type CreateTracerProviderFunc func(context.Context, Settings, component.Config) (trace.TracerProvider, error) - -// WithTracerProvider overrides the default no-op tracer provider. -func WithTracerProvider(createTracerProvider CreateTracerProviderFunc) FactoryOption { - return factoryOptionFunc(func(o *factory) { - o.CreateTracerProviderFunc = createTracerProvider - }) -} - -func (f *factory) CreateTracerProvider(ctx context.Context, set Settings, cfg component.Config) (trace.TracerProvider, error) { - if f.CreateTracerProviderFunc == nil { - return tracenoop.NewTracerProvider(), nil - } - return f.CreateTracerProviderFunc(ctx, set, cfg) -} - -// CreateMeterProviderFunc is the equivalent of Factory.CreateMeterProvider. -type CreateMeterProviderFunc func(context.Context, Settings, component.Config) (metric.MeterProvider, error) - -// WithMeterProvider overrides the default no-op meter provider. -func WithMeterProvider(createMeterProvider CreateMeterProviderFunc) FactoryOption { - return factoryOptionFunc(func(o *factory) { - o.CreateMeterProviderFunc = createMeterProvider - }) -} - -func (f *factory) CreateMeterProvider(ctx context.Context, set Settings, cfg component.Config) (metric.MeterProvider, error) { - if f.CreateMeterProviderFunc == nil { - return metricnoop.NewMeterProvider(), nil - } - return f.CreateMeterProviderFunc(ctx, set, cfg) -} - -func (f *factory) unexportedFactoryFunc() {} - -// NewFactory returns a new Factory. -func NewFactory(createDefaultConfig component.CreateDefaultConfigFunc, options ...FactoryOption) Factory { - f := &factory{ - createDefaultConfig: createDefaultConfig, - } - for _, op := range options { - op.applyTelemetryFactoryOption(f) - } - return f -} diff --git a/service/telemetry/metrics.go b/service/telemetry/metrics.go index 76b0a758b5a..a3be9169c7c 100644 --- a/service/telemetry/metrics.go +++ b/service/telemetry/metrics.go @@ -5,12 +5,9 @@ package telemetry // import "go.opentelemetry.io/collector/service/telemetry" import ( "context" - "net" "net/http" - "strconv" "sync" - "go.opentelemetry.io/contrib/config" "go.opentelemetry.io/otel/metric" "go.opentelemetry.io/otel/metric/noop" sdkmetric "go.opentelemetry.io/otel/sdk/metric" @@ -40,34 +37,10 @@ type meterProviderSettings struct { } func newMeterProvider(set meterProviderSettings, disableHighCardinality bool) (metric.MeterProvider, error) { - if set.cfg.Level == configtelemetry.LevelNone || (set.cfg.Address == "" && len(set.cfg.Readers) == 0) { + if set.cfg.Level == configtelemetry.LevelNone || len(set.cfg.Readers) == 0 { return noop.NewMeterProvider(), nil } - if len(set.cfg.Address) != 0 { - host, port, err := net.SplitHostPort(set.cfg.Address) - if err != nil { - return nil, err - } - portInt, err := strconv.Atoi(port) - if err != nil { - return nil, err - } - if set.cfg.Readers == nil { - set.cfg.Readers = []config.MetricReader{} - } - set.cfg.Readers = append(set.cfg.Readers, config.MetricReader{ - Pull: &config.PullMetricReader{ - Exporter: config.MetricExporter{ - Prometheus: &config.Prometheus{ - Host: &host, - Port: &portInt, - }, - }, - }, - }) - } - mp := &meterProvider{} var opts []sdkmetric.Option for _, reader := range set.cfg.Readers { diff --git a/service/telemetry/metrics_test.go b/service/telemetry/metrics_test.go index f3bb140b1f3..3446ad219d6 100644 --- a/service/telemetry/metrics_test.go +++ b/service/telemetry/metrics_test.go @@ -17,7 +17,6 @@ import ( "go.opentelemetry.io/collector/component" "go.opentelemetry.io/collector/config/configtelemetry" - "go.opentelemetry.io/collector/internal/testutil" semconv "go.opentelemetry.io/collector/semconv/v1.18.0" "go.opentelemetry.io/collector/service/internal/promtest" "go.opentelemetry.io/collector/service/internal/resource" @@ -208,8 +207,10 @@ func TestTelemetryInit(t *testing.T) { semconv.AttributeServiceInstanceID: &testInstanceID, }, Metrics: MetricsConfig{ - Level: configtelemetry.LevelDetailed, - Address: testutil.GetAvailableLocalAddress(t), + Level: configtelemetry.LevelDetailed, + Readers: []config.MetricReader{{ + Pull: &config.PullMetricReader{Exporter: config.MetricExporter{Prometheus: promtest.GetAvailableLocalAddressPrometheus(t)}}, + }}, }, } } @@ -276,5 +277,4 @@ func getMetricsFromPrometheus(t *testing.T, handler http.Handler) map[string]*io require.NoError(t, err) return parsed - } diff --git a/service/telemetry/telemetry.go b/service/telemetry/telemetry.go deleted file mode 100644 index 8ca29332924..00000000000 --- a/service/telemetry/telemetry.go +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright The OpenTelemetry Authors -// SPDX-License-Identifier: Apache-2.0 - -package telemetry // import "go.opentelemetry.io/collector/service/telemetry" - -import ( - "go.opentelemetry.io/collector/service/telemetry/internal" -) - -// Settings holds configuration for building Telemetry. -type Settings = internal.Settings diff --git a/service/telemetry/testdata/config_deprecated_address.yaml b/service/telemetry/testdata/config_deprecated_address.yaml new file mode 100644 index 00000000000..abb68a70ad2 --- /dev/null +++ b/service/telemetry/testdata/config_deprecated_address.yaml @@ -0,0 +1,5 @@ +logs: + level: "info" +metrics: + level: "basic" + address: "localhost:6666" diff --git a/service/telemetry/testdata/config_deprecated_address_and_readers.yaml b/service/telemetry/testdata/config_deprecated_address_and_readers.yaml new file mode 100644 index 00000000000..987b9f5a7d6 --- /dev/null +++ b/service/telemetry/testdata/config_deprecated_address_and_readers.yaml @@ -0,0 +1,11 @@ +logs: + level: "info" +metrics: + level: "basic" + address: "192.168.0.1:6666" + readers: + - pull: + exporter: + prometheus: + host: "localhost" + port: 9999 diff --git a/service/telemetry/testdata/config_empty_readers.yaml b/service/telemetry/testdata/config_empty_readers.yaml new file mode 100644 index 00000000000..9c2fb6bd7b9 --- /dev/null +++ b/service/telemetry/testdata/config_empty_readers.yaml @@ -0,0 +1,5 @@ +logs: + level: "info" +metrics: + level: "basic" + readers: [] diff --git a/service/telemetry/testdata/config_invalid_deprecated_address.yaml b/service/telemetry/testdata/config_invalid_deprecated_address.yaml new file mode 100644 index 00000000000..fd81b91ad19 --- /dev/null +++ b/service/telemetry/testdata/config_invalid_deprecated_address.yaml @@ -0,0 +1,5 @@ +logs: + level: "info" +metrics: + level: "basic" + address: "1212:212121:2121" diff --git a/service/telemetry/tracer_test.go b/service/telemetry/tracer_test.go index 6c365351549..f2ed37c1b50 100644 --- a/service/telemetry/tracer_test.go +++ b/service/telemetry/tracer_test.go @@ -13,7 +13,6 @@ import ( "go.opentelemetry.io/collector/config/configtelemetry" "go.opentelemetry.io/collector/featuregate" "go.opentelemetry.io/collector/internal/globalgates" - "go.opentelemetry.io/collector/service/telemetry/internal" ) func TestNewTracerProvider(t *testing.T) { @@ -51,7 +50,7 @@ func TestNewTracerProvider(t *testing.T) { defer func() { require.NoError(t, featuregate.GlobalRegistry().Set(globalgates.NoopTracerProvider.ID(), previousValue)) }() - provider, err := newTracerProvider(context.TODO(), internal.Settings{}, tt.cfg) + provider, err := newTracerProvider(context.TODO(), Settings{}, tt.cfg) require.NoError(t, err) require.IsType(t, tt.wantTracerProvider, provider) }) diff --git a/versions.yaml b/versions.yaml index 4f0b4a31e69..bb9e7900eda 100644 --- a/versions.yaml +++ b/versions.yaml @@ -3,7 +3,7 @@ module-sets: stable: - version: v1.15.0 + version: v1.16.0 modules: - go.opentelemetry.io/collector/client - go.opentelemetry.io/collector/featuregate @@ -17,7 +17,7 @@ module-sets: - go.opentelemetry.io/collector/config/configtls - go.opentelemetry.io/collector/config/confignet beta: - version: v0.109.0 + version: v0.110.0 modules: - go.opentelemetry.io/collector - go.opentelemetry.io/collector/internal/globalgates