diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 0000000..71eb003 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,38 @@ +--- +name: Bug report +about: Describe a scenario in which this project behaves unexpectedly +title: '' +labels: bug, needs-triage +assignees: '' + +--- + +[NOTE]: # ( ^^ Provide a general summary of the issue in the title above. ^^ ) + +## Description + +[NOTE]: # ( Describe the problem you're encountering. ) +[TIP]: # ( Do NOT give us access or passwords to your New Relic account or API keys! ) + +## Steps to Reproduce + +[NOTE]: # ( Please be as specific as possible. ) + +## Expected Behavior + +[NOTE]: # ( Tell us what you expected to happen. ) + +## Relevant Logs / Console output + +[NOTE]: # ( Please provide specifics of the local error logs, Browser Dev Tools console, etc. if appropriate and possible. ) + +## Your Environment + +[TIP]: # ( Include as many relevant details about your environment as possible. ) + +* ex: Browser name and version: +* ex: Operating System and version: + +## Additional context + +[TIP]: # ( Add any other context about the problem here. ) diff --git a/.github/ISSUE_TEMPLATE/enhancement.md b/.github/ISSUE_TEMPLATE/enhancement.md new file mode 100644 index 0000000..0907a9f --- /dev/null +++ b/.github/ISSUE_TEMPLATE/enhancement.md @@ -0,0 +1,27 @@ +--- +name: Enhancement request +about: Suggest an idea for a future version of this project +title: '' +labels: enhancement, needs-triage +assignees: '' + +--- + +[NOTE]: # ( ^^ Provide a general summary of the request in the title above. ^^ ) + +## Summary + +[NOTE]: # ( Provide a brief overview of what the new feature is all about. ) + +## Desired Behavior + +[NOTE]: # ( Tell us how the new feature should work. Be specific. ) +[TIP]: # ( Do NOT give us access or passwords to your New Relic account or API keys! ) + +## Possible Solution + +[NOTE]: # ( Not required. Suggest how to implement the addition or change. ) + +## Additional context + +[TIP]: # ( Why does this feature matter to you? What unique circumstances do you have? ) diff --git a/.github/workflows/CHANGELOG.tpl.md b/.github/workflows/CHANGELOG.tpl.md new file mode 100644 index 0000000..d8f4f1e --- /dev/null +++ b/.github/workflows/CHANGELOG.tpl.md @@ -0,0 +1,3 @@ + +{{.SECTION}}### $title{{.SECTION}} +{{.COMMITS}}- $commit{{.COMMITS}} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..a0f5a50 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,216 @@ +name: Build and Release (Manual Run) v1.3 + +on: + workflow_dispatch: # This event allows manual triggering + +jobs: + build-and-release: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + + - name: Set up JDK 8 + uses: actions/setup-java@v3 + with: + java-version: 8 + distribution: 'temurin' + + + - name: Set Extensions Dir + id: set_ext_dir + run: | + echo "Setting Extensions Dir..." + mkdir ${HOME}/release + mkdir /tmp/to + echo "NEW_RELIC_EXTENSIONS_DIR=${HOME}/release" >> $GITHUB_ENV + + - name: Build with Gradle and verifyInstrumentation + run: | + . ./newrelic-dependencies.sh + ./gradlew clean build install verifyInstrumentation + + - name: Identify Release Type + id: define_release_type + run: | + echo "Generating changelog to check type of release..." + old_tag=$(git describe --abbrev=0 --tags 2>/dev/null) || true + if [[ -n "$old_tag" ]]; then + changelog=$(git log --pretty=format:"- %s (%h)" $old_tag..HEAD) + fi + if echo "$changelog" | grep -iqE '\bBREAKING CHANGE\b'; then + echo "RELEASE_TYPE=major" >> $GITHUB_ENV + elif echo "$changelog" | grep -iqE '\bfeat\b'; then + echo "RELEASE_TYPE=minor" >> $GITHUB_ENV + else + echo "RELEASE_TYPE=patch" >> $GITHUB_ENV + fi + + - name: Set release version + id: set_release_version + run: | + major_version=1 + minor_version=0 + patch_revision=0 + + # Retrieve the latest release tag + latest_tag=$(git describe --abbrev=0 --tags 2>/dev/null) || true + echo "LATEST_TAG=${latest_tag}" >> $GITHUB_ENV + + if [[ -n "$latest_tag" && $latest_tag == v* ]]; then + # Extract the major and minor versions from the latest tag + current_major_version=$(echo $latest_tag | cut -d'.' -f1 | sed 's/v//') + current_minor_version=$(echo $latest_tag | cut -d'.' -f2) + current_patch_revision=$(echo $latest_tag | cut -d'.' -f3) + + if [ "${{ env.RELEASE_TYPE }}" = "major" ]; then + major_version=$((current_major_version +1 )) + elif [ "${{ env.RELEASE_TYPE }}" = "minor" ]; then + minor_version=$((current_minor_version + 1)) + major_version=$((current_major_version)) + else + patch_revision=$((current_patch_revision + 1)) + minor_version=$((current_minor_version)) + major_version=$((current_major_version)) + fi + + fi + + # Set the release version environment variable + release_version="v${major_version}.${minor_version}.${patch_revision}" + echo "RELEASE_VERSION=${release_version}" >> $GITHUB_ENV + + - name: Set Tag + id: set_tag + run: echo "::set-output name=tag::${{ env.RELEASE_VERSION }}" + + - name: Set release name + id: set_release_name + run: | + repo_name="${{ github.repository }}" + sanitized_repo_name=$(echo "$repo_name" | awk -F 'newrelic-java-' '{print $2}') + echo "RELEASE_NAME=${sanitized_repo_name}-instrumentation-" >> $GITHUB_ENV + previous_tag=$(git describe --abbrev=0 --tags HEAD^ 2>/dev/null || git rev-list --max-parents=0 HEAD) + + - name: Create Archive + run: | + echo "CURRENT=${PWD}" >> $GITHUB_ENV + cd ${HOME}/release + zip -r /tmp/to/${{ env.RELEASE_NAME}}${{ steps.set_tag.outputs.tag }}.zip *.jar + cd ${{env.CURRENT}} + + + + - name: Create Release + id: create_release + uses: actions/github-script@v6 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + script: | + try { + var changelog = ``; + var tag = '' + `${{ steps.set_tag.outputs.tag }}`; + const archivePath = '/tmp/to/${{ env.RELEASE_NAME}}${{ steps.set_tag.outputs.tag }}.zip'; + var response = await github.rest.repos.createRelease({ + draft:false, + generate_release_notes:true, + name:tag, + owner:context.repo.owner, + prerelease:false, + repo:context.repo.repo, + tag_name:tag, + body:changelog + }); + + core.exportVariable('RELEASE_ID', response.data.id); + core.exportVariable('RELEASE_URL', response.data.html_url); + core.exportVariable('RELEASE_UPLOAD_URL', response.data.upload_url); + } catch (error) { + core.setFailed(error.message); + } + - name: Upload Release Artifacts + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + asset_path: /tmp/to/${{ env.RELEASE_NAME}}${{ steps.set_tag.outputs.tag }}.zip + asset_name: ${{ env.RELEASE_NAME}}${{ steps.set_tag.outputs.tag }}.zip + upload_url: ${{ env.RELEASE_UPLOAD_URL }} + asset_content_type: application/zip + + - name: "Generate release changelog" + id: github_changelog + uses: Helmisek/conventional-changelog-generator@v1.0.6-release + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + commit-types: "fix:Bug Fixes,feat:Features,doc:Documentation,build:Build Upgrades,BREAKING CHANGE:Enhancements" + template-path: ".github/workflows/CHANGELOG.tpl.md" + + + - name: update CHANGELOG.md + run: | + # Content to add at the top + # Get the current date in YYYY-MM-DD format + release_date=$(date +"%Y-%m-%d") + version="## Version: [${{env.RELEASE_VERSION}}](${{ env.RELEASE_URL }}) | Created: $release_date" + content="$version${{steps.github_changelog.outputs.changelog}}" + + # Existing file + file="CHANGELOG.md" + + # Create a temporary file with the content at the top and existing content below + + echo "$content" > temp_file.txt + cat "$file" >> temp_file.txt + + # Overwrite the original file with the updated content + mv temp_file.txt "$file" + + # Commit the updated CHANGELOG.md file + git add CHANGELOG.md + git config --local user.email "action@github.com" + git config --local user.name "GitHub Action" + git commit -m "Update Changelog for Release [skip ci]" + + # Push the changes to the remote repository + git push --quiet --set-upstream origin HEAD + + - name: Get Compare URL + run: | + compare=$(echo ${{ env.RELEASE_URL }} | sed 's/releases\/tag.*/compare/') + compareurl=$(echo "\nFull Changelog: ($compare/${{ env.LATEST_TAG }}...${{ steps.set_tag.outputs.tag }})") + echo "COMPAREURL=${compareurl}" >> $GITHUB_ENV + + - name: Update Release + id: update_release + uses: actions/github-script@v6 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + script: | + try { + + + var changelog = `${{steps.github_changelog.outputs.changelog}}` + `${{env.COMPAREURL}}` ; + var release_id = `${{env.RELEASE_ID}}`; + var tag = '' + `${{ steps.set_tag.outputs.tag }}`; + const archivePath = '/tmp/to/${{ env.RELEASE_NAME}}${{ steps.set_tag.outputs.tag }}.zip'; + var _response = await github.rest.repos.updateRelease({ + draft:false, + generate_release_notes:true, + owner:context.repo.owner, + repo: context.repo.repo, + prerelease:false, + release_id:release_id, + body:changelog + }); + + core.exportVariable('RELEASE_ID', _response.data.id); + core.exportVariable('RELEASE_URL', _response.data.html_url); + core.exportVariable('RELEASE_UPLOAD_URL', _response.data.upload_url); + } catch (error) { + core.setFailed(error.message); + } diff --git a/.github/workflows/repolinter.yml b/.github/workflows/repolinter.yml new file mode 100644 index 0000000..063e748 --- /dev/null +++ b/.github/workflows/repolinter.yml @@ -0,0 +1,31 @@ +# NOTE: This file should always be named `repolinter.yml` to allow +# workflow_dispatch to work properly +name: Repolinter Action + +# NOTE: This workflow will ONLY check the default branch! +# Currently there is no elegant way to specify the default +# branch in the event filtering, so branches are instead +# filtered in the "Test Default Branch" step. +on: [push, workflow_dispatch] + +jobs: + repolint: + name: Run Repolinter + runs-on: ubuntu-latest + steps: + - name: Test Default Branch + id: default-branch + uses: actions/github-script@v2 + with: + script: | + const data = await github.repos.get(context.repo) + return data.data && data.data.default_branch === context.ref.split('/').slice(-1)[0] + - name: Checkout Self + if: ${{ steps.default-branch.outputs.result == 'true' }} + uses: actions/checkout@v2 + - name: Run Repolinter + if: ${{ steps.default-branch.outputs.result == 'true' }} + uses: newrelic/repolinter-action@v1 + with: + config_url: https://raw.githubusercontent.com/newrelic/.github/main/repolinter-rulesets/new-relic-experimental.yml + output_type: issue diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..3589ff9 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +.java-version +.git +.github diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..d5bd6d6 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,8 @@ +## Installation + +To install: + +1. Download the latest release jar files. +2. In the New Relic Java directory (the one containing newrelic.jar), create a directory named extensions if it does not already exist. +3. Copy the downloaded jars into the extensions directory. +4. Restart the application. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..e16db55 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,30 @@ +# Contributing + +Contributions are always welcome. Before contributing please read the +[code of conduct](./CODE_OF_CONDUCT.md) and [search the issue tracker](issues); your issue may have already been discussed or fixed in `main`. To contribute, +[fork](https://help.github.com/articles/fork-a-repo/) this repository, commit your changes, and [send a Pull Request](https://help.github.com/articles/using-pull-requests/). + +Note that our [code of conduct](./CODE_OF_CONDUCT.md) applies to all platforms and venues related to this project; please follow it in all your interactions with the project and its participants. + +## Feature Requests + +Feature requests should be submitted in the [Issue tracker](../../issues), with a description of the expected behavior & use case, where they’ll remain closed until sufficient interest, [e.g. :+1: reactions](https://help.github.com/articles/about-discussions-in-issues-and-pull-requests/), has been [shown by the community](../../issues?q=label%3A%22votes+needed%22+sort%3Areactions-%2B1-desc). +Before submitting an Issue, please search for similar ones in the +[closed issues](../../issues?q=is%3Aissue+is%3Aclosed+label%3Aenhancement). + +## Pull Requests + +1. Ensure any install or build dependencies are removed before the end of the layer when doing a build. +2. Increase the version numbers in any examples files and the README.md to the new version that this Pull Request would represent. The versioning scheme we use is [SemVer](http://semver.org/). +3. You may merge the Pull Request in once you have the sign-off of two other developers, or if you do not have permission to do that, you may request the second reviewer to merge it for you. + +## Contributor License Agreement + +Keep in mind that when you submit your Pull Request, you'll need to sign the CLA via the click-through using CLA-Assistant. If you'd like to execute our corporate CLA, or if you have any questions, please drop us an email at opensource@newrelic.com. + +For more information about CLAs, please check out Alex Russell’s excellent post, +[“Why Do I Need to Sign This?”](https://infrequently.org/2008/06/why-do-i-need-to-sign-this/). + +## Slack + +We host a public Slack with a dedicated channel for contributors and maintainers of open source projects hosted by New Relic. If you are contributing to this project, you're welcome to request access to the #oss-contributors channel in the newrelicusers.slack.com workspace. To request access, see https://newrelicusers-signup.herokuapp.com/. diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..261eeb9 --- /dev/null +++ b/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/README.md b/README.md new file mode 100644 index 0000000..784103b --- /dev/null +++ b/README.md @@ -0,0 +1,87 @@ +New Relic Open Source experimental project banner. + + +![GitHub forks](https://img.shields.io/github/forks/newrelic-experimental/java-instrumentation-template?style=social) +![GitHub stars](https://img.shields.io/github/stars/newrelic-experimental/java-instrumentation-template?style=social) +![GitHub watchers](https://img.shields.io/github/watchers/newrelic-experimental/java-instrumentation-template?style=social) + +![GitHub all releases](https://img.shields.io/github/downloads/newrelic-experimental/java-instrumentation-template/total) +![GitHub release (latest by date)](https://img.shields.io/github/v/release/newrelic-experimental/java-instrumentation-template) +![GitHub last commit](https://img.shields.io/github/last-commit/newrelic-experimental/java-instrumentation-template) +![GitHub Release Date](https://img.shields.io/github/release-date/newrelic-experimental/java-instrumentation-template) + + +![GitHub issues](https://img.shields.io/github/issues/newrelic-experimental/java-instrumentation-template) +![GitHub issues closed](https://img.shields.io/github/issues-closed/newrelic-experimental/java-instrumentation-template) +![GitHub pull requests](https://img.shields.io/github/issues-pr/newrelic-experimental/java-instrumentation-template) +![GitHub pull requests closed](https://img.shields.io/github/issues-pr-closed/newrelic-experimental/java-instrumentation-template) + + +# [Project Name - use format "newrelic-java-"] [build badges go here when available] + +>[Brief description - what is the project and value does it provide? How often should users expect to get releases? How is versioning set up? Where does this project want to go?] + +## Value + +|Metrics | Events | Logs | Traces | Visualization | Automation | +|:-:|:-:|:-:|:-:|:-:|:-:| +|:x:|:x:|:x:|:white_check_mark:|:x:|:x:| + +### List of Metrics,Events,Logs,Traces +|Name | Type | Description | +|:-:|:-:|:-:| +|*metric.name* | Metric| *description*| +|*event.name* | Event| *description*| +|*log.name* | Log| *description*| +|*trace.name*| Trace| *description* +|---|---|---| + + +## Installation + +> [Include a step-by-step procedure on how to get your code installed. Be sure to include any third-party dependencies that need to be installed separately] + +## Getting Started + +>[Simple steps to start working with the software similar to a "Hello World"] + +## Usage + +>[**Optional** - Include more thorough instructions on how to use the software. This section might not be needed if the Getting Started section is enough. Remove this section if it's not needed.] + +## Building + +>[**Optional** - Include this section if users will need to follow specific instructions to build the software from source. Be sure to include any third party build dependencies that need to be installed separately. Remove this section if it's not needed.] + +## Testing + +>[**Optional** - Include instructions on how to run tests if we include tests with the codebase. Remove this section if it's not needed.] + +## Support + +New Relic has open-sourced this project. This project is provided AS-IS WITHOUT WARRANTY OR DEDICATED SUPPORT. Issues and contributions should be reported to the project here on GitHub. + +>[Choose 1 of the 2 options below for Support details, and remove the other one.] + +>[Option 1 - no specific thread in Community] +>We encourage you to bring your experiences and questions to the [Explorers Hub](https://discuss.newrelic.com) where our community members collaborate on solutions and new ideas. + +>[Option 2 - thread in Community] +>New Relic hosts and moderates an online forum where customers can interact with New Relic employees as well as other customers to get help and share best practices. Like all official New Relic open source projects, there's a related Community topic in the New Relic Explorers Hub. +>You can find this project's topic/threads here: [URL for Community thread] + +## Contributing + +We encourage your contributions to improve [Project Name]! Keep in mind when you submit your pull request, you'll need to sign the CLA via the click-through using CLA-Assistant. You only have to sign the CLA one time per project. If you have any questions, or to execute our corporate CLA, required if your contribution is on behalf of a company, please drop us an email at opensource@newrelic.com. + +**A note about vulnerabilities** + +As noted in our [security policy](../../security/policy), New Relic is committed to the privacy and security of our customers and their data. We believe that providing coordinated disclosure by security researchers and engaging with the security community are important means to achieve our security goals. + +If you believe you have found a security vulnerability in this project or any of New Relic's products or websites, we welcome and greatly appreciate you reporting it to New Relic through [HackerOne](https://hackerone.com/newrelic). + +## License + +[Project Name] is licensed under the [Apache 2.0](http://apache.org/licenses/LICENSE-2.0.txt) License. + +>[If applicable: [Project Name] also uses source code from third-party libraries. You can find full details on which libraries are used and the terms under which they are licensed in the third-party notices document.] diff --git a/build.gradle b/build.gradle new file mode 100644 index 0000000..e930f0b --- /dev/null +++ b/build.gradle @@ -0,0 +1,204 @@ +// Build.gradle for creating or installing new instrumentation modules + + +// Global defaults - override here or in individual modules as needed. +buildscript { + repositories { + flatDir dirs: 'template-lib' + mavenLocal() + mavenCentral() + gradlePluginPortal() + } + + dependencies { + classpath 'gradle-templates:gradle-templates:1.5' + classpath 'com.newrelic.agent.java:gradle-verify-instrumentation-plugin:3.2' + } +} + +plugins { + id "de.undercouch.download" version "1.2" +} + +project.ext { + group = 'com.newrelic.instrumentation.labs' + javaAgentVersion = '6.4.0' + + // Aligned with minimum Java major version supported by latest Java Agent + javaVersion = JavaVersion.VERSION_1_8 + +} + +apply plugin: 'java' +apply plugin: 'de.undercouch.download' + +import templates.* +import de.undercouch.gradle.tasks.download.Download + +task getAgent(type: Download) { + def rootProject = projectDir.path + src 'https://repo1.maven.org/maven2/com/newrelic/agent/java/newrelic-agent/'+project.javaAgentVersion+'/newrelic-agent-'+project.javaAgentVersion+'.jar' + dest projectDir.path+"/libs/newrelic-agent-"+project.javaAgentVersion+".jar" +} + +task extractJars(type: Copy) { + + from zipTree(projectDir.path+"/libs/newrelic-agent-"+project.javaAgentVersion+".jar") + into projectDir.path+"/libs" +} + +task cleanUp(type: Delete) { + delete projectDir.path+'/libs/META-INF', projectDir.path+'/libs/com', projectDir.path+'/libs/mozilla' + delete projectDir.path+'/libs/LICENSE', projectDir.path+'/libs/Log4j-events.dtd', projectDir.path+'/libs/THIRD_PARTY_NOTICES.md' + delete fileTree(projectDir.path+'/libs') { + include '**/*.xsd' + include '**/*.xml' + include '**/*.yml' + include '**/*.properties' + } +} + +task checkForDependencies(type: Exec) { + environment "JAVAAGENTVERSION", javaAgentVersion + def rootProject = projectDir.path + def cmdLine = rootProject+'/newrelic-dependencies.sh' + workingDir rootProject + commandLine cmdLine + +} + +task buildIfNeeded { + dependsOn checkForDependencies + dependsOn jar + tasks.findByName('jar').mustRunAfter 'checkForDependencies' +} + +task createModule { + dependsOn checkForDependencies + description = 'Generate project files for a new instrumentation module' + group = 'New Relic' + doLast { + + def rootProject = projectDir.path + + String projectGroup = TemplatesPlugin.prompt('Instrumentation Module Group (default: ' + project.ext.group + ') (Hit return to use default):\n') + String projectName = TemplatesPlugin.prompt('Instrumentation Module Name:\n') + + if (projectName == null) { + throw new Exception("Please specify a valid module name.") + } else { + projectName = projectName.trim() + } + + if (projectGroup == null || projectGroup.trim() == '') { + projectGroup = project.ext.group + } else { + projectGroup = projectGroup.trim() + } + + def projectLibDir = new File(rootProject+'/lib') + + def projectPath = new File(projectName) + if (projectPath.exists()) { + throw new Exception(projectPath.path + ' already exists.') + } + + def projectJava = new File(projectPath, 'src/main/java') + def projectTest = new File(projectPath, 'src/test/java') + mkdir projectJava + mkdir projectTest + + ProjectTemplate.fromRoot(projectPath) { + 'build.gradle' ''' + // Build.gradle generated for instrumentation module PROJECT_NAME + + apply plugin: 'java' + + dependencies { + // Declare a dependency on each JAR you want to instrument + // Example: + // implementation 'javax.servlet:servlet-api:2.5' + + // New Relic Java Agent dependencies + implementation 'com.newrelic.agent.java:newrelic-agent:JAVA_AGENT_VERSION' + implementation 'com.newrelic.agent.java:newrelic-api:JAVA_AGENT_VERSION' + implementation fileTree(include: ['*.jar'], dir: '../libs') + implementation fileTree(include: ['*.jar'], dir: '../test-lib') + } + + jar { + manifest { + attributes 'Implementation-Title': 'PROJECT_GROUP.PROJECT_NAME' + attributes 'Implementation-Vendor': 'New Relic Labs' + attributes 'Implementation-Vendor-Id': 'com.newrelic.labs' + attributes 'Implementation-Version': 1.0 + } + } + + verifyInstrumentation { + // Verifier plugin documentation: + // https://github.com/newrelic/newrelic-gradle-verify-instrumentation + // Example: + // passes 'javax.servlet:servlet-api:[2.2,2.5]' + // exclude 'javax.servlet:servlet-api:2.4.public_draft' + }'''.replace('PROJECT_GROUP', projectGroup) + .replace('PROJECT_NAME', projectName) + .replace('PROJECT_PATH', projectPath.path) + .replace('JAVA_AGENT_VERSION', project.ext.javaAgentVersion) + } + + File settings = new File('settings.gradle') + settings.append("include '$projectName'\n") + println "Created module in $projectPath.path." + } +} + +subprojects { + repositories { + mavenLocal() + mavenCentral() + } + + apply plugin: 'java' + apply plugin: 'eclipse' + apply plugin: 'idea' + apply plugin: 'com.newrelic.gradle-verify-instrumentation-plugin' + + sourceCompatibility = project.javaVersion + targetCompatibility = project.javaVersion + + dependencies { + testImplementation fileTree(dir: '../lib', include: "*.jar") // + project.javaAgentVersion + testImplementation 'org.nanohttpd:nanohttpd:2.3.1' + testImplementation 'com.newrelic.agent.java:newrelic-agent:' + project.javaAgentVersion + } + + task install(dependsOn: buildIfNeeded, type: Copy) { + description = 'Copies compiled jar to the NEW_RELIC_EXTENSIONS_DIR.' + group = 'New Relic' + + def extDir = System.getenv("NEW_RELIC_EXTENSIONS_DIR") ?: " " + + from jar + into extDir + } + + compileJava.doFirst { + tasks.findByName('checkForDependencies') + } + + install.doFirst { + def extDir = System.getenv("NEW_RELIC_EXTENSIONS_DIR") + if (extDir == null) { + throw new Exception("Must set NEW_RELIC_EXTENSIONS_DIR.") + } + + if (extDir.startsWith("~" + File.separator)) { + extDir = System.getProperty("user.home") + extDir.substring(1); + } + + if (!file(extDir).directory) { + throw new Exception(extDir + "NEW_RELIC_EXTENSIONS_DIR, set as '" + extDir + "'is not a valid directory.") + } + } +} diff --git a/cla.md b/cla.md new file mode 100644 index 0000000..27af9b4 --- /dev/null +++ b/cla.md @@ -0,0 +1,16 @@ +# NEW RELIC, INC. +## INDIVIDUAL CONTRIBUTOR LICENSE AGREEMENT +Thank you for your interest in contributing to the open source projects of New Relic, Inc. (“New Relic”). In order to clarify the intellectual property license granted with Contributions from any person or entity, New Relic must have a Contributor License Agreement ("Agreement") on file that has been signed by each Contributor, indicating agreement to the license terms below. This Agreement is for your protection as a Contributor as well as the protection of New Relic; it does not change your rights to use your own Contributions for any other purpose. + +You accept and agree to the following terms and conditions for Your present and future Contributions submitted to New Relic. Except for the licenses granted herein to New Relic and recipients of software distributed by New Relic, You reserve all right, title, and interest in and to Your Contributions. + +## Definitions. +1. "You" (or "Your") shall mean the copyright owner or legal entity authorized by the copyright owner that is entering into this Agreement with New Relic. For legal entities, the entity making a Contribution and all other entities that control, are controlled by, or are under common control with that entity are considered to be a single Contributor. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. +2. "Contribution" shall mean any original work of authorship, including any modifications or additions to an existing work, that is intentionally submitted by You to New Relic for inclusion in, or documentation of, any of the products managed or maintained by New Relic (the "Work"). For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to New Relic or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, New Relic for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by You as "Not a Contribution." +3. Grant of Copyright License. Subject to the terms and conditions of this Agreement, You hereby grant to New Relic and to recipients of software distributed by New Relic a perpetual, worldwide, non-exclusive, no-charge, royalty-free, transferable, irrevocable copyright license to reproduce, prepare derivative works of, publicly display, publicly perform, sublicense, and distribute Your Contributions and such derivative works. +4. Grant of Patent License. Subject to the terms and conditions of this Agreement, You hereby grant to New Relic and to recipients of software distributed by New Relic a perpetual, worldwide, non-exclusive, no-charge, royalty-free, transferable, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by You that are necessarily infringed by Your Contributions alone or by combination of Your Contribution(s) with the Work to which such Contribution(s) was submitted. If any entity institutes patent litigation against You or any other entity (including a cross-claim or counterclaim in a lawsuit) alleging that Your Contribution, or the Work to which You have contributed, constitutes direct or contributory patent infringement, then any patent licenses granted to that entity under this Agreement for that Contribution or Work shall terminate as of the date such litigation is filed. +5. You represent that You are legally entitled to grant the above licenses. If Your employer(s) has rights to intellectual property that You create that includes Your Contributions, You represent that You have received permission to make Contributions on behalf of that employer, that Your employer has waived such rights for Your Contributions to New Relic, or that Your employer has executed a separate Agreement with New Relic. +6. You represent that each of Your Contributions is Your original creation (see section 7 for submissions on behalf of others). You represent that Your Contribution submissions include complete details of any third-party license or other restriction (including, but not limited to, related patents and trademarks) of which You are personally aware and which are associated with any part of Your Contributions. +7. You are not expected to provide support for Your Contributions, except to the extent You desire to provide support. You may provide support for free, for a fee, or not at all. Unless required by applicable law or agreed to in writing, You provide Your Contributions on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON- INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. +8. Should You wish to submit work that is not Your original creation, You may submit it to New Relic separately from any Contribution, identifying the complete details of its source and of any license or other restriction (including, but not limited to, related patents, trademarks, and license agreements) of which You are personally aware, and conspicuously marking the work as "Submitted on behalf of a third-party: [named here]". +9. You agree to notify New Relic of any facts or circumstances of which You become aware that would make these representations inaccurate in any respect. diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000..62d4c05 Binary files /dev/null and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..a4f0001 --- /dev/null +++ b/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-6.4.1-bin.zip +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew new file mode 100755 index 0000000..fbd7c51 --- /dev/null +++ b/gradlew @@ -0,0 +1,185 @@ +#!/usr/bin/env sh + +# +# Copyright 2015 the original author or authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn () { + echo "$*" +} + +die () { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; + NONSTOP* ) + nonstop=true + ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin or MSYS, switch paths to Windows format before running java +if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + + JAVACMD=`cygpath --unix "$JAVACMD"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=`expr $i + 1` + done + case $i in + 0) set -- ;; + 1) set -- "$args0" ;; + 2) set -- "$args0" "$args1" ;; + 3) set -- "$args0" "$args1" "$args2" ;; + 4) set -- "$args0" "$args1" "$args2" "$args3" ;; + 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Escape application args +save () { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " +} +APP_ARGS=`save "$@"` + +# Collect all arguments for the java command, following the shell quoting and substitution rules +eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" + +exec "$JAVACMD" "$@" diff --git a/gradlew.bat b/gradlew.bat new file mode 100644 index 0000000..a9f778a --- /dev/null +++ b/gradlew.bat @@ -0,0 +1,104 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windows variants + +if not "%OS%" == "Windows_NT" goto win9xME_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/newrelic-dependencies.sh b/newrelic-dependencies.sh new file mode 100755 index 0000000..a425604 --- /dev/null +++ b/newrelic-dependencies.sh @@ -0,0 +1,53 @@ +#!/bin/bash -e + +if [ ! -d "libs" ]; +then + mkdir libs +fi + + +AGENT_DOWNLOADED="libs/newrelic-agent-*.jar" + +AGENT_BRIDGE_LIBS="libs/agent-bridge.jar" +AGENT_BRIDGE_DS_LIBS="libs/agent-bridge-datastore.jar" + +function checkForFiles { + if [ ! -f $AGENT_BRIDGE_LIBS ]; + then + getAgentBridge + fi + if [ ! -f $AGENT_BRIDGE_DS_LIBS ]; + then + getAgentBridgeDatastore + fi +} + +function downloadAgent { + ./gradlew getAgent + ./gradlew extractJars + ./gradlew cleanUp +} + +function getAgentBridge { + if [ ! -f $AGENT_DOWNLOADED ]; + then + downloadAgent + fi + if [ ! -f $AGENT_BRIDGE_LIBS ]; + then + echo "Download of Agent and extraction of Agent Bridge failed" + fi +} + +function getAgentBridgeDatastore { + if [ ! -f $AGENT_DOWNLOADED ]; + then + downloadAgent + fi + if [ ! -f $AGENT_BRIDGE_DS_LIBS ]; + then + echo "Download of Agent and extraction of Agent Bridge Datastore failed" + fi +} + +checkForFiles diff --git a/settings.gradle b/settings.gradle new file mode 100644 index 0000000..67070a5 --- /dev/null +++ b/settings.gradle @@ -0,0 +1 @@ +rootProject.name = 'java-instrumentation-template' diff --git a/template-lib/gradle-templates-1.5.jar b/template-lib/gradle-templates-1.5.jar new file mode 100644 index 0000000..4f6092f Binary files /dev/null and b/template-lib/gradle-templates-1.5.jar differ diff --git a/test-lib/instrumentation-test.jar b/test-lib/instrumentation-test.jar new file mode 100644 index 0000000..58ebe75 Binary files /dev/null and b/test-lib/instrumentation-test.jar differ