Skip to content

Commit

Permalink
release: v0.6.0 (#108)
Browse files Browse the repository at this point in the history
  • Loading branch information
evansims authored Jun 28, 2024
2 parents 99ab813 + ff229a4 commit 9065ff1
Show file tree
Hide file tree
Showing 15 changed files with 58 additions and 14 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## v0.6.0

### [0.6.0](https://github.com/openfga/python-sdk/compare/v0.5.0...v0.6.0) (2024-06-28)

- feat: add OpenTelemetry metrics reporting

## v0.5.0

### [0.5.0](https://github.com/openfga/python-sdk/compare/v0.4.2...v0.5.0) (2024-06-17)
Expand Down
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ This is an autogenerated python SDK for OpenFGA. It provides a wrapper around th
- [Retries](#retries)
- [API Endpoints](#api-endpoints)
- [Models](#models)
- [OpenTelemetry](#opentelemetry)
- [Contributing](#contributing)
- [Issues](#issues)
- [Pull Requests](#pull-requests)
Expand Down Expand Up @@ -1139,6 +1140,12 @@ Class | Method | HTTP request | Description



### OpenTelemetry

This SDK supports producing metrics that can be consumed as part of an [OpenTelemetry](https://opentelemetry.io/) setup. For more information, please see [the documentation](https://github.com/openfga/python-sdk/blob/main/docs/opentelemetry.md)



## Contributing

### Issues
Expand Down
31 changes: 31 additions & 0 deletions docs/opentelemetry.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# OpenTelemetry

This SDK produces [metrics](https://opentelemetry.io/docs/concepts/signals/metrics/) using [OpenTelemetry](https://opentelemetry.io/) that allow you to view data such as request timings. These metrics also include attributes for the model and store ID, as well as the API called to allow you to build reporting.

When an OpenTelemetry SDK instance is configured, the metrics will be exported and sent to the collector configured as part of your applications configuration. If you are not using OpenTelemetry, the metric functionality is a no-op and the events are never sent.

In cases when metrics events are sent, they will not be viewable outside of infrastructure configured in your application, and are never available to the OpenFGA team or contributors.

## Metrics

### Supported Metrics

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

### Supported attributes

| Attribute Name | Type | Description |
| ------------------------------ | -------- | ----------------------------------------------------------------------------------- |
| `fga-client.response.model_id` | `string` | The authorization model ID that the FGA server used |
| `fga-client.request.method` | `string` | The FGA method/action that was performed |
| `fga-client.request.store_id` | `string` | The store ID that was sent as part of the request |
| `fga-client.request.model_id` | `string` | The authorization model ID that was sent as part of the request, if any |
| `fga-client.request.client_id` | `string` | The client ID associated with the request, if any |
| `fga-client.user` | `string` | The user that is associated with the action of the request for check and list users |
| `http.status_code ` | `int` | The status code of the response |
| `http.method` | `string` | The HTTP method for the request |
| `http.host` | `string` | Host identifier of the origin the request was sent to |
2 changes: 1 addition & 1 deletion example/example1/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ attrs >= 23.1.0
frozenlist >= 1.4.1
idna >= 3.6
multidict >= 6.0.4
openfga-sdk >= 0.5.0
openfga-sdk >= 0.6.0
python-dateutil >= 2.8.2
urllib3 >= 2.1.0
yarl >= 1.9.4
2 changes: 1 addition & 1 deletion openfga_sdk/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
NOTE: This file was auto generated by OpenAPI Generator (https://openapi-generator.tech). DO NOT EDIT.
"""

__version__ = "0.5.0"
__version__ = "0.6.0"

from openfga_sdk.api.open_fga_api import OpenFgaApi
from openfga_sdk.api_client import ApiClient
Expand Down
2 changes: 1 addition & 1 deletion openfga_sdk/api_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
from openfga_sdk.telemetry import Telemetry
from openfga_sdk.telemetry.attributes import TelemetryAttribute, TelemetryAttributes

DEFAULT_USER_AGENT = "openfga-sdk python/0.5.0"
DEFAULT_USER_AGENT = "openfga-sdk python/0.6.0"


def random_time(loop_count, min_wait_in_ms):
Expand Down
2 changes: 1 addition & 1 deletion openfga_sdk/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,7 @@ def to_debug_report(self):
"OS: {env}\n"
"Python Version: {pyversion}\n"
"Version of the API: 1.x\n"
"SDK Package Version: 0.5.0".format(env=sys.platform, pyversion=sys.version)
"SDK Package Version: 0.6.0".format(env=sys.platform, pyversion=sys.version)
)

def get_host_settings(self):
Expand Down
2 changes: 1 addition & 1 deletion openfga_sdk/oauth2.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ async def _obtain_token(self, client):
{
"Accept": "application/json",
"Content-Type": "application/x-www-form-urlencoded",
"User-Agent": "openfga-sdk (python) 0.5.0",
"User-Agent": "openfga-sdk (python) 0.6.0",
}
)

Expand Down
2 changes: 1 addition & 1 deletion openfga_sdk/sync/api_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
from openfga_sdk.telemetry import Telemetry
from openfga_sdk.telemetry.attributes import TelemetryAttribute, TelemetryAttributes

DEFAULT_USER_AGENT = "openfga-sdk python/0.5.0"
DEFAULT_USER_AGENT = "openfga-sdk python/0.6.0"


def random_time(loop_count, min_wait_in_ms):
Expand Down
2 changes: 1 addition & 1 deletion openfga_sdk/sync/oauth2.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def _obtain_token(self, client):
{
"Accept": "application/json",
"Content-Type": "application/x-www-form-urlencoded",
"User-Agent": "openfga-sdk (python) 0.5.0",
"User-Agent": "openfga-sdk (python) 0.6.0",
}
)

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import setuptools

NAME = "openfga-sdk"
VERSION = "0.5.0"
VERSION = "0.6.0"
REQUIRES = []


Expand Down
2 changes: 1 addition & 1 deletion test/test_oauth2.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ async def test_get_authentication_obtain_client_credentials(self, mock_request):
{
"Accept": "application/json",
"Content-Type": "application/x-www-form-urlencoded",
"User-Agent": "openfga-sdk (python) 0.5.0",
"User-Agent": "openfga-sdk (python) 0.6.0",
}
)
mock_request.assert_called_once_with(
Expand Down
2 changes: 1 addition & 1 deletion test/test_oauth2_sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def test_get_authentication_obtain_client_credentials(self, mock_request):
{
"Accept": "application/json",
"Content-Type": "application/x-www-form-urlencoded",
"User-Agent": "openfga-sdk (python) 0.5.0",
"User-Agent": "openfga-sdk (python) 0.6.0",
}
)
mock_request.assert_called_once_with(
Expand Down
4 changes: 2 additions & 2 deletions test/test_open_fga_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -1520,7 +1520,7 @@ async def test_check_api_token(self, mock_request):
{
"Accept": "application/json",
"Content-Type": "application/json",
"User-Agent": "openfga-sdk python/0.5.0",
"User-Agent": "openfga-sdk python/0.6.0",
"Authorization": "Bearer TOKEN1",
}
)
Expand Down Expand Up @@ -1574,7 +1574,7 @@ async def test_check_custom_header(self, mock_request):
{
"Accept": "application/json",
"Content-Type": "application/json",
"User-Agent": "openfga-sdk python/0.5.0",
"User-Agent": "openfga-sdk python/0.6.0",
"Custom Header": "custom value",
}
)
Expand Down
4 changes: 2 additions & 2 deletions test/test_open_fga_api_sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -1520,7 +1520,7 @@ async def test_check_api_token(self, mock_request):
{
"Accept": "application/json",
"Content-Type": "application/json",
"User-Agent": "openfga-sdk python/0.5.0",
"User-Agent": "openfga-sdk python/0.6.0",
"Authorization": "Bearer TOKEN1",
}
)
Expand Down Expand Up @@ -1574,7 +1574,7 @@ async def test_check_custom_header(self, mock_request):
{
"Accept": "application/json",
"Content-Type": "application/json",
"User-Agent": "openfga-sdk python/0.5.0",
"User-Agent": "openfga-sdk python/0.6.0",
"Custom Header": "custom value",
}
)
Expand Down

0 comments on commit 9065ff1

Please sign in to comment.