-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
20 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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| | ||
|
@@ -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); | ||
|
@@ -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); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters