Generate name suggestion for database sourced metrics based on keypath
Background
During research work for new naming convention for database sourced metrics, we've decided to use underlying SQL as source for metric name. In order to help apply new naming convention onto metrics, we've decided that metrics names should be generated automatically.
PoC of metric names generator !54077 (closed)
Goal
For database sourced metrics, generate metric name proposal based on key_path
attribute. In the current iteration metric name should follow templates:
- operation_<adjective_describing>_target
This template is used when operation target is not a foreign key to other relation
Eg:
"SELECT COUNT("project_auto_devops"."id") FROM "project_auto_devops" WHERE "project_auto_devops"."enabled" = FALSE"
Should generate name: count_<adjectives describing>_project_auto_devops
- operation_target_having__source
This template is used when operation target is a foreign key to other relation
Eg:
SELECT COUNT(DISTINCT "container_expiration_policies"."project_id") FROM "container_expiration_policies" WHERE "container_expiration_policies"."enabled" = FALSE
Should generate name count_distinct_projects_having_<adjectives describing>_container_expiration_policies