Example of how to instrument your BattleSnake with New Relic, using NodeJS

Overview

Instrummenting your BattleSnake with New Relic using NodeJS

New Relic Experimental header

GitHub last commit

GitHub issues GitHub issues closed GitHub pull requests GitHub pull requests closed

Contributor Covenant Apache licensed

Deploy

Learn how to instrument your BattleSnake with New Relic using the NodeJS agent. For this repository we are using BattleSnake JavaScript starter from the BattleSnake Official.

Intrumentation

  • Create a free account at New Relic,
  • On the New Relic One home page, select the + Add more data button on the top right, and choose Node.js under App Monitoring,
  • On the next page click on Begin installation and choose how you will be installing your Node.js agent, here we are using a Package Manager,
  • Name your application,
  • On your cloned or forked repository, first change into the directory and execute the following commands in your terminal to install the agent:
 npm install newrelic --save
  • Download the custom configuration file (example here), and add it to the root of your Node.js application,
  • Add New Relic to your application's main module, pasting the following command on the first line of your app's main module:
 require('newrelic');
  • Start your application and as soon as it is running, New Relic is collecting your BattleSnake data.

Usage

Using dotenv

When you download the newrelic.js file, it will have your New Relic license key on it. To use it safely, we will work with dotenv.

  • First, install:
    npm i dotenv
  • Then in your index.js file, require and configure the package like this:
require('dotenv').config()
  • Once you have DotEnv installed and configured, make a file called .env at the root of your app, this is where you will create all of your New Relic license key environment variable:
NEW_RELIC_LICENSE_KEY={your key}
  • Now go to the newrelic.js file, copy your license key and substitute it with:
env.NEW_RELIC_LICENSE_KEY

Deploying to Heroku

You can deploy the application directly from this GitHub repository by clicking on the Deploy to Heroku button at the top of this README. Once you do that you still must set your New Relic License key in Heroku. You can either do so at the time you are initializing your application after you have the clicked the Deploy to Heroku button above, or after from within the Heroku Dashboard.

After you have clicked the above Deploy to Heroku button, you will see one option for the config vars in the Heroku deployment settings. Add your New Relic License Key before clicking the final Deploy app button. This will ensure your application is deployed to Heroku with your information.

Alternatively, you can do so from with your Heroku Dashboard's application settings by managing the config vars for your Battlesnake after deploying. You will need to add the environment variable: NEW_RELIC_LICENSE_KEY.

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.

Contributing

We encourage your contributions to improve this demo app! Keep in mind when you submit your pull request, you'll need to sign the CLA via the click-through using CLA-Assistant. You only have to sign the CLA one time per project. If you have any questions, or to execute our corporate CLA, required if your contribution is on behalf of a company, please drop us an email at [email protected].

A note about vulnerabilities

As noted in our security policy, New Relic is committed to the privacy and security of our customers and their data. We believe that providing coordinated disclosure by security researchers and engaging with the security community are important means to achieve our security goals.

If you believe you have found a security vulnerability in this project or any of New Relic's products or websites, we welcome and greatly appreciate you reporting it to New Relic through HackerOne.

License

This project is licensed under the Apache 2.0 License.

You might also like...

Today began learn about MEAN stack first with Nodejs that is a server side form of javascript. Repository for track of Day by Day improvement track in new Skill.

Today began learn about MEAN stack first with Nodejs that is a server side form of javascript. Repository for track of Day by Day improvement track in new Skill.

NodeJs Today began learn about MEAN stack first with Nodejs that is a server side form of javascript. Repository for track of Day by Day improvement t

Oct 14, 2022

CLI Progress Bar implemented in NodeJS to track Time, ETA and Steps for any long running jobs in any loops in JS, NodeJS code

CLI Progress Bar implemented in NodeJS to track Time, ETA and Steps for any long running jobs in any loops in JS, NodeJS code

NodeJS-ProgressBar CLI Progress Bar for NodeJS and JavaScript to track Time, ETA and Steps for any long running jobs in any loops in JS, NodeJS code D

Nov 14, 2022

An example web extension, using MockRTC to intercept & debug your own WebRTC traffic

An example web extension, using MockRTC to intercept & debug your own WebRTC traffic

MockRTC WebExtension Example Part of HTTP Toolkit: powerful tools for building, testing & debugging HTTP(S), WebRTC, and more This is an example web e

Oct 14, 2022

"Space Travelers' Hub" This project will lay foundations for your understanding the new features for Redux, using slice reducer and API requires with createAsyncThunk

Space Travelers' Hub Space Travelers' Hub React - Redux "Space Travelers' Hub" This project will lay foundations for your understand new features for

Mar 6, 2022

