Skip to content

Commit

Permalink
Privatize collector struct
Browse files Browse the repository at this point in the history
  • Loading branch information
damemi committed Sep 13, 2022
1 parent b9592fa commit 7edd4e4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion exporters/prometheus/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@

// Package prometheus provides a Prometheus Exporter that converts
// OTLP metrics into the Prometheus exposition format and implements
// prometheus.Collector to provide a handler for these metrics.
// prometheus.collector to provide a handler for these metrics.
package prometheus // import "go.opentelemetry.io/otel/exporters/prometheus"
14 changes: 7 additions & 7 deletions exporters/prometheus/exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ type Exporter struct {
Collector prometheus.Collector
}

// Collector is used to implement prometheus.Collector.
type Collector struct {
// collector is used to implement prometheus.collector.
type collector struct {
metric.Reader
}

Expand All @@ -57,15 +57,15 @@ func NewExporter(options ...Option) Exporter {
reader := metric.NewManualReader()
e := Exporter{
Reader: reader,
Collector: &Collector{
Collector: &collector{
Reader: reader,
},
}
return e
}

// Describe implements prometheus.Collector.
func (c *Collector) Describe(ch chan<- *prometheus.Desc) {
// Describe implements prometheus.collector.
func (c *collector) Describe(ch chan<- *prometheus.Desc) {
metrics, err := c.Reader.Collect(context.TODO())
if err != nil {
otel.Handle(err)
Expand All @@ -75,8 +75,8 @@ func (c *Collector) Describe(ch chan<- *prometheus.Desc) {
}
}

// Collect implements prometheus.Collector.
func (c *Collector) Collect(ch chan<- prometheus.Metric) {
// Collect implements prometheus.collector.
func (c *collector) Collect(ch chan<- prometheus.Metric) {
metrics, err := c.Reader.Collect(context.TODO())
if err != nil {
otel.Handle(err)
Expand Down

0 comments on commit 7edd4e4

Please sign in to comment.