Merge "Update Metric Naming"

This commit is contained in:
Zuul 2021-01-26 13:05:05 +00:00 committed by Gerrit Code Review
commit 0d42ba7ec2
2 changed files with 43 additions and 38 deletions

View File

@ -15,56 +15,61 @@
import prometheus_client import prometheus_client
standard_labels_for_server = [ rpc_server_common_labels = [
'exchange', 'topic', 'server', 'endpoint', 'namespace', 'exchange', 'topic', 'server', 'endpoint', 'namespace',
'version', 'method', 'process' 'version', 'method', 'process'
] ]
standard_labels_for_client = [ rpc_client_common_labels = [
'call_type', 'exchange', 'topic', 'namespace', 'version', 'call_type', 'exchange', 'topic', 'namespace', 'version',
'server', 'fanout', 'process' '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 Metrics
rpc_server_count_for_exception = prometheus_client.Counter( rpc_server_invocation_start_total = prometheus_client.Counter(
'oslo_messaging_rpc_server_exception', 'oslo_messaging_rpc_server_invocation_start_total',
'The number of times to hit Exception', 'Total number of RPC invocation start. This doesn\'t count'
standard_labels_for_server + ['exception', ]) 'if rpc server failed to find method from endpoints.',
rpc_server_common_labels)
rpc_server_count_for_invocation_start = prometheus_client.Counter( rpc_server_invocation_end_total = prometheus_client.Counter(
'oslo_messaging_rpc_server_invocation_start', 'oslo_messaging_rpc_server_invocation_end_total',
'The number of times to attempt to invoke method. It doesn\'t count' 'Total number of RPC invocation end.',
'if rpc server failed to find method from endpoints', rpc_server_common_labels)
standard_labels_for_server)
rpc_server_count_for_invocation_end = prometheus_client.Counter( rpc_server_processing_seconds = prometheus_client.Histogram(
'oslo_messaging_rpc_server_invocation_end', 'oslo_messaging_rpc_server_processing_seconds',
'The number of times to finish to invoke method.', 'Duration of RPC processing.',
standard_labels_for_server) rpc_server_common_labels,
buckets=rpc_processing_seconds_buckets)
rpc_server_processing_time = prometheus_client.Histogram(
'oslo_messaging_rpc_server_processing_second',
'rpc server processing time[second]',
standard_labels_for_server)
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 Metrics
rpc_client_count_for_exception = prometheus_client.Counter( rpc_client_invocation_start_total = prometheus_client.Counter(
'oslo_messaging_rpc_client_exception', 'oslo_messaging_rpc_client_invocation_start_total',
'The number of times to hit Exception', 'Total number of RPC invocation start.',
standard_labels_for_client + ['exception', ]) rpc_client_common_labels)
rpc_client_count_for_invocation_start = prometheus_client.Counter( rpc_client_invocation_end_total = prometheus_client.Counter(
'oslo_messaging_rpc_client_invocation_start', 'oslo_messaging_rpc_client_invocation_end_total',
'The number of times to invoke method', 'Total number of RPC invocation end.',
standard_labels_for_client) rpc_client_common_labels)
rpc_client_count_for_invocation_end = prometheus_client.Counter( rpc_client_processing_seconds = prometheus_client.Histogram(
'oslo_messaging_rpc_client_invocation_end', 'oslo_messaging_rpc_client_processing_seconds',
'The number of times to invoke method', 'Duration of RPC processing.',
standard_labels_for_client) rpc_client_common_labels,
buckets=rpc_processing_seconds_buckets)
rpc_client_processing_time = prometheus_client.Histogram( rpc_client_exception_total = prometheus_client.Counter(
'oslo_messaging_rpc_client_processing_second', 'oslo_messaging_rpc_client_exception_total',
'rpc client processing time[second]', 'Total number of exception while RPC processing.',
standard_labels_for_client) rpc_client_common_labels + ['exception', ])

View File

@ -33,7 +33,7 @@ class TestProcessMessage(base.BaseTestCase):
def test_process_counter(self): def test_process_counter(self):
received_json = """{ received_json = """{
"module": "oslo_messaging", "module": "oslo_messaging",
"name": "rpc_server_count_for_invocation_start", "name": "rpc_server_invocation_start_total",
"action": { "action": {
"action": "inc", "action": "inc",
"value": null "value": null
@ -60,7 +60,7 @@ class TestProcessMessage(base.BaseTestCase):
def test_process_histogram(self): def test_process_histogram(self):
received_json = """{ received_json = """{
"module": "oslo_messaging", "module": "oslo_messaging",
"name": "rpc_client_processing_time", "name": "rpc_client_processing_seconds",
"action": { "action": {
"action": "observe", "action": "observe",
"value": 1.26 "value": 1.26