Skip to content

Commit

Permalink
Merge pull request #7 from itallorian/feature/delivery
Browse files Browse the repository at this point in the history
docs and tests
  • Loading branch information
itallonet authored Dec 18, 2023
2 parents d1351d7 + b5881d4 commit 726350f
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 60 deletions.
20 changes: 19 additions & 1 deletion .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,24 @@ on:
- master

jobs:
test:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '18'

- name: Install dependencies
run: npm install

- name: Run Tests
run: npm test

publish:
runs-on: ubuntu-latest

Expand All @@ -18,7 +36,7 @@ jobs:
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 14
node-version: 18

- name: Install dependencies
run: npm install
Expand Down
55 changes: 5 additions & 50 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,55 +1,10 @@

# New Relic Integration
![enter image description here](https://newrelic.com/themes/custom/erno/assets/mediakit/new_relic_logo_vertical.png)

This solution offers a flexible and efficient approach to integrating systems with New Relic's powerful monitoring platform via API.

## Installation

You can install the library using the following command:

```bash
npm install itallorian-newrelic
```

## **Usage Examples:**

```markdown
const irNewRelic = require('itallorian-newrelic');

// Example 1
irNewRelic.Log("Your Log Message");
# New Relic Integration [@itallorian](https://github.com/itallorian)

// Example 2
irNewRelic.Log("Your Error Log Message", irNewRelic.LogLevel.ERROR);
```

## **Detailed Documentation:**
![enter image description here](https://img.shields.io/badge/npm-CB3837?style=for-the-badge&logo=npm&logoColor=white) ![enter image description here](https://img.shields.io/badge/JavaScript-323330?style=for-the-badge&logo=javascript&logoColor=F7DF1E) ![enter image description here](https://img.shields.io/github/stars/itallorian/newrelic?style=for-the-badge)

This solution offers a flexible and efficient approach to integrating systems with New Relic's powerful monitoring platform via API.

### `Log(message, level)`

The `Log` method takes two parameters: `message` and `level`. The `message` parameter is the log message to be logged, and the `level` parameter is the log level. If no level is provided, it defaults to `LogLevel.DEBUG`.

Inside the `Log` method, a object is created with the following properties:

- `timestamp`: the current time in milliseconds since the Unix Epoch.
- `message`: the processed log message.
- `level`: the log level.
- `service`: the name of the service, taken from constants.
- `hostname`: the name of the host, taken from constants.

This object is then sent to New Relic, a real-time monitoring service.

### `LogLevel`
**LogLevel** is an object with this options.

- `DEBUG`: Used for detailed information on the flow through the system.

- `INFO`: Used to confirm that things are working as expected.

- `WARN`: Used to indicate that something unexpected happened, or there
might be a problem in the near future (e.g., 'disk space low'). The
software is still working as expected.

- `ERROR`: Used to indicate that the software has not been able to
perform some function.
Find all information on our wiki [here](https://github.com/itallorian/newrelic/wiki)
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"name": "itallorian-newrelic",
"version": "1.0.0",
"version": "1.0.1",
"description": "This solution offers a flexible and efficient approach to integrating systems with New Relic's powerful monitoring platform via API.",
"main": "program.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"test": "jest"
},
"repository": {
"type": "git",
Expand All @@ -20,7 +20,7 @@
"bugs": {
"url": "https://github.com/itallorian/newrelic/issues"
},
"homepage": "https://github.com/itallorian/newrelic#readme",
"homepage": "https://github.com/itallorian/newrelic/wiki",
"devDependencies": {
"jest": "^29.7.0",
"nock": "^13.4.0"
Expand Down
4 changes: 2 additions & 2 deletions test/services/newrelic.test.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// FILEPATH: /C:/Labs/Station/products/newrelic/test/newrelic.test.js

const nock = require('nock');
const NewRelicService = require('../src/services/newrelic');
const constants = require('../src/constants');
const NewRelicService = require('../../src/services/newrelic');
const constants = require('../../src/constants');

describe('NewRelicService', () => {
describe('request', () => {
Expand Down

0 comments on commit 726350f

Please sign in to comment.