I am trying to port the follwoing Alloy config to the Otel Collector Distro:
discovery.relabel "metrics_integrations_integrations_test" {
targets = [{
__address__ = "localhost:5572",
}]
rule {
target_label = "instance"
replacement = constants.hostname
}
}
prometheus.scrape "metrics_integrations_integrations_test" {
targets = discovery.relabel.metrics_integrations_integrations_test.output
forward_to = [prometheus.remote_write.metrics_service.receiver]
job_name = "integrations/test"
}
What I have so far:
receivers:
prometheus:
config:
scrape_configs:
- job_name: integrations/test
scrape_interval: 5s
static_configs:
- targets: [localhost:5572]
basic_auth:
username: ' '
password: ' '
processors:
cumulativetodelta:
exporters:
otlphttp:
endpoint: ' '
headers:
Authorization: ' '
service:
pipelines:
metrics:
receivers: [prometheus]
processors: [cumulativetodelta]
exporters: [otlphttp]
What I do not fully understand is how to convert the discovery.relabel rule to the Collector.
I already tried adding
relabel_configs:
- source_labels: [__address__]
target_label: instance
as well as
metric_relabel_configs:
- source_labels: [__address__]
target_label: instance
to the scrape configs, but this does not have any effect on the output. So I assume that I don’t understand what discovery.relabel does exactly in that rule. What I think it does is adding a key value pair instance= to every metric as a label. But with the Otel collector I don’t see the label in the output using metric_relabel_configs and relabel_configs.
Can anybody help?