Skip to content

Commit

Permalink
review feedback
Browse files Browse the repository at this point in the history
Signed-off-by: Goutham <gouthamve@gmail.com>
  • Loading branch information
gouthamve committed Apr 24, 2024
1 parent f3168b9 commit 10c14b1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 19 deletions.
18 changes: 6 additions & 12 deletions exporters/autoexport/metrics.go
Expand Up @@ -101,10 +101,8 @@ func init() {
return nil, err
}
readerOpts := []metric.PeriodicReaderOption{}
if len(producers) > 0 {
for _, producer := range producers {
readerOpts = append(readerOpts, metric.WithProducer(producer))
}
for _, producer := range producers {
readerOpts = append(readerOpts, metric.WithProducer(producer))
}

proto := os.Getenv(otelExporterOTLPProtoEnvKey)
Expand Down Expand Up @@ -135,10 +133,8 @@ func init() {
return nil, err
}
readerOpts := []metric.PeriodicReaderOption{}
if len(producers) > 0 {
for _, producer := range producers {
readerOpts = append(readerOpts, metric.WithProducer(producer))
}
for _, producer := range producers {
readerOpts = append(readerOpts, metric.WithProducer(producer))
}

r, err := stdoutmetric.New()
Expand All @@ -163,10 +159,8 @@ func init() {
if err != nil {
return nil, err
}
if len(producers) > 0 {
for _, producer := range producers {
exporterOpts = append(exporterOpts, promexporter.WithProducer(producer))
}
for _, producer := range producers {
exporterOpts = append(exporterOpts, promexporter.WithProducer(producer))
}

reader, err := promexporter.New(exporterOpts...)
Expand Down
7 changes: 0 additions & 7 deletions exporters/autoexport/noop.go
Expand Up @@ -57,10 +57,3 @@ func (e noopMetricProducer) Produce(ctx context.Context) ([]metricdata.ScopeMetr
func newNoopMetricProducer() noopMetricProducer {
return noopMetricProducer{}
}

// IsNoneMetricReader returns true for the exporter returned by [NewMetricReader]
// when OTEL_METRICS_PRODUCERS environment variable is set to "none".
func IsNoneMetricProducer(e metric.Producer) bool {
_, ok := e.(noopMetricProducer)
return ok
}

0 comments on commit 10c14b1

Please sign in to comment.