1
- // Package http contains a River serializable definition of the weaveworks weaveworks config in
2
- // https://github.com/weaveworks/common /blob/master /server/server.go#L62 .
1
+ // Package http contains a River serializable definition of the dskit config in
2
+ // https://github.com/grafana/dskit /blob/main /server/server.go#L72 .
3
3
package net
4
4
5
5
import (
6
6
"flag"
7
7
"math"
8
8
"time"
9
9
10
- weaveworks "github.com/weaveworks/common /server"
10
+ dskit "github.com/grafana/dskit /server"
11
11
)
12
12
13
13
const (
@@ -16,27 +16,27 @@ const (
16
16
// using zero as default grpc port to assing random free port when not configured
17
17
DefaultGRPCPort = 0
18
18
19
- // defaults inherited from weaveworks
19
+ // defaults inherited from dskit
20
20
durationInfinity = time .Duration (math .MaxInt64 )
21
21
size4MB = 4 << 20
22
22
)
23
23
24
- // ServerConfig is a River configuration that allows one to configure a weaveworks .Server. It
24
+ // ServerConfig is a River configuration that allows one to configure a dskit .Server. It
25
25
// exposes a subset of the available configurations.
26
26
type ServerConfig struct {
27
- // HTTP configures the HTTP weaveworks . Note that despite the block being present or not,
28
- // the weaveworks is always started.
27
+ // HTTP configures the HTTP dskit . Note that despite the block being present or not,
28
+ // the dskit is always started.
29
29
HTTP * HTTPConfig `river:"http,block,optional"`
30
30
31
- // GRPC configures the gRPC weaveworks . Note that despite the block being present or not,
32
- // the weaveworks is always started.
31
+ // GRPC configures the gRPC dskit . Note that despite the block being present or not,
32
+ // the dskit is always started.
33
33
GRPC * GRPCConfig `river:"grpc,block,optional"`
34
34
35
35
// GracefulShutdownTimeout configures a timeout to gracefully shut down the server.
36
36
GracefulShutdownTimeout time.Duration `river:"graceful_shutdown_timeout,attr,optional"`
37
37
}
38
38
39
- // HTTPConfig configures the HTTP weaveworks started by weaveworks .Server.
39
+ // HTTPConfig configures the HTTP dskit started by dskit .Server.
40
40
type HTTPConfig struct {
41
41
ListenAddress string `river:"listen_address,attr,optional"`
42
42
ListenPort int `river:"listen_port,attr,optional"`
@@ -46,8 +46,8 @@ type HTTPConfig struct {
46
46
ServerIdleTimeout time.Duration `river:"server_idle_timeout,attr,optional"`
47
47
}
48
48
49
- // Into applies the configs from HTTPConfig into a weaveworks .Into.
50
- func (h * HTTPConfig ) Into (c * weaveworks .Config ) {
49
+ // Into applies the configs from HTTPConfig into a dskit .Into.
50
+ func (h * HTTPConfig ) Into (c * dskit .Config ) {
51
51
c .HTTPListenAddress = h .ListenAddress
52
52
c .HTTPListenPort = h .ListenPort
53
53
c .HTTPConnLimit = h .ConnLimit
@@ -56,7 +56,7 @@ func (h *HTTPConfig) Into(c *weaveworks.Config) {
56
56
c .HTTPServerIdleTimeout = h .ServerIdleTimeout
57
57
}
58
58
59
- // GRPCConfig configures the gRPC weaveworks started by weaveworks .Server.
59
+ // GRPCConfig configures the gRPC dskit started by dskit .Server.
60
60
type GRPCConfig struct {
61
61
ListenAddress string `river:"listen_address,attr,optional"`
62
62
ListenPort int `river:"listen_port,attr,optional"`
@@ -69,8 +69,8 @@ type GRPCConfig struct {
69
69
ServerMaxConcurrentStreams uint `river:"server_max_concurrent_streams,attr,optional"`
70
70
}
71
71
72
- // Into applies the configs from GRPCConfig into a weaveworks .Into.
73
- func (g * GRPCConfig ) Into (c * weaveworks .Config ) {
72
+ // Into applies the configs from GRPCConfig into a dskit .Into.
73
+ func (g * GRPCConfig ) Into (c * dskit .Config ) {
74
74
c .GRPCListenAddress = g .ListenAddress
75
75
c .GRPCListenPort = g .ListenPort
76
76
c .GRPCConnLimit = g .ConnLimit
@@ -82,11 +82,11 @@ func (g *GRPCConfig) Into(c *weaveworks.Config) {
82
82
c .GPRCServerMaxConcurrentStreams = g .ServerMaxConcurrentStreams
83
83
}
84
84
85
- // Convert converts the River-based ServerConfig into a weaveworks .Config object.
86
- func (c * ServerConfig ) convert () weaveworks .Config {
87
- cfg := newWeaveworksDefaultConfig ()
85
+ // Convert converts the River-based ServerConfig into a dskit .Config object.
86
+ func (c * ServerConfig ) convert () dskit .Config {
87
+ cfg := newdskitDefaultConfig ()
88
88
// use the configured http/grpc blocks, and if not, use a mixin of our defaults, and
89
- // weaveworks 's as a fallback
89
+ // dskit 's as a fallback
90
90
if c .HTTP != nil {
91
91
c .HTTP .Into (& cfg )
92
92
} else {
@@ -101,9 +101,9 @@ func (c *ServerConfig) convert() weaveworks.Config {
101
101
return cfg
102
102
}
103
103
104
- // newWeaveworksDefaultConfig creates a new weaveworks .Config object with some overridden defaults.
105
- func newWeaveworksDefaultConfig () weaveworks .Config {
106
- c := weaveworks .Config {}
104
+ // newdskitDefaultConfig creates a new dskit .Config object with some overridden defaults.
105
+ func newdskitDefaultConfig () dskit .Config {
106
+ c := dskit .Config {}
107
107
c .RegisterFlags (flag .NewFlagSet ("empty" , flag .ContinueOnError ))
108
108
// By default, do not register instrumentation since every metric is later registered
109
109
// inside a custom register
@@ -112,7 +112,7 @@ func newWeaveworksDefaultConfig() weaveworks.Config {
112
112
}
113
113
114
114
// DefaultServerConfig creates a new ServerConfig with defaults applied. Note that some are inherited from
115
- // weaveworks , but copied in our config model to make the mixin logic simpler.
115
+ // dskit , but copied in our config model to make the mixin logic simpler.
116
116
func DefaultServerConfig () * ServerConfig {
117
117
return & ServerConfig {
118
118
HTTP : & HTTPConfig {
0 commit comments