Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
yotamloe committed Aug 11, 2021
1 parent 67d77d1 commit 951353c
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 6 deletions.
22 changes: 18 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,22 @@
## Logz.io nodejs metrics sdk
This topic includes instructions on how to send custom metrics to Logz.io from your Node.js application.

The included example uses the [OpenTelemetry JS SDK](https://github.com/open-telemetry/opentelemetry-js) and its based on [OpenTelemetry exporter collector proto](https://github.com/open-telemetry/opentelemetry-js/tree/main/packages/opentelemetry-exporter-collector-proto).

**Before you begin, you'll need**:
Node 8 or higher


**Note** This project works best with logzio as metrics backend, but its compatible with all backends that support `prometheuesrmotewrite` format

## Quick start

Install the package:

```
npm install [email protected]
```

Set the variables in the following code snippet:

|Environment variable|Description|
Expand All @@ -15,11 +25,13 @@ Set the variables in the following code snippet:
|token| Your Logz.io Prometheus Metrics account token. |
```js
const { MeterProvider } = require('@opentelemetry/metrics');
const { RemoteWriteMetricExporter } = require('yotam-js-metrics-test');
const { RemoteWriteMetricExporter } = require('logzio-nodejs-metrics-sdk');

const collectorOptions = {
url: '<<url>>',
token: '<<token>>',
headers: {
"Authorization":"Bearer <<token>>"
}
};
// Initialize the exporter
const metricExporter = new RemoteWriteMetricExporter(collectorOptions);
Expand Down Expand Up @@ -58,11 +70,13 @@ For more information, see the OpenTelemetry [documentation](https://github.com/o
First Initialize the exporter and meter provider:
```js
const { MeterProvider } = require('@opentelemetry/metrics');
const { RemoteWriteMetricExporter } = require('yotam-js-metrics-test');
const { RemoteWriteMetricExporter } = require('logzio-nodejs-metrics-sdk');

const collectorOptions = {
url: '<<url>>',
token: '<<token>>',
headers: {
"Authorization":"Bearer <<token>>"
}
};
// Initialize the exporter
const metricExporter = new RemoteWriteMetricExporter(collectorOptions);
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "logzio-nodejs-metrics-alpha",
"version": "0.0.2",
"name": "logzio-nodejs-metrics-sdk",
"version": "0.0.1",
"description": "Logz.io node.js metrics Exporter allows user to send collected metrics to the Logz.io using OpenTelemetry SDK ",
"main": "src/index.js",
"repository": "logzio/js-metrics",
Expand Down

0 comments on commit 951353c

Please sign in to comment.