Follow the below steps to bootstrap any new shared profile :
- Create the shared profile
- Adapt your build
- Test it with the Jeyzer Analyzer
- Deploy it to a repository
All steps are detailed hereafter.
Versioning
Shared profiles can be versioned.
See the Versioning section for more details.
Shared profile template
In every Jeyzer installation, a shared template profile is made available in the profiles/external/shared/template
directory.
It contains two files : the template_patterns.xml
and the template_rules.xml.
Feel free to re-use it.
Shared profile creation
- Copy the shared template directory under any local shared profile root directory
- Rename the template directory to the desired profile name
- In the new profile directory, rename all the files by replacing the template prefix with the desired profile name.
For the automatic profile loading, use theartefactId
of your project as profile name. - Edit the
<new shared profile>_patterns.xml
:- Set the
name
with the desired profile name. - Set the
version
to blank or adapt it to your versioning needs. - Add any dummy analysis pattern for testing (if you want to achieve the annotations phase at later stage).
- Set the
- Edit the
<new shared profile>_rules.xml
:- Set the
group_name
with the desired group name. - Add any stickers if necessary
- Add any important rule : follow these guidelines.
- Set the
- If you need to add static conditions on the previous rules, edit the
<new shared profile>_stickers.xml
.
You should mainly use process jar version stickers or process module version stickers in this context.
Adapt your build
Adapt your build to get the analysis patterns – issued from the annotations – injected automatically in the shared profile you created.
As prerequisite, you must use the Jeyzer annotations in your code.
See the Annotations section for more details.
For a Maven based build, you must use the Maven Jeyzer profile updater plugin : follow the setup instructions in the related section.
For a Gradle based build, you must use the Gradle Jeyzer profile updater plugin : follow the setup instructions in the related section.
For the automatic profile loading, you can add the Jeyzer-Repository attribute as part of the Manifest of the built jar file.
Testing
In the master profile that references this shared profile, add a profile dependency in the analysis file (<master profile>_analysis.xml
) :
<patterns> <pattern_set file="${JEYZER_BASE_SHARED_PROFILES_DIR}/<new shared profile
>/analysis/<new shared profile
>_patterns.xml"> ... </patterns>
Use any path of your choice if it’s temporary.
The above example assumes we put it in the local repository.
Start the Jeyzer Web Analyzer and perform any analysis.
To guarantee the matching, perform an endless wait or sleep call in a method of your library and add a fake operation annotation on that method : you must see it in the JZR report, for example in the Histogram sheets.
Deployment
This step is required if your shared profile is used elsewhere in your company.
If not the case, you could stay with the local repository which could be a location shared with other developers.
Once the shared profile is ready, adapt your build to push it on the profile repository.
As the repository storage is yours (could be Github, Nexus, any web server..), use the right deployment method.
Shared profiles can be accessed within the repository either through dependencies declared in the master profile or through the automatic profile loading.
Dependencies
Update the analysis profile to add this new dependency (and remove the previous temporary path) :
<dependencies> <set id="my_company-shared-deps" profiles="other_profile, my_new_shared_profile"/> </dependencies>
Automatic profile loading
Update the analysis profile to declare the automatic profile loading (and remove the previous temporary path) :
<patterns> <dynamic_pattern_sets declared_repository_only="true"/> </patterns>
Important : this must also be reflected in the monitoring rules and stickers if you decide to do so. See the automatic profile loading for more details.
Note that you will have to do it only once as automatic loading will also apply to any new shared profile required by your application.
SCM
A good practice is to store your shared profile in a SCM repository under a shared profile root directory.
If your shared profile concerns an open source project, feel free to submit it to the Jeyzer community : it would be a good candidate for the Jeyzer base repository.
Feel free also to drop a message in the community forum.