MCPcopy Create free account
hub / github.com/cortexproject/cortex / dialAlertmanagerClient

Function dialAlertmanagerClient

pkg/alertmanager/alertmanager_client.go:108–123  ·  view source on GitHub ↗
(cfg grpcclient.Config, addr string, requestDuration *prometheus.HistogramVec)

Source from the content-addressed store, hash-verified

106}
107
108func dialAlertmanagerClient(cfg grpcclient.Config, addr string, requestDuration *prometheus.HistogramVec) (*alertmanagerClient, error) {
109 opts, err := cfg.DialOption(grpcclient.Instrument(requestDuration))
110 if err != nil {
111 return nil, err
112 }
113 conn, err := grpc.NewClient(addr, opts...)
114 if err != nil {
115 return nil, errors.Wrapf(err, "failed to dial alertmanager %s", addr)
116 }
117
118 return &alertmanagerClient{
119 AlertmanagerClient: alertmanagerpb.NewAlertmanagerClient(conn),
120 HealthClient: grpc_health_v1.NewHealthClient(conn),
121 conn: conn,
122 }, nil
123}
124
125type alertmanagerClient struct {
126 alertmanagerpb.AlertmanagerClient

Callers 1

Calls 3

InstrumentFunction · 0.92
NewAlertmanagerClientFunction · 0.92
DialOptionMethod · 0.45

Tested by

no test coverage detected