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

Feature: expose pinner metrics #165

Merged
merged 11 commits into from
Dec 1, 2018
Merged

Feature: expose pinner metrics #165

merged 11 commits into from
Dec 1, 2018

Conversation

pgte
Copy link
Contributor

@pgte pgte commented Nov 30, 2018

Addresses #156

@pgte pgte requested a review from victorb November 30, 2018 16:53
@pgte pgte removed the request for review from victorb November 30, 2018 16:58
@pgte
Copy link
Contributor Author

pgte commented Nov 30, 2018

This PR adds an HTTP endpoint to the pinner. By default it uses port 3001 and hostname '0.0.0.0', but it's configurable using the PORT and HOST environment variables.
The /health endpoint returns a JSON object with peer id and app name like this:

{"app":"peer-pad/2","id":"QmW2yPCiULWEcHSXf4TSiWPiLd31JyjDpaP2dfmMmZyY2f"}

And the /prometheus returns something like this:

# 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 0.152706 1543597170640

# 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.011522999999999999 1543597170640

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

# 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 1543597158

# HELP process_resident_memory_bytes Resident memory size in bytes.
# TYPE process_resident_memory_bytes gauge
process_resident_memory_bytes 104509440 1543597170640

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

# HELP nodejs_active_handles_total Number of active handles.
# TYPE nodejs_active_handles_total gauge
nodejs_active_handles_total 15 1543597170640

# HELP nodejs_active_requests_total Number of active requests.
# TYPE nodejs_active_requests_total gauge
nodejs_active_requests_total 0 1543597170640

# 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 76632064 1543597170640

# 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 38121016 1543597170640

# HELP nodejs_external_memory_bytes Nodejs external memory size in bytes.
# TYPE nodejs_external_memory_bytes gauge
nodejs_external_memory_bytes 855015 1543597170640

# 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"} 524288 1543597170640
nodejs_heap_space_size_total_bytes{space="new"} 33554432 1543597170640
nodejs_heap_space_size_total_bytes{space="old"} 34836480 1543597170640
nodejs_heap_space_size_total_bytes{space="code"} 1572864 1543597170640
nodejs_heap_space_size_total_bytes{space="map"} 2109440 1543597170640
nodejs_heap_space_size_total_bytes{space="large_object"} 4034560 1543597170640

# 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"} 35200 1543597170640
nodejs_heap_space_size_used_bytes{space="new"} 2280608 1543597170640
nodejs_heap_space_size_used_bytes{space="old"} 30473728 1543597170640
nodejs_heap_space_size_used_bytes{space="code"} 945632 1543597170640
nodejs_heap_space_size_used_bytes{space="map"} 1712216 1543597170640
nodejs_heap_space_size_used_bytes{space="large_object"} 2676384 1543597170640

# 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"} 480384 1543597170640
nodejs_heap_space_size_available_bytes{space="new"} 14218080 1543597170640
nodejs_heap_space_size_available_bytes{space="old"} 3233496 1543597170640
nodejs_heap_space_size_available_bytes{space="code"} 476608 1543597170640
nodejs_heap_space_size_available_bytes{space="map"} 84168 1543597170640
nodejs_heap_space_size_available_bytes{space="large_object"} 1450085888 1543597170640

# HELP nodejs_version_info Node.js version info.
# TYPE nodejs_version_info gauge
nodejs_version_info{version="v10.12.0",major="10",minor="12",patch="0"} 1

# HELP peerstar_peers total peers connected
# TYPE peerstar_peers gauge
peerstar_peers 0

# HELP peerstar_collaborations total number of active collaborations
# TYPE peerstar_collaborations gauge
peerstar_collaborations 0
pedroteixeira@MacBook-Pro-4:~/projects/ipfs/peer-star/peer-star-app (feat/pinner-metrics)
→ curl http://localhost:3001/prometheus
# 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 0.152706 1543597170640

# 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.011522999999999999 1543597170640

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

# 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 1543597158

# HELP process_resident_memory_bytes Resident memory size in bytes.
# TYPE process_resident_memory_bytes gauge
process_resident_memory_bytes 104509440 1543597170640

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

# HELP nodejs_active_handles_total Number of active handles.
# TYPE nodejs_active_handles_total gauge
nodejs_active_handles_total 15 1543597170640

