Skip to content

Commit

Permalink
Upgrade dskit and remove dependency on weaveworks/common (#10220)
Browse files Browse the repository at this point in the history
**What this PR does / why we need it**:

This PR upgrades `github.com/grafana/dskit` removes Loki's dependency on
`github.com/weaveworks/common`.

The changes in dskit, apart from the migration
(grafana/dskit#356), are:

* grafana/dskit#347 
* grafana/dskit#349, which required small
changes in `pkg/canary/reader/reader.go` and `pkg/canary/writer/push.go`
* grafana/dskit#352
* grafana/dskit#354

**Which issue(s) this PR fixes**:

(none)

**Special notes for your reviewer**:

**Checklist**
- [x] Reviewed the
[`CONTRIBUTING.md`](https://github.com/grafana/loki/blob/main/CONTRIBUTING.md)
guide (**required**)
- [n/a] Documentation added
- [n/a] Tests updated
- [n/a] `CHANGELOG.md` updated
- [n/a] If the change is worth mentioning in the release notes, add
`add-to-release-notes` label
- [n/a] Changes that require user attention or interaction to upgrade
are documented in `docs/sources/setup/upgrade/_index.md`
- [n/a] For Helm chart changes bump the Helm chart version in
`production/helm/loki/Chart.yaml` and update
`production/helm/loki/CHANGELOG.md` and
`production/helm/loki/README.md`. [Example
PR](d10549e)

---------

Co-authored-by: Michel Hollands <[email protected]>
  • Loading branch information
charleskorn and MichelHollands authored Aug 14, 2023
1 parent 0de80fc commit 8e6a543
Show file tree
Hide file tree
Showing 31 changed files with 855 additions and 555 deletions.
12 changes: 12 additions & 0 deletions docs/sources/configure/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,12 @@ Configures the `server` of the launched module(s).
[tls_min_version: <string> | default = ""]
http_tls_config:
[cert: <string> | default = ""]
[key: <string> | default = ""]
[client_ca: <string> | default = ""]
# HTTP server cert path.
# CLI flag: -server.http-tls-cert-path
[cert_file: <string> | default = ""]
Expand All @@ -282,6 +288,12 @@ http_tls_config:
[client_ca_file: <string> | default = ""]
grpc_tls_config:
[cert: <string> | default = ""]
[key: <string> | default = ""]
[client_ca: <string> | default = ""]
# GRPC TLS server cert path.
# CLI flag: -server.grpc-tls-cert-path
[cert_file: <string> | default = ""]
Expand Down
11 changes: 5 additions & 6 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ require (
github.com/Workiva/go-datastructures v1.1.0
github.com/alicebob/miniredis/v2 v2.30.4
github.com/aliyun/aliyun-oss-go-sdk v2.2.7+incompatible
github.com/aws/aws-sdk-go v1.44.315
github.com/aws/aws-sdk-go v1.44.321
github.com/baidubce/bce-sdk-go v0.9.141
github.com/bmatcuk/doublestar v1.3.4
github.com/buger/jsonparser v1.1.1
Expand Down Expand Up @@ -49,7 +49,7 @@ require (
github.com/gorilla/mux v1.8.0
github.com/gorilla/websocket v1.5.0
github.com/grafana/cloudflare-go v0.0.0-20230110200409-c627cf6792f2
github.com/grafana/dskit v0.0.0-20230804003603-740f56bd2934
github.com/grafana/dskit v0.0.0-20230811062909-a2c425ae7975
github.com/grafana/go-gelf/v2 v2.0.1
github.com/grafana/gomemcache v0.0.0-20230316202710-a081dae0aba9
github.com/grafana/regexp v0.0.0-20221122212121-6b5c0a4cb7fd
Expand Down Expand Up @@ -84,7 +84,7 @@ require (
github.com/pkg/errors v0.9.1
github.com/prometheus/client_golang v1.16.0
github.com/prometheus/client_model v0.4.0
github.com/prometheus/common v0.43.0
github.com/prometheus/common v0.44.0
github.com/prometheus/prometheus v0.43.1-0.20230419161410-69155c6ba1e9
github.com/segmentio/fasthash v1.0.3
github.com/shurcooL/httpfs v0.0.0-20190707220628-8d4bc4ba7749
Expand All @@ -94,14 +94,13 @@ require (
github.com/stretchr/testify v1.8.2
github.com/tonistiigi/fifo v0.0.0-20190226154929-a9fb20d87448
github.com/uber/jaeger-client-go v2.30.0+incompatible
github.com/weaveworks/common v0.0.0-20230511094633-334485600903
github.com/xdg-go/scram v1.1.2
go.etcd.io/bbolt v1.3.6
go.uber.org/atomic v1.11.0
go.uber.org/goleak v1.2.1
golang.org/x/crypto v0.11.0
golang.org/x/net v0.12.0
golang.org/x/sync v0.2.0
golang.org/x/sync v0.3.0
golang.org/x/sys v0.10.0
golang.org/x/time v0.3.0
google.golang.org/api v0.126.0
Expand Down Expand Up @@ -271,7 +270,7 @@ require (
github.com/oschwald/maxminddb-golang v1.10.0 // indirect
github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/prometheus/exporter-toolkit v0.9.1 // indirect
github.com/prometheus/exporter-toolkit v0.10.1-0.20230714054209-2f4150c63f97 // indirect
github.com/prometheus/procfs v0.10.1 // indirect
github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect
github.com/rootless-containers/rootlesskit v1.1.0 // indirect
Expand Down
46 changes: 10 additions & 36 deletions go.sum

Large diffs are not rendered by default.

7 changes: 6 additions & 1 deletion pkg/canary/reader/reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,12 @@ func NewReader(writer io.Writer,
httpClient := http.DefaultClient
if tlsConfig != nil && (certFile != "" || keyFile != "" || caFile != "") {
// For the mTLS case, use a http.Client configured with the client side certificates.
rt, err := config.NewTLSRoundTripper(tlsConfig, caFile, certFile, keyFile, func(tls *tls.Config) (http.RoundTripper, error) {
tlsSettings := config.TLSRoundTripperSettings{
CAFile: caFile,
CertFile: certFile,
KeyFile: keyFile,
}
rt, err := config.NewTLSRoundTripper(tlsConfig, tlsSettings, func(tls *tls.Config) (http.RoundTripper, error) {
return &http.Transport{TLSClientConfig: tls}, nil
})
if err != nil {
Expand Down
7 changes: 6 additions & 1 deletion pkg/canary/writer/push.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,12 @@ func NewPush(

// setup tls transport
if tlsCfg != nil {
rt, err := config.NewTLSRoundTripper(tlsCfg, caFile, certFile, keyFile, func(tls *tls.Config) (http.RoundTripper, error) {
tlsSettings := config.TLSRoundTripperSettings{
CAFile: caFile,
CertFile: certFile,
KeyFile: keyFile,
}
rt, err := config.NewTLSRoundTripper(tlsCfg, tlsSettings, func(tls *tls.Config) (http.RoundTripper, error) {
return &http.Transport{TLSClientConfig: tls}, nil
})
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion pkg/storage/chunk/client/aws/dynamodb_storage_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ import (
"github.com/aws/aws-sdk-go/service/dynamodb"
"github.com/aws/aws-sdk-go/service/dynamodb/dynamodbiface"
"github.com/go-kit/log/level"
awscommon "github.com/grafana/dskit/aws"
"github.com/grafana/dskit/backoff"
"github.com/grafana/dskit/flagext"
"github.com/grafana/dskit/instrument"
ot "github.com/opentracing/opentracing-go"
otlog "github.com/opentracing/opentracing-go/log"
"github.com/pkg/errors"
"github.com/prometheus/client_golang/prometheus"
awscommon "github.com/weaveworks/common/aws"
"golang.org/x/time/rate"

"github.com/grafana/loki/pkg/storage/chunk"
Expand Down
2 changes: 1 addition & 1 deletion pkg/storage/chunk/client/aws/s3_storage_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ import (
v4 "github.com/aws/aws-sdk-go/aws/signer/v4"
"github.com/aws/aws-sdk-go/service/s3"
"github.com/aws/aws-sdk-go/service/s3/s3iface"
awscommon "github.com/grafana/dskit/aws"
"github.com/grafana/dskit/backoff"
"github.com/grafana/dskit/flagext"
"github.com/grafana/dskit/instrument"
"github.com/minio/minio-go/v7/pkg/signer"
"github.com/pkg/errors"
"github.com/prometheus/client_golang/prometheus"
awscommon "github.com/weaveworks/common/aws"

bucket_s3 "github.com/grafana/loki/pkg/storage/bucket/s3"
"github.com/grafana/loki/pkg/storage/chunk/client"
Expand Down
2 changes: 1 addition & 1 deletion pkg/storage/stores/composite_store_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ import (

"github.com/grafana/loki/pkg/logproto"

"github.com/grafana/dskit/test"
"github.com/prometheus/common/model"
"github.com/prometheus/prometheus/model/labels"
"github.com/stretchr/testify/require"
"github.com/weaveworks/common/test"

"github.com/grafana/loki/pkg/storage/chunk"
"github.com/grafana/loki/pkg/storage/chunk/fetcher"
Expand Down
2 changes: 1 addition & 1 deletion pkg/storage/stores/series/series_store_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ import (

"github.com/go-kit/log"
"github.com/grafana/dskit/flagext"
"github.com/grafana/dskit/test"
"github.com/grafana/dskit/user"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/common/model"
"github.com/prometheus/prometheus/model/labels"
"github.com/prometheus/prometheus/promql/parser"
"github.com/stretchr/testify/require"
"github.com/weaveworks/common/test"

"github.com/grafana/loki/pkg/ingester/client"
"github.com/grafana/loki/pkg/logqlmodel/stats"
Expand Down
81 changes: 81 additions & 0 deletions vendor/github.com/aws/aws-sdk-go/aws/endpoints/defaults.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion vendor/github.com/aws/aws-sdk-go/aws/version.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 8e6a543

Please sign in to comment.