- 
                Notifications
    You must be signed in to change notification settings 
- Fork 3
Description
Description
I am unable to get either Logz.io, nor Prometheus, to recieve more than the intial batch of metrics.
If I use the Prometheus exporter (@opentelemetry/exporter-prometheus), metrics appear fine in Prometheus.
Expected Result
Using the RemoteWriteExporter exports all metrics to Logz.io.
Actual Result
Using the RemoteWriteExporter only exports the first record batch of metrics to Logz.io. After the first export from PeriodicExportingMetricReader, no new metrics appear in Logz.io.
How can we reproduce it?
I am using NestJS, and here is how I have things configured. I don't think the issue is this setup, because if I swap PeriodicExportingMetricReader  for PrometheusExporter and scrape metrics with Prometheus, they are collected correctly.
import { Injectable } from "@nestjs/common";
import { Counter, Histogram, Meter } from "@opentelemetry/api";
import { PeriodicExportingMetricReader, ConsoleMetricExporter, MeterProvider } from "@opentelemetry/sdk-metrics";
import { RemoteWriteExporter } from "logzio-nodejs-metrics-sdk";
import { PrometheusExporter } from '@opentelemetry/exporter-prometheus';
@Injectable()
export class MetricsService {
  private _meter: Meter;
  private _meterProvider: MeterProvider;
  private _counterMetrics: Record<string, Counter> = {};
  constructor(private readonly logger: LoggingService) {
    this._meterProvider = new MeterProvider({
      readers: [
        new PeriodicExportingMetricReader({
          exporter: new RemoteWriteExporter({
            url: "https://listener.logz.io:8053",
            // url: "http://localhost:9090/api/v1/write",  // local Prometheus
            headers: {
              Authorization: `Bearer ${Configuration.logzIoMetricsToken}`
            }
          }),
          exportIntervalMillis: 5000
        })
      ]
    });
    this._meter = this._meterProvider.getMeter("metrics");
  }
  registerMetrics(...metrics: MetricDescription[]) {
    for (const metric of metrics) {
      if (metric.type === "counter") {
        this._counterMetrics[metric.name] = this._meter.createCounter(metric.name, {
          description: metric.description
        });
      }
    }
  }
  increment(counterName: string, labels: Record<string, string>) {
    const counter = this._counterMetrics[counterName];
    counter.add(1, labels);
  }
}Log output
Server started
10:48:11     INFO  [Server] Server started - Listening @ http://localhost:3003  apiV:  0.1.0
Send metrics fires, no metrics to send
[2025-07-15T09:48:12.183Z][info] - No timeseries to send
Three calls to an endpoint that handles metrics
10:48:13     INFO  [LoggingMiddleware]  Handled request
10:48:13     INFO  [LoggingMiddleware]  Handled request
10:48:13     INFO  [LoggingMiddleware]  Handled request
Metrics sent
[2025-07-15T09:48:14.180Z][info] - Sending bulk of 4 timeseries
[2025-07-15T09:48:14.546Z][info] - Export Succeeded after 1 attempts. Status code: 200
Another export
[2025-07-15T09:48:14.180Z][info] - Sending bulk of 4 timeseries
[2025-07-15T09:48:14.546Z][info] - Export Succeeded after 1 attempts. Status code: 200
Two more calls the endpoint
10:48:13     INFO  [LoggingMiddleware]  Handled request
10:48:13     INFO  [LoggingMiddleware]  Handled request
Another export, but the above calls never show
[2025-07-15T09:48:14.180Z][info] - Sending bulk of 4 timeseries
[2025-07-15T09:48:14.546Z][info] - Export Succeeded after 1 attempts. Status code: 200
In Prometheus you can see the count stay at 3
 
Environment
OS: MacOS Sequoia 15.5 - Darwin Kernel Version 24.5.0
Version: 0.5.0
@opentelemetry/api: 1.9.0
@opentelemetry/sdk-metrics: 1.26.0
logzio-nodejs-metrics-sdk: 0.5.0