summaryrefslogtreecommitdiff
path: root/ceilometer/sample.py
diff options
context:
space:
mode:
authorYadnesh Kulkarni <ykulkarn@redhat.com>2022-08-01 10:42:02 +0000
committerYadnesh Kulkarni <ykulkarn@redhat.com>2022-09-13 11:15:51 +0000
commit79454d6b22787627ae6239aa7b2707101ba30212 (patch)
treecba04acbc58b7ee581eb0001837f6216940b2a33 /ceilometer/sample.py
parent6f88ee6be9a3ae5c78587f1a2bc8cd2e9a5a2fa7 (diff)
downloadceilometer-79454d6b22787627ae6239aa7b2707101ba30212.tar.gz
Add user/project names to polled samples
Project and user names would be first fetched from cache, if not found, they will be requested from keystone and then cached. Using cache will significanlty reduce the number of calls made to keystone. If ceilometer is configured with no caching backend, the results will always be fetched by querying request to keystone. A new config option, `tenant_name_discovery` is introduced to operate this feature. This feature is optional and is disabled by default. No attempts to identify names will be made if uuids are found to be `None`. Signed-off-by: Yadnesh Kulkarni <ykulkarn@redhat.com> Change-Id: Iee5dbf09a1fd3ac571746fc66d2683eb8e6a1b27
Diffstat (limited to 'ceilometer/sample.py')
-rw-r--r--ceilometer/sample.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/ceilometer/sample.py b/ceilometer/sample.py
index c86caa35..536b561d 100644
--- a/ceilometer/sample.py
+++ b/ceilometer/sample.py
@@ -94,13 +94,16 @@ class Sample(object):
def __init__(self, name, type, unit, volume, user_id, project_id,
resource_id, timestamp=None, resource_metadata=None,
- source=None, id=None, monotonic_time=None):
+ source=None, id=None, monotonic_time=None,
+ user_name=None, project_name=None):
self.name = name
self.type = type
self.unit = unit
self.volume = volume
self.user_id = user_id
+ self.user_name = user_name
self.project_id = project_id
+ self.project_name = project_name
self.resource_id = resource_id
self.timestamp = timestamp
self.resource_metadata = resource_metadata or {}