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

Added additional details to Java integration #169

Merged
merged 5 commits into from
Apr 10, 2023

Conversation

6fears7
Copy link
Contributor

@6fears7 6fears7 commented Apr 10, 2023

To assist when utilizing frameworks such as Spring

To assist when utilizing frameworks such as Spring
@CLAassistant
Copy link

CLAassistant commented Apr 10, 2023

CLA assistant check
All committers have signed the CLA.

@@ -43,18 +44,40 @@ Add pyroscope dependency:
```kotlin
implementation("io.pyroscope:agent:${pyroscope_version}")
```
As .xml:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not think this is very useful, there are other build systems like sbt,ivy, etc, and we are not going to provide a snippet for each of them. The gradle snippet provides enough bits to be able to add it to other build systems. Also I beilieve intellij idea is able to convert it back and forth automatically when you paste a dependency to a build script.

I think there should be just one example and between gradle and maven I prefer gradle since its more concise.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@korniltsev what do you think if we do a tabgroup and over time people can update docs accordingly:
image
image

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. This should do the job

nit: in your example tab with title "maven" contains gradle example

btw here is what maven central does (which we have a link to, just above the section)
image

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And what about other build systems? Should we add them as well?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think eventually we will have other helpful community members like @6fears7 to help us add those if they feel they are necessary :)

Then add the following code to your application:
```java

import io.pyroscope.javaagent.PyroscopeAgent;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not think imports are that important. They make an example more verbose while not providing much value. Imports are also automatically added with modern smart IDE.
Although maybe we should still add imports for consistency(golang, python etc have import)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah I agree it makes it a little verbose, but let's leave this in for consistency in this case.




@PostConstruct
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why spring? What about Vaadin, Spark, Grails, Play
Framework example should not be the default one. The default one should be just plain java.
Maybe we could add a spring notice somewhere down the page, like "Hey if you use spring, you can put this initialization in PostConstruct". At the same time I am not sure it should go to PostConstruct, I am not that familiar with spring but it looks like it will be invoked somewhere in the middle of bean graph initialization, and I believe the best moment to start profiling is before the whole initialization(somewhere in main or clinit)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll default to your judgment. I do not primarily develop in Java and was going through setting up an example Spring Boot application for our Dev teams using Maven and had to spend some time working through what the docs implied vs declared and found these to be useful. I prefer exhaustive documentation that covers multiple popular frameworks, but that is a preference of mine obviously and not a standard

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this can be resolved with tabgroups see example here

I agree the default should be plain java, but I think with a tabgroup we can show the version that works with spring

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And what about other frameworks? Should we add them as well?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll create an issue for it, but definitely not as part of this pr. I think if others want to add them we will appreciate their help similar to @6fears7

@@ -0,0 +1,40 @@
export const exampleGradle = `implementation("io.pyroscope:agent:\${pyroscope_version}")`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@petethepig how do we make this variable actually substitute in here?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe out of scope for this pr though, happy to create an issue and address later if you think thats better

Copy link
Member

@Rperry2174 Rperry2174 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM -- your input on the docs is much appreciated @6fears7. We can now use this foundation to support other build systems and frameworks

Let us know if you have any other feedabck about either docs or the integration itself as you use it more!

@Rperry2174 Rperry2174 merged commit fcb60d9 into pyroscope-io:main Apr 10, 2023
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

Successfully merging this pull request may close these issues.

4 participants