Like Prometheus, but for logs.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
loki/pkg/util/rangeio/context.go

21 lines
603 B

package rangeio
import "context"
type contextKey struct{}
// WithConfig creates a new context that contains the provided [Config]. Calls
// to [ReadRanges] with this context will use the config.
func WithConfig(ctx context.Context, config *Config) context.Context {
return context.WithValue(ctx, contextKey{}, config)
}
// configFromContext retrieves the [Config] from the provided context. If the
// context does not contain a config, it returns nil.
func configFromContext(ctx context.Context) *Config {
config, ok := ctx.Value(contextKey{}).(*Config)
if !ok {
return nil
}
return config
}