Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(cd-service): delete deprecated metrics #2095

Open
wants to merge 16 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 15 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions docs/metrics.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@ Kuberpult uploads mulitple metrics to datadog.

### `cd-service` Metrics
The cd-service uploads the following metrics to datadog:
* `env_lock_count` - the count of current environment locks, for a given environment; \[❗ deprecated\]
* `environment_lock_count` - the count of current environment locks, for a given environment;
* `app_lock_count` - the count of current environment application locks, for a given application in a given environment; \[❗ deprecated\]
* `application_lock_count` - the count of current environment application locks, for a given application in a given environment;
* `lastDeployed` - the time since the last deployment in minutes;
* `request_queue_size` - the current size of the request queue;
Expand Down
12 changes: 0 additions & 12 deletions services/cd-service/pkg/repository/transformer.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,12 +148,6 @@ func GaugeEnvLockMetric(ctx context.Context, s *State, transaction *sql.Tx, env
Warnf("Error when trying to get the number of environment locks: %w\n", err)
return
}
err = ddMetrics.Gauge("env_lock_count", count, []string{"env:" + env}, 1)
if err != nil {
logger.FromContext(ctx).
Sugar().
Warnf("Error when trying to send `env_lock_count` metric to datadog: %w\n", err)
}
err = ddMetrics.Gauge("environment_lock_count", count, []string{"kuberpult_environment:" + env}, 1)
if err != nil {
logger.FromContext(ctx).
Expand All @@ -171,12 +165,6 @@ func GaugeEnvAppLockMetric(ctx context.Context, s *State, transaction *sql.Tx, e
Warnf("Error when trying to get the number of application locks: %w\n", err)
return
}
err = ddMetrics.Gauge("app_lock_count", count, []string{"app:" + app, "env:" + env}, 1)
if err != nil {
logger.FromContext(ctx).
Sugar().
Warnf("Error when trying to send `app_lock_count` metric to datadog: %w\n", err)
}
err = ddMetrics.Gauge("application_lock_count", count, []string{"kuberpult_environment:" + env, "kuberpult_application:" + app}, 1)
if err != nil {
logger.FromContext(ctx).
Expand Down
9 changes: 0 additions & 9 deletions services/cd-service/pkg/repository/transformer_db_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3925,12 +3925,9 @@ func TestUpdateDatadogMetricsInternal(t *testing.T) {
},
expectedGauges: []Gauge{
makeGauge("request_queue_size", 0, []string{}, 1),
makeGauge("env_lock_count", 0, []string{"env:envA"}, 1),
makeGauge("environment_lock_count", 0, []string{"kuberpult_environment:envA"}, 1),
makeGauge("app_lock_count", 0, []string{"app:app1", "env:envA"}, 1),
makeGauge("application_lock_count", 0, []string{"kuberpult_environment:envA", "kuberpult_application:app1"}, 1),
makeGauge("lastDeployed", 0, []string{"kuberpult_application:app1", "kuberpult_environment:envA"}, 1),
makeGauge("app_lock_count", 0, []string{"app:app2", "env:envA"}, 1),
makeGauge("application_lock_count", 0, []string{"kuberpult_environment:envA", "kuberpult_application:app2"}, 1),
makeGauge("lastDeployed", 0, []string{"kuberpult_application:app2", "kuberpult_environment:envA"}, 1),
},
Expand Down Expand Up @@ -3967,20 +3964,14 @@ func TestUpdateDatadogMetricsInternal(t *testing.T) {
},
expectedGauges: []Gauge{
makeGauge("request_queue_size", 0, []string{}, 1),
makeGauge("env_lock_count", 0, []string{"env:envA"}, 1),
makeGauge("environment_lock_count", 0, []string{"kuberpult_environment:envA"}, 1),
makeGauge("app_lock_count", 0, []string{"app:app1", "env:envA"}, 1),
makeGauge("application_lock_count", 0, []string{"kuberpult_environment:envA", "kuberpult_application:app1"}, 1),
makeGauge("lastDeployed", 0, []string{"kuberpult_application:app1", "kuberpult_environment:envA"}, 1),
makeGauge("app_lock_count", 0, []string{"app:app2", "env:envA"}, 1),
makeGauge("application_lock_count", 0, []string{"kuberpult_environment:envA", "kuberpult_application:app2"}, 1),
makeGauge("lastDeployed", 0, []string{"kuberpult_application:app2", "kuberpult_environment:envA"}, 1),
makeGauge("env_lock_count", 0, []string{"env:envB"}, 1),
makeGauge("environment_lock_count", 0, []string{"kuberpult_environment:envB"}, 1),
makeGauge("app_lock_count", 0, []string{"app:app1", "env:envB"}, 1),
makeGauge("application_lock_count", 0, []string{"kuberpult_environment:envB", "kuberpult_application:app1"}, 1),
makeGauge("lastDeployed", 0, []string{"kuberpult_application:app1", "kuberpult_environment:envB"}, 1),
makeGauge("app_lock_count", 0, []string{"app:app2", "env:envB"}, 1),
makeGauge("application_lock_count", 0, []string{"kuberpult_environment:envB", "kuberpult_application:app2"}, 1),
makeGauge("lastDeployed", 0, []string{"kuberpult_application:app2", "kuberpult_environment:envB"}, 1),
},
Expand Down
Loading