# HELP nodejs_active_requests_total Number of active requests.
# TYPE nodejs_active_requests_total gauge
nodejs_active_requests_total 0 1543597170640

# 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 76632064 1543597170640

# 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 38121016 1543597170640

# HELP nodejs_external_memory_bytes Nodejs external memory size in bytes.
# TYPE nodejs_external_memory_bytes gauge
nodejs_external_memory_bytes 855015 1543597170640

# 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"} 524288 1543597170640
nodejs_heap_space_size_total_bytes{space="new"} 33554432 1543597170640
nodejs_heap_space_size_total_bytes{space="old"} 34836480 1543597170640
nodejs_heap_space_size_total_bytes{space="code"} 1572864 1543597170640
nodejs_heap_space_size_total_bytes{space="map"} 2109440 1543597170640
nodejs_heap_space_size_total_bytes{space="large_object"} 4034560 1543597170640

# 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"} 35200 1543597170640
nodejs_heap_space_size_used_bytes{space="new"} 2280608 1543597170640
nodejs_heap_space_size_used_bytes{space="old"} 30473728 1543597170640
nodejs_heap_space_size_used_bytes{space="code"} 945632 1543597170640
nodejs_heap_space_size_used_bytes{space="map"} 1712216 1543597170640
nodejs_heap_space_size_used_bytes{space="large_object"} 2676384 1543597170640

# 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"} 480384 1543597170640
nodejs_heap_space_size_available_bytes{space="new"} 14218080 1543597170640
nodejs_heap_space_size_available_bytes{space="old"} 3233496 1543597170640
nodejs_heap_space_size_available_bytes{space="code"} 476608 1543597170640
nodejs_heap_space_size_available_bytes{space="map"} 84168 1543597170640
nodejs_heap_space_size_available_bytes{space="large_object"} 1450085888 1543597170640

# HELP nodejs_version_info Node.js version info.
# TYPE nodejs_version_info gauge
nodejs_version_info{version="v10.12.0",major="10",minor="12",patch="0"} 1

# HELP peerstar_peers total peers connected
# TYPE peerstar_peers gauge
peerstar_peers 0

# HELP peerstar_collaborations total number of active collaborations
# TYPE peerstar_collaborations gauge
peerstar_collaborations 2
pedroteixeira@MacBook-Pro-4:~/projects/ipfs/peer-star/peer-star-app (feat/pinner-metrics)
→ curl http://localhost:3001/prometheus
# 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 0.152706 1543597170640

# 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.011522999999999999 1543597170640

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

# 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 1543597158

# HELP process_resident_memory_bytes Resident memory size in bytes.
# TYPE process_resident_memory_bytes gauge
process_resident_memory_bytes 104509440 1543597170640

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

# HELP nodejs_active_handles_total Number of active handles.
# TYPE nodejs_active_handles_total gauge
nodejs_active_handles_total 15 1543597170640

# HELP nodejs_active_requests_total Number of active requests.
# TYPE nodejs_active_requests_total gauge
nodejs_active_requests_total 0 1543597170640

# 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 76632064 1543597170640

# 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 38121016 1543597170640

# HELP nodejs_external_memory_bytes Nodejs external memory size in bytes.
# TYPE nodejs_external_memory_bytes gauge
nodejs_external_memory_bytes 855015 1543597170640

# 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"} 524288 1543597170640
nodejs_heap_space_size_total_bytes{space="new"} 33554432 1543597170640
nodejs_heap_space_size_total_bytes{space="old"} 34836480 1543597170640
nodejs_heap_space_size_total_bytes{space="code"} 1572864 1543597170640
nodejs_heap_space_size_total_bytes{space="map"} 2109440 1543597170640
nodejs_heap_space_size_total_bytes{space="large_object"} 4034560 1543597170640

# 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"} 35200 1543597170640
nodejs_heap_space_size_used_bytes{space="new"} 2280608 1543597170640
nodejs_heap_space_size_used_bytes{space="old"} 30473728 1543597170640
nodejs_heap_space_size_used_bytes{space="code"} 945632 1543597170640
nodejs_heap_space_size_used_bytes{space="map"} 1712216 1543597170640
nodejs_heap_space_size_used_bytes{space="large_object"} 2676384 1543597170640

