# Custom metric metadata on lastest versions

**URL:** <https://community.dynatrace.com/t/custom-metric-metadata-on-lastest-versions/43227>\
**Category:** Extensions\
**Tags:** dynatrace-managed, extensions\
**Created:** [December 15, 2023, 11:15am UTC](https://community.dynatrace.com/t/custom-metric-metadata-on-lastest-versions/43227 "2023-12-15T11:15:37Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![g\_kat](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/g_kat/32/34573_2.png) [@g\_kat](https://community.dynatrace.com/u/g_kat)\
**Post date:** [December 15, 2023, 11:15am UTC](https://community.dynatrace.com/t/custom-metric-metadata-on-lastest-versions/43227/1 "2023-12-15T11:15:37Z")

</div>

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:

```markup
- 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:

```markup
- 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

---

<div class="post-metadata">

**Author:** ![Mike\_L](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/mike_l/32/11717_2.png) [@Mike\_L](https://community.dynatrace.com/u/Mike_L)\
**Post date:** [December 15, 2023, 1:53pm UTC](https://community.dynatrace.com/t/custom-metric-metadata-on-lastest-versions/43227/2 "2023-12-15T13:53:48Z")

</div>

Hi,

Put this in the root of the YAML instead of under the sql section:

```markup
metrics:
  - key: custom_costmosdb.postgres.extension.ingestor.last_inserted_at
    metadata:
      tags:
        - myTag
      displayName: Last Inserted
      unit: Seconds

```
