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

Dynamic labels not working #93

Closed
valodzka opened this issue Apr 24, 2023 · 5 comments
Closed

Dynamic labels not working #93

valodzka opened this issue Apr 24, 2023 · 5 comments

Comments

@valodzka
Copy link

As of agent 0.11.3, this code adds label region=test but now unit=test:

    public static void main(String[] args) {
        Pyroscope.setStaticLabels(Map.of("region", "test"));

        for (int i = 0; i < 2; ++i) {
            Pyroscope.LabelsWrapper.run(new LabelsSet(Map.of("unit", "test")), () -> {
                try {
                    Thread.sleep(5_000);
                } catch (InterruptedException e) {
                    throw new RuntimeException(e);
                }
            });
        }
    }

image

@korniltsev
Copy link
Collaborator

Can you try replacing Thread.sleep with something burning cpu?
What is your configuration?

@valodzka
Copy link
Author

Can you try replacing Thread.sleep with something burning cpu?

I will try to test it.

What is your configuration?
Mac OS M2, JDK 17.0.6, run with -javaagent:agent.jar
PYROSCOPE_APPLICATION_NAME=test
PYROSCOPE_SERVER_ADDRESS=http://127.0.0.1:3150

@valodzka
Copy link
Author

I will try to test it.

Same result with this code:

        Pyroscope.setStaticLabels(Map.of("region", "test44"));
        Random rnd = new Random();

        for (int i = 0; i < 2; ++i) {
            Pyroscope.LabelsWrapper.run(new LabelsSet(Map.of("unit", "test")), () -> {
                for (int j = 0; j < 1000_000_000; ++j) {
                    if (rnd.nextInt() % 1_000_000_000 == 1)
                        System.out.println("y");
                }
            });
        }

@korniltsev
Copy link
Collaborator

by default it uses collapsed format, labels are supported only with JFR format

@valodzka
Copy link
Author

yes, can confirm, with JFR it's working

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