elastic / elastic/apm-agent-nodejs

Amazon SQS: How to Support context.message.age.ms

Open
#2,026 0 comments 0 reactions 0 assignees View on GitHub
agent-nodejs
Dominant language
JavaScript
Stars
594
Forks
244
Avg merge
1d 8h
Merged PRs (30d)
16

Description

The [current messaging spec](https://github.com/elastic/apm/blob/master/specs/agents/tracing-instrumentation-messaging.md#context-fields) includes an optional `context.message.age.ms` field.

> optional for message/record receivers only (transactions or spans). A numeric field indicating the message's age in milliseconds. Relevant for transactions and receive spans that receive valid messages. There is no accurate definition as to how this is calculated. If the messaging framework provides a timestamp for the message- agents may use it (subtract the message/record timestamp from the read timestamp). If a timestamp is not available- agents should omit this field or find an alternative and document it in this spec. For example, the sending agent can add a timestamp to the message's metadata to be retrieved by the receiving agent.
Clock skews between agents are ignored, unless the calculated age (receive-timestamp minus send-timestamp) is negative, in which case the agent should report 0 for this field.

This is not a straight forward metric for the Node Agent to produce. Our `receiveMessage: 'poll',` is not linked to an individual span, and it becomes murky what this value should be. (we do have min/max/avg queue delay metrics which measure the same thing).

We should investigate whether it's possible to support `context.message.age.ms` on individual receiving spans.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.