Adding OTEL collector to a SpringBoot application and enabling custom metrics
Config Repository Changes
- Under
additionalPodAnnotations, add: -
Under
env, add: -
If the application has the following property
JAVA_TOOL_OPTIONS: -Xms512m -Xmx2g -XX:+UseG1GC -XX:NewRatio=1in theconfigMap, you may need to change it toJDK_JAVA_OPTIONS: -Xms512m -Xmx2g -XX:+UseG1GC -XX:NewRatio=1, as the OTEL java agent will override the JAVA_TOOL_OPTIONS and the memory settings will not be applied. This way, both values are picked up appropriately. -
For the micrometer OTLP exporter, please add the following properties to the
configMapin each environment'svalues.yamlfile:
Service Repository Changes
-
If the service includes the Protobuf dependency, you may need to update the version to
4.28.3to make it compatible with the micrometer OTLP dependency. -
Add the following dependency for our custom micrometer metrics to be exported through OTLP:
This exporter should be able to coexist with the existing Prometheus one (although metrics may be duplicated), but if you want to remove or disable Prometheus in the config repo, please also remove the below dependency to prevent duplication: -
Some custom metric names may need to change or be replaced by non-custom metrics. Please, visit https://github.com/Flutter-Global/uki-copilot-signalfx/blob/main/knowledge/tenants/platformservices/AUTO-INSTRUMENTATION-PLAN.md for a list of our TLAs and affected metrics. Tests may need updating after these changes.
Dashboard Changes
Dashboards will likely need updating if custom metric names have been changed, or if we need to substitute them with non-custom metrics. Please make sure all charts are working as expected after the changes.