# MetricSelector for Properties Attribute

**URL:** <https://community.dynatrace.com/t/metricselector-for-properties-attribute/42178>\
**Category:** Dynatrace API\
**Tags:** dynatrace-api\
**Created:** [October 19, 2023, 6:40am UTC](https://community.dynatrace.com/t/metricselector-for-properties-attribute/42178 "2023-10-19T06:40:15Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![abnerlusung](https://avatars.discourse-cdn.com/v4/letter/a/58956e/32.png) [@abnerlusung](https://community.dynatrace.com/u/abnerlusung)\
**Post date:** [October 19, 2023, 6:40am UTC](https://community.dynatrace.com/t/metricselector-for-properties-attribute/42178/1 "2023-10-19T06:40:15Z")

</div>

Hi all,

Need help for creating Metric Selectors to select this service and lookup the publicCloudId.

This is the JSON.

```markup
{
  "entityId": "SERVICE-ABCDEF",
  "type": "SERVICE",
  "displayName": "demo-name in ap-southeast-1",
  "firstSeenTms": 1695795958177,
  "lastSeenTms": 1697695446317,
  "properties": {
    "serviceType": "RPC_SERVICE",
    "detectedName": "demo-name in ap-southeast-1",
    "isExternalService": false,
    "publicCloudRegion": "ap-southeast-1",
    "publicCloudId": "arn‌‌lambda:ap-southeast-1:123456789:function:demo-name",
    "softwareTechnologies": [
      {
        "type": "NODE_JS"
      },
      {
        "type": "AWS_LAMBDA"
      }
    ],
    "agentTechnologyType": "N/A"
  },
  "tags": [],
  "managementZones": [
    {
      "id": "987654321",
      "name": "demoMZ"
    }
  ],
  "icon": {
    "primaryIconType": "aws-lambda"
  },
  "fromRelationships": {
    "runsOn": [
      {
        "id": "AWS_LAMBDA_FUNCTION-ABC123",
        "type": "AWS_LAMBDA_FUNCTION"
      }
    ],
    "calls": [
      {
        "id": "SERVICE-ABC123",
        "type": "SERVICE"
      },
      {
        "id": "SERVICE-ABC1234",
        "type": "SERVICE"
      },
      {
        "id": "SERVICE-ABC12345",
        "type": "SERVICE"
      }
    ]
  },
  "toRelationships": {
    "isGroupOf": [
      {
        "id": "SERVICE_METHOD_GROUP-ABC123",
        "type": "SERVICE_METHOD_GROUP"
      }
    ]
  }
}

```

Cannot use the following:

```auto
"message": "Unknown predicate name publicCloudId",

```

Any ideas?

Thanks,

Abner

---

<div class="post-metadata">

**Author:** ![victor\_balbuena](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/victor_balbuena/32/9773_2.png) [@victor\_balbuena](https://community.dynatrace.com/u/victor_balbuena)\
**Post date:** [October 19, 2023, 10:43am UTC](https://community.dynatrace.com/t/metricselector-for-properties-attribute/42178/2 "2023-10-19T10:43:52Z")

</div>

Can you please elaborate more on your question and provide some more screenshots/data?

From what I see in the question, you’re trying to use a metric selector that uses an entity’s property, in this case the&nbsp; **publicCloudId**. In order to do that, you need to use an&nbsp;[entity selector](https://www.dynatrace.com/support/help/dynatrace-api/environment-api/entity-v2/entity-selector) insice the [metric selector](https://www.dynatrace.com/support/help/dynatrace-api/environment-api/metric-v2/metric-selector#data-filtering). However, there is a limited set of properties you can use from each entity type in an entity selector, as decribed [here](https://www.dynatrace.com/support/help/shortlink/api-entities-v2-selector#attribute). You will need to call the [GET entity type API](https://www.dynatrace.com/support/help/dynatrace-api/environment-api/entity-v2/get-entity-type) for, in this case, the SERVICE entity type, and check the&nbsp; **properties** field. If the&nbsp; **publicCloudId** is in there, you can use it. If not, you will have to find a workaround with tags or something else to filter your metric selector by your service.

---

<div class="post-metadata">

**Author:** ![abnerlusung](https://avatars.discourse-cdn.com/v4/letter/a/58956e/32.png) [@abnerlusung](https://community.dynatrace.com/u/abnerlusung)\
**Post date:** [October 20, 2023, 2:25am UTC](https://community.dynatrace.com/t/metricselector-for-properties-attribute/42178/3 "2023-10-20T02:25:48Z")

</div>

Hi&nbsp;[@victor\_balbuena](https://community.dynatrace.com/user/3978)

The JSON above is from the Get Entity Type API.

As you saw, it has the publicCloudId property but cannot use. Why?

Regards,

Abner

---

<div class="post-metadata">

**Author:** ![victor\_balbuena](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/victor_balbuena/32/9773_2.png) [@victor\_balbuena](https://community.dynatrace.com/u/victor_balbuena)\
**Post date:** [October 23, 2023, 6:47am UTC](https://community.dynatrace.com/t/metricselector-for-properties-attribute/42178/4 "2023-10-23T06:47:39Z")

</div>

The [entities API](https://www.dynatrace.com/support/help/dynatrace-api/environment-api/entity-v2) and the [entities type API](https://www.dynatrace.com/support/help/dynatrace-api/environment-api/entity-v2/get-all-entity-types) are different APIs. You’re using the first one and it’s the second one to tell you if you can use the property or not.

---

<div class="post-metadata">

**Author:** ![abnerlusung](https://avatars.discourse-cdn.com/v4/letter/a/58956e/32.png) [@abnerlusung](https://community.dynatrace.com/u/abnerlusung)\
**Post date:** [October 24, 2023, 6:25am UTC](https://community.dynatrace.com/t/metricselector-for-properties-attribute/42178/5 "2023-10-24T06:25:47Z")

</div>

I tried the entities type API, it returned the property

```auto
publicCloudId

```

See screenshot Dynatrace.png

It means, I can use the property? But why right now, it’s returning an error?

 ![Dynatrace.png](https://global.discourse-cdn.com/dynatrace/original/3X/3/4/34d2cebc1124b96d0a1841b399e47390ac1a08be.png)

---

<div class="post-metadata">

**Author:** ![victor\_balbuena](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/victor_balbuena/32/9773_2.png) [@victor\_balbuena](https://community.dynatrace.com/u/victor_balbuena)\
**Post date:** [October 24, 2023, 6:29am UTC](https://community.dynatrace.com/t/metricselector-for-properties-attribute/42178/6 "2023-10-24T06:29:53Z")

</div>

As per the documentation, yes. The problem is probably on the metric selector or the entity selector, mind sharing that too?

---

<div class="post-metadata">

**Author:** ![abnerlusung](https://avatars.discourse-cdn.com/v4/letter/a/58956e/32.png) [@abnerlusung](https://community.dynatrace.com/u/abnerlusung)\
**Post date:** [October 24, 2023, 6:42am UTC](https://community.dynatrace.com/t/metricselector-for-properties-attribute/42178/7 "2023-10-24T06:42:10Z")

</div>

Correct, the expected/documentation vs actual results does not match.

Please see attached Dynatrace2.png

 ![Dynatrace2.png](https://global.discourse-cdn.com/dynatrace/original/2X/7/71e0a8123dcb060bf9424ecb26922fc44d36fc8c.png)

---

<div class="post-metadata">

**Author:** ![victor\_balbuena](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/victor_balbuena/32/9773_2.png) [@victor\_balbuena](https://community.dynatrace.com/u/victor_balbuena)\
**Post date:** [October 24, 2023, 7:03am UTC](https://community.dynatrace.com/t/metricselector-for-properties-attribute/42178/8 "2023-10-24T07:03:32Z")

</div>

You’re right, as per the documentation, that&nbsp; **entitySelector** should work and it doesn’t. I guess the best course of action at this point is a Dynatrace support ticket, as this is potentially a bug, or some kind of exception tht’s not documented.
