Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
thampiotr committed Jan 15, 2025
1 parent 2ca8a4e commit 42c113f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions internal/component/discovery/discovery.go
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,7 @@ func (c *Component) runDiscovery(ctx context.Context, d DiscovererWithMetrics) {
}

func toAlloyTargets(cache map[string]*targetgroup.Group) []Target {
// TODO(thampiotr): HOT SPOT #1
targetsCount := 0
for _, group := range cache {
targetsCount += len(group.Targets)
Expand Down
7 changes: 5 additions & 2 deletions internal/component/discovery/relabel/relabel.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@ import (
"fmt"
"sync"

"github.com/prometheus/prometheus/model/labels"
"github.com/prometheus/prometheus/model/relabel"

"github.com/grafana/alloy/internal/component"
alloy_relabel "github.com/grafana/alloy/internal/component/common/relabel"
"github.com/grafana/alloy/internal/component/discovery"
"github.com/grafana/alloy/internal/featuregate"
"github.com/grafana/alloy/internal/service/livedebugging"
"github.com/prometheus/prometheus/model/labels"
"github.com/prometheus/prometheus/model/relabel"
)

func init() {
Expand Down Expand Up @@ -92,9 +93,11 @@ func (c *Component) Update(args component.Arguments) error {
c.rcs = relabelConfigs

for _, t := range newArgs.Targets {
// TODO(thampiotr): HOT SPOT #2
lset := componentMapToPromLabels(t)
relabelled, keep := relabel.Process(lset, relabelConfigs...)
if keep {
// TODO(thampiotr): HOT SPOT #3
targets = append(targets, promLabelsToComponent(relabelled))
}
componentID := livedebugging.ComponentID(c.opts.ID)
Expand Down

0 comments on commit 42c113f

Please sign in to comment.