elastic / kibana

Your window into the Elastic Stack
https://www.elastic.co/products/kibana
Other
19.72k stars 8.14k forks source link

[APM] Service icons metadata endpoint doesn't apply environment filter #175662

Open kpatticha opened 7 months ago

kpatticha commented 7 months ago

We didn't consider the case where each environment could use different cloud provider or platform.

https://github.com/elastic/kibana/blob/beff74e19e94c7d3c609a2be0cb1d4b2f28da043/x-pack/plugins/apm/server/routes/services/route.ts#L282-L311

elasticmachine commented 7 months ago

Pinging @elastic/apm-ui (Team:APM)

elasticmachine commented 7 months ago

Pinging @elastic/obs-ux-infra_services-team (Team:obs-ux-infra_services)

neptunian commented 7 months ago

@kpatticha Since the query only returns one document, I think that could be the problem where no value is returned. I tried querying my edge cluster data and was able to get documents that have no values:

GET /metrics-apm*,apm-*,logs-apm*/_search
{
  "size": 10,
  "query": {
    "bool": {
      "must_not": [
        {
          "exists": {
            "field": "cloud.provider"
          }
        }
      ],
      "filter": [
        {
          "term": {
            "service.name": "heartbeat"
          }
        },
        {
          "range": {
            "@timestamp": {
              "gte": "now-15m/m",
              "lte": "now"
            }
          }
        }
      ]
    }
  },
  "aggs": {
    "by_environment": {
      "terms": {
        "field": "service.environment",
        "size": 10
      },
      "aggs": {
        "missing_cloud_provider_count": {
          "missing": {
            "field": "cloud.provider"
          }
        }
      }
    }
  }
}

It seems like it could be possible that no value is returned for cloud.provider if it falls out of the time range or the highest ranked document doesn't include this field because it includes the other fields.