Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenStack
oslo
python-oslo.metrics
Commits
0d42ba7e
Commit
0d42ba7e
authored
Jan 26, 2021
by
Zuul
Committed by
Gerrit Code Review
Jan 26, 2021
Browse files
Merge "Update Metric Naming"
parents
4fcf2c16
82928b5b
Changes
2
Hide whitespace changes
Inline
Side-by-side
oslo_metrics/metrics/oslo_messaging.py
View file @
0d42ba7e
...
...
@@ -15,56 +15,61 @@
import
prometheus_client
standard_labels_for_server
=
[
rpc_server_common_labels
=
[
'exchange'
,
'topic'
,
'server'
,
'endpoint'
,
'namespace'
,
'version'
,
'method'
,
'process'
]
standard_labels_for_client
=
[
rpc_client_common_labels
=
[
'call_type'
,
'exchange'
,
'topic'
,
'namespace'
,
'version'
,
'server'
,
'fanout'
,
'process'
]
rpc_processing_seconds_buckets
=
[
0.01
,
0.025
,
0.05
,
0.075
,
0.1
,
0.25
,
0.5
,
0.75
,
1.0
,
2.5
,
5.0
,
7.5
,
10.0
,
25.0
,
50.0
,
75.0
,
100
]
# RPC Server Metrics
rpc_server_count_for_exception
=
prometheus_client
.
Counter
(
'oslo_messaging_rpc_server_exception'
,
'The number of times to hit Exception'
,
standard_labels_for_server
+
[
'exception'
,
])
rpc_server_count_for_invocation_start
=
prometheus_client
.
Counter
(
'oslo_messaging_rpc_server_invocation_start'
,
'The number of times to attempt to invoke method. It doesn
\'
t count'
'if rpc server failed to find method from endpoints'
,
standard_labels_for_server
)
rpc_server_invocation_start_total
=
prometheus_client
.
Counter
(
'oslo_messaging_rpc_server_invocation_start_total'
,
'Total number of RPC invocation start. This doesn
\'
t count'
'if rpc server failed to find method from endpoints.'
,
rpc_server_common_labels
)
rpc_server_
count_for_
invocation_end
=
prometheus_client
.
Counter
(
'oslo_messaging_rpc_server_invocation_end'
,
'T
he
number of
times to finish to invoke metho
d.'
,
standard_labels_for_server
)
rpc_server_invocation_end
_total
=
prometheus_client
.
Counter
(
'oslo_messaging_rpc_server_invocation_end
_total
'
,
'T
otal
number of
RPC invocation en
d.'
,
rpc_server_common_labels
)
rpc_server_processing_time
=
prometheus_client
.
Histogram
(
'oslo_messaging_rpc_server_processing_second'
,
'rpc server processing time[second]'
,
standard_labels_for_server
)
rpc_server_processing_seconds
=
prometheus_client
.
Histogram
(
'oslo_messaging_rpc_server_processing_seconds'
,
'Duration of RPC processing.'
,
rpc_server_common_labels
,
buckets
=
rpc_processing_seconds_buckets
)
rpc_server_exception_total
=
prometheus_client
.
Counter
(
'oslo_messaging_rpc_server_exception_total'
,
'Total number of exception while RPC processing.'
,
rpc_server_common_labels
+
[
'exception'
])
# RPC Client Metrics
rpc_client_
count_for_exception
=
prometheus_client
.
Counter
(
'oslo_messaging_rpc_client_
exception
'
,
'T
he
number of
times to hit Exception
'
,
standard_labels_for_client
+
[
'exception'
,
]
)
rpc_client_
invocation_start_total
=
prometheus_client
.
Counter
(
'oslo_messaging_rpc_client_
invocation_start_total
'
,
'T
otal
number of
RPC invocation start.
'
,
rpc_client_common_labels
)
rpc_client_
count_for_
invocation_
start
=
prometheus_client
.
Counter
(
'oslo_messaging_rpc_client_invocation_
start
'
,
'T
he
number of
times to invoke method
'
,
standard_labels_for_client
)
rpc_client_invocation_
end_total
=
prometheus_client
.
Counter
(
'oslo_messaging_rpc_client_invocation_
end_total
'
,
'T
otal
number of
RPC invocation end.
'
,
rpc_client_common_labels
)
rpc_client_count_for_invocation_end
=
prometheus_client
.
Counter
(
'oslo_messaging_rpc_client_invocation_end'
,
'The number of times to invoke method'
,
standard_labels_for_client
)
rpc_client_processing_seconds
=
prometheus_client
.
Histogram
(
'oslo_messaging_rpc_client_processing_seconds'
,
'Duration of RPC processing.'
,
rpc_client_common_labels
,
buckets
=
rpc_processing_seconds_buckets
)
rpc_client_
processing_time
=
prometheus_client
.
Histogram
(
'oslo_messaging_rpc_client_
processing_second
'
,
'
rpc client processing time[second]
'
,
standard_labels_for_client
)
rpc_client_
exception_total
=
prometheus_client
.
Counter
(
'oslo_messaging_rpc_client_
exception_total
'
,
'
Total number of exception while RPC processing.
'
,
rpc_client_common_labels
+
[
'exception'
,
]
)
oslo_metrics/tests/test_message_process.py
View file @
0d42ba7e
...
...
@@ -33,7 +33,7 @@ class TestProcessMessage(base.BaseTestCase):
def
test_process_counter
(
self
):
received_json
=
"""{
"module": "oslo_messaging",
"name": "rpc_server_
count_for_
invocation_start",
"name": "rpc_server_invocation_start
_total
",
"action": {
"action": "inc",
"value": null
...
...
@@ -60,7 +60,7 @@ class TestProcessMessage(base.BaseTestCase):
def
test_process_histogram
(
self
):
received_json
=
"""{
"module": "oslo_messaging",
"name": "rpc_client_processing_
time
",
"name": "rpc_client_processing_
seconds
",
"action": {
"action": "observe",
"value": 1.26
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment