-
Notifications
You must be signed in to change notification settings - Fork 117
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add specs for host.id and profiler registration message #853
Conversation
specs/agents/metadata.md
Outdated
@@ -75,6 +76,13 @@ hostname if `configured_hostname` is not provided. | |||
Agents that are APM-Server-version-aware, or that are compatible only with versions >= 7.4, should | |||
use the new fields wherever applicable. | |||
|
|||
#### Host.id | |||
|
|||
Agents MAY collect the `host.id` as an unique identifier for the host. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As we have two agents involved here (the APM agent and the profiling host agent) we should always qualify which agent we actually mean. Also there are inconsistencies in terminology throughout the document. We call the APM agent:
- APM agent
- APM-agent
- agent
and the profiling host agent:
- profiling host agent
- profiler host agent
- host agent
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've clarified the "agent" usages in this section.
For the rest of the document, the inconsistencies come from the fact that this document was originally intended as only an APM-agent spec. This metadata spec is also becoming less important as we move to Otel SemConv, which effectively will replace this spec.
I'm just adding the host.id
here, because we intend to also add the universal profiling integration to the old elastic-apm-agent java
to allow easier adoption for existing users.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As discussed in the agents weekly: host.id
as a new metadata field on intake lgtm.
@@ -83,6 +83,8 @@ transaction-id | uint8[8] | |||
* *span-id*: The W3C trace id of the currently active span | |||
* *transaction-id*: The W3C span id of the currently active transaction (=the local root span) | |||
|
|||
APM-agents MAY start populating the thread-local storage only after receiving a host agent [registration message](#profiler-registration-message) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nit] Do we have use-cases where the agent should populate this TLS without waiting for the registration message ? If so, then a "SHOULD" sounds more appropriate as updating this TLS seems useless if the profiler is not available.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The use case would be if you collect traces for the application startup and what to have profiling data for those at the very beginning:
There will be a short delay between application startup and receiving this initial registration message. As a result, spans started and activated before that receival would not get correlated.
This can be overcome for those edge cases by eagerly populating the TLS, even if it is not known whether a profiler is already there.
I'm planning to implement this by having a tri-state enabled
config option:
false
: No correlation, the native lib won't even be loadedtrue
: Correlation active, TLS will be eagerly populatedauto
(default for OTel-extension): Correlation will be active, TLS will only be populated after receiving the profiler registration message (So basically close to zero overhead if no profiler is active)
@@ -188,6 +203,6 @@ stack-trace-id | uint8[16] | |||
count | uint16 | |||
|
|||
* *trace-id*: The APM W3C trace id of the trace which was active for the given profiling samples | |||
* *trace-id*: The APM W3C transaction id of the transaction which was active for the given profiling samples | |||
* *transaction-id*: The APM W3C transaction id of the transaction which was active for the given profiling samples |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does the W3C spec contains anything about the "transactions" ? From what I recall it's only about tracestate
and traceparent
(with a trace-id
and parent-id
as fields) (ref) but I might definitely have missed something.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ooops, this should be The APM W3C span id of the transaction
Co-authored-by: Joel Höner <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
As mentioned at elastic/beats#38689 (comment) using |
The agent also won't always collect the |
That's not what I get from the specs. If we shouldn't provide it ourselves without the profiler it would be nice to write it explicitly. |
Sorry, I was referring to the planned implementation details of the java-agent. The current wording is
This means agents are not required to do so, but might if they want to. It should be changed to MUST if we desire to force all agents to provide the |
The UI for profiling data relies on the
host.id
field for certain calculations, including the cost and CO2-consumption estimates. In order to correctly provide those values for profiling data stored on transaction documents, those need to have thehost.id
too.Therefore this spec adds the
host.id
as an optional, new metadata field forIntakeV2
. The field is only required to be populated when an agent actually is correlating transactions with profiling data.Because the otel-compliant
host.id
can sometimes only be derived correctly with root permissions, this spec change also adds a way of receiving thehost.id
directly from the profiling host agent.CODEOWNERS
)To auto-merge the PR, add
/
schedule YYYY-MM-DD
to the PR description.