Skip to content

Commit

Permalink
feat: add attribute for batch_check checks size
Browse files Browse the repository at this point in the history
  • Loading branch information
ewanharris committed Dec 12, 2024
1 parent c9b2669 commit 70ac189
Show file tree
Hide file tree
Showing 9 changed files with 274 additions and 22 deletions.
35 changes: 18 additions & 17 deletions docs/opentelemetry.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,23 +30,24 @@ If you configure the OpenTelemetry SDK, these metrics will be exported and sent

### 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 |
| Attribute Name | Type | Enabled by Default | Description |
| ------------------------------------- | ------ | ------------------ | --------------------------------------------------------------------------------- |
| `fga-client.request.batch_check_size` | int | No | The total size of the `check` list in a `BatchCheck` call |
| `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 |

## Customizing Reporting

Expand Down
85 changes: 85 additions & 0 deletions openfga_sdk/api/open_fga_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,11 @@ async def batch_check_with_http_info(self, body, **kwargs):
),
}

telemetry_attributes = TelemetryAttributes.fromBody(
body=body_params,
attributes=telemetry_attributes,
)

return await self.api_client.call_api(
"/stores/{store_id}/batch-check".replace("{store_id}", store_id),
"POST",
Expand Down Expand Up @@ -375,6 +380,11 @@ async def check_with_http_info(self, body, **kwargs):
),
}

telemetry_attributes = TelemetryAttributes.fromBody(
body=body_params,
attributes=telemetry_attributes,
)

return await self.api_client.call_api(
"/stores/{store_id}/check".replace("{store_id}", store_id),
"POST",
Expand Down Expand Up @@ -536,6 +546,11 @@ async def create_store_with_http_info(self, body, **kwargs):
),
}

telemetry_attributes = TelemetryAttributes.fromBody(
body=body_params,
attributes=telemetry_attributes,
)

return await self.api_client.call_api(
"/stores",
"POST",
Expand Down Expand Up @@ -678,6 +693,11 @@ async def delete_store_with_http_info(self, **kwargs):
),
}

telemetry_attributes = TelemetryAttributes.fromBody(
body=body_params,
attributes=telemetry_attributes,
)

return await self.api_client.call_api(
"/stores/{store_id}".replace("{store_id}", store_id),
"DELETE",
Expand Down Expand Up @@ -852,6 +872,11 @@ async def expand_with_http_info(self, body, **kwargs):
),
}

telemetry_attributes = TelemetryAttributes.fromBody(
body=body_params,
attributes=telemetry_attributes,
)

return await self.api_client.call_api(
"/stores/{store_id}/expand".replace("{store_id}", store_id),
"POST",
Expand Down Expand Up @@ -1003,6 +1028,11 @@ async def get_store_with_http_info(self, **kwargs):
),
}

telemetry_attributes = TelemetryAttributes.fromBody(
body=body_params,
attributes=telemetry_attributes,
)

return await self.api_client.call_api(
"/stores/{store_id}".replace("{store_id}", store_id),
"GET",
Expand Down Expand Up @@ -1178,6 +1208,11 @@ async def list_objects_with_http_info(self, body, **kwargs):
),
}

telemetry_attributes = TelemetryAttributes.fromBody(
body=body_params,
attributes=telemetry_attributes,
)

return await self.api_client.call_api(
"/stores/{store_id}/list-objects".replace("{store_id}", store_id),
"POST",
Expand Down Expand Up @@ -1337,6 +1372,11 @@ async def list_stores_with_http_info(self, **kwargs):
),
}

telemetry_attributes = TelemetryAttributes.fromBody(
body=body_params,
attributes=telemetry_attributes,
)

return await self.api_client.call_api(
"/stores",
"GET",
Expand Down Expand Up @@ -1512,6 +1552,11 @@ async def list_users_with_http_info(self, body, **kwargs):
),
}

telemetry_attributes = TelemetryAttributes.fromBody(
body=body_params,
attributes=telemetry_attributes,
)

return await self.api_client.call_api(
"/stores/{store_id}/list-users".replace("{store_id}", store_id),
"POST",
Expand Down Expand Up @@ -1686,6 +1731,11 @@ async def read_with_http_info(self, body, **kwargs):
),
}

telemetry_attributes = TelemetryAttributes.fromBody(
body=body_params,
attributes=telemetry_attributes,
)

return await self.api_client.call_api(
"/stores/{store_id}/read".replace("{store_id}", store_id),
"POST",
Expand Down Expand Up @@ -1856,6 +1906,11 @@ async def read_assertions_with_http_info(self, authorization_model_id, **kwargs)
),
}

telemetry_attributes = TelemetryAttributes.fromBody(
body=body_params,
attributes=telemetry_attributes,
)

return await self.api_client.call_api(
"/stores/{store_id}/assertions/{authorization_model_id}".replace(
"{store_id}", store_id
Expand Down Expand Up @@ -2024,6 +2079,11 @@ async def read_authorization_model_with_http_info(self, id, **kwargs):
),
}

telemetry_attributes = TelemetryAttributes.fromBody(
body=body_params,
attributes=telemetry_attributes,
)

return await self.api_client.call_api(
"/stores/{store_id}/authorization-models/{id}".replace(
"{store_id}", store_id
Expand Down Expand Up @@ -2191,6 +2251,11 @@ async def read_authorization_models_with_http_info(self, **kwargs):
),
}

telemetry_attributes = TelemetryAttributes.fromBody(
body=body_params,
attributes=telemetry_attributes,
)

return await self.api_client.call_api(
"/stores/{store_id}/authorization-models".replace("{store_id}", store_id),
"GET",
Expand Down Expand Up @@ -2362,6 +2427,11 @@ async def read_changes_with_http_info(self, **kwargs):
),
}

telemetry_attributes = TelemetryAttributes.fromBody(
body=body_params,
attributes=telemetry_attributes,
)

return await self.api_client.call_api(
"/stores/{store_id}/changes".replace("{store_id}", store_id),
"GET",
Expand Down Expand Up @@ -2536,6 +2606,11 @@ async def write_with_http_info(self, body, **kwargs):
),
}

telemetry_attributes = TelemetryAttributes.fromBody(
body=body_params,
attributes=telemetry_attributes,
)

return await self.api_client.call_api(
"/stores/{store_id}/write".replace("{store_id}", store_id),
"POST",
Expand Down Expand Up @@ -2723,6 +2798,11 @@ async def write_assertions_with_http_info(
),
}

telemetry_attributes = TelemetryAttributes.fromBody(
body=body_params,
attributes=telemetry_attributes,
)

return await self.api_client.call_api(
"/stores/{store_id}/assertions/{authorization_model_id}".replace(
"{store_id}", store_id
Expand Down Expand Up @@ -2900,6 +2980,11 @@ async def write_authorization_model_with_http_info(self, body, **kwargs):
),
}

telemetry_attributes = TelemetryAttributes.fromBody(
body=body_params,
attributes=telemetry_attributes,
)

return await self.api_client.call_api(
"/stores/{store_id}/authorization-models".replace("{store_id}", store_id),
"POST",
Expand Down
Loading

0 comments on commit 70ac189

Please sign in to comment.