Skip to content
This repository was archived by the owner on May 30, 2024. It is now read-only.

Commit c87aa1c

Browse files
author
Noah Hanjun Lee
authored
Change /metrics into the community edition (#216)
* Add types.go to extract types * Add 'metrics.go' for the community edition
1 parent 44e2ff8 commit c87aa1c

File tree

3 files changed

+35
-9
lines changed

3 files changed

+35
-9
lines changed

internal/server/metrics/metrics.go

+6-9
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
// Copyright 2021 Gitploy.IO Inc. All rights reserved.
2+
// Use of this source code is governed by the Gitploy Non-Commercial License
3+
// that can be found in the LICENSE file.
4+
5+
// +build !oss
6+
17
package metrics
28

39
import (
@@ -19,15 +25,6 @@ const (
1925
)
2026

2127
type (
22-
Metric struct {
23-
prometheusAuthSecret string
24-
}
25-
26-
MetricConfig struct {
27-
Interactor
28-
PrometheusAuthSecret string
29-
}
30-
3128
collector struct {
3229
i Interactor
3330

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// +build oss
2+
3+
package metrics
4+
5+
import (
6+
"net/http"
7+
8+
"github.com/gin-gonic/gin"
9+
)
10+
11+
func NewMetric(c *MetricConfig) *Metric {
12+
return &Metric{}
13+
}
14+
15+
func (m *Metric) CollectMetrics(c *gin.Context) {
16+
c.Status(http.StatusOK)
17+
}

internal/server/metrics/types.go

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package metrics
2+
3+
type (
4+
Metric struct {
5+
prometheusAuthSecret string
6+
}
7+
8+
MetricConfig struct {
9+
Interactor
10+
PrometheusAuthSecret string
11+
}
12+
)

0 commit comments

Comments
 (0)