elastic / apm

Elastic Application Performance Monitoring - resources and general issue tracking for Elastic APM.
https://www.elastic.co/apm
Apache License 2.0
384 stars 114 forks source link

Capture FQDN in APM agents #805

Closed SylvainJuge closed 1 year ago

SylvainJuge commented 1 year ago

Summary

Specification change for #793 .

APM agents should capture the FQDN instead of just the host name, APM Server will handle compatibility with current behavior through configuration (as it's a breaking change).

Fixes #794


Checklist


trentm commented 1 year ago

Q2: Should we also be specifying that the FQDN should be lowercased, as the ECS host.name docs recommend? The libbeat impl is lowercasing.

Another argument for lowercasing, at least for Windows is this from MS docs (https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/hostname):

Environment variable %COMPUTERNAME% usually will print the same string as hostname, but in uppercase.

Aside: Yeah Microsoft for (a) the uppercasing and (b) especially for the "usually".

SylvainJuge commented 1 year ago

Q1: Does the "avoid using DNS" warning/condition apply now that we prefer getting the FQDN?

A1: I think capturing the FQDN will very probably involve a DNS query, while that might add some latency and introduce some flakyness I don't think we have better options. In the cases where it's not reliable the fallback using environment variables (the "standard ones" or our own) could still be used.

Q2: Should we also be specifying that the FQDN should be lowercased, as the ECS host.name docs recommend? The libbeat impl is lowercasing.

A2: we should lower-case, spec has been updated to cover this.

Q3: (Unrelated to FQDN) Do other implementations set both of metadata.hostname and metadata.detected_hostname or do you wait for APM Server version detection to know if the APM server is >=7.4?

A3: for Java at least we do check the server version >= before sending metadata.hostname and metadata.detected_hostname.