java-sdk icon indicating copy to clipboard operation
java-sdk copied to clipboard

Unnecessary Telemetry Objects Created

Open jimmyjames opened this issue 3 months ago • 0 comments

Checklist

  • [x] I have looked into the README and have not found a suitable solution or answer.
  • [x] I have looked into the documentation and have not found a suitable solution or answer.
  • [x] I have searched the issues and have not found a suitable solution or answer.
  • [x] I have upgraded to the latest version of OpenFGA and the issue still persists.
  • [x] I have searched the Slack community and have not found a suitable solution or answer.
  • [x] I agree to the terms within the OpenFGA Code of Conduct.

Description

The Java SDK creates a new Telemetry, Metrics, and all associated types for each HTTP request.

Expectation

Only one Telemetry instance should exist per SDK instance. All Telemetry operations should use the single instance.

Reproduction

Observe that new Telemetry instances are created on each HTTP request:

  • https://github.com/openfga/java-sdk/blob/ecef92e60274bb55021542d11f8f9d3fcffc574a/src/main/java/dev/openfga/sdk/api/client/HttpRequestAttempt.java#L45

New instances are also created in OpenFgaApi and OAuth2Client.

OpenFGA SDK version

any

OpenFGA version

any

SDK Configuration

any

Logs

No response

References

Discovered while investigating #201

jimmyjames avatar Aug 19 '25 14:08 jimmyjames