You've already forked nginx_exporter
mirror of
https://github.com/nginxinc/nginx-prometheus-exporter.git
synced 2025-07-30 10:03:04 +03:00
Don't try to connect to nginx on client creation (#504)
The client now is created without making a call to nginx. When Collect() is called we try to get the metrics from nginx and if it's not available it will set 'up' to 0 and not fail anymore.
This commit is contained in:
@ -37,14 +37,13 @@ type StubConnections struct {
|
||||
}
|
||||
|
||||
// NewNginxClient creates an NginxClient.
|
||||
func NewNginxClient(httpClient *http.Client, apiEndpoint string) (*NginxClient, error) {
|
||||
func NewNginxClient(httpClient *http.Client, apiEndpoint string) *NginxClient {
|
||||
client := &NginxClient{
|
||||
apiEndpoint: apiEndpoint,
|
||||
httpClient: httpClient,
|
||||
}
|
||||
|
||||
_, err := client.GetStubStats()
|
||||
return client, err
|
||||
return client
|
||||
}
|
||||
|
||||
// GetStubStats fetches the stub_status metrics.
|
||||
|
Reference in New Issue
Block a user