@@ -112,12 +112,12 @@ func Rotate(account, provider, project string, c config.Config) (err error) {
112
112
} else if isDatadogKeySet (c .Credentials .Datadog .APIKey ) {
113
113
ddAPIKey = c .Credentials .Datadog .APIKey
114
114
}
115
- if ! c .RotationMode {
116
- if ddAPIKey != "" {
117
- if metricErr := postMetric (providerKeys , ddAPIKey , c .Datadog ); metricErr != nil {
118
- logger .Infow ("Posting metrics errored" , metricErr )
119
- }
115
+ if ddAPIKey != "" && c .Datadog != (config.Datadog {}) {
116
+ if metricErr := postMetric (providerKeys , ddAPIKey , c .Datadog ); metricErr != nil {
117
+ logger .Infow ("Posting metrics errored" , metricErr )
120
118
}
119
+ }
120
+ if ! c .RotationMode {
121
121
if c .EnableKeyAgeLogging {
122
122
obfuscatedKeys := []keys.Key {}
123
123
for _ , key := range providerKeys {
@@ -148,17 +148,7 @@ func Rotate(account, provider, project string, c config.Config) (err error) {
148
148
logger .Infof ("Finalised %d keys that are candidates for rotation: %v" ,
149
149
len (rc ), rcStrings )
150
150
151
- if err = rotateKeys (rc , c .Credentials ); err != nil {
152
- return
153
- }
154
- if ddAPIKey != "" {
155
- // Refresh key ages post rotation
156
- if providerKeys , err = keysOfProviders (account , provider , project , c ); err != nil {
157
- return
158
- }
159
- return postMetric (providerKeys , ddAPIKey , c .Datadog )
160
- }
161
- return
151
+ return rotateKeys (rc , c .Credentials )
162
152
}
163
153
164
154
// rotateKey creates a new key for the rotation candidate, updates its key locations,
0 commit comments