forked from lavina/lavina
small fix
This commit is contained in:
parent
cca30d5152
commit
f78156c6a4
|
@ -13,7 +13,3 @@ hostname = "localhost"
|
|||
|
||||
[storage]
|
||||
db_path = "db.sqlite"
|
||||
|
||||
[tracing]
|
||||
endpoint = "http://localhost:4317"
|
||||
service_name = "lavina"
|
||||
|
|
|
@ -84,11 +84,13 @@ impl RoomRegistry {
|
|||
}
|
||||
}
|
||||
|
||||
#[tracing::instrument(skip(self), name = "RoomRegistry::get_room")]
|
||||
pub async fn get_room(&self, room_id: &RoomId) -> Option<RoomHandle> {
|
||||
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<RoomInfo> {
|
||||
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<Option<RoomHandle>> {
|
||||
if let Some(room_handle) = self.rooms.get(room_id) {
|
||||
log::debug!("Room {} was loaded already", &room_id.0);
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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::*;
|
||||
|
|
Loading…
Reference in New Issue