Skip to content

Commit

Permalink
metadata collector is unneeded for the collector controller
Browse files Browse the repository at this point in the history
  • Loading branch information
dmathieu committed Jan 7, 2025
1 parent 2810357 commit 9ead7a5
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 20 deletions.
2 changes: 0 additions & 2 deletions internal/controller/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ type Config struct {
Tracers string
VerboseMode bool
Version bool
// HostName is the name of the host.
HostName string

Reporter reporter.Reporter

Expand Down
18 changes: 0 additions & 18 deletions internal/controller/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ import (
"github.com/tklauser/numcpus"

"go.opentelemetry.io/ebpf-profiler/host"
"go.opentelemetry.io/ebpf-profiler/hostmetadata"
"go.opentelemetry.io/ebpf-profiler/internal/helpers"
"go.opentelemetry.io/ebpf-profiler/metrics"
"go.opentelemetry.io/ebpf-profiler/reporter"
"go.opentelemetry.io/ebpf-profiler/times"
Expand Down Expand Up @@ -68,29 +66,13 @@ func (c *Controller) Start(ctx context.Context) error {
return fmt.Errorf("failed to parse the included tracers: %w", err)
}

metadataCollector := hostmetadata.NewCollector(c.config.CollAgentAddr)
metadataCollector.AddCustomData("os.type", "linux")

kernelVersion, err := helpers.GetKernelVersion()
if err != nil {
return fmt.Errorf("failed to get Linux kernel version: %w", err)
}
// OTel semantic introduced in https://github.com/open-telemetry/semantic-conventions/issues/66
metadataCollector.AddCustomData("os.kernel.release", kernelVersion)

metadataCollector.AddCustomData("host.name", c.config.HostName)
metadataCollector.AddCustomData("host.ip", c.config.IPAddress)

err = c.reporter.Start(ctx)
if err != nil {
return fmt.Errorf("failed to start reporter: %w", err)
}

metrics.SetReporter(c.reporter)

// Now that set the initial host metadata, start a goroutine to keep sending updates regularly.
metadataCollector.StartMetadataCollection(ctx, c.reporter)

// Load the eBPF code and map definitions
trc, err := tracer.NewTracer(ctx, &tracer.Config{
Reporter: c.reporter,
Expand Down

0 comments on commit 9ead7a5

Please sign in to comment.