OpenTelemetry
x/otel
component: v0.28.0+ OpenTelemetry client component, used for recording various metric data and sending it to backend systems (such as: Prometheus, Datadog, InfluxDB, etc.) via the OTLP protocol.
Requires additional import of the extension library: rulego-components (opens new window)
# Configuration
Field | Type | Description | Default Value |
---|---|---|---|
server | string | Address of the OTLP backend system | localhost:4318 |
protocol | string | Transport protocol, supports grpc and http | http |
metricExpr | string | Dynamic metric configuration expression, supports fetching metric configuration from message payload | ${msg.metrics} |
metrics | MetricConfig[] | Static metric configuration list | None |
# MetricConfig Metric Configuration
Field | Type | Description | Example Value |
---|---|---|---|
metricName | string | Metric name | http_requests |
description | string | Metric description | HTTP request count |
unit | string | Metric unit (e.g., 1, s, ms, B, %, etc.) | 1 |
opType | string | Operation type: COUNTER , GAUGE , HISTOGRAM | COUNTER |
value | string | Metric value expression, supports dynamic value fetching | ${msg.value} |
labels | string | Label expression, supports dynamic value fetching, in JSON object format | ${msg.labels} |
# Metric Type Description
- COUNTER: Counter, a cumulative value that only increases (e.g., total number of requests)
- GAUGE: Gauge, an instantaneous value that can increase or decrease (e.g., CPU usage rate)
- HISTOGRAM: Histogram, used for statistical distribution of values (e.g., request latency distribution)
# Configuration Example
{
"id": "otel1",
"type": "x/otel",
"configuration": {
"server": "localhost:4317",
"protocol": "grpc",
"metricExpr": "${msg.metrics}",
"metrics": [
{
"metricName": "http_requests",
"description": "HTTP requests made",
"unit": "1",
"opType": "COUNTER",
"value": "${msg.value}",
"labels": "${msg.labels}"
}
]
}
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
Edit this page on GitHub (opens new window)
Last Updated: 2025/01/06, 10:45:29