Skip to content

Expose OpenSearch search body to its span db.query.text #15466

@mznet

Description

@mznet

Is your feature request related to a problem? Please describe.

The current OpenSearch instrumentation exposes a mixture of method and operation to db.query.text instead of the query body. Refer to semconv, db.query.text should be search type query text and also sanitized.

Describe the solution you'd like

  1. Extract search query body.
  2. Sanitize the search query body, masking value with question mark in leaf nodes. If impossible, expose a mixture of method and operation as before.

raw query:

"query": {
        "bool": {
            "must": [
                {"term": {"user_email": "[email protected]"}},
                {"term": {"ssn": "123-45-6789"}},
                {"term": {"credit_card": "4111-1111-1111-1111"}},
            ]
        }
    }

sanitized query:

"query": {
        "bool": {
            "must": [
                {"term": {"user_email": "?"}},
                {"term": {"ssn": "?"}},
                {"term": {"credit_card": "?"}},
            ]
        }
    }

Describe alternatives you've considered

No response

Additional context

#14823 (comment)

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    contribution welcomeRequest makes sense, maintainers probably won't have time, contribution would be welcomeenhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions