-
Notifications
You must be signed in to change notification settings - Fork 156
feat(metrics): support otel and console metric export #1204
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Codecov Report❌ Patch coverage is
❌ Your project status has failed because the head coverage (79.36%) is below the target coverage (86.00%). You can increase the head coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## main #1204 +/- ##
==========================================
- Coverage 79.38% 79.36% -0.03%
==========================================
Files 88 89 +1
Lines 10067 10131 +64
==========================================
+ Hits 7992 8040 +48
- Misses 1712 1725 +13
- Partials 363 366 +3 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
1108236 to
0c83d4f
Compare
|
Tested with ElasticStack here, so I think we're good elastic/observability-examples#86 |
|
triple checked the README everything is smooth |
|
|
|
taking to draft because I think it isn't exposing prom by default as it was before. even if things work I suspect we want to default to that and make sure everything works exactly as before unless you set an override |
|
hopefully last change fixes the flake where other tests making a request were required to have the one that flaked pass (race condition) |
|
Something else is flakey not sure if I will be able to solve in this PR |
mathetake
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed the code and seems straightforward vs unlocking a new use case which is exciting!
this seems flaky @codefromthecrypt |
d671be5 to
b0fd33d
Compare
|
@mathetake refactored the prom metrics test to not be flakey |
|
ok 🤞 |
| } | ||
|
|
||
| // TestNewMetricsFromEnv_NetworkExporters tests OTLP and other network-based exporters. | ||
| // We CANNOT use synctest here because it creates a "bubble" where goroutines are isolated |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ps I intentionally left this in as it is something I will discuss in the golang meetup tomorrow ;)
This extends otel ENV config to metrics, when enabled exports instead of a
prometheus listener. This allows metrics in otel native systems like elastic stack,
otel tui and otherwise, without a prometheus pump. This also allows you to do
ad-hoc configuration by using `console` config.
Updated cmd/aigw examples:
- Add otel-tui service to show native otel w/o prometheus
- Use profile-based env file selection (.env.otel.${COMPOSE_PROFILES:-console})
- Set console as default for immediate debugging without external dependencies
Documentation:
- Document separate OTLP endpoints for traces/metrics and exporter types
Phoenix users: Set OTEL_METRICS_EXPORTER=none as Phoenix only supports traces
Signed-off-by: Adrian Cole <adrian@tetrate.io>
Signed-off-by: Adrian Cole <adrian@tetrate.io>
9cddcb8 to
84fbab7
Compare
| // TestPrometheusMetrics verifies that metrics are properly exported via Prometheus | ||
| // when processing a chat completion request. This test uses the default configuration | ||
| // which exposes metrics on the /metrics endpoint. | ||
| func TestPrometheusMetrics(t *testing.T) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@hustxiayang fyi once this lands, feel free to refactor it or rename it to TestPromOpenAIChatCompletions so you can have a second TestPromOpenAIEmbeddings that verifies the token things aren't there (or remain not there). another way is to make this a table test, but the parameters may be difficult enough to warrant a separate test for embeddings. not sure.. anyway hope this base test helps!
**Description** This extends otel ENV config to metrics, when enabled exports instead of a prometheus listener. This allows metrics in otel native systems like elastic stack, otel tui and otherwise, without a prometheus pump. This also allows you to do ad-hoc configuration by using `console` config. Here's an example of standalone using otel-tui https://github.com/ymtdzzz/otel-tui: <img width="720" height="296" alt="tui-metrics" src="https://github.com/user-attachments/assets/6640e6ee-c87c-4586-bce7-13d6ca837c96" /> <img width="2096" height="1014" alt="tui-trace" src="https://github.com/user-attachments/assets/0feb6ed2-87e0-4b43-9c96-7f09493ec365" /> Updated cmd/aigw examples: - Add otel-tui service to show native otel w/o prometheus - Use profile-based env file selection (.env.otel.${COMPOSE_PROFILES:-console}) - Set console as default for immediate debugging without external dependencies Documentation: - Document separate OTLP endpoints for traces/metrics and exporter types Phoenix users: Set OTEL_METRICS_EXPORTER=none as Phoenix only supports traces Fixes envoyproxy#1100 --------- Signed-off-by: Adrian Cole <adrian@tetrate.io> Signed-off-by: Erica Hughberg <erica.sundberg.90@gmail.com>
Description
This extends otel ENV config to metrics, when enabled exports instead of a prometheus listener. This allows metrics in otel native systems like elastic stack, otel tui and otherwise, without a prometheus pump. This also allows you to do ad-hoc configuration by using
consoleconfig.Here's an example of standalone using otel-tui https://github.com/ymtdzzz/otel-tui:


Updated cmd/aigw examples:
Documentation:
Phoenix users: Set OTEL_METRICS_EXPORTER=none as Phoenix only supports traces
Fixes #1100