Skip to content

Reusable configuration to provide observability of Apigee proxies through New Relic, using W3C Trace Context distributed tracing, metrics, and logs in context.

License

Notifications You must be signed in to change notification settings

newrelic-experimental/nr-apigee-integration

New Relic Experimental header

nr-apigee-integration

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.

Installation

Assumes an Apigee-X environment, but there is no reason this shouldn't work with Apigee Edge, aside from credentials.

Prerequisites

Configuration properties file

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:

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.

Maven configuration

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 or newrelic.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 or trace-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 5000ms (5 seconds)

Environment variables

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

Shared flows

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:

  1. Execute the deploy.sh script from within the sharedflows/src/gateway/nr-instrumentation-obfuscation-sharedflow directory.
  2. Execute the deploy.sh script from within the sharedflows/src/gateway/nr-instrumentation-sharedflow directory.
  3. Execute the deploy.sh script from within the sharedflows/src/gateway/nr-log-api-sharedflow directory.
  4. Execute the deploy.sh script from within the sharedflows/src/gateway/nr-logging-sharedflow directory.
  5. Execute the deploy.sh script from within the sharedflows/src/gateway/nr-metric-api-sharedflow directory.
  6. Execute the deploy.sh script from within the sharedflows/src/gateway/nr-trace-api-sharedflow directory.

Example flow

To install the example flows:

  1. Execute the deploy.sh script from within the examples/newrelic-log directory.
  2. Execute the deploy.sh script from within the examples/newrelic-logging directory.
  3. Execute the deploy.sh script from within the examples/newrelic-metric directory.
  4. Execute the deploy.sh script from within the examples/newrelic-trace directory.
  5. Execute the deploy.sh script from within the examples/newrelic-trace-and-logging directory.
  6. Execute the deploy.sh script from within the examples/newrelic-trace-and-metric-and-log directory.
  7. Execute the deploy.sh script from within the examples/newrelic-trace-and-metric-and-log-obfuscate directory.

Synthetics tests for the example API proxies

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.

Acknowledgements

The distributed tracing instrumentation code here owes much to the https://github.com/sri-shetty/DT-Apigee-Proxy repository.

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.

We encourage you to bring your experiences and questions to the Explorers Hub where our community members collaborate on solutions and new ideas.

Issues / enhancement requests

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.

Contributing

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.

Open source license

This project is distributed under the Apache 2 license.

About

Reusable configuration to provide observability of Apigee proxies through New Relic, using W3C Trace Context distributed tracing, metrics, and logs in context.

Topics

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Packages

No packages published