diff --git a/config/clients/java/CHANGELOG.md.mustache b/config/clients/java/CHANGELOG.md.mustache index 0aa6d066..4dac0bc1 100644 --- a/config/clients/java/CHANGELOG.md.mustache +++ b/config/clients/java/CHANGELOG.md.mustache @@ -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) diff --git a/config/clients/java/config.overrides.json b/config/clients/java/config.overrides.json index f2948524..e00dda62 100644 --- a/config/clients/java/config.overrides.json +++ b/config/clients/java/config.overrides.json @@ -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", diff --git a/config/clients/java/template/README_installation.mustache b/config/clients/java/template/README_installation.mustache index 3e38639b..9eafe185 100644 --- a/config/clients/java/template/README_installation.mustache +++ b/config/clients/java/template/README_installation.mustache @@ -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) diff --git a/config/clients/java/template/build.gradle.mustache b/config/clients/java/template/build.gradle.mustache index e1ecd484..ef0fbfdc 100644 --- a/config/clients/java/template/build.gradle.mustache +++ b/config/clients/java/template/build.gradle.mustache @@ -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" @@ -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" diff --git a/config/clients/java/template/config-TelemetryConfiguration.java.mustache b/config/clients/java/template/config-TelemetryConfiguration.java.mustache index fbaa2f37..26757931 100644 --- a/config/clients/java/template/config-TelemetryConfiguration.java.mustache +++ b/config/clients/java/template/config-TelemetryConfiguration.java.mustache @@ -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()); diff --git a/config/clients/java/template/docs/OpenTelemetry.md.mustache b/config/clients/java/template/docs/OpenTelemetry.md.mustache index 4f82d8fc..94aed42f 100644 --- a/config/clients/java/template/docs/OpenTelemetry.md.mustache +++ b/config/clients/java/template/docs/OpenTelemetry.md.mustache @@ -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 @@ -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()); diff --git a/config/clients/java/template/example/example1/build.gradle.mustache b/config/clients/java/template/example/example1/build.gradle.mustache index 00204676..c5d6dfc6 100644 --- a/config/clients/java/template/example/example1/build.gradle.mustache +++ b/config/clients/java/template/example/example1/build.gradle.mustache @@ -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 { diff --git a/config/clients/java/template/telemetry-Metrics.java.mustache b/config/clients/java/template/telemetry-Metrics.java.mustache index 189fbb80..759af0cb 100644 --- a/config/clients/java/template/telemetry-Metrics.java.mustache +++ b/config/clients/java/template/telemetry-Metrics.java.mustache @@ -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;