Repository navigation
Conversation
…ttributes OAuth2Client recorded fga-client.credentials.request with a hard-coded empty attributes map, so the metric had no host, status code or other attributes. Record it in exchangeToken with the attributes that HttpRequestAttempt collected for the token request. Fixes openfga#149 Fixes openfga#208 Signed-off-by: Srinivas Chippagiri <[email protected]>
|
No actionable comments were generated in the recent review. WalkthroughOAuth2Client now records credential-request metrics with telemetry attributes from the successful token-exchange HTTP attempt. A new test checks the host, response status, and request method attributes. ChangesCredential request metrics
Estimated code review effort: 2 (Simple) | ~10 minutes Change: Bug fix · Severity of issue fixed: Low Possibly related PRs
Suggested reviewers: Merge Risk:
|
…equest-attributes # Conflicts: # src/test/java/dev/openfga/sdk/api/auth/OAuth2ClientTest.java
Description
OAuth2Clientrecorded thefga-client.credentials.requestcounter with a hard-coded empty attributes map (#149, #208), so the metric had none of the configured attributes: no host, URL, method, status code or resend count.HttpRequestAttemptalready collects those attributes for the token request, but they never made it back togetAccessToken(), where the counter was recorded. The counter is now recorded inexchangeToken(), right after the token request succeeds, withattempt.getTelemetryAttributes(). As before, it's recorded once per successful exchange, and the attribute filtering from the telemetry configuration still applies inMetrics.Fixes #149
Fixes #208
Testing
New
credentialsRequestMetricHasTheTokenRequestAttributesinOAuth2ClientTest: it intercepts theMetricsinstance with Mockito'smockConstruction, exchanges a token, and checks thatcredentialsRequestis called once with the token request'shttp.host,http.request.methodandhttp.response.status_code. That avoids adding the OpenTelemetry SDK as a test dependency.I haven't run the Gradle build locally, so I'm relying on CI for compilation and the test run.
Summary by CodeRabbit