Skip to content

Commit

Permalink
update clickhouse-operator
Browse files Browse the repository at this point in the history
  • Loading branch information
marriva committed Dec 27, 2023
1 parent 0517c44 commit 2f5f9ae
Showing 1 changed file with 31 additions and 5 deletions.
36 changes: 31 additions & 5 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@ import (
"os"
"os/signal"
"syscall"
"time"

"github.com/alecthomas/kingpin/v2"
"github.com/altinity/clickhouse-operator/pkg/apis/metrics"
"github.com/altinity/clickhouse-operator/pkg/model/clickhouse"
"github.com/prometheus/common/version"
"github.com/sirupsen/logrus"
"gopkg.in/alecthomas/kingpin.v2"
)

const (
Expand Down Expand Up @@ -100,15 +102,39 @@ func main() {
log.Infof("Starting metrics exporter %s", version.Info())
log.Infof("Build context %s", version.BuildContext())

// TODO: rootCA
clusterConnectionParams := clickhouse.NewClusterConnectionParams(scheme, username, password, "", port)
// TODO: multiple hostnames
params := clusterConnectionParams.NewEndpointConnectionParams(hostnames[0])
metrics.NewClickHouseFetcher(params)

host := &metrics.WatchedHost{
Name: namespace,
Hostname: "",
TCPPort: 0,
TLSPort: 0,
HTTPPort: 0,
HTTPSPort: 0,
}
cluster := &metrics.WatchedCluster{
Name: chiName,
Hosts: []*metrics.WatchedHost{host},
}
metrics.StartMetricsREST(
metrics.NewCHAccessInfo(scheme, username, password, port),

metricsEP,
metricsPath,

time.Second*30,
chiListEP,
chiListPath,
).UpdateWatch(namespace, chiName, hostnames)
).UpdateWatch(namespace, chiName, []*metrics.WatchedCluster{cluster})

// metrics.StartMetricsREST(
// metricsEP,
// metricsPath,
// time.Second*30,
// chiListEP,
// chiListPath,
// ).UpdateWatch(namespace, chiName, hostnames)

<-ctx.Done()
}
Expand Down

0 comments on commit 2f5f9ae

Please sign in to comment.