mirror of
https://github.com/grafana/alloy.git
synced 2025-11-05 13:28:02 +08:00
* pyroscope.java: decouple archive extraction from the profiler, remove Profiler(use Distribution).
* playground
* fix args
* cleanup
* todo
* review fix
* review fixes
* pyroscope.java: add integration tests (#4454)
* pyroscope.java: add integration tests
fix package name
Revert "pyroscope.java: Fix java log level parameter (#4440)"
This reverts commit 4909877427.
move the helper to pyroscope package
* second integration test
* revert compose tests
* revert unneeded changes
* fix buildtag
* fix buildtag
* improve start time for pyroscope container
* skip integration test if it's not pyoroscope job
* update makefile
* pyroscope.java: Fix java log level parameter (#4440)
* pyroscope.java: Fix java log level parameter
The version bundled of the async profiler has no loglevel parameter:
```
ts=2025-09-16T08:16:50.898924708Z level=error component_path=/profiling.feature component_id=pyroscope.java.java_pods pid=1184752 err="failed to start: asprof failed to run: asprof failed to run /tmp/alloy-asprof-ae0261b1093f2bc4df44a87300fef98dcdebccb5/bin/asprof: exit status 1 Unrecognized option: --loglevel\n"
```
* Quiet is not a valid argument for the async-profiler cli
It can only be used for attaching using agent
* remove comments
* fix
---------
Co-authored-by: Christian Simon <simon@swine.de>
---------
Co-authored-by: Christian Simon <simon@swine.de>
65 lines
1.7 KiB
Go
65 lines
1.7 KiB
Go
package java
|
|
|
|
import (
|
|
"fmt"
|
|
"time"
|
|
|
|
"github.com/grafana/alloy/internal/component/discovery"
|
|
"github.com/grafana/alloy/internal/component/pyroscope"
|
|
)
|
|
|
|
type Arguments struct {
|
|
Targets []discovery.Target `alloy:"targets,attr"`
|
|
ForwardTo []pyroscope.Appendable `alloy:"forward_to,attr"`
|
|
|
|
TmpDir string `alloy:"tmp_dir,attr,optional"`
|
|
ProfilingConfig ProfilingConfig `alloy:"profiling_config,block,optional"`
|
|
|
|
// undocumented
|
|
Dist string `alloy:"dist,attr,optional"`
|
|
}
|
|
|
|
type ProfilingConfig struct {
|
|
Interval time.Duration `alloy:"interval,attr,optional"`
|
|
SampleRate int `alloy:"sample_rate,attr,optional"`
|
|
Alloc string `alloy:"alloc,attr,optional"`
|
|
Lock string `alloy:"lock,attr,optional"`
|
|
CPU bool `alloy:"cpu,attr,optional"`
|
|
Event string `alloy:"event,attr,optional"`
|
|
PerThread bool `alloy:"per_thread,attr,optional"`
|
|
LogLevel string `alloy:"log_level,attr,optional"`
|
|
Quiet bool `alloy:"quiet,attr,optional"`
|
|
}
|
|
|
|
func (rc *Arguments) UnmarshalAlloy(f func(interface{}) error) error {
|
|
*rc = DefaultArguments()
|
|
type config Arguments
|
|
return f((*config)(rc))
|
|
}
|
|
|
|
func (arg *Arguments) Validate() error {
|
|
switch arg.ProfilingConfig.Event {
|
|
case "itimer", "cpu", "wall":
|
|
return nil
|
|
default:
|
|
return fmt.Errorf("invalid event: '%s'. Event must be one of 'itimer', 'cpu' or 'wall'", arg.ProfilingConfig.Event)
|
|
}
|
|
}
|
|
|
|
func DefaultArguments() Arguments {
|
|
return Arguments{
|
|
TmpDir: "/tmp",
|
|
ProfilingConfig: ProfilingConfig{
|
|
Interval: 60 * time.Second,
|
|
SampleRate: 100,
|
|
Alloc: "10ms",
|
|
Lock: "512k",
|
|
CPU: true,
|
|
Event: "itimer",
|
|
PerThread: false,
|
|
LogLevel: "INFO",
|
|
Quiet: false,
|
|
},
|
|
}
|
|
}
|