Skip to content

Commit 99f7c27

Browse files
committed
feat: add attribute for batch_check checks size
1 parent 7be0001 commit 99f7c27

9 files changed

Lines changed: 274 additions & 22 deletions

File tree

docs/opentelemetry.md

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -30,23 +30,24 @@ If you configure the OpenTelemetry SDK, these metrics will be exported and sent
3030

3131
### Supported Attributes
3232

33-
| Attribute Name | Type | Enabled by Default | Description |
34-
| ------------------------------ | ------ | ------------------ | --------------------------------------------------------------------------------- |
35-
| `fga-client.request.client_id` | string | Yes | Client ID associated with the request, if any |
36-
| `fga-client.request.method` | string | Yes | FGA method/action that was performed (e.g., Check, ListObjects) in TitleCase |
37-
| `fga-client.request.model_id` | string | Yes | Authorization model ID that was sent as part of the request, if any |
38-
| `fga-client.request.store_id` | string | Yes | Store ID that was sent as part of the request |
39-
| `fga-client.response.model_id` | string | Yes | Authorization model ID that the FGA server used |
40-
| `fga-client.user` | string | No | User associated with the action of the request for check and list users |
41-
| `http.client.request.duration` | int | No | Duration for the SDK to complete the request, in milliseconds |
42-
| `http.host` | string | Yes | Host identifier of the origin the request was sent to |
43-
| `http.request.method` | string | Yes | HTTP method for the request |
44-
| `http.request.resend_count` | int | Yes | Number of retries attempted, if any |
45-
| `http.response.status_code` | int | Yes | Status code of the response (e.g., `200` for success) |
46-
| `http.server.request.duration` | int | No | Time taken by the FGA server to process and evaluate the request, in milliseconds |
47-
| `url.scheme` | string | Yes | HTTP scheme of the request (`http`/`https`) |
48-
| `url.full` | string | Yes | Full URL of the request |
49-
| `user_agent.original` | string | Yes | User Agent used in the query |
33+
| Attribute Name | Type | Enabled by Default | Description |
34+
| ------------------------------------- | ------ | ------------------ | --------------------------------------------------------------------------------- |
35+
| `fga-client.request.batch_check_size` | int | No | The total size of the `check` list in a `BatchCheck` call |
36+
| `fga-client.request.client_id` | string | Yes | Client ID associated with the request, if any |
37+
| `fga-client.request.method` | string | Yes | FGA method/action that was performed (e.g., Check, ListObjects) in TitleCase |
38+
| `fga-client.request.model_id` | string | Yes | Authorization model ID that was sent as part of the request, if any |
39+
| `fga-client.request.store_id` | string | Yes | Store ID that was sent as part of the request |
40+
| `fga-client.response.model_id` | string | Yes | Authorization model ID that the FGA server used |
41+
| `fga-client.user` | string | No | User associated with the action of the request for check and list users |
42+
| `http.client.request.duration` | int | No | Duration for the SDK to complete the request, in milliseconds |
43+
| `http.host` | string | Yes | Host identifier of the origin the request was sent to |
44+
| `http.request.method` | string | Yes | HTTP method for the request |
45+
| `http.request.resend_count` | int | Yes | Number of retries attempted, if any |
46+
| `http.response.status_code` | int | Yes | Status code of the response (e.g., `200` for success) |
47+
| `http.server.request.duration` | int | No | Time taken by the FGA server to process and evaluate the request, in milliseconds |
48+
| `url.scheme` | string | Yes | HTTP scheme of the request (`http`/`https`) |
49+
| `url.full` | string | Yes | Full URL of the request |
50+
| `user_agent.original` | string | Yes | User Agent used in the query |
5051

5152
## Customizing Reporting
5253

openfga_sdk/api/open_fga_api.py

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,11 @@ async def batch_check_with_http_info(self, body, **kwargs):
201201
),
202202
}
203203

204+
telemetry_attributes = TelemetryAttributes.fromBody(
205+
body=body_params,
206+
attributes=telemetry_attributes,
207+
)
208+
204209
return await self.api_client.call_api(
205210
"/stores/{store_id}/batch-check".replace("{store_id}", store_id),
206211
"POST",
@@ -375,6 +380,11 @@ async def check_with_http_info(self, body, **kwargs):
375380
),
376381
}
377382

383+
telemetry_attributes = TelemetryAttributes.fromBody(
384+
body=body_params,
385+
attributes=telemetry_attributes,
386+
)
387+
378388
return await self.api_client.call_api(
379389
"/stores/{store_id}/check".replace("{store_id}", store_id),
380390
"POST",
@@ -536,6 +546,11 @@ async def create_store_with_http_info(self, body, **kwargs):
536546
),
537547
}
538548

549+
telemetry_attributes = TelemetryAttributes.fromBody(
550+
body=body_params,
551+
attributes=telemetry_attributes,
552+
)
553+
539554
return await self.api_client.call_api(
540555
"/stores",
541556
"POST",
@@ -678,6 +693,11 @@ async def delete_store_with_http_info(self, **kwargs):
678693
),
679694
}
680695

696+
telemetry_attributes = TelemetryAttributes.fromBody(
697+
body=body_params,
698+
attributes=telemetry_attributes,
699+
)
700+
681701
return await self.api_client.call_api(
682702
"/stores/{store_id}".replace("{store_id}", store_id),
683703
"DELETE",
@@ -852,6 +872,11 @@ async def expand_with_http_info(self, body, **kwargs):
852872
),
853873
}
854874

