Skip to content

feat(plugins/opentelemetry): Replace PeriodicReader with direct gRPC export#400

Open
ValentinCB wants to merge 2 commits into
alumet-dev:mainfrom
ValentinCB:feat/otel-high-frequency
Open

feat(plugins/opentelemetry): Replace PeriodicReader with direct gRPC export#400
ValentinCB wants to merge 2 commits into
alumet-dev:mainfrom
ValentinCB:feat/otel-high-frequency

Conversation

@ValentinCB

Copy link
Copy Markdown
Contributor

Description

A output plugin which exports Alumet metrics to an OpenTelemetry collector via gRPC.

This PR replaces the previous opentelemetry-sdk-based implementation that used a PeriodicReader, which capped the export frequency at 1Hz regardless of Alumet's pipeline cadence. The new implementation calls the OTLP gRPC endpoint directly inside write(), allowing metrics to be exported at any frequency.

Functional tests are also added to cover the main export behaviors.

For more info, please refer to ./plugins/opentelemetry/README.md.

How to test

At the root of the repo, edit the alumet-config.toml file. Lower the pool intervals of RAPL and Procfs under 1s, and add the [opentelemetry] config field:

[plugins.opentelemetry]
# URL of the OTLP gRPC collector
collector_host = "http://localhost:4317"
# Optional prefix and suffix for metric names
prefix = ""
suffix = ""
# Use the display name for units (e.g. "gCO₂") instead of the unique name (e.g. "g_CO2")
use_unit_display_name = false
# Forward measurement attributes as OTel data-point attributes
add_attributes_to_labels = false

Start a local OpenTelemetry collector (e.g. with Docker):

docker run -p 4317:4317 otel/opentelemetry-collector

Build the binary and launch Alumet with rapl and opentelemetry:

cargo build
./target/debug/alumet-agent --config alumet-config.toml

You should see metrics being exported to your collector in real time.

To run the functional tests:

cargo test --test output -p plugin-opentelemetry

@ValentinCB ValentinCB force-pushed the feat/otel-high-frequency branch 3 times, most recently from 9937c87 to b46d398 Compare May 6, 2026 15:01

@guigomcha guigomcha left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Super nice, just a few questions

Comment thread plugins/opentelemetry/src/lib.rs
Comment thread plugins/opentelemetry/src/output.rs Outdated
Comment thread plugins/opentelemetry/src/output.rs Outdated
Comment thread plugins/opentelemetry/tests/fakeplugin.rs
@ValentinCB ValentinCB force-pushed the feat/otel-high-frequency branch 3 times, most recently from c27ced7 to 3fc5d99 Compare May 13, 2026 15:38
@ValentinCB ValentinCB requested a review from guigomcha May 15, 2026 12:54

@guigomcha guigomcha left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! nice improvement!

@ValentinCB ValentinCB force-pushed the feat/otel-high-frequency branch 2 times, most recently from de427c7 to d96be3a Compare May 15, 2026 14:00
Comment thread plugins/opentelemetry/src/output.rs
Comment thread plugins/opentelemetry/src/output.rs Outdated
Comment thread plugins/opentelemetry/src/output.rs Outdated
Comment thread plugins/opentelemetry/README.md Outdated
Comment thread plugins/opentelemetry/README.md Outdated
Comment thread plugins/opentelemetry/README.md
@ValentinCB ValentinCB force-pushed the feat/otel-high-frequency branch from b1e4f3c to 791abb3 Compare May 20, 2026 14:46
@ValentinCB ValentinCB requested a review from ahuret May 20, 2026 14:54
Comment thread plugins/opentelemetry/README.md Outdated
Comment thread plugins/opentelemetry/README.md Outdated
@ValentinCB ValentinCB force-pushed the feat/otel-high-frequency branch from 115a2c4 to 7512a58 Compare May 21, 2026 08:25
ahuret
ahuret previously approved these changes May 21, 2026
Comment thread plugins/opentelemetry/tests/output.rs Outdated
Comment thread plugins/opentelemetry/src/output.rs Outdated
Comment thread plugins/opentelemetry/src/output.rs Outdated
@ValentinCB ValentinCB force-pushed the feat/otel-high-frequency branch from 39a1893 to eca06b6 Compare June 9, 2026 09:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants