Skip to content

Commit

Permalink
Ditch use of slog for now (until prebid#4103).
Browse files Browse the repository at this point in the history
  • Loading branch information
scr-oath committed Dec 13, 2024
1 parent 41526ab commit 360eab9
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions metrics/config/metrics.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package config

import (
"log/slog"
"time"

"github.com/golang/glog"
"github.com/prebid/prebid-server/v3/config"
"github.com/prebid/prebid-server/v3/metrics"
"github.com/prebid/prebid-server/v3/metrics/opentelemetry"
Expand Down Expand Up @@ -48,7 +48,7 @@ func NewMetricsEngine(cfg *config.Configuration, adapterList []openrtb_ext.Bidde
if cfg.Metrics.Otel.Enabled {
otelEngine, err := opentelemetry.NewEngine(cfg.Metrics.Otel.Prefix, &cfg.Metrics.Disabled)
if err != nil {
slog.Error("error creating otel engine", "err", err.Error())
glog.Error("error creating otel engine: %v", err)
}
engineList = append(engineList, otelEngine)
}
Expand Down
6 changes: 3 additions & 3 deletions metrics/opentelemetry/engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ package opentelemetry

import (
"context"
"log/slog"
"strings"
"time"

"github.com/golang/glog"
"github.com/prebid/prebid-server/v3/config"
"github.com/prebid/prebid-server/v3/metrics"
"github.com/prebid/prebid-server/v3/openrtb_ext"
Expand Down Expand Up @@ -401,7 +401,7 @@ func (o *PbsMetricsEngine) RecordStoredDataFetchTime(labels metrics.StoredDataLa
case metrics.ResponseDataType:
histogramPtr = &o.StoredResponsesFetchTime
default:
slog.DebugContext(ctx, "unknown data type", "dataType", labels.DataType)
glog.Error("unknown data type: %v", labels.DataType)
return
}
// Record the chosen histogram
Expand All @@ -427,7 +427,7 @@ func (o *PbsMetricsEngine) RecordStoredDataError(labels metrics.StoredDataLabels
case metrics.ResponseDataType:
counterPtr = &o.StoredResponsesErrors
default:
slog.DebugContext(ctx, "unknown data type", "dataType", labels.DataType)
glog.Error(ctx, "unknown data type: %v", labels.DataType)
return
}
// Record the chosen histogram
Expand Down
8 changes: 4 additions & 4 deletions metrics/opentelemetry/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ package opentelemetry
import (
"errors"
"fmt"
"log/slog"
"reflect"
"strconv"
"strings"

"github.com/gobeam/stringy"
"github.com/golang/glog"
"go.opentelemetry.io/otel/metric"
)

Expand Down Expand Up @@ -85,7 +85,7 @@ func HistogramOptions(elem Elem) []metric.HistogramOption {
var err error
for i, s := range floatStrings {
if floats[i], err = strconv.ParseFloat(s, 64); err != nil {
slog.Error("failed to parse bucket boundary", "boundary", s, "err", err.Error())
glog.Error("failed to parse bucket boundary: %s: %v", s, err)
return nil
}
}
Expand Down Expand Up @@ -113,7 +113,7 @@ func InitMetrics(meter metric.Meter, m any, prefix string) error {
// possibly with altered Name or Tags.
func InitMetricElem(meter metric.Meter, elem Elem, prefix string) error {
if elem.Tag.Get("metric") == "-" {
slog.Debug("skipping metric", "name", elem.Name)
glog.Info("skipping metric: %s", elem.Name)
return nil
}
var opts []metric.InstrumentOption
Expand Down Expand Up @@ -142,7 +142,7 @@ func InitMetricElem(meter metric.Meter, elem Elem, prefix string) error {
case "metric.Float64Histogram":
m, err = CreateHistogramMetric(metricName, meter.Float64Histogram, HistogramOptions(elem), opts...)
default:
slog.Warn("unknown metric type; skipping", "type", elem.Value.Type().String())
glog.Error("unknown metric type; skipping: %s", elem.Value.Type().String())
return nil
}
if err != nil {
Expand Down

0 comments on commit 360eab9

Please sign in to comment.