otelcol.receiver.prometheus
公开预览: 这是一个 公开预览 组件。公开预览组件可能会有重大更改,并且可能会被涵盖相同用例的等效功能所取代。
stability.level
标志必须设置为public-preview
或更低才能使用该组件。
otelcol.receiver.prometheus
接收 Prometheus 指标,将其转换为 OpenTelemetry 指标格式,并将其转发到其他 otelcol.*
组件。
可以指定多个 otelcol.receiver.prometheus
组件,方法是为它们提供不同的标签。
用法
otelcol.receiver.prometheus "LABEL" {
output {
metrics = [...]
}
}
参数
otelcol.receiver.prometheus
不支持任何参数,并且完全通过内部块进行配置。
块
otelcol.receiver.prometheus
的定义内部支持以下块
层级结构 | 块 | 描述 | 必需 |
---|---|---|---|
output | output | 配置将接收到的遥测数据发送到哪里。 | 是 |
output 块
output
块配置一组组件,用于将生成的遥测数据转发到这些组件。
支持以下参数
名称 | 类型 | 描述 | 默认值 | 必需 |
---|---|---|---|---|
logs | list(otelcol.Consumer) | 要将日志发送到的消费者列表。 | [] | 否 |
metrics | list(otelcol.Consumer) | 要将指标发送到的消费者列表。 | [] | 否 |
traces | list(otelcol.Consumer) | 要将追踪发送到的消费者列表。 | [] | 否 |
您必须指定 output
块,但其所有参数都是可选的。默认情况下,遥测数据将被丢弃。相应地配置 metrics
、logs
和 traces
参数,以将遥测数据发送到其他组件。
导出的字段
以下字段已导出,可以被其他组件引用
名称 | 类型 | 描述 |
---|---|---|
receiver | MetricsReceiver | 其他组件可用于将 Prometheus 指标发送到此的值。 |
组件运行状况
仅当 otelcol.receiver.prometheus
配置无效时,才报告为不健康。
调试信息
otelcol.receiver.prometheus
不公开任何组件特定的调试信息。
示例
此示例使用 otelcol.receiver.prometheus
组件作为 Prometheus 和 OpenTelemetry 生态系统之间的桥梁。该组件公开了一个接收器,prometheus.scrape
组件使用该接收器将 Prometheus 指标数据发送到该组件。指标在转发到 otelcol.exporter.otlp
组件之前被转换为 OTLP 格式,以便发送到支持 OTLP 的端点
prometheus.scrape "default" {
// Collect metrics from the default HTTP listen address.
targets = [{"__address__" = "127.0.0.1:12345"}]
forward_to = [otelcol.receiver.prometheus.default.receiver]
}
otelcol.receiver.prometheus "default" {
output {
metrics = [otelcol.exporter.otlp.default.input]
}
}
otelcol.exporter.otlp "default" {
client {
endpoint = sys.env("OTLP_ENDPOINT")
}
}
兼容组件
otelcol.receiver.prometheus
可以接受来自以下组件的参数
otelcol.receiver.prometheus
具有可以被以下组件使用的导出
- 使用 Prometheus
MetricsReceiver
的组件
注意
连接某些组件可能不合理,或者组件可能需要进一步配置才能使连接正常工作。有关更多详细信息,请参阅链接的文档。