The OSprofiler is a distributed trace toolkit library. It helps to trace internal calls of Openstack services including RPC, DB and WSGI. This patch integrates OSprofiler in Rally. Rally can trigger the profiling on a per-iteration basis. To do so a secret key (profiler_hmac_key) is stored alongside the credentials and used to initialize the profiler in the constructor of the scenarios. A configuration parameter (enable_profiler) can disabled the profiling. Note that in this patch we don't embed the full osprofiler report but only a trace id. This trace id can be used to retrieve the full trace from the osprofiler tool later. Change-Id: I7602856d094e073fde80d287b4d92b5750aacc3c Co-Authored-By: rcherrueau <Ronan-Alexandre.Cherrueau@inria.fr> Implements: spec osprofiler
87 lines
3.7 KiB
Python
87 lines
3.7 KiB
Python
# Copyright 2014: Mirantis Inc.
|
|
# All Rights Reserved.
|
|
#
|
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
|
# not use this file except in compliance with the License. You may obtain
|
|
# a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
# License for the specific language governing permissions and limitations
|
|
# under the License.
|
|
|
|
from rally.common import objects
|
|
from rally import consts
|
|
from tests.unit import test
|
|
|
|
|
|
# TODO(astudenov): remove this class in future releases
|
|
|
|
class CredentialTestCase(test.TestCase):
|
|
|
|
def test_to_dict(self):
|
|
credential = objects.Credential(
|
|
"foo_url", "foo_user", "foo_password",
|
|
tenant_name="foo_tenant",
|
|
permission=consts.EndpointPermission.ADMIN)
|
|
self.assertEqual(credential.to_dict(),
|
|
{"auth_url": "foo_url",
|
|
"username": "foo_user",
|
|
"password": "foo_password",
|
|
"tenant_name": "foo_tenant",
|
|
"region_name": None,
|
|
"domain_name": None,
|
|
"endpoint": None,
|
|
"endpoint_type": None,
|
|
"https_insecure": False,
|
|
"https_cacert": None,
|
|
"project_domain_name": None,
|
|
"user_domain_name": None,
|
|
"profiler_hmac_key": None})
|
|
|
|
def test_to_dict_with_include_permission(self):
|
|
credential = objects.Credential(
|
|
"foo_url", "foo_user", "foo_password",
|
|
tenant_name="foo_tenant",
|
|
permission=consts.EndpointPermission.ADMIN)
|
|
self.assertEqual(credential.to_dict(include_permission=True),
|
|
{"auth_url": "foo_url",
|
|
"username": "foo_user",
|
|
"password": "foo_password",
|
|
"tenant_name": "foo_tenant",
|
|
"region_name": None,
|
|
"domain_name": None,
|
|
"endpoint": None,
|
|
"permission": consts.EndpointPermission.ADMIN,
|
|
"endpoint_type": None,
|
|
"https_insecure": False,
|
|
"https_cacert": None,
|
|
"project_domain_name": None,
|
|
"user_domain_name": None,
|
|
"profiler_hmac_key": None})
|
|
|
|
def test_to_dict_with_kwarg_credential(self):
|
|
credential = objects.Credential(
|
|
"foo_url", "foo_user", "foo_password",
|
|
tenant_name="foo_tenant",
|
|
permission=consts.EndpointPermission.ADMIN,
|
|
endpoint="foo_endpoint",
|
|
endpoint_type=consts.EndpointType.PUBLIC)
|
|
self.assertEqual(credential.to_dict(),
|
|
{"auth_url": "foo_url",
|
|
"username": "foo_user",
|
|
"password": "foo_password",
|
|
"tenant_name": "foo_tenant",
|
|
"region_name": None,
|
|
"domain_name": None,
|
|
"endpoint": "foo_endpoint",
|
|
"endpoint_type": consts.EndpointType.PUBLIC,
|
|
"https_insecure": False,
|
|
"https_cacert": None,
|
|
"project_domain_name": None,
|
|
"user_domain_name": None,
|
|
"profiler_hmac_key": None})
|