Repository navigation
fix(config): idp-core observability #168
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
foukou19
wants to merge
33
commits into
main
Choose a base branch
from
feat/idp-core-observability
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+1,158
−290
Open
Changes from 26 commits
Commits
Show all changes
33 commits
Select commit
Hold shift + click to select a range
b98b630
feat(config): update OpenTelemetry OTLP
foukou19 76f3ec9
feat(config): Adapt webhooks security configuration
foukou19 bf81dd8
fix: resolution conflit sur webhooks.md
foukou19 e46ae70
feat(config): update webhook.md
foukou19 4ee4d47
Merge branch 'main' into feat/idp-core-observability-otel-starter
foukou19 bb69f19
feat(config): update application.yaml
foukou19 6a1d961
Update docs/src/features/webhooks.md
foukou19 fee9111
feat(config): update application.yaml
foukou19 92d43ba
feat(config): update application.yaml
foukou19 5924d23
feat(observability): add custom webhook security metrics
foukou19 4bad155
feat(observability): add custom webhook security metrics
foukou19 a598f66
feat(config): add custom webhook ingestion metrics
foukou19 4f91fed
Merge branch 'main' into feat/idp-core-observability
foukou19 ad98b66
feat(config): centralize webhook metrics and tracing
foukou19 372e20f
Merge branch 'main' into feat/idp-core-observability
foukou19 d55eb94
feat(config): centralize webhook metrics and tracing
foukou19 7d67e93
feat(config): update webhook metrics
foukou19 ec92e1d
feat(config): update camel tracing configuration
foukou19 7059a37
feat(config): update CamelTracingConfiguration
foukou19 04fe456
feat(config): update EntityController.java
foukou19 556bae2
Merge branch 'main' into feat/idp-core-observability
foukou19 7a32662
feat(config): update EntityController.java
foukou19 5530fae
Merge branch 'main' into feat/idp-core-observability
foukou19 eaea15b
feat(config): update EntityController.java
foukou19 1226447
feat(config): Keep Camel Micrometer route metrics active
foukou19 d32fb09
feat(config): attach micrometer route policy factory to camel context
foukou19 57e617d
feat(config): separate Camel OTel tracing from Micrometer OTLP metric…
foukou19 00b757a
feat(config): remove Camel Micrometer metrics scope from this PR
foukou19 48c55c4
Merge branch 'main' into feat/idp-core-observability
foukou19 4e512fd
Merge branch 'main' into feat/idp-core-observability
brandPittCode 8f47512
Merge branch 'main' into feat/idp-core-observability
brandPittCode 9371a07
feat(config): Centralize ingestion metric constants and typed attribu…
foukou19 8853bbd
feat(config): Centralize ingestion metric constants and typed attribu…
foukou19 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
73 changes: 73 additions & 0 deletions
73
...n/idp_core/infrastructure/adapters/ingestion/configuration/CamelTracingConfiguration.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,73 @@ | ||||||||||||||||||||||||||
| package com.decathlon.idp_core.infrastructure.adapters.ingestion.configuration; | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| import org.apache.camel.CamelContext; | ||||||||||||||||||||||||||
| import org.apache.camel.component.micrometer.eventnotifier.MicrometerExchangeEventNotifier; | ||||||||||||||||||||||||||
| import org.apache.camel.component.micrometer.eventnotifier.MicrometerRouteEventNotifier; | ||||||||||||||||||||||||||
| import org.apache.camel.component.micrometer.messagehistory.MicrometerMessageHistoryFactory; | ||||||||||||||||||||||||||
| import org.apache.camel.component.micrometer.routepolicy.MicrometerRoutePolicyFactory; | ||||||||||||||||||||||||||
| import org.apache.camel.spring.boot.CamelContextConfiguration; | ||||||||||||||||||||||||||
| import org.springframework.beans.factory.ObjectProvider; | ||||||||||||||||||||||||||
| import org.springframework.context.annotation.Bean; | ||||||||||||||||||||||||||
| import org.springframework.context.annotation.Configuration; | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| import io.micrometer.core.instrument.MeterRegistry; | ||||||||||||||||||||||||||
| import io.opentelemetry.api.OpenTelemetry; | ||||||||||||||||||||||||||
| import io.opentelemetry.api.trace.Tracer; | ||||||||||||||||||||||||||
| import io.opentelemetry.context.propagation.ContextPropagators; | ||||||||||||||||||||||||||
| import lombok.extern.slf4j.Slf4j; | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| @Configuration | ||||||||||||||||||||||||||
| @Slf4j | ||||||||||||||||||||||||||
| public class CamelTracingConfiguration { | ||||||||||||||||||||||||||
|
foukou19 marked this conversation as resolved.
Resolved
|
||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| static final String CAMEL_INSTRUMENTATION_SCOPE = "camel"; | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| @Bean | ||||||||||||||||||||||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Null-safe OpenTelemetry fallback in Camel tracing In CamelTracingConfiguration.java:20-29, pass OpenTelemetry::noop as the default supplier so sliced tests or contexts without the OTel starter do not fail with a NullPointerException:
Suggested change
|
||||||||||||||||||||||||||
| public Tracer camelTracer(ObjectProvider<OpenTelemetry> openTelemetryProvider) { | ||||||||||||||||||||||||||
| return openTelemetryProvider.getIfAvailable().getTracer(CAMEL_INSTRUMENTATION_SCOPE); | ||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| @Bean | ||||||||||||||||||||||||||
| public ContextPropagators camelContextPropagators( | ||||||||||||||||||||||||||
| ObjectProvider<OpenTelemetry> openTelemetryProvider) { | ||||||||||||||||||||||||||
| return openTelemetryProvider.getIfAvailable().getPropagators(); | ||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| @Bean | ||||||||||||||||||||||||||
| public CamelContextConfiguration camelTelemetryBridge(Tracer camelTracer, | ||||||||||||||||||||||||||
| ContextPropagators camelContextPropagators, MeterRegistry meterRegistry) { | ||||||||||||||||||||||||||
| return new CamelContextConfiguration() { | ||||||||||||||||||||||||||
| @Override | ||||||||||||||||||||||||||
| public void beforeApplicationStart(CamelContext camelContext) { | ||||||||||||||||||||||||||
| // 1. Preserve the native OTel tracing bridge. | ||||||||||||||||||||||||||
| camelContext.getRegistry().bind("camelTracer", camelTracer); | ||||||||||||||||||||||||||
| camelContext.getRegistry().bind("camelContextPropagators", camelContextPropagators); | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| // 2. Emit camel.* metrics into Micrometer so they can be exported through the | ||||||||||||||||||||||||||
| // OTLP registry. | ||||||||||||||||||||||||||
| MicrometerRoutePolicyFactory routePolicyFactory = new MicrometerRoutePolicyFactory(); | ||||||||||||||||||||||||||
| routePolicyFactory.setMeterRegistry(meterRegistry); | ||||||||||||||||||||||||||
| camelContext.addRoutePolicyFactory(routePolicyFactory); | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| MicrometerMessageHistoryFactory messageHistoryFactory = new MicrometerMessageHistoryFactory(); | ||||||||||||||||||||||||||
| messageHistoryFactory.setMeterRegistry(meterRegistry); | ||||||||||||||||||||||||||
| camelContext.setMessageHistoryFactory(messageHistoryFactory); | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| MicrometerExchangeEventNotifier exchangeNotifier = new MicrometerExchangeEventNotifier(); | ||||||||||||||||||||||||||
| exchangeNotifier.setMeterRegistry(meterRegistry); | ||||||||||||||||||||||||||
| camelContext.getManagementStrategy().addEventNotifier(exchangeNotifier); | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| MicrometerRouteEventNotifier routeNotifier = new MicrometerRouteEventNotifier(); | ||||||||||||||||||||||||||
| routeNotifier.setMeterRegistry(meterRegistry); | ||||||||||||||||||||||||||
| camelContext.getManagementStrategy().addEventNotifier(routeNotifier); | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| log.info("[TELEMETRY BRIDGE] Registered Camel OTel Tracer and Micrometer route metrics."); | ||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| @Override | ||||||||||||||||||||||||||
| public void afterApplicationStart(CamelContext camelContext) { | ||||||||||||||||||||||||||
| // No-op. | ||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.