Rbac¶
- class observabilityclient.rbac.PromQLRbac(prom_api_client, project_id, project_label='project')
Bases:
object
- append_rbac_labels(query)
Append rbac labels to queries.
It’s a simplified and faster version of modify_query(). This just appends the labels at the end of the query string. For proper handling of complex queries, where metric names might occure elsewhere than just at the end, please use the modify_query() function.
- Parameters:
query (str) – The query to append to
- modify_query(query, metric_names=None)
Add rbac labels to a query.
- Parameters:
query (str) – The query to modify
metric_names (list) – List of metric names currently stored in prometheus. For correct function of the query modification, it’s important for the list to be accurate and to include all metrics across all tenants. This parameter can be unspecified or None, in which case the list will be retrieved from Prometheus by sending an API request to it. It’s advised to provide the metric list when doing a query modification in a loop for performance purposes.