...
e) http://localhost:16686/ Load Jaeger UI, a1-pms traces, and a sample of the last call would be:
Steps Taken and Challenges:
Adding Telemetry to a1policymanagementservice: The application uses the WebClient from SpringWebflux to contact from the northbound interface a southbound interface (for the latter a A1-OSC simulator has been used).
...
And then use var context = ApplicationContextProvider.getApplicationContext().getBean(OtelConfig.class); In the non Spring class, and if tracing is enabled to add the tracing filters.
4. The ApplicationContextProvider class got removed, because it can cause issues on different environment. The class during start up time, in rare cases, was null (if the dependant classes were initialized first). So the approach changed into wrapping the AsyncWebClient build function into a @Service with the Bean SpringWebfluxTelemetry in @Autowired(required = false) in case the telemetry is disabled an the bean does not start
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
@Service @DependsOn({"otelConfig"}) public class WebClientUtil { private static OtelConfig otelConfig; private static SpringWebfluxTelemetry springWebfluxTelemetry; public WebClientUtil(OtelConfig otelConfig, @Autowired(required = false) SpringWebfluxTelemetry springWebfluxTelemetry) { WebClientUtil.otelConfig = otelConfig; if (otelConfig.isTracingEnabled()) { WebClientUtil.springWebfluxTelemetry = springWebfluxTelemetry; } } |
5. Used opentelemetry-springboot-starter, we noticed more information getting traced automatically if we enabled this dependecy. So we control this dependency in the application yaml under the otel properties.
...