Extra logging and clues context for folder caches (#4988)
Add extra logging and clues to errors when populating container caches for Exchange. This could help track down some things related to time spent getting data. --- #### Does this PR need a docs update or release note? - [ ] ✅ Yes, it's included - [ ] 🕐 Yes, but in a later PR - [x] ⛔ No #### Type of change - [ ] 🌻 Feature - [ ] 🐛 Bugfix - [ ] 🗺️ Documentation - [x] 🤖 Supportability/Tests - [ ] 💻 CI/Deployment - [ ] 🧹 Tech Debt/Cleanup #### Test Plan - [x] 💪 Manual - [ ] ⚡ Unit test - [ ] 💚 E2E
This commit is contained in:
parent
2279d612d9
commit
443aed639c
@ -2,12 +2,14 @@ package exchange
|
||||
|
||||
import (
|
||||
"context"
|
||||
"time"
|
||||
|
||||
"github.com/alcionai/clues"
|
||||
"github.com/microsoftgraph/msgraph-sdk-go/models"
|
||||
|
||||
"github.com/alcionai/corso/src/internal/common/ptr"
|
||||
"github.com/alcionai/corso/src/pkg/fault"
|
||||
"github.com/alcionai/corso/src/pkg/logger"
|
||||
"github.com/alcionai/corso/src/pkg/path"
|
||||
"github.com/alcionai/corso/src/pkg/services/m365/api/graph"
|
||||
)
|
||||
@ -93,6 +95,10 @@ func (cfc *contactContainerCache) Populate(
|
||||
baseID string,
|
||||
baseContainerPath ...string,
|
||||
) error {
|
||||
start := time.Now()
|
||||
|
||||
logger.Ctx(ctx).Info("populating container cache")
|
||||
|
||||
if err := cfc.init(ctx, baseID, baseContainerPath); err != nil {
|
||||
return clues.Wrap(err, "initializing")
|
||||
}
|
||||
@ -104,8 +110,10 @@ func (cfc *contactContainerCache) Populate(
|
||||
cfc.userID,
|
||||
baseID,
|
||||
false)
|
||||
ctx = clues.Add(ctx, "num_enumerated_containers", len(containers))
|
||||
|
||||
if err != nil {
|
||||
return clues.Wrap(err, "enumerating containers")
|
||||
return clues.WrapWC(ctx, err, "enumerating containers")
|
||||
}
|
||||
|
||||
for _, c := range containers {
|
||||
@ -127,5 +135,9 @@ func (cfc *contactContainerCache) Populate(
|
||||
return clues.Wrap(err, "populating paths")
|
||||
}
|
||||
|
||||
logger.Ctx(ctx).Infow(
|
||||
"done populating container cache",
|
||||
"duration", time.Since(start))
|
||||
|
||||
return el.Failure()
|
||||
}
|
||||
|
||||
@ -2,12 +2,14 @@ package exchange
|
||||
|
||||
import (
|
||||
"context"
|
||||
"time"
|
||||
|
||||
"github.com/alcionai/clues"
|
||||
"github.com/microsoftgraph/msgraph-sdk-go/models"
|
||||
|
||||
"github.com/alcionai/corso/src/internal/common/ptr"
|
||||
"github.com/alcionai/corso/src/pkg/fault"
|
||||
"github.com/alcionai/corso/src/pkg/logger"
|
||||
"github.com/alcionai/corso/src/pkg/path"
|
||||
"github.com/alcionai/corso/src/pkg/services/m365/api"
|
||||
"github.com/alcionai/corso/src/pkg/services/m365/api/graph"
|
||||
@ -67,6 +69,10 @@ func (ecc *eventContainerCache) Populate(
|
||||
baseID string,
|
||||
baseContainerPath ...string,
|
||||
) error {
|
||||
start := time.Now()
|
||||
|
||||
logger.Ctx(ctx).Info("populating container cache")
|
||||
|
||||
if err := ecc.init(ctx); err != nil {
|
||||
return clues.Wrap(err, "initializing")
|
||||
}
|
||||
@ -78,8 +84,10 @@ func (ecc *eventContainerCache) Populate(
|
||||
ecc.userID,
|
||||
"",
|
||||
false)
|
||||
ctx = clues.Add(ctx, "num_enumerated_containers", len(containers))
|
||||
|
||||
if err != nil {
|
||||
return clues.Wrap(err, "enumerating containers")
|
||||
return clues.WrapWC(ctx, err, "enumerating containers")
|
||||
}
|
||||
|
||||
for _, c := range containers {
|
||||
@ -104,6 +112,10 @@ func (ecc *eventContainerCache) Populate(
|
||||
return clues.Wrap(err, "populating paths")
|
||||
}
|
||||
|
||||
logger.Ctx(ctx).Infow(
|
||||
"done populating container cache",
|
||||
"duration", time.Since(start))
|
||||
|
||||
return el.Failure()
|
||||
}
|
||||
|
||||
|
||||
@ -2,11 +2,13 @@ package exchange
|
||||
|
||||
import (
|
||||
"context"
|
||||
"time"
|
||||
|
||||
"github.com/alcionai/clues"
|
||||
"github.com/microsoftgraph/msgraph-sdk-go/models"
|
||||
|
||||
"github.com/alcionai/corso/src/pkg/fault"
|
||||
"github.com/alcionai/corso/src/pkg/logger"
|
||||
"github.com/alcionai/corso/src/pkg/path"
|
||||
"github.com/alcionai/corso/src/pkg/services/m365/api"
|
||||
"github.com/alcionai/corso/src/pkg/services/m365/api/graph"
|
||||
@ -97,6 +99,10 @@ func (mc *mailContainerCache) Populate(
|
||||
baseID string,
|
||||
baseContainerPath ...string,
|
||||
) error {
|
||||
start := time.Now()
|
||||
|
||||
logger.Ctx(ctx).Info("populating container cache")
|
||||
|
||||
if err := mc.init(ctx); err != nil {
|
||||
return clues.Wrap(err, "initializing")
|
||||
}
|
||||
@ -108,8 +114,10 @@ func (mc *mailContainerCache) Populate(
|
||||
mc.userID,
|
||||
"",
|
||||
false)
|
||||
ctx = clues.Add(ctx, "num_enumerated_containers", len(containers))
|
||||
|
||||
if err != nil {
|
||||
return clues.Wrap(err, "enumerating containers")
|
||||
return clues.WrapWC(ctx, err, "enumerating containers")
|
||||
}
|
||||
|
||||
for _, c := range containers {
|
||||
@ -131,5 +139,9 @@ func (mc *mailContainerCache) Populate(
|
||||
return clues.Wrap(err, "populating paths")
|
||||
}
|
||||
|
||||
logger.Ctx(ctx).Infow(
|
||||
"done populating container cache",
|
||||
"duration", time.Since(start))
|
||||
|
||||
return el.Failure()
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user