Skip to content

Commit

Permalink
fix: bunotel add set attributes to query metrics
Browse files Browse the repository at this point in the history
Signed-off-by: Guillaume Delbergue <[email protected]>
  • Loading branch information
guyguy333 committed Jul 9, 2022
1 parent 1f1dba4 commit dae82cc
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion extra/bunotel/otel.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ func (h *QueryHook) AfterQuery(ctx context.Context, event *bun.QueryEvent) {
operation := event.Operation()
dbOperation := semconv.DBOperationKey.String(operation)

labels := make([]attribute.KeyValue, 0, 2)
labels := make([]attribute.KeyValue, 0, len(h.attrs)+2)
labels = append(labels, h.attrs...)
labels = append(labels, dbOperation)
if event.IQuery != nil {
if tableName := event.IQuery.GetTableName(); tableName != "" {
Expand Down

0 comments on commit dae82cc

Please sign in to comment.