From deb3cffea20a26c14e1edff69220b262dad104c3 Mon Sep 17 00:00:00 2001 From: Abhishu Raina Date: Fri, 10 Jan 2025 13:33:06 +0530 Subject: [PATCH] feat: add labels from v4 integrations config as tags on UI. --- pkg/entity/register/worker.go | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/pkg/entity/register/worker.go b/pkg/entity/register/worker.go index 2efd1c9dc..bca024f03 100644 --- a/pkg/entity/register/worker.go +++ b/pkg/entity/register/worker.go @@ -22,6 +22,9 @@ import ( var ( wlog = log.WithComponent("RegisterWorker") ) +var ( + elog = log.WithComponent("integrations.emitter.Emitter") +) // WorkerConfig will provide all configuration parameters for a register worker. type WorkerConfig struct { @@ -112,7 +115,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 { + for key, value := range r.Definition.Labels { + entity.Metadata[key] = value + } + } + entities = append(entities, entity) } responses := w.registerEntitiesWithRetry(ctx, entities)