File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed
Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -108,9 +108,30 @@ pub(crate) fn initialize_telemetry(
108108 . filter ( |_| config. otel_export_metrics ) ;
109109 let metrics_provider = init_metrics ( otel_metrics_endpoint) ?;
110110
111+ register_service_info ( ) ;
112+
111113 Ok ( ( metrics_provider, logs_provider) )
112114}
113115
116+ // MARK: Service Info
117+
118+ fn register_service_info ( ) {
119+ static OTEL_SERVICE_INFO : LazyLock < Gauge < u64 > > = LazyLock :: new ( || {
120+ opentelemetry:: global:: meter ( CARGO_CRATE_NAME )
121+ . u64_gauge ( "s3_cache.info" )
122+ . with_description ( "Service build and runtime information" )
123+ . build ( )
124+ } ) ;
125+
126+ OTEL_SERVICE_INFO . record (
127+ 1 ,
128+ & [
129+ KeyValue :: new ( "version" , env ! ( "CARGO_PKG_VERSION" ) ) ,
130+ KeyValue :: new ( "host.name" , HOSTNAME . clone ( ) ) ,
131+ ] ,
132+ ) ;
133+ }
134+
114135fn init_logs (
115136 otel_grpc_endpoint_url : Option < & str > ,
116137) -> crate :: Result < Option < opentelemetry_sdk:: logs:: SdkLoggerProvider > > {
You can’t perform that action at this time.
0 commit comments