mirror of
https://github.com/tendermint/tendermint.git
synced 2026-08-27 19:37:08 +00:00
change struct name
This commit is contained in:
@@ -68,18 +68,18 @@ func main() {
|
||||
|
||||
// MetricsDiffFromReaders parses the metrics present in the readers a and b and
|
||||
// determines which metrics were added and removed in b.
|
||||
func MetricsDiffFromReaders(a, b io.Reader) (MetricsDiff, error) {
|
||||
func MetricsDiffFromReaders(a, b io.Reader) (Diff, error) {
|
||||
parser := expfmt.TextParser{}
|
||||
amf, err := parser.TextToMetricFamilies(a)
|
||||
if err != nil {
|
||||
return MetricsDiff{}, err
|
||||
return Diff{}, err
|
||||
}
|
||||
bmf, err := parser.TextToMetricFamilies(b)
|
||||
if err != nil {
|
||||
return MetricsDiff{}, err
|
||||
return Diff{}, err
|
||||
}
|
||||
|
||||
md := MetricsDiff{}
|
||||
md := Diff{}
|
||||
for name, afamily := range amf {
|
||||
bfamily, ok := bmf[name]
|
||||
if !ok {
|
||||
@@ -127,7 +127,7 @@ func toSet(lps []*dto.LabelPair) map[string]struct{} {
|
||||
return m
|
||||
}
|
||||
|
||||
func (m MetricsDiff) String() string {
|
||||
func (m Diff) String() string {
|
||||
var s string
|
||||
if len(m.Adds) > 0 {
|
||||
s += "Adds: \n"
|
||||
|
||||
@@ -15,7 +15,7 @@ func TestDiff(t *testing.T) {
|
||||
aContents string
|
||||
bContents string
|
||||
|
||||
want metricsdiff.MetricsDiff
|
||||
want metricsdiff.Diff
|
||||
}{
|
||||
{
|
||||
name: "labels",
|
||||
@@ -25,7 +25,7 @@ func TestDiff(t *testing.T) {
|
||||
bContents: `
|
||||
metric_one{label_three="content", label_four="content"} 0
|
||||
`,
|
||||
want: metricsdiff.MetricsDiff{
|
||||
want: metricsdiff.Diff{
|
||||
LabelDiffs: []metricsdiff.LabelDiff{
|
||||
{
|
||||
MetricsName: "metric_one",
|
||||
@@ -43,7 +43,7 @@ func TestDiff(t *testing.T) {
|
||||
bContents: `
|
||||
metric_two{label_two="content"} 0
|
||||
`,
|
||||
want: metricsdiff.MetricsDiff{
|
||||
want: metricsdiff.Diff{
|
||||
Adds: []string{"metric_two"},
|
||||
Removes: []string{"metric_one"},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user