File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed
src/api/Elastic.Documentation.Api.Infrastructure/OpenTelemetry Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -105,15 +105,18 @@ private static void ConfigureServiceVersionAttributes<TBuilder>(TBuilder builder
105105 where TBuilder : IHostApplicationBuilder
106106 {
107107
108- var serviceVersion = Assembly . GetExecutingAssembly ( )
108+ var informationalVersion = Assembly . GetExecutingAssembly ( )
109109 . GetCustomAttribute < AssemblyInformationalVersionAttribute > ( ) ? . InformationalVersion ;
110110
111- if ( serviceVersion is null )
111+ if ( informationalVersion is null )
112112 {
113113 Console . WriteLine ( $ "Unable to determine service.version from { nameof ( AssemblyInformationalVersionAttribute ) } . Skipping setting it.") ;
114114 return ;
115115 }
116116
117+ // Extract just major.minor.patch by removing prerelease tags (-) and build metadata (+)
118+ var serviceVersion = informationalVersion . Split ( [ '+' , '-' ] ) [ 0 ] ;
119+
117120 var versionAttribute = new KeyValuePair < string , object > ( "service.version" , serviceVersion ) ;
118121
119122 _ = builder . Services . ConfigureOpenTelemetryTracerProvider ( tracerProviderBuilder =>
You can’t perform that action at this time.
0 commit comments