Skip to content

Commit

Permalink
Add scope to sqlqueryreceiver logs, too
Browse files Browse the repository at this point in the history
  • Loading branch information
dehaansa committed Dec 12, 2024
1 parent 2498b13 commit c29fc1b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .chloggen/sqlqueryreceiver-scope.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ change_type: enhancement
component: sqlqueryreceiver

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: "Add instrumentation scope to SQL query receiver metrics"
note: "Add instrumentation scope to SQL query receiver metrics and logs"

# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists.
issues: [31028]
Expand Down
4 changes: 3 additions & 1 deletion receiver/sqlqueryreceiver/logs_receiver.go
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,9 @@ func (queryReceiver *logsQueryReceiver) collect(ctx context.Context) (plog.Logs,
}

var errs []error
scopeLogs := logs.ResourceLogs().AppendEmpty().ScopeLogs().AppendEmpty().LogRecords()
scope := logs.ResourceLogs().AppendEmpty().ScopeLogs().AppendEmpty()
scope.Scope().SetName(metadata.ScopeName)
scopeLogs := scope.LogRecords()
for logsConfigIndex, logsConfig := range queryReceiver.query.Logs {
for _, row := range rows {
logRecord := scopeLogs.AppendEmpty()
Expand Down

0 comments on commit c29fc1b

Please sign in to comment.