Skip to content

Commit 9065ff1

Browse files
authored
release: v0.6.0 (#108)
2 parents 99ab813 + ff229a4 commit 9065ff1

15 files changed

+58
-14
lines changed

CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Changelog
22

3+
## v0.6.0
4+
5+
### [0.6.0](https://github.com/openfga/python-sdk/compare/v0.5.0...v0.6.0) (2024-06-28)
6+
7+
- feat: add OpenTelemetry metrics reporting
8+
39
## v0.5.0
410

511
### [0.5.0](https://github.com/openfga/python-sdk/compare/v0.4.2...v0.5.0) (2024-06-17)

README.md

+7
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ This is an autogenerated python SDK for OpenFGA. It provides a wrapper around th
4545
- [Retries](#retries)
4646
- [API Endpoints](#api-endpoints)
4747
- [Models](#models)
48+
- [OpenTelemetry](#opentelemetry)
4849
- [Contributing](#contributing)
4950
- [Issues](#issues)
5051
- [Pull Requests](#pull-requests)
@@ -1139,6 +1140,12 @@ Class | Method | HTTP request | Description
11391140

11401141

11411142

1143+
### OpenTelemetry
1144+
1145+
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)
1146+
1147+
1148+
11421149
## Contributing
11431150

11441151
### Issues

docs/opentelemetry.md

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# OpenTelemetry
2+
3+
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.
4+
5+
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.
6+
7+
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.
8+
9+
## Metrics
10+
11+
### Supported Metrics
12+
13+
| Metric Name | Type | Description |
14+
| --------------------------------- | --------- | -------------------------------------------------------------------------------- |
15+
| `fga-client.request.duration` | Histogram | The total request time for FGA requests |
16+
| `fga-client.query.duration` | Histogram | The amount of time the FGA server took to process the request |
17+
| ` fga-client.credentials.request` | Counter | The total number of times a new token was requested when using ClientCredentials |
18+
19+
### Supported attributes
20+
21+
| Attribute Name | Type | Description |
22+
| ------------------------------ | -------- | ----------------------------------------------------------------------------------- |
23+
| `fga-client.response.model_id` | `string` | The authorization model ID that the FGA server used |
24+
| `fga-client.request.method` | `string` | The FGA method/action that was performed |
25+
| `fga-client.request.store_id` | `string` | The store ID that was sent as part of the request |
26+
| `fga-client.request.model_id` | `string` | The authorization model ID that was sent as part of the request, if any |
27+
| `fga-client.request.client_id` | `string` | The client ID associated with the request, if any |
28+
| `fga-client.user` | `string` | The user that is associated with the action of the request for check and list users |
29+
| `http.status_code ` | `int` | The status code of the response |
30+
| `http.method` | `string` | The HTTP method for the request |
31+
| `http.host` | `string` | Host identifier of the origin the request was sent to |

example/example1/requirements.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ attrs >= 23.1.0
44
frozenlist >= 1.4.1
55
idna >= 3.6
66
multidict >= 6.0.4
7-
openfga-sdk >= 0.5.0
7+
openfga-sdk >= 0.6.0
88
python-dateutil >= 2.8.2
99
urllib3 >= 2.1.0
1010
yarl >= 1.9.4

openfga_sdk/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
NOTE: This file was auto generated by OpenAPI Generator (https://openapi-generator.tech). DO NOT EDIT.
1111
"""
1212

13-
__version__ = "0.5.0"
13+
__version__ = "0.6.0"
1414

1515
from openfga_sdk.api.open_fga_api import OpenFgaApi
1616
from openfga_sdk.api_client import ApiClient

openfga_sdk/api_client.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
from openfga_sdk.telemetry import Telemetry
3737
from openfga_sdk.telemetry.attributes import TelemetryAttribute, TelemetryAttributes
3838

39-
DEFAULT_USER_AGENT = "openfga-sdk python/0.5.0"
39+
DEFAULT_USER_AGENT = "openfga-sdk python/0.6.0"
4040

4141

4242
def random_time(loop_count, min_wait_in_ms):

openfga_sdk/configuration.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -469,7 +469,7 @@ def to_debug_report(self):
469469
"OS: {env}\n"
470470
"Python Version: {pyversion}\n"
471471
"Version of the API: 1.x\n"
472-
"SDK Package Version: 0.5.0".format(env=sys.platform, pyversion=sys.version)
472+
"SDK Package Version: 0.6.0".format(env=sys.platform, pyversion=sys.version)
473473
)
474474

475475
def get_host_settings(self):

openfga_sdk/oauth2.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ async def _obtain_token(self, client):
8383
{
8484
"Accept": "application/json",
8585
"Content-Type": "application/x-www-form-urlencoded",
86-
"User-Agent": "openfga-sdk (python) 0.5.0",
86+
"User-Agent": "openfga-sdk (python) 0.6.0",
8787
}
8888
)
8989

openfga_sdk/sync/api_client.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
from openfga_sdk.telemetry import Telemetry
3636
from openfga_sdk.telemetry.attributes import TelemetryAttribute, TelemetryAttributes
3737

38-
DEFAULT_USER_AGENT = "openfga-sdk python/0.5.0"
38+
DEFAULT_USER_AGENT = "openfga-sdk python/0.6.0"
3939

4040

4141
def random_time(loop_count, min_wait_in_ms):

openfga_sdk/sync/oauth2.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ def _obtain_token(self, client):
8383
{
8484
"Accept": "application/json",
8585
"Content-Type": "application/x-www-form-urlencoded",
86-
"User-Agent": "openfga-sdk (python) 0.5.0",
86+
"User-Agent": "openfga-sdk (python) 0.6.0",
8787
}
8888
)
8989

setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
import setuptools
1717

1818
NAME = "openfga-sdk"
19-
VERSION = "0.5.0"
19+
VERSION = "0.6.0"
2020
REQUIRES = []
2121

2222

test/test_oauth2.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ async def test_get_authentication_obtain_client_credentials(self, mock_request):
8484
{
8585
"Accept": "application/json",
8686
"Content-Type": "application/x-www-form-urlencoded",
87-
"User-Agent": "openfga-sdk (python) 0.5.0",
87+
"User-Agent": "openfga-sdk (python) 0.6.0",
8888
}
8989
)
9090
mock_request.assert_called_once_with(

test/test_oauth2_sync.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ def test_get_authentication_obtain_client_credentials(self, mock_request):
8484
{
8585
"Accept": "application/json",
8686
"Content-Type": "application/x-www-form-urlencoded",
87-
"User-Agent": "openfga-sdk (python) 0.5.0",
87+
"User-Agent": "openfga-sdk (python) 0.6.0",
8888
}
8989
)
9090
mock_request.assert_called_once_with(

test/test_open_fga_api.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1520,7 +1520,7 @@ async def test_check_api_token(self, mock_request):
15201520
{
15211521
"Accept": "application/json",
15221522
"Content-Type": "application/json",
1523-
"User-Agent": "openfga-sdk python/0.5.0",
1523+
"User-Agent": "openfga-sdk python/0.6.0",
15241524
"Authorization": "Bearer TOKEN1",
15251525
}
15261526
)
@@ -1574,7 +1574,7 @@ async def test_check_custom_header(self, mock_request):
15741574
{
15751575
"Accept": "application/json",
15761576
"Content-Type": "application/json",
1577-
"User-Agent": "openfga-sdk python/0.5.0",
1577+
"User-Agent": "openfga-sdk python/0.6.0",
15781578
"Custom Header": "custom value",
15791579
}
15801580
)

test/test_open_fga_api_sync.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1520,7 +1520,7 @@ async def test_check_api_token(self, mock_request):
15201520
{
15211521
"Accept": "application/json",
15221522
"Content-Type": "application/json",
1523-
"User-Agent": "openfga-sdk python/0.5.0",
1523+
"User-Agent": "openfga-sdk python/0.6.0",
15241524
"Authorization": "Bearer TOKEN1",
15251525
}
15261526
)
@@ -1574,7 +1574,7 @@ async def test_check_custom_header(self, mock_request):
15741574
{
15751575
"Accept": "application/json",
15761576
"Content-Type": "application/json",
1577-
"User-Agent": "openfga-sdk python/0.5.0",
1577+
"User-Agent": "openfga-sdk python/0.6.0",
15781578
"Custom Header": "custom value",
15791579
}
15801580
)

0 commit comments

Comments
 (0)