Skip to content

Commit

Permalink
made Metric implement gauge interface
Browse files Browse the repository at this point in the history
  • Loading branch information
maurafortino committed Jun 13, 2023
1 parent 389feaf commit 59e2d1d
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 0 deletions.
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ require (
github.com/miekg/dns v1.1.54
github.com/mitchellh/mapstructure v1.5.0
github.com/prometheus/client_golang v1.15.1
github.com/prometheus/client_model v0.4.0 // indirect
github.com/segmentio/ksuid v1.0.4
github.com/spaolacci/murmur3 v1.1.0 // indirect
github.com/spf13/cast v1.5.1
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1463,6 +1463,8 @@ github.com/prometheus/client_model v0.1.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6T
github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
github.com/prometheus/client_model v0.3.0 h1:UBgGFHqYdG/TPFD1B1ogZywDqEkwp3fBMvqdiQ7Xew4=
github.com/prometheus/client_model v0.3.0/go.mod h1:LDGWKZIo7rky3hgvBe+caln+Dr3dPggB5dvjtD7w9+w=
github.com/prometheus/client_model v0.4.0 h1:5lQXD3cAg1OXBf4Wq03gTrXHeaV0TQvGfUooCfx1yqY=
github.com/prometheus/client_model v0.4.0/go.mod h1:oMQmHW1/JoDwqLtg57MGgP/Fb1CJEYF2imWWhWtMkYU=
github.com/prometheus/common v0.0.0-20181113130724-41aa239b4cce/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro=
github.com/prometheus/common v0.0.0-20181126121408-4724e9255275/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro=
github.com/prometheus/common v0.2.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4=
Expand Down
42 changes: 42 additions & 0 deletions xmetrics/metric.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"time"

"github.com/prometheus/client_golang/prometheus"
dto "github.com/prometheus/client_model/go"
"github.com/xmidt-org/sallust"
"go.uber.org/zap"
)
Expand Down Expand Up @@ -139,6 +140,47 @@ func NewCollector(m Metric) (prometheus.Collector, error) {
return nil, fmt.Errorf("Unsupported metric type: %s", m.Type)
}
}
func (m Metric) Describe(chan<- *prometheus.Desc) {

}

func (m Metric) Collect(chan<- prometheus.Metric) {

}

func (m Metric) Desc() *prometheus.Desc {
return prometheus.NewDesc(m.Name, m.Name, []string{}, prometheus.Labels{})
}

func (m Metric) Write(*dto.Metric) error {
var err error

return err
}

func (m Metric) Set(float64) {

}

func (m Metric) Inc() {

}

func (m Metric) Dec() {

}

func (m Metric) Add(float64) {

}

func (m Metric) Sub(float64) {

}

func (m Metric) SetToCurrentTime() {

}

// Merger is the strategy for merging metrics from various sources. It applies a configurable default
// namespace and subsystem to each metric. This type implements a Fluent Interface which tracks the first
Expand Down

0 comments on commit 59e2d1d

Please sign in to comment.