From e3e4e44367b2f8297fce249a8614604aa971ae81 Mon Sep 17 00:00:00 2001 From: Lennart Kloock Date: Fri, 3 May 2024 00:00:53 +0200 Subject: [PATCH] fix(foundations): spelling --- foundations/examples/src/http.rs | 8 +++---- foundations/examples/src/simple.rs | 14 ++++++------ foundations/macros/src/metrics/mod.rs | 12 +++++----- foundations/src/bootstrap.rs | 4 ++-- foundations/src/lib.rs | 2 +- .../env_filter/directive.rs | 0 .../env_filter/env/builder.rs | 0 .../env_filter/env/directive.rs | 0 .../env_filter/env/field.rs | 0 .../env_filter/env/mod.rs | 0 .../env_filter/mod.rs | 0 .../src/{telementry => telemetry}/logging.rs | 0 .../{telementry => telemetry}/metrics/mod.rs | 0 .../metrics/registries.rs | 0 .../metrics/serde/mod.rs | 0 .../metrics/serde/top.rs | 0 .../metrics/serde/value.rs | 0 .../src/{telementry => telemetry}/mod.rs | 2 +- .../opentelemetry/exporter.rs | 22 +++++++++---------- .../opentelemetry/layer.rs | 0 .../opentelemetry/mod.rs | 0 .../opentelemetry/node.rs | 0 .../opentelemetry/span_ext.rs | 0 .../{telementry => telemetry}/pprof/cpu.rs | 0 .../{telementry => telemetry}/pprof/heap.rs | 0 .../{telementry => telemetry}/pprof/mod.rs | 0 .../src/{telementry => telemetry}/server.rs | 6 ++--- .../src/{telementry => telemetry}/settings.rs | 20 ++++++++--------- 28 files changed, 45 insertions(+), 45 deletions(-) rename foundations/src/{telementry => telemetry}/env_filter/directive.rs (100%) rename foundations/src/{telementry => telemetry}/env_filter/env/builder.rs (100%) rename foundations/src/{telementry => telemetry}/env_filter/env/directive.rs (100%) rename foundations/src/{telementry => telemetry}/env_filter/env/field.rs (100%) rename foundations/src/{telementry => telemetry}/env_filter/env/mod.rs (100%) rename foundations/src/{telementry => telemetry}/env_filter/mod.rs (100%) rename foundations/src/{telementry => telemetry}/logging.rs (100%) rename foundations/src/{telementry => telemetry}/metrics/mod.rs (100%) rename foundations/src/{telementry => telemetry}/metrics/registries.rs (100%) rename foundations/src/{telementry => telemetry}/metrics/serde/mod.rs (100%) rename foundations/src/{telementry => telemetry}/metrics/serde/top.rs (100%) rename foundations/src/{telementry => telemetry}/metrics/serde/value.rs (100%) rename foundations/src/{telementry => telemetry}/mod.rs (96%) rename foundations/src/{telementry => telemetry}/opentelemetry/exporter.rs (90%) rename foundations/src/{telementry => telemetry}/opentelemetry/layer.rs (100%) rename foundations/src/{telementry => telemetry}/opentelemetry/mod.rs (100%) rename foundations/src/{telementry => telemetry}/opentelemetry/node.rs (100%) rename foundations/src/{telementry => telemetry}/opentelemetry/span_ext.rs (100%) rename foundations/src/{telementry => telemetry}/pprof/cpu.rs (100%) rename foundations/src/{telementry => telemetry}/pprof/heap.rs (100%) rename foundations/src/{telementry => telemetry}/pprof/mod.rs (100%) rename foundations/src/{telementry => telemetry}/server.rs (97%) rename foundations/src/{telementry => telemetry}/settings.rs (95%) diff --git a/foundations/examples/src/http.rs b/foundations/examples/src/http.rs index 67282130..6de7e2ce 100644 --- a/foundations/examples/src/http.rs +++ b/foundations/examples/src/http.rs @@ -11,8 +11,8 @@ use scuffle_foundations::bootstrap::{bootstrap, Bootstrap, RuntimeSettings}; use scuffle_foundations::runtime::spawn; use scuffle_foundations::settings::auto_settings; use scuffle_foundations::settings::cli::Matches; -use scuffle_foundations::telementry::opentelemetry::OpenTelemetrySpanExt; -use scuffle_foundations::telementry::settings::TelementrySettings; +use scuffle_foundations::telemetry::opentelemetry::OpenTelemetrySpanExt; +use scuffle_foundations::telemetry::settings::TelemetrySettings; use scuffle_foundations::{wrapped, BootstrapResult}; use socket2::Socket; use tokio::net::{TcpListener, TcpStream}; @@ -22,7 +22,7 @@ type Body = http_body_util::Full; #[auto_settings] #[serde(default)] struct Config { - telemetry: TelementrySettings, + telemetry: TelemetrySettings, runtime: RuntimeSettings, #[settings(default = SocketAddr::from(([127, 0, 0, 1], 8080)))] bind: SocketAddr, @@ -37,7 +37,7 @@ impl Bootstrap for Config { self.runtime.clone() } - fn telemetry_config(&self) -> Option { + fn telemetry_config(&self) -> Option { Some(self.telemetry.clone()) } } diff --git a/foundations/examples/src/simple.rs b/foundations/examples/src/simple.rs index fc2eea1f..8e544be1 100644 --- a/foundations/examples/src/simple.rs +++ b/foundations/examples/src/simple.rs @@ -1,14 +1,14 @@ use scuffle_foundations::bootstrap::{bootstrap, Bootstrap, RuntimeSettings}; use scuffle_foundations::settings::auto_settings; use scuffle_foundations::settings::cli::Matches; -use scuffle_foundations::telementry::metrics::metrics; -use scuffle_foundations::telementry::settings::TelementrySettings; +use scuffle_foundations::telemetry::metrics::metrics; +use scuffle_foundations::telemetry::settings::TelemetrySettings; #[metrics] mod http_server { use std::sync::Arc; - use scuffle_foundations::telementry::metrics::prometheus_client::metrics::counter::Counter; + use scuffle_foundations::telemetry::metrics::prometheus_client::metrics::counter::Counter; /// Number of active client connections. pub fn active_connections(endpoint_name: &str) -> Counter; @@ -26,8 +26,8 @@ mod http_server { #[auto_settings] pub struct HttpServerSettings { - /// Telementry Settings - telementry: TelementrySettings, + /// Telemetry Settings + telemetry: TelemetrySettings, /// Runtime Settings runtime: RuntimeSettings, } @@ -39,8 +39,8 @@ impl Bootstrap for HttpServerSettings { self.runtime.clone() } - fn telemetry_config(&self) -> Option { - Some(self.telementry.clone()) + fn telemetry_config(&self) -> Option { + Some(self.telemetry.clone()) } } diff --git a/foundations/macros/src/metrics/mod.rs b/foundations/macros/src/metrics/mod.rs index 6f8bb5a9..c191e459 100644 --- a/foundations/macros/src/metrics/mod.rs +++ b/foundations/macros/src/metrics/mod.rs @@ -334,7 +334,7 @@ fn metric_function( let metric_ident = if has_args { quote::quote! { - #crate_path::telementry::metrics::serde::Family<__Args, #ret> + #crate_path::telemetry::metrics::serde::Family<__Args, #ret> } } else { quote::quote! { @@ -347,14 +347,14 @@ fn metric_function( let constructor = quote::quote! { { (|| { - #crate_path::telementry::metrics::MetricBuilder::build(&#builder) + #crate_path::telemetry::metrics::MetricBuilder::build(&#builder) }) as fn() -> #ret } }; if has_args { quote::quote! { - #crate_path::telementry::metrics::serde::Family::new_with_constructor(#constructor) + #crate_path::telemetry::metrics::serde::Family::new_with_constructor(#constructor) } } else { quote::quote! { @@ -364,7 +364,7 @@ fn metric_function( } else { if has_args { quote::quote! { - #crate_path::telementry::metrics::serde::Family::default() + #crate_path::telemetry::metrics::serde::Family::default() } } else { quote::quote! { @@ -375,11 +375,11 @@ fn metric_function( let registry = if item.attrs.options.optional || options.optional { quote::quote! { - #crate_path::telementry::metrics::registries::Registries::get_optional_sub_registry(stringify!(#module_name)) + #crate_path::telemetry::metrics::registries::Registries::get_optional_sub_registry(stringify!(#module_name)) } } else { quote::quote! { - #crate_path::telementry::metrics::registries::Registries::get_main_sub_registry(stringify!(#module_name)) + #crate_path::telemetry::metrics::registries::Registries::get_main_sub_registry(stringify!(#module_name)) } }; diff --git a/foundations/src/bootstrap.rs b/foundations/src/bootstrap.rs index 4a7820b0..98edb0be 100644 --- a/foundations/src/bootstrap.rs +++ b/foundations/src/bootstrap.rs @@ -35,7 +35,7 @@ pub fn bootstrap) -> Fut, Fut: Future { } #[cfg(feature = "_telemetry")] - fn telemetry_config(&self) -> Option { + fn telemetry_config(&self) -> Option { None } diff --git a/foundations/src/lib.rs b/foundations/src/lib.rs index 7fcf0df0..1c0d6009 100644 --- a/foundations/src/lib.rs +++ b/foundations/src/lib.rs @@ -31,7 +31,7 @@ pub mod settings; pub mod bootstrap; #[cfg(feature = "_telemetry")] -pub mod telementry; +pub mod telemetry; #[cfg(feature = "signal")] pub mod signal; diff --git a/foundations/src/telementry/env_filter/directive.rs b/foundations/src/telemetry/env_filter/directive.rs similarity index 100% rename from foundations/src/telementry/env_filter/directive.rs rename to foundations/src/telemetry/env_filter/directive.rs diff --git a/foundations/src/telementry/env_filter/env/builder.rs b/foundations/src/telemetry/env_filter/env/builder.rs similarity index 100% rename from foundations/src/telementry/env_filter/env/builder.rs rename to foundations/src/telemetry/env_filter/env/builder.rs diff --git a/foundations/src/telementry/env_filter/env/directive.rs b/foundations/src/telemetry/env_filter/env/directive.rs similarity index 100% rename from foundations/src/telementry/env_filter/env/directive.rs rename to foundations/src/telemetry/env_filter/env/directive.rs diff --git a/foundations/src/telementry/env_filter/env/field.rs b/foundations/src/telemetry/env_filter/env/field.rs similarity index 100% rename from foundations/src/telementry/env_filter/env/field.rs rename to foundations/src/telemetry/env_filter/env/field.rs diff --git a/foundations/src/telementry/env_filter/env/mod.rs b/foundations/src/telemetry/env_filter/env/mod.rs similarity index 100% rename from foundations/src/telementry/env_filter/env/mod.rs rename to foundations/src/telemetry/env_filter/env/mod.rs diff --git a/foundations/src/telementry/env_filter/mod.rs b/foundations/src/telemetry/env_filter/mod.rs similarity index 100% rename from foundations/src/telementry/env_filter/mod.rs rename to foundations/src/telemetry/env_filter/mod.rs diff --git a/foundations/src/telementry/logging.rs b/foundations/src/telemetry/logging.rs similarity index 100% rename from foundations/src/telementry/logging.rs rename to foundations/src/telemetry/logging.rs diff --git a/foundations/src/telementry/metrics/mod.rs b/foundations/src/telemetry/metrics/mod.rs similarity index 100% rename from foundations/src/telementry/metrics/mod.rs rename to foundations/src/telemetry/metrics/mod.rs diff --git a/foundations/src/telementry/metrics/registries.rs b/foundations/src/telemetry/metrics/registries.rs similarity index 100% rename from foundations/src/telementry/metrics/registries.rs rename to foundations/src/telemetry/metrics/registries.rs diff --git a/foundations/src/telementry/metrics/serde/mod.rs b/foundations/src/telemetry/metrics/serde/mod.rs similarity index 100% rename from foundations/src/telementry/metrics/serde/mod.rs rename to foundations/src/telemetry/metrics/serde/mod.rs diff --git a/foundations/src/telementry/metrics/serde/top.rs b/foundations/src/telemetry/metrics/serde/top.rs similarity index 100% rename from foundations/src/telementry/metrics/serde/top.rs rename to foundations/src/telemetry/metrics/serde/top.rs diff --git a/foundations/src/telementry/metrics/serde/value.rs b/foundations/src/telemetry/metrics/serde/value.rs similarity index 100% rename from foundations/src/telementry/metrics/serde/value.rs rename to foundations/src/telemetry/metrics/serde/value.rs diff --git a/foundations/src/telementry/mod.rs b/foundations/src/telemetry/mod.rs similarity index 96% rename from foundations/src/telementry/mod.rs rename to foundations/src/telemetry/mod.rs index 8dc95bd7..d263b4ba 100644 --- a/foundations/src/telementry/mod.rs +++ b/foundations/src/telemetry/mod.rs @@ -26,7 +26,7 @@ pub mod server; type Underlying = tracing::level_filters::LevelFilter; #[cfg(feature = "env-filter")] -type Underlying = crate::telementry::EnvFilter; +type Underlying = crate::telemetry::EnvFilter; #[derive(Debug)] pub struct LevelFilter(Underlying); diff --git a/foundations/src/telementry/opentelemetry/exporter.rs b/foundations/src/telemetry/opentelemetry/exporter.rs similarity index 90% rename from foundations/src/telementry/opentelemetry/exporter.rs rename to foundations/src/telemetry/opentelemetry/exporter.rs index 3f9ff48f..19623b60 100644 --- a/foundations/src/telementry/opentelemetry/exporter.rs +++ b/foundations/src/telemetry/opentelemetry/exporter.rs @@ -1,7 +1,7 @@ use std::sync::Arc; use itertools::Itertools; -use opentelemetry::trace::TraceError; +use ::opentelemetry::trace::TraceError; use opentelemetry_otlp::SpanExporter; use opentelemetry_sdk::Resource; use thread_local::ThreadLocal; @@ -15,8 +15,8 @@ use super::node::SpanNode; use crate::runtime::spawn; #[cfg(feature = "metrics")] -#[crate::telementry::metrics::metrics(crate_path = "crate")] -mod opentelementry { +#[crate::telemetry::metrics::metrics(crate_path = "crate")] +mod opentelemetry { use prometheus_client::metrics::counter::Counter; #[derive(serde::Serialize, Debug, Clone, Copy, PartialEq, Eq, Hash)] @@ -97,8 +97,8 @@ impl BatchExporter { pub fn with_service_info(&mut self, info: crate::ServiceInfo) -> &mut Self { self.resource.merge(&Resource::new(vec![ - opentelemetry::KeyValue::new("service.name", info.metric_name), - opentelemetry::KeyValue::new("service.version", info.version), + ::opentelemetry::KeyValue::new("service.name", info.metric_name), + ::opentelemetry::KeyValue::new("service.version", info.version), ])); self @@ -177,18 +177,18 @@ fn export_batch(internal: Arc, batch: Vec, pending_per #[cfg(feature = "metrics")] if internal.config.metrics { let reason = match err { - TraceError::ExportTimedOut(_) => opentelementry::SpanDroppedReason::ExportTimeout, - _ => opentelementry::SpanDroppedReason::ExportFailed, + TraceError::ExportTimedOut(_) => opentelemetry::SpanDroppedReason::ExportTimeout, + _ => opentelemetry::SpanDroppedReason::ExportFailed, }; - opentelementry::spans_dropped(reason).inc_by(size as u64); + opentelemetry::spans_dropped(reason).inc_by(size as u64); } (internal.config.error_handler)(err, size); } else { #[cfg(feature = "metrics")] if internal.config.metrics { - opentelementry::spans_exported().inc_by(size as u64); + opentelemetry::spans_exported().inc_by(size as u64); } (internal.config.export_handler)(size); @@ -239,7 +239,7 @@ impl Exporter { #[cfg(feature = "metrics")] if self.internal.config.metrics { - opentelementry::spans_dropped(opentelementry::SpanDroppedReason::ThreadBackpressure) + opentelemetry::spans_dropped(opentelemetry::SpanDroppedReason::ThreadBackpressure) .inc_by(total_dropped as u64); } @@ -285,7 +285,7 @@ impl Exporter { #[cfg(feature = "metrics")] if self.internal.config.metrics { - opentelementry::spans_dropped(opentelementry::SpanDroppedReason::PendingExportBackpressure) + opentelemetry::spans_dropped(opentelemetry::SpanDroppedReason::PendingExportBackpressure) .inc_by(pending_total_dropped as u64); } diff --git a/foundations/src/telementry/opentelemetry/layer.rs b/foundations/src/telemetry/opentelemetry/layer.rs similarity index 100% rename from foundations/src/telementry/opentelemetry/layer.rs rename to foundations/src/telemetry/opentelemetry/layer.rs diff --git a/foundations/src/telementry/opentelemetry/mod.rs b/foundations/src/telemetry/opentelemetry/mod.rs similarity index 100% rename from foundations/src/telementry/opentelemetry/mod.rs rename to foundations/src/telemetry/opentelemetry/mod.rs diff --git a/foundations/src/telementry/opentelemetry/node.rs b/foundations/src/telemetry/opentelemetry/node.rs similarity index 100% rename from foundations/src/telementry/opentelemetry/node.rs rename to foundations/src/telemetry/opentelemetry/node.rs diff --git a/foundations/src/telementry/opentelemetry/span_ext.rs b/foundations/src/telemetry/opentelemetry/span_ext.rs similarity index 100% rename from foundations/src/telementry/opentelemetry/span_ext.rs rename to foundations/src/telemetry/opentelemetry/span_ext.rs diff --git a/foundations/src/telementry/pprof/cpu.rs b/foundations/src/telemetry/pprof/cpu.rs similarity index 100% rename from foundations/src/telementry/pprof/cpu.rs rename to foundations/src/telemetry/pprof/cpu.rs diff --git a/foundations/src/telementry/pprof/heap.rs b/foundations/src/telemetry/pprof/heap.rs similarity index 100% rename from foundations/src/telementry/pprof/heap.rs rename to foundations/src/telemetry/pprof/heap.rs diff --git a/foundations/src/telementry/pprof/mod.rs b/foundations/src/telemetry/pprof/mod.rs similarity index 100% rename from foundations/src/telementry/pprof/mod.rs rename to foundations/src/telemetry/pprof/mod.rs diff --git a/foundations/src/telementry/server.rs b/foundations/src/telemetry/server.rs similarity index 97% rename from foundations/src/telementry/server.rs rename to foundations/src/telemetry/server.rs index d1d88b75..0d1e3d2b 100644 --- a/foundations/src/telementry/server.rs +++ b/foundations/src/telemetry/server.rs @@ -76,7 +76,7 @@ async fn pprof_cpu( } match tokio::task::spawn_blocking(move || { - crate::telementry::pprof::Cpu::new(query.frequency, &query.blocklist) + crate::telemetry::pprof::Cpu::new(query.frequency, &query.blocklist) .capture(std::time::Duration::from_secs(query.seconds as u64)) }) .await @@ -106,7 +106,7 @@ async fn pprof_cpu( #[cfg(feature = "pprof-heap")] async fn pprof_heap() -> axum::response::Response { - match tokio::task::spawn_blocking(|| crate::telementry::pprof::Heap::new().capture()).await { + match tokio::task::spawn_blocking(|| crate::telemetry::pprof::Heap::new().capture()).await { Ok(Ok(contents)) => axum::response::Response::builder() .status(axum::http::StatusCode::OK) .header("content-type", "application/octet-stream") @@ -140,7 +140,7 @@ struct MetricsQuery { async fn metrics( axum::extract::Query(query): axum::extract::Query, ) -> axum::response::Response { - match tokio::task::spawn_blocking(move || crate::telementry::metrics::collect(query.optional)).await { + match tokio::task::spawn_blocking(move || crate::telemetry::metrics::collect(query.optional)).await { Ok(Ok(contents)) => axum::response::Response::builder() .status(axum::http::StatusCode::OK) .header("content-type", "text/plain") diff --git a/foundations/src/telementry/settings.rs b/foundations/src/telemetry/settings.rs similarity index 95% rename from foundations/src/telementry/settings.rs rename to foundations/src/telemetry/settings.rs index c2e61a9d..2c7406b1 100644 --- a/foundations/src/telementry/settings.rs +++ b/foundations/src/telemetry/settings.rs @@ -9,11 +9,11 @@ use opentelemetry_sdk::Resource; use tracing_subscriber::fmt::time::{ChronoLocal, ChronoUtc}; #[cfg(feature = "logging")] -use crate::telementry::logging::TimeFormatter; -use crate::telementry::opentelemetry::{complex_rate_sampler, BatchExporter, Sampler, SpanObserver}; +use crate::telemetry::logging::TimeFormatter; +use crate::telemetry::opentelemetry::{complex_rate_sampler, BatchExporter, Sampler, SpanObserver}; #[crate::settings::auto_settings(crate_path = "crate")] -pub struct TelementrySettings { +pub struct TelemetrySettings { /// Settings for metric exporting. pub metrics: MetricsSettings, /// Settings for opentelemetry span exporting. @@ -271,10 +271,10 @@ pub struct ServerSettings { pub health_timeout: Option, } -pub async fn init(info: crate::ServiceInfo, settings: TelementrySettings) { +pub async fn init(info: crate::ServiceInfo, settings: TelemetrySettings) { #[cfg(feature = "metrics")] if settings.metrics.enabled { - crate::telementry::metrics::init(info, &settings.metrics.labels); + crate::telemetry::metrics::init(info, &settings.metrics.labels); } #[cfg(any(feature = "opentelemetry", feature = "logging"))] @@ -282,7 +282,7 @@ pub async fn init(info: crate::ServiceInfo, settings: TelementrySettings) { #[cfg(feature = "opentelemetry")] let opentelemetry = if settings.opentelemetry.enabled { Some( - crate::telementry::opentelemetry::layer( + crate::telemetry::opentelemetry::layer( SpanObserver { max_unprocessed_spans_per_thread: settings.opentelemetry.max_backpressure, sampler: match settings.opentelemetry.sampler { @@ -326,7 +326,7 @@ pub async fn init(info: crate::ServiceInfo, settings: TelementrySettings) { Resource::new(kv) }, drop_handler: { - const DROPPED_SPANS_ERROR: &str = "opentelementry exporter dropped spans due to backpressure"; + const DROPPED_SPANS_ERROR: &str = "opentelemetry exporter dropped spans due to backpressure"; match settings.opentelemetry.logging.dropped_spans { OpentelemetrySettingsLoggingLevel::Error => Box::new(|count| { @@ -348,7 +348,7 @@ pub async fn init(info: crate::ServiceInfo, settings: TelementrySettings) { } }, error_handler: { - const EXPORTER_ERROR: &str = "opentelementry exporter failed to export spans"; + const EXPORTER_ERROR: &str = "opentelemetry exporter failed to export spans"; match settings.opentelemetry.logging.exporter_errors { OpentelemetrySettingsLoggingLevel::Error => Box::new(|err, count| { @@ -370,7 +370,7 @@ pub async fn init(info: crate::ServiceInfo, settings: TelementrySettings) { } }, export_handler: { - const EXPORTER_SUCCESS: &str = "opentelementry exporter successfully exported spans"; + const EXPORTER_SUCCESS: &str = "opentelemetry exporter successfully exported spans"; match settings.opentelemetry.logging.exporter_success { OpentelemetrySettingsLoggingLevel::Error => Box::new(|count| { @@ -455,7 +455,7 @@ pub async fn init(info: crate::ServiceInfo, settings: TelementrySettings) { use crate::runtime::spawn; spawn(async move { - match crate::telementry::server::init(super::server::ServerSettings { + match crate::telemetry::server::init(super::server::ServerSettings { bind: settings.server.bind, #[cfg(feature = "metrics")] metrics_path: settings.server.metrics_path,