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
27 changes: 1 addition & 26 deletions docs/sources/reference/components/pyroscope/pyroscope.ebpf.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,32 +87,7 @@ Several arguments are marked as "Deprecated (no-op)". These arguments were previ

## Blocks

You can use the following blocks with `pyroscope.ebpf`:

| Hierarchy | Block | Description | Required |
|--------------|--------------|---------------------------------------------------------|----------|
| `debug_info` | [debug_info] | Configures debug information handling and remote upload. | no |

[debug_info]: #debug_info

### debug_info

The `debug_info` block configures how the component handles debug information for symbolization. You can use it to enable on-target symbolization, which resolves symbols locally, or to upload debug information to a remote endpoint for server-side symbolization.

You can use the following arguments with the `debug_info` block:

| Name | Type | Description | Default | Required |
|---------------------------|--------|------------------------------------------------------------------------|---------|----------|
| `on_target_symbolization` | `bool` | Enables on-target symbolization using local debug information. | `true` | no |
| `upload` | `bool` | Enables uploading debug information to the remote endpoint. | `false` | no |
| `cache_size` | `int` | Size of the LRU cache for tracking uploaded debug information. | `65536` | no |
| `strip_text_section` | `bool` | Strips the `.text` section from debug information before upload. | `false` | no |
| `queue_size` | `int` | Size of the upload queue. | `1024` | no |
| `worker_num` | `int` | Number of worker goroutines for uploading debug information. | `8` | no |

When `on_target_symbolization` is enabled, the component resolves symbols locally using debug files found on the host. This is the default behavior and works well when debug symbols are available on the profiled system.

When `upload` is enabled, the component uploads debug information to the configured `pyroscope.write` endpoint, allowing the server to perform symbolization instead. This reduces CPU and memory usage on the profiled host, which is useful in resource-constrained environments.
`pyroscope.ebpf` doesn't support any blocks.

## Exported fields

Expand Down
3 changes: 0 additions & 3 deletions internal/component/pyroscope/ebpf/args.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (

"github.com/grafana/alloy/internal/component/discovery"
"github.com/grafana/alloy/internal/component/pyroscope"
"github.com/grafana/alloy/internal/component/pyroscope/write/debuginfo"
)

type Arguments struct {
Expand All @@ -29,8 +28,6 @@ type Arguments struct {
LazyMode bool `alloy:"lazy_mode,attr,optional"`
DeprecatedArguments DeprecatedArguments `alloy:",squash"`

DebugInfoOptions debuginfo.Arguments `alloy:"debug_info,block,optional"`

// undocumented
PyroscopeDynamicProfilingPolicy bool `alloy:"targets_only,attr,optional"`
SymbCachePath string `alloy:"symb_cache_path,attr,optional"`
Expand Down
39 changes: 12 additions & 27 deletions internal/component/pyroscope/ebpf/ebpf_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,20 +67,17 @@ func New(logger log.Logger, reg prometheus.Registerer, id string, args Arguments

appendable := pyroscope.NewFanout(args.ForwardTo, id, reg)

var nfs *irsymcache.Resolver
if args.DebugInfoOptions.OnTargetSymbolizationEnabled {
nfs, err = irsymcache.NewFSCache(logger, irsymcache.TableTableFactory{
Options: []lidia.Option{
lidia.WithFiles(),
lidia.WithLines(),
},
}, irsymcache.Options{
SizeEntries: uint32(args.SymbCacheSizeEntries),
Path: args.SymbCachePath,
})
if err != nil {
return nil, err
}
nfs, err := irsymcache.NewFSCache(logger, irsymcache.TableTableFactory{
Options: []lidia.Option{
lidia.WithFiles(),
lidia.WithLines(),
},
}, irsymcache.Options{
SizeEntries: uint32(args.SymbCacheSizeEntries),
Path: args.SymbCachePath,
})
if err != nil {
return nil, err
}

if dynamicProfilingPolicy {
Expand Down Expand Up @@ -282,11 +279,9 @@ func (c *Component) ReportExecutable(md *reporter2.ExecutableMetadata) {
if c.symbols != nil {
c.symbols.ReportExecutable(md)
}
if c.args.DebugInfoOptions.UploadEnabled {
c.reportExecutableForDebugInfoUpload(md)
}
}

//nolint:unused
func (c *Component) reportExecutableForDebugInfoUpload(args *reporter2.ExecutableMetadata) {
extractAsFile := func(pid libpf.PID, file string) string {
return path.Join("/proc", strconv.Itoa(int(pid)), "root", file)
Expand All @@ -309,7 +304,6 @@ func (c *Component) reportExecutableForDebugInfoUpload(args *reporter2.Executabl
c.appendable.Upload(debuginfo.UploadJob{
FrameMappingFileData: mf,
Open: open,
InitArguments: c.args.DebugInfoOptions,
})
}

Expand All @@ -333,15 +327,6 @@ func NewDefaultArguments() Arguments {
VerboseMode: false,
LazyMode: false,

DebugInfoOptions: debuginfo.Arguments{
OnTargetSymbolizationEnabled: true,
UploadEnabled: false,
CacheSize: 65536,
StripTextSection: false,
QueueSize: 1024,
WorkerNum: 8,
},

// undocumented
PyroscopeDynamicProfilingPolicy: true,
SymbCachePath: "/tmp/symb-cache",
Expand Down
1 change: 1 addition & 0 deletions internal/component/pyroscope/receive_http/debuginfo.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import (

var errNoDebugInfoClient = status.Error(codes.Unavailable, "no debug info client available")

//nolint:unused
func (c *Component) mountDebugInfo(router *mux.Router) {
c.grpcServer = NewGrpcServer(c.server.Config())
debuginfogrpc.RegisterDebuginfoServiceServer(c.grpcServer, c)
Expand Down
2 changes: 0 additions & 2 deletions internal/component/pyroscope/receive_http/receive_http.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,6 @@ func (c *Component) update(args component.Arguments) (bool, error) {
// mount connect go pushv1
pathPush, handlePush := pushv1connect.NewPusherServiceHandler(c)
router.PathPrefix(pathPush).Handler(handlePush).Methods(http.MethodPost)

c.mountDebugInfo(router)
})
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ func newEbpf(forward pyroscope.Appendable, uprobeLinks []string) *ebpf.Component
args.ReporterUnsymbolizedStubs = true
args.Demangle = "full"
args.UProbeLinks = uprobeLinks
args.DebugInfoOptions.UploadEnabled = true
// args.DebugInfoOptions.UploadEnabled = true
e, err := ebpf.New(
log.With(l, "component", "ebpf"),
reg,
Expand Down
Loading