15 Dec 2023 11:15 AM - last edited on 15 Dec 2023 02:39 PM by Ana_Kuzmenchuk
Hi,
I'm writing an Extension 2.0 for SQL data sources and I want to give custom metric metadata like display name and unit.
A sample looks like this:
- group: ingestor_metrics
featureSet: ingestor
query: >
SELECT
topic_name,
EXTRACT(epoch FROM CURRENT_TIMESTAMP AT TIME ZONE 'utc' - max(commit_timestamp))::float AS last_inserted_at
FROM
statement_enrichment.ingestion_execution_log c
GROUP BY topic_name
dimensions:
- key: custom_cosmosdb.postgres.extension.ingestor.topic_name
value: col:topic_name
metrics:
- key: custom_cosmosdb.postgres.extension.ingestor.last_inserted_at
displayName: Last Inserted
unit: Seconds
value: col:last_inserted_at
type: gauge
interval:
minutes: 2
I have the VSCode add-on and it throws an error that displayName and unit are not allowed. I tried loading an earlier schema (1.253 instead of 1.279 which I'm working now) and it still doesn't allow it.
I tried also to pass them as metadata like this:
- group: ingestor_metrics
featureSet: ingestor
query: >
SELECT
topic_name,
EXTRACT(epoch FROM CURRENT_TIMESTAMP AT TIME ZONE 'utc' - max(commit_timestamp))::float AS last_inserted_at
FROM
statement_enrichment.ingestion_execution_log c
GROUP BY topic_name
dimensions:
- key: custom_cosmosdb.postgres.extension.ingestor.topic_name
value: col:topic_name
metrics:
- key: custom_cosmosdb.postgres.extension.ingestor.last_inserted_at
value: col:last_inserted_at
type: gauge
interval:
minutes: 2
metadata:
displayName: Last Inserted
unit: Seconds
and I'm getting the error that metadata is not allowed.
Am I missing something?
George
Solved! Go to Solution.
15 Dec 2023 01:53 PM
Hi,
Put this in the root of the YAML instead of under the sql section:
metrics:
- key: custom_costmosdb.postgres.extension.ingestor.last_inserted_at
metadata:
tags:
- myTag
displayName: Last Inserted
unit: Seconds