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

Question about usage : network_concurrent_connections_count #498

Closed
BenjD90 opened this issue Oct 21, 2020 · 6 comments
Closed

Question about usage : network_concurrent_connections_count #498

BenjD90 opened this issue Oct 21, 2020 · 6 comments

Comments

@BenjD90
Copy link

BenjD90 commented Oct 21, 2020

Hello,

First, I'd like to thank you for all the metrics you allow me to export.

I'm interesting by the metric you use in the README.md :
network_concurrent_connections_count

How can I expose it ? Do I have to implement it myself ? If yes, do you have any exemple ? I think something using : server.getConnections

Thank you for your help,
Benjamin

Tech context:

  • Node 14
  • Express 4
@tdeekens
Copy link
Owner

Thanks for opening. The metric should be automatically part of the reported metics. I you GET /metrics you should be able to find it there as part of the Prometheus metrics.

@BenjD90
Copy link
Author

BenjD90 commented Oct 23, 2020

Hello,

Thank you for your quick answer 😄
I don't find that metric on my api 😕

Here is the output I get :

Click to expand
# HELP process_cpu_user_seconds_total Total user CPU time spent in seconds.
# TYPE process_cpu_user_seconds_total counter
process_cpu_user_seconds_total 1.245762

# HELP process_cpu_system_seconds_total Total system CPU time spent in seconds.
# TYPE process_cpu_system_seconds_total counter
process_cpu_system_seconds_total 0.069989

# HELP process_cpu_seconds_total Total user and system CPU time spent in seconds.
# TYPE process_cpu_seconds_total counter
process_cpu_seconds_total 1.3157510000000001

# HELP process_start_time_seconds Start time of the process since unix epoch in seconds.
# TYPE process_start_time_seconds gauge
process_start_time_seconds 1603445740

# HELP process_resident_memory_bytes Resident memory size in bytes.
# TYPE process_resident_memory_bytes gauge
process_resident_memory_bytes 188538880

# HELP process_virtual_memory_bytes Virtual memory size in bytes.
# TYPE process_virtual_memory_bytes gauge
process_virtual_memory_bytes 1133129728

# HELP process_heap_bytes Process heap size in bytes.
# TYPE process_heap_bytes gauge
process_heap_bytes 239915008

# HELP process_open_fds Number of open file descriptors.
# TYPE process_open_fds gauge
process_open_fds 28

# HELP process_max_fds Maximum number of open file descriptors.
# TYPE process_max_fds gauge
process_max_fds 1048576

# HELP nodejs_eventloop_lag_seconds Lag of event loop in seconds.
# TYPE nodejs_eventloop_lag_seconds gauge
nodejs_eventloop_lag_seconds 0.005919435

# HELP nodejs_eventloop_lag_min_seconds The minimum recorded event loop delay.
# TYPE nodejs_eventloop_lag_min_seconds gauge
nodejs_eventloop_lag_min_seconds 0.009076736

# HELP nodejs_eventloop_lag_max_seconds The maximum recorded event loop delay.
# TYPE nodejs_eventloop_lag_max_seconds gauge
nodejs_eventloop_lag_max_seconds 0.024674303

# HELP nodejs_eventloop_lag_mean_seconds The mean of the recorded event loop delays.
# TYPE nodejs_eventloop_lag_mean_seconds gauge
nodejs_eventloop_lag_mean_seconds 0.010128831867337873

# HELP nodejs_eventloop_lag_stddev_seconds The standard deviation of the recorded event loop delays.
# TYPE nodejs_eventloop_lag_stddev_seconds gauge
nodejs_eventloop_lag_stddev_seconds 0.00042510576469645704

# HELP nodejs_eventloop_lag_p50_seconds The 50th percentile of the recorded event loop delays.
# TYPE nodejs_eventloop_lag_p50_seconds gauge
nodejs_eventloop_lag_p50_seconds 0.010117119

# HELP nodejs_eventloop_lag_p90_seconds The 90th percentile of the recorded event loop delays.
# TYPE nodejs_eventloop_lag_p90_seconds gauge
nodejs_eventloop_lag_p90_seconds 0.010174463

# HELP nodejs_eventloop_lag_p99_seconds The 99th percentile of the recorded event loop delays.
# TYPE nodejs_eventloop_lag_p99_seconds gauge
nodejs_eventloop_lag_p99_seconds 0.010272767

# HELP nodejs_active_handles Number of active libuv handles grouped by handle type. Every handle type is C++ class name.
# TYPE nodejs_active_handles gauge
nodejs_active_handles{type="Socket"} 5
nodejs_active_handles{type="Server"} 2

# HELP nodejs_active_handles_total Total number of active handles.
# TYPE nodejs_active_handles_total gauge
nodejs_active_handles_total 7

