Skip to content

Commit

Permalink
feat(chotel): try parsing numerical attrs
Browse files Browse the repository at this point in the history
  • Loading branch information
ernado committed Dec 4, 2023
1 parent 7c2176b commit 6633adf
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions cmd/chotel/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"fmt"
"net/url"
"os"
"strconv"
"strings"
"time"

Expand Down Expand Up @@ -250,7 +251,27 @@ func (a *App) send(ctx context.Context, now time.Time) error {
SpanID: r.ParentSpanID,
}),
}
Attribute:
for k, v := range r.Attributes {
for _, marker := range []string{
"count",
"thread_id",
"_bytes",
"_rows",
"memory_usage",
"thread_num",
"exception_code",
} {
if !strings.Contains(k, marker) {
continue
}
n, err := strconv.ParseInt(v, 10, 64)
if err != nil {
break
}
stub.Attributes = append(stub.Attributes, attribute.Int64(k, n))
continue Attribute
}
stub.Attributes = append(stub.Attributes, attribute.String(k, v))
}
if latest.Before(stub.EndTime) {
Expand Down

0 comments on commit 6633adf

Please sign in to comment.