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

add prometheus metrics server and config #1015

Merged
merged 2 commits into from
Sep 24, 2024
Merged

Conversation

jchappelow
Copy link
Member

@jchappelow jchappelow commented Sep 23, 2024

I want to play with prometheus a bit before saying this is right, but it addresses exposing cometbft's metrics as in #995 (comment)

Prometheus server + Grafana can talk to this and see cometbft's metrics, so I think this is properly exposing CometBFT's metrics endpoint.

Metrics: https://docs.cometbft.com/v0.38/core/metrics

image

prometheus config

global:
  scrape_interval: 15s # Set the scrape interval to every 15 seconds. Default is every 1 minute.
  evaluation_interval: 15s # Evaluate rules every 15 seconds. The default is every 1 minute.
  # scrape_timeout is set to the global default (10s).

# Alertmanager configuration
alerting:
  alertmanagers:
    - static_configs:
        - targets:
          # - alertmanager:9093

# Load rules once and periodically evaluate them according to the global 'evaluation_interval'.
rule_files:
  # - "first_rules.yml"
  # - "second_rules.yml"

# A scrape configuration containing exactly one endpoint to scrape:
# Here it's Prometheus itself.
scrape_configs:
  # The job name is added as a label `job=<job_name>` to any timeseries scraped from this config.
  - job_name: "prometheus"

    # metrics_path defaults to '/metrics'
    # scheme defaults to 'http'.

    scrape_interval: 5s

    static_configs:
      - targets: ['localhost:26660']

@jchappelow jchappelow marked this pull request as draft September 23, 2024 22:52
@jchappelow jchappelow added this to the v0.9 milestone Sep 24, 2024
@jchappelow jchappelow changed the title [WIP] add prometheus metrics server and config add prometheus metrics server and config Sep 24, 2024
@jchappelow jchappelow marked this pull request as ready for review September 24, 2024 19:57
Comment on lines +62 to +68
// UNSTABLE: this is not much more than a placeholder to ensure we can add
// our own metrics to the global prometheus metrics registry.
metrics map[string]Metrics
}

type Metrics interface {
Inc()
Copy link
Member Author

Choose a reason for hiding this comment

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

Here's some PoC stuff. I marked this counter-type metric as unstable as we should fully specify all of kwild's metrics and organize them better within a hierarchy of namespaces.

@jchappelow jchappelow marked this pull request as draft September 24, 2024 20:06
@jchappelow jchappelow marked this pull request as ready for review September 24, 2024 20:24
Copy link
Collaborator

@brennanjl brennanjl left a comment

Choose a reason for hiding this comment

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

LGTM, thanks a ton for doing this

@brennanjl brennanjl merged commit 162cabe into kwilteam:main Sep 24, 2024
4 checks passed
@jchappelow jchappelow deleted the metrics branch September 24, 2024 21:40
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