# HELP nodejs_active_requests Number of active libuv requests grouped by request type. Every request type is C++ class name.
# TYPE nodejs_active_requests gauge

# HELP nodejs_active_requests_total Total number of active requests.
# TYPE nodejs_active_requests_total gauge
nodejs_active_requests_total 0

# HELP nodejs_heap_size_total_bytes Process heap size from Node.js in bytes.
# TYPE nodejs_heap_size_total_bytes gauge
nodejs_heap_size_total_bytes 114810880

# HELP nodejs_heap_size_used_bytes Process heap size used from Node.js in bytes.
# TYPE nodejs_heap_size_used_bytes gauge
nodejs_heap_size_used_bytes 112788048

# HELP nodejs_external_memory_bytes Node.js external memory size in bytes.
# TYPE nodejs_external_memory_bytes gauge
nodejs_external_memory_bytes 1775539

# HELP nodejs_heap_space_size_total_bytes Process heap space size total from Node.js in bytes.
# TYPE nodejs_heap_space_size_total_bytes gauge
nodejs_heap_space_size_total_bytes{space="read_only"} 151552
nodejs_heap_space_size_total_bytes{space="new"} 1048576
nodejs_heap_space_size_total_bytes{space="old"} 87175168
nodejs_heap_space_size_total_bytes{space="code"} 1146880
nodejs_heap_space_size_total_bytes{space="map"} 2101248
nodejs_heap_space_size_total_bytes{space="large_object"} 23138304
nodejs_heap_space_size_total_bytes{space="code_large_object"} 49152
nodejs_heap_space_size_total_bytes{space="new_large_object"} 0

# HELP nodejs_heap_space_size_used_bytes Process heap space size used from Node.js in bytes.
# TYPE nodejs_heap_space_size_used_bytes gauge
nodejs_heap_space_size_used_bytes{space="read_only"} 150392
nodejs_heap_space_size_used_bytes{space="new"} 840192
nodejs_heap_space_size_used_bytes{space="old"} 86438424
nodejs_heap_space_size_used_bytes{space="code"} 1023936
nodejs_heap_space_size_used_bytes{space="map"} 1230264
nodejs_heap_space_size_used_bytes{space="large_object"} 23104120
nodejs_heap_space_size_used_bytes{space="code_large_object"} 2880
nodejs_heap_space_size_used_bytes{space="new_large_object"} 0

# HELP nodejs_heap_space_size_available_bytes Process heap space size available from Node.js in bytes.
# TYPE nodejs_heap_space_size_available_bytes gauge
nodejs_heap_space_size_available_bytes{space="read_only"} 0
nodejs_heap_space_size_available_bytes{space="new"} 207232
nodejs_heap_space_size_available_bytes{space="old"} 395048
nodejs_heap_space_size_available_bytes{space="code"} 6048
nodejs_heap_space_size_available_bytes{space="map"} 864272
nodejs_heap_space_size_available_bytes{space="large_object"} 0
nodejs_heap_space_size_available_bytes{space="code_large_object"} 0
nodejs_heap_space_size_available_bytes{space="new_large_object"} 1047424

# HELP nodejs_version_info Node.js version info.
# TYPE nodejs_version_info gauge
nodejs_version_info{version="v14.11.0",major="14",minor="11",patch="0"} 1

