Documentation ¶
Index ¶
- Constants
- func ParseRequest(logger log.Logger, userID string, r *http.Request, ...) (*logproto.PushRequest, error)
- func RetentionPeriodToString(retentionPeriod time.Duration) string
- type Action
- type AttributesConfig
- type EmptyLimits
- type GlobalOTLPConfig
- type Limits
- type OTLPConfig
- func (c *OTLPConfig) ActionForLogAttribute(attribute string) Action
- func (c *OTLPConfig) ActionForResourceAttribute(attribute string) Action
- func (c *OTLPConfig) ActionForScopeAttribute(attribute string) Action
- func (c *OTLPConfig) ApplyGlobalOTLPConfig(config GlobalOTLPConfig)
- func (c *OTLPConfig) Validate() error
- type RequestParser
- type RequestParserWrapper
- type ResourceAttributesConfig
- type Stats
- type TenantsRetention
- type UsageTracker
Constants ¶
View Source
const ( LabelServiceName = "service_name" ServiceUnknown = "unknown_service" AggregatedMetricLabel = "__aggregated_metric__" )
View Source
const (
OTLPSeverityNumber = "severity_number"
)
Variables ¶
This section is empty.
Functions ¶
func ParseRequest ¶
func ParseRequest(logger log.Logger, userID string, r *http.Request, tenantsRetention TenantsRetention, limits Limits, pushRequestParser RequestParser, tracker UsageTracker, logPushRequestStreams bool) (*logproto.PushRequest, error)
func RetentionPeriodToString ¶
Types ¶
type Action ¶
type Action string
Action is the action to be performed on OTLP Resource Attribute.
const ( // IndexLabel stores a Resource Attribute as a label in index to identify streams. IndexLabel Action = "index_label" // StructuredMetadata stores an Attribute as Structured Metadata with each log entry. StructuredMetadata Action = "structured_metadata" // Drop drops Attributes for which the Attribute name does match the regex. Drop Action = "drop" )
type AttributesConfig ¶
type AttributesConfig struct { Action Action `` /* 227-byte string literal not displayed */ Attributes []string `yaml:"attributes,omitempty" doc:"description=List of attributes to configure how to store them or drop them altogether"` Regex relabel.Regexp `yaml:"regex,omitempty" doc:"description=Regex to choose attributes to configure how to store them or drop them altogether"` }
func (*AttributesConfig) UnmarshalYAML ¶
func (c *AttributesConfig) UnmarshalYAML(unmarshal func(interface{}) error) error
type EmptyLimits ¶
type EmptyLimits struct{}
func (EmptyLimits) DiscoverServiceName ¶ added in v3.2.0
func (EmptyLimits) DiscoverServiceName(string) []string
func (EmptyLimits) OTLPConfig ¶
func (EmptyLimits) OTLPConfig(string) OTLPConfig
type GlobalOTLPConfig ¶
type GlobalOTLPConfig struct {
DefaultOTLPResourceAttributesAsIndexLabels []string `yaml:"default_resource_attributes_as_index_labels"`
}
func (*GlobalOTLPConfig) RegisterFlags ¶
func (cfg *GlobalOTLPConfig) RegisterFlags(fs *flag.FlagSet)
RegisterFlags registers distributor-related flags.
type Limits ¶
type Limits interface { OTLPConfig(userID string) OTLPConfig DiscoverServiceName(userID string) []string }
type OTLPConfig ¶
type OTLPConfig struct { ResourceAttributes ResourceAttributesConfig `` /* 169-byte string literal not displayed */ ScopeAttributes []AttributesConfig `` /* 147-byte string literal not displayed */ LogAttributes []AttributesConfig `` /* 143-byte string literal not displayed */ }
func DefaultOTLPConfig ¶
func DefaultOTLPConfig(cfg GlobalOTLPConfig) OTLPConfig
func (*OTLPConfig) ActionForLogAttribute ¶
func (c *OTLPConfig) ActionForLogAttribute(attribute string) Action
func (*OTLPConfig) ActionForResourceAttribute ¶
func (c *OTLPConfig) ActionForResourceAttribute(attribute string) Action
func (*OTLPConfig) ActionForScopeAttribute ¶
func (c *OTLPConfig) ActionForScopeAttribute(attribute string) Action
func (*OTLPConfig) ApplyGlobalOTLPConfig ¶
func (c *OTLPConfig) ApplyGlobalOTLPConfig(config GlobalOTLPConfig)
ApplyGlobalOTLPConfig applies global otlp config, specifically DefaultOTLPResourceAttributesAsIndexLabels for the start.
func (*OTLPConfig) Validate ¶
func (c *OTLPConfig) Validate() error
type RequestParser ¶
type RequestParser func(userID string, r *http.Request, tenantsRetention TenantsRetention, limits Limits, tracker UsageTracker, logPushRequestStreams bool, logger log.Logger) (*logproto.PushRequest, *Stats, error)
type RequestParserWrapper ¶
type RequestParserWrapper func(inner RequestParser) RequestParser
type ResourceAttributesConfig ¶
type ResourceAttributesConfig struct { IgnoreDefaults bool `` /* 281-byte string literal not displayed */ AttributesConfig []AttributesConfig `yaml:"attributes_config,omitempty"` }
type Stats ¶
type Stats struct { Errs []error NumLines int64 LogLinesBytes map[time.Duration]int64 StructuredMetadataBytes map[time.Duration]int64 ResourceAndSourceMetadataLabels map[time.Duration]push.LabelsAdapter StreamLabelsSize int64 MostRecentEntryTimestamp time.Time ContentType string ContentEncoding string BodySize int64 // Extra is a place for a wrapped perser to record any interesting stats as key-value pairs to be logged Extra []any IsAggregatedMetric bool }
func ParseLokiRequest ¶
func ParseLokiRequest(userID string, r *http.Request, tenantsRetention TenantsRetention, limits Limits, tracker UsageTracker, logPushRequestStreams bool, logger log.Logger) (*logproto.PushRequest, *Stats, error)
func ParseOTLPRequest ¶
func ParseOTLPRequest(userID string, r *http.Request, tenantsRetention TenantsRetention, limits Limits, tracker UsageTracker, logPushRequestStreams bool, logger log.Logger) (*logproto.PushRequest, *Stats, error)
type TenantsRetention ¶
type UsageTracker ¶
type UsageTracker interface { // ReceivedBytesAdd records ingested bytes by tenant, retention period and labels. ReceivedBytesAdd(ctx context.Context, tenant string, retentionPeriod time.Duration, labels labels.Labels, value float64) // DiscardedBytesAdd records discarded bytes by tenant and labels. DiscardedBytesAdd(ctx context.Context, tenant, reason string, labels labels.Labels, value float64) }
Click to show internal directories.
Click to hide internal directories.