-
Notifications
You must be signed in to change notification settings - Fork 944
fix: improve log on provisioner daemon started with pk #15588
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
995a046
2ca6c91
c67d322
911a47d
1a019bb
c629f07
54437f2
8eeffb1
960084d
3aa81ed
ebcf687
0cff661
d4472a2
ee0fef6
703668b
9e0a2d3
b5ff465
7ea193f
08ab032
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -104,14 +104,20 @@ func (r *RootCmd) provisionerDaemonStart() *serpent.Command { | |
return err | ||
} | ||
|
||
displayedTags := make(map[string]string, len(tags)) | ||
for key, val := range tags { | ||
displayedTags[key] = val | ||
} | ||
|
||
if provisionerKey != "" { | ||
pkDetails, err := client.GetProvisionerKey(ctx, provisionerKey) | ||
if err != nil { | ||
return xerrors.Errorf("unable to get provisioner key details: %w", err) | ||
return xerrors.New("unable to get provisioner key details") | ||
} | ||
|
||
displayedTags = make(map[string]string, len(pkDetails.Tags)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What is your intention here? To clear out the map if the provisioner key is set? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So globally, either we have no key and some tags (line 107 to 110) - either we have no key (line 112) and want to fill the displayedTags with the ones fetched in That's why at first I was using the same map without allocating it , as we can't really be sure about the size before knowing in which case we'll enter There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Seems like you should add an I don't think what you have is a big deal performance-wise since maps can never shrink, so if the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. tried to improve it from your feedback, was it what you had in mind ? 🙏 I basically allocate before the logic, then fill it with the tags i want based on the case - worst situation, it will reallocate with more space for the tags fetched if required. |
||
for k, v := range pkDetails.Tags { | ||
tags[k] = v | ||
displayedTags[k] = v | ||
} | ||
} | ||
|
||
|
@@ -142,7 +148,7 @@ func (r *RootCmd) provisionerDaemonStart() *serpent.Command { | |
defer closeLogger() | ||
} | ||
|
||
if len(tags) == 0 { | ||
if len(displayedTags) == 0 { | ||
logger.Info(ctx, "note: untagged provisioners can only pick up jobs from untagged templates") | ||
} | ||
|
||
|
@@ -213,7 +219,7 @@ func (r *RootCmd) provisionerDaemonStart() *serpent.Command { | |
defer closeFunc() | ||
} | ||
|
||
logger.Info(ctx, "starting provisioner daemon", slog.F("tags", tags), slog.F("name", name)) | ||
logger.Info(ctx, "starting provisioner daemon", slog.F("tags", displayedTags), slog.F("name", name)) | ||
|
||
connector := provisionerd.LocalProvisioners{ | ||
string(database.ProvisionerTypeTerraform): proto.NewDRPCProvisionerClient(terraformClient), | ||
|
Uh oh!
There was an error while loading. Please reload this page.