I add the metadata "metering.server_group":"corey-group" to an instance while creating, and check it by using "nova show", it is applied, then I check the Gnocchi resource using "gnocchi resource show --type instance ${instance-id}", the attribute server_group is None in the begining, but after a while, it will be applied (always on the hour, ex: 07:00, 08:00...), I have no idea what happens, I think this issue will cause Gnocchi gets incorrect datasets while doing aggregation.
I added some log in the file ceilometer/publisher/gnocchi.py, and found that it updates resource every minutes, but the variable "resource_extra" gets "server_group" only on the hour, that's why it is None is the begining.
Here are some parts of the logs:
2020-11-09 **11:59:15** DEBUG ceilometer.publisher.gnocchi Resource {'host': u'test-com-002', 'display_name': u'vm-001', 'flavor_id': u'xxx', 'flavor_name': u'xxx'} publish_samples /usr/lib/python2.7/site-packages/ceilometer/publisher/gnocchi.py:345
2020-11-09 **12:00:15** DEBUG ceilometer.publisher.gnocchi Resource {'host': u'test-com-002', 'display_name': u'vm-001', 'flavor_name': u'xxx', **'server_group': 'corey-group'**} publish_samples /usr/lib/python2.7/site-packages/ceilometer/publisher/gnocchi.py:345
2020-11-09 **12:01:15** DEBUG ceilometer.publisher.gnocchi Resource {'host': u'test-com-002', 'display_name': u'vm-001', 'flavor_id': u'xxx', 'flavor_name': u'xxx'} publish_samples /usr/lib/python2.7/site-packages/ceilometer/publisher/gnocchi.py:345
Env:
Running on Queens, and I can't reproduce this issue on Pike.
Seems like is the same issue to [this](https:/ /bugs.launchpad .net/charm- ceilometer- agent/+ bug/1749954)
I explicitly defind the instance_ discovery_ method as "naive" solved the problem.