@@ -18,6 +18,7 @@ import (
1818 "github.com/DataDog/chaos-controller/cloudservice"
1919 cloudtypes "github.com/DataDog/chaos-controller/cloudservice/types"
2020 "github.com/DataDog/chaos-controller/ddmark"
21+ cLog "github.com/DataDog/chaos-controller/log"
2122 "github.com/DataDog/chaos-controller/o11y/metrics"
2223 "github.com/DataDog/chaos-controller/o11y/tracer"
2324 chaostypes "github.com/DataDog/chaos-controller/types"
@@ -121,7 +122,7 @@ var _ webhook.Validator = &Disruption{}
121122
122123// ValidateCreate implements webhook.Validator so a webhook will be registered for the type
123124func (r * Disruption ) ValidateCreate () (admission.Warnings , error ) {
124- log := logger .With ("disruptionName" , r .Name , "disruptionNamespace" , r .Namespace )
125+ log := logger .With (cLog . DisruptionNameKey , r .Name , cLog . DisruptionNamespaceKey , r .Namespace )
125126
126127 ctx , err := r .SpanContext (context .Background ())
127128 if err != nil {
@@ -274,7 +275,7 @@ func (r *Disruption) ValidateCreate() (admission.Warnings, error) {
274275
275276// ValidateUpdate implements webhook.Validator so a webhook will be registered for the type
276277func (r * Disruption ) ValidateUpdate (old runtime.Object ) (admission.Warnings , error ) {
277- log := logger .With ("disruptionName" , r .Name , "disruptionNamespace" , r .Namespace )
278+ log := logger .With (cLog . DisruptionNameKey , r .Name , cLog . DisruptionNamespaceKey , r .Namespace )
278279 log .Debugw ("validating updated disruption" , "spec" , r .Spec )
279280
280281 var err error
@@ -384,7 +385,7 @@ func (r *Disruption) getMetricsTags() []string {
384385
385386 if userInfo , err := r .UserInfo (); ! errors .Is (err , ErrNoUserInfo ) {
386387 if err != nil {
387- logger .Errorw ("error retrieving user info from disruption, using empty user info" , "error" , err , "disruptionName" , r .Name , "disruptionNamespace" , r .Namespace )
388+ logger .Errorw ("error retrieving user info from disruption, using empty user info" , "error" , err , cLog . DisruptionNameKey , r .Name , cLog . DisruptionNamespaceKey , r .Namespace )
388389 }
389390
390391 tags = append (tags , "username:" + userInfo .Username )
@@ -602,8 +603,8 @@ func safetyNetCountNotTooLarge(r *Disruption) (bool, string, error) {
602603 }
603604
604605 logger .Debugw ("comparing estimated target count to total existing targets" ,
605- "disruptionName" , r .Name ,
606- "disruptionNamespace" , r .Namespace ,
606+ cLog . DisruptionNameKey , r .Name ,
607+ cLog . DisruptionNamespaceKey , r .Namespace ,
607608 "namespaceThreshold" , namespaceThreshold ,
608609 "clusterThreshold" , clusterThreshold ,
609610 "estimatedEligibleTargetsCount" , targetCount ,
0 commit comments