Skip to content

Commit

Permalink
adding telemetry
Browse files Browse the repository at this point in the history
  • Loading branch information
rashmichandrashekar committed Nov 1, 2024
1 parent 415d951 commit 246cba7
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 0 deletions.
17 changes: 17 additions & 0 deletions otelcollector/prom-config-validator-builder/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,23 @@ func generateOtelConfig(promFilePath string, outputFilePath string, otelConfigTe
return fmt.Errorf("unsupported features:\n\t%s", strings.Join(unsupportedFeatures, "\n\t"))
}

globalSettingsFromMergedOtelConfig := prometheusConfig["global"]

if globalSettingsFromMergedOtelConfig != nil {
globalSettings := globalSettingsFromMergedOtelConfig2.(map[interface{}]interface{})
scrapeInterval := globalSettings["scrape_interval"]
if (len(globalSettings) > 1) || (len(globalSettings) == 1 && scrapeInterval != "15s") {
if os.Getenv("CONTROLLER_TYPE") == "ReplicaSet" {
os.Setenv("AZMON_GLOBAL_SETTINGS_ENABLED_REPLICASET", "true")
} else if os.Getenv("CONTROLLER_TYPE") == "DaemonSet" && os.Getenv("OS_TYPE") == "linux" {
os.Setenv("AZMON_GLOBAL_SETTINGS_ENABLED_DAEMONSET_LINUX", "true")
} else if os.Getenv("CONTROLLER_TYPE") == "DaemonSet" && os.Getenv("OS_TYPE") != "linux" {
os.Setenv("AZMON_GLOBAL_SETTINGS_ENABLED_DAEMONSET_WINDOWS", "true")
}
fmt.Printf("prom-config-validator::Successfully set env variables for global config\n")
}
}

otelConfig.Receivers.Prometheus.Config = prometheusConfig

if os.Getenv("DEBUG_MODE_ENABLED") == "true" {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
podname = "$POD_NAME"
ostype = "$OS_TYPE"
mip="$MINIMAL_INGESTION_PROFILE"
daemonsetGlobalSettingsEnabled= "$AZMON_GLOBAL_SETTINGS_ENABLED_DAEMONSET_LINUX"

# Configuration for telegraf agent
[agent]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
operatormodelcfgmapsetting = "$AZMON_OPERATOR_ENABLED_CFG_MAP_SETTING"
operatormodelchartsetting = "$AZMON_OPERATOR_ENABLED_CHART_SETTING"
collectorHpaEnabled = "$AZMON_COLLECTOR_HPA_ENABLED"
replicasetGlobalSettingsEnabled= "$AZMON_GLOBAL_SETTINGS_ENABLED_REPLICASET"

# Configuration for telegraf agent
[agent]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@
ostype = "$OS_TYPE"
debugmodeenabled = "$DEBUG_MODE_ENABLED"
windowsVersion = "$windowsVersion"
windowsdaemonsetGlobalSettingsEnabled= "$AZMON_GLOBAL_SETTINGS_ENABLED_DAEMONSET_WINDOWS"


# Configuration for telegraf agent
[agent]
Expand Down

0 comments on commit 246cba7

Please sign in to comment.