This repository contains reusable configuration to provide observability of Apigee proxies through New Relic, using W3C Trace Context distributed tracing, metrics, and logs in context.
Assumes an Apigee-X environment, but there is no reason this shouldn't work with Apigee Edge, aside from credentials.
- maven - the deployment of proxies makes use of the apigee-deploy-maven-plugin
- gcloud CLI
Update the newrelic.properties.sample properties file to provide the configuration for your environment, and rename it newrelic.properties
. Important do not commit this new file to git! (It should be ignored in .gitignore
already.)
The newrelic.properties file contains the following value:
- LICENSE_KEY: your New Relic Ingest License API key
Create, or update a property set named NewRelicPropSet
for your environment using props.sh -c or -u for create, and update respectively. Use props.sh -r to verify the property set has been created successfully. Use props.sh -d to delete the property set.
Note that in production environments you may wish to use Apigee secrets rather than property sets.
If you are using the New Relic EU region, instead of the US region, change the host endpoint values.
- For logging edit the config.json file. Use either
newrelic.syslog.nr-data.net
ornewrelic.syslog.eu.nr-data.net
depending on whether your New Relic account is hosted in the US or EU region respectively - For tracing edit the config.json file. Use either
trace-api.newrelic.com
ortrace-api.eu.newrelic.com
depending on whether your New Relic account is hosted in the US or EU region respectively
To configure the slow requests auto sample time edit the config.json file. This is the time, in milliseconds, that will initiate auto-sampling of slow proxy requests. Suggested 5000
ms (5 seconds)
Set the following environment variables:
- APIGEE_ORG: the name of your Apigee organization, e.g
silicon-shape-123456
- APIGEE_ENV: your agigee environment. The proxies can be configured per environment, e.g.
dev
If the environment variables are not set, they can alternatively be provided in the following file locations:
- props.sh
- deploy.sh for each of the proxies
The instrumentation examples in this repository make use of shared flows.
Example API proxies are contained in the examples directory. The example proxies are dependent on the following shared flows:
- nr-instrumentation-sharedflow
- nr-instrumentation-obfuscation-sharedflow
- nr-log-api-sharedflow
- nr-logging-sharedflow
- nr-metric-api-sharedflow
- nr-trace-api-sharedflow
To install the shared flows:
- Execute the deploy.sh script from within the sharedflows/src/gateway/nr-instrumentation-obfuscation-sharedflow directory.
- Execute the deploy.sh script from within the sharedflows/src/gateway/nr-instrumentation-sharedflow directory.
- Execute the deploy.sh script from within the sharedflows/src/gateway/nr-log-api-sharedflow directory.
- Execute the deploy.sh script from within the sharedflows/src/gateway/nr-logging-sharedflow directory.
- Execute the deploy.sh script from within the sharedflows/src/gateway/nr-metric-api-sharedflow directory.
- Execute the deploy.sh script from within the sharedflows/src/gateway/nr-trace-api-sharedflow directory.
To install the example flows:
- Execute the deploy.sh script from within the examples/newrelic-log directory.
- Execute the deploy.sh script from within the examples/newrelic-logging directory.
- Execute the deploy.sh script from within the examples/newrelic-metric directory.
- Execute the deploy.sh script from within the examples/newrelic-trace directory.
- Execute the deploy.sh script from within the examples/newrelic-trace-and-logging directory.
- Execute the deploy.sh script from within the examples/newrelic-trace-and-metric-and-log directory.
- Execute the deploy.sh script from within the examples/newrelic-trace-and-metric-and-log-obfuscate directory.
Terraform configuration is available to create synthetics monitors to exercise the sample API proxies. Take a look at the README.md file in the synthetics-tests directory for more information.
The distributed tracing instrumentation code here owes much to the https://github.com/sri-shetty/DT-Apigee-Proxy repository.
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.
We encourage you to bring your experiences and questions to the Explorers Hub where our community members collaborate on solutions and new ideas.
Issues and enhancement requests can be submitted in the Issues tab of this repository. Please search for and review the existing open issues before submitting a new issue.
Contributions are encouraged! If you submit an enhancement request, we'll invite you to contribute the change yourself. Please review our Contributors Guide.
Keep in mind that when you submit your pull request, you'll need to sign the CLA via the click-through using CLA-Assistant.
This project is distributed under the Apache 2 license.