Skip to content

Commit

Permalink
Merge branch 'main' into feature/remove_resource_WithBuiltinDetectors…
Browse files Browse the repository at this point in the history
…_func
  • Loading branch information
hanyuancheung authored Jul 21, 2021
2 parents 1a41f22 + 63dfe64 commit 0f4c61c
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 7 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
- When using WithNewRoot, don't use the parent context for making sampling decisions. (#2032)
- `oteltest.Tracer` now creates a valid `SpanContext` when using `WithNewRoot`. (#2073)
- OS type detector now sets the correct `dragonflybsd` value for DragonFly BSD. (#2092)
- The OTel span status is correctly transformed into the OTLP status in the `go.opentelemetry.io/otel/exporters/otlp/otlptrace` package.
This fix will by default set the status to `Unset` if it is not explicitly set to `Ok` or `Error`. (#2099 #2102)

### Security

Expand Down Expand Up @@ -1440,7 +1442,7 @@ It contains api and sdk for trace and meter.
- CODEOWNERS file to track owners of this project.

[Unreleased]: https://github.com/open-telemetry/opentelemetry-go/compare/v1.0.0-RC1...HEAD
[Experimental Metrics v0.22.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/metric%2Fv0.22.0
[Experimental Metrics v0.22.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/metric/v0.22.0
[1.0.0-RC1]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.0.0-RC1
[0.20.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v0.20.0
[0.19.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v0.19.0
Expand Down
4 changes: 3 additions & 1 deletion exporters/otlp/otlptrace/internal/tracetransform/span.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,10 +132,12 @@ func span(sd tracesdk.ReadOnlySpan) *tracepb.Span {
func status(status codes.Code, message string) *tracepb.Status {
var c tracepb.Status_StatusCode
switch status {
case codes.Ok:
c = tracepb.Status_STATUS_CODE_OK
case codes.Error:
c = tracepb.Status_STATUS_CODE_ERROR
default:
c = tracepb.Status_STATUS_CODE_OK
c = tracepb.Status_STATUS_CODE_UNSET
}
return &tracepb.Status{
Code: c,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,11 @@ func TestStatus(t *testing.T) {
{
codes.Unset,
"test Unset",
tracepb.Status_STATUS_CODE_OK,
tracepb.Status_STATUS_CODE_UNSET,
},
{
message: "default code is unset",
otlpStatus: tracepb.Status_STATUS_CODE_UNSET,
},
{
codes.Error,
Expand Down
10 changes: 6 additions & 4 deletions sdk/trace/span.go
Original file line number Diff line number Diff line change
Expand Up @@ -262,11 +262,13 @@ func (s *span) End(options ...trace.SpanEndOption) {
}
s.mu.Unlock()

sps, ok := s.tracer.provider.spanProcessors.Load().(spanProcessorStates)
mustExportOrProcess := ok && len(sps) > 0
if mustExportOrProcess {
if sps, ok := s.tracer.provider.spanProcessors.Load().(spanProcessorStates); ok {
if len(sps) == 0 {
return
}
snap := s.snapshot()
for _, sp := range sps {
sp.sp.OnEnd(s.snapshot())
sp.sp.OnEnd(snap)
}
}
}
Expand Down

0 comments on commit 0f4c61c

Please sign in to comment.