ceilometer/ceilometer/telemetry
Rafael Weingärtner de91333fed Fix `TelemetryIpc` when using `tenant_name_discovery=False`
Patches [1-2] introduced the variables `project_name` and
`user_name` for the Ceilometer samples that are collected.
The gathering of these attributes is controlled with the use
of the parameter `tenant_name_discovery` , which defaults to
False.

However, when it (the parameter) is set as False, an error will
happen at [2], as the key will not exist in the dictionary.

This patch fixes the described issue.

Without this patch, the error that happens is the follwoing:
```
ERROR ceilometer.pipeline.sample [-] Fail to process notification: KeyError: 'user_name'
ERROR ceilometer.pipeline.sample Traceback (most recent call last):
ERROR ceilometer.pipeline.sample   File "/usr/lib/python3/dist-packages/ceilometer/pipeline/sample.py", line 44, in process_notifications
ERROR ceilometer.pipeline.sample     p(list(self.build_sample(message)))
ERROR ceilometer.pipeline.sample   File "/usr/lib/python3/dist-packages/ceilometer/telemetry/notifications.py", line 34, in build_sample
ERROR ceilometer.pipeline.sample     user_name=sample_dict['user_name'],
ERROR ceilometer.pipeline.sample KeyError: 'user_name'
ERROR ceilometer.pipeline.sample

```

[1] https://review.opendev.org/c/openstack/ceilometer/+/877647
[2] 2a5f63da95
Change-Id: I54a0fd43ac2da1b9a8bcdeae7ad7d160bc07f35b
2023-11-21 14:09:23 -03:00
..
__init__.py Add handler of sample creation notification 2015-06-24 17:11:59 +08:00
notifications.py Fix `TelemetryIpc` when using `tenant_name_discovery=False` 2023-11-21 14:09:23 -03:00