Always log Runner and Environment ID.
Systematically log the runner id and the environment id by adding the information at the findRunnerMiddleware.
This commit is contained in:
@ -3,6 +3,7 @@ package logging
|
||||
import (
|
||||
"context"
|
||||
"github.com/getsentry/sentry-go"
|
||||
"github.com/openHPI/poseidon/pkg/dto"
|
||||
"github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
@ -28,6 +29,9 @@ func (hook *SentryHook) Fire(entry *logrus.Entry) error {
|
||||
var hub *sentry.Hub
|
||||
if entry.Context != nil {
|
||||
hub = sentry.GetHubFromContext(entry.Context)
|
||||
// This might overwrite valid data when not the request context is passed.
|
||||
entry.Data[dto.KeyRunnerID] = entry.Context.Value(dto.ContextKey(dto.KeyRunnerID))
|
||||
entry.Data[dto.KeyEnvironmentID] = entry.Context.Value(dto.ContextKey(dto.KeyEnvironmentID))
|
||||
}
|
||||
if hub == nil {
|
||||
hub = sentry.CurrentHub()
|
||||
|
Reference in New Issue
Block a user