Skip to content

[sqlserverreceiver] Enrich db.server.query_sample with blocking and resource attributes#47259

Draft
splunk-shanu wants to merge 4 commits intoopen-telemetry:mainfrom
splunk-shanu:feat/sqlserver-query-sample-lock-fields
Draft

[sqlserverreceiver] Enrich db.server.query_sample with blocking and resource attributes#47259
splunk-shanu wants to merge 4 commits intoopen-telemetry:mainfrom
splunk-shanu:feat/sqlserver-query-sample-lock-fields

Conversation

@splunk-shanu
Copy link
Copy Markdown
Contributor

Description

Add sqlserver.blocking_start_time, sqlserver.resource_id, and sqlserver.resource_type to db.server.query_sample in receiver/sqlserverreceiver.

This change enriches existing active request rows collected by the SQL Server receiver with:

  • blocking start time
  • lock/resource identifier
  • lock/resource type

The change updates:

  • metadata.yaml
  • templates/sqlServerQuerySample.tmpl
  • scraper.go
  • generated metadata/docs
  • query/golden testdata

It also ensures sqlserver.blocking_start_time is only populated when sqlserver.blocking_session_id > 0, so we do not report a blocking start time when there is no blocking session.

Link to tracking issue

Fixes #47119

Testing

Ran targeted and full receiver tests from receiver/sqlserverreceiver:

  • go test ./... -run 'TestGetSQLServerQuerySamplesQuery|TestRecordDatabaseSampleQuery' -v
  • go test ./...

Also validated the custom collector build path:

  • make otelcontribcol

Documentation

Updated generated receiver documentation to include:

  • sqlserver.blocking_start_time
  • sqlserver.resource_id
  • sqlserver.resource_type

Regenerated metadata-derived files and refreshed query/golden testdata accordingly.

description: SQL Server identifier for the locked or waited-on resource, if available.
type: string
requirement_level: recommended
sqlserver.resource_type:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
sqlserver.resource_type:
sqlserver.resource.type:

description: Status of the request (e.g., running, suspended).
type: string
requirement_level: recommended
sqlserver.resource_id:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
sqlserver.resource_id:
sqlserver.resource.id:

Comment on lines +344 to +345
- sqlserver.resource_id
- sqlserver.resource_type
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

U

Suggested change
- sqlserver.resource_id
- sqlserver.resource_type
- sqlserver.resource.id
- sqlserver.resource.type

description: Session ID that is blocking the current session. 0 if none.
type: int
requirement_level: recommended
sqlserver.blocking_start_time:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
sqlserver.blocking_start_time:
sqlserver.blocking.start_time:

- network.peer.address
- network.peer.port
- sqlserver.blocking_session_id
- sqlserver.blocking_start_time
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- sqlserver.blocking_start_time
- sqlserver.blocking.start_time

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add suport for additional attributes for query_sample blocking sessions event flow

2 participants