Skip to content

Commit

Permalink
feat: add error.id to jaeger errors (#272)
Browse files Browse the repository at this point in the history
  • Loading branch information
kruskall authored May 7, 2024
1 parent 337a5ee commit e72603d
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
"namespace": "4"
},
"error": {
"id": "dynamic",
"exception": [
{
"message": "no connection established"
Expand Down Expand Up @@ -78,4 +79,4 @@
}
}
]
}
}
4 changes: 4 additions & 0 deletions input/otlp/test_approved/span_jaeger_http.approved.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@
"version": "unknown"
},
"error": {
"id": "dynamic",
"exception": [
{
"message": "no connection established"
Expand Down Expand Up @@ -173,6 +174,7 @@
"version": "unknown"
},
"error": {
"id": "dynamic",
"exception": [
{
"message": "no connection established"
Expand Down Expand Up @@ -220,6 +222,7 @@
"version": "unknown"
},
"error": {
"id": "dynamic",
"exception": [
{
"message": "no connection established"
Expand Down Expand Up @@ -267,6 +270,7 @@
"version": "unknown"
},
"error": {
"id": "dynamic",
"exception": [
{
"type": "DBClosedException"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
"namespace": "4"
},
"error": {
"id": "dynamic",
"exception": [
{
"message": "no connection established"
Expand Down Expand Up @@ -77,4 +78,4 @@
}
}
]
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@
"version": "unknown"
},
"error": {
"id": "dynamic",
"exception": [
{
"message": "no connection established"
Expand Down Expand Up @@ -185,6 +186,7 @@
"version": "unknown"
},
"error": {
"id": "dynamic",
"exception": [
{
"message": "no connection established"
Expand Down Expand Up @@ -242,6 +244,7 @@
"version": "unknown"
},
"error": {
"id": "dynamic",
"exception": [
{
"message": "no connection established"
Expand Down Expand Up @@ -299,6 +302,7 @@
"version": "unknown"
},
"error": {
"id": "dynamic",
"exception": [
{
"type": "DBClosedException"
Expand Down
3 changes: 3 additions & 0 deletions input/otlp/traces.go
Original file line number Diff line number Diff line change
Expand Up @@ -1221,6 +1221,9 @@ func (c *Consumer) convertJaegerErrorSpanEvent(event ptrace.SpanEvent, apmEvent
e.Exception = modelpb.ExceptionFromVTPool()
e.Exception.Message = exMessage
e.Exception.Type = exType
if id, err := newUniqueID(); err == nil {
e.Id = id
}
}
return e
}
Expand Down
6 changes: 6 additions & 0 deletions input/otlp/traces_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1960,6 +1960,12 @@ func approveEventDocs(t testing.TB, name string, docs [][]byte) {
delete(m, "event")
}

if e, ok := m["error"].(map[string]any); ok {
if _, ok := e["id"]; ok {
e["id"] = "dynamic"
}
}

events[i] = m
}
received := map[string]any{"events": events}
Expand Down

0 comments on commit e72603d

Please sign in to comment.