Skip to content

Commit

Permalink
Update default attributes based on data model
Browse files Browse the repository at this point in the history
  • Loading branch information
xperimental committed Oct 7, 2024
1 parent 9da80cd commit b2e70aa
Showing 1 changed file with 59 additions and 29 deletions.
88 changes: 59 additions & 29 deletions operator/internal/manifests/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -402,55 +402,85 @@ func defaultOTLPAttributeConfig(ts *lokiv1.TenantsSpec) config.OTLPAttributeConf
return config.OTLPAttributeConfig{}
}

// TODO decide which of these can be disabled by using "disableRecommendedAttributes"
// TODO decide whether we want to split the default configuration by tenant
result := config.OTLPAttributeConfig{
DefaultIndexLabels: []string{
"openshift.cluster.uid",
"openshift.log.source",
"log_source",
"openshift.log.type",
"log_type",
"kubernetes_namespace_name",
"kubernetes_pod_name",
"kubernetes_container_name",
"k8s.namespace.name",
},
}

if ts.Openshift == nil || ts.Openshift.OTLP == nil || !ts.Openshift.OTLP.DisableRecommendedAttributes {
result.DefaultIndexLabels = append(result.DefaultIndexLabels, []string{
"service.name",
"k8s.cluster.uid",
"k8s.pod.name",
"k8s.node.name",
"k8s.node.uid",
"k8s.namespace.name",
"kubernetes.namespace_name",
"k8s.container.name",
"openshift.log.source",
"k8s.deployment.name",
"k8s.statefulset.name",
"k8s.daemonset.name",
"k8s.cronjob.name",
}...)

result.Global = &config.OTLPTenantAttributeConfig{
"kubernetes.container_name",
"k8s.pod.name",
"k8s.pod.uid",
"kubernetes.pod_name",
},
Global: &config.OTLPTenantAttributeConfig{
ResourceAttributes: []config.OTLPAttribute{
{
Action: config.OTLPAttributeActionStreamLabel,
Regex: "openshift\\.labels\\..+",
},
{
Action: config.OTLPAttributeActionMetadata,
Regex: "k8s\\.pod\\.labels\\..+",
},
{
Action: config.OTLPAttributeActionMetadata,
Names: []string{
"k8s.replicaset.name",
"k8s.cronjob.name",
"k8s.daemonset.name",
"k8s.deployment.name",
"k8s.job.name",
"k8s.replicaset.name",
"k8s.statefulset.name",
"process.executable.name",
"process.executable.path",
"process.command_line",
"process.pid",
"service.name",
},
},
},
LogAttributes: []config.OTLPAttribute{
{
Action: config.OTLPAttributeActionMetadata,
Names: []string{
"k8s.node.name",
"service.name",
"host.name",
"process.command",
"node.name",
"url.path",
"http.request.method_original",
"http.response.status.code",
"log.iostream",
"k8s.event.level",
"k8s.event.stage",
"k8s.event.user_agent",
"k8s.event.request.uri",
"k8s.event.response.code",
"k8s.event.object_ref.resource",
"k8s.event.object_ref.name",
"k8s.event.object_ref.api.group",
"k8s.event.object_ref.api.version",
"k8s.user.username",
"k8s.user.groups",
},
},
{
Action: config.OTLPAttributeActionMetadata,
Regex: "k8s\\.event\\.annotations\\..+",
},
{
Action: config.OTLPAttributeActionMetadata,
Regex: "systemd\\.t\\..+",
},
{
Action: config.OTLPAttributeActionMetadata,
Regex: "systemd\\.u\\..+",
},
},
}
},
}

return result
Expand Down

0 comments on commit b2e70aa

Please sign in to comment.