From 7a686be9de051b10f7c29f35bb1ade2b694b900a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C4=90=E1=BB=97=20Tr=E1=BB=8Dng=20H=E1=BA=A3i?= <41283691+hainenber@users.noreply.github.com> Date: Tue, 20 Feb 2024 19:57:48 +0700 Subject: [PATCH] feat!(comp/exporter/self): rename component to clear up ambiguity (#6365) Signed-off-by: hainenber Co-authored-by: Clayton Cornell <131809008+clayton-cornell@users.noreply.github.com> Co-authored-by: Robert Fratto --- CHANGELOG.md | 2 ++ component/all/all.go | 2 +- .../exporter/{agent/agent.go => self/self.go} | 8 ++--- .../{agent_exporter.go => self_exporter.go} | 14 ++++----- .../testdata-v2/integrations_v2.river | 4 +-- .../staticconvert/testdata/integrations.river | 4 +-- .../staticconvert/testdata/sanitize.river | 4 +-- .../flow/reference/compatibility/_index.md | 2 +- ...r.agent.md => prometheus.exporter.self.md} | 29 ++++++++++--------- docs/sources/flow/release-notes.md | 5 ++++ 10 files changed, 41 insertions(+), 33 deletions(-) rename component/prometheus/exporter/{agent/agent.go => self/self.go} (91%) rename converter/internal/staticconvert/internal/build/{agent_exporter.go => self_exporter.go} (61%) rename docs/sources/flow/reference/components/{prometheus.exporter.agent.md => prometheus.exporter.self.md} (69%) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4d2969ee94d9..d63fa3ef1ee7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,8 @@ Main (unreleased) - For `otelcol.exporter` components, change the default value of `disable_high_cardinality_metrics` to `true`. (@ptodev) +- Rename component `prometheus.exporter.agent` to `prometheus.exporter.self` to clear up ambiguity. (@hainenber) + ### Features - A new `discovery.process` component for discovering Linux OS processes on the current host. (@korniltsev) diff --git a/component/all/all.go b/component/all/all.go index 0bf3da725bbf..2ef486e1b0ea 100644 --- a/component/all/all.go +++ b/component/all/all.go @@ -94,7 +94,6 @@ import ( _ "github.com/grafana/agent/component/otelcol/receiver/prometheus" // Import otelcol.receiver.prometheus _ "github.com/grafana/agent/component/otelcol/receiver/vcenter" // Import otelcol.receiver.vcenter _ "github.com/grafana/agent/component/otelcol/receiver/zipkin" // Import otelcol.receiver.zipkin - _ "github.com/grafana/agent/component/prometheus/exporter/agent" // Import prometheus.exporter.agent _ "github.com/grafana/agent/component/prometheus/exporter/apache" // Import prometheus.exporter.apache _ "github.com/grafana/agent/component/prometheus/exporter/azure" // Import prometheus.exporter.azure _ "github.com/grafana/agent/component/prometheus/exporter/blackbox" // Import prometheus.exporter.blackbox @@ -114,6 +113,7 @@ import ( _ "github.com/grafana/agent/component/prometheus/exporter/postgres" // Import prometheus.exporter.postgres _ "github.com/grafana/agent/component/prometheus/exporter/process" // Import prometheus.exporter.process _ "github.com/grafana/agent/component/prometheus/exporter/redis" // Import prometheus.exporter.redis + _ "github.com/grafana/agent/component/prometheus/exporter/self" // Import prometheus.exporter.self _ "github.com/grafana/agent/component/prometheus/exporter/snmp" // Import prometheus.exporter.snmp _ "github.com/grafana/agent/component/prometheus/exporter/snowflake" // Import prometheus.exporter.snowflake _ "github.com/grafana/agent/component/prometheus/exporter/squid" // Import prometheus.exporter.squid diff --git a/component/prometheus/exporter/agent/agent.go b/component/prometheus/exporter/self/self.go similarity index 91% rename from component/prometheus/exporter/agent/agent.go rename to component/prometheus/exporter/self/self.go index 5a02005c92b1..a67073b1c61f 100644 --- a/component/prometheus/exporter/agent/agent.go +++ b/component/prometheus/exporter/self/self.go @@ -1,4 +1,4 @@ -package agent +package self import ( "github.com/grafana/agent/component" @@ -9,7 +9,7 @@ import ( func init() { component.Register(component.Registration{ - Name: "prometheus.exporter.agent", + Name: "prometheus.exporter.self", Args: Arguments{}, Exports: exporter.Exports{}, @@ -22,10 +22,10 @@ func createExporter(opts component.Options, args component.Arguments, defaultIns return integrations.NewIntegrationWithInstanceKey(opts.Logger, a.Convert(), defaultInstanceKey) } -// Arguments holds values which are used to configured the prometheus.exporter.agent component. +// Arguments holds values which are used to configured the prometheus.exporter.self component. type Arguments struct{} -// Exports holds the values exported by the prometheus.exporter.agent component. +// Exports holds the values exported by the prometheus.exporter.self component. type Exports struct{} // DefaultArguments defines the default settings diff --git a/converter/internal/staticconvert/internal/build/agent_exporter.go b/converter/internal/staticconvert/internal/build/self_exporter.go similarity index 61% rename from converter/internal/staticconvert/internal/build/agent_exporter.go rename to converter/internal/staticconvert/internal/build/self_exporter.go index 4d9a56cc3abd..ee6f3cc9355d 100644 --- a/converter/internal/staticconvert/internal/build/agent_exporter.go +++ b/converter/internal/staticconvert/internal/build/self_exporter.go @@ -2,25 +2,25 @@ package build import ( "github.com/grafana/agent/component/discovery" - "github.com/grafana/agent/component/prometheus/exporter/agent" + "github.com/grafana/agent/component/prometheus/exporter/self" agent_exporter "github.com/grafana/agent/pkg/integrations/agent" agent_exporter_v2 "github.com/grafana/agent/pkg/integrations/v2/agent" ) func (b *IntegrationsConfigBuilder) appendAgentExporter(config *agent_exporter.Config) discovery.Exports { args := toAgentExporter(config) - return b.appendExporterBlock(args, config.Name(), nil, "agent") + return b.appendExporterBlock(args, config.Name(), nil, "self") } -func toAgentExporter(config *agent_exporter.Config) *agent.Arguments { - return &agent.Arguments{} +func toAgentExporter(config *agent_exporter.Config) *self.Arguments { + return &self.Arguments{} } func (b *IntegrationsConfigBuilder) appendAgentExporterV2(config *agent_exporter_v2.Config) discovery.Exports { args := toAgentExporterV2(config) - return b.appendExporterBlock(args, config.Name(), config.Common.InstanceKey, "agent") + return b.appendExporterBlock(args, config.Name(), config.Common.InstanceKey, "self") } -func toAgentExporterV2(config *agent_exporter_v2.Config) *agent.Arguments { - return &agent.Arguments{} +func toAgentExporterV2(config *agent_exporter_v2.Config) *self.Arguments { + return &self.Arguments{} } diff --git a/converter/internal/staticconvert/testdata-v2/integrations_v2.river b/converter/internal/staticconvert/testdata-v2/integrations_v2.river index 919af1b47286..c609330be6c7 100644 --- a/converter/internal/staticconvert/testdata-v2/integrations_v2.river +++ b/converter/internal/staticconvert/testdata-v2/integrations_v2.river @@ -593,10 +593,10 @@ prometheus.scrape "integrations_statsd" { job_name = "integrations/statsd" } -prometheus.exporter.agent "integrations_agent" { } +prometheus.exporter.self "integrations_agent" { } discovery.relabel "integrations_agent" { - targets = prometheus.exporter.agent.integrations_agent.targets + targets = prometheus.exporter.self.integrations_agent.targets rule { source_labels = ["__address__"] diff --git a/converter/internal/staticconvert/testdata/integrations.river b/converter/internal/staticconvert/testdata/integrations.river index 07875ba5fcea..201f5e99e1c2 100644 --- a/converter/internal/staticconvert/testdata/integrations.river +++ b/converter/internal/staticconvert/testdata/integrations.river @@ -1,7 +1,7 @@ -prometheus.exporter.agent "integrations_agent" { } +prometheus.exporter.self "integrations_agent" { } discovery.relabel "integrations_agent" { - targets = prometheus.exporter.agent.integrations_agent.targets + targets = prometheus.exporter.self.integrations_agent.targets rule { target_label = "job" diff --git a/converter/internal/staticconvert/testdata/sanitize.river b/converter/internal/staticconvert/testdata/sanitize.river index eaacf45291b6..7b2bf9ef8ffb 100644 --- a/converter/internal/staticconvert/testdata/sanitize.river +++ b/converter/internal/staticconvert/testdata/sanitize.river @@ -100,10 +100,10 @@ loki.write "logs_integrations" { external_labels = {} } -prometheus.exporter.agent "integrations_agent" { } +prometheus.exporter.self "integrations_agent" { } discovery.relabel "integrations_agent" { - targets = prometheus.exporter.agent.integrations_agent.targets + targets = prometheus.exporter.self.integrations_agent.targets rule { source_labels = ["agent_hostname"] diff --git a/docs/sources/flow/reference/compatibility/_index.md b/docs/sources/flow/reference/compatibility/_index.md index cdd9426cfb27..691b10893024 100644 --- a/docs/sources/flow/reference/compatibility/_index.md +++ b/docs/sources/flow/reference/compatibility/_index.md @@ -79,7 +79,6 @@ The following components, grouped by namespace, _export_ Targets. {{< /collapse >}} {{< collapse title="prometheus" >}} -- [prometheus.exporter.agent]({{< relref "../components/prometheus.exporter.agent.md" >}}) - [prometheus.exporter.apache]({{< relref "../components/prometheus.exporter.apache.md" >}}) - [prometheus.exporter.azure]({{< relref "../components/prometheus.exporter.azure.md" >}}) - [prometheus.exporter.blackbox]({{< relref "../components/prometheus.exporter.blackbox.md" >}}) @@ -99,6 +98,7 @@ The following components, grouped by namespace, _export_ Targets. - [prometheus.exporter.postgres]({{< relref "../components/prometheus.exporter.postgres.md" >}}) - [prometheus.exporter.process]({{< relref "../components/prometheus.exporter.process.md" >}}) - [prometheus.exporter.redis]({{< relref "../components/prometheus.exporter.redis.md" >}}) +- [prometheus.exporter.self]({{< relref "../components/prometheus.exporter.self.md" >}}) - [prometheus.exporter.snmp]({{< relref "../components/prometheus.exporter.snmp.md" >}}) - [prometheus.exporter.snowflake]({{< relref "../components/prometheus.exporter.snowflake.md" >}}) - [prometheus.exporter.squid]({{< relref "../components/prometheus.exporter.squid.md" >}}) diff --git a/docs/sources/flow/reference/components/prometheus.exporter.agent.md b/docs/sources/flow/reference/components/prometheus.exporter.self.md similarity index 69% rename from docs/sources/flow/reference/components/prometheus.exporter.agent.md rename to docs/sources/flow/reference/components/prometheus.exporter.self.md index a4575bb08c1b..16ee5990eec9 100644 --- a/docs/sources/flow/reference/components/prometheus.exporter.agent.md +++ b/docs/sources/flow/reference/components/prometheus.exporter.self.md @@ -2,25 +2,26 @@ aliases: - /docs/grafana-cloud/monitor-infrastructure/agent/flow/reference/components/prometheus.exporter.agent/ - /docs/grafana-cloud/send-data/agent/flow/reference/components/prometheus.exporter.agent/ -canonical: https://grafana.com/docs/agent/latest/flow/reference/components/prometheus.exporter.agent/ -description: Learn about prometheus.exporter.agen -title: prometheus.exporter.agent +- ./prometheus.exporter.agent/ +canonical: https://grafana.com/docs/agent/latest/flow/reference/components/prometheus.exporter.self/ +description: Learn about prometheus.exporter.self +title: prometheus.exporter.self --- -# prometheus.exporter.agent +# prometheus.exporter.self -The `prometheus.exporter.agent` component collects and exposes metrics about {{< param "PRODUCT_NAME" >}} itself. +The `prometheus.exporter.self` component collects and exposes metrics about {{< param "PRODUCT_NAME" >}} itself. ## Usage ```river -prometheus.exporter.agent "agent" { +prometheus.exporter.self "agent" { } ``` ## Arguments -`prometheus.exporter.agent` accepts no arguments. +`prometheus.exporter.self` accepts no arguments. ## Exported fields @@ -28,30 +29,30 @@ prometheus.exporter.agent "agent" { ## Component health -`prometheus.exporter.agent` is only reported as unhealthy if given +`prometheus.exporter.self` is only reported as unhealthy if given an invalid configuration. ## Debug information -`prometheus.exporter.agent` doesn't expose any component-specific +`prometheus.exporter.self` doesn't expose any component-specific debug information. ## Debug metrics -`prometheus.exporter.agent` doesn't expose any component-specific +`prometheus.exporter.self` doesn't expose any component-specific debug metrics. ## Example This example uses a [`prometheus.scrape` component][scrape] to collect metrics -from `prometheus.exporter.agent`: +from `prometheus.exporter.self`: ```river -prometheus.exporter.agent "example" {} +prometheus.exporter.self "example" {} // Configure a prometheus.scrape component to collect agent metrics. prometheus.scrape "demo" { - targets = prometheus.exporter.agent.example.targets + targets = prometheus.exporter.self.example.targets forward_to = [prometheus.remote_write.demo.receiver] } @@ -78,7 +79,7 @@ Replace the following: ## Compatible components -`prometheus.exporter.agent` has exports that can be consumed by the following components: +`prometheus.exporter.self` has exports that can be consumed by the following components: - Components that consume [Targets]({{< relref "../compatibility/#targets-consumers" >}}) diff --git a/docs/sources/flow/release-notes.md b/docs/sources/flow/release-notes.md index baa91ae3d068..12d157868593 100644 --- a/docs/sources/flow/release-notes.md +++ b/docs/sources/flow/release-notes.md @@ -41,6 +41,11 @@ This functionality is now only available in the main configuration. The `disable_high_cardinality_metrics` configuration argument is used by `otelcol.exporter` components such as `otelcol.exporter.otlp`. If you need to see high cardinality metrics containing labels such as IP addresses and port numbers, you now have to explicitly set `disable_high_cardinality_metrics` to `false`. +### Breaking change: Rename component `prometheus.exporter.agent` to `prometheus.exporter.self` + +The name `prometheus.exporter.agent` is potentially ambiguous and can be misinterpreted as an exporter for Prometheus Agent. +The new name reflects the component's true purpose as an exporter of the process's own metrics. + ## v0.39 ### Breaking change: `otelcol.receiver.prometheus` will drop all `otel_scope_info` metrics when converting them to OTLP