Skip to content

Commit

Permalink
Address feedback from review
Browse files Browse the repository at this point in the history
Signed-off-by: Saswata Mukherjee <saswataminsta@yahoo.com>
  • Loading branch information
saswatamcode committed Sep 23, 2024
1 parent c6af14f commit 278ccf3
Show file tree
Hide file tree
Showing 10 changed files with 36 additions and 29 deletions.
6 changes: 3 additions & 3 deletions collectors/metrics/cmd/metrics-collector/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ func main() {
&opt.WorkerNum,
"worker-number",
opt.WorkerNum,
"The number of workers that will be used to send metrics.")
"The number of workers that will work in parallel to send metrics.")
cmd.Flags().StringVar(
&opt.Listen,
"listen",
Expand Down Expand Up @@ -355,7 +355,7 @@ func (o *Options) Run() error {
g.Add(func() error {
for i, shardWorker := range shardWorkers {
go func(i int, shardWorker *forwarder.Worker) {
fmt.Printf("Starting shard worker %d\n", i)
logger.Log(o.Logger, logger.Info, "msg", "Starting shard worker", "worker", i)
shardWorker.Run(ctx)
}(i, shardWorker)
}
Expand Down Expand Up @@ -435,7 +435,7 @@ func splitMatchersIntoShards(matchers []string, shardCount int) [][]string {
}

// Agent is the type of the worker agent that will be running.
// They are classed according to what they collect.
// They are classified according to what they collect.
type Agent string

const (
Expand Down
2 changes: 1 addition & 1 deletion collectors/metrics/pkg/forwarder/forwarder.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ type Config struct {
ToClientConfig ToClientConfig
// Enable debug roundtrippers for from and to clients.
Debug bool
// LimitBytes limits the size of the response read from requests made to from and to clients.
// LimitBytes limits the size of the requests made to from and to clients.
LimitBytes int64

// Interval is the interval at which workers will federate Prometheus and send remote write requests.
Expand Down
4 changes: 2 additions & 2 deletions collectors/metrics/pkg/metricsclient/metricsclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -365,10 +365,10 @@ func MTLSTransport(logger log.Logger, caCertFile, tlsCrtFile, tlsKeyFile string)

func DefaultTransport(logger log.Logger) *http.Transport {
return &http.Transport{
Dial: (&net.Dialer{
DialContext: (&net.Dialer{
Timeout: 30 * time.Second,
KeepAlive: 30 * time.Second,
}).Dial,
}).DialContext,
TLSHandshakeTimeout: 10 * time.Second,
DisableKeepAlives: true,
}
Expand Down
2 changes: 1 addition & 1 deletion collectors/metrics/pkg/metricsclient/metricsclient_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ func TestDefaultTransport(t *testing.T) {
DisableKeepAlives: true,
}
http := DefaultTransport(logger)
if http.Dial == nil || reflect.TypeOf(http) != reflect.TypeOf(want) {
if http.DialContext == nil || reflect.TypeOf(http) != reflect.TypeOf(want) {
t.Errorf("Default transport doesn't match expected format")
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,10 @@ type ObservabilityAddonSpec struct {
// +kubebuilder:default:=1073741824
ScrapeSizeLimitBytes int `json:"scrapeSizeLimitBytes,omitempty"`

// Workers is the number of workers that work parallelly to push metrics to hub server.
// If set to > 1, metrics-collector will shard /federate calls to Prometheus, based on
// matcher rules provided by allowlist.
// Workers is the number of workers in metrics-collector that work in parallel to
// push metrics to hub server. If set to > 1, metrics-collector will shard
// /federate calls to Prometheus, based on matcher rules provided by allowlist.
// Ensure that number of matchers exceeds number of workers.
// +optional
// +kubebuilder:default:=1
// +kubebuilder:validation:Minimum=1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ metadata:
}
]
capabilities: Basic Install
createdAt: "2024-09-16T10:55:32Z"
createdAt: "2024-09-23T12:07:01Z"
operators.operatorframework.io/builder: operator-sdk-v1.34.2
operators.operatorframework.io/project_layout: go.kubebuilder.io/v3
name: multicluster-observability-operator.v0.1.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,9 +172,10 @@ spec:
workers:
default: 1
description: |-
Workers is the number of workers that work parallelly to push metrics to hub server.
If set to > 1, metrics-collector will shard /federate calls to Prometheus, based on
matcher rules provided by allowlist.
Workers is the number of workers in metrics-collector that work in parallel to
push metrics to hub server. If set to > 1, metrics-collector will shard
/federate calls to Prometheus, based on matcher rules provided by allowlist.
Ensure that number of matchers exceeds number of workers.
format: int32
minimum: 1
type: integer
Expand Down Expand Up @@ -10210,9 +10211,10 @@ spec:
workers:
default: 1
description: |-
Workers is the number of workers that work parallelly to push metrics to hub server.
If set to > 1, metrics-collector will shard /federate calls to Prometheus, based on
matcher rules provided by allowlist.
Workers is the number of workers in metrics-collector that work in parallel to
push metrics to hub server. If set to > 1, metrics-collector will shard
/federate calls to Prometheus, based on matcher rules provided by allowlist.
Ensure that number of matchers exceeds number of workers.
format: int32
minimum: 1
type: integer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,10 @@ spec:
workers:
default: 1
description: |-
Workers is the number of workers that work parallelly to push metrics to hub server.
If set to > 1, metrics-collector will shard /federate calls to Prometheus, based on
matcher rules provided by allowlist.
Workers is the number of workers in metrics-collector that work in parallel to
push metrics to hub server. If set to > 1, metrics-collector will shard
/federate calls to Prometheus, based on matcher rules provided by allowlist.
Ensure that number of matchers exceeds number of workers.
format: int32
minimum: 1
type: integer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,9 +154,10 @@ spec:
workers:
default: 1
description: |-
Workers is the number of workers that work parallelly to push metrics to hub server.
If set to > 1, metrics-collector will shard /federate calls to Prometheus, based on
matcher rules provided by allowlist.
Workers is the number of workers in metrics-collector that work in parallel to
push metrics to hub server. If set to > 1, metrics-collector will shard
/federate calls to Prometheus, based on matcher rules provided by allowlist.
Ensure that number of matchers exceeds number of workers.
format: int32
minimum: 1
type: integer
Expand Down Expand Up @@ -10194,9 +10195,10 @@ spec:
workers:
default: 1
description: |-
Workers is the number of workers that work parallelly to push metrics to hub server.
If set to > 1, metrics-collector will shard /federate calls to Prometheus, based on
matcher rules provided by allowlist.
Workers is the number of workers in metrics-collector that work in parallel to
push metrics to hub server. If set to > 1, metrics-collector will shard
/federate calls to Prometheus, based on matcher rules provided by allowlist.
Ensure that number of matchers exceeds number of workers.
format: int32
minimum: 1
type: integer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,10 @@ spec:
workers:
default: 1
description: |-
Workers is the number of workers that work parallelly to push metrics to hub server.
If set to > 1, metrics-collector will shard /federate calls to Prometheus, based on
matcher rules provided by allowlist.
Workers is the number of workers in metrics-collector that work in parallel to
push metrics to hub server. If set to > 1, metrics-collector will shard
/federate calls to Prometheus, based on matcher rules provided by allowlist.
Ensure that number of matchers exceeds number of workers.
format: int32
minimum: 1
type: integer
Expand Down

0 comments on commit 278ccf3

Please sign in to comment.