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

Publish Jar (with embedded native agent) to Maven central #93

Open
advancedxy opened this Issue Mar 9, 2018 · 12 comments

Comments

Projects
None yet
5 participants
@advancedxy
Copy link

advancedxy commented Mar 9, 2018

Some ideas about the Java API:

  1. published to maven central, so it can be easily added as dependency in other Maven based projects.
  2. Jar contains libAsynProfiler.so(dylib) so that the jar can be used independently
  3. Java API execute() method supports 'file' argument (already committed)
@apangin

This comment has been minimized.

Copy link
Member

apangin commented Mar 9, 2018

OK, it would be nice, if someone volunteered to help with this.

@advancedxy

This comment has been minimized.

Copy link
Author

advancedxy commented Mar 10, 2018

I may help with jar packing and API in my spare time. But I have never published jars to central personally, that needs an experienced one

@incubos

This comment has been minimized.

Copy link
Collaborator

incubos commented Mar 10, 2018

I can do the publishing part.

@advancedxy

This comment has been minimized.

Copy link
Author

advancedxy commented Mar 20, 2018

Some other issues popped during my experience with async-profiler, one feature I hope Java API has:
ability to specify dumped file path in API.
The rationale is that sometimes we want to defer the start of profiler: after loading other native library by calling System.load or similar, so the native library's symbol can be identified correctly. Then the profiler output can be dumped at the JVM exit. However it's impossible for Java API to specify an output file.

@apangin what do you think? If this seems ok. I will try to send a PR. And Let's keep this issue open for a while

@apangin

This comment has been minimized.

Copy link
Member

apangin commented Mar 20, 2018

Java API returns profiling data as a String, then you do whatever you want with this String: write to a file etc.
Shutdown Hook can be used to stop profiler before VM exit.

@advancedxy

This comment has been minimized.

Copy link
Author

advancedxy commented Mar 20, 2018

Java API returns profiling data as a String, then you do whatever you want with this String: write to a file etc.

Yeah, I know, but that requires wrapper code to flush the output into file. If we can flush output to file, the execute API can be used as same as Java Agent(or Attach)'s options.

apangin added a commit that referenced this issue Mar 21, 2018

@apangin

This comment has been minimized.

Copy link
Member

apangin commented Mar 21, 2018

OK. Now if execute(command) contains file= option, the output will be dumped directly to the given file.

@advancedxy

This comment has been minimized.

Copy link
Author

advancedxy commented Mar 21, 2018

OK. Now if execute(command) contains file= option, the output will be dumped directly to the given file.

Thanks, it works as expected after I check the master branch.

However my old approach was persisting execute's argument into vmEntry's internal _agent_args: so it's dumped automatically at JVM exit.

@apangin

This comment has been minimized.

Copy link
Member

apangin commented Mar 21, 2018

I would argue that Java API should not modify global arguments designed primarily for the agent loaded at start-up. At Java level an application can still use Java mechanisms such as Shutdown Hook.

@advancedxy

This comment has been minimized.

Copy link
Author

advancedxy commented Mar 21, 2018

I would argue that Java API should not modify global arguments designed primarily for the agent loaded at start-up. At Java level an application can still use Java mechanisms such as Shutdown Hook.

Yeah, that's a fair point. It's ugly to modify _agent_args. User can register a shutdown hook, however it would be more convenient if provided(or handled) by the Java API. I am still thinking other possible approaches.

@advancedxy advancedxy changed the title Consider publish to maven central? Possible Java API improvements Mar 21, 2018

@jesperpedersen

This comment has been minimized.

Copy link

jesperpedersen commented Mar 23, 2018

Adding

public static final String EVENT_CPU   = "cpu";
public static final String EVENT_ALLOC = "alloc";
public static final String EVENT_LOCK  = "lock";

to AsyncProfiler.java would make the event parameter for start() more clear.

@apangin

This comment has been minimized.

Copy link
Member

apangin commented Mar 23, 2018

apangin added a commit that referenced this issue Mar 27, 2018

@nitsanw nitsanw added the enhancement label Apr 3, 2018

@nitsanw nitsanw changed the title Possible Java API improvements Publish Jar (with embedded native agent) to Maven central Apr 3, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.