Skip to content

Commit

Permalink
Add logging for prometheus operator in TargetAllocator's config gener…
Browse files Browse the repository at this point in the history
…ator (open-telemetry#2329)

* add logging for prometheus operator

* adding yaml for changelog

* Adding tracking issue
  • Loading branch information
rashmichandrashekar authored Nov 14, 2023
1 parent 86b57da commit 3d16cee
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
16 changes: 16 additions & 0 deletions .chloggen/target-allocator-prometheus-operator-logging.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
change_type: enhancement

# The name of the component, or a single word describing the area of concern, (e.g. operator, target allocator, github action)
component: target allocator

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: Add logging for prometheus operator in TargetAllocator's config generator

# One or more tracking issues related to the change
issues: [2348]

# (Optional) One or more lines of additional information to render under the primary note.
# These lines will be padded with 2 spaces and then inserted directly into the document.
# Use pipe (|) for multiline entries.
subtext:
6 changes: 5 additions & 1 deletion cmd/otel-allocator/watcher/promOperator.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,11 @@ package watcher
import (
"context"
"fmt"
"os"
"time"

"github.com/go-kit/log"
"github.com/go-kit/log/level"
"github.com/go-logr/logr"
monitoringv1 "github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/v1"
promv1alpha1 "github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/v1alpha1"
Expand Down Expand Up @@ -67,7 +69,9 @@ func NewPrometheusCRWatcher(logger logr.Logger, cfg allocatorconfig.Config) (*Pr
},
}

generator, err := prometheus.NewConfigGenerator(log.NewNopLogger(), prom, true) // TODO replace Nop?
promOperatorLogger := level.NewFilter(log.NewLogfmtLogger(os.Stderr), level.AllowWarn())
generator, err := prometheus.NewConfigGenerator(promOperatorLogger, prom, true)

if err != nil {
return nil, err
}
Expand Down

0 comments on commit 3d16cee

Please sign in to comment.