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

[V2] refactor(agent): channel capacity as histogram #429

Open
wants to merge 1 commit into
base: v2
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
5 changes: 4 additions & 1 deletion agent/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -696,7 +696,10 @@ func (a *agentImpl) reportChannelSize() {
}
for _, mr := range a.metricsReporters {
if err := mr.ReportGauge(metrics.ChannelCapacity, map[string]string{"channel": "agent_chsend"}, float64(chSendCapacity)); err != nil {
logger.Log.Warnf("failed to report chSend channel capaacity: %s", err.Error())
logger.Log.Warnf("failed to report gauge chSend channel capacity: %s", err.Error())
}
if err := mr.ReportHistogram(metrics.ChannelCapacityHistogram, map[string]string{"channel": "agent_chsend"}, float64(chSendCapacity)); err != nil {
logger.Log.Warnf("failed to report histogram chSend channel capacity: %s", err.Error())
}
}
}
3 changes: 3 additions & 0 deletions metrics/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ var (
// CountServers counts the number of servers of different types
CountServers = "count_servers"
// ChannelCapacity represents the capacity of a channel (available slots)
// Deprecated: This variable will be removed in future versions. Use ChannelCapacityHistogram instead.
ChannelCapacity = "channel_capacity"
// ChannelCapacityHistogram represents the capacity of a channel as a histogram (distribution of available slots)
ChannelCapacityHistogram = "channel_capacity_histogram"
// DroppedMessages reports the number of dropped messages in rpc server (messages that will not be handled)
DroppedMessages = "dropped_messages"
// ProcessDelay reports the message processing delay to handle the messages at the handler service
Expand Down
11 changes: 11 additions & 0 deletions metrics/prometheus_reporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,17 @@ func (p *PrometheusReporter) registerMetrics(
append([]string{"channel"}, additionalLabelsKeys...),
)

p.histogramReportersMap[ChannelCapacityHistogram] = prometheus.NewHistogramVec(
prometheus.HistogramOpts{
Namespace: "pitaya",
Subsystem: "channel",
Name: ChannelCapacityHistogram,
Help: "the available capacity of the channel",
Buckets: []float64{0, 1, 10, 50, 100, 250, 500, 750, 1000, 1500, 2000, 3000, 4000, 5000},
ConstLabels: constLabels,
},
append([]string{"channel"}, additionalLabelsKeys...),

p.gaugeReportersMap[DroppedMessages] = prometheus.NewGaugeVec(
prometheus.GaugeOpts{
Namespace: "pitaya",
Expand Down