Skip to content

Commit 6ebfc86

Browse files
authored
Merge pull request #87 from weaviate/metrics_endpoint
Add metrics endpoint
2 parents a747e2d + 4be837e commit 6ebfc86

3 files changed

Lines changed: 6 additions & 3 deletions

File tree

benchmarker/cmd/ann_benchmark.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1099,6 +1099,8 @@ func initAnnBenchmark() {
10991099
"httpOrigin", "localhost:8080", "The http origin for Weaviate (only used if grpc enabled)")
11001100
annBenchmarkCommand.PersistentFlags().StringVar(&globalConfig.HttpScheme,
11011101
"httpScheme", "http", "The http scheme (http or https)")
1102+
annBenchmarkCommand.PersistentFlags().StringVar(&globalConfig.MetricsEndpoint,
1103+
"metricsEndpoint", "http://localhost:2112/metrics", "The metrics endpoint for Weaviate(default http://localhost:2112/metrics)")
11021104
annBenchmarkCommand.PersistentFlags().StringVarP(&globalConfig.OutputFormat,
11031105
"format", "f", "text", "Output format, one of [text, json]")
11041106
annBenchmarkCommand.PersistentFlags().IntVarP(&globalConfig.Limit,

benchmarker/cmd/config.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ type Config struct {
6060
StartTenantNum int
6161
NumTenants int
6262
ExistingSchema bool
63+
MetricsEndpoint string
6364
HttpOrigin string
6465
HttpScheme string
6566
UpdatePercentage float64

benchmarker/cmd/metrics.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ type Memstats struct {
1818
}
1919

2020
func readMemoryMetrics(cfg *Config) (*Memstats, error) {
21-
prometheusURL := fmt.Sprintf("http://%s/metrics", strings.Replace(cfg.HttpOrigin, "8080", "2112", -1))
21+
prometheusURL := cfg.MetricsEndpoint
2222
response, err := http.Get(prometheusURL)
2323
if err != nil {
2424
return nil, err
@@ -65,7 +65,7 @@ type HFreshPendingMetrics struct {
6565
}
6666

6767
func readHFreshMetrics(cfg *Config) (*HFreshPendingMetrics, error) {
68-
prometheusURL := fmt.Sprintf("http://%s/metrics", strings.Replace(cfg.HttpOrigin, "8080", "2112", -1))
68+
prometheusURL := cfg.MetricsEndpoint
6969
response, err := http.Get(prometheusURL)
7070
if err != nil {
7171
return nil, err
@@ -119,7 +119,7 @@ func readHFreshMetrics(cfg *Config) (*HFreshPendingMetrics, error) {
119119

120120
func waitTombstonesEmpty(cfg *Config) error {
121121

122-
prometheusURL := fmt.Sprintf("http://%s/metrics", strings.Replace(cfg.HttpOrigin, "8080", "2112", -1))
122+
prometheusURL := cfg.MetricsEndpoint
123123
metricName := "vector_index_tombstones"
124124

125125
log.Printf("Waiting to allow for tombstone cleanup\n")

0 commit comments

Comments
 (0)