File tree Expand file tree Collapse file tree 2 files changed +7
-16
lines changed
Expand file tree Collapse file tree 2 files changed +7
-16
lines changed Original file line number Diff line number Diff line change 11use anyhow:: Result ;
22use clap:: { Parser , Subcommand } ;
3- use opentelemetry:: { trace:: TracerProvider , KeyValue } ;
4- use opentelemetry_otlp:: WithExportConfig ;
5- use opentelemetry_sdk:: Resource ;
3+ use opentelemetry:: trace:: TracerProvider ;
64use tracing_subscriber:: prelude:: * ;
75
86mod config;
@@ -129,19 +127,12 @@ async fn main() -> Result<()> {
129127 )
130128 } ;
131129
132- let otlp_host = match std:: env:: var ( "OTEL_EXPORTER_OTLP_ENDPOINT" ) {
133- Ok ( val) => val,
134- Err ( _) => "http://localhost:4317" . to_string ( ) ,
135- } ;
136-
137- let provider = opentelemetry_otlp:: new_pipeline ( )
138- . tracing ( )
139- . with_exporter ( opentelemetry_otlp:: new_exporter ( ) . tonic ( ) . with_endpoint ( otlp_host) )
140- . with_trace_config (
141- opentelemetry_sdk:: trace:: Config :: default ( )
142- . with_resource ( Resource :: new ( vec ! [ KeyValue :: new( "service.name" , "machine-api" ) ] ) ) ,
130+ let provider = opentelemetry_sdk:: trace:: TracerProvider :: builder ( )
131+ . with_batch_exporter (
132+ opentelemetry_otlp:: SpanExporter :: builder ( ) . with_tonic ( ) . build ( ) ?,
133+ opentelemetry_sdk:: runtime:: Tokio ,
143134 )
144- . install_batch ( opentelemetry_sdk :: runtime :: Tokio ) ? ;
135+ . build ( ) ;
145136
146137 opentelemetry:: global:: set_tracer_provider ( provider. clone ( ) ) ;
147138 let tracer = provider. tracer ( "tracing-otel-subscriber" ) ;
Original file line number Diff line number Diff line change @@ -84,7 +84,7 @@ pub async fn create_server(
8484/// Get the OpenAPI specification for the server.
8585pub fn get_openapi ( api : & mut ApiDescription < Arc < Context > > ) -> Result < serde_json:: Value > {
8686 // Create the API schema.
87- let mut definition = api. openapi ( "machine-api" , clap:: crate_version!( ) ) ;
87+ let mut definition = api. openapi ( "machine-api" , clap:: crate_version!( ) . parse ( ) ? ) ;
8888 definition
8989 . description ( "" )
9090 . contact_url ( "https://zoo.dev" )
You can’t perform that action at this time.
0 commit comments