From f78156c6a496535332bbc17cb42b68891c1f55b8 Mon Sep 17 00:00:00 2001 From: Nikita Vilunov Date: Fri, 26 Apr 2024 12:12:40 +0200 Subject: [PATCH] small fix --- config.toml | 4 ---- crates/lavina-core/src/room.rs | 3 +++ docs/running.md | 5 +++++ src/main.rs | 3 +-- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/config.toml b/config.toml index e1fc123..4765aa0 100644 --- a/config.toml +++ b/config.toml @@ -13,7 +13,3 @@ hostname = "localhost" [storage] db_path = "db.sqlite" - -[tracing] -endpoint = "http://localhost:4317" -service_name = "lavina" diff --git a/crates/lavina-core/src/room.rs b/crates/lavina-core/src/room.rs index 49de286..17a463b 100644 --- a/crates/lavina-core/src/room.rs +++ b/crates/lavina-core/src/room.rs @@ -84,11 +84,13 @@ impl RoomRegistry { } } + #[tracing::instrument(skip(self), name = "RoomRegistry::get_room")] pub async fn get_room(&self, room_id: &RoomId) -> Option { let mut inner = self.0.write().await; inner.get_or_load_room(room_id).await.unwrap() } + #[tracing::instrument(skip(self), name = "RoomRegistry::get_all_rooms")] pub async fn get_all_rooms(&self) -> Vec { let handles = { let inner = self.0.read().await; @@ -110,6 +112,7 @@ struct RoomRegistryInner { } impl RoomRegistryInner { + #[tracing::instrument(skip(self), name = "RoomRegistryInner::get_or_load_room")] async fn get_or_load_room(&mut self, room_id: &RoomId) -> Result> { if let Some(room_handle) = self.rooms.get(room_id) { log::debug!("Room {} was loaded already", &room_id.0); diff --git a/docs/running.md b/docs/running.md index ad422a1..cd5efbf 100644 --- a/docs/running.md +++ b/docs/running.md @@ -23,6 +23,11 @@ hostname = "localhost" [storage] db_path = "db.sqlite" + +[tracing] +# otlp grpc endpoint +endpoint = "http://localhost:4317" +service_name = "lavina" ``` ## With Docker Compose diff --git a/src/main.rs b/src/main.rs index 90214b7..d72055b 100644 --- a/src/main.rs +++ b/src/main.rs @@ -8,13 +8,12 @@ use figment::providers::Format; use figment::{providers::Toml, Figment}; use opentelemetry::KeyValue; use opentelemetry_otlp::WithExportConfig; -use opentelemetry_sdk::trace::{BatchConfig, RandomIdGenerator, Sampler, TracerProvider}; +use opentelemetry_sdk::trace::{BatchConfig, RandomIdGenerator, Sampler}; use opentelemetry_sdk::{runtime, Resource}; use opentelemetry_semantic_conventions::resource::SERVICE_NAME; use opentelemetry_semantic_conventions::SCHEMA_URL; use prometheus::Registry as MetricsRegistry; use serde::Deserialize; -use tracing::level_filters::LevelFilter; use tracing_opentelemetry::OpenTelemetryLayer; use tracing_subscriber::fmt::Subscriber; use tracing_subscriber::prelude::*;