Skip to content

Commit

Permalink
fix: make sure all label values are strings
Browse files Browse the repository at this point in the history
  • Loading branch information
niekcandaele committed Aug 11, 2021
1 parent 3060d2b commit ec82e79
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 ec82e79

Please sign in to comment.