Skip to content

Conversation

Kludex
Copy link
Member

@Kludex Kludex commented Dec 13, 2024

I think this can be considered a breaking change, and I'm not sure how it affects other services, but it fixes the behavior according to the OTel specification.

Changes

  • Remove replace - to _ on the HTTP header normalizer.
  • Update test suite.
  • Update documentation.

Details

The current behavior is incorrect according to the HTTP RFCs regarding HTTP headers (because they are just case-insensitive), and the OpenTelemetry specification itself.

Screenshot 2024-12-13 at 11 19 26

The following headers are not the same:

Content-Type: application/json
Content_Type: application/json

But those two, should be treated as same:

Content-Type: application/json
content-type: application/json

@Kludex Kludex requested a review from a team as a code owner December 13, 2024 10:18
@github-actions github-actions bot requested a review from shalevr December 13, 2024 10:19
Comment on lines 186 to 193
def normalise_request_header_name(header: str) -> str:
key = header.lower().replace("-", "_")
key = header.lower()
return f"http.request.header.{key}"


def normalise_response_header_name(header: str) -> str:
key = header.lower().replace("-", "_")
key = header.lower()
return f"http.response.header.{key}"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Those are the relevant changes. The rest is just to comply with this.

@Kludex
Copy link
Member Author

Kludex commented Dec 13, 2024

I don't know what's wrong with the docs... 😢

…telemetry/instrumentation/tornado/__init__.py
@Kludex
Copy link
Member Author

Kludex commented Dec 20, 2024

Thanks @emdneto

@lzchen
Copy link
Contributor

lzchen commented Jan 2, 2025

Relevant pr in semconv: open-telemetry/semantic-conventions#369

Would this breaking change fall under semconv migration? @emdneto @aabmass @xrmx wdyt?

@emdneto
Copy link
Member

emdneto commented Jan 10, 2025

Relevant pr in semconv: open-telemetry/semantic-conventions#369

Would this breaking change fall under semconv migration? @emdneto @aabmass @xrmx wdyt?

@lzchen Taking a second look: yes. We do still have an open PR to migrate util-http: #2648 . In that case, I think the problem is we are breaking already migrated instrumentation, like django, flask.

edit: maybe I wasn't so clear, but I'm saying that my concern is we should do that change only for new semconv at least for instrumentation that were migrated

@emdneto
Copy link
Member

emdneto commented Feb 13, 2025

@Kludex Since we are breaking users of already migrated instrumentation to support opt-in for stable semantic conventions, it would also be necessary to include this as part of it. So, the change must take into consideration the _sem_conv_opt_in_mode specified by the user. If the user opt-in for the stable semantic convention, it should return the header with -, otherwise by default, keep the underscore _. See

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Ready for review

Development

Successfully merging this pull request may close these issues.

4 participants