[Ceilometer] Dynamic pollsters : dot in JSON keyname

Rafael Weingärtner rafaelweingartner at gmail.com
Thu Oct 13 11:41:02 UTC 2022


In such cases, you need to use the "Dynamic pollsters operations" to
process the sample, and retrieve the key as "rgw.main.size". By default,
this value ("rgw.main.size") is interpreted as a nested dictionary. I mean,
an object with a key "rgw", and then, another one that has a key "main",
where there is a dict, with a key "size".

To handle such cases, you would need something similar to:
`value_attribute: "usage || value['rgw.main'] | value['size']"`. However,
that might not address all use cases. You will also need to handle
situations when there is no key "rgw.main" in the response samples.

On Wed, Oct 12, 2022 at 12:17 PM Taltavull Jean-François <
jean-francois.taltavull at elca.ch> wrote:

> Hello Rafael,
>
> To get the the size, in GB, occupied by buckets I need to manipulate a
> JSON key which contains a dot in its name:
>
> ````
> - name: "radosgw.containers.objects.size"
>   sample_type: "gauge"
>   unit: "B"
>   value_attribute: "rgw.main.size"
> <------------------------------------"rgw.main" is a JSON key, with a dot
> in its name, which belongs to "bucket.usage" JSON container
>   url_path: "http://FQDN/admin/bucket?stats=True"
>   module: "awsauth"
>   authentication_object: "S3Auth"
>   authentication_parameters: my_access_key,my_secret_key,FQDN
>   user_id_attribute: "owner"
>   project_id_attribute: "tenant"
>   resource_id_attribute: "id"
>   response_entries_key: "usage"
> ````
>
> But with this dynamic pollster definition, I get the python error
> "KeyError: 'rgw' ".
>
> In this case, is there a specific syntax to define "value_attribute" or am
> I doing something the wrong way ?
>
>
> Jean-Francois
>


-- 
Rafael Weingärtner
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.openstack.org/pipermail/openstack-discuss/attachments/20221013/7d6eee0b/attachment.htm>


More information about the openstack-discuss mailing list