elastic / apm-agent-ruby

https://www.elastic.co/solutions/apm
Apache License 2.0
168 stars 131 forks source link

`host.name` assigned with `pod.name` #1474

Closed crespocarlos closed 2 months ago

crespocarlos commented 2 months ago

Describe the bug

When viewing the Hosts UI with Ruby APM service active in a k8s pod, Ruby agent monitored services report the pod name in the host.name, which makes the Hosts View display hosts that do not correlate with hosts monitored by the system integration.

Steps to reproduce

edge-oblt can be used for the above.

Expected behavior

Only hosts (VMs) are expected to be present in the Hosts View.

Additional context

There was a ticket opened for this issue, but apparently, the problem persists: https://github.com/elastic/apm-agent-ruby/issues/1292

image image image

Sample doc

{
  "_index": ".ds-metrics-apm.internal-default-2024.07.17-000005",
  "_id": "_PQbxZABSDGMOSNlRFmU",
  "_score": 0,
  "_source": {
    "agent": {
      "name": "ruby",
      "version": "4.7.3"
    },
    "cloud": {
      "availability_zone": "us-central1-c",
      "instance": {
        "id": "899642394284519665",
        "name": "gke-edge-oblt-edge-oblt-pool-8fc2868f-vmqk"
      },
      "machine": {
        "type": "e2-highcpu-4"
      },
      "project": {
        "id": "elastic-observability"
      },
      "provider": "gcp",
      "region": "us-central1"
    },
    "data_stream": {
      "dataset": "apm.internal",
      "namespace": "default",
      "type": "metrics"
    },
    "host": {
      "architecture": "x86_64",
      "hostname": "opbeans-ruby-ccb6447c9-4srwm",
      "ip": "34.66.231.196",
      "name": "opbeans-ruby-ccb6447c9-4srwm",
      "os": {
        "platform": "linux"
      }
    },
    "metricset": {
      "name": "span_breakdown"
    }
  }
}
crespocarlos commented 2 months ago

I had a quick call with @Mpdreamz , and he explained that the non-matching host names shipped by APM agents are due to missing configuration as exemplified in this comment https://github.com/elastic/observability-dev/issues/3321#issuecomment-2236909682.