Skip to content

Commit

Permalink
in response
Browse files Browse the repository at this point in the history
  • Loading branch information
noyoshi committed Aug 10, 2024
1 parent f415965 commit 1cdbff9
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions router/src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ use axum::response::sse::{Event, KeepAlive, Sse};
use axum::response::{IntoResponse, Response};
use axum::routing::{get, post};
use axum::{http, Json, Router};
use axum_tracing_opentelemetry::middleware::OtelAxumLayer;
use axum_tracing_opentelemetry::middleware::{OtelAxumLayer, OtelInResponseLayer};
use clap::error;
use futures::stream::StreamExt;
use futures::Stream;
Expand All @@ -30,6 +30,7 @@ use metrics_exporter_prometheus::{Matcher, PrometheusBuilder, PrometheusHandle};
use once_cell::sync::OnceCell;
use reqwest_middleware::{ClientBuilder, ClientWithMiddleware};
use reqwest_retry::{policies::ExponentialBackoff, RetryTransientMiddleware};
use reqwest::Client;
use std::convert::Infallible;
use std::net::SocketAddr;
use std::sync::atomic::AtomicBool;
Expand Down Expand Up @@ -960,7 +961,7 @@ async fn request_logger(
tracing::info!("Request logging enabled, sending logs to {url_string}");

let retry_policy = ExponentialBackoff::builder().build_with_max_retries(3);
let client = ClientBuilder::new(reqwest::Client::new())
let client = ClientBuilder::new(Client::new())
.with(RetryTransientMiddleware::new_with_policy(retry_policy))
.build();
while let Some((tokens, api_token, model_id)) = rx.recv().await {
Expand Down Expand Up @@ -1256,6 +1257,7 @@ pub async fn run(
.layer(Extension(infer))
.layer(Extension(prom_handle.clone()))
.layer(OtelAxumLayer::default())
.layer(OtelInResponseLayer::default())
.layer(cors_layer)
.layer(Extension(cloned_tokenizer));

Expand Down

0 comments on commit 1cdbff9

Please sign in to comment.