Skip to content
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

metrics: Use prometheus-client for proxy_build_info #2551

Merged
merged 3 commits into from
Dec 5, 2023

Conversation

olix0r
Copy link
Member

@olix0r olix0r commented Dec 5, 2023

In prepration to add metrics that report float values, and ultimately in service of replacing Linkerd's custom metrics implementation with an upstream library, this change adds an integration with the prometheus-client crate.

This is accomplished by leaving the existing types and traits in place and adding a FmtMetrics implementation for the prometheus-client Registry type, minimizing the change needed to support this new library.

New metrics can use the upstream registry and metric types. The proxy_build_info metric has been ported to use the new API to validate the new library. Now, the metrics dump ends with:

# HELP proxy_build_info Proxy build info.
# TYPE proxy_build_info gauge
proxy_build_info{date="2023-12-05T19:52:40Z",git_sha="215c32d3f",profile="release",vendor="code@ver-sea",version="0.0.0-dev.215c32d3f"} 1
# EOF

In prepration to add metrics that report float values, and ultimately in
service of replacing Linkerd's custom metrics implementation with an
upstream library, this change adds an integration with the
prometheus-client crate.

This is accomplished by leaving the existing types and traits in place
and adding a FmtMetrics implementation for the prometheus-client
Registry type, minimizing the change needed to support this new library.

New metrics can use the upstream registry and metric types. The
proxy_build_info metric has been ported to use the new API to validate
the new library. Now, the metrics dump ends with:

> # HELP proxy_build_info Proxy build info.
> # TYPE proxy_build_info gauge
> proxy_build_info{date="2023-12-05T19:52:40Z",git_sha="215c32d3f",profile="release",vendor="code@ver-sea",version="0.0.0-dev.215c32d3f"} 1
> # EOF
@olix0r olix0r requested a review from a team as a code owner December 5, 2023 20:08
Copy link

codecov bot commented Dec 5, 2023

Codecov Report

Merging #2551 (e337802) into main (b12ff1d) will increase coverage by 0.03%.
The diff coverage is 100.00%.

❗ Current head e337802 differs from pull request most recent head 4ab8fdc. Consider uploading reports for the commit 4ab8fdc to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2551      +/-   ##
==========================================
+ Coverage   67.35%   67.39%   +0.03%     
==========================================
  Files         329      329              
  Lines       14652    14651       -1     
==========================================
+ Hits         9869     9874       +5     
+ Misses       4783     4777       -6     
Files Coverage Δ
linkerd/app/core/src/build_info.rs 100.00% <100.00%> (ø)
linkerd/app/core/src/lib.rs 87.50% <ø> (ø)
linkerd/app/core/src/metrics.rs 98.51% <100.00%> (+0.04%) ⬆️
linkerd/metrics/src/counter.rs 91.30% <ø> (ø)
linkerd/metrics/src/fmt.rs 72.41% <ø> (ø)
linkerd/metrics/src/gauge.rs 88.88% <ø> (ø)
linkerd/metrics/src/lib.rs 100.00% <100.00%> (ø)

... and 4 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b12ff1d...4ab8fdc. Read the comment docs.

@olix0r olix0r force-pushed the ver/metrics-prom-client branch from 37adce5 to ec512c0 Compare December 5, 2023 20:28
@olix0r olix0r merged commit f920e6c into main Dec 5, 2023
22 checks passed
@olix0r olix0r deleted the ver/metrics-prom-client branch December 5, 2023 23:15
olix0r added a commit to linkerd/linkerd2 that referenced this pull request Dec 13, 2023
This change culminates recent work to restructure the balancer to use a
PoolQueue so that balancer changes may occur independently of request
processing. This replaces independent discovery buffering so that the
balancer task is responsible for polling discovery streams without
independent buffering. Requests are buffered and processed as soon as
the pool has available backends. Fail-fast circuit breaking is enforced
on the balancer's queue so that requests can't get stuck in a queue
indefinitely.

In general, the new balancer is instrumented directly with metrics, and
the relevant metric name prefix and labelset is provided by the stack.
In addition to detailed queue metrics including request (in-queue)
latency histograms, but also failfast states, discovery updates counts,
and balancer endpoint pool sizes.

---

