@@ -289,6 +289,34 @@ type OpenshiftTenantSpec struct {
289
289
// +kubebuilder:validation:Optional
290
290
// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Admin Groups"
291
291
AdminGroups []string `json:"adminGroups"`
292
+
293
+ // OTLP contains settings for ingesting data using OTLP in the OpenShift tenancy mode.
294
+ //
295
+ // +optional
296
+ // +kubebuilder:validation:Optional
297
+ // +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="OpenTelemetry Protocol"
298
+ OTLP * OpenshiftOTLPConfig `json:"otlp,omitempty"`
299
+ }
300
+
301
+ // OpenshiftOTLPConfig defines configuration specific to users using OTLP together with an OpenShift tenancy mode.
302
+ type OpenshiftOTLPConfig struct {
303
+ // DisableRecommendedAttributes can be used to reduce the number of attributes used for stream labels and structured
304
+ // metadata.
305
+ //
306
+ // Enabling this setting removes the "recommended attributes" from the generated Loki configuration. This will cause
307
+ // meta information to not be available as stream labels or structured metadata, potentially making queries more
308
+ // expensive and less performant.
309
+ //
310
+ // Note that there is a set of "required attributes", needed for OpenShift Logging to work properly. Those will be
311
+ // added to the configuration, even if this field is set to true.
312
+ //
313
+ // This option is supposed to be combined with a custom label configuration customizing the labels for the specific
314
+ // usecase.
315
+ //
316
+ // +optional
317
+ // +kubebuilder:validation:Optional
318
+ // +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Disable recommended OTLP attributes"
319
+ DisableRecommendedAttributes bool `json:"disableRecommendedAttributes,omitempty"`
292
320
}
293
321
294
322
// LokiComponentSpec defines the requirements to configure scheduling
@@ -791,138 +819,70 @@ type IngestionLimitSpec struct {
791
819
PerStreamRateLimitBurst int32 `json:"perStreamRateLimitBurst,omitempty"`
792
820
}
793
821
794
- // OTLPAttributeAction defines the action to executed when indexing
795
- // OTLP resource attributes. Resource attributes can be either added
796
- // to the index, the chunk structured metadata or entirely dropped.
797
- type OTLPAttributeAction string
798
-
799
- const (
800
- // OTLPAttributeActionIndexLabel stores a resource attribute as a label, which is part of the index identifying streams.
801
- OTLPAttributeActionIndexLabel OTLPAttributeAction = "indexLabel"
802
- // OTLPAttributeActionStructuredMetadata stores an attribute as structured metadata with each log entry.
803
- OTLPAttributeActionStructuredMetadata OTLPAttributeAction = "structuredMetadata"
804
- // OTLPAttributeActionDrop removes the matching attributes from the log entry.
805
- OTLPAttributeActionDrop OTLPAttributeAction = "drop"
806
- )
807
-
808
- // OTLPAttributesSpec contains the configuration for a set of attributes
809
- // to store them as index labels or structured metadata or drop them altogether.
810
- type OTLPAttributesSpec struct {
811
- // Action defines the indexing action for the selected attributes. They
812
- // can be either added to structured metadata or drop altogether.
813
- //
814
- // +required
815
- // +kubebuilder:validation:Required
816
- // +kubebuilder:validation:Enum=structured_metadata;drop
817
- // +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Action"
818
- Action OTLPAttributeAction `json:"action"`
819
-
820
- // Attributes allows choosing the attributes by listing their names.
822
+ // OTLPSpec defines which resource, scope and log attributes should be used as stream labels or
823
+ // stored as structured metadata.
824
+ type OTLPSpec struct {
825
+ // StreamLabels configures which resource attributes are converted to Loki stream labels.
821
826
//
822
827
// +optional
823
828
// +kubebuilder:validation:Optional
824
- // +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Attribute Names "
825
- Attributes [] string `json:"attributes ,omitempty"`
829
+ // +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Stream Labels "
830
+ StreamLabels * OTLPStreamLabelSpec `json:"streamLabels ,omitempty"`
826
831
827
- // Regex allows choosing the attributes by matching a regular expression .
832
+ // StructuredMetadata configures which attributes are saved in structured metadata .
828
833
//
829
834
// +optional
830
835
// +kubebuilder:validation:Optional
831
- // +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Regular Expression "
832
- Regex string `json:"regex ,omitempty"`
836
+ // +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Structured Metadata "
837
+ StructuredMetadata * OTLPMetadataSpec `json:"structuredMetadata ,omitempty"`
833
838
}
834
839
835
- // OTLPResourceAttributesConfigSpec contains the configuration for a set of resource attributes
836
- // to store them as index labels or structured metadata or drop them altogether.
837
- type OTLPResourceAttributesConfigSpec struct {
838
- // Action defines the indexing action for the selected resoure attributes. They
839
- // can be either indexed as labels, added to structured metadata or drop altogether.
840
- //
841
- // +required
842
- // +kubebuilder:validation:Required
843
- // +kubebuilder:validation:Enum=index_label;structured_metadata;drop
844
- // +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Action"
845
- Action OTLPAttributeAction `json:"action"`
846
-
847
- // Attributes is the list of attributes to configure indexing or drop them
848
- // altogether.
849
- //
850
- // +optional
851
- // +kubebuilder:validation:Optional
852
- // +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Attribute Names"
853
- Attributes []string `json:"attributes,omitempty"`
854
-
855
- // Regex allows choosing the attributes by matching a regular expression.
840
+ type OTLPStreamLabelSpec struct {
841
+ // ResourceAttributes lists the names of the resource attributes that should be converted into Loki stream labels.
856
842
//
857
843
// +optional
858
844
// +kubebuilder:validation:Optional
859
- // +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Regular Expression "
860
- Regex string `json:"regex ,omitempty"`
845
+ // +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Resource Attributes "
846
+ ResourceAttributes [] OTLPAttributeReference `json:"resourceAttributes ,omitempty"`
861
847
}
862
848
863
- // OTLPResourceAttributesSpec contains the configuration for resource attributes
864
- // to store them as index labels or structured metadata or drop them altogether.
865
- type OTLPResourceAttributesSpec struct {
866
- // IgnoreDefaults controls whether to ignore the global configuration for resource attributes
867
- // indexed as labels.
868
- //
869
- // If IgnoreDefaults is true, then this spec needs to contain at least one mapping to a index label.
849
+ type OTLPMetadataSpec struct {
850
+ // ResourceAttributes lists the names of resource attributes that should be included in structured metadata.
870
851
//
871
852
// +optional
872
853
// +kubebuilder:validation:Optional
873
- // +operator-sdk:csv:customresourcedefinitions:type=spec,xDescriptors="urn:alm:descriptor:com.tectonic.ui:booleanSwitch", displayName="Ignore Global Defaults "
874
- IgnoreDefaults bool `json:"ignoreDefaults ,omitempty"`
854
+ // +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Resource Attributes "
855
+ ResourceAttributes [] OTLPAttributeReference `json:"resourceAttributes ,omitempty"`
875
856
876
- // Attributes contains the configuration for resource attributes
877
- // to store them as index labels or structured metadata or drop them altogether.
857
+ // ScopeAttributes lists the names of scope attributes that should be included in structured metadata.
878
858
//
879
859
// +optional
880
860
// +kubebuilder:validation:Optional
881
- // +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Attributes"
882
- Attributes []OTLPResourceAttributesConfigSpec `json:"attributes,omitempty"`
883
- }
861
+ // +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Scope Attributes"
862
+ ScopeAttributes []OTLPAttributeReference `json:"scopeAttributes,omitempty"`
884
863
885
- // GlobalOTLPSpec defines which resource, scope and log attributes to
886
- // be stored as index or structured metadata or drop altogether for all
887
- // tenants.
888
- type GlobalOTLPSpec struct {
889
- // IndexedResourceAttributes contains the global configuration for resource attributes
890
- // to store them as index labels.
864
+ // LogAttributes lists the names of log attributes that should be included in structured metadata.
891
865
//
892
866
// +optional
893
867
// +kubebuilder:validation:Optional
894
- // +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Indexed Resource Attributes"
895
- IndexedResourceAttributes []string `json:"indexedResourceAttributes,omitempty"`
896
-
897
- OTLPSpec `json:",omitempty"`
868
+ // +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Log Attributes"
869
+ LogAttributes []OTLPAttributeReference `json:"logAttributes,omitempty"`
898
870
}
899
871
900
- // OTLPSpec defines which resource, scope and log attributes to
901
- // be stored as index or structured metadata or drop altogether
902
- type OTLPSpec struct {
903
- // ResourceAttributes contains the configuration for resource attributes
904
- // to store them as index labels or structured metadata or drop them altogether.
872
+ type OTLPAttributeReference struct {
873
+ // Name contains either a verbatim name of an attribute or a regular expression matching many attributes.
905
874
//
906
- // +optional
907
- // +kubebuilder:validation:Optional
908
- // +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Resource Attributes"
909
- ResourceAttributes * OTLPResourceAttributesSpec `json:"resourceAttributes,omitempty"`
910
-
911
- // ScopeAttributes contains the configuration for scope attributes
912
- // to store them as structured metadata or drop them altogether.
913
- //
914
- // +optional
915
- // +kubebuilder:validation:Optional
916
- // +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Scope Attributes"
917
- ScopeAttributes []OTLPAttributesSpec `json:"scopeAttributes,omitempty"`
875
+ // +required
876
+ // +kubebuilder:validation:Required
877
+ // +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Name"
878
+ Name string `json:"name"`
918
879
919
- // LogAttributes contains the configuration for log attributes
920
- // to store them as structured metadata or drop them altogether.
880
+ // If Regex is true, then Name is treated as a regular expression instead of as a verbatim attribute name.
921
881
//
922
882
// +optional
923
883
// +kubebuilder:validation:Optional
924
- // +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Log Attributes "
925
- LogAttributes [] OTLPAttributesSpec `json:"logAttributes ,omitempty"`
884
+ // +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Treat name as regular expression "
885
+ Regex bool `json:"regex ,omitempty"`
926
886
}
927
887
928
888
// RetentionStreamSpec defines a log stream with separate retention time.
@@ -978,13 +938,14 @@ type LimitsTemplateSpec struct {
978
938
// +kubebuilder:validation:Optional
979
939
QueryLimits * QueryLimitSpec `json:"queries,omitempty"`
980
940
981
- // OTLP to configure which resource, scope and log attributes
982
- // to store as labels or structured metadata or drop them altogether
983
- // for all tenants.
941
+ // OTLP to configure which resource, scope and log attributes are stored as stream labels or structured metadata.
942
+ //
943
+ // Tenancy modes can provide a default OTLP configuration, when no custom OTLP configuration is set or even
944
+ // enforce the use of some required attributes.
984
945
//
985
946
// +optional
986
947
// +kubebuilder:validation:Optional
987
- OTLP * GlobalOTLPSpec `json:"otlp,omitempty"`
948
+ OTLP * OTLPSpec `json:"otlp,omitempty"`
988
949
989
950
// Retention defines how long logs are kept in storage.
990
951
//
@@ -993,7 +954,7 @@ type LimitsTemplateSpec struct {
993
954
Retention * RetentionLimitSpec `json:"retention,omitempty"`
994
955
}
995
956
996
- // LimitsTemplateSpec defines the limits applied at ingestion or query path.
957
+ // PerTenantLimitsTemplateSpec defines the limits applied at ingestion or query path.
997
958
type PerTenantLimitsTemplateSpec struct {
998
959
// IngestionLimits defines the limits applied on ingested log streams.
999
960
//
@@ -1007,9 +968,12 @@ type PerTenantLimitsTemplateSpec struct {
1007
968
// +kubebuilder:validation:Optional
1008
969
QueryLimits * PerTenantQueryLimitSpec `json:"queries,omitempty"`
1009
970
1010
- // OTLP to configure which resource, scope and log attributes
1011
- // to store as labels or structured metadata or drop them altogether
1012
- // for a single tenants.
971
+ // OTLP to configure which resource, scope and log attributes are stored as stream labels or structured metadata.
972
+ //
973
+ // Tenancy modes can provide a default OTLP configuration, when no custom OTLP configuration is set or even
974
+ // enforce the use of some required attributes.
975
+ //
976
+ // The per-tenant configuration for OTLP attributes will be merged with the global configuration.
1013
977
//
1014
978
// +optional
1015
979
// +kubebuilder:validation:Optional
@@ -1463,16 +1427,3 @@ func (t BlockedQueryTypes) String() string {
1463
1427
1464
1428
return strings .Join (res , "," )
1465
1429
}
1466
-
1467
- func (a OTLPAttributeAction ) Value () string {
1468
- switch a {
1469
- case OTLPAttributeActionIndexLabel :
1470
- return "index_label"
1471
- case OTLPAttributeActionStructuredMetadata :
1472
- return "structured_metadata"
1473
- case OTLPAttributeActionDrop :
1474
- return "drop"
1475
- default :
1476
- return string (a )
1477
- }
1478
- }
0 commit comments