Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
perxis-go
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Package registry
Operate
Terraform modules
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
perxis
perxis-go
Commits
c715ad8d
Commit
c715ad8d
authored
1 year ago
by
ensiouel
Browse files
Options
Downloads
Patches
Plain Diff
docs: добавлен комментарий
parent
abbe3985
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
pkg/metrics/request.go
+12
-0
12 additions, 0 deletions
pkg/metrics/request.go
with
12 additions
and
0 deletions
pkg/metrics/request.go
+
12
−
0
View file @
c715ad8d
...
@@ -10,7 +10,19 @@ type RequestMetrics struct {
...
@@ -10,7 +10,19 @@ type RequestMetrics struct {
DurationSeconds
*
prometheus
.
HistogramVec
DurationSeconds
*
prometheus
.
HistogramVec
}
}
// NewRequestMetrics возвращает метрики для подсчета количества удачных/неудачных запросов, а так же длительности ответов.
//
// subsystem указывает подсистему, к которой принадлежат метрики.
// Значение должно быть уникальным, совпадение разрешено только при совпадении ключей labels. Пустое значение допустимо.
//
// labels - список меток, где каждый элемент метки соответствует парам ключ-значение. Отсутствие допустимо.
// Значения меток должны быть уникальными в рамках одной subsystem.
//
// Метрики записываются в prometheus.DefaultRegisterer
func
NewRequestMetrics
(
subsystem
string
,
durationBuckets
[]
float64
,
labels
...
string
)
*
RequestMetrics
{
func
NewRequestMetrics
(
subsystem
string
,
durationBuckets
[]
float64
,
labels
...
string
)
*
RequestMetrics
{
if
len
(
durationBuckets
)
==
0
{
durationBuckets
=
prometheus
.
DefBuckets
}
metrics
:=
&
RequestMetrics
{
metrics
:=
&
RequestMetrics
{
Total
:
prometheus
.
NewCounterVec
(
prometheus
.
CounterOpts
{
Total
:
prometheus
.
NewCounterVec
(
prometheus
.
CounterOpts
{
Subsystem
:
subsystem
,
Subsystem
:
subsystem
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment