Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
FROM eclipse-temurin:25-jre-alpine

ENV PORT=8080
ENV JAVA_TOOL_OPTIONS="-Dotel.java.global-autoconfigure.enabled=true"

RUN apk add --no-cache shadow && \
groupadd -r idp-core-group && \
Expand Down
30 changes: 30 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,13 @@
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>io.opentelemetry</groupId>
<artifactId>opentelemetry-bom</artifactId>
<version>1.54.0</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>

Expand Down Expand Up @@ -337,6 +344,28 @@
<artifactId>camel-rest-starter</artifactId>
</dependency>

<dependency>
<groupId>io.opentelemetry</groupId>
<artifactId>opentelemetry-api</artifactId>
</dependency>
<dependency>
<groupId>io.opentelemetry</groupId>
<artifactId>opentelemetry-sdk</artifactId>
</dependency>
<dependency>
<groupId>io.opentelemetry</groupId>
<artifactId>opentelemetry-sdk-extension-autoconfigure</artifactId>
</dependency>
<dependency>
<groupId>io.opentelemetry</groupId>
<artifactId>opentelemetry-exporter-otlp</artifactId>
</dependency>

<dependency>
<groupId>org.apache.camel.springboot</groupId>
<artifactId>camel-opentelemetry-starter</artifactId>
</dependency>

</dependencies>

<build>
Expand Down Expand Up @@ -545,6 +574,7 @@
<exclude>org.hibernate.orm:hibernate-core:6.6.29.Final</exclude>
<exclude>ch.qos.logback:logback-classic:1.5.34</exclude>
<exclude>ch.qos.logback:logback-core:1.5.34</exclude>
<exclude>org.codehaus.mojo:animal-sniffer-annotations:1.26</exclude>
</exclusions>
</configuration>
<executions>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
package com.decathlon.idp_core.infrastructure.adapters.api.controller;

import java.util.Map;

import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import io.opentelemetry.api.GlobalOpenTelemetry;
import io.opentelemetry.api.trace.Span;
import io.opentelemetry.api.trace.StatusCode;
import io.opentelemetry.api.trace.Tracer;
import io.opentelemetry.context.Scope;

/**
* Debug endpoint used to validate that OpenTelemetry spans are created and
* exported.
*
* <p>
* This endpoint intentionally creates a custom span with attributes and logs an
* event so that Cloud Run logs can confirm whether the SDK is active and
* whether the exporter is called.
*/
@RestController
@RequestMapping("/debug")
public class OtelDebugController {

private static final Tracer TRACER = GlobalOpenTelemetry.get().getTracer("idp-core-debug");

@GetMapping("/otel-test")
public ResponseEntity<Map<String, String>> triggerOtelTrace() {
Span span = TRACER.spanBuilder("debug.otel-test").setAttribute("debug.enabled", true)
.setAttribute("debug.route", "/debug/otel-test").startSpan();

try (Scope ignored = span.makeCurrent()) {

Check warning on line 36 in src/main/java/com/decathlon/idp_core/infrastructure/adapters/api/controller/OtelDebugController.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Remove this unused "ignored" local variable.

See more on https://sonarcloud.io/project/issues?id=Decathlon_internal-developer-platform&issues=AaD-Cvw4yBL9wOjKBwGn&open=AaD-Cvw4yBL9wOjKBwGn&pullRequest=160
span.addEvent("debug-otel-triggered");
span.setStatus(StatusCode.OK);
return ResponseEntity.ok(Map.of("status", "ok", "trace", "debug.otel-test"));
} finally {
span.end();
}
}
}
63 changes: 28 additions & 35 deletions src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -170,27 +170,40 @@ idp:

logging:
level:
# Application log level, defaults to INFO. Override per environment via LOG_LEVEL env var.
io.opentelemetry: DEBUG
org.apache.camel.opentelemetry: DEBUG
com.decathlon: ${LOG_LEVEL:INFO}
# Suppresses noisy Spring context startup logs at WARN level.
org.springframework.context.support: WARN
# Suppresses a specific repetitive bean registration delegate log line.
org.springframework.context.support.PostProcessorRegistrationDelegate: ERROR

otel:
service:
name: ${OTEL_SERVICE_NAME:internal-developer-platform}
traces:
exporter: otlp
metrics:
exporter: otlp
logs:
exporter: none
exporter:
otlp:
endpoint: ${OTEL_EXPORTER_OTLP_ENDPOINT}
protocol: ${OTEL_EXPORTER_OTLP_PROTOCOL:http/protobuf}
resource:
attributes:
deployment.environment: ${OTEL_ENV}
service.namespace: ${OTEL_SERVICE_NAMESPACE}
X-Datadog-Org: ${ORG}
X-Backend: ${BACKEND}

camel:
opentelemetry:
enabled: true

management:
tracing:
# Tracing is disabled by default and only enabled via environment variables (OTEL_TRACING_ENABLED).
enabled: false
sampling:
probability: 1.0 # 100% des traces

otlp:
tracing:
endpoint: ${OPEN_TELEMETRY_URL:""}
headers:
swagger:
enabled: ${APP_SECURITY_SWAGGER_ENABLED:true}
authorization: ${OPEN_TELEMETRY_TOKEN:""}
# Tracing is disabled by default and only enabled via environment variables.
enabled: ${OTEL_TRACING_ENABLED:false}

endpoints:
web:
Expand Down Expand Up @@ -220,23 +233,3 @@ management:
# Shows full health details only to authenticated users.
# Avoids leaking internal infrastructure info to unauthenticated callers.
show-details: when_authorized

camel:
component:
platform-http:
engine: "servlet"
# Never expose the health "details" map (e.g. database product name/version,
# validation query, disk space paths). Only UP/DOWN status is shown.
show-details: never
# Still surface per-component status (e.g. db: UP/DOWN) so direct
# dependencies can be checked, without leaking their details.
show-components: always
health:
diskspace:
# DiskSpace is not a direct dependency and its free/threshold values
# are not relevant to consumers checking service health.
enabled: false
ssl:
# SSL certificate/chain info is internal infrastructure detail and
# must not be exposed via actuator.
enabled: false
Loading