Skip to content

Commit fbf0a31

Browse files
committed
export NewAggate public
This allows users to construct their own main(). This is useful for constructing your own webserver setup for adding features such as api signing.
1 parent 0f34684 commit fbf0a31

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

cmd/prom-aggregation-gateway/main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ type aggate struct {
170170
families map[string]*dto.MetricFamily
171171
}
172172

173-
func newAggate() *aggate {
173+
func NewAggate() *aggate {
174174
return &aggate{
175175
families: map[string]*dto.MetricFamily{},
176176
}
@@ -284,7 +284,7 @@ func main() {
284284
labelQueryParam := flag.String("label-query-param", "", "Append labels to metrics from query parameters <label-query-param>=<label-key>:<label-value>")
285285
flag.Parse()
286286

287-
a := newAggate()
287+
a := NewAggate()
288288
http.HandleFunc("/metrics", a.handler)
289289
http.HandleFunc("/api/ui/metrics", func(w http.ResponseWriter, r *http.Request) {
290290
w.Header().Set("Access-Control-Allow-Origin", *cors)

cmd/prom-aggregation-gateway/main_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ func TestAggate(t *testing.T) {
198198
{duplicateLabels, "", "", fmt.Errorf("%s", duplicateError), nil},
199199
{reorderedLabels1, reorderedLabels2, reorderedLabelsResult, nil, nil},
200200
} {
201-
a := newAggate()
201+
a := NewAggate()
202202

203203
if err := a.parseAndMerge(strings.NewReader(c.a), url.Values{}, ""); err != nil {
204204
if c.err1 == nil {
@@ -242,7 +242,7 @@ func TestAggateWithServerLabels(t *testing.T) {
242242
{duplicateLabels, "", "", fmt.Errorf("%s", duplicateErrorWithServerLabels), nil},
243243
{reorderedLabels1, reorderedLabels2, reorderedLabelsResultWithServerLabels, nil, nil},
244244
} {
245-
a := newAggate()
245+
a := NewAggate()
246246

247247
query := url.Values{}
248248
query.Add("_label", "appversion:3.2")

0 commit comments

Comments
 (0)