forked from netobserv/network-observability-operator
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
NETOBSERV-1407 - Loki labels for deduper merge (netobserv#529)
* manage loki labels for deduper merge * fix console flags defaults * manage errors + testing
- Loading branch information
1 parent
9d50e16
commit fe8ae8c
Showing
7 changed files
with
176 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package loki | ||
|
||
import ( | ||
"strconv" | ||
|
||
flowslatest "github.com/netobserv/network-observability-operator/apis/flowcollector/v1beta2" | ||
"github.com/netobserv/network-observability-operator/controllers/constants" | ||
"github.com/netobserv/network-observability-operator/controllers/ebpf" | ||
"github.com/netobserv/network-observability-operator/pkg/helper" | ||
) | ||
|
||
func GetLokiLabels(desired *flowslatest.FlowCollectorSpec) []string { | ||
indexFields := constants.LokiIndexFields | ||
|
||
if desired.Processor.LogTypes != nil && *desired.Processor.LogTypes != flowslatest.LogTypeFlows { | ||
indexFields = append(indexFields, constants.LokiConnectionIndexFields...) | ||
} | ||
|
||
if desired.Processor.MultiClusterDeployment != nil && *desired.Processor.MultiClusterDeployment { | ||
indexFields = append(indexFields, constants.ClusterNameLabelName) | ||
} | ||
|
||
if helper.UseEBPF(desired) { | ||
dedupJustMark, _ := strconv.ParseBool(ebpf.DedupeJustMarkDefault) | ||
if desired.Agent.EBPF.Advanced != nil { | ||
if v, ok := desired.Agent.EBPF.Advanced.Env[ebpf.EnvDedupeJustMark]; ok { | ||
dedupJustMark, _ = strconv.ParseBool(v) | ||
} | ||
} | ||
if dedupJustMark { | ||
indexFields = append(indexFields, constants.LokiDeduperMarkIndexFields...) | ||
} | ||
} | ||
|
||
return indexFields | ||
} |