Skip to content

Commit

Permalink
Merge pull request #943 from mjholder/dependency-metrics-ff
Browse files Browse the repository at this point in the history
Control dependency metrics via a config or env
  • Loading branch information
psav committed Feb 28, 2024
2 parents 1b228db + 059c06d commit a618416
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 5 deletions.
3 changes: 2 additions & 1 deletion config/deployment-template/clowder_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ data:
"watchStrimziResources": ${WATCH_STRIMZI_RESOURCES},
"enableKedaResources": ${ENABLE_KEDA_RESOURCES},
"perProviderMetrics": ${PER_PROVIDER_METRICS},
"reconciliationMetrics": ${RECONCILIATION_METRICS}
"reconciliationMetrics": ${RECONCILIATION_METRICS},
"enableDependencyMetrics": ${ENABLE_TELEMETRY_METRICS}
},
"settings": {
"managedKafkaEphemDeleteRegex": "${MANAGED_EPHEM_DELETE_REGEX}"
Expand Down
5 changes: 5 additions & 0 deletions controllers/cloud.redhat.com/clowdapp_reconciliation.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,11 @@ func ReportDependencies(ctx context.Context, pClient client.Client, app *crd.Clo
appDependencies := app.Spec.Dependencies
appDependencies = append(appDependencies, app.Spec.OptionalDependencies...)

// Don't record metrics if not enabled
if !clowderconfig.LoadedConfig.Features.EnableDependencyMetrics {
return nil
}

applist, err := env.GetAppsInEnv(ctx, pClient)
if err != nil {
return err
Expand Down
1 change: 1 addition & 0 deletions controllers/cloud.redhat.com/clowderconfig/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ type ClowderConfig struct {
KedaResources bool `json:"enableKedaResources"`
PerProviderMetrics bool `json:"perProviderMetrics"`
ReconciliationMetrics bool `json:"reconciliationMetrics"`
EnableDependencyMetrics bool `json:"enableDependencyMetrics"`
DisableCloudWatchLogging bool `json:"disableCloudWatchLogging"`
EnableExternalStrimzi bool `json:"enableExternalStrimzi"`
DisableRandomRoutes bool `json:"disableRandomRoutes"`
Expand Down
7 changes: 5 additions & 2 deletions deploy-mutate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8395,8 +8395,9 @@ objects:
features\": {\n \"createServiceMonitor\": ${CREATE_SERVICE_MONITORS},\n\
\ \"watchStrimziResources\": ${WATCH_STRIMZI_RESOURCES},\n \"\
enableKedaResources\": ${ENABLE_KEDA_RESOURCES},\n \"perProviderMetrics\"\
: ${PER_PROVIDER_METRICS},\n \"reconciliationMetrics\": ${RECONCILIATION_METRICS}\n\
\ },\n \"settings\": {\n \"managedKafkaEphemDeleteRegex\": \"${MANAGED_EPHEM_DELETE_REGEX}\"\
: ${PER_PROVIDER_METRICS},\n \"reconciliationMetrics\": ${RECONCILIATION_METRICS},\n\
\ \"enableDependencyMetrics\": ${ENABLE_TELEMETRY_METRICS}\n },\n\
\ \"settings\": {\n \"managedKafkaEphemDeleteRegex\": \"${MANAGED_EPHEM_DELETE_REGEX}\"\
\n }\n}\n"
kind: ConfigMap
metadata:
Expand Down Expand Up @@ -8424,6 +8425,8 @@ parameters:
value: 'false'
- name: RECONCILIATION_METRICS
value: 'false'
- name: ENABLE_TELEMETRY_METRICS
value: 'false'
- name: MANAGED_EPHEM_DELETE_REGEX
value: .*ephemeral.*
- name: ENABLE_KEDA_RESOURCES
Expand Down
7 changes: 5 additions & 2 deletions deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8368,8 +8368,9 @@ objects:
features\": {\n \"createServiceMonitor\": ${CREATE_SERVICE_MONITORS},\n\
\ \"watchStrimziResources\": ${WATCH_STRIMZI_RESOURCES},\n \"\
enableKedaResources\": ${ENABLE_KEDA_RESOURCES},\n \"perProviderMetrics\"\
: ${PER_PROVIDER_METRICS},\n \"reconciliationMetrics\": ${RECONCILIATION_METRICS}\n\
\ },\n \"settings\": {\n \"managedKafkaEphemDeleteRegex\": \"${MANAGED_EPHEM_DELETE_REGEX}\"\
: ${PER_PROVIDER_METRICS},\n \"reconciliationMetrics\": ${RECONCILIATION_METRICS},\n\
\ \"enableDependencyMetrics\": ${ENABLE_TELEMETRY_METRICS}\n },\n\
\ \"settings\": {\n \"managedKafkaEphemDeleteRegex\": \"${MANAGED_EPHEM_DELETE_REGEX}\"\
\n }\n}\n"
kind: ConfigMap
metadata:
Expand Down Expand Up @@ -8397,6 +8398,8 @@ parameters:
value: 'false'
- name: RECONCILIATION_METRICS
value: 'false'
- name: ENABLE_TELEMETRY_METRICS
value: 'false'
- name: MANAGED_EPHEM_DELETE_REGEX
value: .*ephemeral.*
- name: ENABLE_KEDA_RESOURCES
Expand Down
1 change: 1 addition & 0 deletions docsmd/developer-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -463,6 +463,7 @@ behaviour. They are detailed as follows:
| ``features.enablekedaResources`` | Turns on the addition of Keda resources into the protectedGVK list. | No
| ``features.perProviderMetrics`` | Turns on metrics that calculate reconciliation time per provider. | Yes
| ``features.reconciliationMetrics`` | Enables extra detailed metrics on reconciliations per application. | Yes
| ``features.enableDependencyMetrics`` | Turns on metrics that report availability of a ClowdApps dependencies. | Yes
| ``disableCloudWatchLogging`` | Disables logging to CloudWatch. | Yes
| ``enableExternalStrimzi`` | Enables talking to Strimzi via a local nodeport (only useful on minikube) | Yes
| ``disableRandomRoutes`` | Gives the ability to disable the extra portion of randomness added to routes. | Yes
2 changes: 2 additions & 0 deletions template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ parameters:
value: "false"
- name: RECONCILIATION_METRICS
value: "false"
- name: ENABLE_TELEMETRY_METRICS
value: "false"
- name: MANAGED_EPHEM_DELETE_REGEX
value: ".*ephemeral.*"
- name: ENABLE_KEDA_RESOURCES
Expand Down

0 comments on commit a618416

Please sign in to comment.