Skip to content

Polish OpenTelemetryResourceAttributes #44677

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

Closed
wants to merge 1 commit into from

Conversation

nosan
Copy link
Contributor

@nosan nosan commented Mar 11, 2025

Update OpenTelemetryResourceAttributes to use StringUtils.uriDecode(...), as it provides the same functionality as the custom decode(...) method.

Update OpenTelemetryResourceAttributes to use StringUtils.uriDecode(...)
as it provides the same functionality as the custom decode(...) method.

Signed-off-by: Dmytro Nosan <dimanosan@gmail.com>
@mhalbritter mhalbritter self-assigned this Mar 13, 2025
@mhalbritter mhalbritter added type: task A general task and removed status: waiting-for-triage An issue we've not yet triaged labels Mar 13, 2025
@mhalbritter mhalbritter added this to the 3.5.0-M3 milestone Mar 13, 2025
mhalbritter pushed a commit that referenced this pull request Mar 13, 2025
Update OpenTelemetryResourceAttributes to use StringUtils.uriDecode(...)
as it provides the same functionality as the custom decode(...) method.

See gh-44677

Signed-off-by: Dmytro Nosan <dimanosan@gmail.com>
@mhalbritter
Copy link
Contributor

Thanks @nosan !

@nosan
Copy link
Contributor Author

nosan commented Mar 13, 2025

@mhalbritter

I just found this core issue: spring-projects/spring-framework#34570.

It actually does alter a Unicode character.

Consider the following test:

@Test
void otelResourceAttributes() {
    this.environmentVariables.put("OTEL_RESOURCE_ATTRIBUTES", "key8=%20ś\u2019");
    assertThat(getAttributes()).containsEntry("key8", " ś’");
}

The custom decode method works fine, but StringUtils.uriDecode fails with an error:


Expecting map:
  {"key8"=" [�", "service.name"="unknown_service"}
to contain entries:
  ["key8"=" ś’"]
but the following map entries had different values:
  ["key8"=" [�" (expected: " ś’")]
java.lang.AssertionError: 
Expecting map:
  {"key8"=" [�", "service.name"="unknown_service"}
to contain entries:
  ["key8"=" ś’"]
but the following map entries had different values:
  ["key8"=" [�" (expected: " ś’")]

@mhalbritter
Copy link
Contributor

mhalbritter commented Mar 13, 2025

Hm. We should then stay on the custom decode method until this is fixed. I'll get that fixed.

@nosan
Copy link
Contributor Author

nosan commented Mar 13, 2025

Thanks, sorry for inconvenience :(

@mhalbritter
Copy link
Contributor

No problem. I've fixed that in 3bd75f6 and subscribed to spring-projects/spring-framework#34570. When that's fixed in Framework, we can use their decode method.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: task A general task
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants