socket.io-prometheus-metrics icon indicating copy to clipboard operation
socket.io-prometheus-metrics copied to clipboard

New: Add `prefix` support to be able to specify a custom Prometheous metric name prefix

Open DataTables opened this issue 5 years ago • 5 comments

https://github.com/UNIwise/socket.io-prometheus-metrics/issues/12

I've done this on the v2 branch since that seems to be were the development is - I hope that is okay.

DataTables avatar Oct 27 '20 14:10 DataTables

I think this code might be a better fit for the v2 branch. Would you please look into adding this to v2 instead?

Also thanks a lot for you interest in the project!

naueramant avatar Nov 18 '20 19:11 naueramant

Hi - thanks for your replies! This was targeting the v2 branch - have I not set the pull request up properly to reflect that?

Regarding the dist directory - the package.json references "main": "./dist/index.js",. So to be able to npm install this package and then use it, the dist directory would need to be included. The source is TS, so it couldn't be directly referenced from package.json and have it work without tsc.

DataTables avatar Nov 18 '20 21:11 DataTables

My bad you did indeed target the v2 branch!

The package is meant the be build and published to npm so this repo does itself not hold the build.

naueramant avatar Nov 19 '20 08:11 naueramant

Sorry for quite getting it - when you npm install socket.io-prometheus-metrics it will pull in the contents of this repo (I'm assuming the v2 branch here) - then if you do a require('socket.io-prometheus-metrics') it will fail since dist/main.js isn't present.

DataTables avatar Nov 19 '20 08:11 DataTables

No, when running npm install the client fetches a tarball from the npm registry with the released package and extracts it into node_modules/<package name>.

You can find links to the tarball and inspect it yourself by running npm view as so:

npm view socket.io-prometheus-metrics

[email protected] | Apache-2.0 | deps: 3 | versions: 7
Prometheus metrics for socket.io

keywords: prometheus, socket.io, metrics

dist
.tarball: https://registry.npmjs.org/socket.io-prometheus-metrics/-/socket.io-prometheus-metrics-1.0.6.tgz
.shasum: 59189d57daaa879708a76d6618cc0bbef87fc9a0
.integrity: sha512-rG1XIWuFRysVE/VE2ikJcYbv1ZqcY5IZ5CJOoih2MMiVx7GujwvxF1olcpDlQ/iGGryCXC/FRoBAB00Qnzsntw==
.unpackedSize: 24.3 kB

dependencies:
express: ^4.16.4     prom-client: ^11.2.1 socket.io: ^2.2.0    

maintainers:
- jenkinsuniwise <[email protected]>
- jonastranberguniwise <[email protected]>
- mads_stenhoj <[email protected]>

dist-tags:
latest: 1.0.6  

published 3 months ago by jonastranberguniwise <[email protected]>

When releasing a package you do the following:

  1. build the packge to generate the dist dir
  2. run npm publish which will bundle all the files (including the dist folder) in a tar and push it to the npm registry.

Thats why there is no need for the dist folder in version control. In general compiled code should not be version controlled.

naueramant avatar Nov 19 '20 11:11 naueramant