Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can we change the configuration like sampling duration at runtime without restarting the app? #131

Open
Nitish1210 opened this issue Nov 5, 2023 · 1 comment

Comments

@Nitish1210
Copy link

Nitish1210 commented Nov 5, 2023

Currently, we can provide the sampling duration at the time of building configuration and then we provide that configuration to PyroscopeAgent.start(config) method.

But i didn't find any method/api so that i can change the sampling duration/sampling rate after starting the agent without restarting the app.

Please let me know if we can achieve this behavior already and i have missed it or it is not possible for now with current code.

Thanks.

    PyroscopeAgent.start(
        new Config.Builder()
            .setApplicationName("app-java")
            .setProfilingEvent(EventType.ITIMER)
            .setFormat(Format.JFR)
            //pyroscope is service name
            // pyroscope-test is namespace in which pyroscope service is running and listening for profiling data
            .setServerAddress("http://pyroscope.pyroscope-test.cluster.local:4040")
            // Optionally, if authentication is enabled, specify the API key.
            // .setAuthToken(System.getenv("PYROSCOPE_AUTH_TOKEN"))
            // Optionally, if you'd like to sets allocation threshold to register events, in bytes. '0' registers all events
            // .setProfilingAlloc("0")
            .setSamplingDuration(Duration.ofSeconds(1))
            .build()
    );
@korniltsev
Copy link
Collaborator

Currently not possible. You can work around it by creating a custom ProfilingScheduler.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants