Skip to content

Commit

Permalink
feat: support for scraping multiple elasticsearch instance
Browse files Browse the repository at this point in the history
Signed-off-by: lework <[email protected]>
  • Loading branch information
lework committed Sep 2, 2024
1 parent e89e697 commit 15c3337
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,8 @@ func main() {
httpClient.Transport, err = roundtripper.NewAWSSigningTransport(httpTransport, *awsRegion, *awsRoleArn, logger)
if err != nil {
level.Error(logger).Log("msg", "failed to create AWS transport", "err", err)
os.Exit(1)
http.Error(w, "failed to create AWS transport", http.StatusInternalServerError)
return
}
}

Expand All @@ -252,7 +253,8 @@ func main() {
)
if err != nil {
level.Error(logger).Log("msg", "failed to create Elasticsearch collector", "err", err)
os.Exit(1)
http.Error(w, "failed to create Elasticsearch collector", http.StatusInternalServerError)
return
}
registry.MustRegister(exporter)

Expand Down Expand Up @@ -283,9 +285,9 @@ func main() {

if *esExportIndices || *esExportShards {
sC := collector.NewShards(logger, httpClient, esURL)
prometheus.MustRegister(sC)
registry.MustRegister(sC)
iC := collector.NewIndices(logger, httpClient, esURL, *esExportShards, *esExportIndexAliases)
prometheus.MustRegister(iC)
registry.MustRegister(iC)
if registerErr := clusterInfoRetriever.RegisterConsumer(iC); registerErr != nil {
level.Error(logger).Log("msg", "failed to register indices collector in cluster info")
os.Exit(1)
Expand Down

0 comments on commit 15c3337

Please sign in to comment.