Bug: All telemetry attributes exported as strings instead of correct OTel types
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 54
- Forks
- 26
- Avg merge
- 2d 7h
- Merged PRs (30d)
- 9
Description
Summary
Attributes.prepare() in src/main/java/dev/openfga/sdk/telemetry/Attributes.java:130 uses AttributeKey.stringKey() for every attribute. Per the OpenFGA telemetry spec and OTel conventions, some attributes should be numeric:
http.response.status_codeshould beint→AttributeKey.longKey()http.request.resend_countshould beint→AttributeKey.longKey()
Impact
Downstream OTel pipelines (dashboards, alerts) that expect numeric types for these attributes will either fail or treat them incorrectly. For example, queries like status_code >= 400 won't work on string-typed values.
Proposed Fix
In Attributes.prepare(), use AttributeKey.longKey() for known numeric attributes, parsing the string value to long. The internal Map<Attribute, String> representation can stay as strings — only the OTel export needs correct types.
Prior Art
The Python SDK already fixed this same issue in PR #177.
Related
- PR #290 (telemetry instance sharing fix)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at src/main/java/dev/openfga/sdk/telemetry/Attributes.java:130 and inspect how Attributes.prepare() converts values for OTel export. Compare the two named HTTP attributes with the OpenFGA telemetry spec and Python SDK PR #177; done means those attributes use numeric OTel types while the internal string map remains unchanged.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- observability
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 65/100