elastic / elastic/apm-agent-nodejs

add `db.statement` to 'mongodb' instrumentation

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

Description

(https://github.com/elastic/apm-agent-nodejs/pull/2882 will be adding the beginnings of "db" context to spans from the 'mongodb' instrumentation.)

Currently our [mongodb instrumentation](https://github.com/elastic/apm-agent-nodejs/blob/main/lib/instrumentation/modules/mongodb.js) does not set `db.statement`. I believe the info is *available* in the `onStart` event. The thing to figure is how to create "The MongoDB command encoded as MongoDB Extended JSON." from `event.command` and set `db.statement` to that.

Food for thought: The current (experimental) [OTel semantic conventions for databases](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/trace/semantic_conventions/database.md#mongodb) includes a MongoDB example that shows `db.statement` *not* being set. That may stem mainly from their recommended to *not* do any client-side parsing of DB statements to gather span fields.

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.