-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: add zebpay count linking metric * feat: add zebpay count linking metric * rename metrics * feat: add zebpay count linking metric * rename test var
- Loading branch information
Showing
8 changed files
with
318 additions
and
124 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package metric | ||
|
||
import ( | ||
"github.com/prometheus/client_golang/prometheus" | ||
) | ||
|
||
const ( | ||
status = "status" | ||
countryCode = "country_code" | ||
) | ||
|
||
type Metric struct { | ||
cntLinkZP *prometheus.CounterVec | ||
} | ||
|
||
// New returns a new metric.Metric. | ||
// New panics if it cannot register any of the metrics. | ||
func New() *Metric { | ||
clzp := prometheus.NewCounterVec(prometheus.CounterOpts{ | ||
Name: "count_link_zebpay", | ||
Help: "Counts the number of successful and failed ZebPay linkings partitioned by country code", | ||
}, | ||
[]string{status, countryCode}, | ||
) | ||
prometheus.MustRegister(clzp) | ||
|
||
return &Metric{cntLinkZP: clzp} | ||
} | ||
|
||
func (m *Metric) LinkSuccessZP(cc string) { | ||
const success = "success" | ||
m.cntLinkZP.With(prometheus.Labels{ | ||
status: success, | ||
countryCode: cc, | ||
}).Inc() | ||
} | ||
|
||
func (m *Metric) LinkFailureZP(cc string) { | ||
const failure = "failure" | ||
m.cntLinkZP.With(prometheus.Labels{ | ||
status: failure, | ||
countryCode: cc, | ||
}).Inc() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.