Skip to content

Commit

Permalink
Fix recordSpanError does not set the status of span to Error (#5)
Browse files Browse the repository at this point in the history
* Fix recordSpanError does not set the status of span to Error

* Update CHANGELOG
  • Loading branch information
XSAM authored Mar 28, 2021
1 parent 6ed3efa commit 9df5bfd
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm

## [Unreleased]

### Fixed

- otelsql does not set the status of span to Error while recording error. (#5)

## [0.2.0] - 2021-03-24

### Changed
Expand Down
5 changes: 4 additions & 1 deletion utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ package otelsql

import (
"database/sql/driver"


"go.opentelemetry.io/otel/codes"
"go.opentelemetry.io/otel/trace"
)

Expand All @@ -27,8 +28,10 @@ func recordSpanError(span trace.Span, opts SpanOptions, err error) {
case driver.ErrSkip:
if !opts.DisableErrSkip {
span.RecordError(err)
span.SetStatus(codes.Error, "")
}
default:
span.RecordError(err)
span.SetStatus(codes.Error, "")
}
}

0 comments on commit 9df5bfd

Please sign in to comment.