Telegraf provides an integration to collect metrics from arbitrary HTTP endpoints using the HTTP input plugin. Telegraf collects the metrics, processes them, and sends them to Lightstep Observability using the OpenTelemetry output plugin.
To complete the integration, you will:
- Configure the Telegraf HTTP input plugin
- Configure the Telegraf OpenTelemetry output plugin
Configure the Telegraf HTTP input plugin
In the Telegraf configuration file, add configuration for the HTTP input plugin. This input plugin configuration requires setting a target endpoint to fetch the metrics from. Aditional configuration depends on the data_format
that you use. You can find complete configuration details in the official HTTP plugin documentation.
This example uses json
with the settings needed for that format.
1
2
3
4
5
6
7
8
9
10
[[inputs.http]]
urls = [
"http://demosvc:8080/heapbasics"
]
timeout = "10s"
data_format = "json"
json_name_key = "name"
json_time_key = "timestamp"
json_time_format = "unix"
Configure the OpenTelemetry output plugin
To deliver metrics to Lightstep Observability you configure the Telegraf OpenTelmetry output plugin. This plugin sends metrics to Lightstep using gRPC.
This example shows the plugin configured without TLS:
1
2
3
4
5
6
7
[[outputs.opentelemetry]]
service_address = "ingest.lightstep.com:443"
insecure_skip_verify = true
# Additional gRPC request metadata
[outputs.opentelemetry.headers]
lightstep-access-token = "$LS_ACCESS_TOKEN"
For more details regarding configuring the OpenTelemetry output plugin see the official Telegraf documentation.
Validate metrics are reporting to Lightstep
You can validate that metrics are reporting to Lightstep on the Metrics details page in Project settings.
-
In Lightstep, click Project settings > Metric details.
-
Search for HTTP metric names.
-
If needed, select on the metric to edit the description and how the units are displayed in Lightstep.
View metrics in Lightstep
After you have Lightstep ingesting metrics from the HTTP endpoint, you can use the Lightstep Terraform Provider to create a dashboard for the metrics.
Additional resources
-
For a complete example that’s ready to run, see Telegraf HTTP input plugin in the Lightstep OpenTelemetry Examples.
-
You can learn more about configuring Telegraf from the official documentation.