Metrics API v2 - unit State in Extension

In extension 1.0 , I had a statetimeseries metric as below:

{ “statetimeseries”: { “key”: “host_state”, “states”: [“UNHEALTHY”, “HEALTHY”, “INPROCESS”], “displayname”: “Host State” }}For migration to extension 2.0 , I am unable determine that how to define/map the states in yaml  since there seems to be no “states” option under metadata :- key: host_state    metadata:      displayName: Node State      unit: State

State metrics no longer exist. The best solution is to use dimension values to indicate the state. For instance if it is  INPROCESS, we set the dimension to inprocess and the value to 1 (true), we can either not set the other values or set them to 0 (false).

mymetric, metricstate=“INPROCESS” 1

mymetric, metricstate=“HEALTHY” 0

mymetric, metricstate=“UNHEALTHY” 0

By using below way , isn’t it that both HEALTHY and UNHEALTHY will both get same values.

mymetric, metricstate=“INPROCESS” 1

mymetric, metricstate=“HEALTHY” 0

mymetric, metricstate=“UNHEALTHY” 0

For the above metric solution , should we report metric in below way:

self.report_metric(“mymetric”, metricstate=“INPROCESS” 1 ,{“host”:host_entity.id})Or is it that dimension value needs to be set in YAML:- key: host_state    metadata:      displayName: Node State      unit: State      dimensions:        - key: host          displayName: Host

yes they can have the same value. With dimensions it is almost like having 3 separate metrics. It is best to set them all because when charting it will look better as all 3 values will show.

You don’t need to set the host in the dimension as it will be done automatically for you if your extension is local. You should add the metricstatus dimension in the definition too.