spring-projects / spring-projects/spring-boot

Provide a way to supply OpenTelemetry Resource Attributes to OTLPMeterRegistry

Open
#46,229 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

status: on-hold theme: opentelemetry type: enhancement
Dominant language
Java
Stars
81.5k
Forks
42.7k
Avg merge
2d 4h
Merged PRs (30d)
65

Description

https://github.com/spring-projects/spring-boot/blob/b6b570ebebb6ea233e00af5e554adcf40256f224/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/otlp/OtlpMetricsExportAutoConfiguration.java#L72-L76

Currently, there are several ways to provide resource attributes to OtlpMeterRegistry.

  1. Set values in the environment
  2. Adding it to properties management.opentelemetry.resourceAttributes

We have a use case to compute some of these values programatically during the start-up and set them before wiring up the OtlpMeterRegistry. Currently, there seems to be no easy way to achieve this by merging the programatically resolved values with the default values other than completely copying OtlpMetricsPropertiesConfigAdapter and overriding the resourceAttributes().

If there is a way to inject the Resource bean, or if OtlpMetricsPropertiesConfigAdapter can be made extended (by making this public), this would help providing additional resource attributes to the registry.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with OtlpMetricsExportAutoConfiguration.java at the referenced lines, then read OpenTelemetryAutoConfiguration.java and OtlpMetricsPropertiesConfigAdapter. Compare the proposed Resource bean injection with making the adapter extensible; done means providing a supported way to merge programmatically resolved resource attributes with the existing defaults.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring-boot
Domain
observability-sre
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.