-
Notifications
You must be signed in to change notification settings - Fork 75
Closed as not planned
Labels
bugSomething isn't workingSomething isn't workingstaleIssue or PR without activityIssue or PR without activity
Description
What happened:
I'm using the github.com/grafana/grafana-plugin-sdk-go/backend/log package in my SDK code, writing logs like so:
logger.Info("Log Message", "fieldOne", "1", "fieldTwo", "2")
Log messages are printed with nondeterministic ordering after the message field:
msg="Log Message" fieldOne=1 fieldTwo=2
msg="Log Message" fieldTwo=2 fieldOne=1
msg="Log Message" fieldTwo=2 fieldOne=1
msg="Log Message" fieldOne=1 fieldTwo=2
msg="Log Message" fieldTwo=2 fieldOne=1
msg="Log Message" fieldOne=1 fieldTwo=2
msg="Log Message" fieldOne=1 fieldTwo=2
The logger uses hclog and marshals to JSON at some point, passing through a map[string]interface{}
, which makes the output order non-deterministic
What you expected to happen:
Log fields should always be written to Grafana logs in the order that they're provided.
How to reproduce it (as minimally and precisely as possible):
pkg main
import (
"github.com/grafana/grafana-plugin-sdk-go/backend/log"
)
func main() {
l := log.New()
t := time.NewTimer(1*time.Second)
for {
select {
case <- t.C:
l.Info("msg", "fieldOne", "1", "fieldTwo", "2")
}
}
}
Anything else we need to know?:
Environment:
- SDK version: v0.164.0
- Grafana version: v10.0.1
- Go version: 1.21
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingstaleIssue or PR without activityIssue or PR without activity
Type
Projects
Status
💡 Ideation