875+
telemetry_attributes = TelemetryAttributes.fromBody(
876+
body=body_params,
877+
attributes=telemetry_attributes,
878+
)
879+
855880
return await self.api_client.call_api(
856881
"/stores/{store_id}/expand".replace("{store_id}", store_id),
857882
"POST",
@@ -1003,6 +1028,11 @@ async def get_store_with_http_info(self, **kwargs):
10031028
),
10041029
}
10051030

1031+
telemetry_attributes = TelemetryAttributes.fromBody(
1032+
body=body_params,
1033+
attributes=telemetry_attributes,
1034+
)
1035+
10061036
return await self.api_client.call_api(
10071037
"/stores/{store_id}".replace("{store_id}", store_id),
10081038
"GET",
@@ -1178,6 +1208,11 @@ async def list_objects_with_http_info(self, body, **kwargs):
11781208
),
11791209
}
11801210

1211+
telemetry_attributes = TelemetryAttributes.fromBody(
1212+
body=body_params,
1213+
attributes=telemetry_attributes,
1214+
)
1215+
11811216
return await self.api_client.call_api(
11821217
"/stores/{store_id}/list-objects".replace("{store_id}", store_id),
11831218
"POST",
@@ -1337,6 +1372,11 @@ async def list_stores_with_http_info(self, **kwargs):
13371372
),
13381373
}
13391374

1375+
telemetry_attributes = TelemetryAttributes.fromBody(
1376+
body=body_params,
1377+
attributes=telemetry_attributes,
1378+
)
1379+
13401380
return await self.api_client.call_api(
13411381
"/stores",
13421382
"GET",
@@ -1512,6 +1552,11 @@ async def list_users_with_http_info(self, body, **kwargs):
15121552
),
15131553
}
15141554

1555+
telemetry_attributes = TelemetryAttributes.fromBody(
1556+
body=body_params,
1557+
attributes=telemetry_attributes,
1558+
)
1559+
15151560
return await self.api_client.call_api(
15161561
"/stores/{store_id}/list-users".replace("{store_id}", store_id),
15171562
"POST",
@@ -1686,6 +1731,11 @@ async def read_with_http_info(self, body, **kwargs):
16861731
),
16871732
}
16881733

1734+
telemetry_attributes = TelemetryAttributes.fromBody(
1735+
body=body_params,
1736+
attributes=telemetry_attributes,
1737+
)
1738+
16891739
return await self.api_client.call_api(
16901740
"/stores/{store_id}/read".replace("{store_id}", store_id),
16911741
"POST",
@@ -1856,6 +1906,11 @@ async def read_assertions_with_http_info(self, authorization_model_id, **kwargs)
18561906
),
18571907
}
18581908

1909+
telemetry_attributes = TelemetryAttributes.fromBody(
1910+
body=body_params,
1911+
attributes=telemetry_attributes,
1912+
)
1913+
18591914
return await self.api_client.call_api(
18601915
"/stores/{store_id}/assertions/{authorization_model_id}".replace(
18611916
"{store_id}", store_id
@@ -2024,6 +2079,11 @@ async def read_authorization_model_with_http_info(self, id, **kwargs):
20242079
),
20252080
}
20262081

2082+
telemetry_attributes = TelemetryAttributes.fromBody(
2083+
body=body_params,
2084+
attributes=telemetry_attributes,
2085+
)
2086+
20272087
return await self.api_client.call_api(
20282088
"/stores/{store_id}/authorization-models/{id}".replace(
20292089
"{store_id}", store_id
@@ -2191,6 +2251,11 @@ async def read_authorization_models_with_http_info(self, **kwargs):
21912251
),
21922252
}
21932253

2254+
telemetry_attributes = TelemetryAttributes.fromBody(
2255+
body=body_params,
2256+
attributes=telemetry_attributes,
2257+
)
2258+
21942259
return await self.api_client.call_api(
21952260
"/stores/{store_id}/authorization-models".replace("{store_id}", store_id),
21962261
"GET",
@@ -2368,6 +2433,11 @@ async def read_changes_with_http_info(self, **kwargs):
23682433
),
23692434
}
23702435

2436+
telemetry_attributes = TelemetryAttributes.fromBody(
2437+
body=body_params,
2438+
attributes=telemetry_attributes,
2439+
)
2440+
23712441
return await self.api_client.call_api(
23722442
"/stores/{store_id}/changes".replace("{store_id}", store_id),
23732443
"GET",
@@ -2542,6 +2612,11 @@ async def write_with_http_info(self, body, **kwargs):
25422612
),
25432613
}
25442614

2615+
telemetry_attributes = TelemetryAttributes.fromBody(
2616+
body=body_params,
2617+
attributes=telemetry_attributes,
2618+
)
2619+
25452620
return await self.api_client.call_api(
25462621
"/stores/{store_id}/write".replace("{store_id}", store_id),
25472622
"POST",
@@ -2729,6 +2804,11 @@ async def write_assertions_with_http_info(
27292804
),
27302805
}
27312806

2807+
telemetry_attributes = TelemetryAttributes.fromBody(
2808+
body=body_params,
2809+
attributes=telemetry_attributes,
2810+
)
2811+
27322812
return await self.api_client.call_api(
27332813
"/stores/{store_id}/assertions/{authorization_model_id}".replace(
27342814
"{store_id}", store_id
@@ -2906,6 +2986,11 @@ async def write_authorization_model_with_http_info(self, body, **kwargs):
29062986
),
29072987
}
29082988

2989+
telemetry_attributes = TelemetryAttributes.fromBody(
2990+
body=body_params,
2991+
attributes=telemetry_attributes,
2992+
)
2993+
29092994
return await self.api_client.call_api(
29102995
"/stores/{store_id}/authorization-models".replace("{store_id}", store_id),
29112996
"POST",

0 commit comments

Comments
 (0)