# HELP nodejs_gc_duration_seconds Garbage collection duration by kind, one of major, minor, incremental or weakcb.
# TYPE nodejs_gc_duration_seconds histogram
nodejs_gc_duration_seconds_bucket{le="0.001",kind="minor"} 1
nodejs_gc_duration_seconds_bucket{le="0.01",kind="minor"} 4
nodejs_gc_duration_seconds_bucket{le="0.1",kind="minor"} 4
nodejs_gc_duration_seconds_bucket{le="1",kind="minor"} 4
nodejs_gc_duration_seconds_bucket{le="2",kind="minor"} 4
nodejs_gc_duration_seconds_bucket{le="5",kind="minor"} 4
nodejs_gc_duration_seconds_bucket{le="+Inf",kind="minor"} 4
nodejs_gc_duration_seconds_sum{kind="minor"} 0.012561524999999999
nodejs_gc_duration_seconds_count{kind="minor"} 4
nodejs_gc_duration_seconds_bucket{le="0.001",kind="weakcb"} 1
nodejs_gc_duration_seconds_bucket{le="0.01",kind="weakcb"} 1
nodejs_gc_duration_seconds_bucket{le="0.1",kind="weakcb"} 1
nodejs_gc_duration_seconds_bucket{le="1",kind="weakcb"} 1
nodejs_gc_duration_seconds_bucket{le="2",kind="weakcb"} 1
nodejs_gc_duration_seconds_bucket{le="5",kind="weakcb"} 1
nodejs_gc_duration_seconds_bucket{le="+Inf",kind="weakcb"} 1
nodejs_gc_duration_seconds_sum{kind="weakcb"} 0.0000023440000000000003
nodejs_gc_duration_seconds_count{kind="weakcb"} 1
nodejs_gc_duration_seconds_bucket{le="0.001",kind="incremental"} 6
nodejs_gc_duration_seconds_bucket{le="0.01",kind="incremental"} 6
nodejs_gc_duration_seconds_bucket{le="0.1",kind="incremental"} 6
nodejs_gc_duration_seconds_bucket{le="1",kind="incremental"} 6
nodejs_gc_duration_seconds_bucket{le="2",kind="incremental"} 6
nodejs_gc_duration_seconds_bucket{le="5",kind="incremental"} 6
nodejs_gc_duration_seconds_bucket{le="+Inf",kind="incremental"} 6
nodejs_gc_duration_seconds_sum{kind="incremental"} 0.00101978
nodejs_gc_duration_seconds_count{kind="incremental"} 6
nodejs_gc_duration_seconds_bucket{le="0.001",kind="major"} 0
nodejs_gc_duration_seconds_bucket{le="0.01",kind="major"} 2
nodejs_gc_duration_seconds_bucket{le="0.1",kind="major"} 3
nodejs_gc_duration_seconds_bucket{le="1",kind="major"} 3
nodejs_gc_duration_seconds_bucket{le="2",kind="major"} 3
nodejs_gc_duration_seconds_bucket{le="5",kind="major"} 3
nodejs_gc_duration_seconds_bucket{le="+Inf",kind="major"} 3
nodejs_gc_duration_seconds_sum{kind="major"} 0.030101070999999997
nodejs_gc_duration_seconds_count{kind="major"} 3

# HELP up 1 = up, 0 = not up
# TYPE up gauge
up 1

# HELP nodejs_gc_runs_total Count of total garbage collections.
# TYPE nodejs_gc_runs_total counter
nodejs_gc_runs_total{gc_type="scavenge"} 4
nodejs_gc_runs_total{gc_type="weak_phantom"} 1
nodejs_gc_runs_total{gc_type="incremental_marking"} 6
nodejs_gc_runs_total{gc_type="mark_sweep_compact"} 3

# HELP nodejs_gc_pause_seconds_total Time spent in GC Pause in seconds.
# TYPE nodejs_gc_pause_seconds_total counter
nodejs_gc_pause_seconds_total{gc_type="scavenge"} 0.013887284000000001
nodejs_gc_pause_seconds_total{gc_type="weak_phantom"} 0.000841211
nodejs_gc_pause_seconds_total{gc_type="incremental_marking"} 0.001954825
nodejs_gc_pause_seconds_total{gc_type="mark_sweep_compact"} 0.03045759

# HELP nodejs_gc_reclaimed_bytes_total Total number of bytes reclaimed by GC.
# TYPE nodejs_gc_reclaimed_bytes_total counter
nodejs_gc_reclaimed_bytes_total{gc_type="scavenge"} 23332272
nodejs_gc_reclaimed_bytes_total{gc_type="mark_sweep_compact"} 24047224

