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

Update metrics #805

Merged
merged 2 commits into from
May 6, 2024
Merged

Update metrics #805

merged 2 commits into from
May 6, 2024

Conversation

michaeldjeffrey
Copy link
Contributor

This is pointing into mj/telemetry-histograms branch to ease reviewing. This update changes a lot of files.

Also bumps metrics-exporter-prometheus.

The biggest change from 0.21 -> 0.22 is in this PR metrics-rs/metrics#394

Also bumps metrics-exporter-prometheus.

The biggest change from 0.21 -> 0.22 is in this PR
metrics-rs/metrics#394
Cargo.toml Outdated Show resolved Hide resolved
this may change if the api to metrics changes _again_ before a major version.
@michaeldjeffrey michaeldjeffrey merged commit 1888c61 into mj/telemtry-histograms May 6, 2024
@michaeldjeffrey michaeldjeffrey deleted the mj/update-metrics branch May 6, 2024 18:18
michaeldjeffrey added a commit that referenced this pull request May 6, 2024
* Update metrics crate

Also bumps metrics-exporter-prometheus.

The biggest change from 0.21 -> 0.22 is in this PR
metrics-rs/metrics#394

* allow for versions greater than 0.22

this may change if the api to metrics changes _again_ before a major version.
michaeldjeffrey added a commit that referenced this pull request May 6, 2024
* Add client_requests timing module to metrics

- Add a timing span to anything that can be instrumented and returns a Result.

  Example:
  ```ignore
  let client = GatewayClient::new(channel);

  client.info(req)
    .with_timing("iot_fetch_info")
    .await?;
  ```

  This will result in a prometheus metric
  >> client_request_duration_seconds{name = "iot_fetch_info", quantile="xxx"}

- Install the `ApiTimingLayer`.

  Adding `.with_span_events(FmtSpan::CLOSE)` to a regular format layer will
  print the timing spans to stdout as well.

  Example:
  ```ignore
  tracing_subscriber::registry()
    .with(tracing_subscriber::fmt::layer().with_span_events(FmtSpan::CLOSE))
    .with(metrics::client_requests::client_request_timing_layer("histogram_name"))
    .init();
  ```

- Remove unused `install_metrics` function, replace with nested
  `install` function that `start_metrics` delegates to. This allows us to
  start metrics in tests without needing to make a `Settings` struct.

* Update metrics (#805)

* Update metrics crate

Also bumps metrics-exporter-prometheus.

The biggest change from 0.21 -> 0.22 is in this PR
metrics-rs/metrics#394

* allow for versions greater than 0.22

this may change if the api to metrics changes _again_ before a major version.

* make string values consts

Makes the values hide a little bit less in the code
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.

2 participants