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

feat(operator)!: Add configuration option for dropping OTLP attributes #15857

Open
wants to merge 16 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 13 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
6 changes: 3 additions & 3 deletions operator/api/loki/v1/lokistack_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -837,12 +837,12 @@ type OTLPSpec struct {
// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Stream Labels"
StreamLabels *OTLPStreamLabelSpec `json:"streamLabels,omitempty"`

// StructuredMetadata configures which attributes are saved in structured metadata.
// Drop configures which attributes are dropped from the log entry.
//
// +optional
// +kubebuilder:validation:Optional
// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Structured Metadata"
StructuredMetadata *OTLPMetadataSpec `json:"structuredMetadata,omitempty"`
// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Dropped Attributes"
Drop *OTLPMetadataSpec `json:"drop,omitempty"`
}

type OTLPStreamLabelSpec struct {
Expand Down
2 changes: 2 additions & 0 deletions operator/api/loki/v1/v1.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@ var (
ErrOTLPTenantMissing = errors.New("if no global OTLP configuration is present which defines at least one stream label, every tenant must have an OTLP configuration")
// ErrOTLPTenantNoStreamLabel when a tenant is defined but has no stream labels and there also no global stream labels.
ErrOTLPTenantNoStreamLabel = errors.New("if no global OTLP configuration is present which defines at least one stream label, every tenant must define at least one stream label")
// ErrOTLPInvalidDrop when a OTLP configuration tries to drop an attribute also listed as stream label or structured metadata
xperimental marked this conversation as resolved.
Show resolved Hide resolved
ErrOTLPInvalidDrop = errors.New("can not drop OTLP attributes also listed as stream label or structured metadata")

// ErrRuleMustMatchNamespace indicates that an expression used in an alerting or recording rule is missing
// matchers for a namespace.
Expand Down
4 changes: 2 additions & 2 deletions operator/api/loki/v1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ metadata:
categories: OpenShift Optional, Logging & Tracing
certified: "false"
containerImage: docker.io/grafana/loki-operator:0.7.1
createdAt: "2025-01-16T18:30:58Z"
createdAt: "2025-01-21T12:58:10Z"
description: The Community Loki Operator provides Kubernetes native deployment
and management of Loki and related logging components.
features.operators.openshift.io/disconnected: "true"
Expand Down Expand Up @@ -373,62 +373,61 @@ spec:
path: limits.global.ingestion.perStreamRateLimitBurst
x-descriptors:
- urn:alm:descriptor:com.tectonic.ui:number
- description: StreamLabels configures which resource attributes are converted
to Loki stream labels.
displayName: Stream Labels
path: limits.global.otlp.streamLabels
- description: ResourceAttributes lists the names of the resource attributes
that should be converted into Loki stream labels.
displayName: Resource Attributes
path: limits.global.otlp.streamLabels.resourceAttributes
- description: Name contains either a verbatim name of an attribute or a regular
expression matching many attributes.
displayName: Name
path: limits.global.otlp.streamLabels.resourceAttributes[0].name
- description: If Regex is true, then Name is treated as a regular expression
instead of as a verbatim attribute name.
displayName: Treat name as regular expression
path: limits.global.otlp.streamLabels.resourceAttributes[0].regex
- description: StructuredMetadata configures which attributes are saved in structured
metadata.
displayName: Structured Metadata
path: limits.global.otlp.structuredMetadata
- description: Drop configures which attributes are dropped from the log entry.
displayName: Dropped Attributes
path: limits.global.otlp.drop
- description: LogAttributes lists the names of log attributes that should be
included in structured metadata.
displayName: Log Attributes
path: limits.global.otlp.structuredMetadata.logAttributes
path: limits.global.otlp.drop.logAttributes
- description: Name contains either a verbatim name of an attribute or a regular
expression matching many attributes.
displayName: Name
path: limits.global.otlp.structuredMetadata.logAttributes[0].name
path: limits.global.otlp.drop.logAttributes[0].name
- description: If Regex is true, then Name is treated as a regular expression
instead of as a verbatim attribute name.
displayName: Treat name as regular expression
path: limits.global.otlp.structuredMetadata.logAttributes[0].regex
path: limits.global.otlp.drop.logAttributes[0].regex
- description: ResourceAttributes lists the names of resource attributes that
should be included in structured metadata.
displayName: Resource Attributes
path: limits.global.otlp.structuredMetadata.resourceAttributes
path: limits.global.otlp.drop.resourceAttributes
- description: Name contains either a verbatim name of an attribute or a regular
expression matching many attributes.
displayName: Name
path: limits.global.otlp.structuredMetadata.resourceAttributes[0].name
path: limits.global.otlp.drop.resourceAttributes[0].name
- description: If Regex is true, then Name is treated as a regular expression
instead of as a verbatim attribute name.
displayName: Treat name as regular expression
path: limits.global.otlp.structuredMetadata.resourceAttributes[0].regex
path: limits.global.otlp.drop.resourceAttributes[0].regex
- description: ScopeAttributes lists the names of scope attributes that should
be included in structured metadata.
displayName: Scope Attributes
path: limits.global.otlp.structuredMetadata.scopeAttributes
path: limits.global.otlp.drop.scopeAttributes
- description: Name contains either a verbatim name of an attribute or a regular
expression matching many attributes.
displayName: Name
path: limits.global.otlp.structuredMetadata.scopeAttributes[0].name
path: limits.global.otlp.drop.scopeAttributes[0].name
- description: If Regex is true, then Name is treated as a regular expression
instead of as a verbatim attribute name.
displayName: Treat name as regular expression
path: limits.global.otlp.structuredMetadata.scopeAttributes[0].regex
path: limits.global.otlp.drop.scopeAttributes[0].regex
- description: StreamLabels configures which resource attributes are converted
to Loki stream labels.
displayName: Stream Labels
path: limits.global.otlp.streamLabels
- description: ResourceAttributes lists the names of the resource attributes
that should be converted into Loki stream labels.
displayName: Resource Attributes
path: limits.global.otlp.streamLabels.resourceAttributes
- description: Name contains either a verbatim name of an attribute or a regular
expression matching many attributes.
displayName: Name
path: limits.global.otlp.streamLabels.resourceAttributes[0].name
- description: If Regex is true, then Name is treated as a regular expression
instead of as a verbatim attribute name.
displayName: Treat name as regular expression
path: limits.global.otlp.streamLabels.resourceAttributes[0].regex
- description: CardinalityLimit defines the cardinality limit for index queries.
displayName: Cardinality Limit
path: limits.global.queries.cardinalityLimit
Expand Down Expand Up @@ -534,62 +533,61 @@ spec:
path: limits.tenants.ingestion.perStreamRateLimitBurst
x-descriptors:
- urn:alm:descriptor:com.tectonic.ui:number
- description: StreamLabels configures which resource attributes are converted
to Loki stream labels.
displayName: Stream Labels
path: limits.tenants.otlp.streamLabels
- description: ResourceAttributes lists the names of the resource attributes
that should be converted into Loki stream labels.
displayName: Resource Attributes
path: limits.tenants.otlp.streamLabels.resourceAttributes
- description: Name contains either a verbatim name of an attribute or a regular
expression matching many attributes.
displayName: Name
path: limits.tenants.otlp.streamLabels.resourceAttributes[0].name
- description: If Regex is true, then Name is treated as a regular expression
instead of as a verbatim attribute name.
displayName: Treat name as regular expression
path: limits.tenants.otlp.streamLabels.resourceAttributes[0].regex
- description: StructuredMetadata configures which attributes are saved in structured
metadata.
displayName: Structured Metadata
path: limits.tenants.otlp.structuredMetadata
- description: Drop configures which attributes are dropped from the log entry.
displayName: Dropped Attributes
path: limits.tenants.otlp.drop
- description: LogAttributes lists the names of log attributes that should be
included in structured metadata.
displayName: Log Attributes
path: limits.tenants.otlp.structuredMetadata.logAttributes
path: limits.tenants.otlp.drop.logAttributes
- description: Name contains either a verbatim name of an attribute or a regular
expression matching many attributes.
displayName: Name
path: limits.tenants.otlp.structuredMetadata.logAttributes[0].name
path: limits.tenants.otlp.drop.logAttributes[0].name
- description: If Regex is true, then Name is treated as a regular expression
instead of as a verbatim attribute name.
displayName: Treat name as regular expression
path: limits.tenants.otlp.structuredMetadata.logAttributes[0].regex
path: limits.tenants.otlp.drop.logAttributes[0].regex
- description: ResourceAttributes lists the names of resource attributes that
should be included in structured metadata.
displayName: Resource Attributes
path: limits.tenants.otlp.structuredMetadata.resourceAttributes
path: limits.tenants.otlp.drop.resourceAttributes
- description: Name contains either a verbatim name of an attribute or a regular
expression matching many attributes.
displayName: Name
path: limits.tenants.otlp.structuredMetadata.resourceAttributes[0].name
path: limits.tenants.otlp.drop.resourceAttributes[0].name
- description: If Regex is true, then Name is treated as a regular expression
instead of as a verbatim attribute name.
displayName: Treat name as regular expression
path: limits.tenants.otlp.structuredMetadata.resourceAttributes[0].regex
path: limits.tenants.otlp.drop.resourceAttributes[0].regex
- description: ScopeAttributes lists the names of scope attributes that should
be included in structured metadata.
displayName: Scope Attributes
path: limits.tenants.otlp.structuredMetadata.scopeAttributes
path: limits.tenants.otlp.drop.scopeAttributes
- description: Name contains either a verbatim name of an attribute or a regular
expression matching many attributes.
displayName: Name
path: limits.tenants.otlp.structuredMetadata.scopeAttributes[0].name
path: limits.tenants.otlp.drop.scopeAttributes[0].name
- description: If Regex is true, then Name is treated as a regular expression
instead of as a verbatim attribute name.
displayName: Treat name as regular expression
path: limits.tenants.otlp.structuredMetadata.scopeAttributes[0].regex
path: limits.tenants.otlp.drop.scopeAttributes[0].regex
- description: StreamLabels configures which resource attributes are converted
to Loki stream labels.
displayName: Stream Labels
path: limits.tenants.otlp.streamLabels
- description: ResourceAttributes lists the names of the resource attributes
that should be converted into Loki stream labels.
displayName: Resource Attributes
path: limits.tenants.otlp.streamLabels.resourceAttributes
- description: Name contains either a verbatim name of an attribute or a regular
expression matching many attributes.
displayName: Name
path: limits.tenants.otlp.streamLabels.resourceAttributes[0].name
- description: If Regex is true, then Name is treated as a regular expression
instead of as a verbatim attribute name.
displayName: Treat name as regular expression
path: limits.tenants.otlp.streamLabels.resourceAttributes[0].regex
- description: Blocked defines the list of rules to block matching queries.
displayName: Blocked
path: limits.tenants.queries.blocked
Expand Down
Loading
Loading