As modern production systems become more complex, so do the monitoring and notification workflows required to maintain them. These workflows are often intertwined with the requirements (and workflows) of multiple DevOps tools, which only increases complexity. Nevertheless, teams need the flexibility to send incident data to and from whatever tools they want, and the ability to attach relevant information along the way.
At AWS re:Invent 2019, we introduced New Relic Connect, a customizable system SRE and DevOps teams can use to integrate with additional notification platforms, modify webhook payloads with new attributes, and enrich webhooks with information from NRDB—New Relic’s underlying database.
In this post, we’ll explain how to use Connect with Amazon EventBridge to easily integrate New Relic Alerts with any Amazon Web Services (AWS) offering.
Modifying New Relic webhooks with New Relic Connect
Connect enhances the power and flexibility of an existing webhook’s functionality in New Relic Alerts.
You can access Connect’s functionality—including integrating with additional notification sources and enriching incidents with the output of NRQL queries—by modifying the custom payload of a New Relic webhook.
Here are a few ways to use Connect:
- Execute NRQL queries and add their output to the webhook. In the example below, adding a field to the webhook payload definition will stitch the NRDB output (the details of a transaction for the erroring application) into the final payload. Notice the use of
{{template_text}}
; other fields from the webhook payload can then be mapped into the query string.
“nrql_execution”: “SELECT * FROM Transaction WHERE appName = {{application_1}}”
- Map attributes from the webhook to make the output easier to parse in your end destination. Here, the
owner
field specified in the default webhook payload is mapped into a new field calledservice_owner
, and a newpriority
field is defined with a static value:
“map_attributes”: { “service_owner”: “{{owner}}”, “priority”: “2” }
- Send New Relic webhooks to new destinations. In this example, we add
awseventbridge
as a notification channel for new webhooks to be directed to:
“notification_channels”:[ { “type”: “awseventbridge”, “endpoint”: “<your eventbridge endpoint>” } ]
See Connect webhook payload parameters for more about required and optional parameters to include for New Relic Connect incidents.
Using New Relic Connect with Amazon EventBridge
EventBridge is a serverless event bus that allows developers to connect real-time data streams from their applications, SaaS applications, and AWS services. Connect makes it easy to hook New Relic events into AWS services via EventBridge.
Let’s look at an example use case for Connect and EventBridge. Let’s say a service in your app is an AWS Lambda function that should never time out. Here’s how to use Connect with EventBridge to prevent disruptions to your service functionality and uptime:
- Write a NRQL query to scan New Relic Logs for AWS Lambda functions timing out. For example:
Find logs where has:”aws.logGroup” “timed out”
- Configure a New Relic webhook, with Connect parameters, to send data into EventBridge. Include the NRQL query from Step 1 in the webhook payload definition.
- Write an AWS Lambda function to increase the timeout of a different function, using a placeholder Amazon Resource Name (ARN) to represent the function timing out. (Check out the AWS Lambda documentation for guidance.)
- Create an EventBridge rule, triggered by the New Relic webhook you configured in Step 2 and using the NRDB output included in its payload, to activate the Lambda function you wrote in Step 3. (See EventBridge resources for walkthroughs and examples.)
With this workflow, you’re able to prevent temporary issues from disrupting the uptime or functionality of your services that use AWS Lambda functions without requiring an SRE or developer to make changes manually.
This is just one of many use cases for Connect and EventBridge. Imagine scaling applications automatically with increased demand, responding to infrastructure anomalies, gathering more information based on custom New Relic Insights events, and more.
Ready to get started?
We’re excited to see the possibilities New Relic Connect can bring to your team! Contact your account representative for more information or get started now by filling out this quick form.
이 블로그에 표현된 견해는 저자의 견해이며 반드시 New Relic의 견해를 반영하는 것은 아닙니다. 저자가 제공하는 모든 솔루션은 환경에 따라 다르며 New Relic에서 제공하는 상용 솔루션이나 지원의 일부가 아닙니다. 이 블로그 게시물과 관련된 질문 및 지원이 필요한 경우 Explorers Hub(discuss.newrelic.com)에서만 참여하십시오. 이 블로그에는 타사 사이트의 콘텐츠에 대한 링크가 포함될 수 있습니다. 이러한 링크를 제공함으로써 New Relic은 해당 사이트에서 사용할 수 있는 정보, 보기 또는 제품을 채택, 보증, 승인 또는 보증하지 않습니다.