# Why does metrics API try to apply filter to a dimensionless metric?

**URL:** <https://community.dynatrace.com/t/why-does-metrics-api-try-to-apply-filter-to-a-dimensionless-metric/34611>\
**Category:** Dynatrace API\
**Tags:** dynatrace-managed, dynatrace-api\
**Created:** [March 24, 2022, 10:39am UTC](https://community.dynatrace.com/t/why-does-metrics-api-try-to-apply-filter-to-a-dimensionless-metric/34611 "2022-03-24T10:39:35Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![ext-Antti\_Elonh](https://avatars.discourse-cdn.com/v4/letter/e/a698b9/32.png) [@ext-Antti\_Elonh](https://community.dynatrace.com/u/ext-Antti_Elonh)\
**Post date:** [March 24, 2022, 10:39am UTC](https://community.dynatrace.com/t/why-does-metrics-api-try-to-apply-filter-to-a-dimensionless-metric/34611/1 "2022-03-24T10:39:35Z")

</div>

I have a problem trying to configure alerting (custom anomaly detection) where the calculation includes one dimensionless metric and another with the wished dimensions. The same metric expression works great in Data explorer and dashboards but not in alerting because the metrics API tries to apply the filter also to the dimensionless metric.

The metric expression uses Prometheus metrics exposed by cert-manager like this:

```markup
(certmanager_certificate_renewal_timestamp_seconds:splitBy("name","namespace","k8s.deployment.name","dt.entity.kubernetes_cluster")/86400)-(certmanager_clock_time_seconds_gauge:splitBy()/86400)

```

I have checked the Dynatrace server logs and the actual alerting component queries metrics API for each combination with selector as this:

```markup
((certmanager_certificate_renewal_timestamp_seconds:splitBy(name,namespace,\"k8s.deployment.name\",\"dt.entity.kubernetes_cluster\")/86400)-(certmanager_clock_time_seconds_gauge:splitBy()/86400)):filter(eq(\"dt.entity.kubernetes_cluster\",KUBERNETES_CLUSTER-4F32D9E28C22C7F1),eq(\"k8s.deployment.name\",cert-manager),eq(name,test-cert),eq(namespace,test-namespace))

```

If I try that query in Data explorer it fails because it tries to apply the filter also to that dimensionless metric “certmanager\_clock\_time\_seconds\_gauge:splitBy()” - it’s made dimensionless with that empty splitBy.

I’m just wondering why does Dynatrace even try to apply a filter to a dimensionless metric because it would always fail?

---

<div class="post-metadata">

**Author:** ![wolfgang\_beer](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/wolfgang_beer/32/14717_2.png) [@wolfgang\_beer](https://community.dynatrace.com/u/wolfgang_beer)\
**Post date:** [March 24, 2022, 11:34am UTC](https://community.dynatrace.com/t/why-does-metrics-api-try-to-apply-filter-to-a-dimensionless-metric/34611/2 "2022-03-24T11:34:55Z")

</div>

Yes that is a bug we recently encountered in the alerting module. We are working on a fix.

---

<div class="post-metadata">

**Author:** ![ext-Antti\_Elonh](https://avatars.discourse-cdn.com/v4/letter/e/a698b9/32.png) [@ext-Antti\_Elonh](https://community.dynatrace.com/u/ext-Antti_Elonh)\
**Post date:** [March 24, 2022, 1:12pm UTC](https://community.dynatrace.com/t/why-does-metrics-api-try-to-apply-filter-to-a-dimensionless-metric/34611/3 "2022-03-24T13:12:37Z")

</div>

I understand that this can be fixed in the alerting module also but I think there should be a fix in the metrics API as well.

The documentation basically says that a fixed number and a dimensionless metric behave similarly (creating tuples etc.) except that a dimensionless metric is a series. They still don’t behave the same regarding that filter transformation. I think they should both be excluded from filter transformation and it might have solved the issue also in this other topic: [https://community.dynatrace.com/t5/Dashboarding/I-can-t-create-latency-SLO-using-calculated-metric/m-p/176085](https://community.dynatrace.com/post/176085)

---

<div class="post-metadata">

**Author:** ![wolfgang\_beer](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/wolfgang_beer/32/14717_2.png) [@wolfgang\_beer](https://community.dynatrace.com/u/wolfgang_beer)\
**Post date:** [March 24, 2022, 3:03pm UTC](https://community.dynatrace.com/t/why-does-metrics-api-try-to-apply-filter-to-a-dimensionless-metric/34611/4 "2022-03-24T15:03:17Z")

</div>

Yes sorry I was not precise enough. We are working on a fix at the moment and the fix is done in the metric query subsystem that includes a fix on API as well as on alerting.

Best greetings,

Wolfgang

---

<div class="post-metadata">

**Author:** ![ext-Antti\_Elonh](https://avatars.discourse-cdn.com/v4/letter/e/a698b9/32.png) [@ext-Antti\_Elonh](https://community.dynatrace.com/u/ext-Antti_Elonh)\
**Post date:** [May 2, 2022, 8:10am UTC](https://community.dynatrace.com/t/why-does-metrics-api-try-to-apply-filter-to-a-dimensionless-metric/34611/5 "2022-05-02T08:10:07Z")

</div>

Hi, [@wolfgang\_beer](https://community.dynatrace.com/user/8624) . Could you tell in which version of a Managed Dynatrace can we expect the fix?

---

<div class="post-metadata">

**Author:** ![wolfgang\_beer](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/wolfgang_beer/32/14717_2.png) [@wolfgang\_beer](https://community.dynatrace.com/u/wolfgang_beer)\
**Post date:** [May 2, 2022, 9:01am UTC](https://community.dynatrace.com/t/why-does-metrics-api-try-to-apply-filter-to-a-dimensionless-metric/34611/6 "2022-05-02T09:01:05Z")

</div>

Hi&nbsp;[@ext-Antti\_Elonh](https://community.dynatrace.com/user/2211)&nbsp;there are 2 topics still upcoming for DT Managed support which are:

- View the list of problems (precondition is Managed Release 240)

- Push notifications for Managed Environments (expect that in Mai)

Best greetings,

Wolfgang

---

<div class="post-metadata">

**Author:** ![ext-Antti\_Elonh](https://avatars.discourse-cdn.com/v4/letter/e/a698b9/32.png) [@ext-Antti\_Elonh](https://community.dynatrace.com/u/ext-Antti_Elonh)\
**Post date:** [May 3, 2022, 10:09am UTC](https://community.dynatrace.com/t/why-does-metrics-api-try-to-apply-filter-to-a-dimensionless-metric/34611/7 "2022-05-03T10:09:13Z")

</div>

Hi,  
I was wondering about the fix to metric query problem in anomaly detection.

---

<div class="post-metadata">

**Author:** ![wolfgang\_beer](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/wolfgang_beer/32/14717_2.png) [@wolfgang\_beer](https://community.dynatrace.com/u/wolfgang_beer)\
**Post date:** [May 10, 2022, 8:15am UTC](https://community.dynatrace.com/t/why-does-metrics-api-try-to-apply-filter-to-a-dimensionless-metric/34611/8 "2022-05-10T08:15:05Z")

</div>

According to what I see from dev side, this reported issue was fixed with Dynatrace release 239.

Best greetings,

Wolfgang

---

<div class="post-metadata">

**Author:** ![ext-Antti\_Elonh](https://avatars.discourse-cdn.com/v4/letter/e/a698b9/32.png) [@ext-Antti\_Elonh](https://community.dynatrace.com/u/ext-Antti_Elonh)\
**Post date:** [May 25, 2022, 1:56pm UTC](https://community.dynatrace.com/t/why-does-metrics-api-try-to-apply-filter-to-a-dimensionless-metric/34611/9 "2022-05-25T13:56:09Z")

</div>

Our managed cluster was updated to v1.240 last night and these custom alerts started to work as expected.

---

<div class="post-metadata">

**Author:** ![wolfgang\_beer](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/wolfgang_beer/32/14717_2.png) [@wolfgang\_beer](https://community.dynatrace.com/u/wolfgang_beer)\
**Post date:** [May 30, 2022, 5:51am UTC](https://community.dynatrace.com/t/why-does-metrics-api-try-to-apply-filter-to-a-dimensionless-metric/34611/10 "2022-05-30T05:51:19Z")

</div>

[@ext-Antti\_Elonh](https://community.dynatrace.com/user/2211)&nbsp;Excellent, many thanks for sharing this confirmation with us!

Best greetings,

Wolfgang
