Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

generator: add new service with mix of json and logfmt #749

Merged
merged 3 commits into from
Sep 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions generator/generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,23 @@ var generators = map[model.LabelValue]map[model.LabelValue]LogGenerator{
}
}()
},
"nginx-json-mixed": func(ctx context.Context, logger *AppLogger) {
go func() {
for ctx.Err() == nil {
level := randLevel()
t := time.Now()
if rand.Intn(10)%2 == 0 && level == ERROR {
log := flog.NewCommonLogFormat(t, randURI(), statusFromLevel(level))
// Add a stacktrace to the logfmt log, and include a field that will conflict with stream selectors
logger.Log(level, t, fmt.Sprintf("%s %s", log, `method=GET namespace=whoopsie caller=flush.go:253 stacktrace="Exception in thread \"main\" java.lang.NullPointerException\n at com.example.myproject.Book.getTitle(Book.java:16)\n at com.example.myproject.Author.getBookTitles(Author.java:25)\n at com.example.myproject.Bootstrap.main(Bootstrap.java:14)"`))
}
logger.Log(level, t, flog.NewJSONLogFormat(t, randURI(), statusFromLevel(level)))
time.Sleep(time.Duration(rand.Intn(5000)) * time.Millisecond)
}
}()
},
},

"mimir-dev": {
"mimir-ingester": mimirPod,
"mimir-distributor": mimirPod,
Expand Down
2 changes: 2 additions & 0 deletions project-words.txt
Original file line number Diff line number Diff line change
Expand Up @@ -473,3 +473,5 @@ REFID
unroute
myown
yass
whoopsie
myproject
Loading