prom-client icon indicating copy to clipboard operation
prom-client copied to clipboard

TS issues setting the Registry to OpenMetrics

Open bahamut657 opened this issue 1 year ago • 0 comments

I'm trying to configure prom-client to work with the global default Registry set to OpenMetrics format.

As described in the README this requires:

// set the content type to OpenMetrics format
import client from 'prom-client';

client.register.setContentType(
  client.Registry.OPENMETRICS_CONTENT_TYPE
);

Using this code, TS throws the following error:

Argument of type '"application/openmetrics-text; version=1.0.0; charset=utf-8"' is not assignable to parameter of type '"text/plain; version=0.0.4; charset=utf-8"'

I'm able to workaround it only type-casting it to any but it really seems an issue in the TS interface

Affected version: 15.1.3 NodeJS version 20.12

bahamut657 avatar Mar 27 '25 16:03 bahamut657