Skip to content

Commit

Permalink
Instru: follow span specs for status and errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Gabriel-Darbord committed Jul 14, 2024
1 parent d5fc45c commit 6266e07
Showing 1 changed file with 17 additions and 8 deletions.
25 changes: 17 additions & 8 deletions src/OpenTelemetry-Instrumentation/OTSpan.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -272,8 +272,23 @@ OTSpan >> printOn: aStream [
{ #category : 'recording' }
OTSpan >> recordException: anException [

self status: 'ERROR'.
self attributeAt: 'error' put: anException description
self setErrorStatus.
self attributeAt: 'exception' put: anException description
]

{ #category : 'recording' }
OTSpan >> setErrorStatus [
"Specification: https://opentelemetry.io/docs/specs/otel/trace/api/#set-status
Status values form a total order: Ok > Error > Unset.
This means that setting Status with Ok will override any prior or future attempts to set span Status with Error or Unset."

status == #OK ifFalse: [ status := #ERROR ]
]

{ #category : 'recording' }
OTSpan >> setOkStatus [

status := #OK
]

{ #category : 'accessing' }
Expand Down Expand Up @@ -307,12 +322,6 @@ OTSpan >> status [
^ status
]

{ #category : 'accessing' }
OTSpan >> status: aString [

status := aString
]

{ #category : 'ston persistence' }
OTSpan >> stonOn: stonWriter [

Expand Down

0 comments on commit 6266e07

Please sign in to comment.