Skip to content

Commit

Permalink
remove shared
Browse files Browse the repository at this point in the history
  • Loading branch information
bragi92 committed Feb 21, 2025
1 parent a916835 commit 399acd5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,9 @@ data:
etcd = ""
minimal-ingestion-profile: |-
enabled = true
shared: |-
prometheus-collector-settings: |-
cluster_alias = ""
debug-mode = "true"
prometheus-collector-settings: |-
cluster_alias = ""
debug-mode = "true"
metadata:
name: ama-metrics-settings-configmap
namespace: kube-system
7 changes: 3 additions & 4 deletions otelcollector/shared/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,6 @@ func ParseMetricsFiles(filePaths []string) (map[string]map[string]string, error)
metricsConfigBySection := make(map[string]map[string]string)

for _, filePath := range filePaths {
// Open the file with deferred closure to ensure proper resource cleanup
file, err := os.Open(filePath)
if err != nil {
return nil, fmt.Errorf("failed to open file %s: %w", filePath, err)
Expand All @@ -322,7 +321,7 @@ func ParseMetricsFiles(filePaths []string) (map[string]map[string]string, error)
continue
}

// Detect and process section headers
// Detect section headers (supports top-level keys)
if strings.HasSuffix(line, ": |-") {
currentSection = strings.TrimSuffix(line, ": |-")
if _, exists := metricsConfigBySection[currentSection]; !exists {
Expand All @@ -331,10 +330,10 @@ func ParseMetricsFiles(filePaths []string) (map[string]map[string]string, error)
continue
}

// Process key-value pairs
// Process key-value pairs within sections
if currentSection != "" && strings.Contains(line, "=") {
parts := strings.SplitN(line, "=", 2)
if len(parts) < 2 {
if len(parts) != 2 {
log.Printf("warning: skipping malformed line in file %s: %q", filePath, line)
continue
}
Expand Down

0 comments on commit 399acd5

Please sign in to comment.