Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 0 additions & 23 deletions reporter/base_reporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,9 @@
package reporter // import "go.opentelemetry.io/ebpf-profiler/reporter"

import (
"context"
"errors"
"fmt"
"time"

lru "github.com/elastic/go-freelru"
"go.opentelemetry.io/ebpf-profiler/libpf"
"go.opentelemetry.io/ebpf-profiler/libpf/xsync"
"go.opentelemetry.io/ebpf-profiler/reporter/internal/pdata"
Expand All @@ -35,9 +32,6 @@ type baseReporter struct {

// traceEvents stores reported trace events (trace metadata with frames and counts)
traceEvents xsync.RWMutex[samples.TraceEventsTree]

// hostmetadata stores metadata that is sent out with every request.
hostmetadata *lru.SyncedLRU[string, string]
}

var errUnknownOrigin = errors.New("unknown trace origin")
Expand All @@ -46,23 +40,6 @@ func (b *baseReporter) Stop() {
b.runLoop.Stop()
}

func (b *baseReporter) ReportHostMetadata(metadataMap map[string]string) {
b.addHostmetadata(metadataMap)
}

func (b *baseReporter) ReportHostMetadataBlocking(_ context.Context,
metadataMap map[string]string, _ int, _ time.Duration) error {
b.addHostmetadata(metadataMap)
return nil
}

// addHostmetadata adds to and overwrites host metadata.
func (b *baseReporter) addHostmetadata(metadataMap map[string]string) {
for k, v := range metadataMap {
b.hostmetadata.Add(k, v)
}
}

func (b *baseReporter) ExecutableKnown(fileID libpf.FileID) bool {
_, known := b.pdata.Executables.GetAndRefresh(fileID, pdata.ExecutableCacheLifetime)
return known
Expand Down
20 changes: 5 additions & 15 deletions reporter/collector_reporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ package reporter // import "go.opentelemetry.io/ebpf-profiler/reporter"
import (
"context"

lru "github.com/elastic/go-freelru"
log "github.com/sirupsen/logrus"
"go.opentelemetry.io/collector/consumer/xconsumer"

Expand All @@ -28,14 +27,6 @@ type CollectorReporter struct {

// NewCollector builds a new CollectorReporter
func NewCollector(cfg *Config, nextConsumer xconsumer.Profiles) (*CollectorReporter, error) {
// Next step: Dynamically configure the size of this LRU.
// Currently, we use the length of the JSON array in
// hostmetadata/hostmetadata.json.
hostmetadata, err := lru.NewSynced[string, string](115, hashString)
if err != nil {
return nil, err
}

data, err := pdata.New(
cfg.SamplesPerSecond,
cfg.ExecutablesCacheElements,
Expand All @@ -49,12 +40,11 @@ func NewCollector(cfg *Config, nextConsumer xconsumer.Profiles) (*CollectorRepor

return &CollectorReporter{
baseReporter: &baseReporter{
cfg: cfg,
name: cfg.Name,
version: cfg.Version,
pdata: data,
traceEvents: xsync.NewRWMutex(tree),
hostmetadata: hostmetadata,
cfg: cfg,
name: cfg.Name,
version: cfg.Version,
pdata: data,
traceEvents: xsync.NewRWMutex(tree),
runLoop: &runLoop{
stopSignal: make(chan libpf.Void),
},
Expand Down
11 changes: 0 additions & 11 deletions reporter/iface.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ package reporter // import "go.opentelemetry.io/ebpf-profiler/reporter"

import (
"context"
"time"

"go.opentelemetry.io/ebpf-profiler/libpf"
"go.opentelemetry.io/ebpf-profiler/process"
Expand All @@ -16,7 +15,6 @@ import (
type Reporter interface {
TraceReporter
SymbolReporter
HostMetadataReporter

// Start starts the reporter in the background.
//
Expand Down Expand Up @@ -77,12 +75,3 @@ type SymbolReporter interface {
// open the file and then enqueue the upload in the background.
ExecutableMetadata(args *ExecutableMetadataArgs)
}

type HostMetadataReporter interface {
// ReportHostMetadata enqueues host metadata for sending (to the collection agent).
ReportHostMetadata(metadataMap map[string]string)

// ReportHostMetadataBlocking sends host metadata to the collection agent.
ReportHostMetadataBlocking(ctx context.Context, metadataMap map[string]string,
maxRetries int, waitRetry time.Duration) error
}
20 changes: 5 additions & 15 deletions reporter/otlp_reporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (
"crypto/tls"
"time"

lru "github.com/elastic/go-freelru"
log "github.com/sirupsen/logrus"
"go.opentelemetry.io/collector/pdata/pprofile/pprofileotlp"
"google.golang.org/grpc"
Expand Down Expand Up @@ -44,14 +43,6 @@ type OTLPReporter struct {

// NewOTLP returns a new instance of OTLPReporter
func NewOTLP(cfg *Config) (*OTLPReporter, error) {
// Next step: Dynamically configure the size of this LRU.
// Currently, we use the length of the JSON array in
// hostmetadata/hostmetadata.json.
hostmetadata, err := lru.NewSynced[string, string](115, hashString)
if err != nil {
return nil, err
}

data, err := pdata.New(
cfg.SamplesPerSecond,
cfg.ExecutablesCacheElements,
Expand All @@ -65,12 +56,11 @@ func NewOTLP(cfg *Config) (*OTLPReporter, error) {

return &OTLPReporter{
baseReporter: &baseReporter{
cfg: cfg,
name: cfg.Name,
version: cfg.Version,
pdata: data,
traceEvents: xsync.NewRWMutex(eventsTree),
hostmetadata: hostmetadata,
cfg: cfg,
name: cfg.Name,
version: cfg.Version,
pdata: data,
traceEvents: xsync.NewRWMutex(eventsTree),
runLoop: &runLoop{
stopSignal: make(chan libpf.Void),
},
Expand Down
13 changes: 0 additions & 13 deletions reporter/util.go

This file was deleted.

Loading