Skip to content

Commit

Permalink
Generate metrics documentation.
Browse files Browse the repository at this point in the history
Signed-off-by: Cody Littley <[email protected]>
  • Loading branch information
cody-littley committed Nov 26, 2024
1 parent 53bbb85 commit 974fbc5
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 0 deletions.
33 changes: 33 additions & 0 deletions operators/churner/churner-metrics.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Metrics Documentation for namespace 'eigenda_churner'

This documentation was automatically generated at time `2024-11-26T14:29:13-06:00`

There are a total of `2` registered metrics.

---

## latency_ms

latency summary in milliseconds

| | |
|---|---|
| **Name** | `latency` |
| **Unit** | `ms` |
| **Labels** | `method` |
| **Type** | `latency` |
| **Quantiles** | `0.500`, `0.900`, `0.950`, `0.990` |
| **Fully Qualified Name** | `eigenda_churner_latency_ms` |
---

## request_count

the number of requests

| | |
|---|---|
| **Name** | `request` |
| **Unit** | `count` |
| **Labels** | `status`, `method`, `reason` |
| **Type** | `counter` |
| **Fully Qualified Name** | `eigenda_churner_request_count` |
5 changes: 5 additions & 0 deletions operators/churner/churner_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,3 +85,8 @@ func TestProcessChurnRequest(t *testing.T) {
}
assert.ElementsMatch(t, []dacore.QuorumID{0, 1}, actualQuorums)
}

// Uncomment and run this to generate the metrics documentation
func TestGenerateMetricsDoc(t *testing.T) {

}
24 changes: 24 additions & 0 deletions operators/churner/mdoc/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package main

import (
"github.com/Layr-Labs/eigenda/common"
"github.com/Layr-Labs/eigenda/operators/churner"
)

// main generates documentation for churner metrics.
func main() {
logger, err := common.NewLogger(common.DefaultLoggerConfig())
if err != nil {
panic(err)
}

metrics, err := churner.NewMetrics(0, logger)
if err != nil {
panic(err)
}

err = metrics.WriteMetricsDocumentation()
if err != nil {
panic(err)
}
}
5 changes: 5 additions & 0 deletions operators/churner/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,11 @@ func NewMetrics(httpPort int, logger logging.Logger) (*Metrics, error) {
}, nil
}

// WriteMetricsDocumentation writes the metrics for the churner to a markdown file.
func (g *Metrics) WriteMetricsDocumentation() error {
return g.metricsServer.WriteMetricsDocumentation("operators/churner/churner-metrics.md")
}

// ObserveLatency observes the latency of a stage
func (g *Metrics) ObserveLatency(method string, latency time.Duration) {
g.latency.ReportLatency(latency, latencyLabel{method: method})
Expand Down

0 comments on commit 974fbc5

Please sign in to comment.