Skip to content

Commit

Permalink
v0.5.0
Browse files Browse the repository at this point in the history
  • Loading branch information
8naama authored Sep 17, 2024
2 parents 8ee585d + 3baae0a commit 24f29f3
Show file tree
Hide file tree
Showing 10 changed files with 1,395 additions and 5,104 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/test-node-js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [12.x, 14.x, 16.x, 17.x]
node-version: [14.x, 16.x, 17.x, 18.x, 20.x]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
Expand Down
36 changes: 27 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ This topic includes instructions on how to send custom metrics to Logz.io from y
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 12 or higher
Node 14 or higher

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

Expand All @@ -26,7 +26,7 @@ Set the variables in the following code snippet:
| token | Your Logz.io Prometheus Metrics account token. |

```js
const MeterProvider = require('@opentelemetry/sdk-metrics-base');
const { MeterProvider, PeriodicExportingMetricReader } = require('@opentelemetry/sdk-metrics');
const sdk = require('logzio-nodejs-metrics-sdk');

const collectorOptions = {
Expand All @@ -39,9 +39,14 @@ const collectorOptions = {
const metricExporter = new sdk.RemoteWriteExporter(collectorOptions);

// Initialize the meter provider
const meter = new MeterProvider.MeterProvider({
exporter: metricExporter,
interval: 15000, // Push interval in seconds
const meter = new MeterProvider({
readers: [
new PeriodicExportingMetricReader(
{
exporter: metricExporter,
exportIntervalMillis: 1000
})
],
}).getMeter('example-exporter');

// Create your first counter metric
Expand Down Expand Up @@ -71,7 +76,7 @@ For more information, see the OpenTelemetry [documentation](https://github.com/o
First Initialize the exporter and meter provider:

```js
const MeterProvider = require('@opentelemetry/sdk-metrics-base');
const { MeterProvider, PeriodicExportingMetricReader } = require('@opentelemetry/sdk-metrics');
const sdk = require('logzio-nodejs-metrics-sdk');

const collectorOptions = {
Expand All @@ -84,9 +89,14 @@ const collectorOptions = {
const metricExporter = new sdk.RemoteWriteExporter(collectorOptions);

// Initialize the meter provider
const meter = new MeterProvider.MeterProvider({
exporter: metricExporter,
interval: 15000, // Push interval in miliseconds
const meter = new MeterProvider({
readers: [
new PeriodicExportingMetricReader(
{
exporter: metricExporter,
exportIntervalMillis: 1000
})
],
}).getMeter('example-exporter');
```

Expand Down Expand Up @@ -127,6 +137,14 @@ histogram.record(20), labels;
```

## Update log
**0.5.0**

Breaking changes:
- Update dependencies versions
- Upgrade to OTEL packages in version `1.26.0`
- Update docs
- Drop support for Nodejs `12.*`

**0.4.0**

Breaking changes:
Expand Down
Loading

0 comments on commit 24f29f3

Please sign in to comment.