# HELP http_request_duration_seconds The HTTP request latencies in seconds.
# TYPE http_request_duration_seconds histogram
http_request_duration_seconds_bucket{le="0.05",method="get",path="/",status_code="200"} 1
http_request_duration_seconds_bucket{le="0.1",method="get",path="/",status_code="200"} 1
http_request_duration_seconds_bucket{le="0.3",method="get",path="/",status_code="200"} 1
http_request_duration_seconds_bucket{le="0.5",method="get",path="/",status_code="200"} 1
http_request_duration_seconds_bucket{le="0.8",method="get",path="/",status_code="200"} 1
http_request_duration_seconds_bucket{le="1",method="get",path="/",status_code="200"} 1
http_request_duration_seconds_bucket{le="1.5",method="get",path="/",status_code="200"} 1
http_request_duration_seconds_bucket{le="2",method="get",path="/",status_code="200"} 1
http_request_duration_seconds_bucket{le="3",method="get",path="/",status_code="200"} 1
http_request_duration_seconds_bucket{le="10",method="get",path="/",status_code="200"} 1
http_request_duration_seconds_bucket{le="+Inf",method="get",path="/",status_code="200"} 1
http_request_duration_seconds_sum{method="get",path="/",status_code="200"} 0.010175347
http_request_duration_seconds_count{method="get",path="/",status_code="200"} 1
http_request_duration_seconds_bucket{le="0.05",method="get",path="/favicon.ico",status_code="404"} 1
http_request_duration_seconds_bucket{le="0.1",method="get",path="/favicon.ico",status_code="404"} 1
http_request_duration_seconds_bucket{le="0.3",method="get",path="/favicon.ico",status_code="404"} 1
http_request_duration_seconds_bucket{le="0.5",method="get",path="/favicon.ico",status_code="404"} 1
http_request_duration_seconds_bucket{le="0.8",method="get",path="/favicon.ico",status_code="404"} 1
http_request_duration_seconds_bucket{le="1",method="get",path="/favicon.ico",status_code="404"} 1
http_request_duration_seconds_bucket{le="1.5",method="get",path="/favicon.ico",status_code="404"} 1
http_request_duration_seconds_bucket{le="2",method="get",path="/favicon.ico",status_code="404"} 1
http_request_duration_seconds_bucket{le="3",method="get",path="/favicon.ico",status_code="404"} 1
http_request_duration_seconds_bucket{le="10",method="get",path="/favicon.ico",status_code="404"} 1
http_request_duration_seconds_bucket{le="+Inf",method="get",path="/favicon.ico",status_code="404"} 1
http_request_duration_seconds_sum{method="get",path="/favicon.ico",status_code="404"} 0.019963248
http_request_duration_seconds_count{method="get",path="/favicon.ico",status_code="404"} 1
http_request_duration_seconds_bucket{le="0.05",method="get",path="/",status_code="304"} 4
http_request_duration_seconds_bucket{le="0.1",method="get",path="/",status_code="304"} 4
http_request_duration_seconds_bucket{le="0.3",method="get",path="/",status_code="304"} 4
http_request_duration_seconds_bucket{le="0.5",method="get",path="/",status_code="304"} 4
http_request_duration_seconds_bucket{le="0.8",method="get",path="/",status_code="304"} 4
http_request_duration_seconds_bucket{le="1",method="get",path="/",status_code="304"} 4
http_request_duration_seconds_bucket{le="1.5",method="get",path="/",status_code="304"} 4
http_request_duration_seconds_bucket{le="2",method="get",path="/",status_code="304"} 4
http_request_duration_seconds_bucket{le="3",method="get",path="/",status_code="304"} 4
http_request_duration_seconds_bucket{le="10",method="get",path="/",status_code="304"} 4
http_request_duration_seconds_bucket{le="+Inf",method="get",path="/",status_code="304"} 4
http_request_duration_seconds_sum{method="get",path="/",status_code="304"} 0.012875428999999999
http_request_duration_seconds_count{method="get",path="/",status_code="304"} 4

# HELP http_requests_total The total HTTP requests.
# TYPE http_requests_total counter
http_requests_total{method="get",path="/",status_code="200"} 1
http_requests_total{method="get",path="/favicon.ico",status_code="404"} 1
http_requests_total{method="get",path="/",status_code="304"} 4

# HELP version_info App version
# TYPE version_info gauge
version_info{version="2.15.0"} 1

There is no metric network_concurrent_connections_count.

How do I use Promster ?

I use @promster/express and @promster/server like this :

		expressApp.use(
			createMiddleware({
				options: {
					normalizePath: 
                                           (path: string, rr: { req: express.Request }): string => rr.req.route?.path || rr.req.originalUrl || rr.req.url,
					accuracies: ['s']
				},
			}),
		);

		const packageJson = require(join(appRootDir.get(), 'package.json'));

		new PrometheusClient.Gauge({
			name: 'version_info',
			help: 'App version',
			labelNames: ['version'],
		}).set({ version: packageJson.version }, 1);

		prometheusServer = await PromsterServer.createServer({ port: 9101 });

@tdeekens Do you see something missing ?

@tdeekens
Copy link
Owner

Nope that looks good. It should come from gc-stats I think. Can you check there if they maybe dropped it? Maybe it also depends on the Node.js version or something else. I basically just forward whatever they offer.

@BenjD90
Copy link
Author

BenjD90 commented Oct 23, 2020

I don't see any reference to this metric in the project, except in the readme, that's why I created this issue.

The gc-stats are well exposed and usefull 😃, they seems to be treated here :
https://github.com/tdeekens/promster/blob/69ddaa25401840704d4f7f78275680414a6457e7/packages/metrics/modules/create-gc-observer/create-gc-observer.ts

@tdeekens
Copy link
Owner

I don't see any reference to this metric in the project, except in the readme, that's why I created this issue.

The gc-stats are well exposed and usefull 😃, they seems to be treated here :
69ddaa2/packages/metrics/modules/create-gc-observer/create-gc-observer.ts

Thanks. Maybe the example is misleading then. It could also be a stat one could build yourself from Node.js data or when using any proxy library.

@tdeekens
Copy link
Owner

tdeekens commented Dec 6, 2020

Closing this issue due to inactivity. Feel free to re-open if the discussion becomes relevant again.

@tdeekens tdeekens closed this as completed Dec 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants