Sindweller commented on a change in pull request #670:
URL: 
https://github.com/apache/apisix-ingress-controller/pull/670#discussion_r726204210



##########
File path: pkg/apisix/cluster.go
##########
@@ -77,7 +77,8 @@ type ClusterOptions struct {
        BaseURL  string
        Timeout  time.Duration
        // SyncInterval is the interval to sync schema.
-       SyncInterval types.TimeDuration
+       SyncInterval     types.TimeDuration
+       MetricsCollector metrics.Collector

Review comment:
       I use `ClusterOptions` to pass `MetricsCollector` from `controller.go` 
to `cluster.go` through `c.apisix.AddCluster(ctx, clusterOpts)`. See 
[here](https://github.com/apache/apisix-ingress-controller/pull/670/files/ed4fd3116f2bcba39c895494f0831a3c8463b3e7..4b608ce8b718208f1e2bf48614758883d870ac0a#:~:text=MetricsCollector%3A%20o.MetricsCollector%2C).
   Then `MetricsCollector: o.MetricsCollector,` in `NewCluster`:
   ```
   c := &cluster{
                name:        o.Name,
                baseURL:     o.BaseURL,
                baseURLHost: u.Host,
                adminKey:    o.AdminKey,
                cli: &http.Client{
                        Timeout:   o.Timeout,
                        Transport: _defaultTransport,
                },
                cacheState:       _cacheSyncing, // default state
                cacheSynced:      make(chan struct{}),
                MetricsCollector: o.MetricsCollector,  // o *ClusterOptions
        }
   ```




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to