Skip to content
This repository has been archived by the owner on Jun 11, 2024. It is now read-only.

Create API endpoint for Prometheus (api/prometheus/metrics) #5887

Closed
ishantiw opened this issue Oct 19, 2020 · 0 comments · Fixed by #5932
Closed

Create API endpoint for Prometheus (api/prometheus/metrics) #5887

ishantiw opened this issue Oct 19, 2020 · 0 comments · Fixed by #5932

Comments

@ishantiw
Copy link
Contributor

ishantiw commented Oct 19, 2020

Description

Prometheus supports three value types, counter, gauge and histogram. It accepts a specific format of data.
List of parameters for Prometheus

Below is the text format that is accepted by Prometheus and including parameters that are good candidates to be included in the response.

avg_number_of_times_block_received: get averageReceivedBlock from #5295
avg_number_of_times_transaction_received: get averageReceivedTransactions from #5884
node_height: await channel.invoke('app:getNodeInfo')
finalized_height: await channel.invoke('app:getNodeInfo')
unconfirmed_transactions: await channel.invoke('app:getNodeInfo')
connected_peers: await channel.invoke('app:getConnectedPeers')
disconnected_peers: await channel.invoke('app:getDisconnectedPeers')
number_of_fork_events: get the count from the counter from #5886

# HELP Block propagation
# TYPE avg_number_of_times_block_received gauge
avg_number_of_times_block_received 18

# HELP Transaction propagation
# TYPE avg_number_of_times_transaction_received gauge
avg_number_of_times_transaction_received 42

# HELP Node height
# TYPE node_height gauge
node_height 126688

# HELP Finalised height
# TYPE finalized_height gauge
finalized_height 42

# HELP Unconfirmed transactions
# TYPE unconfirmed_transactions gauge
unconfirmed_transactions 2

# HELP Connected peers // This can be broken down into outgoing and incoming peers
# TYPE connected_peers gauge
connected_peers 85

# HELP Disconnected peers
# TYPE disconnected_peers gauge
disconnected_peers 1234

# HELP Number of fork events
# TYPE number_of_fork_events gauge
number_of_fork_events 23

Motivation

To provide data that is compatible with Prometheus that can be used to visualize or to have network wide view of nodes during alpha testing based on some key parameters.

Acceptance Criteria

  • Add unit test to check if the above values are exposed
  • Check if the above values are responded by registering to the framework

Additional Information

Related issues: #5216

@ishantiw ishantiw self-assigned this Oct 27, 2020
ishantiw added a commit that referenced this issue Oct 29, 2020
Controller that collects relevant data from channel actions and sharedState and export it to prometheus export format
ManuGowda pushed a commit that referenced this issue Oct 30, 2020
Controller that collects relevant data from channel actions and sharedState and export it to prometheus export format
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants