Skip to content

Fixing issue "examples: Refresh client_golang examples #1652" #1736

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions api/prometheus/v1/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -692,9 +692,9 @@ type TSDBHeadStats struct {

// WalReplayStatus represents the wal replay status.
type WalReplayStatus struct {
Min int `json:"min"`
Max int `json:"max"`
Current int `json:"current"`
StartOffset int `json:"startOffset"`
EndOffset int `json:"endOffset"`
Current int `json:"current"`
}

// Stat models information about statistic value.
Expand Down
25 changes: 25 additions & 0 deletions examples/random/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ import (
type metrics struct {
rpcDurations *prometheus.SummaryVec
rpcDurationsHistogram prometheus.Histogram
rpcRequests *prometheus.CounterVec
activeRpcs *prometheus.GaugeVec
}

func NewMetrics(reg prometheus.Registerer, normMean, normDomain float64) *metrics {
Expand Down Expand Up @@ -65,9 +67,32 @@ func NewMetrics(reg prometheus.Registerer, normMean, normDomain float64) *metric
Buckets: prometheus.LinearBuckets(normMean-5*normDomain, .5*normDomain, 20),
NativeHistogramBucketFactor: 1.1,
}),

//Adding the counter metric type
rpcRequests: prometheus.NewCounterVec(
prometheus.CounterOpts{
Name: "rpc_requests_total",
Help: "RPC request distributions.",
},
[]string{"service"},
),

//Adding the gauge metric type
activeRpcs: prometheus.NewGaugeVec(
prometheus.GaugeOpts{
Name: "rpc_active_calls",
Help: "RPC call distributions.",
},
[]string{"service"},
),
}

reg.MustRegister(m.rpcDurations)
reg.MustRegister(m.rpcDurationsHistogram)
//Registering the counter vec
reg.MustRegister(m.rpcRequests)
//Registing the gauge vec
reg.MustRegister(m.activeRpcs)
return m
}

Expand Down
Loading