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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
perxis
perxis-go
Commits
eec376da
Commit
eec376da
authored
1 year ago
by
ensiouel
Browse files
Options
Downloads
Patches
Plain Diff
fix
parent
6845af08
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
pkg/metrics/cache.go
+1
-1
1 addition, 1 deletion
pkg/metrics/cache.go
pkg/metrics/request.go
+12
-15
12 additions, 15 deletions
pkg/metrics/request.go
with
13 additions
and
16 deletions
pkg/metrics/cache.go
+
1
−
1
View file @
eec376da
...
@@ -14,7 +14,7 @@ type CacheMetrics struct {
...
@@ -14,7 +14,7 @@ type CacheMetrics struct {
func
NewCacheMetrics
(
scope
string
)
(
*
CacheMetrics
,
error
)
{
func
NewCacheMetrics
(
scope
string
)
(
*
CacheMetrics
,
error
)
{
var
(
var
(
meter
=
otel
.
Meter
(
scope
)
meter
=
otel
.
Meter
(
scope
)
cacheMetrics
*
CacheMetrics
cacheMetrics
=
new
(
CacheMetrics
)
err
error
err
error
)
)
...
...
This diff is collapsed.
Click to expand it.
pkg/metrics/request.go
+
12
−
15
View file @
eec376da
...
@@ -15,33 +15,30 @@ type RequestMetrics struct {
...
@@ -15,33 +15,30 @@ type RequestMetrics struct {
//
//
// Для RequestMetrics.DurationMilliseconds значения buckets по умолчанию равно []float64{0, 5, 10, 25, 50, 75, 100, 250, 500, 750, 1000, 2500, 5000, 7500, 10000}
// Для RequestMetrics.DurationMilliseconds значения buckets по умолчанию равно []float64{0, 5, 10, 25, 50, 75, 100, 250, 500, 750, 1000, 2500, 5000, 7500, 10000}
func
NewRequestMetrics
(
scope
string
)
(
*
RequestMetrics
,
error
)
{
func
NewRequestMetrics
(
scope
string
)
(
*
RequestMetrics
,
error
)
{
meter
:=
otel
.
Meter
(
scope
)
var
(
meter
=
otel
.
Meter
(
scope
)
requestMetrics
=
new
(
RequestMetrics
)
err
error
)
t
otal
,
err
:
=
meter
.
Int64Counter
(
"requests"
,
if
requestMetrics
.
T
otal
,
err
=
meter
.
Int64Counter
(
"requests"
,
otelmetric
.
WithDescription
(
"Количество запросов"
),
otelmetric
.
WithDescription
(
"Количество запросов"
),
)
);
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
err
}
}
f
ailedTotal
,
err
:
=
meter
.
Int64Counter
(
"requests_failed"
,
if
requestMetrics
.
F
ailedTotal
,
err
=
meter
.
Int64Counter
(
"requests_failed"
,
otelmetric
.
WithDescription
(
"Количество запросов, вернувших ошибку"
),
otelmetric
.
WithDescription
(
"Количество запросов, вернувших ошибку"
),
)
);
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
err
}
}
d
urationMilliseconds
,
err
:
=
meter
.
Int64Histogram
(
"request_duration"
,
if
requestMetrics
.
D
urationMilliseconds
,
err
=
meter
.
Int64Histogram
(
"request_duration"
,
otelmetric
.
WithDescription
(
"Длительность обработки запроса"
),
otelmetric
.
WithDescription
(
"Длительность обработки запроса"
),
otelmetric
.
WithUnit
(
"ms"
),
otelmetric
.
WithUnit
(
"ms"
),
)
);
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
err
}
}
return
&
RequestMetrics
{
return
requestMetrics
,
nil
Total
:
total
,
FailedTotal
:
failedTotal
,
DurationMilliseconds
:
durationMilliseconds
,
},
nil
}
}
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