This is a full-stack exercise tracker web application built using the MERN (MongoDB, ExpressJS, ReactJS, NodeJS) stack. You can easily track your exercises with this Full-Stack Web Application.

Getting Started with Create React App This project was bootstrapped with Create React App. Available Scripts In the project directory, you can run: np

Dec 25, 2021

Feel free to create new file, don't hesitate to pull your code, the most important thing is that the file name here must match your nickname so that file does not conflict with other people.

Hacktoberfest Indonesia Apa Itu Hacktoberfest ? Hacktoberfest adalah acara tahunan yang bertujuan untuk mendorong berkontribusi kedalam ekosistem open

Dec 15, 2022

NextJS with GraphQL using type-graphl and graphql-codegen adoptable dogs example code

This is a Next.js project bootstrapped with create-next-app. Getting Started First, run the development server: npm run dev # or yarn dev Open http://

Mar 31, 2022

Example Serverless DynamoDB integration tests using Jest, TypeScript and the AWS CDK

Example Serverless DynamoDB integration tests using Jest, TypeScript and the AWS CDK

serverless dynamodb integration tests 🚀 Example Serverless DynamoDB integration tests using Jest, TypeScript and the AWS CDK Introduction How to inte

Nov 4, 2022

Solidity NFT whitelist contract example using MerkleTree.js for constructing merkle root and merkle proofs.

MerkleTree.js Solidity NFT Whitelist example Allow NFT minting only to whitelisted accounts by verifying merkle proof in Solidity contract. Merkle roo

Dec 29, 2022
Comments
  • Reviews and give feedback

    Reviews and give feedback

    Hello ben, when you have some time can you review this repo and give me some feedback on it? There are some fields note filled because I am not sure what is the right thing to use there, so all the help you can give is welcomed!

    Thank you!

    opened by pachicodes 2
Owner
New Relic Experimental
Experimental code and projects by @newrelic employees (Relics) and our community members across the globe.
New Relic Experimental
example app that creates a new player in Spotify Connect to play music from in the browse using Spotify Web Playback SDK.

Spotify Web Playback SDK Demo Requirements User must have Spotify Premium, DRM & EME supported and JavaScript enabled Web Browser. License Copyright 2

Sijey 8 Jul 20, 2022
Simple SAGA example using amqp and nodejs

Simple SAGA example using amqp and nodejs The banks works as the following the diagram: All the banks are listening their own queue on the broker. Eve

jose teodoro da silva 7 Sep 23, 2022
Example-browserstack-reporting - This repository contains an example of running Selenium tests and reporting BrowserStack test results, including full CI pipeline integration.

BrowserStack reporting and Selenium test result example This repository contains an example of running Selenium tests and reporting BrowserStack test

Testmo 1 Jan 1, 2022
Example auto-generated OpenAPI client library and an accompanying example Angular app.

To utilize this demo Head into petstore_frontend\petes_pets Run npm install Go to frontend_client_lib\out Run npm install Head back into petstore_fron

Alan Gross 1 Jan 21, 2022
A Node.js REST API example built with Express and Typescript that can be used as template for creation of new servers.

api-example-firebase-nodejs A Node.js REST API example built with Express and Typescript that can be used as template for creation of new servers. The

Rodrigo João Bertotti 5 Nov 25, 2022
This is a nodejs implementation of the python example

DOC This is a nodejs implementation of the python example provided in https://github.com/EnAccess/OpenPAYGO-Token. In case of anything please feel fre

Shadrack Lilan 2 Jan 25, 2022
Easily open daily notes and periodic notes in new pane; customize periodic notes background; quick append new line to daily notes.

Obsidian daily notes opener This plugin adds a command for opening daily notes in a new pane (so that a keyboard shortcut could be used!) and gives ex

Xiao Meng 16 Dec 26, 2022
:new:A new version of Icalingua.

Icalingua 3 新版 Icalingua。将抛弃 Electron,转向网页前端 + Node 后端(类似于原来 icalingua-bridge-oicq)的模式。 正在开发中。当前技术栈选型: oicq2 socket.io Vue3 Fastify WindiCSS rxjs Mikr

Icalingua++ 150 Dec 27, 2022
A CRUD made with NodeJS. It's a book directory where you can see the books, add new ones, update them, or even delete .

BOOK-DIRECTORY-NODEJS A CRUD made with NodeJS. It's a book directory where you can see the books, add new ones, update them, or even delete . What I u

null 6 May 18, 2022
A CRUD made with NodeJS. It's a book directory where you can see the books, add new ones, update them, or even delete .

Book-Directory-NodeJS A CRUD made with NodeJS. It's a book directory where you can see the books, add new ones, update them, or even delete . What I u

null 5 May 13, 2022