YeagerAI-Bulat / genlayer-simulator

MIT License
0 stars 0 forks source link

SIM-BE Add /metrics endpoint for backend to expose metrics in Prometheus format #3

Open YeagerAI-Bulat opened 1 month ago

YeagerAI-Bulat commented 1 month ago

We would like to enhance the observability of the JSON-RPC container by adding a /metrics endpoint that exposes application metrics in the Prometheus format. This will allow us to monitor key performance indicators and system health effectively. The official Python client for Prometheus could be used.

Proposed Implementation:

Create a new /metrics endpoint: This endpoint should return metrics in the Prometheus exposition format. Ensure that it is accessible without authentication for Prometheus scrapers.

Metrics to expose: Counters: Track the total number of requests handled by the server. Gauges: Monitor the current number of active connections. Histograms: Measure request durations to analyze latency. Here are a few examples of how the metrics could be structured:

Example Metrics Format:

RPC Duration

Metric Name: rpc.server.duration
Type: Histogram
Description: Measures the duration of inbound RPC requests.
Example:
# TYPE rpc_server_duration histogram
rpc_server_duration_bucket{method="get_balance", le="50"} 100
rpc_server_duration_bucket{method="get_balance", le="100"} 200
rpc_server_duration_count{method="get_balance"} 300
rpc_server_duration_sum{method="get_balance"} 15000

Error Rate

Metric Name: rpc.server.error_count
Type: Counter
Description: Counts the total number of errors encountered during RPC calls.
Example:
# HELP rpc_server_error_count Total number of errors encountered during RPC calls
# TYPE rpc_server_error_count counter
rpc_server_error_count{method="get_contract_schema"} 5
github-actions[bot] commented 1 month ago

OpenHands started fixing the issue! You can monitor the progress here.

github-actions[bot] commented 1 month ago

The workflow to fix this issue encountered an error. Please check the workflow logs for more information.

github-actions[bot] commented 1 month ago

OpenHands started fixing the issue! You can monitor the progress here.

github-actions[bot] commented 1 month ago

The workflow to fix this issue encountered an error. Please check the workflow logs for more information.

github-actions[bot] commented 1 month ago

OpenHands started fixing the issue! You can monitor the progress here.

github-actions[bot] commented 1 month ago

The workflow to fix this issue encountered an error. Please check the workflow logs for more information.

github-actions[bot] commented 1 month ago

OpenHands started fixing the issue! You can monitor the progress here.

github-actions[bot] commented 1 month ago

The workflow to fix this issue encountered an error. Please check the workflow logs for more information.

YeagerAI-Bulat commented 1 month ago

@mentatai

mentatbot[bot] commented 1 month ago

I will start working on this issue

github-actions[bot] commented 1 week ago

OpenHands started fixing the issue! You can monitor the progress here.

github-actions[bot] commented 1 week ago

OpenHands started fixing the issue! You can monitor the progress here.

github-actions[bot] commented 1 week ago

The workflow to fix this issue encountered an error. Openhands failed to create any code changes.

github-actions[bot] commented 1 week ago

OpenHands started fixing the issue! You can monitor the progress here.

github-actions[bot] commented 1 week ago

OpenHands started fixing the issue! You can monitor the progress here.

github-actions[bot] commented 1 week ago

An attempt was made to automatically fix this issue, but it was unsuccessful. A branch named 'openhands-fix-issue-3' has been created with the attempted changes. You can view the branch here. Manual intervention may be required.