Skip to content

Commit

Permalink
chore: upgrade tracing
Browse files Browse the repository at this point in the history
  • Loading branch information
Randoooom committed Jul 29, 2024
1 parent e831ccb commit 45da48b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
9 changes: 5 additions & 4 deletions src/otlp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

use crate::prelude::*;
use opentelemetry::{global, KeyValue};
use opentelemetry::{global, trace::TracerProvider, KeyValue};
use opentelemetry_http::{HeaderExtractor, Request};
use opentelemetry_otlp::WithExportConfig;
use opentelemetry_sdk::{propagation::TraceContextPropagator, Resource};
Expand All @@ -31,7 +31,7 @@ use tower_http::{
trace::{MakeSpan, TraceLayer},
};
use tracing::Span;
use tracing_opentelemetry::OpenTelemetrySpanExt;
use tracing_opentelemetry::{OpenTelemetryLayer, OpenTelemetrySpanExt};
use tracing_subscriber::layer::SubscriberExt;

pub fn init_tracing() {
Expand All @@ -58,8 +58,9 @@ pub fn init_tracing() {
.install_batch(opentelemetry_sdk::runtime::Tokio)
.unwrap();

let layer = tracing_opentelemetry::layer().with_tracer(tracer_provider);
let subscriber = subscriber.with(layer);
let subscriber = subscriber.with(OpenTelemetryLayer::new(
tracer_provider.tracer("feedback-fusion"),
));
tracing::subscriber::set_global_default(subscriber).ok();
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/services/v1/response.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ pub async fn get_responses(
"Select responses by id"
)?
.into_iter()
.group_by(|value| value.response().clone())
.chunk_by(|value| value.response().clone())
.into_iter()
.map(|(key, value)| {
let value = FieldResponseList {
Expand Down

0 comments on commit 45da48b

Please sign in to comment.