typelevel / typelevel/natchez-http4s

Should http.status_code be an Integer, not a String?

Open
#7 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Scala
Stars
50
Forks
18
Avg merge
15m
Merged PRs (30d)
5

Description

Hello, we're using natchez for tracing, very pleased.

We're trying to bump to 0.0.22, but our HTTP4s services start failing requests due to a ClassCastException.

I did some digging, and I found the cause. Recent versions of dd-trace have started looking at the http.status_code flag, which is expected to be an Integer, not a String:

https://github.com/DataDog/dd-trace-java/commit/e6a2a365b641144423961d33d411a06385c49fec#diff-9df24c921979abf616256e047e43b08aa0ad40ef7ac721632512765ec47e1b9cL103

This only recently started breaking because the status code was hardcoded to 0 before; they weren't examining the tag.

The documentation for natchez-https perhaps hints that the String type is surprising, if I'm interpreting "String (!)" correctly.

Is there a reason it's a String, or would you be open to moving it to an Int? I'm happy to contribute with a PR if that's something you'd like.

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 by locating the natchez-https handling of the http.status_code tag and compare its emitted type with the dd-trace expectation described in the issue. Done means the status code is emitted as an Integer and HTTP4s requests no longer fail with ClassCastException.

Written by the indexing model from the issue text.

Assessment

Tech stack
scala
Domain
observability
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.