1
0
mirror of https://github.com/matrix-org/matrix-authentication-service.git synced 2025-07-29 22:01:14 +03:00

Replace the OTEL-based tracing layer with tracing based layers

This commit is contained in:
Quentin Gliech
2023-04-15 14:21:12 +02:00
parent 4a4fbc7a16
commit 08f58db08b
47 changed files with 1703 additions and 1520 deletions

View File

@ -191,7 +191,7 @@ async fn fetch_jwks(
.unwrap();
let mut client = http_client_factory
.client("fetch-jwks")
.client()
.await?
.response_body_to_bytes()
.json_response::<PublicJsonWebKeySet>();

View File

@ -43,16 +43,13 @@ impl HttpClientFactory {
/// # Errors
///
/// Returns an error if the client failed to initialise
pub async fn client<B>(
&self,
operation: &'static str,
) -> Result<ClientService<TracedClient<B>>, ClientInitError>
pub async fn client<B>(&self) -> Result<ClientService<TracedClient<B>>, ClientInitError>
where
B: axum::body::HttpBody + Send,
B::Data: Send,
{
let client = mas_http::make_traced_client::<B>().await?;
let layer = ClientLayer::with_semaphore(operation, self.semaphore.clone());
let layer = ClientLayer::with_semaphore(self.semaphore.clone());
Ok(layer.layer(client))
}
@ -61,11 +58,8 @@ impl HttpClientFactory {
/// # Errors
///
/// Returns an error if the client failed to initialise
pub async fn http_service(
&self,
operation: &'static str,
) -> Result<HttpService, ClientInitError> {
let client = self.client(operation).await?;
pub async fn http_service(&self) -> Result<HttpService, ClientInitError> {
let client = self.client().await?;
let client = (
MapErrLayer::new(BoxError::from),
MapRequestLayer::new(|req: http::Request<_>| req.map(Full::new)),