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

Add abstract build method to MetricSnapshot.Builder #969

Merged
merged 1 commit into from
Sep 7, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ public Builder dataPoint(CounterDataPointSnapshot dataPoint) {
return this;
}

@Override
public CounterSnapshot build() {
return new CounterSnapshot(buildMetadata(), dataPoints);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,13 +118,14 @@ private Builder() {
}

/**
* Add a data point. This can be alled multiple times to add multiple data points.
* Add a data point. This can be called multiple times to add multiple data points.
*/
public Builder dataPoint(GaugeDataPointSnapshot dataPoint) {
dataPoints.add(dataPoint);
return this;
}

@Override
public GaugeSnapshot build() {
return new GaugeSnapshot(buildMetadata(), dataPoints);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,7 @@ public Builder gaugeHistogram(boolean isGaugeHistogram) {
return this;
}

@Override
public HistogramSnapshot build() {
return new HistogramSnapshot(isGaugeHistogram, buildMetadata(), dataPoints);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ public Builder unit(Unit unit) {
throw new IllegalArgumentException("Info metric cannot have a unit.");
}

@Override
public InfoSnapshot build() {
return new InfoSnapshot(buildMetadata(), dataPoints);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ public T unit(Unit unit) {
return self();
}

public abstract MetricSnapshot build();

protected MetricMetadata buildMetadata() {
return new MetricMetadata(name, help, unit);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,7 @@ public Builder unit(Unit unit) {
throw new IllegalArgumentException("StateSet metric cannot have a unit.");
}

@Override
public StateSetSnapshot build() {
return new StateSetSnapshot(buildMetadata(), dataPoints);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ public Builder dataPoint(SummaryDataPointSnapshot data) {
return this;
}

@Override
public SummarySnapshot build() {
return new SummarySnapshot(buildMetadata(), dataPoints);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ public Builder dataPoint(UnknownDataPointSnapshot data) {
return this;
}

@Override
public UnknownSnapshot build() {
return new UnknownSnapshot(buildMetadata(), dataPoints);
}
Expand Down