For scenarios where the demo is deployed to a Kubernetes cluster via Helm, we provide a number of New Relic configurations that may be helpful. These include:
- Workloads
- Service Levels
- Alert Policies
The New Relic Terraform Provider is used to automate the creation of these entities in New Relic.
Configure environment variables by adding the following to ~/.bash_profile (if using bash shell) or ~/.zshrc (on Mac OS Catalina):
export NEW_RELIC_API_KEY="<your New Relic User API key>"
export NEW_RELIC_REGION="US"
Navigate to the newrelic-config folder then run the following command to initialize your Terrform setup:
terraform init
If you're using Terraform to apply the New Relic configuration to multiple accounts, you'll need to create a separate workspaces in Terraform to do so.
For example, to create separate workspaces for dev and staging, navigate to the newrelic-config folder then run the following command:
terraform workspace new dev
terraform workspace new staging
Then if you want to apply the configuration in the staging environment, using the following command first:
terraform workspace select staging
Navigate to the newrelic-config folder then run the following command to create the workloads, service levels, and alert policies in your account:
terraform apply -var="account_id=<YOUR ACCOUNT ID>" -var="cluster_name=otel-community-demo" -var="apm_app_name=currencyservice-apm"
Substitute the name of the Kubernetes (K8s) cluster and New Relic Account ID where your demo is running, and the name of the service which is monitored with the New Relic APM agent, rather than OpenTelemetry.
Workloads provide the ability to group and monitor a set of related entities, providing aggregated health and activity data from frontend to backend services across your entire stack.
We configure two workloads as part of the OpenTelemetry demo:
- Open Telemetry Demo - All Entities: This workload includes all entities deployed to the demo cluster.
- Open Telemetry Demo - Services: This workload includes all APM and OTel instrumented services deployed to the demo cluster.
Service Levels are used to measure the performance of a service from the end user (or client application) point of view.
We configure two service levels as part of the OpenTelemetry demo:
- AdService Service Level: This service level measures the proportion of successful requests processed by the AdService.
- CartService Service Level: This service level measures the proportion of successful requests processed by the CartService.
In New Relic, you setup alerts for your telemetry data by configuring alert conditions, which define what will constitute a violation and trigger an incident. Alert policies are then used to group one or more alert conditions.
We configure the following alert policies as part of the OpenTelemetry demo:
- OpenTelemetry Service Health: includes conditions to monitor the error rate of both APM and OTel-instrumented services.
- OpenTelemetry Infrastructure Health: includes conditions to monitor the health of the Kubernetes cluster and underlying hosts.