Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Upgrade packages and update code following it #45

Merged
merged 7 commits into from
Sep 17, 2024
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions .github/workflows/test-node-js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,13 @@ 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]
env:
METRIC_SHIPPING_TOKEN: ${{ secrets.METRIC_SHIPPING_TOKEN }}
8naama marked this conversation as resolved.
Show resolved Hide resolved
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
34 changes: 25 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,12 @@ histogram.record(20), labels;
```

## Update log
**0.5.0**
- Update dependencies versions
8naama marked this conversation as resolved.
Show resolved Hide resolved
- Upgrade to OTEL packages in version `1.26.0`
- Update docs
- Drop support for Nodejs `12.*`
8naama marked this conversation as resolved.
Show resolved Hide resolved

**0.4.0**

Breaking changes:
Expand Down
Loading