Skip to content

Commit

Permalink
Update prometheus deps (#1673)
Browse files Browse the repository at this point in the history
Signed-off-by: Bogdan Drutu <[email protected]>
  • Loading branch information
bogdandrutu authored Sep 17, 2020
1 parent e92658a commit 639b9a8
Show file tree
Hide file tree
Showing 7 changed files with 119 additions and 175 deletions.
9 changes: 4 additions & 5 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ require (
github.com/ory/go-acc v0.2.6
github.com/pavius/impi v0.0.3
github.com/prometheus/client_golang v1.7.1
github.com/prometheus/common v0.11.1
github.com/prometheus/prometheus v1.8.2-0.20200626085723-c448ada63d83
github.com/prometheus/common v0.13.0
github.com/prometheus/prometheus v1.8.2-0.20200827201422-1195cc24e3c8
github.com/rs/cors v1.7.0
github.com/securego/gosec/v2 v2.4.0
github.com/shirou/gopsutil v2.20.6+incompatible
Expand All @@ -56,10 +56,9 @@ require (
go.uber.org/atomic v1.6.0
go.uber.org/zap v1.16.0
golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d
golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae
golang.org/x/sys v0.0.0-20200821140526-fda516888d29
golang.org/x/text v0.3.3
google.golang.org/api v0.29.0 // indirect
google.golang.org/genproto v0.0.0-20200624020401-64a14ca9d1ad
google.golang.org/genproto v0.0.0-20200815001618-f69a88009b70
google.golang.org/grpc v1.32.0
google.golang.org/grpc/examples v0.0.0-20200728065043-dfc0c05b2da9 // indirect
google.golang.org/protobuf v1.25.0
Expand Down
250 changes: 97 additions & 153 deletions go.sum

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion receiver/prometheusreceiver/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
"testing"
"time"

"github.com/prometheus/prometheus/discovery/kubernetes"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

Expand Down Expand Up @@ -104,7 +105,7 @@ func TestLoadConfigK8s(t *testing.T) {
})

scrapeConfig := r.PrometheusConfig.ScrapeConfigs[0]
kubeSDConfig := scrapeConfig.ServiceDiscoveryConfig.KubernetesSDConfigs[0]
kubeSDConfig := scrapeConfig.ServiceDiscoveryConfigs[0].(*kubernetes.SDConfig)
assert.Equal(t,
kubeSDConfig.Selectors[0].Field,
fmt.Sprintf("spec.nodeName=%s", node))
Expand Down
2 changes: 1 addition & 1 deletion receiver/prometheusreceiver/internal/ocastore.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ func (o *ocaStore) SetScrapeManager(scrapeManager *scrape.Manager) {
}
}

func (o *ocaStore) Appender() storage.Appender {
func (o *ocaStore) Appender(context.Context) storage.Appender {
state := atomic.LoadInt32(&o.running)
if state == runningStateReady {
return newTransaction(o.ctx, o.jobsMap, o.useStartTimeMetric, o.startTimeMetricRegex, o.receiverName, o.mc, o.sink, o.logger)
Expand Down
4 changes: 2 additions & 2 deletions receiver/prometheusreceiver/internal/ocastore_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ func TestOcaStore(t *testing.T) {
o := NewOcaStore(context.Background(), nil, nil, nil, false, "", "prometheus")
o.SetScrapeManager(&scrape.Manager{})

app := o.Appender()
app := o.Appender(context.Background())
require.NotNil(t, app, "Expecting app")

_ = o.Close()

app = o.Appender()
app = o.Appender(context.Background())
assert.Equal(t, noop, app)
}

Expand Down
5 changes: 2 additions & 3 deletions receiver/prometheusreceiver/metrics_receiver.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import (
"time"

"github.com/prometheus/prometheus/discovery"
sdconfig "github.com/prometheus/prometheus/discovery/config"
"github.com/prometheus/prometheus/scrape"
"go.uber.org/zap"

Expand Down Expand Up @@ -93,9 +92,9 @@ func (pr *pReceiver) Start(_ context.Context, host component.Host) error {
// By this point we've given time to the scrape manager
// to start applying its original configuration.

discoveryCfg := make(map[string]sdconfig.ServiceDiscoveryConfig)
discoveryCfg := make(map[string]discovery.Configs)
for _, scrapeConfig := range pr.cfg.PrometheusConfig.ScrapeConfigs {
discoveryCfg[scrapeConfig.JobName] = scrapeConfig.ServiceDiscoveryConfig
discoveryCfg[scrapeConfig.JobName] = scrapeConfig.ServiceDiscoveryConfigs
}

// Now trigger the discovery notification to the scrape manager.
Expand Down
21 changes: 11 additions & 10 deletions testbed/testbed/receivers.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ import (

"github.com/prometheus/common/model"
"github.com/prometheus/prometheus/config"
sdConfig "github.com/prometheus/prometheus/discovery/config"
"github.com/prometheus/prometheus/discovery/targetgroup"
"github.com/prometheus/prometheus/discovery"
"go.uber.org/zap"

"go.opentelemetry.io/collector/component"
Expand Down Expand Up @@ -324,14 +323,16 @@ func (dr *PrometheusDataReceiver) Start(_ consumer.TraceConsumer, mc consumer.Me
JobName: "testbed-job",
ScrapeInterval: model.Duration(100 * time.Millisecond),
ScrapeTimeout: model.Duration(time.Second),
ServiceDiscoveryConfig: sdConfig.ServiceDiscoveryConfig{
StaticConfigs: []*targetgroup.Group{{
Targets: []model.LabelSet{{
"__address__": model.LabelValue(addr),
"__scheme__": "http",
"__metrics_path__": "/metrics",
}},
}},
ServiceDiscoveryConfigs: discovery.Configs{
&discovery.StaticConfig{
{
Targets: []model.LabelSet{{
"__address__": model.LabelValue(addr),
"__scheme__": "http",
"__metrics_path__": "/metrics",
}},
},
},
},
}},
}
Expand Down

0 comments on commit 639b9a8

Please sign in to comment.