-
Notifications
You must be signed in to change notification settings - Fork 132
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
feat: add labels from nri-winservices config as tags on UI. #1989
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -112,7 +112,14 @@ func (w *worker) send(ctx context.Context, batch map[entity.Key]fwrequest.Entity | |
|
||
var entities []entity.Fields | ||
for _, r := range batch { | ||
entities = append(entities, r.Data.Entity) | ||
entity := r.Data.Entity | ||
// Add labels to Metadata | ||
if r.Definition.Labels != nil && len(r.Definition.Labels) > 0 { | ||
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. Does it make sense to extract it in a short util func and add some unit tests? (Would improve coverage as well :)) 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. Adding the unit tests for this is an excellent point ;-) |
||
for key, value := range r.Definition.Labels { | ||
entity.Metadata[key] = value | ||
} | ||
} | ||
entities = append(entities, entity) | ||
} | ||
|
||
responses := w.registerEntitiesWithRetry(ctx, entities) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it required to check the
nilness
? IfLabels
isnil
,len(r.Definition.Labels)
will be 0, won't it?