-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
9 changed files
with
108 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,51 @@ | ||
package metrics | ||
|
||
import "github.com/prometheus/client_golang/prometheus" | ||
import ( | ||
"fmt" | ||
|
||
const innerRingSubsystem = "object" | ||
"github.com/prometheus/client_golang/prometheus" | ||
) | ||
|
||
const innerRingNameSpace = "neofs_ir" | ||
|
||
// FIXME: drop after v0.38.0 release: #2347. | ||
const innerRingNameSpaceDeprecated = storageNodeNameSpace | ||
const innerRingSubsystemDeprecated = objectSubsystem | ||
|
||
// InnerRingServiceMetrics contains metrics collected by inner ring. | ||
type InnerRingServiceMetrics struct { | ||
epoch prometheus.Gauge | ||
epoch prometheus.Gauge | ||
epochDeprecated prometheus.Gauge | ||
} | ||
|
||
// NewInnerRingMetrics returns new instance of metrics collectors for inner ring. | ||
func NewInnerRingMetrics() InnerRingServiceMetrics { | ||
var ( | ||
epoch = prometheus.NewGauge(prometheus.GaugeOpts{ | ||
Namespace: namespace, | ||
Subsystem: innerRingSubsystem, | ||
Name: "epoch", | ||
Help: "Current epoch as seen by inner-ring node.", | ||
}) | ||
) | ||
func NewInnerRingMetrics(version string) InnerRingServiceMetrics { | ||
registerVersionMetric(innerRingNameSpace, version) | ||
|
||
epoch := prometheus.NewGauge(prometheus.GaugeOpts{ | ||
Namespace: innerRingNameSpace, | ||
Subsystem: stateSubsystem, | ||
Name: "epoch", | ||
Help: "Current epoch as seen by inner-ring node.", | ||
}) | ||
prometheus.MustRegister(epoch) | ||
|
||
epochDeprecated := prometheus.NewGauge(prometheus.GaugeOpts{ | ||
Namespace: innerRingNameSpaceDeprecated, | ||
Subsystem: innerRingSubsystemDeprecated, | ||
Name: "epoch", | ||
Help: fmt.Sprintf("Current epoch as seen by inner-ring node. DEPRECATED: use [%s_%s_epoch] instead.", innerRingNameSpace, stateSubsystem), | ||
}) | ||
prometheus.MustRegister(epochDeprecated) | ||
|
||
return InnerRingServiceMetrics{ | ||
epoch: epoch, | ||
epoch: epoch, | ||
epochDeprecated: epochDeprecated, | ||
} | ||
} | ||
|
||
// SetEpoch updates epoch metrics. | ||
func (m InnerRingServiceMetrics) SetEpoch(epoch uint64) { | ||
m.epoch.Set(float64(epoch)) | ||
m.epochDeprecated.Set(float64(epoch)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.