openfga / openfga/java-sdk

Bug: All telemetry attributes exported as strings instead of correct OTel types

Open Beginner friendly
#291 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
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_code should be intAttributeKey.longKey()
  • http.request.resend_count should be intAttributeKey.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

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 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.