# 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"} 480384 1543597170640
nodejs_heap_space_size_available_bytes{space="new"} 14218080 1543597170640
nodejs_heap_space_size_available_bytes{space="old"} 3233496 1543597170640
nodejs_heap_space_size_available_bytes{space="code"} 476608 1543597170640
nodejs_heap_space_size_available_bytes{space="map"} 84168 1543597170640
nodejs_heap_space_size_available_bytes{space="large_object"} 1450085888 1543597170640

# HELP nodejs_version_info Node.js version info.
# TYPE nodejs_version_info gauge
nodejs_version_info{version="v10.12.0",major="10",minor="12",patch="0"} 1

# HELP peerstar_peers total peers connected
# TYPE peerstar_peers gauge
peerstar_peers 0

# HELP peerstar_collaborations total number of active collaborations
# TYPE peerstar_collaborations gauge
peerstar_collaborations 2
pedroteixeira@MacBook-Pro-4:~/projects/ipfs/peer-star/peer-star-app (feat/pinner-metrics)
→ curl http://localhost:3001/prometheus
# 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 0.152706 1543597170640

# 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.011522999999999999 1543597170640

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

# 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 1543597158

# HELP process_resident_memory_bytes Resident memory size in bytes.
# TYPE process_resident_memory_bytes gauge
process_resident_memory_bytes 104509440 1543597170640

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

# HELP nodejs_active_handles_total Number of active handles.
# TYPE nodejs_active_handles_total gauge
nodejs_active_handles_total 15 1543597170640

# HELP nodejs_active_requests_total Number of active requests.
# TYPE nodejs_active_requests_total gauge
nodejs_active_requests_total 0 1543597170640

# 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 76632064 1543597170640

# 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 38121016 1543597170640

# HELP nodejs_external_memory_bytes Nodejs external memory size in bytes.
# TYPE nodejs_external_memory_bytes gauge
nodejs_external_memory_bytes 855015 1543597170640

# 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"} 524288 1543597170640
nodejs_heap_space_size_total_bytes{space="new"} 33554432 1543597170640
nodejs_heap_space_size_total_bytes{space="old"} 34836480 1543597170640
nodejs_heap_space_size_total_bytes{space="code"} 1572864 1543597170640
nodejs_heap_space_size_total_bytes{space="map"} 2109440 1543597170640
nodejs_heap_space_size_total_bytes{space="large_object"} 4034560 1543597170640

# 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"} 35200 1543597170640
nodejs_heap_space_size_used_bytes{space="new"} 2280608 1543597170640
nodejs_heap_space_size_used_bytes{space="old"} 30473728 1543597170640
nodejs_heap_space_size_used_bytes{space="code"} 945632 1543597170640
nodejs_heap_space_size_used_bytes{space="map"} 1712216 1543597170640
nodejs_heap_space_size_used_bytes{space="large_object"} 2676384 1543597170640

# 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"} 480384 1543597170640
nodejs_heap_space_size_available_bytes{space="new"} 14218080 1543597170640
nodejs_heap_space_size_available_bytes{space="old"} 3233496 1543597170640
nodejs_heap_space_size_available_bytes{space="code"} 476608 1543597170640
nodejs_heap_space_size_available_bytes{space="map"} 84168 1543597170640
nodejs_heap_space_size_available_bytes{space="large_object"} 1450085888 1543597170640

# HELP nodejs_version_info Node.js version info.
# TYPE nodejs_version_info gauge
nodejs_version_info{version="v10.12.0",major="10",minor="12",patch="0"} 1

# HELP peerstar_peers total peers connected
# TYPE peerstar_peers gauge
peerstar_peers 1

# HELP peerstar_collaborations total number of active collaborations
# TYPE peerstar_collaborations gauge
peerstar_collaborations 2

@pgte pgte requested a review from victorb November 30, 2018 17:17
@pgte
Copy link
Contributor Author

pgte commented Nov 30, 2018

@victorb could you please review this?

bin/pinner Outdated Show resolved Hide resolved
Copy link
Contributor

@victorb victorb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! 👍

@pgte pgte merged commit 2043691 into master Dec 1, 2018
@pgte pgte deleted the feat/pinner-metrics branch December 1, 2018 14:44
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

Successfully merging this pull request may close these issues.

2 participants