openfga / openfga/java-sdk

Bug: No telemetry recorded for failed requests

Open
#293 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

In src/main/java/dev/openfga/sdk/api/client/HttpRequestAttempt.java, when a request fails permanently (max retries exceeded, non-retryable error), requestDuration and queryDuration metrics are never recorded. Only the success path (~line 211-221) records metrics.

Impact

  • Error rates are invisible via telemetry
  • Request duration for failed calls is not tracked
  • Users cannot build alerting/dashboards on error patterns
  • Failed requests are a silent gap in observability

Proposed Fix

Record requestDuration on all terminal paths (success and failure), not just success. The http.response.status_code attribute already distinguishes success from failure, so existing dashboards filtering by status code will continue to work correctly.

This could be done with a try/finally pattern or by recording metrics just before throwing in the error paths.

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 in src/main/java/dev/openfga/sdk/api/client/HttpRequestAttempt.java, focusing on the success-path metric recording around lines 211-221 and the terminal failure paths for exhausted retries and non-retryable errors. Ensure requestDuration and queryDuration are recorded for failed requests as well as successful ones, while preserving the existing status-code distinction.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.