Skip to content

Commit

Permalink
release(java-sdk): v0.7.1 (#445)
Browse files Browse the repository at this point in the history
  • Loading branch information
ewanharris authored Nov 5, 2024
2 parents 1af59ec + c2bbdb3 commit 9bca180
Show file tree
Hide file tree
Showing 8 changed files with 44 additions and 29 deletions.
9 changes: 9 additions & 0 deletions config/clients/java/CHANGELOG.md.mustache
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# Changelog

## v0.7.1

### [0.7.1](https://github.com/openfga/java-sdk/compare/v0.7.0...v0.7.1) (2024-09-23)

- refactor(OpenTelemetry): remove SDK version from meter name
- fix(OpenTelemetry): `http.request.method` should be enabled by default (#114)
- chore(deps): update dependencies (#110, #111, #112)
- docs(OpenTelemetry): update Metrics and Attributes tables (#115)

## v0.7.0

### [0.7.0](https://{{gitHost}}/{{gitUserId}}/{{gitRepoId}}/compare/v0.6.1...v0.7.0) (2024-08-28)
Expand Down
2 changes: 1 addition & 1 deletion config/clients/java/config.overrides.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"gitRepoId": "java-sdk",
"artifactId": "openfga-sdk",
"groupId": "dev.openfga",
"packageVersion": "0.7.0",
"packageVersion": "0.7.1",
"apiPackage": "dev.openfga.sdk.api",
"authPackage": "dev.openfga.sdk.api.auth",
"clientPackage": "dev.openfga.sdk.api.client",
Expand Down
2 changes: 2 additions & 0 deletions config/clients/java/template/README_installation.mustache
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
The {{appName}} Java SDK is available on [Maven Central](https://central.sonatype.com/).

The OpenFGA Java SDK currently supports **Java 11** as the minimum JDK version.

It can be used with the following:

* Gradle (Groovy)
Expand Down
4 changes: 2 additions & 2 deletions config/clients/java/template/build.gradle.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ dependencies {
{{#swagger2AnnotationLibrary}}
implementation "io.swagger.core.v3:swagger-annotations:$swagger_annotations_version"
{{/swagger2AnnotationLibrary}}
implementation "com.google.code.findbugs:jsr305:3.0.1"
implementation "com.google.code.findbugs:jsr305:3.0.2"
implementation "com.fasterxml.jackson.core:jackson-core:$jackson_version"
implementation "com.fasterxml.jackson.core:jackson-annotations:$jackson_version"
implementation "com.fasterxml.jackson.core:jackson-databind:$jackson_version"
Expand All @@ -96,7 +96,7 @@ testing {
dependencies {
implementation project()
implementation "org.junit.jupiter:junit-jupiter:$junit_version"
implementation "org.mockito:mockito-core:5.12.0"
implementation "org.mockito:mockito-core:5.13.0"
runtimeOnly "org.junit.platform:junit-platform-launcher"
implementation "org.wiremock:wiremock:3.9.1"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ public class TelemetryConfiguration {
defaultAttributes.put(Attributes.FGA_CLIENT_REQUEST_STORE_ID, Optional.empty());
defaultAttributes.put(Attributes.FGA_CLIENT_RESPONSE_MODEL_ID, Optional.empty());
defaultAttributes.put(Attributes.HTTP_HOST, Optional.empty());
defaultAttributes.put(Attributes.HTTP_REQUEST_METHOD, Optional.empty());
defaultAttributes.put(Attributes.HTTP_REQUEST_RESEND_COUNT, Optional.empty());
defaultAttributes.put(Attributes.HTTP_RESPONSE_STATUS_CODE, Optional.empty());
defaultAttributes.put(Attributes.URL_FULL, Optional.empty());
Expand Down
49 changes: 26 additions & 23 deletions config/clients/java/template/docs/OpenTelemetry.md.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -10,29 +10,31 @@ In cases when metrics events are sent, they will not be viewable outside of infr

### Supported Metrics

| Metric Name | Type | Description |
| --------------------------------- | --------- | ------------------------------------------------------------------------------------ |
| `fga-client.credentials.request` | Counter | The total number of times a new token was requested when using ClientCredentials |
| `fga-client.query.duration` | Histogram | The amount of time the FGA server took to internally process nd evaluate the request |
| `fga-client.request.duration` | Histogram | The total request time for FGA requests |

### Supported attributes

| Attribute Name | Type | Description |
| ------------------------------ | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `fga-client.request.client_id` | `string` | The client ID associated with the request, if any |
| `fga-client.request.method` | `string` | The FGA method/action that was performed (e.g. `Check`, `ListObjects`, ...) in TitleCase |
| `fga-client.request.model_id` | `string` | The authorization model ID that was sent as part of the request, if any |
| `fga-client.request.store_id` | `string` | The store ID that was sent as part of the request |
| `fga-client.response.model_id` | `string` | The authorization model ID that the FGA server used |
| `fga-client.user` | `string` | The user that is associated with the action of the request for check and list objects |
| `http.host` | `string` | Host identifier of the origin the request was sent to |
| `http.request.method` | `string` | The HTTP method for the request |
| `http.request.resend_count` | `int` | The number of retries attempted (Only sent if the request was retried. Count of `1` means the request was retried once in addition to the original request) |
| `http.response.status_code` | `int` | The status code of the response |
| `url.full` | `string` | Full URL of the request |
| `url.scheme` | `string` | HTTP Scheme of the request (`http`/`https`) |
| `user_agent.original` | `string` | User Agent used in the query |
| Metric Name | Type | Enabled by Default | Description |
| -------------------------------- | --------- | ------------------ | --------------------------------------------------------------------------------- |
| `fga-client.request.duration` | Histogram | Yes | Total request time for FGA requests, in milliseconds |
| `fga-client.query.duration` | Histogram | Yes | Time taken by the FGA server to process and evaluate the request, in milliseconds |
| `fga-client.credentials.request` | Counter | Yes | Total number of new token requests initiated using the Client Credentials flow |

### Supported Attributes

| Attribute Name | Type | Enabled by Default | Description |
| ------------------------------ | ------ | ------------------ | --------------------------------------------------------------------------------- |
| `fga-client.request.client_id` | string | Yes | Client ID associated with the request, if any |
| `fga-client.request.method` | string | Yes | FGA method/action that was performed (e.g., Check, ListObjects) in TitleCase |
| `fga-client.request.model_id` | string | Yes | Authorization model ID that was sent as part of the request, if any |
| `fga-client.request.store_id` | string | Yes | Store ID that was sent as part of the request |
| `fga-client.response.model_id` | string | Yes | Authorization model ID that the FGA server used |
| `fga-client.user` | string | No | User associated with the action of the request for check and list users |
| `http.client.request.duration` | int | No | Duration for the SDK to complete the request, in milliseconds |
| `http.host` | string | Yes | Host identifier of the origin the request was sent to |
| `http.request.method` | string | Yes | HTTP method for the request |
| `http.request.resend_count` | int | Yes | Number of retries attempted, if any |
| `http.response.status_code` | int | Yes | Status code of the response (e.g., `200` for success) |
| `http.server.request.duration` | int | No | Time taken by the FGA server to process and evaluate the request, in milliseconds |
| `url.scheme` | string | Yes | HTTP scheme of the request (`http`/`https`) |
| `url.full` | string | Yes | Full URL of the request |
| `user_agent.original` | string | Yes | User Agent used in the query |

## Examples

Expand Down Expand Up @@ -142,6 +144,7 @@ public class Example {
attributes.put(Attributes.FGA_CLIENT_REQUEST_STORE_ID, Optional.empty());
attributes.put(Attributes.FGA_CLIENT_RESPONSE_MODEL_ID, Optional.empty());
attributes.put(Attributes.HTTP_HOST, Optional.empty());
attributes.put(Attributes.HTTP_REQUEST_METHOD, Optional.empty());
attributes.put(Attributes.HTTP_REQUEST_RESEND_COUNT, Optional.empty());
attributes.put(Attributes.HTTP_RESPONSE_STATUS_CODE, Optional.empty());
attributes.put(Attributes.URL_FULL, Optional.empty());
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
plugins {
id 'application'
id 'com.diffplug.spotless' version '6.25.0'
id 'org.jetbrains.kotlin.jvm' version '2.0.20-RC2'
id 'org.jetbrains.kotlin.jvm' version '2.0.20'
}

application {
Expand Down
4 changes: 2 additions & 2 deletions config/clients/java/template/telemetry-Metrics.java.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ public class Metrics {
private final Configuration configuration;
public Metrics() {
this.meter = OpenTelemetry.noop().getMeterProvider().get("{{artifactId}}/{{packageVersion}}");
this.meter = OpenTelemetry.noop().getMeterProvider().get("{{artifactId}}");
this.counters = new HashMap<>();
this.histograms = new HashMap<>();
this.configuration = new Configuration();
}

public Metrics(Configuration configuration) {
this.meter = OpenTelemetry.noop().getMeterProvider().get("{{artifactId}}/{{packageVersion}}");
this.meter = OpenTelemetry.noop().getMeterProvider().get("{{artifactId}}");
this.counters = new HashMap<>();
this.histograms = new HashMap<>();
this.configuration = configuration;
Expand Down

0 comments on commit 9bca180

Please sign in to comment.