Skip to content

Commit 631db20

Browse files
committed
bundles: add region tracing
Add 'TraceLogger.Region()' invocations to all public methods of the 'BundleProvider' struct, except for 'CreateInitialBundle()' and 'CreateSingletonBundle()' (due to the relative brevity of those functions). Signed-off-by: Victoria Dye <[email protected]>
1 parent 56f572e commit 631db20

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

internal/bundles/bundles.go

+12
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,9 @@ func (b *bundleProvider) CreateSingletonList(ctx context.Context, bundle Bundle)
118118

119119
// Given a BundleList
120120
func (b *bundleProvider) WriteBundleList(ctx context.Context, list *BundleList, repo *core.Repository) error {
121+
_, exitRegion := b.logger.Region(ctx, "bundles", "write_bundle_list")
122+
defer exitRegion()
123+
121124
listFile := repo.WebDir + "/bundle-list"
122125
jsonFile := repo.RepoDir + "/bundle-list.json"
123126

@@ -179,6 +182,9 @@ func (b *bundleProvider) WriteBundleList(ctx context.Context, list *BundleList,
179182
}
180183

181184
func (b *bundleProvider) GetBundleList(ctx context.Context, repo *core.Repository) (*BundleList, error) {
185+
_, exitRegion := b.logger.Region(ctx, "bundles", "get_bundle_list")
186+
defer exitRegion()
187+
182188
jsonFile := repo.RepoDir + "/bundle-list.json"
183189

184190
reader, err := os.Open(jsonFile)
@@ -283,6 +289,9 @@ func (b *bundleProvider) getAllPrereqsForIncrementalBundle(list *BundleList) ([]
283289
}
284290

285291
func (b *bundleProvider) CreateIncrementalBundle(ctx context.Context, repo *core.Repository, list *BundleList) (*Bundle, error) {
292+
ctx, exitRegion := b.logger.Region(ctx, "bundles", "create_incremental_bundle")
293+
defer exitRegion()
294+
286295
bundle := b.createDistinctBundle(repo, list)
287296

288297
lines, err := b.getAllPrereqsForIncrementalBundle(list)
@@ -303,6 +312,9 @@ func (b *bundleProvider) CreateIncrementalBundle(ctx context.Context, repo *core
303312
}
304313

305314
func (b *bundleProvider) CollapseList(ctx context.Context, repo *core.Repository, list *BundleList) error {
315+
ctx, exitRegion := b.logger.Region(ctx, "bundles", "collapse_list")
316+
defer exitRegion()
317+
306318
maxBundles := 5
307319

308320
if len(list.Bundles) <= maxBundles {

0 commit comments

Comments
 (0)