Fix calculation of authz ages at new-order time (#6827)

Previously, we were computing the age of the authorization as "how much
time it has left, minus its total lifetime". In retrospect, this
universally results in negative values, which then all end up in the
zero bucket of the histogram. Fix the arithmetic so we can start getting
accurate data.
This commit is contained in:
Aaron Gable 2023-04-17 16:05:11 -07:00 committed by GitHub
parent 1235cbed5e
commit bd2da9b830
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -2417,7 +2417,7 @@ func (ra *RegistrationAuthorityImpl) NewOrder(ctx context.Context, req *rapb.New
return nil, err
}
newOrder.V2Authorizations = append(newOrder.V2Authorizations, authzID)
ra.authzAges.Observe((time.Unix(0, authz.Expires).Sub(ra.clk.Now()) - ra.authorizationLifetime).Seconds())
ra.authzAges.Observe((ra.authorizationLifetime - time.Unix(0, authz.Expires).Sub(ra.clk.Now())).Seconds())
continue
} else if !strings.HasPrefix(name, "*.") {
// If the identifier isn't a wildcard, we can reuse any authz
@ -2426,7 +2426,7 @@ func (ra *RegistrationAuthorityImpl) NewOrder(ctx context.Context, req *rapb.New
return nil, err
}
newOrder.V2Authorizations = append(newOrder.V2Authorizations, authzID)
ra.authzAges.Observe((time.Unix(0, authz.Expires).Sub(ra.clk.Now()) - ra.authorizationLifetime).Seconds())
ra.authzAges.Observe((ra.authorizationLifetime - time.Unix(0, authz.Expires).Sub(ra.clk.Now())).Seconds())
continue
}