change struct name

This commit is contained in:
William Banfield
2022-05-11 09:56:28 -04:00
parent f3550cea47
commit 7947e9ea5f
2 changed files with 8 additions and 8 deletions
@@ -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"},
},