Skip to content

Commit

Permalink
Merge pull request #73 from niekcandaele/make-sure-all-label-values-a…
Browse files Browse the repository at this point in the history
…re-strings

fix: make sure all label values are strings
  • Loading branch information
JaniAnttonen authored Aug 31, 2021
2 parents 3060d2b + ec82e79 commit 768de2b
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@ class LokiTransport extends Transport {
rest && Object.keys(rest).length > 0 ? JSON.stringify(rest) : ''
}`

// Make sure all label values are strings
lokiLabels = JSON.parse(JSON.stringify(lokiLabels, (key, value) => value ? value.toString() : value))

// Construct the log to fit Grafana Loki's accepted format
const logEntry = {
labels: lokiLabels,
Expand Down

0 comments on commit 768de2b

Please sign in to comment.