Ingesting data using OpenTelemetry Collector
OpenTelemetry Collector is an agent that pulls telemetry data from systems you want to monitor and sends it to tracing tools using the OpenTelemetry protocol (OTLP).
You can use OpenTelemetry Collector to monitor system metrics, PostgreSQL, MySQL, Redis, and more.
Out of the box, Uptrace accepts data from OpenTelemetry Collector using OTLP and automatically creates dashboards for the available metrics.
Sending data from Collector to Uptrace
If you are already using OpenTelemetry Collector, you can configure it to send data to Uptrace using OpenTelemetry Protocol (OTLP).
To send data to a self-managed Uptrace installation that does not have TLS:
exporters:
otlp:
endpoint: http://localhost:14317
tls:
insecure: true
headers:
uptrace-dsn: 'http://project2_secret_token@localhost:14317/2'
exporters:
otlphttp:
endpoint: http://localhost:14318
tls:
insecure: true
headers:
uptrace-dsn: 'http://project2_secret_token@localhost:14318/2'
To send data to Uptrace Cloud:
exporters:
otlp:
endpoint: otlp.uptrace.dev:4317
headers:
uptrace-dsn: 'https://<token>@uptrace.dev/<project_id>'
exporters:
otlphttp:
endpoint: https://otlp.uptrace.dev
headers:
uptrace-dsn: 'https://<token>@uptrace.dev/<project_id>'
Either way, don't forget to add Uptrace exporter to service.pipelines
section:
service:
pipelines:
traces:
receivers: [otlp]
processors: [batch]
exporters: [otlp/uptrace]
metrics:
receivers: [otlp]
processors: [batch, resourcedetection]
exporters: [otlp/uptrace]
logs:
receivers: [otlp]
processors: [batch]
exporters: [otlp/uptrace]
service:
pipelines:
traces:
receivers: [otlp]
processors: [batch]
exporters: [otlphttp/uptrace]
metrics:
receivers: [otlp]
processors: [batch, resourcedetection]
exporters: [otlphttp/uptrace]
logs:
receivers: [otlp]
processors: [batch]
exporters: [otlphttp/uptrace]
Sending data from Uptrace distros to Collector
Sometimes it might be useful to send data from Uptrace distros to an OpenTelemetry Collector acting as a middle-man that forwards the received data to Uptrace.
For example, you can use OpenTelemetry Collector in such a manner for tail-based sampling or redacting span attributes.
Assuming OpenTelemetry Collector is listening on localhost:4317
and localhost:4318
, use the following Uptrace DSN with Uptrace distros such as uptrace-go:
# OTLP/gRPC
UPTRACE_DSN=http://localhost:4317
# or
# OTLP/HTTP
UPTRACE_DSN=http://localhost:4318
If the Collector supports TLS, replace http
with https
.
hostmetrics
hostmetricsreceiver is an OpenTelemetry Collector receiver that gathers various metrics about the host system, for example, CPU, RAM, disk metrics and more.
To start collecting host metrics, you need to install Collector on each system you want to monitor and add the following lines to the Collector config:
processors:
resourcedetection:
detectors: ['system']
batch:
send_batch_size: 10000
timeout: 10s
receivers:
hostmetrics:
collection_interval: 10s
scrapers:
cpu:
disk:
filesystem:
load:
memory:
network:
paging:
If you are using unusual filesystems, you may want to configure the receiver more thoroughly, for example, to scrape only supported filesystems:
receivers:
hostmetrics:
collection_interval: 10s
scrapers:
cpu:
disk:
load:
filesystem:
include_fs_types:
match_type: strict
fs_types: [ext3, ext4]
memory:
network:
paging:
Lastly, you need to add the configured receiver to a pipeline to enable it:
service:
pipelines:
metrics/hostmetrics:
receivers: [hostmetrics]
processors: [batch, resourcedetection]
exporters: [otlp/uptrace]
Dashboards
Once everything is configured properly, Uptrace will automatically create dashboards using pre-built templates:
What's next?
Next, learn more about OpenTelemetry Collector or browse available receivers.