This repository contains many Azure Function Apps samples that demonstrate how to implement the New Relic agent within Azure Function App.
By default New Relic does not support Azure Function Apps, but it is possible to use the New Relic APM Agent in an Azure Function by using its API. This repository contains examples of how to use them in Azure Functions Apps written in Java, JavaScript and TypeScript.
In order to run the samples in this repository, you will need the following tools:
- sdkman (↗)
- nvm (↗)
- docker (↗)
- docker-compose (↗)
- Azure Functions Core Tools (↗)
- Azure CLI (↗)
- New Relic account (↗)
- Visual Studio Code (VSCode ↗) with the Azure Functions extension
The principal components of this repository are organized as follows:
.
├── scripts
├── sample-java
├── sample-javascript
├── sample-typescript@azure-functions@v3
└── sample-typescript@azure-functions@v4
scripts
: Contains scripts to automate the deployment of the Azure Functions.sample-java
: Contains a sample Azure Function written in Java.sample-javascript
: Contains a sample Azure Function written in JavaScript.sample-typescript@azure-functions@v3
: Contains a sample Azure Function written in TypeScript using @azure/functions version 3.x.y.sample-typescript@azure-functions@v4
: Contains a sample Azure Function written in TypeScript using @azure/functions version 4.x.y.
For detailed information about each sample, see the README.md
file in each
folder.
To use the samples in this repository, follow these steps:
-
Clone this repository to your local machine.
-
Open a terminal and navigate to the root of the repository.
-
Select a sample, navigate to its directory, follow the instructions in the
README.md
and meet the requirements. -
Run the sample locally to ensure that it works as expected.
-
Deploy the sample to azure using the scripts provided in the
scripts
directory. This scripts can be run using the following command:./scripts/create_resourcegroup.sh \ $resource_group_name \ $location ./scripts/create_functionapp.sh \ $project_name \ $function_app_runtime \ $function_app_runtime_version \ $resource_group_name \ $location ./scripts/configure_functionapp.sh \ $project_name \ $function_app_runtime \ $resource_group_name \ $new_relic_license_key ./scripts/publish_functionapp.sh \ $project_name \ $function_app_runtime \ $resource_group_name ./scripts/invoke_function.sh \ $project_name \ $function_name \ $resource_group_name \ $execution_times \ $execution_interval
-
Monitor the Azure Function in the New Relic dashboard.
-
Clean up the resources using the following command:
az group delete --name $resource_group_name --yes
Sugestions and contributions are welcome!
Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.
For more information, please refer to the Code of Conduct ↗.
This project is licensed under the terms of the BSD-3-Clause ↗ license.