You've already forked authentication-service
mirror of
https://github.com/matrix-org/matrix-authentication-service.git
synced 2025-08-06 06:02:40 +03:00
OpenTelemetry upgrade
This commit is contained in:
@@ -14,6 +14,7 @@ tower = "0.4.13"
|
||||
tokio = { version = "1.30.0", features = ["time"] }
|
||||
opentelemetry = { version = "0.20.0", features = ["metrics"] }
|
||||
opentelemetry-http = "0.9.0"
|
||||
opentelemetry-semantic-conventions = "0.12.0"
|
||||
pin-project-lite = "0.2.12"
|
||||
|
||||
[features]
|
||||
|
@@ -27,6 +27,7 @@ fn meter() -> opentelemetry::metrics::Meter {
|
||||
opentelemetry::global::meter_with_version(
|
||||
env!("CARGO_PKG_NAME"),
|
||||
Some(env!("CARGO_PKG_VERSION")),
|
||||
Some(opentelemetry_semantic_conventions::SCHEMA_URL),
|
||||
None,
|
||||
)
|
||||
}
|
||||
|
@@ -14,7 +14,7 @@
|
||||
|
||||
use std::future::Future;
|
||||
|
||||
use opentelemetry::{metrics::Histogram, Context, KeyValue};
|
||||
use opentelemetry::{metrics::Histogram, KeyValue};
|
||||
use pin_project_lite::pin_project;
|
||||
use tokio::time::Instant;
|
||||
use tower::{Layer, Service};
|
||||
@@ -195,8 +195,7 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
this.histogram
|
||||
.record(&Context::new(), duration_ms, &attributes);
|
||||
this.histogram.record(duration_ms, &attributes);
|
||||
std::task::Poll::Ready(result)
|
||||
}
|
||||
}
|
||||
|
@@ -16,7 +16,7 @@ use std::future::Future;
|
||||
|
||||
use opentelemetry::{
|
||||
metrics::{Unit, UpDownCounter},
|
||||
Context, KeyValue,
|
||||
KeyValue,
|
||||
};
|
||||
use pin_project_lite::pin_project;
|
||||
use tower::{Layer, Service};
|
||||
@@ -98,7 +98,7 @@ struct InFlightGuard {
|
||||
|
||||
impl InFlightGuard {
|
||||
fn new(counter: UpDownCounter<i64>, attributes: Vec<KeyValue>) -> Self {
|
||||
counter.add(&Context::new(), 1, &attributes);
|
||||
counter.add(1, &attributes);
|
||||
|
||||
Self {
|
||||
counter,
|
||||
@@ -109,7 +109,7 @@ impl InFlightGuard {
|
||||
|
||||
impl Drop for InFlightGuard {
|
||||
fn drop(&mut self) {
|
||||
self.counter.add(&Context::new(), -1, &self.attributes);
|
||||
self.counter.add(-1, &self.attributes);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -54,7 +54,8 @@ where
|
||||
|
||||
// Poll the inner future, with the span entered. This is effectively what
|
||||
// [`tracing::Instrumented`] does.
|
||||
let result = ready!(this.span.in_scope(|| this.inner.poll(cx)));
|
||||
let _guard = this.span.enter();
|
||||
let result = ready!(this.inner.poll(cx));
|
||||
|
||||
match &result {
|
||||
Ok(response) => {
|
||||
|
Reference in New Issue
Block a user