From 796ae69c8686c3ace0465853043f12ac2d0c084b Mon Sep 17 00:00:00 2001 From: Charles Korn Date: Fri, 4 Aug 2023 10:38:34 +1000 Subject: [PATCH] Upgrade dskit to use packages migrated from weaveworks/common See https://github.com/grafana/dskit/pull/342. --- clients/cmd/docker-driver/main.go | 6 +- clients/cmd/fluent-bit/config.go | 6 +- clients/cmd/fluent-bit/config_test.go | 6 +- clients/cmd/fluent-bit/loki.go | 4 +- clients/cmd/fluent-bit/out_grafana_loki.go | 4 +- clients/cmd/promtail/main.go | 6 +- clients/pkg/logentry/stages/drop_test.go | 2 +- .../pkg/logentry/stages/labelallow_test.go | 2 +- clients/pkg/logentry/stages/labeldrop_test.go | 2 +- clients/pkg/logentry/stages/multiline_test.go | 2 +- clients/pkg/logentry/stages/pack_test.go | 2 +- clients/pkg/promtail/promtail_test.go | 2 +- .../pkg/promtail/scrapeconfig/scrapeconfig.go | 2 +- clients/pkg/promtail/server/server.go | 2 +- .../promtail/targets/gcplog/push_target.go | 6 +- .../targets/gcplog/push_target_test.go | 2 +- clients/pkg/promtail/targets/heroku/target.go | 6 +- .../promtail/targets/heroku/target_test.go | 2 +- .../promtail/targets/lokipush/pushtarget.go | 2 +- .../targets/lokipush/pushtarget_test.go | 2 +- .../lokipush/pushtargetmanager_test.go | 2 +- .../promtail/targets/serverutils/config.go | 2 +- .../promtail/targets/windows/target_test.go | 2 +- cmd/logql-analyzer/main.go | 2 +- cmd/loki/main.go | 6 +- cmd/migrate/main.go | 2 +- cmd/querytee/main.go | 6 +- go.mod | 2 +- go.sum | 4 +- integration/client/client.go | 2 +- pkg/canary/comparator/comparator.go | 2 +- pkg/configs/client/client.go | 2 +- pkg/distributor/distributor.go | 4 +- pkg/distributor/distributor_test.go | 4 +- pkg/distributor/http.go | 2 +- pkg/distributor/ratestore.go | 2 +- pkg/distributor/ratestore_metrics.go | 2 +- pkg/ingester/checkpoint_test.go | 2 +- pkg/ingester/client/client.go | 2 +- pkg/ingester/flush.go | 2 +- pkg/ingester/flush_test.go | 2 +- pkg/ingester/ingester_test.go | 6 +- pkg/ingester/instance.go | 2 +- pkg/ingester/recovery_test.go | 2 +- pkg/ingester/stream.go | 2 +- pkg/ingester/stream_test.go | 2 +- pkg/ingester/transfer.go | 2 +- pkg/ingester/transfer_test.go | 2 +- pkg/logcli/client/file.go | 2 +- pkg/logcli/query/query.go | 2 +- pkg/logcli/query/query_test.go | 2 +- pkg/logql/blocker_test.go | 2 +- pkg/logql/downstream_test.go | 2 +- pkg/logql/engine_test.go | 2 +- pkg/logql/metrics_test.go | 2 +- pkg/loki/loki.go | 6 +- pkg/loki/loki_test.go | 2 +- pkg/loki/modules.go | 6 +- .../frontend/transport/handler.go | 4 +- .../frontend/transport/handler_test.go | 2 +- .../frontend/transport/roundtripper.go | 4 +- pkg/lokifrontend/frontend/v1/frontend.go | 2 +- pkg/lokifrontend/frontend/v1/frontend_test.go | 6 +- .../frontend/v1/frontendv1pb/frontend.pb.go | 62 +-- .../frontend/v1/frontendv1pb/frontend.proto | 2 +- pkg/lokifrontend/frontend/v1/queue_test.go | 4 +- pkg/lokifrontend/frontend/v2/frontend.go | 2 +- .../frontend/v2/frontend_scheduler_worker.go | 2 +- pkg/lokifrontend/frontend/v2/frontend_test.go | 4 +- .../frontend/v2/frontendv2pb/frontend.pb.go | 46 +-- .../frontend/v2/frontendv2pb/frontend.proto | 2 +- pkg/push/go.sum | 1 + pkg/querier/http.go | 4 +- pkg/querier/http_test.go | 2 +- pkg/querier/ingester_querier.go | 2 +- pkg/querier/multi_tenant_querier.go | 2 +- pkg/querier/multi_tenant_querier_test.go | 2 +- pkg/querier/querier.go | 2 +- pkg/querier/querier_test.go | 4 +- pkg/querier/queryrange/codec.go | 2 +- pkg/querier/queryrange/downstreamer_test.go | 2 +- .../queryrange/index_stats_cache_test.go | 2 +- pkg/querier/queryrange/limits.go | 4 +- pkg/querier/queryrange/limits_test.go | 2 +- pkg/querier/queryrange/log_result_cache.go | 2 +- .../queryrange/log_result_cache_test.go | 2 +- .../queryrangebase/instrumentation.go | 2 +- .../queryrange/queryrangebase/middleware.go | 2 +- .../queryrangebase/middleware_test.go | 2 +- .../queryrange/queryrangebase/query_range.go | 2 +- .../queryrangebase/query_range_test.go | 4 +- .../queryrangebase/results_cache.go | 4 +- .../queryrangebase/results_cache_test.go | 2 +- .../queryrange/queryrangebase/retry.go | 2 +- .../queryrange/queryrangebase/retry_test.go | 2 +- .../queryrange/queryrangebase/roundtrip.go | 4 +- pkg/querier/queryrange/querysharding.go | 2 +- pkg/querier/queryrange/querysharding_test.go | 2 +- pkg/querier/queryrange/roundtrip.go | 4 +- pkg/querier/queryrange/roundtrip_test.go | 6 +- pkg/querier/queryrange/series_volume.go | 4 +- pkg/querier/queryrange/split_by_interval.go | 2 +- .../queryrange/split_by_interval_test.go | 2 +- pkg/querier/queryrange/split_by_range.go | 2 +- pkg/querier/queryrange/split_by_range_test.go | 2 +- pkg/querier/queryrange/stats.go | 2 +- pkg/querier/stats/stats.go | 2 +- pkg/querier/worker/frontend_processor.go | 2 +- pkg/querier/worker/scheduler_processor.go | 6 +- .../worker/scheduler_processor_test.go | 2 +- pkg/querier/worker/worker.go | 2 +- pkg/querier/worker_service.go | 4 +- pkg/querier/worker_service_test.go | 2 +- pkg/ruler/base/api.go | 2 +- pkg/ruler/base/api_test.go | 2 +- pkg/ruler/base/client_pool_test.go | 2 +- pkg/ruler/base/compat.go | 4 +- pkg/ruler/base/compat_test.go | 2 +- pkg/ruler/base/manager.go | 2 +- pkg/ruler/base/ruler.go | 2 +- pkg/ruler/base/ruler_test.go | 2 +- pkg/ruler/compat.go | 2 +- pkg/ruler/evaluator_remote.go | 8 +- pkg/ruler/evaluator_remote_test.go | 4 +- pkg/ruler/registry.go | 2 +- pkg/ruler/registry_test.go | 2 +- pkg/scheduler/scheduler.go | 6 +- pkg/scheduler/schedulerpb/scheduler.pb.go | 88 ++-- pkg/scheduler/schedulerpb/scheduler.proto | 2 +- pkg/server/internal_server.go | 2 +- pkg/storage/batch_test.go | 2 +- pkg/storage/chunk/cache/instrumented.go | 2 +- pkg/storage/chunk/cache/memcached.go | 2 +- pkg/storage/chunk/chunk.go | 2 +- .../chunk/client/alibaba/oss_object_client.go | 2 +- .../chunk/client/aws/dynamodb_metrics.go | 2 +- .../client/aws/dynamodb_storage_client.go | 2 +- .../chunk/client/aws/dynamodb_table_client.go | 2 +- .../chunk/client/aws/metrics_autoscaling.go | 2 +- .../client/aws/metrics_autoscaling_test.go | 2 +- .../chunk/client/aws/s3_storage_client.go | 2 +- .../chunk/client/azure/blob_storage_client.go | 2 +- .../client/baidubce/bos_storage_client.go | 2 +- .../chunk/client/gcp/instrumentation.go | 2 +- .../client/ibmcloud/cos_object_client.go | 2 +- pkg/storage/chunk/interface.go | 2 +- pkg/storage/chunk/tests/index_client_test.go | 2 +- pkg/storage/config/schema_config.go | 2 +- pkg/storage/hack/main.go | 2 +- pkg/storage/store_test.go | 2 +- pkg/storage/stores/index/index.go | 2 +- .../indexshipper/compactor/client/grpc.go | 4 +- .../deletion/delete_requests_store.go | 2 +- .../deletion/grpc_request_handler_test.go | 4 +- .../deletion/request_handler_test.go | 2 +- .../deletion/tenant_request_handler_test.go | 2 +- .../compactor/retention/util_test.go | 2 +- .../gatewayclient/gateway_client.go | 2 +- .../gatewayclient/gateway_client_test.go | 2 +- .../series/index/caching_index_client_test.go | 2 +- .../stores/series/index/schema_caching.go | 2 +- .../series/index/schema_caching_test.go | 2 +- .../stores/series/index/table_manager.go | 4 +- .../stores/series/index/table_manager_test.go | 2 +- .../stores/series/series_store_test.go | 2 +- .../shipper/index/compactor/util_test.go | 4 +- .../stores/shipper/index/table_test.go | 2 +- .../shipper/indexgateway/gateway_test.go | 2 +- pkg/storage/stores/shipper/metrics.go | 2 +- .../stores/shipper/shipper_index_client.go | 2 +- .../stores/shipper/testutil/testutil.go | 2 +- pkg/util/fakeauth/fake_auth.go | 6 +- pkg/util/httpgrpc/carrier.go | 2 +- pkg/util/httpreq/headers.go | 2 +- pkg/util/httpreq/tags.go | 2 +- pkg/util/instrument/instrument.go | 2 +- pkg/util/instrument/instrument_test.go | 2 +- pkg/util/log/log.go | 9 +- pkg/util/log/log_test.go | 4 +- pkg/util/log/wrappers.go | 2 +- pkg/util/querylimits/middleware.go | 2 +- pkg/util/server/error.go | 4 +- pkg/util/server/error_test.go | 4 +- pkg/util/server/middleware.go | 4 +- pkg/util/server/recovery.go | 4 +- pkg/util/time.go | 2 +- tools/doc-generator/parse/parser.go | 4 +- tools/doc-generator/parse/root_blocks.go | 2 +- .../github.com/grafana/dskit/errors/error.go | 10 + .../github.com/grafana/dskit/flagext/parse.go | 28 ++ .../dskit/grpcclient/instrumentation.go | 3 +- .../grpc => grafana/dskit/grpcutil}/cancel.go | 9 +- .../dskit}/httpgrpc/README.md | 0 .../dskit}/httpgrpc/httpgrpc.go | 4 + .../dskit}/httpgrpc/httpgrpc.pb.go | 114 ++++-- .../dskit}/httpgrpc/httpgrpc.proto | 1 - .../dskit}/httpgrpc/server/server.go | 20 +- .../grafana/dskit/httpgrpc/tools.go | 10 + .../dskit}/instrument/instrument.go | 39 +- .../grafana/dskit/kv/consul/client.go | 3 +- .../grafana/dskit/kv/consul/metrics.go | 3 +- vendor/github.com/grafana/dskit/kv/metrics.go | 5 +- .../logging => grafana/dskit/log}/format.go | 8 +- .../logging => grafana/dskit/log}/global.go | 6 +- .../logging => grafana/dskit/log}/gokit.go | 6 +- .../dskit/log}/interface.go | 6 +- .../logging => grafana/dskit/log}/level.go | 8 +- .../logging => grafana/dskit/log}/logging.go | 6 +- .../logging => grafana/dskit/log}/logrus.go | 6 +- vendor/github.com/grafana/dskit/log/noop.go | 27 ++ .../dskit}/middleware/counting_listener.go | 4 + .../dskit}/middleware/errorhandler.go | 4 + .../dskit}/middleware/grpc_auth.go | 11 +- .../dskit}/middleware/grpc_instrumentation.go | 11 +- .../dskit}/middleware/grpc_logging.go | 28 +- .../dskit}/middleware/grpc_stats.go | 4 + .../dskit}/middleware/header_adder.go | 4 + .../dskit}/middleware/http_auth.go | 6 +- .../dskit}/middleware/http_tracing.go | 4 + .../dskit}/middleware/instrument.go | 17 +- .../dskit}/middleware/logging.go | 56 ++- .../dskit}/middleware/middleware.go | 4 + .../dskit}/middleware/path_rewrite.go | 4 + .../dskit}/middleware/response.go | 10 +- .../dskit}/middleware/source_ips.go | 4 + .../common => grafana/dskit}/mtime/mtime.go | 4 + .../grafana/dskit/ring/client/pool.go | 2 +- .../dskit}/server/fake_server.pb.go | 384 ++++++++++++++++-- .../dskit}/server/fake_server.proto | 2 - .../grafana/dskit/server/metrics.go | 67 +++ .../common => grafana/dskit}/server/server.go | 165 ++++---- .../dskit}/server/tls_config.go | 4 + .../dskit}/signals/signals.go | 14 +- .../grafana/dskit/spanlogger/spanlogger.go | 3 +- .../grafana/dskit/tenant/resolver.go | 2 +- .../github.com/grafana/dskit/tenant/tenant.go | 2 +- .../dskit}/tracing/tracing.go | 4 + .../common => grafana/dskit}/user/grpc.go | 7 +- .../common => grafana/dskit}/user/http.go | 7 +- .../common => grafana/dskit}/user/id.go | 8 +- .../common => grafana/dskit}/user/logging.go | 10 +- .../weaveworks/common/errors/error.go | 6 - .../weaveworks/common/httpgrpc/tools.go | 6 - .../weaveworks/common/logging/noop.go | 23 -- vendor/modules.txt | 24 +- 245 files changed, 1248 insertions(+), 691 deletions(-) create mode 100644 vendor/github.com/grafana/dskit/errors/error.go create mode 100644 vendor/github.com/grafana/dskit/flagext/parse.go rename vendor/github.com/{weaveworks/common/grpc => grafana/dskit/grpcutil}/cancel.go (55%) rename vendor/github.com/{weaveworks/common => grafana/dskit}/httpgrpc/README.md (100%) rename vendor/github.com/{weaveworks/common => grafana/dskit}/httpgrpc/httpgrpc.go (87%) rename vendor/github.com/{weaveworks/common => grafana/dskit}/httpgrpc/httpgrpc.pb.go (89%) rename vendor/github.com/{weaveworks/common => grafana/dskit}/httpgrpc/httpgrpc.proto (92%) rename vendor/github.com/{weaveworks/common => grafana/dskit}/httpgrpc/server/server.go (91%) create mode 100644 vendor/github.com/grafana/dskit/httpgrpc/tools.go rename vendor/github.com/{weaveworks/common => grafana/dskit}/instrument/instrument.go (79%) rename vendor/github.com/{weaveworks/common/logging => grafana/dskit/log}/format.go (83%) rename vendor/github.com/{weaveworks/common/logging => grafana/dskit/log}/global.go (87%) rename vendor/github.com/{weaveworks/common/logging => grafana/dskit/log}/gokit.go (92%) rename vendor/github.com/{weaveworks/common/logging => grafana/dskit/log}/interface.go (76%) rename vendor/github.com/{weaveworks/common/logging => grafana/dskit/log}/level.go (90%) rename vendor/github.com/{weaveworks/common/logging => grafana/dskit/log}/logging.go (76%) rename vendor/github.com/{weaveworks/common/logging => grafana/dskit/log}/logrus.go (86%) create mode 100644 vendor/github.com/grafana/dskit/log/noop.go rename vendor/github.com/{weaveworks/common => grafana/dskit}/middleware/counting_listener.go (82%) rename vendor/github.com/{weaveworks/common => grafana/dskit}/middleware/errorhandler.go (92%) rename vendor/github.com/{weaveworks/common => grafana/dskit}/middleware/grpc_auth.go (85%) rename vendor/github.com/{weaveworks/common => grafana/dskit}/middleware/grpc_instrumentation.go (92%) rename vendor/github.com/{weaveworks/common => grafana/dskit}/middleware/grpc_logging.go (63%) rename vendor/github.com/{weaveworks/common => grafana/dskit}/middleware/grpc_stats.go (91%) rename vendor/github.com/{weaveworks/common => grafana/dskit}/middleware/header_adder.go (71%) rename vendor/github.com/{weaveworks/common => grafana/dskit}/middleware/http_auth.go (66%) rename vendor/github.com/{weaveworks/common => grafana/dskit}/middleware/http_tracing.go (86%) rename vendor/github.com/{weaveworks/common => grafana/dskit}/middleware/instrument.go (87%) rename vendor/github.com/{weaveworks/common => grafana/dskit}/middleware/logging.go (69%) rename vendor/github.com/{weaveworks/common => grafana/dskit}/middleware/middleware.go (81%) rename vendor/github.com/{weaveworks/common => grafana/dskit}/middleware/path_rewrite.go (87%) rename vendor/github.com/{weaveworks/common => grafana/dskit}/middleware/response.go (90%) rename vendor/github.com/{weaveworks/common => grafana/dskit}/middleware/source_ips.go (95%) rename vendor/github.com/{weaveworks/common => grafana/dskit}/mtime/mtime.go (64%) rename vendor/github.com/{weaveworks/common => grafana/dskit}/server/fake_server.pb.go (53%) rename vendor/github.com/{weaveworks/common => grafana/dskit}/server/fake_server.proto (90%) create mode 100644 vendor/github.com/grafana/dskit/server/metrics.go rename vendor/github.com/{weaveworks/common => grafana/dskit}/server/server.go (81%) rename vendor/github.com/{weaveworks/common => grafana/dskit}/server/tls_config.go (87%) rename vendor/github.com/{weaveworks/common => grafana/dskit}/signals/signals.go (78%) rename vendor/github.com/{weaveworks/common => grafana/dskit}/tracing/tracing.go (92%) rename vendor/github.com/{weaveworks/common => grafana/dskit}/user/grpc.go (85%) rename vendor/github.com/{weaveworks/common => grafana/dskit}/user/http.go (91%) rename vendor/github.com/{weaveworks/common => grafana/dskit}/user/id.go (86%) rename vendor/github.com/{weaveworks/common => grafana/dskit}/user/logging.go (50%) delete mode 100644 vendor/github.com/weaveworks/common/errors/error.go delete mode 100644 vendor/github.com/weaveworks/common/httpgrpc/tools.go delete mode 100644 vendor/github.com/weaveworks/common/logging/noop.go diff --git a/clients/cmd/docker-driver/main.go b/clients/cmd/docker-driver/main.go index b2dbf52a18ef7..bff182a39cc7e 100644 --- a/clients/cmd/docker-driver/main.go +++ b/clients/cmd/docker-driver/main.go @@ -9,8 +9,8 @@ import ( "github.com/docker/go-plugins-helpers/sdk" "github.com/go-kit/log" "github.com/go-kit/log/level" + dslog "github.com/grafana/dskit/log" "github.com/prometheus/common/version" - "github.com/weaveworks/common/logging" "github.com/grafana/loki/pkg/util" _ "github.com/grafana/loki/pkg/util/build" @@ -19,7 +19,7 @@ import ( const socketAddress = "/run/docker/plugins/loki.sock" -var logLevel logging.Level +var logLevel dslog.Level func main() { levelVal := os.Getenv("LOG_LEVEL") @@ -51,7 +51,7 @@ func main() { } } -func newLogger(lvl logging.Level) log.Logger { +func newLogger(lvl dslog.Level) log.Logger { // plugin logs must be stdout to appear. logger := log.NewLogfmtLogger(log.NewSyncWriter(os.Stdout)) logger = level.NewFilter(logger, util.LogFilter(lvl.String())) diff --git a/clients/cmd/fluent-bit/config.go b/clients/cmd/fluent-bit/config.go index d8448d5acf907..768ba845a3308 100644 --- a/clients/cmd/fluent-bit/config.go +++ b/clients/cmd/fluent-bit/config.go @@ -10,8 +10,8 @@ import ( "time" "github.com/grafana/dskit/flagext" + "github.com/grafana/dskit/log" "github.com/prometheus/common/model" - "github.com/weaveworks/common/logging" "github.com/grafana/loki/clients/pkg/logentry/logql" "github.com/grafana/loki/clients/pkg/promtail/client" @@ -45,7 +45,7 @@ const ( type config struct { clientConfig client.Config bufferConfig bufferConfig - logLevel logging.Level + logLevel log.Level autoKubernetesLabels bool removeKeys []string labelKeys []string @@ -152,7 +152,7 @@ func parseConfig(cfg ConfigGetter) (*config, error) { if logLevel == "" { logLevel = "info" } - var level logging.Level + var level log.Level if err := level.Set(logLevel); err != nil { return nil, fmt.Errorf("invalid log level: %v", logLevel) } diff --git a/clients/cmd/fluent-bit/config_test.go b/clients/cmd/fluent-bit/config_test.go index 2dd9c0f37e525..0d5ec6d592b0e 100644 --- a/clients/cmd/fluent-bit/config_test.go +++ b/clients/cmd/fluent-bit/config_test.go @@ -9,8 +9,8 @@ import ( "github.com/grafana/dskit/backoff" "github.com/grafana/dskit/flagext" + "github.com/grafana/dskit/log" "github.com/prometheus/common/model" - "github.com/weaveworks/common/logging" "github.com/grafana/loki/clients/pkg/promtail/client" @@ -210,8 +210,8 @@ func mustParseURL(u string) flagext.URLValue { return flagext.URLValue{URL: parsed} } -func mustParseLogLevel(l string) logging.Level { - level := logging.Level{} +func mustParseLogLevel(l string) log.Level { + level := log.Level{} err := level.Set(l) if err != nil { panic(err) diff --git a/clients/cmd/fluent-bit/loki.go b/clients/cmd/fluent-bit/loki.go index 5d1d8f4e8dad5..5dbb7031b63f5 100644 --- a/clients/cmd/fluent-bit/loki.go +++ b/clients/cmd/fluent-bit/loki.go @@ -13,9 +13,9 @@ import ( "github.com/go-kit/log" "github.com/go-kit/log/level" "github.com/go-logfmt/logfmt" + dslog "github.com/grafana/dskit/log" jsoniter "github.com/json-iterator/go" "github.com/prometheus/common/model" - "github.com/weaveworks/common/logging" "github.com/grafana/loki/clients/pkg/promtail/api" "github.com/grafana/loki/clients/pkg/promtail/client" @@ -268,7 +268,7 @@ func (l *loki) createLine(records map[string]interface{}, f format) (string, err } } -func newLogger(logLevel logging.Level) log.Logger { +func newLogger(logLevel dslog.Level) log.Logger { logger := log.NewLogfmtLogger(log.NewSyncWriter(os.Stderr)) logger = level.NewFilter(logger, util.LogFilter(logLevel.String())) logger = log.With(logger, "caller", log.Caller(3)) diff --git a/clients/cmd/fluent-bit/out_grafana_loki.go b/clients/cmd/fluent-bit/out_grafana_loki.go index d40a8c5431eed..38f24c3841a67 100644 --- a/clients/cmd/fluent-bit/out_grafana_loki.go +++ b/clients/cmd/fluent-bit/out_grafana_loki.go @@ -10,8 +10,8 @@ import ( "github.com/fluent/fluent-bit-go/output" "github.com/go-kit/log" "github.com/go-kit/log/level" + dslog "github.com/grafana/dskit/log" "github.com/prometheus/common/version" - "github.com/weaveworks/common/logging" _ "github.com/grafana/loki/pkg/util/build" ) @@ -28,7 +28,7 @@ var ( ) func init() { - var logLevel logging.Level + var logLevel dslog.Level _ = logLevel.Set("info") logger = newLogger(logLevel) } diff --git a/clients/cmd/promtail/main.go b/clients/cmd/promtail/main.go index 5d20460628c81..833677bfb0f0a 100644 --- a/clients/cmd/promtail/main.go +++ b/clients/cmd/promtail/main.go @@ -14,10 +14,10 @@ import ( "github.com/go-kit/log/level" "github.com/grafana/dskit/flagext" + "github.com/grafana/dskit/log" + "github.com/grafana/dskit/tracing" "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/common/version" - "github.com/weaveworks/common/logging" - "github.com/weaveworks/common/tracing" "github.com/grafana/loki/clients/pkg/logentry/stages" "github.com/grafana/loki/clients/pkg/promtail" @@ -102,7 +102,7 @@ func main() { } // Init the logger which will honor the log level set in cfg.Server - if reflect.DeepEqual(&config.Config.ServerConfig.Config.LogLevel, &logging.Level{}) { + if reflect.DeepEqual(&config.Config.ServerConfig.Config.LogLevel, &log.Level{}) { fmt.Println("Invalid log level") exit(1) } diff --git a/clients/pkg/logentry/stages/drop_test.go b/clients/pkg/logentry/stages/drop_test.go index c27af36b98aee..0b094fe70478d 100644 --- a/clients/pkg/logentry/stages/drop_test.go +++ b/clients/pkg/logentry/stages/drop_test.go @@ -6,11 +6,11 @@ import ( "testing" "time" + ww "github.com/grafana/dskit/server" "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/common/model" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - ww "github.com/weaveworks/common/server" util_log "github.com/grafana/loki/pkg/util/log" ) diff --git a/clients/pkg/logentry/stages/labelallow_test.go b/clients/pkg/logentry/stages/labelallow_test.go index c6556e203deae..c968135af8b2f 100644 --- a/clients/pkg/logentry/stages/labelallow_test.go +++ b/clients/pkg/logentry/stages/labelallow_test.go @@ -4,10 +4,10 @@ import ( "testing" "time" + ww "github.com/grafana/dskit/server" "github.com/prometheus/common/model" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - ww "github.com/weaveworks/common/server" util_log "github.com/grafana/loki/pkg/util/log" ) diff --git a/clients/pkg/logentry/stages/labeldrop_test.go b/clients/pkg/logentry/stages/labeldrop_test.go index 67a2d62a9ade0..394702a349a9f 100644 --- a/clients/pkg/logentry/stages/labeldrop_test.go +++ b/clients/pkg/logentry/stages/labeldrop_test.go @@ -4,10 +4,10 @@ import ( "testing" "time" + ww "github.com/grafana/dskit/server" "github.com/prometheus/common/model" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - ww "github.com/weaveworks/common/server" util_log "github.com/grafana/loki/pkg/util/log" ) diff --git a/clients/pkg/logentry/stages/multiline_test.go b/clients/pkg/logentry/stages/multiline_test.go index 058689164b92b..315e7a1ad4fcb 100644 --- a/clients/pkg/logentry/stages/multiline_test.go +++ b/clients/pkg/logentry/stages/multiline_test.go @@ -6,9 +6,9 @@ import ( "testing" "time" + ww "github.com/grafana/dskit/server" "github.com/prometheus/common/model" "github.com/stretchr/testify/require" - ww "github.com/weaveworks/common/server" "github.com/grafana/loki/clients/pkg/promtail/api" diff --git a/clients/pkg/logentry/stages/pack_test.go b/clients/pkg/logentry/stages/pack_test.go index f9639fb15777e..32bf75053b7a1 100644 --- a/clients/pkg/logentry/stages/pack_test.go +++ b/clients/pkg/logentry/stages/pack_test.go @@ -4,12 +4,12 @@ import ( "testing" "time" + ww "github.com/grafana/dskit/server" json "github.com/json-iterator/go" "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/common/model" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - ww "github.com/weaveworks/common/server" "github.com/grafana/loki/clients/pkg/promtail/api" diff --git a/clients/pkg/promtail/promtail_test.go b/clients/pkg/promtail/promtail_test.go index 7a8c7a37b9574..a3cfdc600c3ef 100644 --- a/clients/pkg/promtail/promtail_test.go +++ b/clients/pkg/promtail/promtail_test.go @@ -17,6 +17,7 @@ import ( "github.com/go-kit/log" "github.com/go-kit/log/level" "github.com/grafana/dskit/flagext" + serverww "github.com/grafana/dskit/server" "github.com/pkg/errors" "github.com/prometheus/client_golang/prometheus" dto "github.com/prometheus/client_model/go" @@ -28,7 +29,6 @@ import ( "github.com/prometheus/prometheus/promql/parser" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - serverww "github.com/weaveworks/common/server" "github.com/grafana/loki/clients/pkg/logentry/stages" "github.com/grafana/loki/clients/pkg/promtail/client" diff --git a/clients/pkg/promtail/scrapeconfig/scrapeconfig.go b/clients/pkg/promtail/scrapeconfig/scrapeconfig.go index d2866d79102b0..bd99a9f49a2bb 100644 --- a/clients/pkg/promtail/scrapeconfig/scrapeconfig.go +++ b/clients/pkg/promtail/scrapeconfig/scrapeconfig.go @@ -8,6 +8,7 @@ import ( "github.com/Shopify/sarama" "github.com/grafana/dskit/flagext" + "github.com/grafana/dskit/server" promconfig "github.com/prometheus/common/config" "github.com/prometheus/common/model" "github.com/prometheus/prometheus/discovery" @@ -25,7 +26,6 @@ import ( "github.com/prometheus/prometheus/discovery/triton" "github.com/prometheus/prometheus/discovery/zookeeper" "github.com/prometheus/prometheus/model/relabel" - "github.com/weaveworks/common/server" "github.com/grafana/loki/clients/pkg/logentry/stages" "github.com/grafana/loki/clients/pkg/promtail/discovery/consulagent" diff --git a/clients/pkg/promtail/server/server.go b/clients/pkg/promtail/server/server.go index 6ae754cdd3b7b..a3d98cd8aa752 100644 --- a/clients/pkg/promtail/server/server.go +++ b/clients/pkg/promtail/server/server.go @@ -17,11 +17,11 @@ import ( "github.com/felixge/fgprof" "github.com/go-kit/log" "github.com/go-kit/log/level" + serverww "github.com/grafana/dskit/server" "github.com/pkg/errors" "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus/promhttp" "github.com/prometheus/common/version" - serverww "github.com/weaveworks/common/server" "github.com/grafana/loki/clients/pkg/promtail/server/ui" "github.com/grafana/loki/clients/pkg/promtail/targets" diff --git a/clients/pkg/promtail/targets/gcplog/push_target.go b/clients/pkg/promtail/targets/gcplog/push_target.go index 730dd7a33545d..d259cd8e68599 100644 --- a/clients/pkg/promtail/targets/gcplog/push_target.go +++ b/clients/pkg/promtail/targets/gcplog/push_target.go @@ -9,10 +9,10 @@ import ( "github.com/go-kit/log" "github.com/go-kit/log/level" + dslog "github.com/grafana/dskit/log" + "github.com/grafana/dskit/server" "github.com/prometheus/common/model" "github.com/prometheus/prometheus/model/relabel" - "github.com/weaveworks/common/logging" - "github.com/weaveworks/common/server" "github.com/grafana/loki/clients/pkg/promtail/api" "github.com/grafana/loki/clients/pkg/promtail/scrapeconfig" @@ -80,7 +80,7 @@ func (h *pushTarget) run() error { h.config.Server.RegisterInstrumentation = false // Wrapping util logger with component-specific key vals, and the expected GoKit logging interface - h.config.Server.Log = logging.GoKit(log.With(util_log.Logger, "component", "gcp_push")) + h.config.Server.Log = dslog.GoKit(log.With(util_log.Logger, "component", "gcp_push")) srv, err := server.New(h.config.Server) if err != nil { diff --git a/clients/pkg/promtail/targets/gcplog/push_target_test.go b/clients/pkg/promtail/targets/gcplog/push_target_test.go index e05d08a6d3db9..7a514b553357d 100644 --- a/clients/pkg/promtail/targets/gcplog/push_target_test.go +++ b/clients/pkg/promtail/targets/gcplog/push_target_test.go @@ -14,11 +14,11 @@ import ( "github.com/grafana/loki/clients/pkg/promtail/api" "github.com/go-kit/log" + "github.com/grafana/dskit/server" "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/common/model" "github.com/prometheus/prometheus/model/relabel" "github.com/stretchr/testify/require" - "github.com/weaveworks/common/server" lokiClient "github.com/grafana/loki/clients/pkg/promtail/client" "github.com/grafana/loki/clients/pkg/promtail/client/fake" diff --git a/clients/pkg/promtail/targets/heroku/target.go b/clients/pkg/promtail/targets/heroku/target.go index 78bcf53785acc..4634832397fe9 100644 --- a/clients/pkg/promtail/targets/heroku/target.go +++ b/clients/pkg/promtail/targets/heroku/target.go @@ -8,12 +8,12 @@ import ( "github.com/go-kit/log" "github.com/go-kit/log/level" + dslog "github.com/grafana/dskit/log" + "github.com/grafana/dskit/server" herokuEncoding "github.com/heroku/x/logplex/encoding" "github.com/prometheus/common/model" "github.com/prometheus/prometheus/model/labels" "github.com/prometheus/prometheus/model/relabel" - "github.com/weaveworks/common/logging" - "github.com/weaveworks/common/server" "github.com/grafana/loki/clients/pkg/promtail/api" lokiClient "github.com/grafana/loki/clients/pkg/promtail/client" @@ -80,7 +80,7 @@ func (h *Target) run() error { h.config.Server.RegisterInstrumentation = false // Wrapping util logger with component-specific key vals, and the expected GoKit logging interface - h.config.Server.Log = logging.GoKit(log.With(util_log.Logger, "component", "heroku_drain")) + h.config.Server.Log = dslog.GoKit(log.With(util_log.Logger, "component", "heroku_drain")) srv, err := server.New(h.config.Server) if err != nil { diff --git a/clients/pkg/promtail/targets/heroku/target_test.go b/clients/pkg/promtail/targets/heroku/target_test.go index 70b8383890b9e..c584bedba471d 100644 --- a/clients/pkg/promtail/targets/heroku/target_test.go +++ b/clients/pkg/promtail/targets/heroku/target_test.go @@ -13,11 +13,11 @@ import ( "github.com/go-kit/log" "github.com/google/uuid" + "github.com/grafana/dskit/server" "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/common/model" "github.com/prometheus/prometheus/model/relabel" "github.com/stretchr/testify/require" - "github.com/weaveworks/common/server" lokiClient "github.com/grafana/loki/clients/pkg/promtail/client" "github.com/grafana/loki/clients/pkg/promtail/client/fake" diff --git a/clients/pkg/promtail/targets/lokipush/pushtarget.go b/clients/pkg/promtail/targets/lokipush/pushtarget.go index d76a6fbfdcdbd..abf08baf82626 100644 --- a/clients/pkg/promtail/targets/lokipush/pushtarget.go +++ b/clients/pkg/promtail/targets/lokipush/pushtarget.go @@ -11,12 +11,12 @@ import ( "github.com/go-kit/log" "github.com/go-kit/log/level" + "github.com/grafana/dskit/server" "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/common/model" "github.com/prometheus/prometheus/model/labels" "github.com/prometheus/prometheus/model/relabel" promql_parser "github.com/prometheus/prometheus/promql/parser" - "github.com/weaveworks/common/server" "github.com/grafana/dskit/tenant" diff --git a/clients/pkg/promtail/targets/lokipush/pushtarget_test.go b/clients/pkg/promtail/targets/lokipush/pushtarget_test.go index 1bcb397b78b3b..147994fb2df1a 100644 --- a/clients/pkg/promtail/targets/lokipush/pushtarget_test.go +++ b/clients/pkg/promtail/targets/lokipush/pushtarget_test.go @@ -14,11 +14,11 @@ import ( "github.com/go-kit/log" "github.com/grafana/dskit/flagext" + "github.com/grafana/dskit/server" "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/common/model" "github.com/prometheus/prometheus/model/relabel" "github.com/stretchr/testify/require" - "github.com/weaveworks/common/server" "github.com/grafana/loki/clients/pkg/promtail/api" "github.com/grafana/loki/clients/pkg/promtail/client" diff --git a/clients/pkg/promtail/targets/lokipush/pushtargetmanager_test.go b/clients/pkg/promtail/targets/lokipush/pushtargetmanager_test.go index 0770ce6fcaecb..40621d18f5ba0 100644 --- a/clients/pkg/promtail/targets/lokipush/pushtargetmanager_test.go +++ b/clients/pkg/promtail/targets/lokipush/pushtargetmanager_test.go @@ -3,7 +3,7 @@ package lokipush import ( "testing" - "github.com/weaveworks/common/server" + "github.com/grafana/dskit/server" "github.com/grafana/loki/clients/pkg/promtail/scrapeconfig" ) diff --git a/clients/pkg/promtail/targets/serverutils/config.go b/clients/pkg/promtail/targets/serverutils/config.go index 39f61088b8dc9..451a3d0953c76 100644 --- a/clients/pkg/promtail/targets/serverutils/config.go +++ b/clients/pkg/promtail/targets/serverutils/config.go @@ -3,8 +3,8 @@ package serverutils import ( "flag" + "github.com/grafana/dskit/server" "github.com/imdario/mergo" - "github.com/weaveworks/common/server" ) // MergeWithDefaults applies server.Config defaults to a given and different server.Config. diff --git a/clients/pkg/promtail/targets/windows/target_test.go b/clients/pkg/promtail/targets/windows/target_test.go index 932630b93a0b6..f1f786e3a6f6e 100644 --- a/clients/pkg/promtail/targets/windows/target_test.go +++ b/clients/pkg/promtail/targets/windows/target_test.go @@ -7,11 +7,11 @@ import ( "testing" "time" + "github.com/grafana/dskit/server" jsoniter "github.com/json-iterator/go" "github.com/prometheus/common/model" "github.com/spf13/afero" "github.com/stretchr/testify/require" - "github.com/weaveworks/common/server" "golang.org/x/sys/windows/svc/eventlog" "github.com/grafana/loki/clients/pkg/promtail/api" diff --git a/cmd/logql-analyzer/main.go b/cmd/logql-analyzer/main.go index 6409b94d7a7f8..b6e894a594229 100644 --- a/cmd/logql-analyzer/main.go +++ b/cmd/logql-analyzer/main.go @@ -7,8 +7,8 @@ import ( "github.com/go-kit/log" "github.com/go-kit/log/level" "github.com/gorilla/mux" + "github.com/grafana/dskit/server" "github.com/prometheus/client_golang/prometheus" - "github.com/weaveworks/common/server" "github.com/grafana/loki/pkg/logqlanalyzer" "github.com/grafana/loki/pkg/sizing" diff --git a/cmd/loki/main.go b/cmd/loki/main.go index b1ead7dde6e84..6c41dd61f67ad 100644 --- a/cmd/loki/main.go +++ b/cmd/loki/main.go @@ -8,10 +8,10 @@ import ( "runtime" "github.com/go-kit/log/level" + "github.com/grafana/dskit/log" + "github.com/grafana/dskit/tracing" "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/common/version" - "github.com/weaveworks/common/logging" - "github.com/weaveworks/common/tracing" "github.com/grafana/loki/pkg/loki" "github.com/grafana/loki/pkg/util" @@ -44,7 +44,7 @@ func main() { validation.SetDefaultLimitsForYAMLUnmarshalling(config.LimitsConfig) // Init the logger which will honor the log level set in config.Server - if reflect.DeepEqual(&config.Server.LogLevel, &logging.Level{}) { + if reflect.DeepEqual(&config.Server.LogLevel, &log.Level{}) { level.Error(util_log.Logger).Log("msg", "invalid log level") exit(1) } diff --git a/cmd/migrate/main.go b/cmd/migrate/main.go index e68bf1b90b7b5..f6d22f1b34ddf 100644 --- a/cmd/migrate/main.go +++ b/cmd/migrate/main.go @@ -15,8 +15,8 @@ import ( "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/common/model" + "github.com/grafana/dskit/user" "github.com/prometheus/prometheus/model/labels" - "github.com/weaveworks/common/user" "github.com/grafana/loki/pkg/logql/syntax" "github.com/grafana/loki/pkg/loki" diff --git a/cmd/querytee/main.go b/cmd/querytee/main.go index 4e88820d9ae1d..1a02b501a5abb 100644 --- a/cmd/querytee/main.go +++ b/cmd/querytee/main.go @@ -5,10 +5,10 @@ import ( "os" "github.com/go-kit/log/level" + "github.com/grafana/dskit/log" + "github.com/grafana/dskit/server" "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus/collectors" - "github.com/weaveworks/common/logging" - "github.com/weaveworks/common/server" "github.com/grafana/loki/pkg/loghttp" util_log "github.com/grafana/loki/pkg/util/log" @@ -17,7 +17,7 @@ import ( type Config struct { ServerMetricsPort int - LogLevel logging.Level + LogLevel log.Level ProxyConfig querytee.ProxyConfig } diff --git a/go.mod b/go.mod index 708bf367b633f..69b114c7a465b 100644 --- a/go.mod +++ b/go.mod @@ -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-20230725162534-96da0816983e + github.com/grafana/dskit v0.0.0-20230804003603-740f56bd2934 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 diff --git a/go.sum b/go.sum index c143a9d52d7ba..defafcc9ea63a 100644 --- a/go.sum +++ b/go.sum @@ -1080,8 +1080,8 @@ github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/ad github.com/gotestyourself/gotestyourself v2.2.0+incompatible/go.mod h1:zZKM6oeNM8k+FRljX1mnzVYeS8wiGgQyvST1/GafPbY= github.com/grafana/cloudflare-go v0.0.0-20230110200409-c627cf6792f2 h1:qhugDMdQ4Vp68H0tp/0iN17DM2ehRo1rLEdOFe/gB8I= github.com/grafana/cloudflare-go v0.0.0-20230110200409-c627cf6792f2/go.mod h1:w/aiO1POVIeXUQyl0VQSZjl5OAGDTL5aX+4v0RA1tcw= -github.com/grafana/dskit v0.0.0-20230725162534-96da0816983e h1:lLZMz1yUfp2y9ozpXsiBR14bVQCEnuaqa4siQdFazF0= -github.com/grafana/dskit v0.0.0-20230725162534-96da0816983e/go.mod h1:M03k2fzuQ2n9TVE1xfVKTESibxsXdw0wYfWT3+9Owp4= +github.com/grafana/dskit v0.0.0-20230804003603-740f56bd2934 h1:W1g+y6rOO7K/Jm2XNPxIXyJisJSJ25uiVVaSa7N1Zwo= +github.com/grafana/dskit v0.0.0-20230804003603-740f56bd2934/go.mod h1:Xg0aN3EpqkYFW1ZxGyIl4BGEpr3QrCQOM1aWalpU3ik= github.com/grafana/go-gelf/v2 v2.0.1 h1:BOChP0h/jLeD+7F9mL7tq10xVkDG15he3T1zHuQaWak= github.com/grafana/go-gelf/v2 v2.0.1/go.mod h1:lexHie0xzYGwCgiRGcvZ723bSNyNI8ZRD4s0CLobh90= github.com/grafana/gocql v0.0.0-20200605141915-ba5dc39ece85 h1:xLuzPoOzdfNb/RF/IENCw+oLVdZB4G21VPhkHBgwSHY= diff --git a/integration/client/client.go b/integration/client/client.go index 7095e5bf398d1..64dda8c0b1755 100644 --- a/integration/client/client.go +++ b/integration/client/client.go @@ -13,8 +13,8 @@ import ( "strings" "time" + "github.com/grafana/dskit/user" "github.com/prometheus/prometheus/model/labels" - "github.com/weaveworks/common/user" ) const requestTimeout = 30 * time.Second diff --git a/pkg/canary/comparator/comparator.go b/pkg/canary/comparator/comparator.go index de1e50c559d73..e7234df191f9c 100644 --- a/pkg/canary/comparator/comparator.go +++ b/pkg/canary/comparator/comparator.go @@ -7,9 +7,9 @@ import ( "sync" "time" + "github.com/grafana/dskit/instrument" "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus/promauto" - "github.com/weaveworks/common/instrument" "github.com/grafana/loki/pkg/canary/reader" ) diff --git a/pkg/configs/client/client.go b/pkg/configs/client/client.go index 416326f8ebc10..fb530ed020e72 100644 --- a/pkg/configs/client/client.go +++ b/pkg/configs/client/client.go @@ -14,10 +14,10 @@ import ( "github.com/go-kit/log/level" dstls "github.com/grafana/dskit/crypto/tls" "github.com/grafana/dskit/flagext" + "github.com/grafana/dskit/instrument" "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus/promauto" "github.com/prometheus/common/version" - "github.com/weaveworks/common/instrument" "github.com/grafana/loki/pkg/configs/userconfig" util_log "github.com/grafana/loki/pkg/util/log" diff --git a/pkg/distributor/distributor.go b/pkg/distributor/distributor.go index eb2da6395a2a9..def2c548acf67 100644 --- a/pkg/distributor/distributor.go +++ b/pkg/distributor/distributor.go @@ -15,19 +15,19 @@ import ( "github.com/go-kit/log/level" "github.com/prometheus/prometheus/model/labels" + "github.com/grafana/dskit/httpgrpc" "github.com/grafana/dskit/kv" "github.com/grafana/dskit/limiter" "github.com/grafana/dskit/ring" ring_client "github.com/grafana/dskit/ring/client" "github.com/grafana/dskit/services" "github.com/grafana/dskit/tenant" + "github.com/grafana/dskit/user" lru "github.com/hashicorp/golang-lru" "github.com/opentracing/opentracing-go" "github.com/pkg/errors" "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus/promauto" - "github.com/weaveworks/common/httpgrpc" - "github.com/weaveworks/common/user" "go.uber.org/atomic" "github.com/grafana/loki/pkg/analytics" diff --git a/pkg/distributor/distributor_test.go b/pkg/distributor/distributor_test.go index 476df6ca99c40..9c02bb9983e34 100644 --- a/pkg/distributor/distributor_test.go +++ b/pkg/distributor/distributor_test.go @@ -14,17 +14,17 @@ import ( "github.com/go-kit/log" "github.com/grafana/dskit/flagext" + "github.com/grafana/dskit/httpgrpc" "github.com/grafana/dskit/kv" "github.com/grafana/dskit/kv/consul" "github.com/grafana/dskit/ring" ring_client "github.com/grafana/dskit/ring/client" "github.com/grafana/dskit/services" + "github.com/grafana/dskit/user" "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/common/model" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/weaveworks/common/httpgrpc" - "github.com/weaveworks/common/user" "google.golang.org/grpc" "google.golang.org/grpc/health/grpc_health_v1" diff --git a/pkg/distributor/http.go b/pkg/distributor/http.go index 9aba55bc2aca0..29f0f80e394d9 100644 --- a/pkg/distributor/http.go +++ b/pkg/distributor/http.go @@ -6,7 +6,7 @@ import ( "strings" "github.com/go-kit/log/level" - "github.com/weaveworks/common/httpgrpc" + "github.com/grafana/dskit/httpgrpc" "github.com/grafana/loki/pkg/util" diff --git a/pkg/distributor/ratestore.go b/pkg/distributor/ratestore.go index cca5774411085..2eb9e9f062326 100644 --- a/pkg/distributor/ratestore.go +++ b/pkg/distributor/ratestore.go @@ -8,12 +8,12 @@ import ( "time" "github.com/go-kit/log/level" + "github.com/grafana/dskit/instrument" "github.com/grafana/dskit/ring" "github.com/grafana/dskit/ring/client" "github.com/grafana/dskit/services" "github.com/opentracing/opentracing-go" "github.com/prometheus/client_golang/prometheus" - "github.com/weaveworks/common/instrument" "github.com/grafana/loki/pkg/logproto" "github.com/grafana/loki/pkg/util" diff --git a/pkg/distributor/ratestore_metrics.go b/pkg/distributor/ratestore_metrics.go index fe7df4cbd5f2b..696bbf51701e5 100644 --- a/pkg/distributor/ratestore_metrics.go +++ b/pkg/distributor/ratestore_metrics.go @@ -1,9 +1,9 @@ package distributor import ( + "github.com/grafana/dskit/instrument" "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus/promauto" - "github.com/weaveworks/common/instrument" ) type ratestoreMetrics struct { diff --git a/pkg/ingester/checkpoint_test.go b/pkg/ingester/checkpoint_test.go index 9441286c6aaa7..a81f40791778f 100644 --- a/pkg/ingester/checkpoint_test.go +++ b/pkg/ingester/checkpoint_test.go @@ -9,10 +9,10 @@ import ( "time" "github.com/grafana/dskit/services" + "github.com/grafana/dskit/user" "github.com/prometheus/prometheus/model/labels" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/weaveworks/common/user" "github.com/grafana/loki/pkg/chunkenc" "github.com/grafana/loki/pkg/distributor/writefailures" diff --git a/pkg/ingester/client/client.go b/pkg/ingester/client/client.go index 0ce4ea9ae6031..f6682b10db134 100644 --- a/pkg/ingester/client/client.go +++ b/pkg/ingester/client/client.go @@ -6,11 +6,11 @@ import ( "time" "github.com/grafana/dskit/grpcclient" + "github.com/grafana/dskit/middleware" "github.com/grpc-ecosystem/grpc-opentracing/go/otgrpc" "github.com/opentracing/opentracing-go" "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus/promauto" - "github.com/weaveworks/common/middleware" "google.golang.org/grpc" "google.golang.org/grpc/health/grpc_health_v1" diff --git a/pkg/ingester/flush.go b/pkg/ingester/flush.go index 5ea4215798d7b..53c1ca04af644 100644 --- a/pkg/ingester/flush.go +++ b/pkg/ingester/flush.go @@ -8,10 +8,10 @@ import ( "time" "github.com/go-kit/log/level" + "github.com/grafana/dskit/user" "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/common/model" "github.com/prometheus/prometheus/model/labels" - "github.com/weaveworks/common/user" "golang.org/x/net/context" "github.com/grafana/dskit/tenant" diff --git a/pkg/ingester/flush_test.go b/pkg/ingester/flush_test.go index a36214ab17842..14d679eb71081 100644 --- a/pkg/ingester/flush_test.go +++ b/pkg/ingester/flush_test.go @@ -14,10 +14,10 @@ import ( "github.com/grafana/dskit/kv" "github.com/grafana/dskit/ring" "github.com/grafana/dskit/services" + "github.com/grafana/dskit/user" "github.com/prometheus/common/model" "github.com/prometheus/prometheus/model/labels" "github.com/stretchr/testify/require" - "github.com/weaveworks/common/user" "golang.org/x/net/context" "github.com/grafana/dskit/tenant" diff --git a/pkg/ingester/ingester_test.go b/pkg/ingester/ingester_test.go index f3d646606d4f3..b453e5a9ea0ab 100644 --- a/pkg/ingester/ingester_test.go +++ b/pkg/ingester/ingester_test.go @@ -12,13 +12,13 @@ import ( "time" "github.com/grafana/dskit/flagext" + "github.com/grafana/dskit/httpgrpc" + "github.com/grafana/dskit/middleware" "github.com/grafana/dskit/services" + "github.com/grafana/dskit/user" "github.com/prometheus/common/model" "github.com/prometheus/prometheus/model/labels" "github.com/stretchr/testify/require" - "github.com/weaveworks/common/httpgrpc" - "github.com/weaveworks/common/middleware" - "github.com/weaveworks/common/user" "golang.org/x/net/context" "google.golang.org/grpc" "google.golang.org/grpc/credentials/insecure" diff --git a/pkg/ingester/instance.go b/pkg/ingester/instance.go index 4c58fd13c6663..28c3e67ba92fe 100644 --- a/pkg/ingester/instance.go +++ b/pkg/ingester/instance.go @@ -9,6 +9,7 @@ import ( "time" "github.com/go-kit/log/level" + "github.com/grafana/dskit/httpgrpc" "github.com/opentracing/opentracing-go" "github.com/pkg/errors" "github.com/prometheus/client_golang/prometheus" @@ -17,7 +18,6 @@ import ( "github.com/prometheus/prometheus/model/labels" "github.com/prometheus/prometheus/tsdb/chunks" tsdb_record "github.com/prometheus/prometheus/tsdb/record" - "github.com/weaveworks/common/httpgrpc" "go.uber.org/atomic" "github.com/grafana/loki/pkg/analytics" diff --git a/pkg/ingester/recovery_test.go b/pkg/ingester/recovery_test.go index a3d11eac73852..35010564cac90 100644 --- a/pkg/ingester/recovery_test.go +++ b/pkg/ingester/recovery_test.go @@ -9,12 +9,12 @@ import ( "testing" "time" + "github.com/grafana/dskit/user" "github.com/pkg/errors" "github.com/prometheus/prometheus/model/labels" "github.com/prometheus/prometheus/tsdb/chunks" "github.com/prometheus/prometheus/tsdb/record" "github.com/stretchr/testify/require" - "github.com/weaveworks/common/user" "github.com/grafana/loki/pkg/distributor/writefailures" "github.com/grafana/loki/pkg/ingester/client" diff --git a/pkg/ingester/stream.go b/pkg/ingester/stream.go index 01c86d9e2f908..c1ee9f3272332 100644 --- a/pkg/ingester/stream.go +++ b/pkg/ingester/stream.go @@ -9,11 +9,11 @@ import ( "time" "github.com/go-kit/log/level" + "github.com/grafana/dskit/httpgrpc" "github.com/opentracing/opentracing-go" "github.com/pkg/errors" "github.com/prometheus/common/model" "github.com/prometheus/prometheus/model/labels" - "github.com/weaveworks/common/httpgrpc" "github.com/grafana/loki/pkg/chunkenc" "github.com/grafana/loki/pkg/distributor/writefailures" diff --git a/pkg/ingester/stream_test.go b/pkg/ingester/stream_test.go index 40e9977342dcb..5068aa0eff763 100644 --- a/pkg/ingester/stream_test.go +++ b/pkg/ingester/stream_test.go @@ -9,10 +9,10 @@ import ( "testing" "time" + "github.com/grafana/dskit/httpgrpc" "github.com/prometheus/common/model" "github.com/prometheus/prometheus/model/labels" "github.com/stretchr/testify/require" - "github.com/weaveworks/common/httpgrpc" "github.com/grafana/loki/pkg/chunkenc" "github.com/grafana/loki/pkg/iter" diff --git a/pkg/ingester/transfer.go b/pkg/ingester/transfer.go index 9d6f3f3623f01..77f22c7a8c7df 100644 --- a/pkg/ingester/transfer.go +++ b/pkg/ingester/transfer.go @@ -9,11 +9,11 @@ import ( "github.com/go-kit/log/level" "github.com/grafana/dskit/backoff" "github.com/grafana/dskit/ring" + "github.com/grafana/dskit/user" "github.com/pkg/errors" "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus/promauto" "github.com/prometheus/prometheus/model/labels" - "github.com/weaveworks/common/user" "golang.org/x/net/context" "github.com/grafana/loki/pkg/logproto" diff --git a/pkg/ingester/transfer_test.go b/pkg/ingester/transfer_test.go index 9155ba32cbb90..76c933cabf1d7 100644 --- a/pkg/ingester/transfer_test.go +++ b/pkg/ingester/transfer_test.go @@ -12,9 +12,9 @@ import ( "github.com/grafana/dskit/kv" "github.com/grafana/dskit/ring" "github.com/grafana/dskit/services" + "github.com/grafana/dskit/user" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/weaveworks/common/user" "golang.org/x/net/context" "google.golang.org/grpc" diff --git a/pkg/logcli/client/file.go b/pkg/logcli/client/file.go index 34c9456c1af57..45681c36c2c8f 100644 --- a/pkg/logcli/client/file.go +++ b/pkg/logcli/client/file.go @@ -21,8 +21,8 @@ import ( "github.com/grafana/loki/pkg/util/marshal" "github.com/grafana/loki/pkg/util/validation" + "github.com/grafana/dskit/user" "github.com/prometheus/prometheus/model/labels" - "github.com/weaveworks/common/user" ) const ( diff --git a/pkg/logcli/query/query.go b/pkg/logcli/query/query.go index eb5229fab72b6..769cb574c90ef 100644 --- a/pkg/logcli/query/query.go +++ b/pkg/logcli/query/query.go @@ -11,9 +11,9 @@ import ( "time" "github.com/grafana/dskit/multierror" + "github.com/grafana/dskit/user" "github.com/pkg/errors" "github.com/prometheus/client_golang/prometheus" - "github.com/weaveworks/common/user" "gopkg.in/yaml.v2" "github.com/grafana/loki/pkg/logcli/client" diff --git a/pkg/logcli/query/query_test.go b/pkg/logcli/query/query_test.go index 7fbed990c5175..ac0b5d60e5ac6 100644 --- a/pkg/logcli/query/query_test.go +++ b/pkg/logcli/query/query_test.go @@ -12,9 +12,9 @@ import ( "github.com/go-kit/log" "github.com/gorilla/websocket" + "github.com/grafana/dskit/user" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/weaveworks/common/user" "github.com/grafana/loki/pkg/logcli/output" "github.com/grafana/loki/pkg/logcli/volume" diff --git a/pkg/logql/blocker_test.go b/pkg/logql/blocker_test.go index 9cdf8bb1080b3..3dc3b72c81599 100644 --- a/pkg/logql/blocker_test.go +++ b/pkg/logql/blocker_test.go @@ -7,8 +7,8 @@ import ( "time" "github.com/go-kit/log" + "github.com/grafana/dskit/user" "github.com/stretchr/testify/require" - "github.com/weaveworks/common/user" "github.com/grafana/loki/pkg/logproto" "github.com/grafana/loki/pkg/logqlmodel" diff --git a/pkg/logql/downstream_test.go b/pkg/logql/downstream_test.go index e2b4b48c7d8dc..8c52f23cfa7b3 100644 --- a/pkg/logql/downstream_test.go +++ b/pkg/logql/downstream_test.go @@ -7,10 +7,10 @@ import ( "time" "github.com/go-kit/log" + "github.com/grafana/dskit/user" "github.com/prometheus/prometheus/promql" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/weaveworks/common/user" "github.com/grafana/loki/pkg/logproto" ) diff --git a/pkg/logql/engine_test.go b/pkg/logql/engine_test.go index d8a7e9c7ce1e1..c5a1c7235492a 100644 --- a/pkg/logql/engine_test.go +++ b/pkg/logql/engine_test.go @@ -15,13 +15,13 @@ import ( "github.com/grafana/loki/pkg/querier/queryrange/queryrangebase/definitions" "github.com/go-kit/log" + "github.com/grafana/dskit/user" json "github.com/json-iterator/go" "github.com/prometheus/prometheus/model/labels" "github.com/prometheus/prometheus/promql" promql_parser "github.com/prometheus/prometheus/promql/parser" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/weaveworks/common/user" "github.com/grafana/loki/pkg/iter" "github.com/grafana/loki/pkg/logproto" diff --git a/pkg/logql/metrics_test.go b/pkg/logql/metrics_test.go index 46add724dd77d..e3cd64bdf0b8f 100644 --- a/pkg/logql/metrics_test.go +++ b/pkg/logql/metrics_test.go @@ -9,11 +9,11 @@ import ( "time" "github.com/go-kit/log" + "github.com/grafana/dskit/user" "github.com/opentracing/opentracing-go" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "github.com/uber/jaeger-client-go" - "github.com/weaveworks/common/user" "github.com/grafana/loki/pkg/logproto" "github.com/grafana/loki/pkg/logqlmodel" diff --git a/pkg/loki/loki.go b/pkg/loki/loki.go index 9c80db00ab087..0531a3b10483e 100644 --- a/pkg/loki/loki.go +++ b/pkg/loki/loki.go @@ -18,15 +18,15 @@ import ( "github.com/grafana/dskit/flagext" "github.com/grafana/dskit/grpcutil" "github.com/grafana/dskit/kv/memberlist" + "github.com/grafana/dskit/middleware" "github.com/grafana/dskit/modules" "github.com/grafana/dskit/ring" "github.com/grafana/dskit/runtimeconfig" + "github.com/grafana/dskit/server" "github.com/grafana/dskit/services" + "github.com/grafana/dskit/signals" "github.com/pkg/errors" "github.com/prometheus/client_golang/prometheus" - "github.com/weaveworks/common/middleware" - "github.com/weaveworks/common/server" - "github.com/weaveworks/common/signals" "google.golang.org/grpc/health/grpc_health_v1" "github.com/grafana/loki/pkg/analytics" diff --git a/pkg/loki/loki_test.go b/pkg/loki/loki_test.go index da5ee0e66acb4..81d7c0384d7dc 100644 --- a/pkg/loki/loki_test.go +++ b/pkg/loki/loki_test.go @@ -12,9 +12,9 @@ import ( "time" "github.com/grafana/dskit/flagext" + "github.com/grafana/dskit/server" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/weaveworks/common/server" internalserver "github.com/grafana/loki/pkg/server" ) diff --git a/pkg/loki/modules.go b/pkg/loki/modules.go index 9709254a15302..121b173da048a 100644 --- a/pkg/loki/modules.go +++ b/pkg/loki/modules.go @@ -20,18 +20,18 @@ import ( "github.com/grafana/dskit/dns" "github.com/grafana/dskit/kv/codec" "github.com/grafana/dskit/kv/memberlist" + "github.com/grafana/dskit/middleware" "github.com/grafana/dskit/ring" "github.com/grafana/dskit/runtimeconfig" + "github.com/grafana/dskit/server" "github.com/grafana/dskit/services" "github.com/grafana/dskit/tenant" + "github.com/grafana/dskit/user" gerrors "github.com/pkg/errors" "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus/collectors" "github.com/prometheus/common/model" "github.com/prometheus/common/version" - "github.com/weaveworks/common/middleware" - "github.com/weaveworks/common/server" - "github.com/weaveworks/common/user" "github.com/grafana/loki/pkg/analytics" "github.com/grafana/loki/pkg/distributor" diff --git a/pkg/lokifrontend/frontend/transport/handler.go b/pkg/lokifrontend/frontend/transport/handler.go index 4c0f5ca7ca7de..8cd8ca0bbd8e0 100644 --- a/pkg/lokifrontend/frontend/transport/handler.go +++ b/pkg/lokifrontend/frontend/transport/handler.go @@ -14,10 +14,10 @@ import ( "github.com/go-kit/log" "github.com/go-kit/log/level" + "github.com/grafana/dskit/httpgrpc" + "github.com/grafana/dskit/httpgrpc/server" "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus/promauto" - "github.com/weaveworks/common/httpgrpc" - "github.com/weaveworks/common/httpgrpc/server" "github.com/grafana/dskit/tenant" diff --git a/pkg/lokifrontend/frontend/transport/handler_test.go b/pkg/lokifrontend/frontend/transport/handler_test.go index 136f1879933c1..6f25963626712 100644 --- a/pkg/lokifrontend/frontend/transport/handler_test.go +++ b/pkg/lokifrontend/frontend/transport/handler_test.go @@ -6,9 +6,9 @@ import ( "net/http/httptest" "testing" + "github.com/grafana/dskit/httpgrpc" "github.com/pkg/errors" "github.com/stretchr/testify/require" - "github.com/weaveworks/common/httpgrpc" ) func TestWriteError(t *testing.T) { diff --git a/pkg/lokifrontend/frontend/transport/roundtripper.go b/pkg/lokifrontend/frontend/transport/roundtripper.go index 583fc22d04a33..8d8993649555c 100644 --- a/pkg/lokifrontend/frontend/transport/roundtripper.go +++ b/pkg/lokifrontend/frontend/transport/roundtripper.go @@ -6,8 +6,8 @@ import ( "io" "net/http" - "github.com/weaveworks/common/httpgrpc" - "github.com/weaveworks/common/httpgrpc/server" + "github.com/grafana/dskit/httpgrpc" + "github.com/grafana/dskit/httpgrpc/server" ) // GrpcRoundTripper is similar to http.RoundTripper, but works with HTTP requests converted to protobuf messages. diff --git a/pkg/lokifrontend/frontend/v1/frontend.go b/pkg/lokifrontend/frontend/v1/frontend.go index ebcbd67621bed..320e3dd50f437 100644 --- a/pkg/lokifrontend/frontend/v1/frontend.go +++ b/pkg/lokifrontend/frontend/v1/frontend.go @@ -9,12 +9,12 @@ import ( "github.com/go-kit/log" "github.com/go-kit/log/level" + "github.com/grafana/dskit/httpgrpc" "github.com/grafana/dskit/services" "github.com/opentracing/opentracing-go" "github.com/pkg/errors" "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus/promauto" - "github.com/weaveworks/common/httpgrpc" "github.com/grafana/dskit/tenant" diff --git a/pkg/lokifrontend/frontend/v1/frontend_test.go b/pkg/lokifrontend/frontend/v1/frontend_test.go index ddd6055af7930..2fc3712ba326d 100644 --- a/pkg/lokifrontend/frontend/v1/frontend_test.go +++ b/pkg/lokifrontend/frontend/v1/frontend_test.go @@ -13,7 +13,10 @@ import ( "github.com/go-kit/log" "github.com/gorilla/mux" "github.com/grafana/dskit/flagext" + httpgrpc_server "github.com/grafana/dskit/httpgrpc/server" + "github.com/grafana/dskit/middleware" "github.com/grafana/dskit/services" + "github.com/grafana/dskit/user" otgrpc "github.com/opentracing-contrib/go-grpc" "github.com/opentracing-contrib/go-stdlib/nethttp" "github.com/opentracing/opentracing-go" @@ -23,9 +26,6 @@ import ( "github.com/stretchr/testify/require" "github.com/uber/jaeger-client-go" "github.com/uber/jaeger-client-go/config" - httpgrpc_server "github.com/weaveworks/common/httpgrpc/server" - "github.com/weaveworks/common/middleware" - "github.com/weaveworks/common/user" "go.uber.org/atomic" "google.golang.org/grpc" diff --git a/pkg/lokifrontend/frontend/v1/frontendv1pb/frontend.pb.go b/pkg/lokifrontend/frontend/v1/frontendv1pb/frontend.pb.go index 213c5134ba9e3..10d525a0a829a 100644 --- a/pkg/lokifrontend/frontend/v1/frontendv1pb/frontend.pb.go +++ b/pkg/lokifrontend/frontend/v1/frontendv1pb/frontend.pb.go @@ -11,8 +11,8 @@ import ( fmt "fmt" _ "github.com/gogo/protobuf/gogoproto" proto "github.com/gogo/protobuf/proto" + httpgrpc "github.com/grafana/dskit/httpgrpc" stats "github.com/grafana/loki/pkg/querier/stats" - httpgrpc "github.com/weaveworks/common/httpgrpc" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" @@ -267,38 +267,38 @@ func init() { } var fileDescriptor_e58870c6eb9e26f7 = []byte{ - // 487 bytes of a gzipped FileDescriptorProto + // 484 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x93, 0xcd, 0x6e, 0xd3, 0x40, 0x10, 0xc7, 0x3d, 0x50, 0x4a, 0x98, 0x58, 0x95, 0xb5, 0x2a, 0x28, 0x32, 0xb0, 0x8a, 0x2c, 0x40, - 0x11, 0x07, 0x9b, 0x06, 0x24, 0x3e, 0x8e, 0xa5, 0xa1, 0xf4, 0x82, 0x8a, 0x63, 0x2e, 0x5c, 0xaa, - 0xc4, 0xd9, 0x3a, 0x56, 0x12, 0xaf, 0x6b, 0x6f, 0x12, 0xe5, 0xc6, 0x13, 0x20, 0x24, 0x5e, 0x82, - 0x67, 0xe0, 0x09, 0x38, 0xe6, 0xd8, 0x23, 0x71, 0x2e, 0x1c, 0xfb, 0x08, 0xc8, 0xde, 0x64, 0x9b, - 0x44, 0x11, 0x5c, 0x56, 0x33, 0xfb, 0x9f, 0x8f, 0xdf, 0x8c, 0xbd, 0xf8, 0x2a, 0xee, 0x05, 0x4e, - 0x9f, 0xf7, 0xc2, 0xf3, 0x84, 0x47, 0x82, 0x45, 0x1d, 0x47, 0x19, 0xa3, 0x03, 0x65, 0x8f, 0x0e, - 0xe2, 0xb6, 0x72, 0xec, 0x38, 0xe1, 0x82, 0x93, 0xd2, 0xd2, 0x37, 0x5f, 0x04, 0xa1, 0xe8, 0x0e, - 0xdb, 0xb6, 0xcf, 0x07, 0xce, 0x98, 0xb5, 0x46, 0x6c, 0xcc, 0x93, 0x5e, 0xea, 0xf8, 0x7c, 0x30, - 0xe0, 0x91, 0xd3, 0x15, 0x22, 0x0e, 0x92, 0xd8, 0x57, 0x86, 0xcc, 0x37, 0xf7, 0x03, 0x1e, 0xf0, - 0xc2, 0x74, 0x72, 0x6b, 0x71, 0xfb, 0x30, 0xe7, 0xb9, 0x18, 0xb2, 0x24, 0x64, 0x89, 0x93, 0x8a, - 0x96, 0x48, 0xe5, 0x29, 0x65, 0xeb, 0x3b, 0xa0, 0xf1, 0x6e, 0xd1, 0xd7, 0xe3, 0x6f, 0xfb, 0x21, - 0x8b, 0x04, 0x79, 0x89, 0xe5, 0xbc, 0xb6, 0xcb, 0x2e, 0x86, 0x2c, 0x15, 0x15, 0xa8, 0x42, 0xad, - 0x5c, 0xbf, 0x6b, 0xab, 0x7e, 0xef, 0x3d, 0xef, 0x74, 0x21, 0xba, 0xab, 0x91, 0xc4, 0xc2, 0x1d, - 0x31, 0x89, 0x59, 0xe5, 0x46, 0x15, 0x6a, 0x7b, 0xf5, 0x3d, 0x5b, 0x4d, 0xe8, 0x4d, 0x62, 0xe6, - 0x16, 0x1a, 0xb1, 0x50, 0x2f, 0x00, 0x1a, 0x51, 0xab, 0xdd, 0x67, 0x9d, 0xca, 0xcd, 0x2a, 0xd4, - 0x4a, 0xee, 0xda, 0x9d, 0xf5, 0x15, 0xd0, 0x90, 0x2c, 0x1e, 0x5f, 0xd2, 0x91, 0x37, 0xa8, 0xcb, - 0x5e, 0x69, 0xcc, 0xa3, 0x94, 0x2d, 0xb0, 0xee, 0x6d, 0x62, 0x49, 0xd5, 0x5d, 0x8b, 0x25, 0x26, - 0x96, 0xfc, 0xa2, 0xde, 0xc9, 0x51, 0x01, 0x77, 0xc7, 0x55, 0x3e, 0xb1, 0xf0, 0x56, 0xd1, 0xbc, - 0x20, 0x29, 0xd7, 0x75, 0x5b, 0xee, 0xa7, 0x99, 0x9f, 0xae, 0x94, 0xac, 0xd7, 0x78, 0xff, 0x03, - 0x17, 0xe1, 0xf9, 0x44, 0x52, 0x35, 0xbb, 0x43, 0xd1, 0xe1, 0xe3, 0x68, 0x39, 0xf7, 0x6a, 0x79, - 0x58, 0x2f, 0x6f, 0x51, 0x7c, 0xb0, 0x3d, 0x55, 0xa2, 0x3d, 0x7d, 0x84, 0x3b, 0xf9, 0x76, 0x88, - 0x81, 0x7a, 0x3e, 0xc0, 0x99, 0xdb, 0xf8, 0xf8, 0xa9, 0xd1, 0xf4, 0x0c, 0x8d, 0x20, 0xee, 0x1e, - 0x37, 0xbc, 0xb3, 0x93, 0x23, 0x03, 0xea, 0x3f, 0x01, 0x4b, 0x6a, 0x13, 0xc7, 0x78, 0xfb, 0x34, - 0xe1, 0x3e, 0x4b, 0x53, 0x62, 0x5e, 0xef, 0x78, 0x73, 0x61, 0xe6, 0x8a, 0xb6, 0xf9, 0x89, 0x2d, - 0xad, 0x06, 0xcf, 0x80, 0x30, 0xdc, 0xdf, 0xc6, 0x46, 0x1e, 0x5f, 0x67, 0xfe, 0x63, 0x6c, 0xf3, - 0xc9, 0xff, 0xc2, 0xe4, 0x88, 0x87, 0x87, 0xd3, 0x19, 0xd5, 0x2e, 0x67, 0x54, 0xbb, 0x9a, 0x51, - 0xf8, 0x92, 0x51, 0xf8, 0x91, 0x51, 0xf8, 0x95, 0x51, 0x98, 0x66, 0x14, 0x7e, 0x67, 0x14, 0xfe, - 0x64, 0x54, 0xbb, 0xca, 0x28, 0x7c, 0x9b, 0x53, 0x6d, 0x3a, 0xa7, 0xda, 0xe5, 0x9c, 0x6a, 0x9f, - 0xf5, 0xd5, 0xc7, 0xd2, 0xde, 0x2d, 0xfe, 0xd7, 0xe7, 0x7f, 0x03, 0x00, 0x00, 0xff, 0xff, 0xf3, - 0x15, 0xb7, 0x8d, 0x60, 0x03, 0x00, 0x00, + 0x11, 0x07, 0xbb, 0x0d, 0x07, 0x3e, 0x8e, 0xa5, 0xa1, 0xf4, 0x82, 0x8a, 0x63, 0x2e, 0x5c, 0x2a, + 0x27, 0xd9, 0x38, 0x56, 0x82, 0xd7, 0xb5, 0x37, 0x45, 0xb9, 0xf1, 0x04, 0x08, 0x89, 0x97, 0xe0, + 0x19, 0x78, 0x02, 0x8e, 0x39, 0xf6, 0x48, 0x9c, 0x0b, 0xc7, 0x3e, 0x02, 0xf2, 0x6e, 0xb2, 0x4d, + 0xa2, 0x0a, 0x2e, 0xab, 0x99, 0xfd, 0xcf, 0xc7, 0x6f, 0xc6, 0x5e, 0x7c, 0x91, 0x0e, 0x23, 0x6f, + 0xc4, 0x87, 0x71, 0x3f, 0xe3, 0x89, 0x60, 0x49, 0xcf, 0xd3, 0xc6, 0xf9, 0xbe, 0xb6, 0xcf, 0xf7, + 0xd3, 0x8e, 0x76, 0xdc, 0x34, 0xe3, 0x82, 0x93, 0xca, 0xd2, 0xb7, 0xf7, 0xa2, 0x58, 0x0c, 0xc6, + 0x1d, 0xb7, 0xcb, 0x3f, 0x79, 0x51, 0x16, 0xf6, 0xc3, 0x24, 0xf4, 0x7a, 0xf9, 0x30, 0x16, 0xde, + 0x40, 0x88, 0x34, 0xca, 0xd2, 0xae, 0x36, 0x54, 0xae, 0xbd, 0x1b, 0xf1, 0x88, 0x4b, 0xd3, 0x2b, + 0xad, 0xc5, 0xed, 0xc3, 0x92, 0xe5, 0x6c, 0xcc, 0xb2, 0x98, 0x65, 0x5e, 0x2e, 0x42, 0x91, 0xab, + 0x53, 0xc9, 0xce, 0x77, 0x40, 0xeb, 0xcd, 0xa2, 0x67, 0xc0, 0x5f, 0x8f, 0x62, 0x96, 0x08, 0xf2, + 0x1c, 0xab, 0x65, 0x6d, 0x9f, 0x9d, 0x8d, 0x59, 0x2e, 0x6a, 0x50, 0x87, 0x46, 0xb5, 0x79, 0xd7, + 0xd5, 0xfd, 0xde, 0x06, 0xc1, 0xc9, 0x42, 0xf4, 0x57, 0x23, 0x89, 0x83, 0x5b, 0x62, 0x92, 0xb2, + 0xda, 0x8d, 0x3a, 0x34, 0x76, 0x9a, 0x3b, 0xae, 0x9e, 0x2e, 0x98, 0xa4, 0xcc, 0x97, 0x1a, 0x71, + 0xd0, 0x94, 0x00, 0xad, 0x24, 0xec, 0x8c, 0x58, 0xaf, 0x76, 0xb3, 0x0e, 0x8d, 0x8a, 0xbf, 0x76, + 0xe7, 0x7c, 0x05, 0xb4, 0x14, 0x4b, 0xc0, 0x97, 0x74, 0xe4, 0x15, 0x9a, 0xaa, 0x57, 0x9e, 0xf2, + 0x24, 0x67, 0x0b, 0xac, 0x7b, 0x9b, 0x58, 0x4a, 0xf5, 0xd7, 0x62, 0x89, 0x8d, 0x95, 0xae, 0xac, + 0x77, 0x7c, 0x28, 0xe1, 0xee, 0xf8, 0xda, 0x27, 0x0e, 0xde, 0x92, 0xcd, 0x25, 0x49, 0xb5, 0x69, + 0xba, 0x6a, 0x3f, 0xed, 0xf2, 0xf4, 0x95, 0xe4, 0xbc, 0xc4, 0xfb, 0xef, 0xb8, 0x88, 0xfb, 0x13, + 0x45, 0xd5, 0x1e, 0x8c, 0x45, 0x8f, 0x7f, 0x4e, 0x96, 0x73, 0xaf, 0x96, 0x87, 0xf5, 0xf2, 0x0e, + 0xc5, 0x07, 0xd7, 0xa7, 0x2a, 0xb4, 0xa7, 0x8f, 0x70, 0xab, 0xdc, 0x0e, 0xb1, 0xd0, 0x2c, 0x07, + 0x38, 0xf5, 0x5b, 0xef, 0x3f, 0xb4, 0xda, 0x81, 0x65, 0x10, 0xc4, 0xed, 0xa3, 0x56, 0x70, 0x7a, + 0x7c, 0x68, 0x41, 0xf3, 0x27, 0x60, 0x45, 0x6f, 0xe2, 0x08, 0x6f, 0x9f, 0x64, 0xbc, 0xcb, 0xf2, + 0x9c, 0xd8, 0x57, 0x3b, 0xde, 0x5c, 0x98, 0xbd, 0xa2, 0x6d, 0x7e, 0x62, 0xc7, 0x68, 0xc0, 0x1e, + 0x10, 0x86, 0xbb, 0xd7, 0xb1, 0x91, 0xc7, 0x57, 0x99, 0xff, 0x18, 0xdb, 0x7e, 0xf2, 0xbf, 0x30, + 0x35, 0xe2, 0xc1, 0xc1, 0x74, 0x46, 0x8d, 0x8b, 0x19, 0x35, 0x2e, 0x67, 0x14, 0xbe, 0x14, 0x14, + 0x7e, 0x14, 0x14, 0x7e, 0x15, 0x14, 0xa6, 0x05, 0x85, 0xdf, 0x05, 0x85, 0x3f, 0x05, 0x35, 0x2e, + 0x0b, 0x0a, 0xdf, 0xe6, 0xd4, 0x98, 0xce, 0xa9, 0x71, 0x31, 0xa7, 0xc6, 0x47, 0x73, 0xf5, 0xa1, + 0x74, 0xb6, 0xe5, 0xff, 0xfa, 0xec, 0x6f, 0x00, 0x00, 0x00, 0xff, 0xff, 0xe9, 0x13, 0x10, 0xda, + 0x5c, 0x03, 0x00, 0x00, } func (x Type) String() string { diff --git a/pkg/lokifrontend/frontend/v1/frontendv1pb/frontend.proto b/pkg/lokifrontend/frontend/v1/frontendv1pb/frontend.proto index 12cc4011a072d..656eccd4d5185 100644 --- a/pkg/lokifrontend/frontend/v1/frontendv1pb/frontend.proto +++ b/pkg/lokifrontend/frontend/v1/frontendv1pb/frontend.proto @@ -4,7 +4,7 @@ syntax = "proto3"; // in order to not break backward compatibility. package frontend; -import "github.com/weaveworks/common/httpgrpc/httpgrpc.proto"; +import "github.com/grafana/dskit/httpgrpc/httpgrpc.proto"; import "gogoproto/gogo.proto"; import "pkg/querier/stats/stats.proto"; diff --git a/pkg/lokifrontend/frontend/v1/queue_test.go b/pkg/lokifrontend/frontend/v1/queue_test.go index 5331367b34b84..24b12863ca0c6 100644 --- a/pkg/lokifrontend/frontend/v1/queue_test.go +++ b/pkg/lokifrontend/frontend/v1/queue_test.go @@ -10,11 +10,11 @@ import ( "github.com/go-kit/log" "github.com/grafana/dskit/flagext" + "github.com/grafana/dskit/httpgrpc" "github.com/grafana/dskit/services" + "github.com/grafana/dskit/user" "github.com/pkg/errors" "github.com/stretchr/testify/require" - "github.com/weaveworks/common/httpgrpc" - "github.com/weaveworks/common/user" "google.golang.org/grpc/metadata" "github.com/grafana/loki/pkg/lokifrontend/frontend/v1/frontendv1pb" diff --git a/pkg/lokifrontend/frontend/v2/frontend.go b/pkg/lokifrontend/frontend/v2/frontend.go index eeadcaeea255d..c085cb86c43d1 100644 --- a/pkg/lokifrontend/frontend/v2/frontend.go +++ b/pkg/lokifrontend/frontend/v2/frontend.go @@ -13,6 +13,7 @@ import ( "github.com/go-kit/log/level" "github.com/grafana/dskit/flagext" "github.com/grafana/dskit/grpcclient" + "github.com/grafana/dskit/httpgrpc" "github.com/grafana/dskit/netutil" "github.com/grafana/dskit/ring" "github.com/grafana/dskit/services" @@ -20,7 +21,6 @@ import ( "github.com/pkg/errors" "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus/promauto" - "github.com/weaveworks/common/httpgrpc" "go.uber.org/atomic" "github.com/grafana/dskit/tenant" diff --git a/pkg/lokifrontend/frontend/v2/frontend_scheduler_worker.go b/pkg/lokifrontend/frontend/v2/frontend_scheduler_worker.go index 67ab60292b21d..22c5f9b9970f4 100644 --- a/pkg/lokifrontend/frontend/v2/frontend_scheduler_worker.go +++ b/pkg/lokifrontend/frontend/v2/frontend_scheduler_worker.go @@ -9,10 +9,10 @@ import ( "github.com/go-kit/log" "github.com/go-kit/log/level" "github.com/grafana/dskit/backoff" + "github.com/grafana/dskit/httpgrpc" "github.com/grafana/dskit/ring" "github.com/grafana/dskit/services" "github.com/pkg/errors" - "github.com/weaveworks/common/httpgrpc" "google.golang.org/grpc" "github.com/grafana/loki/pkg/lokifrontend/frontend/v2/frontendv2pb" diff --git a/pkg/lokifrontend/frontend/v2/frontend_test.go b/pkg/lokifrontend/frontend/v2/frontend_test.go index 5428e06aacaee..0c4223747eb09 100644 --- a/pkg/lokifrontend/frontend/v2/frontend_test.go +++ b/pkg/lokifrontend/frontend/v2/frontend_test.go @@ -11,10 +11,10 @@ import ( "github.com/go-kit/log" "github.com/grafana/dskit/flagext" + "github.com/grafana/dskit/httpgrpc" "github.com/grafana/dskit/services" + "github.com/grafana/dskit/user" "github.com/stretchr/testify/require" - "github.com/weaveworks/common/httpgrpc" - "github.com/weaveworks/common/user" "go.uber.org/atomic" "google.golang.org/grpc" diff --git a/pkg/lokifrontend/frontend/v2/frontendv2pb/frontend.pb.go b/pkg/lokifrontend/frontend/v2/frontendv2pb/frontend.pb.go index 29b90b1e29a9d..20b49f5f639f3 100644 --- a/pkg/lokifrontend/frontend/v2/frontendv2pb/frontend.pb.go +++ b/pkg/lokifrontend/frontend/v2/frontendv2pb/frontend.pb.go @@ -8,8 +8,8 @@ import ( fmt "fmt" _ "github.com/gogo/protobuf/gogoproto" proto "github.com/gogo/protobuf/proto" + httpgrpc "github.com/grafana/dskit/httpgrpc" stats "github.com/grafana/loki/pkg/querier/stats" - httpgrpc "github.com/weaveworks/common/httpgrpc" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" @@ -135,29 +135,29 @@ func init() { } var fileDescriptor_85a7e5cdf8261f06 = []byte{ - // 342 bytes of a gzipped FileDescriptorProto + // 338 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x51, 0xbd, 0x6e, 0xf2, 0x30, - 0x14, 0xb5, 0xbf, 0xaf, 0x3f, 0x92, 0x61, 0x72, 0x7f, 0x14, 0x21, 0xf5, 0x8a, 0x66, 0x62, 0x8a, - 0xa5, 0xb4, 0x43, 0xd5, 0x11, 0x55, 0xa8, 0xdd, 0x4a, 0xca, 0xd4, 0x0d, 0xa8, 0x1b, 0x28, 0x10, - 0x07, 0xdb, 0x01, 0xb1, 0xf5, 0x09, 0xaa, 0x3e, 0x46, 0x1f, 0xa5, 0x23, 0x23, 0x63, 0x31, 0x4b, - 0x47, 0x1e, 0xa1, 0x4a, 0x0c, 0x11, 0x51, 0xa5, 0x2e, 0x57, 0xe7, 0xe6, 0xdc, 0x9b, 0x73, 0xee, - 0x31, 0xb9, 0x8a, 0x07, 0x21, 0x1b, 0x8a, 0x41, 0xff, 0x59, 0x8a, 0x48, 0xf3, 0xe8, 0x89, 0xe5, - 0x60, 0xe2, 0xe7, 0x78, 0xe2, 0xc7, 0x9d, 0xbc, 0xf1, 0x62, 0x29, 0xb4, 0xa0, 0xe5, 0x5d, 0xb2, - 0x72, 0x19, 0xf6, 0x75, 0x2f, 0xe9, 0x78, 0x5d, 0x31, 0x62, 0x53, 0xde, 0x9e, 0xf0, 0xa9, 0x90, - 0x03, 0xc5, 0xba, 0x62, 0x34, 0x12, 0x11, 0xeb, 0x69, 0x1d, 0x87, 0x32, 0xee, 0xe6, 0xc0, 0xfe, - 0xa3, 0x72, 0x1c, 0x8a, 0x50, 0x64, 0x90, 0xa5, 0x68, 0xf3, 0xf5, 0x2c, 0xf5, 0x34, 0x4e, 0xb8, - 0xec, 0x73, 0xc9, 0x94, 0x6e, 0x6b, 0x65, 0xab, 0xa5, 0xdd, 0x37, 0x4c, 0x68, 0x33, 0xe1, 0x72, - 0x16, 0x70, 0x95, 0x0c, 0x75, 0xc0, 0xc7, 0x09, 0x57, 0x9a, 0x3a, 0xe4, 0x30, 0xdd, 0x99, 0xdd, - 0xdd, 0x38, 0xb8, 0x8a, 0x6b, 0x7b, 0xc1, 0xb6, 0xa5, 0xd7, 0xa4, 0x9c, 0xea, 0x06, 0x5c, 0xc5, - 0x22, 0x52, 0xdc, 0xf9, 0x57, 0xc5, 0xb5, 0x92, 0x7f, 0xea, 0xe5, 0x66, 0x6e, 0x5b, 0xad, 0xfb, - 0x2d, 0x1b, 0x14, 0x66, 0xa9, 0x4b, 0xf6, 0x33, 0x6d, 0xe7, 0x7f, 0xb6, 0x54, 0xf6, 0xac, 0x93, - 0x87, 0xb4, 0x06, 0x96, 0x72, 0x4f, 0xc8, 0x51, 0xc1, 0x8f, 0x5d, 0xf5, 0x5f, 0x08, 0x6d, 0x6c, - 0x22, 0x6a, 0x08, 0xd9, 0xb4, 0xf7, 0xd0, 0x16, 0x29, 0xed, 0x0c, 0xd3, 0xaa, 0xb7, 0x1b, 0xa3, - 0xf7, 0xfb, 0xae, 0xca, 0xf9, 0x1f, 0x13, 0x56, 0xc9, 0x45, 0xf5, 0xfa, 0x7c, 0x09, 0x68, 0xb1, - 0x04, 0xb4, 0x5e, 0x02, 0x7e, 0x35, 0x80, 0x3f, 0x0c, 0xe0, 0x4f, 0x03, 0x78, 0x6e, 0x00, 0x7f, - 0x19, 0xc0, 0xdf, 0x06, 0xd0, 0xda, 0x00, 0x7e, 0x5f, 0x01, 0x9a, 0xaf, 0x00, 0x2d, 0x56, 0x80, - 0x1e, 0x0b, 0x4f, 0xd8, 0x39, 0xc8, 0xe2, 0xbd, 0xf8, 0x09, 0x00, 0x00, 0xff, 0xff, 0x01, 0x87, - 0x83, 0x56, 0x13, 0x02, 0x00, 0x00, + 0x14, 0xb5, 0xbf, 0x9f, 0x56, 0x32, 0x4c, 0xee, 0x8f, 0x22, 0xa4, 0x5e, 0xd1, 0x4c, 0x4c, 0x71, + 0x95, 0x2e, 0x55, 0x47, 0x54, 0xa1, 0x76, 0x2b, 0x29, 0x53, 0xb7, 0x00, 0x26, 0xa4, 0xd0, 0x38, + 0xd8, 0x0e, 0x12, 0x5b, 0x9f, 0xa0, 0xea, 0x63, 0xf4, 0x51, 0x3a, 0x32, 0x32, 0x16, 0xb3, 0x74, + 0xe4, 0x11, 0xaa, 0xc4, 0x10, 0x81, 0x2a, 0x75, 0xb9, 0x3a, 0xd7, 0xe7, 0x1e, 0xdd, 0x73, 0x8f, + 0xc9, 0x55, 0x3a, 0x8a, 0xd8, 0x58, 0x8c, 0xe2, 0x81, 0x14, 0x89, 0xe6, 0x49, 0x9f, 0x95, 0x60, + 0xea, 0x97, 0x78, 0xea, 0xa7, 0xdd, 0xb2, 0xf1, 0x52, 0x29, 0xb4, 0xa0, 0xd5, 0x5d, 0xb2, 0x76, + 0x11, 0xc5, 0x7a, 0x98, 0x75, 0xbd, 0x9e, 0x78, 0x66, 0x91, 0x0c, 0x07, 0x61, 0x12, 0xb2, 0xbe, + 0x1a, 0xc5, 0x9a, 0x0d, 0xb5, 0x4e, 0x23, 0x99, 0xf6, 0x4a, 0x60, 0xf5, 0xb5, 0xe3, 0x48, 0x44, + 0xa2, 0x80, 0x2c, 0x47, 0x9b, 0xd7, 0xb3, 0xdc, 0xcf, 0x24, 0xe3, 0x32, 0xe6, 0x92, 0x29, 0x1d, + 0x6a, 0x65, 0xab, 0xa5, 0xdd, 0x57, 0x4c, 0x68, 0x3b, 0xe3, 0x72, 0x16, 0x70, 0x95, 0x8d, 0x75, + 0xc0, 0x27, 0x19, 0x57, 0x9a, 0x3a, 0xe4, 0x30, 0xd7, 0xcc, 0xee, 0x6e, 0x1c, 0x5c, 0xc7, 0x8d, + 0x7f, 0xc1, 0xb6, 0xa5, 0xd7, 0xa4, 0x9a, 0xef, 0x0d, 0xb8, 0x4a, 0x45, 0xa2, 0xb8, 0xf3, 0xa7, + 0x8e, 0x1b, 0x15, 0xff, 0xd4, 0x2b, 0xcd, 0xdc, 0x76, 0x3a, 0xf7, 0x5b, 0x36, 0xd8, 0x9b, 0xa5, + 0x2e, 0xf9, 0x5f, 0xec, 0x76, 0xfe, 0x16, 0xa2, 0xaa, 0x67, 0x9d, 0x3c, 0xe4, 0x35, 0xb0, 0x94, + 0x7b, 0x42, 0x8e, 0xf6, 0xfc, 0x58, 0xa9, 0xff, 0x44, 0x68, 0x6b, 0x13, 0x4f, 0x4b, 0xc8, 0xb6, + 0xbd, 0x87, 0x76, 0x48, 0x65, 0x67, 0x98, 0xd6, 0xbd, 0xdd, 0x08, 0xbd, 0x9f, 0x77, 0xd5, 0xce, + 0x7f, 0x99, 0xb0, 0x9b, 0x5c, 0xd4, 0x6c, 0xce, 0x97, 0x80, 0x16, 0x4b, 0x40, 0xeb, 0x25, 0xe0, + 0x17, 0x03, 0xf8, 0xdd, 0x00, 0xfe, 0x30, 0x80, 0xe7, 0x06, 0xf0, 0xa7, 0x01, 0xfc, 0x65, 0x00, + 0xad, 0x0d, 0xe0, 0xb7, 0x15, 0xa0, 0xf9, 0x0a, 0xd0, 0x62, 0x05, 0xe8, 0x71, 0xef, 0xfb, 0xba, + 0x07, 0x45, 0xbc, 0x97, 0xdf, 0x01, 0x00, 0x00, 0xff, 0xff, 0x2c, 0x9c, 0x3b, 0xb1, 0x0f, 0x02, + 0x00, 0x00, } func (this *QueryResultRequest) Equal(that interface{}) bool { diff --git a/pkg/lokifrontend/frontend/v2/frontendv2pb/frontend.proto b/pkg/lokifrontend/frontend/v2/frontendv2pb/frontend.proto index 444943bf0c3b8..7e68503d9f945 100644 --- a/pkg/lokifrontend/frontend/v2/frontendv2pb/frontend.proto +++ b/pkg/lokifrontend/frontend/v2/frontendv2pb/frontend.proto @@ -2,7 +2,7 @@ syntax = "proto3"; package frontendv2pb; -import "github.com/weaveworks/common/httpgrpc/httpgrpc.proto"; +import "github.com/grafana/dskit/httpgrpc/httpgrpc.proto"; import "gogoproto/gogo.proto"; import "pkg/querier/stats/stats.proto"; diff --git a/pkg/push/go.sum b/pkg/push/go.sum index 47baafb905de9..250803ad13e6e 100644 --- a/pkg/push/go.sum +++ b/pkg/push/go.sum @@ -31,6 +31,7 @@ github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9dec golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/exp v0.0.0-20230321023759-10a507213a29/go.mod h1:CxIveKay+FTh1D0yPZemJVgC/95VzuuOLq5Qi4xnoYc= golang.org/x/exp v0.0.0-20230713183714-613f0c0eb8a1 h1:MGwJjxBy0HJshjDNfLsYO8xppfqWlA5ZT9OhtUUhTNw= golang.org/x/exp v0.0.0-20230713183714-613f0c0eb8a1/go.mod h1:FXUEEKJgO7OQYeo8N01OfiKP8RXMtf6e8aTskBGqWdc= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= diff --git a/pkg/querier/http.go b/pkg/querier/http.go index 8fe33b92920ba..330a17d7ac639 100644 --- a/pkg/querier/http.go +++ b/pkg/querier/http.go @@ -10,13 +10,13 @@ import ( "github.com/go-kit/log" "github.com/go-kit/log/level" "github.com/gorilla/websocket" + "github.com/grafana/dskit/httpgrpc" + "github.com/grafana/dskit/middleware" "github.com/opentracing/opentracing-go" "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/weaveworks/common/httpgrpc" - "github.com/weaveworks/common/middleware" "github.com/grafana/dskit/tenant" diff --git a/pkg/querier/http_test.go b/pkg/querier/http_test.go index 3019af0bf1d78..0aa45d9962c9b 100644 --- a/pkg/querier/http_test.go +++ b/pkg/querier/http_test.go @@ -19,9 +19,9 @@ import ( "github.com/go-kit/log" "github.com/grafana/dskit/tenant" + "github.com/grafana/dskit/user" "github.com/prometheus/common/model" "github.com/stretchr/testify/require" - "github.com/weaveworks/common/user" ) var ( diff --git a/pkg/querier/ingester_querier.go b/pkg/querier/ingester_querier.go index 942442ebc3fad..c0af7fecfd80c 100644 --- a/pkg/querier/ingester_querier.go +++ b/pkg/querier/ingester_querier.go @@ -9,13 +9,13 @@ import ( "github.com/grafana/loki/pkg/storage/stores/index/seriesvolume" "github.com/gogo/status" + "github.com/grafana/dskit/httpgrpc" "github.com/grafana/dskit/ring" ring_client "github.com/grafana/dskit/ring/client" "github.com/grafana/dskit/services" "github.com/pkg/errors" "github.com/prometheus/common/model" "github.com/prometheus/prometheus/model/labels" - "github.com/weaveworks/common/httpgrpc" "google.golang.org/grpc/codes" "github.com/grafana/loki/pkg/distributor/clientpool" diff --git a/pkg/querier/multi_tenant_querier.go b/pkg/querier/multi_tenant_querier.go index 55cd6142a8ff3..c9b1b56b8b284 100644 --- a/pkg/querier/multi_tenant_querier.go +++ b/pkg/querier/multi_tenant_querier.go @@ -6,8 +6,8 @@ import ( "github.com/grafana/loki/pkg/storage/stores/index/seriesvolume" "github.com/go-kit/log" + "github.com/grafana/dskit/user" "github.com/prometheus/prometheus/model/labels" - "github.com/weaveworks/common/user" "github.com/grafana/dskit/tenant" diff --git a/pkg/querier/multi_tenant_querier_test.go b/pkg/querier/multi_tenant_querier_test.go index 54221e3f0eccd..0a74fe957677b 100644 --- a/pkg/querier/multi_tenant_querier_test.go +++ b/pkg/querier/multi_tenant_querier_test.go @@ -10,10 +10,10 @@ import ( "unicode" "github.com/go-kit/log" + "github.com/grafana/dskit/user" "github.com/prometheus/prometheus/model/labels" "github.com/stretchr/testify/mock" "github.com/stretchr/testify/require" - "github.com/weaveworks/common/user" "github.com/grafana/dskit/tenant" diff --git a/pkg/querier/querier.go b/pkg/querier/querier.go index 31cfcf1611a5f..6fc2576d5dd24 100644 --- a/pkg/querier/querier.go +++ b/pkg/querier/querier.go @@ -11,12 +11,12 @@ import ( "github.com/grafana/loki/pkg/storage/stores/index/seriesvolume" "github.com/go-kit/log/level" + "github.com/grafana/dskit/httpgrpc" "github.com/grafana/dskit/tenant" "github.com/pkg/errors" "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/common/model" "github.com/prometheus/prometheus/model/labels" - "github.com/weaveworks/common/httpgrpc" "golang.org/x/sync/errgroup" "google.golang.org/grpc/health/grpc_health_v1" diff --git a/pkg/querier/querier_test.go b/pkg/querier/querier_test.go index d5766737dccc4..7610854e375c9 100644 --- a/pkg/querier/querier_test.go +++ b/pkg/querier/querier_test.go @@ -9,14 +9,14 @@ import ( "time" "github.com/grafana/dskit/flagext" + "github.com/grafana/dskit/httpgrpc" "github.com/grafana/dskit/ring" ring_client "github.com/grafana/dskit/ring/client" + "github.com/grafana/dskit/user" "github.com/prometheus/common/model" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" "github.com/stretchr/testify/require" - "github.com/weaveworks/common/httpgrpc" - "github.com/weaveworks/common/user" "github.com/grafana/loki/pkg/ingester/client" "github.com/grafana/loki/pkg/logproto" diff --git a/pkg/querier/queryrange/codec.go b/pkg/querier/queryrange/codec.go index 6e0bfcea0a386..269ea7cff501a 100644 --- a/pkg/querier/queryrange/codec.go +++ b/pkg/querier/queryrange/codec.go @@ -15,11 +15,11 @@ import ( "github.com/grafana/loki/pkg/storage/stores/index/seriesvolume" + "github.com/grafana/dskit/httpgrpc" json "github.com/json-iterator/go" "github.com/opentracing/opentracing-go" otlog "github.com/opentracing/opentracing-go/log" "github.com/prometheus/prometheus/model/timestamp" - "github.com/weaveworks/common/httpgrpc" "github.com/grafana/loki/pkg/loghttp" "github.com/grafana/loki/pkg/logproto" diff --git a/pkg/querier/queryrange/downstreamer_test.go b/pkg/querier/queryrange/downstreamer_test.go index a93c0f6cc6e37..552c0c53aa056 100644 --- a/pkg/querier/queryrange/downstreamer_test.go +++ b/pkg/querier/queryrange/downstreamer_test.go @@ -8,10 +8,10 @@ import ( "testing" "time" + "github.com/grafana/dskit/user" "github.com/prometheus/prometheus/model/labels" "github.com/prometheus/prometheus/promql" "github.com/stretchr/testify/require" - "github.com/weaveworks/common/user" "go.uber.org/atomic" "github.com/grafana/loki/pkg/logproto" diff --git a/pkg/querier/queryrange/index_stats_cache_test.go b/pkg/querier/queryrange/index_stats_cache_test.go index 4010e56a09abd..3024ba60dada4 100644 --- a/pkg/querier/queryrange/index_stats_cache_test.go +++ b/pkg/querier/queryrange/index_stats_cache_test.go @@ -7,9 +7,9 @@ import ( "time" "github.com/go-kit/log" + "github.com/grafana/dskit/user" "github.com/prometheus/common/model" "github.com/stretchr/testify/require" - "github.com/weaveworks/common/user" "github.com/grafana/loki/pkg/logproto" "github.com/grafana/loki/pkg/logqlmodel/stats" diff --git a/pkg/querier/queryrange/limits.go b/pkg/querier/queryrange/limits.go index a8b379adb44ba..99967b3e24513 100644 --- a/pkg/querier/queryrange/limits.go +++ b/pkg/querier/queryrange/limits.go @@ -12,14 +12,14 @@ import ( "github.com/dustin/go-humanize" "github.com/go-kit/log" "github.com/go-kit/log/level" + "github.com/grafana/dskit/httpgrpc" "github.com/grafana/dskit/tenant" + "github.com/grafana/dskit/user" "github.com/opentracing/opentracing-go" "github.com/pkg/errors" "github.com/prometheus/common/model" "github.com/prometheus/prometheus/model/labels" "github.com/prometheus/prometheus/model/timestamp" - "github.com/weaveworks/common/httpgrpc" - "github.com/weaveworks/common/user" "golang.org/x/sync/semaphore" "github.com/grafana/loki/pkg/logproto" diff --git a/pkg/querier/queryrange/limits_test.go b/pkg/querier/queryrange/limits_test.go index fd84c6244ad19..5a11e49979334 100644 --- a/pkg/querier/queryrange/limits_test.go +++ b/pkg/querier/queryrange/limits_test.go @@ -8,11 +8,11 @@ import ( "testing" "time" + "github.com/grafana/dskit/user" "github.com/prometheus/common/model" "github.com/prometheus/prometheus/model/labels" "github.com/prometheus/prometheus/promql" "github.com/stretchr/testify/require" - "github.com/weaveworks/common/user" "go.uber.org/atomic" "gopkg.in/yaml.v2" diff --git a/pkg/querier/queryrange/log_result_cache.go b/pkg/querier/queryrange/log_result_cache.go index 827229dd0d83d..3f0555709b9e7 100644 --- a/pkg/querier/queryrange/log_result_cache.go +++ b/pkg/querier/queryrange/log_result_cache.go @@ -9,11 +9,11 @@ import ( "github.com/go-kit/log" "github.com/go-kit/log/level" "github.com/gogo/protobuf/proto" + "github.com/grafana/dskit/httpgrpc" "github.com/opentracing/opentracing-go" "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus/promauto" "github.com/prometheus/common/model" - "github.com/weaveworks/common/httpgrpc" "golang.org/x/sync/errgroup" "github.com/grafana/dskit/tenant" diff --git a/pkg/querier/queryrange/log_result_cache_test.go b/pkg/querier/queryrange/log_result_cache_test.go index 916a4d20d117f..815e24b77ea9e 100644 --- a/pkg/querier/queryrange/log_result_cache_test.go +++ b/pkg/querier/queryrange/log_result_cache_test.go @@ -7,11 +7,11 @@ import ( "time" "github.com/go-kit/log" + "github.com/grafana/dskit/user" "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus/testutil" "github.com/stretchr/testify/mock" "github.com/stretchr/testify/require" - "github.com/weaveworks/common/user" "github.com/grafana/loki/pkg/loghttp" "github.com/grafana/loki/pkg/logproto" diff --git a/pkg/querier/queryrange/queryrangebase/instrumentation.go b/pkg/querier/queryrange/queryrangebase/instrumentation.go index 2b1808a04a939..813e73be5656b 100644 --- a/pkg/querier/queryrange/queryrangebase/instrumentation.go +++ b/pkg/querier/queryrange/queryrangebase/instrumentation.go @@ -4,9 +4,9 @@ import ( "context" "time" + "github.com/grafana/dskit/instrument" "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus/promauto" - "github.com/weaveworks/common/instrument" ) // InstrumentMiddleware can be inserted into the middleware chain to expose timing information. diff --git a/pkg/querier/queryrange/queryrangebase/middleware.go b/pkg/querier/queryrange/queryrangebase/middleware.go index bccb6feeadfd5..4e60ce2dec490 100644 --- a/pkg/querier/queryrange/queryrangebase/middleware.go +++ b/pkg/querier/queryrange/queryrangebase/middleware.go @@ -3,8 +3,8 @@ package queryrangebase import ( "net/http" + "github.com/grafana/dskit/middleware" "github.com/grafana/dskit/tenant" - "github.com/weaveworks/common/middleware" ) const ( diff --git a/pkg/querier/queryrange/queryrangebase/middleware_test.go b/pkg/querier/queryrange/queryrangebase/middleware_test.go index 75cafe6489e39..b5517046308a8 100644 --- a/pkg/querier/queryrange/queryrangebase/middleware_test.go +++ b/pkg/querier/queryrange/queryrangebase/middleware_test.go @@ -6,7 +6,7 @@ import ( "net/http/httptest" "testing" - "github.com/weaveworks/common/user" + "github.com/grafana/dskit/user" "github.com/stretchr/testify/assert" ) diff --git a/pkg/querier/queryrange/queryrangebase/query_range.go b/pkg/querier/queryrange/queryrangebase/query_range.go index e93415513ccd5..70fe36dfc08f0 100644 --- a/pkg/querier/queryrange/queryrangebase/query_range.go +++ b/pkg/querier/queryrange/queryrangebase/query_range.go @@ -14,12 +14,12 @@ import ( "time" "github.com/gogo/status" + "github.com/grafana/dskit/httpgrpc" jsoniter "github.com/json-iterator/go" "github.com/opentracing/opentracing-go" otlog "github.com/opentracing/opentracing-go/log" "github.com/prometheus/common/model" "github.com/prometheus/prometheus/model/timestamp" - "github.com/weaveworks/common/httpgrpc" "github.com/grafana/loki/pkg/logproto" "github.com/grafana/loki/pkg/util" diff --git a/pkg/querier/queryrange/queryrangebase/query_range_test.go b/pkg/querier/queryrange/queryrangebase/query_range_test.go index 1e5c024a557f7..ed46ea66adfd9 100644 --- a/pkg/querier/queryrange/queryrangebase/query_range_test.go +++ b/pkg/querier/queryrange/queryrangebase/query_range_test.go @@ -8,11 +8,11 @@ import ( "strconv" "testing" + "github.com/grafana/dskit/httpgrpc" + "github.com/grafana/dskit/user" jsoniter "github.com/json-iterator/go" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/weaveworks/common/httpgrpc" - "github.com/weaveworks/common/user" "github.com/grafana/loki/pkg/logproto" ) diff --git a/pkg/querier/queryrange/queryrangebase/results_cache.go b/pkg/querier/queryrange/queryrangebase/results_cache.go index 35874a0376520..dde58eb027e0f 100644 --- a/pkg/querier/queryrange/queryrangebase/results_cache.go +++ b/pkg/querier/queryrange/queryrangebase/results_cache.go @@ -14,6 +14,8 @@ import ( "github.com/gogo/protobuf/proto" "github.com/gogo/protobuf/types" "github.com/grafana/dskit/flagext" + "github.com/grafana/dskit/httpgrpc" + "github.com/grafana/dskit/user" "github.com/opentracing/opentracing-go" otlog "github.com/opentracing/opentracing-go/log" "github.com/pkg/errors" @@ -24,8 +26,6 @@ import ( "github.com/prometheus/prometheus/promql" "github.com/prometheus/prometheus/promql/parser" "github.com/uber/jaeger-client-go" - "github.com/weaveworks/common/httpgrpc" - "github.com/weaveworks/common/user" "github.com/grafana/dskit/tenant" diff --git a/pkg/querier/queryrange/queryrangebase/results_cache_test.go b/pkg/querier/queryrange/queryrangebase/results_cache_test.go index 52e3869721a6b..93302bf42612d 100644 --- a/pkg/querier/queryrange/queryrangebase/results_cache_test.go +++ b/pkg/querier/queryrange/queryrangebase/results_cache_test.go @@ -10,10 +10,10 @@ import ( "github.com/go-kit/log" "github.com/gogo/protobuf/types" "github.com/grafana/dskit/flagext" + "github.com/grafana/dskit/user" "github.com/prometheus/common/model" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/weaveworks/common/user" "github.com/grafana/loki/pkg/logproto" "github.com/grafana/loki/pkg/logqlmodel/stats" diff --git a/pkg/querier/queryrange/queryrangebase/retry.go b/pkg/querier/queryrange/queryrangebase/retry.go index 7b4ffb964f6b6..5f23c4defa20a 100644 --- a/pkg/querier/queryrange/queryrangebase/retry.go +++ b/pkg/querier/queryrange/queryrangebase/retry.go @@ -5,9 +5,9 @@ import ( "github.com/go-kit/log" "github.com/go-kit/log/level" + "github.com/grafana/dskit/httpgrpc" "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus/promauto" - "github.com/weaveworks/common/httpgrpc" util_log "github.com/grafana/loki/pkg/util/log" ) diff --git a/pkg/querier/queryrange/queryrangebase/retry_test.go b/pkg/querier/queryrange/queryrangebase/retry_test.go index 3ad45708d5994..71d05b61ebc58 100644 --- a/pkg/querier/queryrange/queryrangebase/retry_test.go +++ b/pkg/querier/queryrange/queryrangebase/retry_test.go @@ -8,8 +8,8 @@ import ( "testing" "github.com/go-kit/log" + "github.com/grafana/dskit/httpgrpc" "github.com/stretchr/testify/require" - "github.com/weaveworks/common/httpgrpc" "go.uber.org/atomic" ) diff --git a/pkg/querier/queryrange/queryrangebase/roundtrip.go b/pkg/querier/queryrange/queryrangebase/roundtrip.go index e723b85a45068..8f51c0f2b567f 100644 --- a/pkg/querier/queryrange/queryrangebase/roundtrip.go +++ b/pkg/querier/queryrange/queryrangebase/roundtrip.go @@ -23,10 +23,10 @@ import ( "time" "github.com/grafana/dskit/flagext" + "github.com/grafana/dskit/httpgrpc" + "github.com/grafana/dskit/user" "github.com/opentracing/opentracing-go" "github.com/pkg/errors" - "github.com/weaveworks/common/httpgrpc" - "github.com/weaveworks/common/user" ) const day = 24 * time.Hour diff --git a/pkg/querier/queryrange/querysharding.go b/pkg/querier/queryrange/querysharding.go index a0a922eeb776c..8027afa3c757d 100644 --- a/pkg/querier/queryrange/querysharding.go +++ b/pkg/querier/queryrange/querysharding.go @@ -9,11 +9,11 @@ import ( "github.com/dustin/go-humanize" "github.com/go-kit/log" "github.com/go-kit/log/level" + "github.com/grafana/dskit/httpgrpc" "github.com/grafana/dskit/tenant" "github.com/pkg/errors" "github.com/prometheus/common/model" "github.com/prometheus/prometheus/promql/parser" - "github.com/weaveworks/common/httpgrpc" "github.com/grafana/loki/pkg/loghttp" "github.com/grafana/loki/pkg/logql" diff --git a/pkg/querier/queryrange/querysharding_test.go b/pkg/querier/queryrange/querysharding_test.go index 9288dd726862c..48eb2592391a2 100644 --- a/pkg/querier/queryrange/querysharding_test.go +++ b/pkg/querier/queryrange/querysharding_test.go @@ -12,9 +12,9 @@ import ( "time" "github.com/go-kit/log" + "github.com/grafana/dskit/user" "github.com/prometheus/common/model" "github.com/stretchr/testify/require" - "github.com/weaveworks/common/user" "github.com/grafana/loki/pkg/loghttp" "github.com/grafana/loki/pkg/logproto" diff --git a/pkg/querier/queryrange/roundtrip.go b/pkg/querier/queryrange/roundtrip.go index ee7bdd22e0bcb..9100f96619b80 100644 --- a/pkg/querier/queryrange/roundtrip.go +++ b/pkg/querier/queryrange/roundtrip.go @@ -7,15 +7,15 @@ import ( "strings" "time" - "github.com/weaveworks/common/user" + "github.com/grafana/dskit/user" "github.com/go-kit/log" "github.com/go-kit/log/level" + "github.com/grafana/dskit/httpgrpc" "github.com/pkg/errors" "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/common/model" "github.com/prometheus/prometheus/model/labels" - "github.com/weaveworks/common/httpgrpc" "github.com/grafana/loki/pkg/loghttp" "github.com/grafana/loki/pkg/logql" diff --git a/pkg/querier/queryrange/roundtrip_test.go b/pkg/querier/queryrange/roundtrip_test.go index f853551a12395..f77ec4aae9b1c 100644 --- a/pkg/querier/queryrange/roundtrip_test.go +++ b/pkg/querier/queryrange/roundtrip_test.go @@ -15,15 +15,15 @@ import ( "testing" "time" + "github.com/grafana/dskit/httpgrpc" + "github.com/grafana/dskit/middleware" + "github.com/grafana/dskit/user" "github.com/prometheus/common/model" "github.com/prometheus/prometheus/model/labels" "github.com/prometheus/prometheus/promql" "github.com/prometheus/prometheus/promql/parser" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/weaveworks/common/httpgrpc" - "github.com/weaveworks/common/middleware" - "github.com/weaveworks/common/user" "github.com/grafana/loki/pkg/loghttp" "github.com/grafana/loki/pkg/logproto" diff --git a/pkg/querier/queryrange/series_volume.go b/pkg/querier/queryrange/series_volume.go index 07eeab3a085bf..44b88a1d907ca 100644 --- a/pkg/querier/queryrange/series_volume.go +++ b/pkg/querier/queryrange/series_volume.go @@ -7,10 +7,10 @@ import ( "time" "github.com/grafana/dskit/concurrency" + "github.com/grafana/dskit/httpgrpc" + "github.com/grafana/dskit/user" "github.com/prometheus/common/model" "github.com/prometheus/prometheus/model/labels" - "github.com/weaveworks/common/httpgrpc" - "github.com/weaveworks/common/user" "github.com/grafana/loki/pkg/loghttp" "github.com/grafana/loki/pkg/logproto" diff --git a/pkg/querier/queryrange/split_by_interval.go b/pkg/querier/queryrange/split_by_interval.go index 88d6157f5a40b..8f12fcb1960c8 100644 --- a/pkg/querier/queryrange/split_by_interval.go +++ b/pkg/querier/queryrange/split_by_interval.go @@ -5,12 +5,12 @@ import ( "net/http" "time" + "github.com/grafana/dskit/httpgrpc" "github.com/opentracing/opentracing-go" otlog "github.com/opentracing/opentracing-go/log" "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus/promauto" "github.com/prometheus/common/model" - "github.com/weaveworks/common/httpgrpc" "github.com/grafana/loki/pkg/util/math" diff --git a/pkg/querier/queryrange/split_by_interval_test.go b/pkg/querier/queryrange/split_by_interval_test.go index 81d788d9fd1e2..7c09b5f786d24 100644 --- a/pkg/querier/queryrange/split_by_interval_test.go +++ b/pkg/querier/queryrange/split_by_interval_test.go @@ -11,8 +11,8 @@ import ( "github.com/prometheus/common/model" + "github.com/grafana/dskit/user" "github.com/stretchr/testify/require" - "github.com/weaveworks/common/user" "gopkg.in/yaml.v2" "github.com/grafana/loki/pkg/loghttp" diff --git a/pkg/querier/queryrange/split_by_range.go b/pkg/querier/queryrange/split_by_range.go index 070af6e3ef610..8fa24eb3b27b7 100644 --- a/pkg/querier/queryrange/split_by_range.go +++ b/pkg/querier/queryrange/split_by_range.go @@ -7,9 +7,9 @@ import ( "github.com/go-kit/log" "github.com/go-kit/log/level" + "github.com/grafana/dskit/httpgrpc" "github.com/grafana/dskit/tenant" "github.com/prometheus/prometheus/promql/parser" - "github.com/weaveworks/common/httpgrpc" "github.com/grafana/loki/pkg/loghttp" "github.com/grafana/loki/pkg/logql" diff --git a/pkg/querier/queryrange/split_by_range_test.go b/pkg/querier/queryrange/split_by_range_test.go index c46704a6f8db9..c3b4587a1dbb1 100644 --- a/pkg/querier/queryrange/split_by_range_test.go +++ b/pkg/querier/queryrange/split_by_range_test.go @@ -9,8 +9,8 @@ import ( "github.com/grafana/loki/pkg/loghttp" "github.com/go-kit/log" + "github.com/grafana/dskit/user" "github.com/stretchr/testify/require" - "github.com/weaveworks/common/user" "github.com/grafana/loki/pkg/logproto" "github.com/grafana/loki/pkg/querier/queryrange/queryrangebase" diff --git a/pkg/querier/queryrange/stats.go b/pkg/querier/queryrange/stats.go index 07ce9ec908695..fc861c2debf66 100644 --- a/pkg/querier/queryrange/stats.go +++ b/pkg/querier/queryrange/stats.go @@ -14,8 +14,8 @@ import ( "github.com/go-kit/log" "github.com/go-kit/log/level" + "github.com/grafana/dskit/middleware" promql_parser "github.com/prometheus/prometheus/promql/parser" - "github.com/weaveworks/common/middleware" "github.com/grafana/loki/pkg/logql" "github.com/grafana/loki/pkg/logqlmodel" diff --git a/pkg/querier/stats/stats.go b/pkg/querier/stats/stats.go index 1a39b320696c1..91999c8dad63e 100644 --- a/pkg/querier/stats/stats.go +++ b/pkg/querier/stats/stats.go @@ -5,7 +5,7 @@ import ( "sync/atomic" //lint:ignore faillint we can't use go.uber.org/atomic with a protobuf struct without wrapping it. "time" - "github.com/weaveworks/common/httpgrpc" + "github.com/grafana/dskit/httpgrpc" ) type contextKey int diff --git a/pkg/querier/worker/frontend_processor.go b/pkg/querier/worker/frontend_processor.go index 310b982926561..4394495db2d4d 100644 --- a/pkg/querier/worker/frontend_processor.go +++ b/pkg/querier/worker/frontend_processor.go @@ -9,7 +9,7 @@ import ( "github.com/go-kit/log" "github.com/go-kit/log/level" "github.com/grafana/dskit/backoff" - "github.com/weaveworks/common/httpgrpc" + "github.com/grafana/dskit/httpgrpc" "google.golang.org/grpc" "github.com/grafana/loki/pkg/lokifrontend/frontend/v1/frontendv1pb" diff --git a/pkg/querier/worker/scheduler_processor.go b/pkg/querier/worker/scheduler_processor.go index 3d1cb9a329909..30f7b003bc594 100644 --- a/pkg/querier/worker/scheduler_processor.go +++ b/pkg/querier/worker/scheduler_processor.go @@ -12,14 +12,14 @@ import ( "github.com/gogo/status" "github.com/grafana/dskit/backoff" "github.com/grafana/dskit/grpcclient" + "github.com/grafana/dskit/httpgrpc" + "github.com/grafana/dskit/middleware" "github.com/grafana/dskit/multierror" "github.com/grafana/dskit/ring/client" "github.com/grafana/dskit/services" + "github.com/grafana/dskit/user" otgrpc "github.com/opentracing-contrib/go-grpc" "github.com/opentracing/opentracing-go" - "github.com/weaveworks/common/httpgrpc" - "github.com/weaveworks/common/middleware" - "github.com/weaveworks/common/user" "go.uber.org/atomic" "google.golang.org/grpc" "google.golang.org/grpc/health/grpc_health_v1" diff --git a/pkg/querier/worker/scheduler_processor_test.go b/pkg/querier/worker/scheduler_processor_test.go index 1fe9eff6defcc..c720c93189cd9 100644 --- a/pkg/querier/worker/scheduler_processor_test.go +++ b/pkg/querier/worker/scheduler_processor_test.go @@ -10,10 +10,10 @@ import ( "github.com/go-kit/log" "github.com/gogo/status" "github.com/grafana/dskit/concurrency" + "github.com/grafana/dskit/httpgrpc" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" "github.com/stretchr/testify/require" - "github.com/weaveworks/common/httpgrpc" "go.uber.org/atomic" "google.golang.org/grpc" "google.golang.org/grpc/codes" diff --git a/pkg/querier/worker/worker.go b/pkg/querier/worker/worker.go index a624378027271..921b7c8a9bfb0 100644 --- a/pkg/querier/worker/worker.go +++ b/pkg/querier/worker/worker.go @@ -10,11 +10,11 @@ import ( "github.com/go-kit/log" "github.com/go-kit/log/level" "github.com/grafana/dskit/grpcclient" + "github.com/grafana/dskit/httpgrpc" "github.com/grafana/dskit/ring" "github.com/grafana/dskit/services" "github.com/pkg/errors" "github.com/prometheus/client_golang/prometheus" - "github.com/weaveworks/common/httpgrpc" "google.golang.org/grpc" "github.com/grafana/loki/pkg/util" diff --git a/pkg/querier/worker_service.go b/pkg/querier/worker_service.go index 6dc41b604ab1c..6e174522ac8b5 100644 --- a/pkg/querier/worker_service.go +++ b/pkg/querier/worker_service.go @@ -6,13 +6,13 @@ import ( "github.com/go-kit/log/level" "github.com/gorilla/mux" + httpgrpc_server "github.com/grafana/dskit/httpgrpc/server" + "github.com/grafana/dskit/middleware" "github.com/grafana/dskit/ring" "github.com/grafana/dskit/services" "github.com/opentracing-contrib/go-stdlib/nethttp" "github.com/opentracing/opentracing-go" "github.com/prometheus/client_golang/prometheus" - httpgrpc_server "github.com/weaveworks/common/httpgrpc/server" - "github.com/weaveworks/common/middleware" querier_worker "github.com/grafana/loki/pkg/querier/worker" "github.com/grafana/loki/pkg/util/httpreq" diff --git a/pkg/querier/worker_service_test.go b/pkg/querier/worker_service_test.go index 3e9b292477518..e4f025e657181 100644 --- a/pkg/querier/worker_service_test.go +++ b/pkg/querier/worker_service_test.go @@ -6,10 +6,10 @@ import ( "testing" "github.com/gorilla/mux" + "github.com/grafana/dskit/middleware" "github.com/grafana/dskit/services" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/weaveworks/common/middleware" querier_worker "github.com/grafana/loki/pkg/querier/worker" ) diff --git a/pkg/ruler/base/api.go b/pkg/ruler/base/api.go index cfef70e1321be..103470b34c1e6 100644 --- a/pkg/ruler/base/api.go +++ b/pkg/ruler/base/api.go @@ -13,11 +13,11 @@ import ( "github.com/go-kit/log" "github.com/go-kit/log/level" "github.com/gorilla/mux" + "github.com/grafana/dskit/user" "github.com/pkg/errors" v1 "github.com/prometheus/client_golang/api/prometheus/v1" "github.com/prometheus/prometheus/model/labels" "github.com/prometheus/prometheus/model/rulefmt" - "github.com/weaveworks/common/user" "gopkg.in/yaml.v3" "github.com/grafana/dskit/tenant" diff --git a/pkg/ruler/base/api_test.go b/pkg/ruler/base/api_test.go index 19d6c3c0d760c..4de5cc3876142 100644 --- a/pkg/ruler/base/api_test.go +++ b/pkg/ruler/base/api_test.go @@ -13,8 +13,8 @@ import ( "github.com/go-kit/log" "github.com/gorilla/mux" "github.com/grafana/dskit/services" + "github.com/grafana/dskit/user" "github.com/stretchr/testify/require" - "github.com/weaveworks/common/user" "github.com/grafana/loki/pkg/ruler/rulespb" ) diff --git a/pkg/ruler/base/client_pool_test.go b/pkg/ruler/base/client_pool_test.go index 190f499cbb9e1..872f61d33c760 100644 --- a/pkg/ruler/base/client_pool_test.go +++ b/pkg/ruler/base/client_pool_test.go @@ -7,11 +7,11 @@ import ( "github.com/grafana/dskit/flagext" "github.com/grafana/dskit/grpcclient" + "github.com/grafana/dskit/user" "github.com/prometheus/client_golang/prometheus" dto "github.com/prometheus/client_model/go" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/weaveworks/common/user" "google.golang.org/grpc" ) diff --git a/pkg/ruler/base/compat.go b/pkg/ruler/base/compat.go index 1e34ca6fb1b49..9503f131dc00e 100644 --- a/pkg/ruler/base/compat.go +++ b/pkg/ruler/base/compat.go @@ -7,6 +7,8 @@ import ( "github.com/go-kit/log" "github.com/go-kit/log/level" + "github.com/grafana/dskit/httpgrpc" + "github.com/grafana/dskit/user" "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus/promauto" "github.com/prometheus/prometheus/model/exemplar" @@ -18,8 +20,6 @@ import ( "github.com/prometheus/prometheus/promql" "github.com/prometheus/prometheus/rules" "github.com/prometheus/prometheus/storage" - "github.com/weaveworks/common/httpgrpc" - "github.com/weaveworks/common/user" "github.com/grafana/loki/pkg/logproto" "github.com/grafana/loki/pkg/ruler/config" diff --git a/pkg/ruler/base/compat_test.go b/pkg/ruler/base/compat_test.go index 0ef2f4875486a..ba5242b43edea 100644 --- a/pkg/ruler/base/compat_test.go +++ b/pkg/ruler/base/compat_test.go @@ -9,6 +9,7 @@ import ( "time" "github.com/go-kit/log" + "github.com/grafana/dskit/httpgrpc" "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus/testutil" "github.com/prometheus/common/model" @@ -16,7 +17,6 @@ import ( "github.com/prometheus/prometheus/promql" "github.com/prometheus/prometheus/promql/parser" "github.com/stretchr/testify/require" - "github.com/weaveworks/common/httpgrpc" "github.com/grafana/loki/pkg/logproto" ) diff --git a/pkg/ruler/base/manager.go b/pkg/ruler/base/manager.go index eb26dc5f74358..c6bbf70c35a3d 100644 --- a/pkg/ruler/base/manager.go +++ b/pkg/ruler/base/manager.go @@ -8,6 +8,7 @@ import ( "github.com/go-kit/log" "github.com/go-kit/log/level" + "github.com/grafana/dskit/user" ot "github.com/opentracing/opentracing-go" "github.com/pkg/errors" "github.com/prometheus/client_golang/prometheus" @@ -16,7 +17,6 @@ import ( "github.com/prometheus/prometheus/model/rulefmt" "github.com/prometheus/prometheus/notifier" promRules "github.com/prometheus/prometheus/rules" - "github.com/weaveworks/common/user" "golang.org/x/net/context/ctxhttp" "github.com/grafana/loki/pkg/ruler/rulespb" diff --git a/pkg/ruler/base/ruler.go b/pkg/ruler/base/ruler.go index 6e923bdc4e04a..cfde1a23ddd8e 100644 --- a/pkg/ruler/base/ruler.go +++ b/pkg/ruler/base/ruler.go @@ -22,6 +22,7 @@ import ( "github.com/grafana/dskit/kv" "github.com/grafana/dskit/ring" "github.com/grafana/dskit/services" + "github.com/grafana/dskit/user" "github.com/pkg/errors" "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus/promauto" @@ -29,7 +30,6 @@ import ( "github.com/prometheus/prometheus/model/rulefmt" "github.com/prometheus/prometheus/notifier" promRules "github.com/prometheus/prometheus/rules" - "github.com/weaveworks/common/user" "golang.org/x/sync/errgroup" "github.com/grafana/dskit/tenant" diff --git a/pkg/ruler/base/ruler_test.go b/pkg/ruler/base/ruler_test.go index 47be2d475934e..f270c29178fd5 100644 --- a/pkg/ruler/base/ruler_test.go +++ b/pkg/ruler/base/ruler_test.go @@ -25,6 +25,7 @@ import ( "github.com/grafana/dskit/kv/consul" "github.com/grafana/dskit/ring" "github.com/grafana/dskit/services" + "github.com/grafana/dskit/user" "github.com/prometheus/client_golang/prometheus" prom_testutil "github.com/prometheus/client_golang/prometheus/testutil" "github.com/prometheus/common/model" @@ -36,7 +37,6 @@ import ( "github.com/prometheus/prometheus/storage" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/weaveworks/common/user" "go.uber.org/atomic" "google.golang.org/grpc" "gopkg.in/yaml.v2" diff --git a/pkg/ruler/compat.go b/pkg/ruler/compat.go index e2557b4c22bd4..efc94fcb8591c 100644 --- a/pkg/ruler/compat.go +++ b/pkg/ruler/compat.go @@ -8,6 +8,7 @@ import ( "github.com/go-kit/log" "github.com/go-kit/log/level" + "github.com/grafana/dskit/user" "github.com/pkg/errors" "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/common/model" @@ -21,7 +22,6 @@ import ( "github.com/prometheus/prometheus/promql/parser" "github.com/prometheus/prometheus/rules" "github.com/prometheus/prometheus/template" - "github.com/weaveworks/common/user" "github.com/grafana/loki/pkg/logql" "github.com/grafana/loki/pkg/logql/syntax" diff --git a/pkg/ruler/evaluator_remote.go b/pkg/ruler/evaluator_remote.go index 78f66a77a49b5..451057fb66516 100644 --- a/pkg/ruler/evaluator_remote.go +++ b/pkg/ruler/evaluator_remote.go @@ -21,6 +21,10 @@ import ( "github.com/go-kit/log" "github.com/go-kit/log/level" "github.com/grafana/dskit/crypto/tls" + "github.com/grafana/dskit/httpgrpc" + "github.com/grafana/dskit/instrument" + "github.com/grafana/dskit/middleware" + "github.com/grafana/dskit/user" grpc_middleware "github.com/grpc-ecosystem/go-grpc-middleware" otgrpc "github.com/opentracing-contrib/go-grpc" "github.com/opentracing/opentracing-go" @@ -28,10 +32,6 @@ import ( "github.com/prometheus/common/model" "github.com/prometheus/prometheus/model/labels" "github.com/prometheus/prometheus/promql" - "github.com/weaveworks/common/httpgrpc" - "github.com/weaveworks/common/instrument" - "github.com/weaveworks/common/middleware" - "github.com/weaveworks/common/user" "google.golang.org/grpc" "google.golang.org/grpc/keepalive" diff --git a/pkg/ruler/evaluator_remote_test.go b/pkg/ruler/evaluator_remote_test.go index ea88c7e7e228f..6c38fe6ca1e5e 100644 --- a/pkg/ruler/evaluator_remote_test.go +++ b/pkg/ruler/evaluator_remote_test.go @@ -10,12 +10,12 @@ import ( "time" "github.com/grafana/dskit/flagext" + "github.com/grafana/dskit/httpgrpc" + "github.com/grafana/dskit/user" "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/common/model" "github.com/prometheus/prometheus/promql" "github.com/stretchr/testify/require" - "github.com/weaveworks/common/httpgrpc" - "github.com/weaveworks/common/user" "google.golang.org/grpc" "github.com/grafana/loki/pkg/loghttp" diff --git a/pkg/ruler/registry.go b/pkg/ruler/registry.go index f7d5982d93e4d..ea1e0848dc481 100644 --- a/pkg/ruler/registry.go +++ b/pkg/ruler/registry.go @@ -9,6 +9,7 @@ import ( "github.com/go-kit/log" "github.com/go-kit/log/level" + "github.com/grafana/dskit/user" "github.com/imdario/mergo" "github.com/pkg/errors" "github.com/prometheus/client_golang/prometheus" @@ -21,7 +22,6 @@ import ( "github.com/prometheus/prometheus/model/metadata" "github.com/prometheus/prometheus/model/relabel" "github.com/prometheus/prometheus/storage" - "github.com/weaveworks/common/user" "gopkg.in/yaml.v2" "github.com/grafana/loki/pkg/ruler/storage/cleaner" diff --git a/pkg/ruler/registry_test.go b/pkg/ruler/registry_test.go index 614e10711f24c..b4d7825fb6fbe 100644 --- a/pkg/ruler/registry_test.go +++ b/pkg/ruler/registry_test.go @@ -9,6 +9,7 @@ import ( "time" "github.com/go-kit/log" + "github.com/grafana/dskit/user" promConfig "github.com/prometheus/common/config" "github.com/prometheus/common/model" "github.com/prometheus/common/sigv4" @@ -16,7 +17,6 @@ import ( "github.com/prometheus/prometheus/model/relabel" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/weaveworks/common/user" "github.com/grafana/loki/pkg/ruler/storage/instance" "github.com/grafana/loki/pkg/ruler/util" diff --git a/pkg/scheduler/scheduler.go b/pkg/scheduler/scheduler.go index de5ab19599eae..938fc96d88dc8 100644 --- a/pkg/scheduler/scheduler.go +++ b/pkg/scheduler/scheduler.go @@ -14,16 +14,16 @@ import ( "github.com/go-kit/log" "github.com/go-kit/log/level" "github.com/grafana/dskit/grpcclient" + "github.com/grafana/dskit/httpgrpc" + "github.com/grafana/dskit/middleware" "github.com/grafana/dskit/ring" "github.com/grafana/dskit/services" + "github.com/grafana/dskit/user" otgrpc "github.com/opentracing-contrib/go-grpc" "github.com/opentracing/opentracing-go" "github.com/pkg/errors" "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus/promauto" - "github.com/weaveworks/common/httpgrpc" - "github.com/weaveworks/common/middleware" - "github.com/weaveworks/common/user" "go.uber.org/atomic" "google.golang.org/grpc" diff --git a/pkg/scheduler/schedulerpb/scheduler.pb.go b/pkg/scheduler/schedulerpb/scheduler.pb.go index 2bf5b0d0e6a1c..e2768f4ed79f1 100644 --- a/pkg/scheduler/schedulerpb/scheduler.pb.go +++ b/pkg/scheduler/schedulerpb/scheduler.pb.go @@ -8,7 +8,7 @@ import ( fmt "fmt" _ "github.com/gogo/protobuf/gogoproto" proto "github.com/gogo/protobuf/proto" - httpgrpc "github.com/weaveworks/common/httpgrpc" + httpgrpc "github.com/grafana/dskit/httpgrpc" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" @@ -449,49 +449,49 @@ func init() { } var fileDescriptor_c3657184e8d38989 = []byte{ - // 667 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x94, 0xcb, 0x4e, 0xdb, 0x4c, - 0x14, 0xc7, 0x3d, 0xb9, 0x01, 0x27, 0x7c, 0x5f, 0xdd, 0x01, 0xda, 0x34, 0xa2, 0x83, 0x65, 0x55, - 0x55, 0x60, 0x91, 0x54, 0x69, 0xa5, 0x76, 0x81, 0x2a, 0xa5, 0x60, 0x4a, 0x54, 0xea, 0x80, 0xe3, - 0xa8, 0x97, 0x4d, 0x94, 0xcb, 0x90, 0x20, 0xc0, 0x63, 0xec, 0x71, 0x51, 0x76, 0x7d, 0x84, 0x3e, - 0x45, 0xd5, 0x47, 0xe9, 0xa6, 0x12, 0x4b, 0x16, 0x5d, 0x14, 0xb3, 0xe9, 0x92, 0x47, 0xa8, 0x62, - 0x4f, 0x82, 0x03, 0x09, 0xb0, 0x3b, 0x73, 0xfc, 0x3f, 0xe3, 0x73, 0x7e, 0xff, 0x99, 0x81, 0x65, - 0x7b, 0xbf, 0x53, 0x70, 0x5b, 0x5d, 0xda, 0xf6, 0x0e, 0xa8, 0x73, 0x19, 0xd9, 0xcd, 0xcb, 0x38, - 0x6f, 0x3b, 0x8c, 0x33, 0x9c, 0x8e, 0x7c, 0xcc, 0xbe, 0xe8, 0xec, 0xf1, 0xae, 0xd7, 0xcc, 0xb7, - 0xd8, 0x61, 0xe1, 0x98, 0x36, 0xbe, 0xd0, 0x63, 0xe6, 0xec, 0xbb, 0x85, 0x16, 0x3b, 0x3c, 0x64, - 0x56, 0xa1, 0xcb, 0xb9, 0xdd, 0x71, 0xec, 0xd6, 0x30, 0x08, 0xb7, 0xc8, 0xce, 0x77, 0x58, 0x87, - 0x05, 0x61, 0xa1, 0x1f, 0x85, 0x59, 0xb5, 0x08, 0x78, 0xc7, 0xa3, 0xce, 0x1e, 0x75, 0x4c, 0x56, - 0x1d, 0xfc, 0x03, 0x2f, 0xc2, 0xcc, 0x51, 0x98, 0x2d, 0xaf, 0x67, 0x90, 0x82, 0x72, 0x33, 0xc6, - 0x65, 0x42, 0xfd, 0x85, 0x00, 0x0f, 0xb5, 0x26, 0x13, 0xf5, 0x38, 0x03, 0x53, 0x7d, 0x4d, 0x4f, - 0x94, 0x24, 0x8c, 0xc1, 0x12, 0xbf, 0x84, 0x74, 0xbf, 0x19, 0x83, 0x1e, 0x79, 0xd4, 0xe5, 0x99, - 0x98, 0x82, 0x72, 0xe9, 0xe2, 0x42, 0x7e, 0xd8, 0xe0, 0xa6, 0x69, 0x6e, 0x8b, 0x8f, 0x46, 0x54, - 0x89, 0x73, 0x70, 0x6f, 0xd7, 0x61, 0x16, 0xa7, 0x56, 0xbb, 0xd4, 0x6e, 0x3b, 0xd4, 0x75, 0x33, - 0xf1, 0xa0, 0x9b, 0xab, 0x69, 0xfc, 0x00, 0x52, 0x9e, 0x1b, 0xb4, 0x9b, 0x08, 0x04, 0x62, 0x85, - 0x55, 0x98, 0x75, 0x79, 0x83, 0xbb, 0x9a, 0xd5, 0x68, 0x1e, 0xd0, 0x76, 0x26, 0xa9, 0xa0, 0xdc, - 0xb4, 0x31, 0x92, 0x53, 0xbf, 0xc7, 0x60, 0x6e, 0x43, 0xec, 0x17, 0xa5, 0xf0, 0x0a, 0x12, 0xbc, - 0x67, 0xd3, 0x60, 0x9a, 0xff, 0x8b, 0x4f, 0xf2, 0x11, 0x0f, 0xf2, 0x63, 0xf4, 0x66, 0xcf, 0xa6, - 0x46, 0x50, 0x31, 0xae, 0xef, 0xd8, 0xf8, 0xbe, 0x23, 0xd0, 0xe2, 0xa3, 0xd0, 0x26, 0x4d, 0x74, - 0x05, 0x66, 0xf2, 0xce, 0x30, 0xaf, 0xa2, 0x48, 0x5d, 0x47, 0x21, 0x8c, 0xf7, 0xe8, 0x76, 0x83, - 0x77, 0x33, 0x53, 0x4a, 0x5c, 0x18, 0x1f, 0x26, 0xd4, 0x7d, 0x98, 0x8b, 0xf8, 0x3e, 0x40, 0x80, - 0x5f, 0x43, 0xaa, 0xbf, 0x89, 0xe7, 0x0a, 0x52, 0x4f, 0x47, 0x48, 0x8d, 0xa9, 0xa8, 0x06, 0x6a, - 0x43, 0x54, 0xe1, 0x79, 0x48, 0x52, 0xc7, 0x61, 0x8e, 0x60, 0x14, 0x2e, 0xd4, 0x55, 0x58, 0xd4, - 0x19, 0xdf, 0xdb, 0xed, 0x89, 0xf3, 0x55, 0xed, 0x7a, 0xbc, 0xcd, 0x8e, 0xad, 0xc1, 0x38, 0x37, - 0x9f, 0xd1, 0x25, 0x78, 0x3c, 0xa1, 0xda, 0xb5, 0x99, 0xe5, 0xd2, 0x95, 0x55, 0x78, 0x38, 0xc1, - 0x43, 0x3c, 0x0d, 0x89, 0xb2, 0x5e, 0x36, 0x65, 0x09, 0xa7, 0x61, 0x4a, 0xd3, 0x77, 0x6a, 0x5a, - 0x4d, 0x93, 0x11, 0x06, 0x48, 0xad, 0x95, 0xf4, 0x35, 0x6d, 0x4b, 0x8e, 0xad, 0xb4, 0xe0, 0xd1, - 0xc4, 0xb9, 0x70, 0x0a, 0x62, 0x95, 0x77, 0xb2, 0x84, 0x15, 0x58, 0x34, 0x2b, 0x95, 0xfa, 0xfb, - 0x92, 0xfe, 0xa9, 0x6e, 0x68, 0x3b, 0x35, 0xad, 0x6a, 0x56, 0xeb, 0xdb, 0x9a, 0x51, 0x37, 0x35, - 0xbd, 0xa4, 0x9b, 0x32, 0xc2, 0x33, 0x90, 0xd4, 0x0c, 0xa3, 0x62, 0xc8, 0x31, 0x7c, 0x1f, 0xfe, - 0xab, 0x6e, 0xd6, 0x4c, 0xb3, 0xac, 0xbf, 0xad, 0xaf, 0x57, 0x3e, 0xe8, 0x72, 0xbc, 0xf8, 0x1b, - 0x45, 0x78, 0x6f, 0x30, 0x67, 0x70, 0xd1, 0x6a, 0x90, 0x16, 0xe1, 0x16, 0x63, 0x36, 0x5e, 0x1a, - 0xc1, 0x7d, 0xfd, 0x36, 0x67, 0x97, 0x26, 0xf9, 0x21, 0xb4, 0xaa, 0x94, 0x43, 0xcf, 0x10, 0xb6, - 0x60, 0x61, 0x2c, 0x32, 0xbc, 0x3c, 0x52, 0x7f, 0x93, 0x29, 0xd9, 0x95, 0xbb, 0x48, 0x43, 0x07, - 0x8a, 0x36, 0xcc, 0x47, 0xa7, 0x1b, 0x1e, 0xa7, 0x8f, 0x30, 0x3b, 0x88, 0x83, 0xf9, 0x94, 0xdb, - 0x2e, 0x5e, 0x56, 0xb9, 0xed, 0xc0, 0x85, 0x13, 0xbe, 0x29, 0x9d, 0x9c, 0x11, 0xe9, 0xf4, 0x8c, - 0x48, 0x17, 0x67, 0x04, 0x7d, 0xf5, 0x09, 0xfa, 0xe1, 0x13, 0xf4, 0xd3, 0x27, 0xe8, 0xc4, 0x27, - 0xe8, 0x8f, 0x4f, 0xd0, 0x5f, 0x9f, 0x48, 0x17, 0x3e, 0x41, 0xdf, 0xce, 0x89, 0x74, 0x72, 0x4e, - 0xa4, 0xd3, 0x73, 0x22, 0x7d, 0x8e, 0xbe, 0xbd, 0xcd, 0x54, 0xf0, 0x6c, 0x3e, 0xff, 0x17, 0x00, - 0x00, 0xff, 0xff, 0xf4, 0x06, 0xc6, 0xd8, 0xbc, 0x05, 0x00, 0x00, + // 662 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x94, 0xcd, 0x4e, 0xdb, 0x40, + 0x10, 0xc7, 0xbd, 0xf9, 0x02, 0x26, 0xb4, 0x4d, 0x17, 0x68, 0xd3, 0x88, 0x2e, 0x96, 0x55, 0x55, + 0x81, 0x43, 0x82, 0xd2, 0x43, 0x7b, 0x40, 0x95, 0x52, 0x30, 0x25, 0x2a, 0x75, 0xc0, 0x71, 0xd4, + 0x8f, 0x4b, 0x94, 0xc4, 0x4b, 0x12, 0x41, 0xbd, 0xc6, 0x5e, 0xab, 0xca, 0xad, 0x8f, 0xd0, 0xa7, + 0xa8, 0xfa, 0x28, 0xbd, 0x54, 0xe2, 0xc8, 0xa1, 0x87, 0x62, 0x2e, 0x3d, 0xf2, 0x08, 0x55, 0xec, + 0x4d, 0x70, 0x20, 0x01, 0x6e, 0xb3, 0xe3, 0xff, 0x7f, 0x35, 0xf3, 0x9b, 0x59, 0xc3, 0xaa, 0x7d, + 0xd8, 0x29, 0xba, 0xed, 0x2e, 0x35, 0xbd, 0x23, 0xea, 0x5c, 0x46, 0x76, 0xeb, 0x32, 0x2e, 0xd8, + 0x0e, 0xe3, 0x0c, 0xa7, 0x23, 0x1f, 0x73, 0xeb, 0x9d, 0x1e, 0xef, 0x7a, 0xad, 0x42, 0x9b, 0x7d, + 0x29, 0x76, 0x9c, 0xe6, 0x41, 0xd3, 0x6a, 0x16, 0x4d, 0xf7, 0xb0, 0xc7, 0x8b, 0x5d, 0xce, 0xed, + 0x8e, 0x63, 0xb7, 0x47, 0x41, 0x68, 0xcf, 0x2d, 0x76, 0x58, 0x87, 0x05, 0x61, 0x71, 0x10, 0x85, + 0x59, 0xa5, 0x04, 0x78, 0xdf, 0xa3, 0x4e, 0x8f, 0x3a, 0x06, 0xab, 0x0d, 0xef, 0xc7, 0xcb, 0x30, + 0x77, 0x1c, 0x66, 0x2b, 0x5b, 0x59, 0x24, 0xa3, 0xfc, 0x9c, 0x7e, 0x99, 0x50, 0x7e, 0x23, 0xc0, + 0x23, 0xad, 0xc1, 0x84, 0x1f, 0x67, 0x61, 0x66, 0xa0, 0xe9, 0x0b, 0x4b, 0x42, 0x1f, 0x1e, 0xf1, + 0x4b, 0x48, 0x0f, 0x8a, 0xd1, 0xe9, 0xb1, 0x47, 0x5d, 0x9e, 0x8d, 0xc9, 0x28, 0x9f, 0x2e, 0x2d, + 0x15, 0x46, 0x05, 0xee, 0x18, 0xc6, 0x9e, 0xf8, 0xa8, 0x47, 0x95, 0x38, 0x0f, 0x0f, 0x0e, 0x1c, + 0x66, 0x71, 0x6a, 0x99, 0x65, 0xd3, 0x74, 0xa8, 0xeb, 0x66, 0xe3, 0x41, 0x35, 0x57, 0xd3, 0xf8, + 0x11, 0xa4, 0x3c, 0x37, 0x28, 0x37, 0x11, 0x08, 0xc4, 0x09, 0x2b, 0x30, 0xef, 0xf2, 0x26, 0x77, + 0x55, 0xab, 0xd9, 0x3a, 0xa2, 0x66, 0x36, 0x29, 0xa3, 0xfc, 0xac, 0x3e, 0x96, 0x53, 0x7e, 0xc4, + 0x60, 0x61, 0x5b, 0xdc, 0x17, 0xa5, 0xf0, 0x0a, 0x12, 0xbc, 0x6f, 0xd3, 0xa0, 0x9b, 0xfb, 0xa5, + 0x67, 0x85, 0x08, 0xff, 0xc2, 0x04, 0xbd, 0xd1, 0xb7, 0xa9, 0x1e, 0x38, 0x26, 0xd5, 0x1d, 0x9b, + 0x5c, 0x77, 0x04, 0x5a, 0x7c, 0x1c, 0xda, 0xb4, 0x8e, 0xae, 0xc0, 0x4c, 0xde, 0x19, 0xe6, 0x55, + 0x14, 0xa9, 0xeb, 0x28, 0xc4, 0xe0, 0x3d, 0xba, 0xd7, 0xe4, 0xdd, 0xec, 0x8c, 0x1c, 0x17, 0x83, + 0x0f, 0x13, 0xca, 0x21, 0x2c, 0x44, 0xe6, 0x3e, 0x44, 0x80, 0x5f, 0x43, 0x6a, 0x70, 0x89, 0xe7, + 0x0a, 0x52, 0xcf, 0xc7, 0x48, 0x4d, 0x70, 0xd4, 0x02, 0xb5, 0x2e, 0x5c, 0x78, 0x11, 0x92, 0xd4, + 0x71, 0x98, 0x23, 0x18, 0x85, 0x07, 0x65, 0x03, 0x96, 0x35, 0xc6, 0x7b, 0x07, 0x7d, 0xb1, 0x5f, + 0xb5, 0xae, 0xc7, 0x4d, 0xf6, 0xd5, 0x1a, 0xb6, 0x73, 0xf3, 0x8e, 0xae, 0xc0, 0xd3, 0x29, 0x6e, + 0xd7, 0x66, 0x96, 0x4b, 0xd7, 0x36, 0xe0, 0xf1, 0x94, 0x19, 0xe2, 0x59, 0x48, 0x54, 0xb4, 0x8a, + 0x91, 0x91, 0x70, 0x1a, 0x66, 0x54, 0x6d, 0xbf, 0xae, 0xd6, 0xd5, 0x0c, 0xc2, 0x00, 0xa9, 0xcd, + 0xb2, 0xb6, 0xa9, 0xee, 0x66, 0x62, 0x6b, 0x6d, 0x78, 0x32, 0xb5, 0x2f, 0x9c, 0x82, 0x58, 0xf5, + 0x5d, 0x46, 0xc2, 0x32, 0x2c, 0x1b, 0xd5, 0x6a, 0xe3, 0x7d, 0x59, 0xfb, 0xd4, 0xd0, 0xd5, 0xfd, + 0xba, 0x5a, 0x33, 0x6a, 0x8d, 0x3d, 0x55, 0x6f, 0x18, 0xaa, 0x56, 0xd6, 0x8c, 0x0c, 0xc2, 0x73, + 0x90, 0x54, 0x75, 0xbd, 0xaa, 0x67, 0x62, 0xf8, 0x21, 0xdc, 0xab, 0xed, 0xd4, 0x0d, 0xa3, 0xa2, + 0xbd, 0x6d, 0x6c, 0x55, 0x3f, 0x68, 0x99, 0x78, 0xe9, 0x0f, 0x8a, 0xf0, 0xde, 0x66, 0xce, 0xf0, + 0xa1, 0xd5, 0x21, 0x2d, 0xc2, 0x5d, 0xc6, 0x6c, 0xbc, 0x32, 0x86, 0xfb, 0xfa, 0x6b, 0xce, 0xad, + 0x4c, 0x9b, 0x87, 0xd0, 0x2a, 0x52, 0x1e, 0xad, 0x23, 0x6c, 0xc1, 0xd2, 0x44, 0x64, 0x78, 0x75, + 0xcc, 0x7f, 0xd3, 0x50, 0x72, 0x6b, 0x77, 0x91, 0x86, 0x13, 0x28, 0xd9, 0xb0, 0x18, 0xed, 0x6e, + 0xb4, 0x4e, 0x1f, 0x61, 0x7e, 0x18, 0x07, 0xfd, 0xc9, 0xb7, 0x3d, 0xbc, 0x9c, 0x7c, 0xdb, 0xc2, + 0x85, 0x1d, 0xbe, 0x29, 0x9f, 0x9c, 0x11, 0xe9, 0xf4, 0x8c, 0x48, 0x17, 0x67, 0x04, 0x7d, 0xf3, + 0x09, 0xfa, 0xe9, 0x13, 0xf4, 0xcb, 0x27, 0xe8, 0xc4, 0x27, 0xe8, 0xaf, 0x4f, 0xd0, 0x3f, 0x9f, + 0x48, 0x17, 0x3e, 0x41, 0xdf, 0xcf, 0x89, 0x74, 0x72, 0x4e, 0xa4, 0xd3, 0x73, 0x22, 0x7d, 0x8e, + 0xfe, 0x77, 0x5b, 0xa9, 0xe0, 0xb7, 0xf9, 0xe2, 0x7f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x32, 0x8f, + 0x04, 0xd6, 0xb8, 0x05, 0x00, 0x00, } func (x FrontendToSchedulerType) String() string { diff --git a/pkg/scheduler/schedulerpb/scheduler.proto b/pkg/scheduler/schedulerpb/scheduler.proto index d63627527d477..cbf3d27231596 100644 --- a/pkg/scheduler/schedulerpb/scheduler.proto +++ b/pkg/scheduler/schedulerpb/scheduler.proto @@ -2,7 +2,7 @@ syntax = "proto3"; package schedulerpb; -import "github.com/weaveworks/common/httpgrpc/httpgrpc.proto"; +import "github.com/grafana/dskit/httpgrpc/httpgrpc.proto"; import "gogoproto/gogo.proto"; option go_package = "schedulerpb"; diff --git a/pkg/server/internal_server.go b/pkg/server/internal_server.go index 79503632651f9..ad3374d27f80c 100644 --- a/pkg/server/internal_server.go +++ b/pkg/server/internal_server.go @@ -4,7 +4,7 @@ import ( "flag" "time" - serverww "github.com/weaveworks/common/server" + serverww "github.com/grafana/dskit/server" ) // Config extends weaveworks server config diff --git a/pkg/storage/batch_test.go b/pkg/storage/batch_test.go index cc9a7ba13cf74..b3416d838eb33 100644 --- a/pkg/storage/batch_test.go +++ b/pkg/storage/batch_test.go @@ -7,11 +7,11 @@ import ( "time" "github.com/cespare/xxhash/v2" + "github.com/grafana/dskit/user" "github.com/pkg/errors" "github.com/prometheus/prometheus/model/labels" "github.com/prometheus/prometheus/promql" "github.com/stretchr/testify/require" - "github.com/weaveworks/common/user" "github.com/grafana/loki/pkg/chunkenc" "github.com/grafana/loki/pkg/iter" diff --git a/pkg/storage/chunk/cache/instrumented.go b/pkg/storage/chunk/cache/instrumented.go index b9b32cbc7afd8..b2bef524ac349 100644 --- a/pkg/storage/chunk/cache/instrumented.go +++ b/pkg/storage/chunk/cache/instrumented.go @@ -3,12 +3,12 @@ package cache import ( "context" + instr "github.com/grafana/dskit/instrument" ot "github.com/opentracing/opentracing-go" "github.com/opentracing/opentracing-go/ext" otlog "github.com/opentracing/opentracing-go/log" "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus/promauto" - instr "github.com/weaveworks/common/instrument" ) // Instrument returns an instrumented cache. diff --git a/pkg/storage/chunk/cache/memcached.go b/pkg/storage/chunk/cache/memcached.go index fe8a3edc4cfe2..172bb3d19df03 100644 --- a/pkg/storage/chunk/cache/memcached.go +++ b/pkg/storage/chunk/cache/memcached.go @@ -9,10 +9,10 @@ import ( "time" "github.com/go-kit/log" + instr "github.com/grafana/dskit/instrument" "github.com/grafana/gomemcache/memcache" "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus/promauto" - instr "github.com/weaveworks/common/instrument" "github.com/grafana/loki/pkg/logqlmodel/stats" "github.com/grafana/loki/pkg/util/math" diff --git a/pkg/storage/chunk/chunk.go b/pkg/storage/chunk/chunk.go index 0bc53509f3fa0..9bf2d1cf0b65b 100644 --- a/pkg/storage/chunk/chunk.go +++ b/pkg/storage/chunk/chunk.go @@ -11,11 +11,11 @@ import ( "unsafe" "github.com/golang/snappy" + errs "github.com/grafana/dskit/errors" jsoniter "github.com/json-iterator/go" "github.com/pkg/errors" "github.com/prometheus/common/model" "github.com/prometheus/prometheus/model/labels" - errs "github.com/weaveworks/common/errors" "github.com/grafana/loki/pkg/logproto" ) diff --git a/pkg/storage/chunk/client/alibaba/oss_object_client.go b/pkg/storage/chunk/client/alibaba/oss_object_client.go index 1e94cb89f1776..aeec18500d025 100644 --- a/pkg/storage/chunk/client/alibaba/oss_object_client.go +++ b/pkg/storage/chunk/client/alibaba/oss_object_client.go @@ -8,9 +8,9 @@ import ( "strconv" "github.com/aliyun/aliyun-oss-go-sdk/oss" + "github.com/grafana/dskit/instrument" "github.com/pkg/errors" "github.com/prometheus/client_golang/prometheus" - "github.com/weaveworks/common/instrument" "github.com/grafana/loki/pkg/storage/chunk/client" ) diff --git a/pkg/storage/chunk/client/aws/dynamodb_metrics.go b/pkg/storage/chunk/client/aws/dynamodb_metrics.go index 261f50fc912d5..47b275f8bf5de 100644 --- a/pkg/storage/chunk/client/aws/dynamodb_metrics.go +++ b/pkg/storage/chunk/client/aws/dynamodb_metrics.go @@ -1,9 +1,9 @@ package aws import ( + "github.com/grafana/dskit/instrument" "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus/promauto" - "github.com/weaveworks/common/instrument" ) type dynamoDBMetrics struct { diff --git a/pkg/storage/chunk/client/aws/dynamodb_storage_client.go b/pkg/storage/chunk/client/aws/dynamodb_storage_client.go index ad3285aa3bf7e..73ad6cd6234a6 100644 --- a/pkg/storage/chunk/client/aws/dynamodb_storage_client.go +++ b/pkg/storage/chunk/client/aws/dynamodb_storage_client.go @@ -20,12 +20,12 @@ import ( "github.com/go-kit/log/level" "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" - "github.com/weaveworks/common/instrument" "golang.org/x/time/rate" "github.com/grafana/loki/pkg/storage/chunk" diff --git a/pkg/storage/chunk/client/aws/dynamodb_table_client.go b/pkg/storage/chunk/client/aws/dynamodb_table_client.go index c4cce4ff3ea97..330624a098ced 100644 --- a/pkg/storage/chunk/client/aws/dynamodb_table_client.go +++ b/pkg/storage/chunk/client/aws/dynamodb_table_client.go @@ -10,9 +10,9 @@ import ( "github.com/aws/aws-sdk-go/service/dynamodb/dynamodbiface" "github.com/go-kit/log/level" "github.com/grafana/dskit/backoff" + "github.com/grafana/dskit/instrument" "github.com/pkg/errors" "github.com/prometheus/client_golang/prometheus" - "github.com/weaveworks/common/instrument" "golang.org/x/time/rate" "github.com/grafana/loki/pkg/storage/config" diff --git a/pkg/storage/chunk/client/aws/metrics_autoscaling.go b/pkg/storage/chunk/client/aws/metrics_autoscaling.go index c1eae58578dc4..f9a6bc14917d3 100644 --- a/pkg/storage/chunk/client/aws/metrics_autoscaling.go +++ b/pkg/storage/chunk/client/aws/metrics_autoscaling.go @@ -7,11 +7,11 @@ import ( "time" "github.com/go-kit/log/level" + "github.com/grafana/dskit/mtime" "github.com/pkg/errors" promApi "github.com/prometheus/client_golang/api" promV1 "github.com/prometheus/client_golang/api/prometheus/v1" "github.com/prometheus/common/model" - "github.com/weaveworks/common/mtime" "github.com/grafana/loki/pkg/storage/config" util_log "github.com/grafana/loki/pkg/util/log" diff --git a/pkg/storage/chunk/client/aws/metrics_autoscaling_test.go b/pkg/storage/chunk/client/aws/metrics_autoscaling_test.go index 8199c360f3020..4257737ae1a7d 100644 --- a/pkg/storage/chunk/client/aws/metrics_autoscaling_test.go +++ b/pkg/storage/chunk/client/aws/metrics_autoscaling_test.go @@ -6,11 +6,11 @@ import ( "testing" "time" + "github.com/grafana/dskit/mtime" "github.com/pkg/errors" promV1 "github.com/prometheus/client_golang/api/prometheus/v1" "github.com/prometheus/common/model" "github.com/stretchr/testify/require" - "github.com/weaveworks/common/mtime" "github.com/grafana/loki/pkg/storage/config" "github.com/grafana/loki/pkg/storage/stores/series/index" diff --git a/pkg/storage/chunk/client/aws/s3_storage_client.go b/pkg/storage/chunk/client/aws/s3_storage_client.go index 70b19dc67d518..2ba04941851db 100644 --- a/pkg/storage/chunk/client/aws/s3_storage_client.go +++ b/pkg/storage/chunk/client/aws/s3_storage_client.go @@ -24,11 +24,11 @@ import ( "github.com/aws/aws-sdk-go/service/s3/s3iface" "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" - "github.com/weaveworks/common/instrument" bucket_s3 "github.com/grafana/loki/pkg/storage/bucket/s3" "github.com/grafana/loki/pkg/storage/chunk/client" diff --git a/pkg/storage/chunk/client/azure/blob_storage_client.go b/pkg/storage/chunk/client/azure/blob_storage_client.go index b87483cbbd9cf..0a9f9152c704e 100644 --- a/pkg/storage/chunk/client/azure/blob_storage_client.go +++ b/pkg/storage/chunk/client/azure/blob_storage_client.go @@ -20,9 +20,9 @@ import ( "github.com/Azure/go-autorest/autorest/azure" "github.com/Azure/go-autorest/autorest/azure/auth" "github.com/grafana/dskit/flagext" + "github.com/grafana/dskit/instrument" "github.com/mattn/go-ieproxy" "github.com/prometheus/client_golang/prometheus" - "github.com/weaveworks/common/instrument" "github.com/grafana/loki/pkg/storage/chunk/client" "github.com/grafana/loki/pkg/storage/chunk/client/hedging" diff --git a/pkg/storage/chunk/client/baidubce/bos_storage_client.go b/pkg/storage/chunk/client/baidubce/bos_storage_client.go index 38050cf9b08f3..11ad6335f1cc5 100644 --- a/pkg/storage/chunk/client/baidubce/bos_storage_client.go +++ b/pkg/storage/chunk/client/baidubce/bos_storage_client.go @@ -11,9 +11,9 @@ import ( "github.com/baidubce/bce-sdk-go/services/bos" "github.com/baidubce/bce-sdk-go/services/bos/api" "github.com/grafana/dskit/flagext" + "github.com/grafana/dskit/instrument" "github.com/pkg/errors" "github.com/prometheus/client_golang/prometheus" - "github.com/weaveworks/common/instrument" "github.com/grafana/loki/pkg/storage/chunk/client" ) diff --git a/pkg/storage/chunk/client/gcp/instrumentation.go b/pkg/storage/chunk/client/gcp/instrumentation.go index 1522e27f038c2..c4863734a07f1 100644 --- a/pkg/storage/chunk/client/gcp/instrumentation.go +++ b/pkg/storage/chunk/client/gcp/instrumentation.go @@ -5,11 +5,11 @@ import ( "strconv" "time" + "github.com/grafana/dskit/middleware" otgrpc "github.com/opentracing-contrib/go-grpc" opentracing "github.com/opentracing/opentracing-go" "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus/promauto" - "github.com/weaveworks/common/middleware" "google.golang.org/api/option" "google.golang.org/grpc" ) diff --git a/pkg/storage/chunk/client/ibmcloud/cos_object_client.go b/pkg/storage/chunk/client/ibmcloud/cos_object_client.go index 85a44cfa496f0..784183fa5ffee 100644 --- a/pkg/storage/chunk/client/ibmcloud/cos_object_client.go +++ b/pkg/storage/chunk/client/ibmcloud/cos_object_client.go @@ -23,9 +23,9 @@ import ( "github.com/go-kit/log/level" "github.com/grafana/dskit/backoff" "github.com/grafana/dskit/flagext" + "github.com/grafana/dskit/instrument" "github.com/pkg/errors" "github.com/prometheus/client_golang/prometheus" - "github.com/weaveworks/common/instrument" "github.com/grafana/loki/pkg/storage/chunk/client" "github.com/grafana/loki/pkg/storage/chunk/client/hedging" diff --git a/pkg/storage/chunk/interface.go b/pkg/storage/chunk/interface.go index 4da7e06e42adc..3888472903b65 100644 --- a/pkg/storage/chunk/interface.go +++ b/pkg/storage/chunk/interface.go @@ -20,9 +20,9 @@ import ( "context" "io" + errs "github.com/grafana/dskit/errors" "github.com/prometheus/common/model" "github.com/prometheus/prometheus/model/labels" - errs "github.com/weaveworks/common/errors" "github.com/grafana/loki/pkg/util/filter" ) diff --git a/pkg/storage/chunk/tests/index_client_test.go b/pkg/storage/chunk/tests/index_client_test.go index d35e67c9ccc15..a4751f1fb1d31 100644 --- a/pkg/storage/chunk/tests/index_client_test.go +++ b/pkg/storage/chunk/tests/index_client_test.go @@ -8,8 +8,8 @@ import ( "time" "github.com/go-kit/log" + "github.com/grafana/dskit/user" "github.com/stretchr/testify/require" - "github.com/weaveworks/common/user" "github.com/grafana/loki/pkg/storage/chunk/cache" "github.com/grafana/loki/pkg/storage/chunk/client" diff --git a/pkg/storage/config/schema_config.go b/pkg/storage/config/schema_config.go index e6d6a77a2f675..13850dba424e3 100644 --- a/pkg/storage/config/schema_config.go +++ b/pkg/storage/config/schema_config.go @@ -13,8 +13,8 @@ import ( "time" "github.com/go-kit/log/level" + "github.com/grafana/dskit/mtime" "github.com/prometheus/common/model" - "github.com/weaveworks/common/mtime" yaml "gopkg.in/yaml.v2" "github.com/grafana/loki/pkg/logproto" diff --git a/pkg/storage/hack/main.go b/pkg/storage/hack/main.go index ff03ab305c716..34555a27aeb5c 100644 --- a/pkg/storage/hack/main.go +++ b/pkg/storage/hack/main.go @@ -9,10 +9,10 @@ import ( "sync" "time" + "github.com/grafana/dskit/user" "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/common/model" "github.com/prometheus/prometheus/model/labels" - "github.com/weaveworks/common/user" "github.com/grafana/loki/pkg/chunkenc" "github.com/grafana/loki/pkg/ingester/client" diff --git a/pkg/storage/store_test.go b/pkg/storage/store_test.go index 3412727f58416..d98eb78034b4b 100644 --- a/pkg/storage/store_test.go +++ b/pkg/storage/store_test.go @@ -15,10 +15,10 @@ import ( "time" "github.com/cespare/xxhash/v2" + "github.com/grafana/dskit/user" "github.com/prometheus/common/model" "github.com/prometheus/prometheus/model/labels" "github.com/stretchr/testify/require" - "github.com/weaveworks/common/user" "github.com/grafana/dskit/flagext" diff --git a/pkg/storage/stores/index/index.go b/pkg/storage/stores/index/index.go index 2c46ef799dfdd..1bdce80b3cc9d 100644 --- a/pkg/storage/stores/index/index.go +++ b/pkg/storage/stores/index/index.go @@ -3,10 +3,10 @@ package index import ( "context" + "github.com/grafana/dskit/instrument" "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/common/model" "github.com/prometheus/prometheus/model/labels" - "github.com/weaveworks/common/instrument" "github.com/grafana/loki/pkg/logproto" "github.com/grafana/loki/pkg/storage/chunk" diff --git a/pkg/storage/stores/indexshipper/compactor/client/grpc.go b/pkg/storage/stores/indexshipper/compactor/client/grpc.go index d18bca5139e6d..1e1bf3135230a 100644 --- a/pkg/storage/stores/indexshipper/compactor/client/grpc.go +++ b/pkg/storage/stores/indexshipper/compactor/client/grpc.go @@ -5,11 +5,11 @@ import ( "flag" "github.com/grafana/dskit/grpcclient" + "github.com/grafana/dskit/instrument" + "github.com/grafana/dskit/user" "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus/promauto" "github.com/prometheus/common/model" - "github.com/weaveworks/common/instrument" - "github.com/weaveworks/common/user" "google.golang.org/grpc" deletion_grpc "github.com/grafana/loki/pkg/storage/stores/indexshipper/compactor/client/grpc" diff --git a/pkg/storage/stores/indexshipper/compactor/deletion/delete_requests_store.go b/pkg/storage/stores/indexshipper/compactor/deletion/delete_requests_store.go index b66ef4865d2c5..dbcef77f159ea 100644 --- a/pkg/storage/stores/indexshipper/compactor/deletion/delete_requests_store.go +++ b/pkg/storage/stores/indexshipper/compactor/deletion/delete_requests_store.go @@ -13,7 +13,7 @@ import ( "time" "unsafe" - "github.com/weaveworks/common/user" + "github.com/grafana/dskit/user" "github.com/prometheus/common/model" diff --git a/pkg/storage/stores/indexshipper/compactor/deletion/grpc_request_handler_test.go b/pkg/storage/stores/indexshipper/compactor/deletion/grpc_request_handler_test.go index 142db21e70249..4e0975cc4bd92 100644 --- a/pkg/storage/stores/indexshipper/compactor/deletion/grpc_request_handler_test.go +++ b/pkg/storage/stores/indexshipper/compactor/deletion/grpc_request_handler_test.go @@ -7,11 +7,11 @@ import ( "testing" "time" + "github.com/grafana/dskit/middleware" "github.com/grafana/dskit/tenant" + "github.com/grafana/dskit/user" "github.com/prometheus/common/model" "github.com/stretchr/testify/require" - "github.com/weaveworks/common/middleware" - "github.com/weaveworks/common/user" "google.golang.org/grpc" "google.golang.org/grpc/credentials/insecure" "google.golang.org/grpc/status" diff --git a/pkg/storage/stores/indexshipper/compactor/deletion/request_handler_test.go b/pkg/storage/stores/indexshipper/compactor/deletion/request_handler_test.go index 61734e62932dd..dec7068bf97c8 100644 --- a/pkg/storage/stores/indexshipper/compactor/deletion/request_handler_test.go +++ b/pkg/storage/stores/indexshipper/compactor/deletion/request_handler_test.go @@ -17,7 +17,7 @@ import ( "github.com/grafana/loki/pkg/util" - "github.com/weaveworks/common/user" + "github.com/grafana/dskit/user" ) func TestAddDeleteRequestHandler(t *testing.T) { diff --git a/pkg/storage/stores/indexshipper/compactor/deletion/tenant_request_handler_test.go b/pkg/storage/stores/indexshipper/compactor/deletion/tenant_request_handler_test.go index ef4ede429f2df..e979a5c8c4d00 100644 --- a/pkg/storage/stores/indexshipper/compactor/deletion/tenant_request_handler_test.go +++ b/pkg/storage/stores/indexshipper/compactor/deletion/tenant_request_handler_test.go @@ -5,8 +5,8 @@ import ( "net/http/httptest" "testing" + "github.com/grafana/dskit/user" "github.com/stretchr/testify/require" - "github.com/weaveworks/common/user" ) func TestDeleteRequestHandlerDeletionMiddleware(t *testing.T) { diff --git a/pkg/storage/stores/indexshipper/compactor/retention/util_test.go b/pkg/storage/stores/indexshipper/compactor/retention/util_test.go index 342cd868ffb3c..bab0e8f117741 100644 --- a/pkg/storage/stores/indexshipper/compactor/retention/util_test.go +++ b/pkg/storage/stores/indexshipper/compactor/retention/util_test.go @@ -8,11 +8,11 @@ import ( "testing" "time" + ww "github.com/grafana/dskit/server" "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/common/model" "github.com/prometheus/prometheus/model/labels" "github.com/stretchr/testify/require" - ww "github.com/weaveworks/common/server" "github.com/grafana/loki/pkg/logproto" "github.com/grafana/loki/pkg/logql/syntax" diff --git a/pkg/storage/stores/indexshipper/gatewayclient/gateway_client.go b/pkg/storage/stores/indexshipper/gatewayclient/gateway_client.go index 771a26490d6ca..fd1fbe66fdf6e 100644 --- a/pkg/storage/stores/indexshipper/gatewayclient/gateway_client.go +++ b/pkg/storage/stores/indexshipper/gatewayclient/gateway_client.go @@ -11,12 +11,12 @@ import ( "github.com/go-kit/log/level" "github.com/grafana/dskit/concurrency" "github.com/grafana/dskit/grpcclient" + "github.com/grafana/dskit/instrument" "github.com/grafana/dskit/ring" ring_client "github.com/grafana/dskit/ring/client" "github.com/grafana/dskit/tenant" "github.com/pkg/errors" "github.com/prometheus/client_golang/prometheus" - "github.com/weaveworks/common/instrument" "google.golang.org/grpc" "github.com/grafana/loki/pkg/distributor/clientpool" diff --git a/pkg/storage/stores/indexshipper/gatewayclient/gateway_client_test.go b/pkg/storage/stores/indexshipper/gatewayclient/gateway_client_test.go index 29ca43a74a653..b16916ebd1dd2 100644 --- a/pkg/storage/stores/indexshipper/gatewayclient/gateway_client_test.go +++ b/pkg/storage/stores/indexshipper/gatewayclient/gateway_client_test.go @@ -15,9 +15,9 @@ import ( "github.com/grafana/dskit/kv/consul" "github.com/grafana/dskit/ring" "github.com/grafana/dskit/services" + "github.com/grafana/dskit/user" "github.com/prometheus/client_golang/prometheus" "github.com/stretchr/testify/require" - "github.com/weaveworks/common/user" "google.golang.org/grpc" "github.com/grafana/loki/pkg/logproto" diff --git a/pkg/storage/stores/series/index/caching_index_client_test.go b/pkg/storage/stores/series/index/caching_index_client_test.go index 4456cd3038815..307304b0590a7 100644 --- a/pkg/storage/stores/series/index/caching_index_client_test.go +++ b/pkg/storage/stores/series/index/caching_index_client_test.go @@ -10,9 +10,9 @@ import ( "github.com/go-kit/log" "github.com/grafana/dskit/flagext" + "github.com/grafana/dskit/user" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/weaveworks/common/user" "github.com/grafana/loki/pkg/storage/chunk/cache" "github.com/grafana/loki/pkg/storage/stores/series/index" diff --git a/pkg/storage/stores/series/index/schema_caching.go b/pkg/storage/stores/series/index/schema_caching.go index e2b78c182e27f..5f9ceb0e6b36f 100644 --- a/pkg/storage/stores/series/index/schema_caching.go +++ b/pkg/storage/stores/series/index/schema_caching.go @@ -3,8 +3,8 @@ package index import ( "time" + "github.com/grafana/dskit/mtime" "github.com/prometheus/common/model" - "github.com/weaveworks/common/mtime" ) type schemaCaching struct { diff --git a/pkg/storage/stores/series/index/schema_caching_test.go b/pkg/storage/stores/series/index/schema_caching_test.go index 9b20bdbf24293..260c5cea47e54 100644 --- a/pkg/storage/stores/series/index/schema_caching_test.go +++ b/pkg/storage/stores/series/index/schema_caching_test.go @@ -5,10 +5,10 @@ import ( "testing" "time" + "github.com/grafana/dskit/mtime" "github.com/prometheus/common/model" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/weaveworks/common/mtime" ) func TestCachingSchema(t *testing.T) { diff --git a/pkg/storage/stores/series/index/table_manager.go b/pkg/storage/stores/series/index/table_manager.go index 095a4b7f9ac1a..b7ca725022e4f 100644 --- a/pkg/storage/stores/series/index/table_manager.go +++ b/pkg/storage/stores/series/index/table_manager.go @@ -11,13 +11,13 @@ import ( "time" "github.com/go-kit/log/level" + "github.com/grafana/dskit/instrument" + "github.com/grafana/dskit/mtime" "github.com/grafana/dskit/services" "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus/promauto" "github.com/prometheus/common/model" tsdb_errors "github.com/prometheus/prometheus/tsdb/errors" - "github.com/weaveworks/common/instrument" - "github.com/weaveworks/common/mtime" "github.com/grafana/loki/pkg/storage/config" util_log "github.com/grafana/loki/pkg/util/log" diff --git a/pkg/storage/stores/series/index/table_manager_test.go b/pkg/storage/stores/series/index/table_manager_test.go index 6571e2b3fc06f..fb2141d2536dc 100644 --- a/pkg/storage/stores/series/index/table_manager_test.go +++ b/pkg/storage/stores/series/index/table_manager_test.go @@ -6,9 +6,9 @@ import ( "testing" "time" + "github.com/grafana/dskit/mtime" "github.com/prometheus/common/model" "github.com/stretchr/testify/require" - "github.com/weaveworks/common/mtime" "github.com/grafana/loki/pkg/storage/config" ) diff --git a/pkg/storage/stores/series/series_store_test.go b/pkg/storage/stores/series/series_store_test.go index b127a8e0ec472..7769711da702d 100644 --- a/pkg/storage/stores/series/series_store_test.go +++ b/pkg/storage/stores/series/series_store_test.go @@ -10,13 +10,13 @@ import ( "github.com/go-kit/log" "github.com/grafana/dskit/flagext" + "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/weaveworks/common/user" "github.com/grafana/loki/pkg/ingester/client" "github.com/grafana/loki/pkg/logqlmodel/stats" diff --git a/pkg/storage/stores/shipper/index/compactor/util_test.go b/pkg/storage/stores/shipper/index/compactor/util_test.go index ecab1e04aa872..0a6b52038b18b 100644 --- a/pkg/storage/stores/shipper/index/compactor/util_test.go +++ b/pkg/storage/stores/shipper/index/compactor/util_test.go @@ -9,11 +9,11 @@ import ( "testing" "time" + ww "github.com/grafana/dskit/server" + "github.com/grafana/dskit/user" "github.com/prometheus/common/model" "github.com/prometheus/prometheus/model/labels" "github.com/stretchr/testify/require" - ww "github.com/weaveworks/common/server" - "github.com/weaveworks/common/user" "go.etcd.io/bbolt" "github.com/grafana/loki/pkg/storage" diff --git a/pkg/storage/stores/shipper/index/table_test.go b/pkg/storage/stores/shipper/index/table_test.go index 5c2095da8a413..a5f0fdd5cf5ff 100644 --- a/pkg/storage/stores/shipper/index/table_test.go +++ b/pkg/storage/stores/shipper/index/table_test.go @@ -9,8 +9,8 @@ import ( "testing" "time" + "github.com/grafana/dskit/user" "github.com/stretchr/testify/require" - "github.com/weaveworks/common/user" "go.etcd.io/bbolt" "github.com/grafana/loki/pkg/storage/chunk/client/local" diff --git a/pkg/storage/stores/shipper/indexgateway/gateway_test.go b/pkg/storage/stores/shipper/indexgateway/gateway_test.go index 790706058ea75..0e3a0f6df2d27 100644 --- a/pkg/storage/stores/shipper/indexgateway/gateway_test.go +++ b/pkg/storage/stores/shipper/indexgateway/gateway_test.go @@ -6,10 +6,10 @@ import ( "math" "testing" + "github.com/grafana/dskit/user" "github.com/prometheus/common/model" "github.com/prometheus/prometheus/model/labels" "github.com/stretchr/testify/mock" - "github.com/weaveworks/common/user" "github.com/stretchr/testify/require" "google.golang.org/grpc" diff --git a/pkg/storage/stores/shipper/metrics.go b/pkg/storage/stores/shipper/metrics.go index dfdf63726e0f6..63f84fd38de17 100644 --- a/pkg/storage/stores/shipper/metrics.go +++ b/pkg/storage/stores/shipper/metrics.go @@ -1,9 +1,9 @@ package shipper import ( + "github.com/grafana/dskit/instrument" "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus/promauto" - "github.com/weaveworks/common/instrument" ) type metrics struct { diff --git a/pkg/storage/stores/shipper/shipper_index_client.go b/pkg/storage/stores/shipper/shipper_index_client.go index ddb76377be1ce..ef41550d3e1de 100644 --- a/pkg/storage/stores/shipper/shipper_index_client.go +++ b/pkg/storage/stores/shipper/shipper_index_client.go @@ -8,8 +8,8 @@ import ( "github.com/go-kit/log" "github.com/go-kit/log/level" + "github.com/grafana/dskit/instrument" "github.com/prometheus/client_golang/prometheus" - "github.com/weaveworks/common/instrument" "go.etcd.io/bbolt" "github.com/grafana/loki/pkg/storage/chunk/client" diff --git a/pkg/storage/stores/shipper/testutil/testutil.go b/pkg/storage/stores/shipper/testutil/testutil.go index df8574b487814..6022128e36d49 100644 --- a/pkg/storage/stores/shipper/testutil/testutil.go +++ b/pkg/storage/stores/shipper/testutil/testutil.go @@ -11,9 +11,9 @@ import ( "testing" "github.com/grafana/dskit/tenant" + "github.com/grafana/dskit/user" "github.com/klauspost/compress/gzip" "github.com/stretchr/testify/require" - "github.com/weaveworks/common/user" "go.etcd.io/bbolt" "github.com/grafana/loki/pkg/storage/chunk/client/local" diff --git a/pkg/util/fakeauth/fake_auth.go b/pkg/util/fakeauth/fake_auth.go index ee850e8045166..8f836c9a0c181 100644 --- a/pkg/util/fakeauth/fake_auth.go +++ b/pkg/util/fakeauth/fake_auth.go @@ -6,9 +6,9 @@ import ( "context" "net/http" - "github.com/weaveworks/common/middleware" - "github.com/weaveworks/common/server" - "github.com/weaveworks/common/user" + "github.com/grafana/dskit/middleware" + "github.com/grafana/dskit/server" + "github.com/grafana/dskit/user" "google.golang.org/grpc" ) diff --git a/pkg/util/httpgrpc/carrier.go b/pkg/util/httpgrpc/carrier.go index cff2cd3920740..7115ce5267ea8 100644 --- a/pkg/util/httpgrpc/carrier.go +++ b/pkg/util/httpgrpc/carrier.go @@ -1,8 +1,8 @@ package httpgrpc import ( + weaveworks_httpgrpc "github.com/grafana/dskit/httpgrpc" "github.com/opentracing/opentracing-go" - weaveworks_httpgrpc "github.com/weaveworks/common/httpgrpc" ) // Used to transfer trace information from/to HTTP request. diff --git a/pkg/util/httpreq/headers.go b/pkg/util/httpreq/headers.go index 54824c6662bfb..427cf658759b9 100644 --- a/pkg/util/httpreq/headers.go +++ b/pkg/util/httpreq/headers.go @@ -5,7 +5,7 @@ import ( "net/http" "strings" - "github.com/weaveworks/common/middleware" + "github.com/grafana/dskit/middleware" ) type headerContextKey string diff --git a/pkg/util/httpreq/tags.go b/pkg/util/httpreq/tags.go index 1753042c65a51..9295a04ae31a9 100644 --- a/pkg/util/httpreq/tags.go +++ b/pkg/util/httpreq/tags.go @@ -6,7 +6,7 @@ import ( "regexp" "time" - "github.com/weaveworks/common/middleware" + "github.com/grafana/dskit/middleware" ) // NOTE(kavi): Why new type? diff --git a/pkg/util/instrument/instrument.go b/pkg/util/instrument/instrument.go index 5060415acdc58..f0c87378ab87b 100644 --- a/pkg/util/instrument/instrument.go +++ b/pkg/util/instrument/instrument.go @@ -4,7 +4,7 @@ import ( "context" "time" - "github.com/weaveworks/common/instrument" + "github.com/grafana/dskit/instrument" ) // TimeRequest reports how much time was spent on the given function `f`. diff --git a/pkg/util/instrument/instrument_test.go b/pkg/util/instrument/instrument_test.go index 6f83b85a1b24b..166b2f383b1af 100644 --- a/pkg/util/instrument/instrument_test.go +++ b/pkg/util/instrument/instrument_test.go @@ -8,10 +8,10 @@ import ( "testing" "time" + "github.com/grafana/dskit/instrument" "github.com/prometheus/client_golang/prometheus" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/weaveworks/common/instrument" ) func TestNewHistogramCollector(t *testing.T) { diff --git a/pkg/util/log/log.go b/pkg/util/log/log.go index fbd7a1bb35ff4..4cfd8b47e4a1e 100644 --- a/pkg/util/log/log.go +++ b/pkg/util/log/log.go @@ -12,10 +12,9 @@ import ( "github.com/go-kit/log" "github.com/go-kit/log/level" dslog "github.com/grafana/dskit/log" + "github.com/grafana/dskit/server" "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus/promauto" - "github.com/weaveworks/common/logging" - "github.com/weaveworks/common/server" ) var ( @@ -41,7 +40,7 @@ func InitLogger(cfg *server.Config, reg prometheus.Registerer, buffered bool, sy // this works in go 1.12, but doesn't work in versions earlier. // it will always shows the wrapper function generated by compiler // marked in old versions. - cfg.Log = logging.GoKit(log.With(l, "caller", log.Caller(4))) + cfg.Log = dslog.GoKit(log.With(l, "caller", log.Caller(4))) } type Flusher interface { @@ -70,7 +69,7 @@ type prometheusLogger struct { // LevelHandler returns an http handler function that returns the current log level. // The optional query parameter 'log_level' can be passed to change the log level at runtime. -func LevelHandler(currentLogLevel *logging.Level) http.HandlerFunc { +func LevelHandler(currentLogLevel *dslog.Level) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { type logResponse struct { Status string `json:"status,omitempty"` @@ -118,7 +117,7 @@ func LevelHandler(currentLogLevel *logging.Level) http.HandlerFunc { // newPrometheusLogger creates a new instance of PrometheusLogger which exposes // Prometheus counters for various log levels. -func newPrometheusLogger(l logging.Level, format logging.Format, reg prometheus.Registerer, buffered bool, sync bool) log.Logger { +func newPrometheusLogger(l dslog.Level, format dslog.Format, reg prometheus.Registerer, buffered bool, sync bool) log.Logger { // buffered logger settings var ( diff --git a/pkg/util/log/log_test.go b/pkg/util/log/log_test.go index c96369925a542..2889141e1948f 100644 --- a/pkg/util/log/log_test.go +++ b/pkg/util/log/log_test.go @@ -9,12 +9,12 @@ import ( "testing" "github.com/go-kit/log" + dslog "github.com/grafana/dskit/log" "github.com/stretchr/testify/assert" - "github.com/weaveworks/common/logging" ) func TestLevelHandler(t *testing.T) { - var lvl logging.Level + var lvl dslog.Level err := lvl.Set("info") assert.NoError(t, err) plogger = &prometheusLogger{ diff --git a/pkg/util/log/wrappers.go b/pkg/util/log/wrappers.go index f455dbf2ba7e5..3c1224b9bc4b3 100644 --- a/pkg/util/log/wrappers.go +++ b/pkg/util/log/wrappers.go @@ -4,7 +4,7 @@ import ( "context" "github.com/go-kit/log" - "github.com/weaveworks/common/tracing" + "github.com/grafana/dskit/tracing" "github.com/grafana/dskit/tenant" ) diff --git a/pkg/util/querylimits/middleware.go b/pkg/util/querylimits/middleware.go index 73cf0b3438b06..58a93ad850f6b 100644 --- a/pkg/util/querylimits/middleware.go +++ b/pkg/util/querylimits/middleware.go @@ -5,7 +5,7 @@ import ( "github.com/go-kit/log" "github.com/go-kit/log/level" - "github.com/weaveworks/common/middleware" + "github.com/grafana/dskit/middleware" util_log "github.com/grafana/loki/pkg/util/log" ) diff --git a/pkg/util/server/error.go b/pkg/util/server/error.go index 4e362f0dfd82c..ef4dedec93094 100644 --- a/pkg/util/server/error.go +++ b/pkg/util/server/error.go @@ -5,9 +5,9 @@ import ( "errors" "net/http" + "github.com/grafana/dskit/httpgrpc" + "github.com/grafana/dskit/user" "github.com/prometheus/prometheus/promql" - "github.com/weaveworks/common/httpgrpc" - "github.com/weaveworks/common/user" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" diff --git a/pkg/util/server/error_test.go b/pkg/util/server/error_test.go index fbf898723d570..1b8132ff653a4 100644 --- a/pkg/util/server/error_test.go +++ b/pkg/util/server/error_test.go @@ -12,10 +12,10 @@ import ( "google.golang.org/grpc/codes" "google.golang.org/grpc/status" + "github.com/grafana/dskit/httpgrpc" + "github.com/grafana/dskit/user" "github.com/prometheus/prometheus/promql" "github.com/stretchr/testify/require" - "github.com/weaveworks/common/httpgrpc" - "github.com/weaveworks/common/user" "github.com/grafana/loki/pkg/logqlmodel" storage_errors "github.com/grafana/loki/pkg/storage/errors" diff --git a/pkg/util/server/middleware.go b/pkg/util/server/middleware.go index de2b94aa6acaa..4dd241a6d54d7 100644 --- a/pkg/util/server/middleware.go +++ b/pkg/util/server/middleware.go @@ -3,8 +3,8 @@ package server import ( "net/http" - "github.com/weaveworks/common/httpgrpc" - "github.com/weaveworks/common/middleware" + "github.com/grafana/dskit/httpgrpc" + "github.com/grafana/dskit/middleware" ) // NewPrepopulateMiddleware creates a middleware which will parse incoming http forms. diff --git a/pkg/util/server/recovery.go b/pkg/util/server/recovery.go index ba6f2315bdbec..3068a41347b02 100644 --- a/pkg/util/server/recovery.go +++ b/pkg/util/server/recovery.go @@ -6,11 +6,11 @@ import ( "os" "runtime" + "github.com/grafana/dskit/httpgrpc" + "github.com/grafana/dskit/middleware" grpc_recovery "github.com/grpc-ecosystem/go-grpc-middleware/recovery" "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus/promauto" - "github.com/weaveworks/common/httpgrpc" - "github.com/weaveworks/common/middleware" ) const maxStacksize = 8 * 1024 diff --git a/pkg/util/time.go b/pkg/util/time.go index c86d0d7494354..8f9e0c01b0a91 100644 --- a/pkg/util/time.go +++ b/pkg/util/time.go @@ -7,8 +7,8 @@ import ( "strconv" "time" + "github.com/grafana/dskit/httpgrpc" "github.com/prometheus/common/model" - "github.com/weaveworks/common/httpgrpc" utilsMath "github.com/grafana/loki/pkg/util/math" ) diff --git a/tools/doc-generator/parse/parser.go b/tools/doc-generator/parse/parser.go index 192ce1ea2f026..0ac57347e8fd6 100644 --- a/tools/doc-generator/parse/parser.go +++ b/tools/doc-generator/parse/parser.go @@ -15,12 +15,12 @@ import ( "unicode" "github.com/grafana/dskit/flagext" + "github.com/grafana/dskit/log" "github.com/grafana/regexp" "github.com/pkg/errors" "github.com/prometheus/common/model" prometheus_config "github.com/prometheus/prometheus/config" "github.com/prometheus/prometheus/model/relabel" - "github.com/weaveworks/common/logging" "github.com/grafana/loki/pkg/ruler/util" storage_config "github.com/grafana/loki/pkg/storage/config" @@ -492,7 +492,7 @@ func getFieldExample(fieldKey string, fieldType reflect.Type) *FieldExample { } func getCustomFieldEntry(cfg interface{}, field reflect.StructField, fieldValue reflect.Value, flags map[uintptr]*flag.Flag) (*ConfigEntry, error) { - if field.Type == reflect.TypeOf(logging.Level{}) || field.Type == reflect.TypeOf(logging.Format{}) { + if field.Type == reflect.TypeOf(log.Level{}) || field.Type == reflect.TypeOf(log.Format{}) { fieldFlag, err := getFieldFlag(field, fieldValue, flags) if err != nil || fieldFlag == nil { return nil, err diff --git a/tools/doc-generator/parse/root_blocks.go b/tools/doc-generator/parse/root_blocks.go index 61e227c89d07c..8451a656507ba 100644 --- a/tools/doc-generator/parse/root_blocks.go +++ b/tools/doc-generator/parse/root_blocks.go @@ -11,7 +11,7 @@ import ( "github.com/grafana/dskit/kv/etcd" "github.com/grafana/dskit/kv/memberlist" "github.com/grafana/dskit/runtimeconfig" - "github.com/weaveworks/common/server" + "github.com/grafana/dskit/server" "github.com/grafana/loki/pkg/analytics" "github.com/grafana/loki/pkg/distributor" diff --git a/vendor/github.com/grafana/dskit/errors/error.go b/vendor/github.com/grafana/dskit/errors/error.go new file mode 100644 index 0000000000000..1d36f7c39e7cd --- /dev/null +++ b/vendor/github.com/grafana/dskit/errors/error.go @@ -0,0 +1,10 @@ +// Provenance-includes-location: https://github.com/weaveworks/common/blob/main/errors/error.go +// Provenance-includes-license: Apache-2.0 +// Provenance-includes-copyright: Weaveworks Ltd. + +package errors + +// Error see https://dave.cheney.net/2016/04/07/constant-errors. +type Error string + +func (e Error) Error() string { return string(e) } diff --git a/vendor/github.com/grafana/dskit/flagext/parse.go b/vendor/github.com/grafana/dskit/flagext/parse.go new file mode 100644 index 0000000000000..41d1bafffeae4 --- /dev/null +++ b/vendor/github.com/grafana/dskit/flagext/parse.go @@ -0,0 +1,28 @@ +package flagext + +import ( + "flag" + "fmt" + "os" + "strings" +) + +// ParseFlagsAndArguments calls Parse() on the input flag.FlagSet and returns the parsed arguments. +func ParseFlagsAndArguments(f *flag.FlagSet) ([]string, error) { + err := f.Parse(os.Args[1:]) + return f.Args(), err +} + +// ParseFlagsWithoutArguments calls Parse() on the input flag.FlagSet and enforces no arguments have been parsed. +// This utility should be called whenever we only expect CLI flags but no arguments. +func ParseFlagsWithoutArguments(f *flag.FlagSet) error { + if err := f.Parse(os.Args[1:]); err != nil { + return err + } + + if f.NArg() > 0 { + return fmt.Errorf("the command does not support any argument, but some were provided: %s", strings.Join(f.Args(), " ")) + } + + return nil +} diff --git a/vendor/github.com/grafana/dskit/grpcclient/instrumentation.go b/vendor/github.com/grafana/dskit/grpcclient/instrumentation.go index c8d3528895a27..4a10ce48d27a8 100644 --- a/vendor/github.com/grafana/dskit/grpcclient/instrumentation.go +++ b/vendor/github.com/grafana/dskit/grpcclient/instrumentation.go @@ -4,8 +4,9 @@ import ( otgrpc "github.com/opentracing-contrib/go-grpc" "github.com/opentracing/opentracing-go" "github.com/prometheus/client_golang/prometheus" - "github.com/weaveworks/common/middleware" "google.golang.org/grpc" + + "github.com/grafana/dskit/middleware" ) func Instrument(requestDuration *prometheus.HistogramVec) ([]grpc.UnaryClientInterceptor, []grpc.StreamClientInterceptor) { diff --git a/vendor/github.com/weaveworks/common/grpc/cancel.go b/vendor/github.com/grafana/dskit/grpcutil/cancel.go similarity index 55% rename from vendor/github.com/weaveworks/common/grpc/cancel.go rename to vendor/github.com/grafana/dskit/grpcutil/cancel.go index debef0895826f..b1d369d2a3ea8 100644 --- a/vendor/github.com/weaveworks/common/grpc/cancel.go +++ b/vendor/github.com/grafana/dskit/grpcutil/cancel.go @@ -1,7 +1,12 @@ -package grpc +// Provenance-includes-location: https://github.com/weaveworks/common/blob/main/grpc/cancel.go +// Provenance-includes-license: Apache-2.0 +// Provenance-includes-copyright: Weaveworks Ltd. + +package grpcutil import ( "context" + "errors" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" @@ -9,7 +14,7 @@ import ( // IsCanceled checks whether an error comes from an operation being canceled func IsCanceled(err error) bool { - if err == context.Canceled { + if errors.Is(err, context.Canceled) { return true } s, ok := status.FromError(err) diff --git a/vendor/github.com/weaveworks/common/httpgrpc/README.md b/vendor/github.com/grafana/dskit/httpgrpc/README.md similarity index 100% rename from vendor/github.com/weaveworks/common/httpgrpc/README.md rename to vendor/github.com/grafana/dskit/httpgrpc/README.md diff --git a/vendor/github.com/weaveworks/common/httpgrpc/httpgrpc.go b/vendor/github.com/grafana/dskit/httpgrpc/httpgrpc.go similarity index 87% rename from vendor/github.com/weaveworks/common/httpgrpc/httpgrpc.go rename to vendor/github.com/grafana/dskit/httpgrpc/httpgrpc.go index db39d0c980a09..050492dfcb110 100644 --- a/vendor/github.com/weaveworks/common/httpgrpc/httpgrpc.go +++ b/vendor/github.com/grafana/dskit/httpgrpc/httpgrpc.go @@ -1,3 +1,7 @@ +// Provenance-includes-location: https://github.com/weaveworks/common/blob/main/httpgrpc/httpgrpc.go +// Provenance-includes-license: Apache-2.0 +// Provenance-includes-copyright: Weaveworks Ltd. + package httpgrpc import ( diff --git a/vendor/github.com/weaveworks/common/httpgrpc/httpgrpc.pb.go b/vendor/github.com/grafana/dskit/httpgrpc/httpgrpc.pb.go similarity index 89% rename from vendor/github.com/weaveworks/common/httpgrpc/httpgrpc.pb.go rename to vendor/github.com/grafana/dskit/httpgrpc/httpgrpc.pb.go index 4b3f6ad9f72fc..bab0efd5362f7 100644 --- a/vendor/github.com/weaveworks/common/httpgrpc/httpgrpc.pb.go +++ b/vendor/github.com/grafana/dskit/httpgrpc/httpgrpc.pb.go @@ -1,5 +1,5 @@ // Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: httpgrpc/httpgrpc.proto +// source: httpgrpc.proto package httpgrpc @@ -40,7 +40,7 @@ type HTTPRequest struct { func (m *HTTPRequest) Reset() { *m = HTTPRequest{} } func (*HTTPRequest) ProtoMessage() {} func (*HTTPRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_6670c8e151665986, []int{0} + return fileDescriptor_c50820dbc814fcdd, []int{0} } func (m *HTTPRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -106,7 +106,7 @@ type HTTPResponse struct { func (m *HTTPResponse) Reset() { *m = HTTPResponse{} } func (*HTTPResponse) ProtoMessage() {} func (*HTTPResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_6670c8e151665986, []int{1} + return fileDescriptor_c50820dbc814fcdd, []int{1} } func (m *HTTPResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -164,7 +164,7 @@ type Header struct { func (m *Header) Reset() { *m = Header{} } func (*Header) ProtoMessage() {} func (*Header) Descriptor() ([]byte, []int) { - return fileDescriptor_6670c8e151665986, []int{2} + return fileDescriptor_c50820dbc814fcdd, []int{2} } func (m *Header) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -213,31 +213,29 @@ func init() { proto.RegisterType((*Header)(nil), "httpgrpc.Header") } -func init() { proto.RegisterFile("httpgrpc/httpgrpc.proto", fileDescriptor_6670c8e151665986) } +func init() { proto.RegisterFile("httpgrpc.proto", fileDescriptor_c50820dbc814fcdd) } -var fileDescriptor_6670c8e151665986 = []byte{ - // 322 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x91, 0x3f, 0x4f, 0xc2, 0x40, - 0x14, 0xc0, 0x7b, 0x14, 0xab, 0x1c, 0x0c, 0xe4, 0xa2, 0xd8, 0x30, 0x5c, 0x08, 0x89, 0x09, 0x71, - 0xa0, 0x09, 0x4e, 0x8e, 0xea, 0xc2, 0xa6, 0xb9, 0x30, 0xb9, 0xb5, 0xf4, 0xa5, 0x35, 0x50, 0x5e, - 0x6d, 0xaf, 0x10, 0x36, 0x3f, 0x82, 0x1f, 0xc3, 0x8f, 0xe2, 0xc8, 0xc8, 0x28, 0xe5, 0x0b, 0xf8, - 0x11, 0xcc, 0x5d, 0x29, 0x36, 0x4e, 0x6e, 0xbf, 0xf7, 0x27, 0xf7, 0x7b, 0xef, 0x1e, 0xbd, 0x0c, - 0xa5, 0x8c, 0x83, 0x24, 0x9e, 0x3a, 0x25, 0x0c, 0xe3, 0x04, 0x25, 0xb2, 0xb3, 0x32, 0xee, 0x9e, - 0x07, 0x18, 0xa0, 0x4e, 0x3a, 0x8a, 0x8a, 0x7a, 0x7f, 0x45, 0x9b, 0xe3, 0xc9, 0xe4, 0x49, 0xc0, - 0x6b, 0x06, 0xa9, 0x64, 0x1d, 0x6a, 0x45, 0x20, 0x43, 0xf4, 0x6d, 0xd2, 0x23, 0x83, 0x86, 0x38, - 0x44, 0xac, 0x4d, 0xcd, 0x2c, 0x99, 0xdb, 0x35, 0x9d, 0x54, 0xc8, 0xae, 0xe9, 0x69, 0x08, 0xae, - 0x0f, 0x49, 0x6a, 0x9b, 0x3d, 0x73, 0xd0, 0x1c, 0xb5, 0x87, 0x47, 0xf5, 0x58, 0x17, 0x44, 0xd9, - 0xc0, 0x18, 0xad, 0x7b, 0xe8, 0xaf, 0xed, 0x7a, 0x8f, 0x0c, 0x5a, 0x42, 0x73, 0xdf, 0xa3, 0xad, - 0x42, 0x9c, 0xc6, 0xb8, 0x48, 0x41, 0xf5, 0x3c, 0xa0, 0x0f, 0xda, 0x7b, 0x22, 0x34, 0x57, 0x1d, - 0xb5, 0xff, 0x3a, 0xcc, 0x8a, 0x63, 0x44, 0xad, 0xa2, 0x4d, 0xcd, 0x3f, 0x83, 0xf5, 0x61, 0x29, - 0x85, 0x6a, 0xd3, 0xa5, 0x3b, 0xcf, 0xa0, 0x78, 0xba, 0x21, 0x0e, 0xd1, 0xe8, 0x8e, 0xd6, 0xd5, - 0x5c, 0xec, 0x96, 0x5a, 0x63, 0x77, 0xe1, 0xcf, 0x81, 0x5d, 0x54, 0xa4, 0xbf, 0x5f, 0xd5, 0xed, - 0xfc, 0x4d, 0x17, 0x8b, 0xf4, 0x8d, 0xfb, 0xc7, 0xed, 0x8e, 0x1b, 0xdf, 0x3b, 0x4e, 0xde, 0x72, - 0x4e, 0x3e, 0x72, 0x4e, 0x3e, 0x73, 0x4e, 0x36, 0x39, 0x27, 0x5f, 0x39, 0x27, 0xef, 0x7b, 0x6e, - 0x6c, 0xf6, 0xdc, 0xd8, 0xee, 0xb9, 0xf1, 0x7c, 0x15, 0xbc, 0xc8, 0x30, 0xf3, 0x86, 0x53, 0x8c, - 0x9c, 0x15, 0xb8, 0x4b, 0x58, 0x61, 0x32, 0x4b, 0x9d, 0x29, 0x46, 0x11, 0x2e, 0x8e, 0xa7, 0xf4, - 0x2c, 0x7d, 0xab, 0x9b, 0x9f, 0x00, 0x00, 0x00, 0xff, 0xff, 0xd8, 0xb5, 0xfe, 0x5d, 0xe6, 0x01, - 0x00, 0x00, +var fileDescriptor_c50820dbc814fcdd = []byte{ + // 301 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x91, 0xbd, 0x4e, 0xc3, 0x30, + 0x14, 0x85, 0xed, 0xa6, 0x04, 0xea, 0x56, 0xa8, 0xb2, 0xa0, 0x8a, 0x3a, 0x5c, 0x55, 0x99, 0x22, + 0x86, 0x22, 0x05, 0x16, 0x46, 0x60, 0xc9, 0x88, 0xac, 0xbe, 0x40, 0x42, 0xac, 0x44, 0x22, 0xd4, + 0x21, 0x3f, 0xa0, 0x6e, 0x3c, 0x02, 0x8f, 0xc1, 0xa3, 0x30, 0x66, 0xec, 0x48, 0x9c, 0x85, 0xb1, + 0x8f, 0x80, 0xec, 0xa4, 0x10, 0x31, 0xb1, 0x9d, 0x7b, 0xee, 0x51, 0xbe, 0x7b, 0x62, 0x72, 0x1c, + 0x17, 0x45, 0x1a, 0x65, 0xe9, 0xfd, 0x32, 0xcd, 0x44, 0x21, 0xe8, 0xd1, 0x7e, 0x9e, 0x9f, 0x44, + 0x22, 0x12, 0xda, 0x3c, 0x57, 0xaa, 0xdd, 0xdb, 0x2f, 0x64, 0xec, 0xad, 0x56, 0x77, 0x8c, 0x3f, + 0x95, 0x3c, 0x2f, 0xe8, 0x8c, 0x98, 0x8f, 0xbc, 0x88, 0x45, 0x68, 0xe1, 0x05, 0x76, 0x46, 0xac, + 0x9b, 0xe8, 0x94, 0x18, 0x65, 0x96, 0x58, 0x03, 0x6d, 0x2a, 0x49, 0xcf, 0xc8, 0x61, 0xcc, 0xfd, + 0x90, 0x67, 0xb9, 0x65, 0x2c, 0x0c, 0x67, 0xec, 0x4e, 0x97, 0x3f, 0x68, 0x4f, 0x2f, 0xd8, 0x3e, + 0x40, 0x29, 0x19, 0x06, 0x22, 0xdc, 0x58, 0xc3, 0x05, 0x76, 0x26, 0x4c, 0x6b, 0x3b, 0x20, 0x93, + 0x16, 0x9c, 0xa7, 0x62, 0x9d, 0x73, 0x95, 0xb9, 0x15, 0x21, 0xd7, 0xdc, 0x03, 0xa6, 0x75, 0x9f, + 0x31, 0xf8, 0x2f, 0xc3, 0xe8, 0x31, 0x5c, 0x62, 0xb6, 0x31, 0x75, 0xff, 0x03, 0xdf, 0x74, 0xa5, + 0x94, 0x54, 0x4d, 0x9f, 0xfd, 0xa4, 0xe4, 0xed, 0xa7, 0x47, 0xac, 0x9b, 0xdc, 0x6b, 0x32, 0x54, + 0x77, 0xd1, 0x2b, 0x62, 0x7a, 0xfe, 0x3a, 0x4c, 0x38, 0x3d, 0xed, 0x41, 0x7f, 0x7f, 0xd5, 0x7c, + 0xf6, 0xd7, 0x6e, 0x8b, 0xd8, 0xe8, 0xe6, 0xb2, 0xaa, 0x01, 0x6d, 0x6b, 0x40, 0xbb, 0x1a, 0xf0, + 0xab, 0x04, 0xfc, 0x2e, 0x01, 0x7f, 0x48, 0xc0, 0x95, 0x04, 0xfc, 0x29, 0x01, 0x7f, 0x49, 0x40, + 0x3b, 0x09, 0xf8, 0xad, 0x01, 0x54, 0x35, 0x80, 0xb6, 0x0d, 0xa0, 0xc0, 0xd4, 0x0f, 0x72, 0xf1, + 0x1d, 0x00, 0x00, 0xff, 0xff, 0x44, 0x0e, 0x7c, 0xff, 0xc2, 0x01, 0x00, 0x00, } func (this *HTTPRequest) Equal(that interface{}) bool { @@ -471,7 +469,7 @@ var _HTTP_serviceDesc = grpc.ServiceDesc{ }, }, Streams: []grpc.StreamDesc{}, - Metadata: "httpgrpc/httpgrpc.proto", + Metadata: "httpgrpc.proto", } func (m *HTTPRequest) Marshal() (dAtA []byte, err error) { @@ -1204,7 +1202,6 @@ func (m *Header) Unmarshal(dAtA []byte) error { func skipHttpgrpc(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 - depth := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { @@ -1236,8 +1233,10 @@ func skipHttpgrpc(dAtA []byte) (n int, err error) { break } } + return iNdEx, nil case 1: iNdEx += 8 + return iNdEx, nil case 2: var length int for shift := uint(0); ; shift += 7 { @@ -1258,30 +1257,55 @@ func skipHttpgrpc(dAtA []byte) (n int, err error) { return 0, ErrInvalidLengthHttpgrpc } iNdEx += length + if iNdEx < 0 { + return 0, ErrInvalidLengthHttpgrpc + } + return iNdEx, nil case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupHttpgrpc + for { + var innerWire uint64 + var start int = iNdEx + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowHttpgrpc + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + innerWire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + innerWireType := int(innerWire & 0x7) + if innerWireType == 4 { + break + } + next, err := skipHttpgrpc(dAtA[start:]) + if err != nil { + return 0, err + } + iNdEx = start + next + if iNdEx < 0 { + return 0, ErrInvalidLengthHttpgrpc + } } - depth-- + return iNdEx, nil + case 4: + return iNdEx, nil case 5: iNdEx += 4 + return iNdEx, nil default: return 0, fmt.Errorf("proto: illegal wireType %d", wireType) } - if iNdEx < 0 { - return 0, ErrInvalidLengthHttpgrpc - } - if depth == 0 { - return iNdEx, nil - } } - return 0, io.ErrUnexpectedEOF + panic("unreachable") } var ( - ErrInvalidLengthHttpgrpc = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowHttpgrpc = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupHttpgrpc = fmt.Errorf("proto: unexpected end of group") + ErrInvalidLengthHttpgrpc = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowHttpgrpc = fmt.Errorf("proto: integer overflow") ) diff --git a/vendor/github.com/weaveworks/common/httpgrpc/httpgrpc.proto b/vendor/github.com/grafana/dskit/httpgrpc/httpgrpc.proto similarity index 92% rename from vendor/github.com/weaveworks/common/httpgrpc/httpgrpc.proto rename to vendor/github.com/grafana/dskit/httpgrpc/httpgrpc.proto index 0313dbb625c00..8f546330a52e7 100644 --- a/vendor/github.com/weaveworks/common/httpgrpc/httpgrpc.proto +++ b/vendor/github.com/grafana/dskit/httpgrpc/httpgrpc.proto @@ -11,7 +11,6 @@ option (gogoproto.goproto_stringer_all) = false; option (gogoproto.goproto_unkeyed_all) = false; option (gogoproto.goproto_unrecognized_all) = false; option (gogoproto.goproto_sizecache_all) = false; -option go_package = "github.com/weaveworks/common/httpgrpc"; service HTTP { rpc Handle(HTTPRequest) returns (HTTPResponse) {}; diff --git a/vendor/github.com/weaveworks/common/httpgrpc/server/server.go b/vendor/github.com/grafana/dskit/httpgrpc/server/server.go similarity index 91% rename from vendor/github.com/weaveworks/common/httpgrpc/server/server.go rename to vendor/github.com/grafana/dskit/httpgrpc/server/server.go index 25377cc5e7f79..7b715bd5625f9 100644 --- a/vendor/github.com/weaveworks/common/httpgrpc/server/server.go +++ b/vendor/github.com/grafana/dskit/httpgrpc/server/server.go @@ -1,7 +1,12 @@ +// Provenance-includes-location: https://github.com/weaveworks/common/blob/main/httpgrpc/server/server.go +// Provenance-includes-license: Apache-2.0 +// Provenance-includes-copyright: Weaveworks Ltd. + package server import ( "bytes" + "context" "fmt" "io/ioutil" "net" @@ -13,13 +18,12 @@ import ( otgrpc "github.com/opentracing-contrib/go-grpc" "github.com/opentracing/opentracing-go" "github.com/sercand/kuberesolver/v4" - "golang.org/x/net/context" "google.golang.org/grpc" "google.golang.org/grpc/credentials/insecure" - "github.com/weaveworks/common/httpgrpc" - "github.com/weaveworks/common/logging" - "github.com/weaveworks/common/middleware" + "github.com/grafana/dskit/httpgrpc" + "github.com/grafana/dskit/log" + "github.com/grafana/dskit/middleware" ) // Server implements HTTPServer. HTTPServer is a generated interface that gRPC @@ -102,9 +106,9 @@ func ParseURL(unparsed string) (string, error) { return "", err } parts := strings.SplitN(host, ".", 3) - service, namespace, domain := parts[0], "default", "" + service, domain := parts[0], "" if len(parts) > 1 { - namespace = parts[1] + namespace := parts[1] domain = "." + namespace } if len(parts) > 2 { @@ -174,7 +178,7 @@ func WriteResponse(w http.ResponseWriter, resp *httpgrpc.HTTPResponse) error { func WriteError(w http.ResponseWriter, err error) { resp, ok := httpgrpc.HTTPResponseFromError(err) if ok { - WriteResponse(w, resp) + _ = WriteResponse(w, resp) } else { http.Error(w, err.Error(), http.StatusInternalServerError) } @@ -185,7 +189,7 @@ func (c *Client) ServeHTTP(w http.ResponseWriter, r *http.Request) { if tracer := opentracing.GlobalTracer(); tracer != nil { if span := opentracing.SpanFromContext(r.Context()); span != nil { if err := tracer.Inject(span.Context(), opentracing.HTTPHeaders, opentracing.HTTPHeadersCarrier(r.Header)); err != nil { - logging.Global().Warnf("Failed to inject tracing headers into request: %v", err) + log.Global().Warnf("Failed to inject tracing headers into request: %v", err) } } } diff --git a/vendor/github.com/grafana/dskit/httpgrpc/tools.go b/vendor/github.com/grafana/dskit/httpgrpc/tools.go new file mode 100644 index 0000000000000..9117d39b129c2 --- /dev/null +++ b/vendor/github.com/grafana/dskit/httpgrpc/tools.go @@ -0,0 +1,10 @@ +// Provenance-includes-location: https://github.com/weaveworks/common/blob/main/httpgrpc/tools.go +// Provenance-includes-license: Apache-2.0 +// Provenance-includes-copyright: Weaveworks Ltd. + +package httpgrpc + +import ( + // This is a workaround for go mod which fails to download gogoproto otherwise + _ "github.com/gogo/protobuf/gogoproto" +) diff --git a/vendor/github.com/weaveworks/common/instrument/instrument.go b/vendor/github.com/grafana/dskit/instrument/instrument.go similarity index 79% rename from vendor/github.com/weaveworks/common/instrument/instrument.go rename to vendor/github.com/grafana/dskit/instrument/instrument.go index 07aa033c0c9ab..4ea480b29d60e 100644 --- a/vendor/github.com/weaveworks/common/instrument/instrument.go +++ b/vendor/github.com/grafana/dskit/instrument/instrument.go @@ -1,3 +1,9 @@ +// Provenance-includes-location: https://github.com/weaveworks/common/blob/main/instrument/instrument.go +// Provenance-includes-license: Apache-2.0 +// Provenance-includes-copyright: Weaveworks Ltd. + +//lint:file-ignore faillint Changing from prometheus to promauto package would be a breaking change for consumers + package instrument import ( @@ -8,11 +14,10 @@ import ( "github.com/opentracing/opentracing-go/ext" otlog "github.com/opentracing/opentracing-go/log" "github.com/prometheus/client_golang/prometheus" - oldcontext "golang.org/x/net/context" - "github.com/weaveworks/common/grpc" - "github.com/weaveworks/common/tracing" - "github.com/weaveworks/common/user" + "github.com/grafana/dskit/grpcutil" + "github.com/grafana/dskit/tracing" + "github.com/grafana/dskit/user" ) // DefBuckets are histogram buckets for the response time (in seconds) @@ -53,7 +58,7 @@ func (c *HistogramCollector) Register() { } // Before collects for the upcoming request. -func (c *HistogramCollector) Before(ctx context.Context, method string, start time.Time) { +func (c *HistogramCollector) Before(context.Context, string, time.Time) { } // After collects when the request is done. @@ -131,13 +136,13 @@ func (c *JobCollector) Register() { } // Before collects for the upcoming request. -func (c *JobCollector) Before(ctx context.Context, method string, start time.Time) { +func (c *JobCollector) Before(_ context.Context, method string, start time.Time) { c.start.WithLabelValues(method).Set(float64(start.UTC().Unix())) c.started.WithLabelValues(method).Inc() } // After collects when the request is done. -func (c *JobCollector) After(ctx context.Context, method, statusCode string, start time.Time) { +func (c *JobCollector) After(_ context.Context, method, statusCode string, start time.Time) { end := time.Now() c.end.WithLabelValues(method, statusCode).Set(float64(end.UTC().Unix())) c.duration.WithLabelValues(method, statusCode).Set(end.Sub(start).Seconds()) @@ -168,7 +173,7 @@ func CollectedRequest(ctx context.Context, method string, col Collector, toStatu col.After(newCtx, method, toStatusCode(err), start) if err != nil { - if !grpc.IsCanceled(err) { + if !grpcutil.IsCanceled(err) { ext.Error.Set(sp, true) } sp.LogFields(otlog.Error(err)) @@ -185,21 +190,3 @@ func ErrorCode(err error) string { } return "500" } - -// TimeRequestHistogram runs 'f' and records how long it took in the given Prometheus -// histogram metric. If 'f' returns successfully, record a "200". Otherwise, record -// "500". It will also emit an OpenTracing span if you have a global tracer configured. -// -// Deprecated: Use CollectedRequest() -func TimeRequestHistogram(ctx oldcontext.Context, method string, metric *prometheus.HistogramVec, f func(context.Context) error) error { - return CollectedRequest(ctx, method, NewHistogramCollector(metric), ErrorCode, f) -} - -// TimeRequestHistogramStatus runs 'f' and records how long it took in the given Prometheus -// histogram metric. If 'f' returns successfully, record a "200". Otherwise, record -// "500". It will also emit an OpenTracing span if you have a global tracer configured. -// -// Deprecated: Use CollectedRequest() -func TimeRequestHistogramStatus(ctx oldcontext.Context, method string, metric *prometheus.HistogramVec, toStatusCode func(error) string, f func(context.Context) error) error { - return CollectedRequest(ctx, method, NewHistogramCollector(metric), toStatusCode, f) -} diff --git a/vendor/github.com/grafana/dskit/kv/consul/client.go b/vendor/github.com/grafana/dskit/kv/consul/client.go index 861e03f5625f8..5501a67d894b2 100644 --- a/vendor/github.com/grafana/dskit/kv/consul/client.go +++ b/vendor/github.com/grafana/dskit/kv/consul/client.go @@ -14,9 +14,10 @@ import ( consul "github.com/hashicorp/consul/api" "github.com/hashicorp/go-cleanhttp" "github.com/prometheus/client_golang/prometheus" - "github.com/weaveworks/common/instrument" "golang.org/x/time/rate" + "github.com/grafana/dskit/instrument" + "github.com/grafana/dskit/backoff" "github.com/grafana/dskit/flagext" "github.com/grafana/dskit/kv/codec" diff --git a/vendor/github.com/grafana/dskit/kv/consul/metrics.go b/vendor/github.com/grafana/dskit/kv/consul/metrics.go index 52a1d4e843adb..166e79bc98e7d 100644 --- a/vendor/github.com/grafana/dskit/kv/consul/metrics.go +++ b/vendor/github.com/grafana/dskit/kv/consul/metrics.go @@ -6,7 +6,8 @@ import ( consul "github.com/hashicorp/consul/api" "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus/promauto" - "github.com/weaveworks/common/instrument" + + "github.com/grafana/dskit/instrument" ) type consulInstrumentation struct { diff --git a/vendor/github.com/grafana/dskit/kv/metrics.go b/vendor/github.com/grafana/dskit/kv/metrics.go index 66fe9fa91be25..7361b8c41c789 100644 --- a/vendor/github.com/grafana/dskit/kv/metrics.go +++ b/vendor/github.com/grafana/dskit/kv/metrics.go @@ -6,8 +6,9 @@ import ( "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus/promauto" - "github.com/weaveworks/common/httpgrpc" - "github.com/weaveworks/common/instrument" + + "github.com/grafana/dskit/httpgrpc" + "github.com/grafana/dskit/instrument" ) // RegistererWithKVName wraps the provided Registerer with the KV name label. If a nil reg diff --git a/vendor/github.com/weaveworks/common/logging/format.go b/vendor/github.com/grafana/dskit/log/format.go similarity index 83% rename from vendor/github.com/weaveworks/common/logging/format.go rename to vendor/github.com/grafana/dskit/log/format.go index 701b32f563232..3925b3c14a402 100644 --- a/vendor/github.com/weaveworks/common/logging/format.go +++ b/vendor/github.com/grafana/dskit/log/format.go @@ -1,4 +1,8 @@ -package logging +// Provenance-includes-location: https://github.com/weaveworks/common/blob/main/logging/format.go +// Provenance-includes-license: Apache-2.0 +// Provenance-includes-copyright: Weaveworks Ltd. + +package log import ( "flag" @@ -15,7 +19,7 @@ type Format struct { // RegisterFlags adds the log format flag to the provided flagset. func (f *Format) RegisterFlags(fs *flag.FlagSet) { - f.Set("logfmt") + _ = f.Set("logfmt") fs.Var(f, "log.format", "Output log messages in the given format. Valid formats: [logfmt, json]") } diff --git a/vendor/github.com/weaveworks/common/logging/global.go b/vendor/github.com/grafana/dskit/log/global.go similarity index 87% rename from vendor/github.com/weaveworks/common/logging/global.go rename to vendor/github.com/grafana/dskit/log/global.go index ed72daf739c4b..68131a156d53a 100644 --- a/vendor/github.com/weaveworks/common/logging/global.go +++ b/vendor/github.com/grafana/dskit/log/global.go @@ -1,4 +1,8 @@ -package logging +// Provenance-includes-location: https://github.com/weaveworks/common/blob/main/logging/global.go +// Provenance-includes-license: Apache-2.0 +// Provenance-includes-copyright: Weaveworks Ltd. + +package log var global = Noop() diff --git a/vendor/github.com/weaveworks/common/logging/gokit.go b/vendor/github.com/grafana/dskit/log/gokit.go similarity index 92% rename from vendor/github.com/weaveworks/common/logging/gokit.go rename to vendor/github.com/grafana/dskit/log/gokit.go index e4b6fdc032cd2..c956c677533c4 100644 --- a/vendor/github.com/weaveworks/common/logging/gokit.go +++ b/vendor/github.com/grafana/dskit/log/gokit.go @@ -1,4 +1,8 @@ -package logging +// Provenance-includes-location: https://github.com/weaveworks/common/blob/main/logging/gokit.go +// Provenance-includes-license: Apache-2.0 +// Provenance-includes-copyright: Weaveworks Ltd. + +package log import ( "fmt" diff --git a/vendor/github.com/weaveworks/common/logging/interface.go b/vendor/github.com/grafana/dskit/log/interface.go similarity index 76% rename from vendor/github.com/weaveworks/common/logging/interface.go rename to vendor/github.com/grafana/dskit/log/interface.go index f4625e474f81a..a074fef90b9b6 100644 --- a/vendor/github.com/weaveworks/common/logging/interface.go +++ b/vendor/github.com/grafana/dskit/log/interface.go @@ -1,4 +1,8 @@ -package logging +// Provenance-includes-location: https://github.com/weaveworks/common/blob/main/logging/interface.go +// Provenance-includes-license: Apache-2.0 +// Provenance-includes-copyright: Weaveworks Ltd. + +package log // Interface 'unifies' gokit logging and logrus logging, such that // the middleware in this repo can be used in projects which use either diff --git a/vendor/github.com/weaveworks/common/logging/level.go b/vendor/github.com/grafana/dskit/log/level.go similarity index 90% rename from vendor/github.com/weaveworks/common/logging/level.go rename to vendor/github.com/grafana/dskit/log/level.go index d7b92eaaa10c3..f2b8db55b1f77 100644 --- a/vendor/github.com/weaveworks/common/logging/level.go +++ b/vendor/github.com/grafana/dskit/log/level.go @@ -1,4 +1,8 @@ -package logging +// Provenance-includes-location: https://github.com/weaveworks/common/blob/main/logging/level.go +// Provenance-includes-license: Apache-2.0 +// Provenance-includes-copyright: Weaveworks Ltd. + +package log // Copy-pasted from prometheus/common/promlog. // Copyright 2017 The Prometheus Authors @@ -32,7 +36,7 @@ type Level struct { // RegisterFlags adds the log level flag to the provided flagset. func (l *Level) RegisterFlags(f *flag.FlagSet) { - l.Set("info") + _ = l.Set("info") f.Var(l, "log.level", "Only log messages with the given severity or above. Valid levels: [debug, info, warn, error]") } diff --git a/vendor/github.com/weaveworks/common/logging/logging.go b/vendor/github.com/grafana/dskit/log/logging.go similarity index 76% rename from vendor/github.com/weaveworks/common/logging/logging.go rename to vendor/github.com/grafana/dskit/log/logging.go index f23db5f6630e5..5bb80dee29385 100644 --- a/vendor/github.com/weaveworks/common/logging/logging.go +++ b/vendor/github.com/grafana/dskit/log/logging.go @@ -1,4 +1,8 @@ -package logging +// Provenance-includes-location: https://github.com/weaveworks/common/blob/main/logging/logging.go +// Provenance-includes-license: Apache-2.0 +// Provenance-includes-copyright: Weaveworks Ltd. + +package log import ( "fmt" diff --git a/vendor/github.com/weaveworks/common/logging/logrus.go b/vendor/github.com/grafana/dskit/log/logrus.go similarity index 86% rename from vendor/github.com/weaveworks/common/logging/logrus.go rename to vendor/github.com/grafana/dskit/log/logrus.go index d302613f7b61e..df0e1ae07e8b8 100644 --- a/vendor/github.com/weaveworks/common/logging/logrus.go +++ b/vendor/github.com/grafana/dskit/log/logrus.go @@ -1,4 +1,8 @@ -package logging +// Provenance-includes-location: https://github.com/weaveworks/common/blob/main/logging/logrus.go +// Provenance-includes-license: Apache-2.0 +// Provenance-includes-copyright: Weaveworks Ltd. + +package log import ( "os" diff --git a/vendor/github.com/grafana/dskit/log/noop.go b/vendor/github.com/grafana/dskit/log/noop.go new file mode 100644 index 0000000000000..89d437468d520 --- /dev/null +++ b/vendor/github.com/grafana/dskit/log/noop.go @@ -0,0 +1,27 @@ +// Provenance-includes-location: https://github.com/weaveworks/common/blob/main/logging/noop.go +// Provenance-includes-license: Apache-2.0 +// Provenance-includes-copyright: Weaveworks Ltd. + +package log + +// Noop logger. +func Noop() Interface { + return noop{} +} + +type noop struct{} + +func (noop) Debugf(string, ...interface{}) {} +func (noop) Debugln(...interface{}) {} +func (noop) Infof(string, ...interface{}) {} +func (noop) Infoln(...interface{}) {} +func (noop) Warnf(string, ...interface{}) {} +func (noop) Warnln(...interface{}) {} +func (noop) Errorf(string, ...interface{}) {} +func (noop) Errorln(...interface{}) {} +func (noop) WithField(string, interface{}) Interface { + return noop{} +} +func (noop) WithFields(Fields) Interface { + return noop{} +} diff --git a/vendor/github.com/weaveworks/common/middleware/counting_listener.go b/vendor/github.com/grafana/dskit/middleware/counting_listener.go similarity index 82% rename from vendor/github.com/weaveworks/common/middleware/counting_listener.go rename to vendor/github.com/grafana/dskit/middleware/counting_listener.go index 1e8526288dae2..961f71a5125cf 100644 --- a/vendor/github.com/weaveworks/common/middleware/counting_listener.go +++ b/vendor/github.com/grafana/dskit/middleware/counting_listener.go @@ -1,3 +1,7 @@ +// Provenance-includes-location: https://github.com/weaveworks/common/blob/main/middleware/counting_listener.go +// Provenance-includes-license: Apache-2.0 +// Provenance-includes-copyright: Weaveworks Ltd. + package middleware import ( diff --git a/vendor/github.com/weaveworks/common/middleware/errorhandler.go b/vendor/github.com/grafana/dskit/middleware/errorhandler.go similarity index 92% rename from vendor/github.com/weaveworks/common/middleware/errorhandler.go rename to vendor/github.com/grafana/dskit/middleware/errorhandler.go index ab2354fa163ce..4a48c90c9ca13 100644 --- a/vendor/github.com/weaveworks/common/middleware/errorhandler.go +++ b/vendor/github.com/grafana/dskit/middleware/errorhandler.go @@ -1,3 +1,7 @@ +// Provenance-includes-location: https://github.com/weaveworks/common/blob/main/middleware/errorhandler.go +// Provenance-includes-license: Apache-2.0 +// Provenance-includes-copyright: Weaveworks Ltd. + package middleware import ( diff --git a/vendor/github.com/weaveworks/common/middleware/grpc_auth.go b/vendor/github.com/grafana/dskit/middleware/grpc_auth.go similarity index 85% rename from vendor/github.com/weaveworks/common/middleware/grpc_auth.go rename to vendor/github.com/grafana/dskit/middleware/grpc_auth.go index 10be1f8d706a1..156ddaf10a1dc 100644 --- a/vendor/github.com/weaveworks/common/middleware/grpc_auth.go +++ b/vendor/github.com/grafana/dskit/middleware/grpc_auth.go @@ -1,10 +1,15 @@ +// Provenance-includes-location: https://github.com/weaveworks/common/blob/main/middleware/grpc_auth.go +// Provenance-includes-license: Apache-2.0 +// Provenance-includes-copyright: Weaveworks Ltd. + package middleware import ( - "golang.org/x/net/context" + "context" + "google.golang.org/grpc" - "github.com/weaveworks/common/user" + "github.com/grafana/dskit/user" ) // ClientUserHeaderInterceptor propagates the user ID from the context to gRPC metadata, which eventually ends up as a HTTP2 header. @@ -29,7 +34,7 @@ func StreamClientUserHeaderInterceptor(ctx context.Context, desc *grpc.StreamDes } // ServerUserHeaderInterceptor propagates the user ID from the gRPC metadata back to our context. -func ServerUserHeaderInterceptor(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (interface{}, error) { +func ServerUserHeaderInterceptor(ctx context.Context, req interface{}, _ *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (interface{}, error) { _, ctx, err := user.ExtractFromGRPCRequest(ctx) if err != nil { return nil, err diff --git a/vendor/github.com/weaveworks/common/middleware/grpc_instrumentation.go b/vendor/github.com/grafana/dskit/middleware/grpc_instrumentation.go similarity index 92% rename from vendor/github.com/weaveworks/common/middleware/grpc_instrumentation.go rename to vendor/github.com/grafana/dskit/middleware/grpc_instrumentation.go index 90c955f1e82dc..4a0899c25f9ae 100644 --- a/vendor/github.com/weaveworks/common/middleware/grpc_instrumentation.go +++ b/vendor/github.com/grafana/dskit/middleware/grpc_instrumentation.go @@ -1,3 +1,7 @@ +// Provenance-includes-location: https://github.com/weaveworks/common/blob/main/middleware/grpc_instrumentation.go +// Provenance-includes-license: Apache-2.0 +// Provenance-includes-copyright: Weaveworks Ltd. + package middleware import ( @@ -7,11 +11,12 @@ import ( "time" "github.com/prometheus/client_golang/prometheus" - grpcUtils "github.com/weaveworks/common/grpc" - "github.com/weaveworks/common/httpgrpc" - "github.com/weaveworks/common/instrument" "google.golang.org/grpc" "google.golang.org/grpc/metadata" + + grpcUtils "github.com/grafana/dskit/grpcutil" + "github.com/grafana/dskit/httpgrpc" + "github.com/grafana/dskit/instrument" ) func observe(ctx context.Context, hist *prometheus.HistogramVec, method string, err error, duration time.Duration) { diff --git a/vendor/github.com/weaveworks/common/middleware/grpc_logging.go b/vendor/github.com/grafana/dskit/middleware/grpc_logging.go similarity index 63% rename from vendor/github.com/weaveworks/common/middleware/grpc_logging.go rename to vendor/github.com/grafana/dskit/middleware/grpc_logging.go index 59994413cd8c8..bb9c99571e95f 100644 --- a/vendor/github.com/weaveworks/common/middleware/grpc_logging.go +++ b/vendor/github.com/grafana/dskit/middleware/grpc_logging.go @@ -1,14 +1,19 @@ +// Provenance-includes-location: https://github.com/weaveworks/common/blob/main/middleware/grpc_logging.go +// Provenance-includes-license: Apache-2.0 +// Provenance-includes-copyright: Weaveworks Ltd. + package middleware import ( + "context" + "errors" "time" - "golang.org/x/net/context" "google.golang.org/grpc" - grpcUtils "github.com/weaveworks/common/grpc" - "github.com/weaveworks/common/logging" - "github.com/weaveworks/common/user" + grpcUtils "github.com/grafana/dskit/grpcutil" + "github.com/grafana/dskit/log" + "github.com/grafana/dskit/user" ) const ( @@ -16,9 +21,14 @@ const ( errorKey = "err" ) +// An error can implement ShouldLog() to control whether GRPCServerLog will log. +type OptionalLogging interface { + ShouldLog(ctx context.Context, duration time.Duration) bool +} + // GRPCServerLog logs grpc requests, errors, and latency. type GRPCServerLog struct { - Log logging.Interface + Log log.Interface // WithRequest will log the entire request rather than just the error WithRequest bool DisableRequestSuccessLog bool @@ -31,8 +41,12 @@ func (s GRPCServerLog) UnaryServerInterceptor(ctx context.Context, req interface if err == nil && s.DisableRequestSuccessLog { return resp, nil } + var optional OptionalLogging + if errors.As(err, &optional) && !optional.ShouldLog(ctx, time.Since(begin)) { + return resp, err + } - entry := user.LogWith(ctx, s.Log).WithFields(logging.Fields{"method": info.FullMethod, "duration": time.Since(begin)}) + entry := user.LogWith(ctx, s.Log).WithFields(log.Fields{"method": info.FullMethod, "duration": time.Since(begin)}) if err != nil { if s.WithRequest { entry = entry.WithField("request", req) @@ -56,7 +70,7 @@ func (s GRPCServerLog) StreamServerInterceptor(srv interface{}, ss grpc.ServerSt return nil } - entry := user.LogWith(ss.Context(), s.Log).WithFields(logging.Fields{"method": info.FullMethod, "duration": time.Since(begin)}) + entry := user.LogWith(ss.Context(), s.Log).WithFields(log.Fields{"method": info.FullMethod, "duration": time.Since(begin)}) if err != nil { if grpcUtils.IsCanceled(err) { entry.WithField(errorKey, err).Debugln(gRPC) diff --git a/vendor/github.com/weaveworks/common/middleware/grpc_stats.go b/vendor/github.com/grafana/dskit/middleware/grpc_stats.go similarity index 91% rename from vendor/github.com/weaveworks/common/middleware/grpc_stats.go rename to vendor/github.com/grafana/dskit/middleware/grpc_stats.go index 6c2581c4c2fd2..3d29d9baabbe1 100644 --- a/vendor/github.com/weaveworks/common/middleware/grpc_stats.go +++ b/vendor/github.com/grafana/dskit/middleware/grpc_stats.go @@ -1,3 +1,7 @@ +// Provenance-includes-location: https://github.com/weaveworks/common/blob/main/middleware/grpc_stats.go +// Provenance-includes-license: Apache-2.0 +// Provenance-includes-copyright: Weaveworks Ltd. + package middleware import ( diff --git a/vendor/github.com/weaveworks/common/middleware/header_adder.go b/vendor/github.com/grafana/dskit/middleware/header_adder.go similarity index 71% rename from vendor/github.com/weaveworks/common/middleware/header_adder.go rename to vendor/github.com/grafana/dskit/middleware/header_adder.go index ce7f07df5787b..ffd5cc8db0c94 100644 --- a/vendor/github.com/weaveworks/common/middleware/header_adder.go +++ b/vendor/github.com/grafana/dskit/middleware/header_adder.go @@ -1,3 +1,7 @@ +// Provenance-includes-location: https://github.com/weaveworks/common/blob/main/middleware/header_adder.go +// Provenance-includes-license: Apache-2.0 +// Provenance-includes-copyright: Weaveworks Ltd. + package middleware import ( diff --git a/vendor/github.com/weaveworks/common/middleware/http_auth.go b/vendor/github.com/grafana/dskit/middleware/http_auth.go similarity index 66% rename from vendor/github.com/weaveworks/common/middleware/http_auth.go rename to vendor/github.com/grafana/dskit/middleware/http_auth.go index 704d1dab4e270..2b576a929b1ec 100644 --- a/vendor/github.com/weaveworks/common/middleware/http_auth.go +++ b/vendor/github.com/grafana/dskit/middleware/http_auth.go @@ -1,9 +1,13 @@ +// Provenance-includes-location: https://github.com/weaveworks/common/blob/main/middleware/http_auth.go +// Provenance-includes-license: Apache-2.0 +// Provenance-includes-copyright: Weaveworks Ltd. + package middleware import ( "net/http" - "github.com/weaveworks/common/user" + "github.com/grafana/dskit/user" ) // AuthenticateUser propagates the user ID from HTTP headers back to the request's context. diff --git a/vendor/github.com/weaveworks/common/middleware/http_tracing.go b/vendor/github.com/grafana/dskit/middleware/http_tracing.go similarity index 86% rename from vendor/github.com/weaveworks/common/middleware/http_tracing.go rename to vendor/github.com/grafana/dskit/middleware/http_tracing.go index 7b55557677e2e..e36bf436df18e 100644 --- a/vendor/github.com/weaveworks/common/middleware/http_tracing.go +++ b/vendor/github.com/grafana/dskit/middleware/http_tracing.go @@ -1,3 +1,7 @@ +// Provenance-includes-location: https://github.com/weaveworks/common/blob/main/middleware/http_tracing.go +// Provenance-includes-license: Apache-2.0 +// Provenance-includes-copyright: Weaveworks Ltd. + package middleware import ( diff --git a/vendor/github.com/weaveworks/common/middleware/instrument.go b/vendor/github.com/grafana/dskit/middleware/instrument.go similarity index 87% rename from vendor/github.com/weaveworks/common/middleware/instrument.go rename to vendor/github.com/grafana/dskit/middleware/instrument.go index ac1f76f007c5c..e5ae9c53c98c3 100644 --- a/vendor/github.com/weaveworks/common/middleware/instrument.go +++ b/vendor/github.com/grafana/dskit/middleware/instrument.go @@ -1,3 +1,7 @@ +// Provenance-includes-location: https://github.com/weaveworks/common/blob/main/middleware/instrument.go +// Provenance-includes-license: Apache-2.0 +// Provenance-includes-copyright: Weaveworks Ltd. + package middleware import ( @@ -11,7 +15,7 @@ import ( "github.com/gorilla/mux" "github.com/prometheus/client_golang/prometheus" - "github.com/weaveworks/common/instrument" + "github.com/grafana/dskit/instrument" ) const mb = 1024 * 1024 @@ -78,11 +82,12 @@ func (i Instrument) Wrap(next http.Handler) http.Handler { } // Return a name identifier for ths request. There are three options: -// 1. The request matches a gorilla mux route, with a name. Use that. -// 2. The request matches an unamed gorilla mux router. Munge the path -// template such that templates like '/api/{org}/foo' come out as -// 'api_org_foo'. -// 3. The request doesn't match a mux route. Return "other" +// 1. The request matches a gorilla mux route, with a name. Use that. +// 2. The request matches an unamed gorilla mux router. Munge the path +// template such that templates like '/api/{org}/foo' come out as +// 'api_org_foo'. +// 3. The request doesn't match a mux route. Return "other" +// // We do all this as we do not wish to emit high cardinality labels to // prometheus. func (i Instrument) getRouteName(r *http.Request) string { diff --git a/vendor/github.com/weaveworks/common/middleware/logging.go b/vendor/github.com/grafana/dskit/middleware/logging.go similarity index 69% rename from vendor/github.com/weaveworks/common/middleware/logging.go rename to vendor/github.com/grafana/dskit/middleware/logging.go index eb07466e7c757..ca13f330ed232 100644 --- a/vendor/github.com/weaveworks/common/middleware/logging.go +++ b/vendor/github.com/grafana/dskit/middleware/logging.go @@ -1,3 +1,7 @@ +// Provenance-includes-location: https://github.com/weaveworks/common/blob/main/middleware/logging.go +// Provenance-includes-license: Apache-2.0 +// Provenance-includes-copyright: Weaveworks Ltd. + package middleware import ( @@ -7,18 +11,19 @@ import ( "net/http" "time" - "github.com/weaveworks/common/logging" - "github.com/weaveworks/common/tracing" - "github.com/weaveworks/common/user" + "github.com/grafana/dskit/log" + "github.com/grafana/dskit/tracing" + "github.com/grafana/dskit/user" ) // Log middleware logs http requests type Log struct { - Log logging.Interface - LogRequestHeaders bool // LogRequestHeaders true -> dump http headers at debug log level - LogRequestAtInfoLevel bool // LogRequestAtInfoLevel true -> log requests at info log level - SourceIPs *SourceIPExtractor - HttpHeadersToExclude map[string]bool + Log log.Interface + DisableRequestSuccessLog bool + LogRequestHeaders bool // LogRequestHeaders true -> dump http headers at debug log level + LogRequestAtInfoLevel bool // LogRequestAtInfoLevel true -> log requests at info log level + SourceIPs *SourceIPExtractor + HTTPHeadersToExclude map[string]bool } var defaultExcludedHeaders = map[string]bool{ @@ -27,7 +32,7 @@ var defaultExcludedHeaders = map[string]bool{ "Authorization": true, } -func NewLogMiddleware(log logging.Interface, logRequestHeaders bool, logRequestAtInfoLevel bool, sourceIPs *SourceIPExtractor, headersList []string) Log { +func NewLogMiddleware(log log.Interface, logRequestHeaders bool, logRequestAtInfoLevel bool, sourceIPs *SourceIPExtractor, headersList []string) Log { httpHeadersToExclude := map[string]bool{} for header := range defaultExcludedHeaders { httpHeadersToExclude[header] = true @@ -41,12 +46,12 @@ func NewLogMiddleware(log logging.Interface, logRequestHeaders bool, logRequestA LogRequestHeaders: logRequestHeaders, LogRequestAtInfoLevel: logRequestAtInfoLevel, SourceIPs: sourceIPs, - HttpHeadersToExclude: httpHeadersToExclude, + HTTPHeadersToExclude: httpHeadersToExclude, } } // logWithRequest information from the request and context as fields. -func (l Log) logWithRequest(r *http.Request) logging.Interface { +func (l Log) logWithRequest(r *http.Request) log.Interface { localLog := l.Log traceID, ok := tracing.ExtractTraceID(r.Context()) if ok { @@ -70,7 +75,7 @@ func (l Log) Wrap(next http.Handler) http.Handler { uri := r.RequestURI // capture the URI before running next, as it may get rewritten requestLog := l.logWithRequest(r) // Log headers before running 'next' in case other interceptors change the data. - headers, err := dumpRequest(r, l.HttpHeadersToExclude) + headers, err := dumpRequest(r, l.HTTPHeadersToExclude) if err != nil { headers = nil requestLog.Errorf("Could not dump request headers: %v", err) @@ -94,20 +99,27 @@ func (l Log) Wrap(next http.Handler) http.Handler { return } - if 100 <= statusCode && statusCode < 500 || statusCode == http.StatusBadGateway || statusCode == http.StatusServiceUnavailable { + + switch { + // success and shouldn't log successful requests. + case statusCode >= 200 && statusCode < 300 && l.DisableRequestSuccessLog: + return + + case 100 <= statusCode && statusCode < 500 || statusCode == http.StatusBadGateway || statusCode == http.StatusServiceUnavailable: if l.LogRequestAtInfoLevel { requestLog.Infof("%s %s (%d) %s", r.Method, uri, statusCode, time.Since(begin)) - } else { - requestLog.Debugf("%s %s (%d) %s", r.Method, uri, statusCode, time.Since(begin)) - } - if l.LogRequestHeaders && headers != nil { - if l.LogRequestAtInfoLevel { + + if l.LogRequestHeaders && headers != nil { requestLog.Infof("ws: %v; %s", IsWSHandshakeRequest(r), string(headers)) - } else { - requestLog.Debugf("ws: %v; %s", IsWSHandshakeRequest(r), string(headers)) } + return + } + + requestLog.Debugf("%s %s (%d) %s", r.Method, uri, statusCode, time.Since(begin)) + if l.LogRequestHeaders && headers != nil { + requestLog.Debugf("ws: %v; %s", IsWSHandshakeRequest(r), string(headers)) } - } else { + default: requestLog.Warnf("%s %s (%d) %s Response: %q ws: %v; %s", r.Method, uri, statusCode, time.Since(begin), buf.Bytes(), IsWSHandshakeRequest(r), headers) } @@ -117,7 +129,7 @@ func (l Log) Wrap(next http.Handler) http.Handler { // Logging middleware logs each HTTP request method, path, response code and // duration for all HTTP requests. var Logging = Log{ - Log: logging.Global(), + Log: log.Global(), } func dumpRequest(req *http.Request, httpHeadersToExclude map[string]bool) ([]byte, error) { diff --git a/vendor/github.com/weaveworks/common/middleware/middleware.go b/vendor/github.com/grafana/dskit/middleware/middleware.go similarity index 81% rename from vendor/github.com/weaveworks/common/middleware/middleware.go rename to vendor/github.com/grafana/dskit/middleware/middleware.go index ad8925ac86867..79720b333f223 100644 --- a/vendor/github.com/weaveworks/common/middleware/middleware.go +++ b/vendor/github.com/grafana/dskit/middleware/middleware.go @@ -1,3 +1,7 @@ +// Provenance-includes-location: https://github.com/weaveworks/common/blob/main/middleware/middleware.go +// Provenance-includes-license: Apache-2.0 +// Provenance-includes-copyright: Weaveworks Ltd. + package middleware import ( diff --git a/vendor/github.com/weaveworks/common/middleware/path_rewrite.go b/vendor/github.com/grafana/dskit/middleware/path_rewrite.go similarity index 87% rename from vendor/github.com/weaveworks/common/middleware/path_rewrite.go rename to vendor/github.com/grafana/dskit/middleware/path_rewrite.go index 8250201a88ceb..c9e917a72b756 100644 --- a/vendor/github.com/weaveworks/common/middleware/path_rewrite.go +++ b/vendor/github.com/grafana/dskit/middleware/path_rewrite.go @@ -1,3 +1,7 @@ +// Provenance-includes-location: https://github.com/weaveworks/common/blob/main/middleware/path_rewrite.go +// Provenance-includes-license: Apache-2.0 +// Provenance-includes-copyright: Weaveworks Ltd. + package middleware import ( diff --git a/vendor/github.com/weaveworks/common/middleware/response.go b/vendor/github.com/grafana/dskit/middleware/response.go similarity index 90% rename from vendor/github.com/weaveworks/common/middleware/response.go rename to vendor/github.com/grafana/dskit/middleware/response.go index 2655003c88fc2..e2ce1d0a7eea2 100644 --- a/vendor/github.com/weaveworks/common/middleware/response.go +++ b/vendor/github.com/grafana/dskit/middleware/response.go @@ -1,3 +1,7 @@ +// Provenance-includes-location: https://github.com/weaveworks/common/blob/main/middleware/response.go +// Provenance-includes-license: Apache-2.0 +// Provenance-includes-copyright: Weaveworks Ltd. + package middleware import ( @@ -108,12 +112,12 @@ func (b *nonFlushingBadResponseLoggingWriter) getWriteError() error { func (b *nonFlushingBadResponseLoggingWriter) captureResponseBody(data []byte) { if len(data) > b.bodyBytesLeft { - b.buffer.Write(data[:b.bodyBytesLeft]) - io.WriteString(b.buffer, "...") + _, _ = b.buffer.Write(data[:b.bodyBytesLeft]) + _, _ = io.WriteString(b.buffer, "...") b.bodyBytesLeft = 0 b.logBody = false } else { - b.buffer.Write(data) + _, _ = b.buffer.Write(data) b.bodyBytesLeft -= len(data) } } diff --git a/vendor/github.com/weaveworks/common/middleware/source_ips.go b/vendor/github.com/grafana/dskit/middleware/source_ips.go similarity index 95% rename from vendor/github.com/weaveworks/common/middleware/source_ips.go rename to vendor/github.com/grafana/dskit/middleware/source_ips.go index 17178d427dd93..7c035ddbf47e6 100644 --- a/vendor/github.com/weaveworks/common/middleware/source_ips.go +++ b/vendor/github.com/grafana/dskit/middleware/source_ips.go @@ -1,3 +1,7 @@ +// Provenance-includes-location: https://github.com/weaveworks/common/blob/main/middleware/source_ips.go +// Provenance-includes-license: Apache-2.0 +// Provenance-includes-copyright: Weaveworks Ltd. + package middleware import ( diff --git a/vendor/github.com/weaveworks/common/mtime/mtime.go b/vendor/github.com/grafana/dskit/mtime/mtime.go similarity index 64% rename from vendor/github.com/weaveworks/common/mtime/mtime.go rename to vendor/github.com/grafana/dskit/mtime/mtime.go index dd1fc87ca045d..2b490f0a8c178 100644 --- a/vendor/github.com/weaveworks/common/mtime/mtime.go +++ b/vendor/github.com/grafana/dskit/mtime/mtime.go @@ -1,3 +1,7 @@ +// Provenance-includes-location: https://github.com/weaveworks/common/blob/main/mtime/mtime.go +// Provenance-includes-license: Apache-2.0 +// Provenance-includes-copyright: Weaveworks Ltd. + package mtime import "time" diff --git a/vendor/github.com/grafana/dskit/ring/client/pool.go b/vendor/github.com/grafana/dskit/ring/client/pool.go index ee9d06b6b3949..5e21e69c3397a 100644 --- a/vendor/github.com/grafana/dskit/ring/client/pool.go +++ b/vendor/github.com/grafana/dskit/ring/client/pool.go @@ -10,12 +10,12 @@ import ( "github.com/go-kit/log" "github.com/go-kit/log/level" "github.com/prometheus/client_golang/prometheus" - "github.com/weaveworks/common/user" "google.golang.org/grpc/health/grpc_health_v1" "github.com/grafana/dskit/concurrency" "github.com/grafana/dskit/internal/slices" "github.com/grafana/dskit/services" + "github.com/grafana/dskit/user" ) // PoolClient is the interface that should be implemented by a diff --git a/vendor/github.com/weaveworks/common/server/fake_server.pb.go b/vendor/github.com/grafana/dskit/server/fake_server.pb.go similarity index 53% rename from vendor/github.com/weaveworks/common/server/fake_server.pb.go rename to vendor/github.com/grafana/dskit/server/fake_server.pb.go index 4fafbb2f32dc7..75ee6b0a14e3e 100644 --- a/vendor/github.com/weaveworks/common/server/fake_server.pb.go +++ b/vendor/github.com/grafana/dskit/server/fake_server.pb.go @@ -1,17 +1,21 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// source: server/fake_server.proto +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: fake_server.proto package server import ( context "context" fmt "fmt" - proto "github.com/golang/protobuf/proto" + proto "github.com/gogo/protobuf/proto" empty "github.com/golang/protobuf/ptypes/empty" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" + io "io" math "math" + math_bits "math/bits" + reflect "reflect" + strings "strings" ) // Reference imports to suppress errors if they are not otherwise used. @@ -23,33 +27,37 @@ var _ = math.Inf // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the // proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package type FailWithHTTPErrorRequest struct { - Code int32 `protobuf:"varint,1,opt,name=Code,proto3" json:"Code,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Code int32 `protobuf:"varint,1,opt,name=Code,proto3" json:"Code,omitempty"` } -func (m *FailWithHTTPErrorRequest) Reset() { *m = FailWithHTTPErrorRequest{} } -func (m *FailWithHTTPErrorRequest) String() string { return proto.CompactTextString(m) } -func (*FailWithHTTPErrorRequest) ProtoMessage() {} +func (m *FailWithHTTPErrorRequest) Reset() { *m = FailWithHTTPErrorRequest{} } +func (*FailWithHTTPErrorRequest) ProtoMessage() {} func (*FailWithHTTPErrorRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_2267b95bf2c64cdc, []int{0} + return fileDescriptor_a932e7b7b9f5c118, []int{0} } - func (m *FailWithHTTPErrorRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_FailWithHTTPErrorRequest.Unmarshal(m, b) + return m.Unmarshal(b) } func (m *FailWithHTTPErrorRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_FailWithHTTPErrorRequest.Marshal(b, m, deterministic) + if deterministic { + return xxx_messageInfo_FailWithHTTPErrorRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } } func (m *FailWithHTTPErrorRequest) XXX_Merge(src proto.Message) { xxx_messageInfo_FailWithHTTPErrorRequest.Merge(m, src) } func (m *FailWithHTTPErrorRequest) XXX_Size() int { - return xxx_messageInfo_FailWithHTTPErrorRequest.Size(m) + return m.Size() } func (m *FailWithHTTPErrorRequest) XXX_DiscardUnknown() { xxx_messageInfo_FailWithHTTPErrorRequest.DiscardUnknown(m) @@ -68,26 +76,70 @@ func init() { proto.RegisterType((*FailWithHTTPErrorRequest)(nil), "server.FailWithHTTPErrorRequest") } -func init() { proto.RegisterFile("server/fake_server.proto", fileDescriptor_2267b95bf2c64cdc) } - -var fileDescriptor_2267b95bf2c64cdc = []byte{ - // 246 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x28, 0x4e, 0x2d, 0x2a, - 0x4b, 0x2d, 0xd2, 0x4f, 0x4b, 0xcc, 0x4e, 0x8d, 0x87, 0xb0, 0xf5, 0x0a, 0x8a, 0xf2, 0x4b, 0xf2, - 0x85, 0xd8, 0x20, 0x3c, 0x29, 0xe9, 0xf4, 0xfc, 0xfc, 0xf4, 0x9c, 0x54, 0x7d, 0xb0, 0x68, 0x52, - 0x69, 0x9a, 0x7e, 0x6a, 0x6e, 0x41, 0x49, 0x25, 0x44, 0x91, 0x92, 0x1e, 0x97, 0x84, 0x5b, 0x62, - 0x66, 0x4e, 0x78, 0x66, 0x49, 0x86, 0x47, 0x48, 0x48, 0x80, 0x6b, 0x51, 0x51, 0x7e, 0x51, 0x50, - 0x6a, 0x61, 0x69, 0x6a, 0x71, 0x89, 0x90, 0x10, 0x17, 0x8b, 0x73, 0x7e, 0x4a, 0xaa, 0x04, 0xa3, - 0x02, 0xa3, 0x06, 0x6b, 0x10, 0x98, 0x6d, 0x74, 0x9b, 0x89, 0x8b, 0xcb, 0x2d, 0x31, 0x3b, 0x35, - 0x18, 0x6c, 0xb6, 0x90, 0x35, 0x17, 0x7b, 0x70, 0x69, 0x72, 0x72, 0x6a, 0x6a, 0x8a, 0x90, 0x98, - 0x1e, 0xc4, 0x1e, 0x3d, 0x98, 0x3d, 0x7a, 0xae, 0x20, 0x7b, 0xa4, 0x70, 0x88, 0x2b, 0x31, 0x08, - 0x39, 0x72, 0xf1, 0xc2, 0xec, 0x06, 0xdb, 0x4b, 0x86, 0x11, 0xfe, 0x5c, 0x82, 0x18, 0xce, 0x17, - 0x52, 0xd0, 0x83, 0x86, 0x03, 0x2e, 0x9f, 0xe1, 0x31, 0xd0, 0x92, 0x8b, 0x35, 0x38, 0x27, 0x35, - 0xb5, 0x80, 0x2c, 0xef, 0x70, 0x07, 0x97, 0x14, 0xa5, 0x26, 0xe6, 0x92, 0x69, 0x80, 0x01, 0xa3, - 0x93, 0x6a, 0x94, 0x72, 0x7a, 0x66, 0x49, 0x46, 0x69, 0x92, 0x5e, 0x72, 0x7e, 0xae, 0x7e, 0x79, - 0x6a, 0x62, 0x59, 0x6a, 0x79, 0x7e, 0x51, 0x76, 0xb1, 0x7e, 0x72, 0x7e, 0x6e, 0x6e, 0x7e, 0x9e, - 0x3e, 0xc4, 0x5f, 0x49, 0x6c, 0x60, 0xad, 0xc6, 0x80, 0x00, 0x00, 0x00, 0xff, 0xff, 0xf9, 0xcd, - 0xa4, 0xf9, 0xfc, 0x01, 0x00, 0x00, +func init() { proto.RegisterFile("fake_server.proto", fileDescriptor_a932e7b7b9f5c118) } + +var fileDescriptor_a932e7b7b9f5c118 = []byte{ + // 265 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x4c, 0x4b, 0xcc, 0x4e, + 0x8d, 0x2f, 0x4e, 0x2d, 0x2a, 0x4b, 0x2d, 0xd2, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x62, 0x83, + 0xf0, 0xa4, 0xa4, 0xd3, 0xf3, 0xf3, 0xd3, 0x73, 0x52, 0xf5, 0xc1, 0xa2, 0x49, 0xa5, 0x69, 0xfa, + 0xa9, 0xb9, 0x05, 0x25, 0x95, 0x10, 0x45, 0x4a, 0x7a, 0x5c, 0x12, 0x6e, 0x89, 0x99, 0x39, 0xe1, + 0x99, 0x25, 0x19, 0x1e, 0x21, 0x21, 0x01, 0xae, 0x45, 0x45, 0xf9, 0x45, 0x41, 0xa9, 0x85, 0xa5, + 0xa9, 0xc5, 0x25, 0x42, 0x42, 0x5c, 0x2c, 0xce, 0xf9, 0x29, 0xa9, 0x12, 0x8c, 0x0a, 0x8c, 0x1a, + 0xac, 0x41, 0x60, 0xb6, 0xd1, 0x6d, 0x26, 0x2e, 0x2e, 0xb7, 0xc4, 0xec, 0xd4, 0x60, 0xb0, 0xd9, + 0x42, 0xd6, 0x5c, 0xec, 0xc1, 0xa5, 0xc9, 0xc9, 0xa9, 0xa9, 0x29, 0x42, 0x62, 0x7a, 0x10, 0x7b, + 0xf4, 0x60, 0xf6, 0xe8, 0xb9, 0x82, 0xec, 0x91, 0xc2, 0x21, 0xae, 0xc4, 0x20, 0xe4, 0xc8, 0xc5, + 0x0b, 0xb3, 0x1b, 0x6c, 0x2f, 0x19, 0x46, 0xf8, 0x73, 0x09, 0x62, 0x38, 0x5f, 0x48, 0x41, 0x0f, + 0x1a, 0x0e, 0xb8, 0x7c, 0x86, 0xc7, 0x40, 0x4b, 0x2e, 0xd6, 0xe0, 0x9c, 0xd4, 0xd4, 0x02, 0xb2, + 0xbc, 0xc3, 0x1d, 0x5c, 0x52, 0x94, 0x9a, 0x98, 0x4b, 0xa6, 0x01, 0x06, 0x8c, 0x4e, 0x26, 0x17, + 0x1e, 0xca, 0x31, 0xdc, 0x78, 0x28, 0xc7, 0xf0, 0xe1, 0xa1, 0x1c, 0x63, 0xc3, 0x23, 0x39, 0xc6, + 0x15, 0x8f, 0xe4, 0x18, 0x4f, 0x3c, 0x92, 0x63, 0xbc, 0xf0, 0x48, 0x8e, 0xf1, 0xc1, 0x23, 0x39, + 0xc6, 0x17, 0x8f, 0xe4, 0x18, 0x3e, 0x3c, 0x92, 0x63, 0x9c, 0xf0, 0x58, 0x8e, 0xe1, 0xc2, 0x63, + 0x39, 0x86, 0x1b, 0x8f, 0xe5, 0x18, 0x92, 0xd8, 0xc0, 0x26, 0x19, 0x03, 0x02, 0x00, 0x00, 0xff, + 0xff, 0x43, 0x2b, 0x71, 0x6d, 0x04, 0x02, 0x00, 0x00, +} + +func (this *FailWithHTTPErrorRequest) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*FailWithHTTPErrorRequest) + if !ok { + that2, ok := that.(FailWithHTTPErrorRequest) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.Code != that1.Code { + return false + } + return true +} +func (this *FailWithHTTPErrorRequest) GoString() string { + if this == nil { + return "nil" + } + s := make([]string, 0, 5) + s = append(s, "&server.FailWithHTTPErrorRequest{") + s = append(s, "Code: "+fmt.Sprintf("%#v", this.Code)+",\n") + s = append(s, "}") + return strings.Join(s, "") +} +func valueToGoStringFakeServer(v interface{}, typ string) string { + rv := reflect.ValueOf(v) + if rv.IsNil() { + return "nil" + } + pv := reflect.Indirect(rv).Interface() + return fmt.Sprintf("func(v %v) *%v { return &v } ( %#v )", typ, typ, pv) } // Reference imports to suppress errors if they are not otherwise used. @@ -339,5 +391,263 @@ var _FakeServer_serviceDesc = grpc.ServiceDesc{ ServerStreams: true, }, }, - Metadata: "server/fake_server.proto", + Metadata: "fake_server.proto", +} + +func (m *FailWithHTTPErrorRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *FailWithHTTPErrorRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *FailWithHTTPErrorRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Code != 0 { + i = encodeVarintFakeServer(dAtA, i, uint64(m.Code)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func encodeVarintFakeServer(dAtA []byte, offset int, v uint64) int { + offset -= sovFakeServer(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *FailWithHTTPErrorRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Code != 0 { + n += 1 + sovFakeServer(uint64(m.Code)) + } + return n +} + +func sovFakeServer(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozFakeServer(x uint64) (n int) { + return sovFakeServer(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } +func (this *FailWithHTTPErrorRequest) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&FailWithHTTPErrorRequest{`, + `Code:` + fmt.Sprintf("%v", this.Code) + `,`, + `}`, + }, "") + return s +} +func valueToStringFakeServer(v interface{}) string { + rv := reflect.ValueOf(v) + if rv.IsNil() { + return "nil" + } + pv := reflect.Indirect(rv).Interface() + return fmt.Sprintf("*%v", pv) +} +func (m *FailWithHTTPErrorRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFakeServer + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: FailWithHTTPErrorRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: FailWithHTTPErrorRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Code", wireType) + } + m.Code = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFakeServer + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Code |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipFakeServer(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthFakeServer + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthFakeServer + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipFakeServer(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowFakeServer + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowFakeServer + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + return iNdEx, nil + case 1: + iNdEx += 8 + return iNdEx, nil + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowFakeServer + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthFakeServer + } + iNdEx += length + if iNdEx < 0 { + return 0, ErrInvalidLengthFakeServer + } + return iNdEx, nil + case 3: + for { + var innerWire uint64 + var start int = iNdEx + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowFakeServer + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + innerWire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + innerWireType := int(innerWire & 0x7) + if innerWireType == 4 { + break + } + next, err := skipFakeServer(dAtA[start:]) + if err != nil { + return 0, err + } + iNdEx = start + next + if iNdEx < 0 { + return 0, ErrInvalidLengthFakeServer + } + } + return iNdEx, nil + case 4: + return iNdEx, nil + case 5: + iNdEx += 4 + return iNdEx, nil + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + } + panic("unreachable") +} + +var ( + ErrInvalidLengthFakeServer = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowFakeServer = fmt.Errorf("proto: integer overflow") +) diff --git a/vendor/github.com/weaveworks/common/server/fake_server.proto b/vendor/github.com/grafana/dskit/server/fake_server.proto similarity index 90% rename from vendor/github.com/weaveworks/common/server/fake_server.proto rename to vendor/github.com/grafana/dskit/server/fake_server.proto index bbf39381af572..248a6f244bdae 100644 --- a/vendor/github.com/weaveworks/common/server/fake_server.proto +++ b/vendor/github.com/grafana/dskit/server/fake_server.proto @@ -2,8 +2,6 @@ syntax = "proto3"; package server; -option go_package = "github.com/weaveworks/common/server"; - import "google/protobuf/empty.proto"; service FakeServer { diff --git a/vendor/github.com/grafana/dskit/server/metrics.go b/vendor/github.com/grafana/dskit/server/metrics.go new file mode 100644 index 0000000000000..aa1c3e53aef93 --- /dev/null +++ b/vendor/github.com/grafana/dskit/server/metrics.go @@ -0,0 +1,67 @@ +// Provenance-includes-location: https://github.com/weaveworks/common/blob/main/server/metrics.go +// Provenance-includes-license: Apache-2.0 +// Provenance-includes-copyright: Weaveworks Ltd. + +package server + +import ( + "time" + + "github.com/prometheus/client_golang/prometheus" + "github.com/prometheus/client_golang/prometheus/promauto" + + "github.com/grafana/dskit/instrument" + "github.com/grafana/dskit/middleware" +) + +type Metrics struct { + TCPConnections *prometheus.GaugeVec + TCPConnectionsLimit *prometheus.GaugeVec + RequestDuration *prometheus.HistogramVec + ReceivedMessageSize *prometheus.HistogramVec + SentMessageSize *prometheus.HistogramVec + InflightRequests *prometheus.GaugeVec +} + +func NewServerMetrics(cfg Config) *Metrics { + reg := promauto.With(cfg.registererOrDefault()) + + return &Metrics{ + TCPConnections: reg.NewGaugeVec(prometheus.GaugeOpts{ + Namespace: cfg.MetricsNamespace, + Name: "tcp_connections", + Help: "Current number of accepted TCP connections.", + }, []string{"protocol"}), + TCPConnectionsLimit: reg.NewGaugeVec(prometheus.GaugeOpts{ + Namespace: cfg.MetricsNamespace, + Name: "tcp_connections_limit", + Help: "The max number of TCP connections that can be accepted (0 means no limit).", + }, []string{"protocol"}), + RequestDuration: reg.NewHistogramVec(prometheus.HistogramOpts{ + Namespace: cfg.MetricsNamespace, + Name: "request_duration_seconds", + Help: "Time (in seconds) spent serving HTTP requests.", + Buckets: instrument.DefBuckets, + NativeHistogramBucketFactor: cfg.MetricsNativeHistogramFactor, + NativeHistogramMaxBucketNumber: 100, + NativeHistogramMinResetDuration: time.Hour, + }, []string{"method", "route", "status_code", "ws"}), + ReceivedMessageSize: reg.NewHistogramVec(prometheus.HistogramOpts{ + Namespace: cfg.MetricsNamespace, + Name: "request_message_bytes", + Help: "Size (in bytes) of messages received in the request.", + Buckets: middleware.BodySizeBuckets, + }, []string{"method", "route"}), + SentMessageSize: reg.NewHistogramVec(prometheus.HistogramOpts{ + Namespace: cfg.MetricsNamespace, + Name: "response_message_bytes", + Help: "Size (in bytes) of messages sent in response.", + Buckets: middleware.BodySizeBuckets, + }, []string{"method", "route"}), + InflightRequests: reg.NewGaugeVec(prometheus.GaugeOpts{ + Namespace: cfg.MetricsNamespace, + Name: "inflight_requests", + Help: "Current number of inflight requests.", + }, []string{"method", "route"}), + } +} diff --git a/vendor/github.com/weaveworks/common/server/server.go b/vendor/github.com/grafana/dskit/server/server.go similarity index 81% rename from vendor/github.com/weaveworks/common/server/server.go rename to vendor/github.com/grafana/dskit/server/server.go index 4026516f5eb01..9275637cf7ec7 100644 --- a/vendor/github.com/weaveworks/common/server/server.go +++ b/vendor/github.com/grafana/dskit/server/server.go @@ -1,6 +1,11 @@ +// Provenance-includes-location: https://github.com/weaveworks/common/blob/main/server/server.go +// Provenance-includes-license: Apache-2.0 +// Provenance-includes-copyright: Weaveworks Ltd. + package server import ( + "context" "crypto/tls" "flag" "fmt" @@ -18,18 +23,16 @@ import ( "github.com/prometheus/client_golang/prometheus/promhttp" "github.com/prometheus/exporter-toolkit/web" "github.com/soheilhy/cmux" - "golang.org/x/net/context" "golang.org/x/net/netutil" "google.golang.org/grpc" "google.golang.org/grpc/credentials" "google.golang.org/grpc/keepalive" - "github.com/weaveworks/common/httpgrpc" - httpgrpc_server "github.com/weaveworks/common/httpgrpc/server" - "github.com/weaveworks/common/instrument" - "github.com/weaveworks/common/logging" - "github.com/weaveworks/common/middleware" - "github.com/weaveworks/common/signals" + "github.com/grafana/dskit/httpgrpc" + httpgrpc_server "github.com/grafana/dskit/httpgrpc/server" + "github.com/grafana/dskit/log" + "github.com/grafana/dskit/middleware" + "github.com/grafana/dskit/signals" ) // Listen on the named network @@ -110,15 +113,15 @@ type Config struct { GRPCServerMinTimeBetweenPings time.Duration `yaml:"grpc_server_min_time_between_pings"` GRPCServerPingWithoutStreamAllowed bool `yaml:"grpc_server_ping_without_stream_allowed"` - LogFormat logging.Format `yaml:"log_format"` - LogLevel logging.Level `yaml:"log_level"` - Log logging.Interface `yaml:"-"` - LogSourceIPs bool `yaml:"log_source_ips_enabled"` - LogSourceIPsHeader string `yaml:"log_source_ips_header"` - LogSourceIPsRegex string `yaml:"log_source_ips_regex"` - LogRequestHeaders bool `yaml:"log_request_headers"` - LogRequestAtInfoLevel bool `yaml:"log_request_at_info_level_enabled"` - LogRequestExcludeHeadersList string `yaml:"log_request_exclude_headers_list"` + LogFormat log.Format `yaml:"log_format"` + LogLevel log.Level `yaml:"log_level"` + Log log.Interface `yaml:"-"` + LogSourceIPs bool `yaml:"log_source_ips_enabled"` + LogSourceIPsHeader string `yaml:"log_source_ips_header"` + LogSourceIPsRegex string `yaml:"log_source_ips_regex"` + LogRequestHeaders bool `yaml:"log_request_headers"` + LogRequestAtInfoLevel bool `yaml:"log_request_at_info_level_enabled"` + LogRequestExcludeHeadersList string `yaml:"log_request_exclude_headers_list"` // If not set, default signal handler is used. SignalHandler SignalHandler `yaml:"-"` @@ -178,6 +181,14 @@ func (cfg *Config) RegisterFlags(f *flag.FlagSet) { f.BoolVar(&cfg.LogRequestAtInfoLevel, "server.log-request-at-info-level-enabled", false, "Optionally log requests at info level instead of debug level. Applies to request headers as well if server.log-request-headers is enabled.") } +func (cfg *Config) registererOrDefault() prometheus.Registerer { + // If user doesn't supply a Registerer/gatherer, use Prometheus' by default. + if cfg.Registerer != nil { + return cfg.Registerer + } + return prometheus.DefaultRegisterer +} + // Server wraps a HTTP and gRPC server, and some common initialization. // // Servers will be automatically instrumented for Prometheus metrics. @@ -197,44 +208,36 @@ type Server struct { HTTP *mux.Router HTTPServer *http.Server GRPC *grpc.Server - Log logging.Interface + Log log.Interface Registerer prometheus.Registerer Gatherer prometheus.Gatherer } -// New makes a new Server +// New makes a new Server. It will panic if the metrics cannot be registered. func New(cfg Config) (*Server, error) { + metrics := NewServerMetrics(cfg) + return newServer(cfg, metrics) +} + +// NewWithMetrics makes a new Server using the provided Metrics. It will not attempt to register the metrics, +// the user is responsible for doing so. +func NewWithMetrics(cfg Config, metrics *Metrics) (*Server, error) { + return newServer(cfg, metrics) +} + +func newServer(cfg Config, metrics *Metrics) (*Server, error) { // If user doesn't supply a logging implementation, by default instantiate // logrus. - log := cfg.Log - if log == nil { - log = logging.NewLogrus(cfg.LogLevel) + logger := cfg.Log + if logger == nil { + logger = log.NewLogrus(cfg.LogLevel) } - // If user doesn't supply a registerer/gatherer, use Prometheus' by default. - reg := cfg.Registerer - if reg == nil { - reg = prometheus.DefaultRegisterer - } gatherer := cfg.Gatherer if gatherer == nil { gatherer = prometheus.DefaultGatherer } - tcpConnections := prometheus.NewGaugeVec(prometheus.GaugeOpts{ - Namespace: cfg.MetricsNamespace, - Name: "tcp_connections", - Help: "Current number of accepted TCP connections.", - }, []string{"protocol"}) - reg.MustRegister(tcpConnections) - - tcpConnectionsLimit := prometheus.NewGaugeVec(prometheus.GaugeOpts{ - Namespace: cfg.MetricsNamespace, - Name: "tcp_connections_limit", - Help: "The max number of TCP connections that can be accepted (0 means no limit).", - }, []string{"protocol"}) - reg.MustRegister(tcpConnectionsLimit) - network := cfg.HTTPListenNetwork if network == "" { network = DefaultNetwork @@ -244,9 +247,9 @@ func New(cfg Config) (*Server, error) { if err != nil { return nil, err } - httpListener = middleware.CountingListener(httpListener, tcpConnections.WithLabelValues("http")) + httpListener = middleware.CountingListener(httpListener, metrics.TCPConnections.WithLabelValues("http")) - tcpConnectionsLimit.WithLabelValues("http").Set(float64(cfg.HTTPConnLimit)) + metrics.TCPConnectionsLimit.WithLabelValues("http").Set(float64(cfg.HTTPConnLimit)) if cfg.HTTPConnLimit > 0 { httpListener = netutil.LimitListener(httpListener, cfg.HTTPConnLimit) } @@ -268,9 +271,9 @@ func New(cfg Config) (*Server, error) { if err != nil { return nil, err } - grpcListener = middleware.CountingListener(grpcListener, tcpConnections.WithLabelValues("grpc")) + grpcListener = middleware.CountingListener(grpcListener, metrics.TCPConnections.WithLabelValues("grpc")) - tcpConnectionsLimit.WithLabelValues("grpc").Set(float64(cfg.GRPCConnLimit)) + metrics.TCPConnectionsLimit.WithLabelValues("grpc").Set(float64(cfg.GRPCConnLimit)) if cfg.GRPCConnLimit > 0 { grpcListener = netutil.LimitListener(grpcListener, cfg.GRPCConnLimit) } @@ -316,60 +319,25 @@ func New(cfg Config) (*Server, error) { } } - // Prometheus histograms for requests. - requestDuration := prometheus.NewHistogramVec(prometheus.HistogramOpts{ - Namespace: cfg.MetricsNamespace, - Name: "request_duration_seconds", - Help: "Time (in seconds) spent serving HTTP requests.", - Buckets: instrument.DefBuckets, - NativeHistogramBucketFactor: cfg.MetricsNativeHistogramFactor, - NativeHistogramMaxBucketNumber: 100, - NativeHistogramMinResetDuration: time.Hour, - }, []string{"method", "route", "status_code", "ws"}) - reg.MustRegister(requestDuration) - - receivedMessageSize := prometheus.NewHistogramVec(prometheus.HistogramOpts{ - Namespace: cfg.MetricsNamespace, - Name: "request_message_bytes", - Help: "Size (in bytes) of messages received in the request.", - Buckets: middleware.BodySizeBuckets, - }, []string{"method", "route"}) - reg.MustRegister(receivedMessageSize) - - sentMessageSize := prometheus.NewHistogramVec(prometheus.HistogramOpts{ - Namespace: cfg.MetricsNamespace, - Name: "response_message_bytes", - Help: "Size (in bytes) of messages sent in response.", - Buckets: middleware.BodySizeBuckets, - }, []string{"method", "route"}) - reg.MustRegister(sentMessageSize) - - inflightRequests := prometheus.NewGaugeVec(prometheus.GaugeOpts{ - Namespace: cfg.MetricsNamespace, - Name: "inflight_requests", - Help: "Current number of inflight requests.", - }, []string{"method", "route"}) - reg.MustRegister(inflightRequests) - - log.WithField("http", httpListener.Addr()).WithField("grpc", grpcListener.Addr()).Infof("server listening on addresses") + logger.WithField("http", httpListener.Addr()).WithField("grpc", grpcListener.Addr()).Infof("server listening on addresses") // Setup gRPC server serverLog := middleware.GRPCServerLog{ - Log: log, + Log: logger, WithRequest: !cfg.ExcludeRequestInLog, DisableRequestSuccessLog: cfg.DisableRequestSuccessLog, } grpcMiddleware := []grpc.UnaryServerInterceptor{ serverLog.UnaryServerInterceptor, otgrpc.OpenTracingServerInterceptor(opentracing.GlobalTracer()), - middleware.UnaryServerInstrumentInterceptor(requestDuration), + middleware.UnaryServerInstrumentInterceptor(metrics.RequestDuration), } grpcMiddleware = append(grpcMiddleware, cfg.GRPCMiddleware...) grpcStreamMiddleware := []grpc.StreamServerInterceptor{ serverLog.StreamServerInterceptor, otgrpc.OpenTracingStreamServerInterceptor(opentracing.GlobalTracer()), - middleware.StreamServerInstrumentInterceptor(requestDuration), + middleware.StreamServerInstrumentInterceptor(metrics.RequestDuration), } grpcStreamMiddleware = append(grpcStreamMiddleware, cfg.GRPCStreamMiddleware...) @@ -394,7 +362,11 @@ func New(cfg Config) (*Server, error) { grpc.MaxRecvMsgSize(cfg.GPRCServerMaxRecvMsgSize), grpc.MaxSendMsgSize(cfg.GRPCServerMaxSendMsgSize), grpc.MaxConcurrentStreams(uint32(cfg.GPRCServerMaxConcurrentStreams)), - grpc.StatsHandler(middleware.NewStatsHandler(receivedMessageSize, sentMessageSize, inflightRequests)), + grpc.StatsHandler(middleware.NewStatsHandler( + metrics.ReceivedMessageSize, + metrics.SentMessageSize, + metrics.InflightRequests, + )), } grpcOptions = append(grpcOptions, cfg.GRPCOptions...) if grpcTLSConfig != nil { @@ -402,7 +374,7 @@ func New(cfg Config) (*Server, error) { grpcOptions = append(grpcOptions, grpc.Creds(grpcCreds)) } grpcServer := grpc.NewServer(grpcOptions...) - grpcOnHttpServer := grpc.NewServer(grpcOptions...) + grpcOnHTTPServer := grpc.NewServer(grpcOptions...) // Setup HTTP server var router *mux.Router @@ -428,18 +400,21 @@ func New(cfg Config) (*Server, error) { } } + defaultLogMiddleware := middleware.NewLogMiddleware(logger, cfg.LogRequestHeaders, cfg.LogRequestAtInfoLevel, sourceIPs, strings.Split(cfg.LogRequestExcludeHeadersList, ",")) + defaultLogMiddleware.DisableRequestSuccessLog = cfg.DisableRequestSuccessLog + defaultHTTPMiddleware := []middleware.Interface{ middleware.Tracer{ RouteMatcher: router, SourceIPs: sourceIPs, }, - middleware.NewLogMiddleware(log, cfg.LogRequestHeaders, cfg.LogRequestAtInfoLevel, sourceIPs, strings.Split(cfg.LogRequestExcludeHeadersList, ",")), + defaultLogMiddleware, middleware.Instrument{ RouteMatcher: router, - Duration: requestDuration, - RequestBodySize: receivedMessageSize, - ResponseBodySize: sentMessageSize, - InflightRequests: inflightRequests, + Duration: metrics.RequestDuration, + RequestBodySize: metrics.ReceivedMessageSize, + ResponseBodySize: metrics.SentMessageSize, + InflightRequests: metrics.InflightRequests, }, } var httpMiddleware []middleware.Interface @@ -461,7 +436,7 @@ func New(cfg Config) (*Server, error) { handler := cfg.SignalHandler if handler == nil { - handler = signals.NewHandler(log) + handler = signals.NewHandler(logger) } return &Server{ @@ -475,9 +450,9 @@ func New(cfg Config) (*Server, error) { HTTP: router, HTTPServer: httpServer, GRPC: grpcServer, - GRPCOnHTTPServer: grpcOnHttpServer, - Log: log, - Registerer: reg, + GRPCOnHTTPServer: grpcOnHTTPServer, + Log: logger, + Registerer: cfg.registererOrDefault(), Gatherer: gatherer, }, nil } @@ -583,6 +558,6 @@ func (s *Server) Shutdown() { ctx, cancel := context.WithTimeout(context.Background(), s.cfg.ServerGracefulShutdownTimeout) defer cancel() // releases resources if httpServer.Shutdown completes before timeout elapses - s.HTTPServer.Shutdown(ctx) + _ = s.HTTPServer.Shutdown(ctx) s.GRPC.GracefulStop() } diff --git a/vendor/github.com/weaveworks/common/server/tls_config.go b/vendor/github.com/grafana/dskit/server/tls_config.go similarity index 87% rename from vendor/github.com/weaveworks/common/server/tls_config.go rename to vendor/github.com/grafana/dskit/server/tls_config.go index b374a67c41bff..128c6d04f0575 100644 --- a/vendor/github.com/weaveworks/common/server/tls_config.go +++ b/vendor/github.com/grafana/dskit/server/tls_config.go @@ -1,3 +1,7 @@ +// Provenance-includes-location: https://github.com/weaveworks/common/blob/main/server/tls_config.go +// Provenance-includes-license: Apache-2.0 +// Provenance-includes-copyright: Weaveworks Ltd. + package server import ( diff --git a/vendor/github.com/weaveworks/common/signals/signals.go b/vendor/github.com/grafana/dskit/signals/signals.go similarity index 78% rename from vendor/github.com/weaveworks/common/signals/signals.go rename to vendor/github.com/grafana/dskit/signals/signals.go index 29d45fc89802b..75609a745e6e5 100644 --- a/vendor/github.com/weaveworks/common/signals/signals.go +++ b/vendor/github.com/grafana/dskit/signals/signals.go @@ -1,3 +1,7 @@ +// Provenance-includes-location: https://github.com/weaveworks/common/blob/main/signals/signals.go +// Provenance-includes-license: Apache-2.0 +// Provenance-includes-copyright: Weaveworks Ltd. + package signals import ( @@ -6,7 +10,7 @@ import ( "runtime" "syscall" - "github.com/weaveworks/common/logging" + "github.com/grafana/dskit/log" ) // SignalReceiver represents a subsystem/server/... that can be stopped or @@ -19,13 +23,13 @@ type SignalReceiver interface { // On SIGINT or SIGTERM it will exit, on SIGQUIT it // will dump goroutine stacks to the Logger. type Handler struct { - log logging.Interface + log log.Interface receivers []SignalReceiver quit chan struct{} } // NewHandler makes a new Handler. -func NewHandler(log logging.Interface, receivers ...SignalReceiver) *Handler { +func NewHandler(log log.Interface, receivers ...SignalReceiver) *Handler { return &Handler{ log: log, receivers: receivers, @@ -54,7 +58,7 @@ func (h *Handler) Loop() { case syscall.SIGINT, syscall.SIGTERM: h.log.Infof("=== received SIGINT/SIGTERM ===\n*** exiting") for _, subsystem := range h.receivers { - subsystem.Stop() + _ = subsystem.Stop() } return case syscall.SIGQUIT: @@ -68,6 +72,6 @@ func (h *Handler) Loop() { // SignalHandlerLoop blocks until it receives a SIGINT, SIGTERM or SIGQUIT. // For SIGINT and SIGTERM, it exits; for SIGQUIT is print a goroutine stack // dump. -func SignalHandlerLoop(log logging.Interface, ss ...SignalReceiver) { +func SignalHandlerLoop(log log.Interface, ss ...SignalReceiver) { NewHandler(log, ss...).Loop() } diff --git a/vendor/github.com/grafana/dskit/spanlogger/spanlogger.go b/vendor/github.com/grafana/dskit/spanlogger/spanlogger.go index 7a7a4fb75b593..9a063e0a4dc2a 100644 --- a/vendor/github.com/grafana/dskit/spanlogger/spanlogger.go +++ b/vendor/github.com/grafana/dskit/spanlogger/spanlogger.go @@ -8,7 +8,8 @@ import ( opentracing "github.com/opentracing/opentracing-go" "github.com/opentracing/opentracing-go/ext" otlog "github.com/opentracing/opentracing-go/log" - "github.com/weaveworks/common/tracing" + + "github.com/grafana/dskit/tracing" ) type loggerCtxMarker struct{} diff --git a/vendor/github.com/grafana/dskit/tenant/resolver.go b/vendor/github.com/grafana/dskit/tenant/resolver.go index f0fd8abfea7fc..aa19d75bb4a78 100644 --- a/vendor/github.com/grafana/dskit/tenant/resolver.go +++ b/vendor/github.com/grafana/dskit/tenant/resolver.go @@ -6,7 +6,7 @@ import ( "net/http" "strings" - "github.com/weaveworks/common/user" + "github.com/grafana/dskit/user" ) var defaultResolver Resolver = NewSingleResolver() diff --git a/vendor/github.com/grafana/dskit/tenant/tenant.go b/vendor/github.com/grafana/dskit/tenant/tenant.go index c7c772648c500..a5807500e527a 100644 --- a/vendor/github.com/grafana/dskit/tenant/tenant.go +++ b/vendor/github.com/grafana/dskit/tenant/tenant.go @@ -7,7 +7,7 @@ import ( "sort" "strings" - "github.com/weaveworks/common/user" + "github.com/grafana/dskit/user" ) var ( diff --git a/vendor/github.com/weaveworks/common/tracing/tracing.go b/vendor/github.com/grafana/dskit/tracing/tracing.go similarity index 92% rename from vendor/github.com/weaveworks/common/tracing/tracing.go rename to vendor/github.com/grafana/dskit/tracing/tracing.go index 55fdfde972fd4..66b3a3cef4cc2 100644 --- a/vendor/github.com/weaveworks/common/tracing/tracing.go +++ b/vendor/github.com/grafana/dskit/tracing/tracing.go @@ -1,3 +1,7 @@ +// Provenance-includes-location: https://github.com/weaveworks/common/blob/main/tracing/tracing.go +// Provenance-includes-license: Apache-2.0 +// Provenance-includes-copyright: Weaveworks Ltd. + package tracing import ( diff --git a/vendor/github.com/weaveworks/common/user/grpc.go b/vendor/github.com/grafana/dskit/user/grpc.go similarity index 85% rename from vendor/github.com/weaveworks/common/user/grpc.go rename to vendor/github.com/grafana/dskit/user/grpc.go index 64f0491a85bc3..201b835eeab7d 100644 --- a/vendor/github.com/weaveworks/common/user/grpc.go +++ b/vendor/github.com/grafana/dskit/user/grpc.go @@ -1,7 +1,12 @@ +// Provenance-includes-location: https://github.com/weaveworks/common/blob/main/user/grpc.go +// Provenance-includes-license: Apache-2.0 +// Provenance-includes-copyright: Weaveworks Ltd. + package user import ( - "golang.org/x/net/context" + "context" + "google.golang.org/grpc/metadata" ) diff --git a/vendor/github.com/weaveworks/common/user/http.go b/vendor/github.com/grafana/dskit/user/http.go similarity index 91% rename from vendor/github.com/weaveworks/common/user/http.go rename to vendor/github.com/grafana/dskit/user/http.go index c15fd4106d542..ca015b36de32a 100644 --- a/vendor/github.com/weaveworks/common/user/http.go +++ b/vendor/github.com/grafana/dskit/user/http.go @@ -1,9 +1,12 @@ +// Provenance-includes-location: https://github.com/weaveworks/common/blob/main/user/http.go +// Provenance-includes-license: Apache-2.0 +// Provenance-includes-copyright: Weaveworks Ltd. + package user import ( + "context" "net/http" - - "golang.org/x/net/context" ) const ( diff --git a/vendor/github.com/weaveworks/common/user/id.go b/vendor/github.com/grafana/dskit/user/id.go similarity index 86% rename from vendor/github.com/weaveworks/common/user/id.go rename to vendor/github.com/grafana/dskit/user/id.go index a1f91f0c1f0f1..2396787c28c7e 100644 --- a/vendor/github.com/weaveworks/common/user/id.go +++ b/vendor/github.com/grafana/dskit/user/id.go @@ -1,9 +1,13 @@ +// Provenance-includes-location: https://github.com/weaveworks/common/blob/main/user/id.go +// Provenance-includes-license: Apache-2.0 +// Provenance-includes-copyright: Weaveworks Ltd. + package user import ( - "golang.org/x/net/context" + "context" - "github.com/weaveworks/common/errors" + "github.com/grafana/dskit/errors" ) type contextKey int diff --git a/vendor/github.com/weaveworks/common/user/logging.go b/vendor/github.com/grafana/dskit/user/logging.go similarity index 50% rename from vendor/github.com/weaveworks/common/user/logging.go rename to vendor/github.com/grafana/dskit/user/logging.go index b873945be368e..0db1946c86453 100644 --- a/vendor/github.com/weaveworks/common/user/logging.go +++ b/vendor/github.com/grafana/dskit/user/logging.go @@ -1,13 +1,17 @@ +// Provenance-includes-location: https://github.com/weaveworks/common/blob/main/user/logging.go +// Provenance-includes-license: Apache-2.0 +// Provenance-includes-copyright: Weaveworks Ltd. + package user import ( - "golang.org/x/net/context" + "context" - "github.com/weaveworks/common/logging" + "github.com/grafana/dskit/log" ) // LogWith returns user and org information from the context as log fields. -func LogWith(ctx context.Context, log logging.Interface) logging.Interface { +func LogWith(ctx context.Context, log log.Interface) log.Interface { userID, err := ExtractUserID(ctx) if err == nil { log = log.WithField("userID", userID) diff --git a/vendor/github.com/weaveworks/common/errors/error.go b/vendor/github.com/weaveworks/common/errors/error.go deleted file mode 100644 index 6d1f97995537f..0000000000000 --- a/vendor/github.com/weaveworks/common/errors/error.go +++ /dev/null @@ -1,6 +0,0 @@ -package errors - -// Error see https://dave.cheney.net/2016/04/07/constant-errors. -type Error string - -func (e Error) Error() string { return string(e) } diff --git a/vendor/github.com/weaveworks/common/httpgrpc/tools.go b/vendor/github.com/weaveworks/common/httpgrpc/tools.go deleted file mode 100644 index 866af4b697535..0000000000000 --- a/vendor/github.com/weaveworks/common/httpgrpc/tools.go +++ /dev/null @@ -1,6 +0,0 @@ -package httpgrpc - -import ( - // This is a workaround for go mod which fails to download gogoproto otherwise - _ "github.com/gogo/protobuf/gogoproto" -) diff --git a/vendor/github.com/weaveworks/common/logging/noop.go b/vendor/github.com/weaveworks/common/logging/noop.go deleted file mode 100644 index 8b7201ca9489b..0000000000000 --- a/vendor/github.com/weaveworks/common/logging/noop.go +++ /dev/null @@ -1,23 +0,0 @@ -package logging - -// Noop logger. -func Noop() Interface { - return noop{} -} - -type noop struct{} - -func (noop) Debugf(format string, args ...interface{}) {} -func (noop) Debugln(args ...interface{}) {} -func (noop) Infof(format string, args ...interface{}) {} -func (noop) Infoln(args ...interface{}) {} -func (noop) Warnf(format string, args ...interface{}) {} -func (noop) Warnln(args ...interface{}) {} -func (noop) Errorf(format string, args ...interface{}) {} -func (noop) Errorln(args ...interface{}) {} -func (noop) WithField(key string, value interface{}) Interface { - return noop{} -} -func (noop) WithFields(Fields) Interface { - return noop{} -} diff --git a/vendor/modules.txt b/vendor/modules.txt index 504b8f32169bd..ec0cd71e324ba 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -826,7 +826,7 @@ github.com/gorilla/websocket # github.com/grafana/cloudflare-go v0.0.0-20230110200409-c627cf6792f2 ## explicit; go 1.17 github.com/grafana/cloudflare-go -# github.com/grafana/dskit v0.0.0-20230725162534-96da0816983e +# github.com/grafana/dskit v0.0.0-20230804003603-740f56bd2934 ## explicit; go 1.18 github.com/grafana/dskit/backoff github.com/grafana/dskit/concurrency @@ -834,10 +834,14 @@ github.com/grafana/dskit/crypto/tls github.com/grafana/dskit/dns github.com/grafana/dskit/dns/godns github.com/grafana/dskit/dns/miekgdns +github.com/grafana/dskit/errors github.com/grafana/dskit/flagext github.com/grafana/dskit/grpcclient github.com/grafana/dskit/grpcencoding/snappy github.com/grafana/dskit/grpcutil +github.com/grafana/dskit/httpgrpc +github.com/grafana/dskit/httpgrpc/server +github.com/grafana/dskit/instrument github.com/grafana/dskit/internal/math github.com/grafana/dskit/internal/slices github.com/grafana/dskit/kv @@ -848,7 +852,9 @@ github.com/grafana/dskit/kv/memberlist github.com/grafana/dskit/limiter github.com/grafana/dskit/log github.com/grafana/dskit/loser +github.com/grafana/dskit/middleware github.com/grafana/dskit/modules +github.com/grafana/dskit/mtime github.com/grafana/dskit/multierror github.com/grafana/dskit/netutil github.com/grafana/dskit/ring @@ -856,9 +862,13 @@ github.com/grafana/dskit/ring/client github.com/grafana/dskit/ring/shard github.com/grafana/dskit/runtimeconfig github.com/grafana/dskit/runutil +github.com/grafana/dskit/server github.com/grafana/dskit/services +github.com/grafana/dskit/signals github.com/grafana/dskit/spanlogger github.com/grafana/dskit/tenant +github.com/grafana/dskit/tracing +github.com/grafana/dskit/user # github.com/grafana/go-gelf/v2 v2.0.1 ## explicit; go 1.17 github.com/grafana/go-gelf/v2/gelf @@ -1379,19 +1389,7 @@ github.com/ugorji/go/codec # github.com/weaveworks/common v0.0.0-20230511094633-334485600903 ## explicit; go 1.14 github.com/weaveworks/common/aws -github.com/weaveworks/common/errors -github.com/weaveworks/common/grpc -github.com/weaveworks/common/httpgrpc -github.com/weaveworks/common/httpgrpc/server -github.com/weaveworks/common/instrument -github.com/weaveworks/common/logging -github.com/weaveworks/common/middleware -github.com/weaveworks/common/mtime -github.com/weaveworks/common/server -github.com/weaveworks/common/signals github.com/weaveworks/common/test -github.com/weaveworks/common/tracing -github.com/weaveworks/common/user # github.com/weaveworks/promrus v1.2.0 ## explicit github.com/weaveworks/promrus