* outbound: Move queues into the concrete stack (linkerd/linkerd2-proxy#2539)
* metrics: Remove unused features (linkerd/linkerd2-proxy#2542)
* Add the PoolQueue middleware (linkerd/linkerd2-proxy#2540)
* ci: Fixup codecov config (linkerd/linkerd2-proxy#2545)
* ci: Cancel prior runs (linkerd/linkerd2-proxy#2546)
* ci: Skip ARM builds during non-release CI (linkerd/linkerd2-proxy#2547)
* deps: Update tokio, tonic, and prost (linkerd/linkerd2-proxy#2544)
* build(deps): bump tj-actions/changed-files from 40.2.0 to 40.2.1 (linkerd/linkerd2-proxy#2549)
* metrics: Use prometheus-client for proxy_build_info (linkerd/linkerd2-proxy#2551)
* balance: Add a p2c Pool implementation (linkerd/linkerd2-proxy#2541)
* metrics: Export process metrics using prometheus-client (linkerd/linkerd2-proxy#2552)
* linkerd_identity: split `linkerd_identity::Id` into DNS and URI variants (linkerd/linkerd2-proxy#2538)
* outbound: Move HTTP balancer into its own module (linkerd/linkerd2-proxy#2554)
* app: Setup prom registry for use in balancers (linkerd/linkerd2-proxy#2555)
* vscode: Move workspace settings to devcontainer (linkerd/linkerd2-proxy#2557)
* build(deps): bump tj-actions/changed-files from 40.2.1 to 40.2.2 (linkerd/linkerd2-proxy#2556)
* balance: Instrument metrics in pool balancer (linkerd/linkerd2-proxy#2558)
* Enable PoolQueue balancer (linkerd/linkerd2-proxy#2559)

Signed-off-by: Oliver Gould <[email protected]>
olix0r added a commit to linkerd/linkerd2 that referenced this pull request Dec 14, 2023
This change culminates recent work to restructure the balancer to use a
PoolQueue so that balancer changes may occur independently of request
processing. This replaces independent discovery buffering so that the
balancer task is responsible for polling discovery streams without
independent buffering. Requests are buffered and processed as soon as
the pool has available backends. Fail-fast circuit breaking is enforced
on the balancer's queue so that requests can't get stuck in a queue
indefinitely.

In general, the new balancer is instrumented directly with metrics, and
the relevant metric name prefix and labelset is provided by the stack.
In addition to detailed queue metrics including request (in-queue)
latency histograms, but also failfast states, discovery updates counts,
and balancer endpoint pool sizes.

---

* outbound: Move queues into the concrete stack (linkerd/linkerd2-proxy#2539)
* metrics: Remove unused features (linkerd/linkerd2-proxy#2542)
* Add the PoolQueue middleware (linkerd/linkerd2-proxy#2540)
* ci: Fixup codecov config (linkerd/linkerd2-proxy#2545)
* ci: Cancel prior runs (linkerd/linkerd2-proxy#2546)
* ci: Skip ARM builds during non-release CI (linkerd/linkerd2-proxy#2547)
* deps: Update tokio, tonic, and prost (linkerd/linkerd2-proxy#2544)
* build(deps): bump tj-actions/changed-files from 40.2.0 to 40.2.1 (linkerd/linkerd2-proxy#2549)
* metrics: Use prometheus-client for proxy_build_info (linkerd/linkerd2-proxy#2551)
* balance: Add a p2c Pool implementation (linkerd/linkerd2-proxy#2541)
* metrics: Export process metrics using prometheus-client (linkerd/linkerd2-proxy#2552)
* linkerd_identity: split `linkerd_identity::Id` into DNS and URI variants (linkerd/linkerd2-proxy#2538)
* outbound: Move HTTP balancer into its own module (linkerd/linkerd2-proxy#2554)
* app: Setup prom registry for use in balancers (linkerd/linkerd2-proxy#2555)
* vscode: Move workspace settings to devcontainer (linkerd/linkerd2-proxy#2557)
* build(deps): bump tj-actions/changed-files from 40.2.1 to 40.2.2 (linkerd/linkerd2-proxy#2556)
* balance: Instrument metrics in pool balancer (linkerd/linkerd2-proxy#2558)
* Enable PoolQueue balancer (linkerd/linkerd2-proxy#2559)

Signed-off-by: Oliver Gould <[email protected]>
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.

1 participant