Make MongoDB query text opt-in and audit database-specific query attribute exclusions

オープン
#21,189 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
45/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
活発
技術スタック
java, mongodb

調査の方向性

Start with MongoDbAttributesGetter.getDbQueryText() in MongoDbAttributesGetter.java and trace how the shared database extractor records it. Compare agent and library instrumentation for synchronous and Reactive Streams clients, then audit the listed database exclusions against Java instrumentation. Check the MongoDB conformance scenario and document the opt-in configuration and migration; done means excluded query attributes default off where requested, other databases retain convention-appropriate behavior, and MongoDB summary generation remains absent.

索引モデルが issue の本文から書いたものです。

説明

bug needs triage
Describe the bug

MongoDB instrumentation records the sanitized BSON command as db.query.text by default. The MongoDB-specific semantic conventions exclude both db.query.text and db.query.summary from the inherited database client span attributes.

Track making MongoDB query capture explicitly opt-in, and audit other database instrumentations for the same default-capture mismatch. The existing sanitization option controls whether values are masked, not whether query text is collected.

Steps to reproduce

Run a MongoDB scenario from open-telemetry/semantic-conventions-conformance#136, with stable database semantic conventions enabled as configured by the scenario:

otel-conformance scenarios/database/java/mongodb/sync/opentelemetry-javaagent

Inspect a find client span. It contains db.query.text with the sanitized command, without an explicit query-capture opt-in. The linked PR also covers library instrumentation and the Reactive Streams driver.

Expected behavior

MongoDB should omit the excluded query attributes by default. Preserve its existing query-text capture through explicit opt-in, with sanitization enabled by default when capture is enabled. Apply the behavior consistently to agent and library instrumentation, including synchronous and Reactive Streams clients.

Audit the database-specific exclusions below against Java instrumentation. Keep query text enabled where the applicable conventions recommend it and their sanitization conditions are met. Do not apply a blanket default-off policy to all databases. Document the configuration and migration from the existing MongoDB default.

Actual behavior

MongoDbAttributesGetter.getDbQueryText() returns the sanitized command, and the shared database extractor records it unconditionally. MongoDB currently leaves db.query.summary unset; the audit should preserve that default rather than introduce summary generation.

Javaagent or library instrumentation version

2.33.1, as reported by the linked conformance PR. Default query-text capture is also present in source at e4f28d52cd0d26b3619de8c61b2ebc3ce9e831f6.

Environment

JDK: N/A for the source and semantic-convention audit.

OS: N/A for the source and semantic-convention audit.

MongoDB synchronous and Reactive Streams drivers, using Javaagent or opentelemetry-mongo-3.1 library instrumentation. The conformance scenarios enable stable database semantic conventions.

Additional context

Raised by this review discussion on open-telemetry/semantic-conventions-conformance#136. That PR no longer requires exact serialized command text.

An audit of semantic conventions v1.45.0 found these explicit exclusions from database client span refinements:

Database db.query.text db.query.summary
MongoDB Excluded Excluded
CouchDB Excluded Excluded
HBase Excluded Excluded
Redis Retained Excluded
Azure Cosmos DB Retained Excluded
Elasticsearch Retained Excluded

Cassandra, generic SQL, MariaDB, MySQL, PostgreSQL, Oracle Database, and Microsoft SQL Server do not remove either query attribute in their span refinements. DynamoDB uses separate AWS client span refinements rather than inheriting the general database client span model.

unref removes an attribute from the system-specific convention; it is not itself an explicit MUST NOT emit it. This issue tracks the requested opt-in default for excluded attributes, separately from the general query-text guidance, which recommends parameterized or adequately sanitized query text where applicable.

Tip

React with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding +1 or me too, to help us triage it. Learn more here.

主要言語
Java
スター
2.7k
フォーク
1.2k
平均マージ
1日 38分
マージ済み PR(30日)
337

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

open-telemetry/opentelemetry-java-instrumentation のほかの issue

open-telemetry/opentelemetry-java-instrumentation の issue をすべて見る

似ている issue

Java の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。