Skip to content

Commit

Permalink
feat!(comp/exporter/self): rename component to clear up ambiguity (#6365
Browse files Browse the repository at this point in the history
)

Signed-off-by: hainenber <[email protected]>
Co-authored-by: Clayton Cornell <[email protected]>
Co-authored-by: Robert Fratto <[email protected]>
  • Loading branch information
3 people authored Feb 20, 2024
1 parent f221ab1 commit 7a686be
Show file tree
Hide file tree
Showing 10 changed files with 41 additions and 33 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion component/all/all.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package agent
package self

import (
"github.com/grafana/agent/component"
Expand All @@ -9,7 +9,7 @@ import (

func init() {
component.Register(component.Registration{
Name: "prometheus.exporter.agent",
Name: "prometheus.exporter.self",
Args: Arguments{},
Exports: exporter.Exports{},

Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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{}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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__"]
Expand Down
4 changes: 2 additions & 2 deletions converter/internal/staticconvert/testdata/integrations.river
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
4 changes: 2 additions & 2 deletions converter/internal/staticconvert/testdata/sanitize.river
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down
2 changes: 1 addition & 1 deletion docs/sources/flow/reference/compatibility/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -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" >}})
Expand All @@ -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" >}})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,56 +2,57 @@
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

{{< docs/shared lookup="flow/reference/components/exporter-component-exports.md" source="agent" version="<AGENT_VERSION>" >}}

## 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]
}
Expand All @@ -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" >}})

Expand Down
5 changes: 5 additions & 0 deletions docs/sources/flow/release-notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 7a686be

Please sign in to comment.