mirror of
https://gitlab.computer.surgery/matrix/grapevine.git
synced 2025-12-16 15:21:24 +01:00
drop dependency on once-cell
This commit is contained in:
parent
a550d8db1f
commit
e74c8687f5
4 changed files with 12 additions and 10 deletions
1
Cargo.lock
generated
1
Cargo.lock
generated
|
|
@ -888,7 +888,6 @@ dependencies = [
|
|||
"lru-cache",
|
||||
"nix",
|
||||
"num_cpus",
|
||||
"once_cell",
|
||||
"opentelemetry",
|
||||
"opentelemetry-jaeger-propagator",
|
||||
"opentelemetry-otlp",
|
||||
|
|
|
|||
|
|
@ -105,7 +105,6 @@ image = { version = "0.25.2", default-features = false, features = ["jpeg", "png
|
|||
jsonwebtoken = "9.3.0"
|
||||
lru-cache = "0.1.2"
|
||||
num_cpus = "1.16.0"
|
||||
once_cell = "1.19.0"
|
||||
opentelemetry = "0.24.0"
|
||||
opentelemetry-jaeger-propagator = "0.3.0"
|
||||
opentelemetry-otlp = "0.17.0"
|
||||
|
|
|
|||
|
|
@ -4,9 +4,9 @@ use std::{
|
|||
fmt::{self, Display},
|
||||
net::{IpAddr, Ipv4Addr},
|
||||
path::{Path, PathBuf},
|
||||
sync::LazyLock,
|
||||
};
|
||||
|
||||
use once_cell::sync::Lazy;
|
||||
use reqwest::Url;
|
||||
use ruma::{
|
||||
api::federation::discovery::OldVerifyKey, OwnedServerName,
|
||||
|
|
@ -24,8 +24,8 @@ pub(crate) use env_filter_clone::EnvFilterClone;
|
|||
use proxy::ProxyConfig;
|
||||
|
||||
/// The default configuration file path
|
||||
pub(crate) static DEFAULT_PATH: Lazy<PathBuf> =
|
||||
Lazy::new(|| [env!("CARGO_PKG_NAME"), "config.toml"].iter().collect());
|
||||
pub(crate) static DEFAULT_PATH: LazyLock<PathBuf> =
|
||||
LazyLock::new(|| [env!("CARGO_PKG_NAME"), "config.toml"].iter().collect());
|
||||
|
||||
#[allow(clippy::struct_excessive_bools)]
|
||||
#[derive(Debug, Deserialize)]
|
||||
|
|
|
|||
|
|
@ -1,7 +1,12 @@
|
|||
//! Facilities for observing runtime behavior
|
||||
#![warn(missing_docs, clippy::missing_docs_in_private_items)]
|
||||
|
||||
use std::{collections::HashSet, fs::File, io::BufWriter, sync::Arc};
|
||||
use std::{
|
||||
collections::HashSet,
|
||||
fs::File,
|
||||
io::BufWriter,
|
||||
sync::{Arc, LazyLock},
|
||||
};
|
||||
|
||||
use axum::{
|
||||
extract::{MatchedPath, Request},
|
||||
|
|
@ -9,7 +14,6 @@ use axum::{
|
|||
response::Response,
|
||||
};
|
||||
use http::Method;
|
||||
use once_cell::sync::Lazy;
|
||||
use opentelemetry::{metrics::MeterProvider, trace::TracerProvider, KeyValue};
|
||||
use opentelemetry_otlp::WithExportConfig;
|
||||
use opentelemetry_sdk::{
|
||||
|
|
@ -34,7 +38,7 @@ use crate::{
|
|||
};
|
||||
|
||||
/// Globally accessible metrics state
|
||||
pub(crate) static METRICS: Lazy<Metrics> = Lazy::new(Metrics::new);
|
||||
pub(crate) static METRICS: LazyLock<Metrics> = LazyLock::new(Metrics::new);
|
||||
|
||||
/// Cleans up resources relating to observability when [`Drop`]ped
|
||||
pub(crate) struct Guard {
|
||||
|
|
@ -385,8 +389,8 @@ impl Metrics {
|
|||
/// Track HTTP metrics by converting this into an [`axum`] layer
|
||||
pub(crate) async fn http_metrics_layer(req: Request, next: Next) -> Response {
|
||||
/// Routes that should not be included in the metrics
|
||||
static IGNORED_ROUTES: Lazy<HashSet<(&Method, &str)>> =
|
||||
Lazy::new(|| [(&Method::GET, "/metrics")].into_iter().collect());
|
||||
static IGNORED_ROUTES: LazyLock<HashSet<(&Method, &str)>> =
|
||||
LazyLock::new(|| [(&Method::GET, "/metrics")].into_iter().collect());
|
||||
|
||||
let matched_path =
|
||||
req.extensions().get::<MatchedPath>().map(|x| x.as_str().to_owned());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue