How to use the @opentelemetry/metrics.MetricDescriptorType.GAUGE_INT64 function in @opentelemetry/metrics

To help you get started, we’ve selected a few @opentelemetry/metrics examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github open-telemetry / opentelemetry-js / packages / opentelemetry-exporter-prometheus / src / prometheus.ts View on Github external
// prom-client throws with empty description which is our default
      help: readableMetric.descriptor.description || 'description missing',
      labelNames: readableMetric.descriptor.labelKeys,
      // list of registries to register the newly created metric
      registers: [this._registry],
    };

    switch (readableMetric.descriptor.type) {
      case MetricDescriptorType.COUNTER_DOUBLE:
      case MetricDescriptorType.COUNTER_INT64:
        // there is no such thing as a non-monotonic counter in prometheus
        return readableMetric.descriptor.monotonic
          ? new Counter(metricObject)
          : new Gauge(metricObject);
      case MetricDescriptorType.GAUGE_DOUBLE:
      case MetricDescriptorType.GAUGE_INT64:
        return new Gauge(metricObject);
      default:
        // Other metric types are currently unimplemented
        return undefined;
    }
  }