Skip to content
Merged
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
11 changes: 6 additions & 5 deletions metrics/prometheus_defs.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,16 @@ var (
muxSessionLabels...)

// Mux Manager

muxManagerLabels = []string{"addr", "mode", "config_name"}
MuxErrors = DefaultCounterVec("mux_errors", "Number of errors observed from mux", append(muxManagerLabels, "error")...)
MuxConnectionEstablish = DefaultCounterVec("mux_connection_establish", "Number of times mux has established", muxManagerLabels...)
MuxDialFailed = DefaultCounterVec("mux_dial_failed", "Mux failed when dialing", muxManagerLabels...)
MuxDialSuccess = DefaultCounterVec("mux_dial_success", "Mux succeeded on dial", muxManagerLabels...)
MuxServerDisconnected = DefaultCounterVec("mux_server_disconnected", "Mux server disconnected", muxManagerLabels...)
NumMuxesActive = DefaultGaugeVec("num_muxes_active", "Host-local number of active muxes for config", muxManagerLabels...)

// Connection provider
ReceiverError = DefaultCounterVec("receiver_error", "Number of errors observed from connection receiver", append(muxManagerLabels, "error")...)
EstablisherError = DefaultCounterVec("establisher_error", "Number of errors observed from connection establisher", muxManagerLabels...)

// Translation interceptor

translationLabels = []string{"kind", "message_type"}
Expand Down Expand Up @@ -128,9 +129,9 @@ func init() {

// Mux Manager
prometheus.MustRegister(MuxErrors)
prometheus.MustRegister(ReceiverError)
prometheus.MustRegister(MuxConnectionEstablish)
prometheus.MustRegister(MuxDialFailed)
prometheus.MustRegister(MuxDialSuccess)
prometheus.MustRegister(EstablisherError)
prometheus.MustRegister(MuxServerDisconnected)
prometheus.MustRegister(NumMuxesActive)

Expand Down
8 changes: 4 additions & 4 deletions transport/mux/establisher.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,7 @@ func NewMuxEstablisherProvider(lifetime context.Context, name string, transportF
return yamux.Client(conn, cfg)
}
// pre-initialize the MuxDial metrics
metrics.MuxDialFailed.WithLabelValues(metricLabels...)
metrics.MuxDialSuccess.WithLabelValues(metricLabels...)
metrics.EstablisherError.WithLabelValues(metricLabels...)
return NewMuxProvider(lifetime, name, connPv, sessionFn, connectionsCapacity, transportFn, metricLabels, logger), nil
}

Expand All @@ -100,16 +99,17 @@ func (p *establishingConnProvider) NewConnection() (net.Conn, error) {
p.logger.Info("mux client failed to dial", tag.Error(err))
return true
}

if err := backoff.ThrottleRetry(dialFn, retryPolicy, retryable); err != nil {
if p.lifetime.Err() != nil {
// shutting down, just exit
return nil, p.lifetime.Err()
}
p.logger.Error("mux client failed to dial with retry", tag.Error(err))
metrics.MuxDialFailed.WithLabelValues(p.metricLabels...).Inc()
metrics.EstablisherError.WithLabelValues(p.metricLabels...).Inc()
return nil, err
}
metrics.MuxDialSuccess.WithLabelValues(p.metricLabels...).Inc()
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

this dups with MuxConnectionEstablish


return client, nil
}

Expand Down
4 changes: 2 additions & 2 deletions transport/mux/receiver.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ func (r *receivingConnProvider) NewConnection() (net.Conn, error) {
}
if err != nil {
r.logger.Fatal("listener.Accept failed", tag.Error(err))
metrics.MuxErrors.WithLabelValues(append(r.metricLabels, classifyError(err))...).Inc()
metrics.ReceiverError.WithLabelValues(append(r.metricLabels, classifyError(err))...).Inc()
return nil, err
}
r.logger.Info("Accept new connection", tag.NewStringTag("remoteAddr", conn.RemoteAddr().String()))
Expand All @@ -98,7 +98,7 @@ func classifyError(err error) string {
if err == io.EOF {
return "eof"
} else {
return "unclassified error"
return "unknown"
}
}

Expand Down
Loading