services/identity: Some more temporary logging to help debug database
wedges.
Change-Id: I2dd7df8438701bd1a42b34c4772879e2bc44599e
diff --git a/services/identity/internal/blesser/oauth.go b/services/identity/internal/blesser/oauth.go
index 079967e..16c0866 100644
--- a/services/identity/internal/blesser/oauth.go
+++ b/services/identity/internal/blesser/oauth.go
@@ -64,10 +64,10 @@
if err != nil {
return noblessings, "", err
}
- return b.bless(call.Security(), email, clientName)
+ return b.bless(ctx, call.Security(), email, clientName)
}
-func (b *oauthBlesser) bless(call security.Call, email, clientName string) (security.Blessings, string, error) {
+func (b *oauthBlesser) bless(ctx *context.T, call security.Call, email, clientName string) (security.Blessings, string, error) {
var noblessings security.Blessings
self := call.LocalPrincipal()
if self == nil {
@@ -76,7 +76,16 @@
var caveat security.Caveat
var err error
if b.revocationManager != nil {
+ // TODO(ashankar,suharshs): Remove: Added for debugging
+ start := time.Now()
caveat, err = b.revocationManager.NewCaveat(self.PublicKey(), b.dischargerLocation)
+ var id string
+ if caveat.ThirdPartyDetails() != nil {
+ id = caveat.ThirdPartyDetails().ID()
+ }
+ if d := time.Since(start); d > time.Second || err != nil {
+ ctx.Infof("NewCaveat took %v and returned error %v (caveat id: %v): (%v <-> %v)", d, err, id, call.RemoteEndpoint(), call.LocalEndpoint())
+ }
} else {
caveat, err = security.NewExpiryCaveat(time.Now().Add(b.duration))
}
diff --git a/services/identity/internal/revocation/revocation_manager.go b/services/identity/internal/revocation/revocation_manager.go
index 47124ae..595b202 100644
--- a/services/identity/internal/revocation/revocation_manager.go
+++ b/services/identity/internal/revocation/revocation_manager.go
@@ -87,7 +87,8 @@
return timestamp
}
-func isRevoked(_ *context.T, _ security.Call, key []byte) error {
+func isRevoked(ctx *context.T, call security.Call, key []byte) error {
+ start := time.Now()
revocationLock.RLock()
if revocationDB == nil {
revocationLock.RUnlock()
@@ -95,6 +96,13 @@
}
revocationLock.RUnlock()
revoked, err := revocationDB.IsRevoked(key)
+ if err != nil {
+ // TODO(ashankar): Remove. Added for debugging.
+ ctx.Infof("IsRevoked(%v) returned %v (%v <-> %v)", key, err, call.RemoteEndpoint(), call.LocalEndpoint())
+ }
+ if d := time.Since(start); d > time.Second {
+ ctx.Infof("IsRevoked(%v) took %v (%v <-> %v)", key, d, call.RemoteEndpoint(), call.LocalEndpoint())
+ }
if revoked {
return fmt.Errorf("revoked")
}