Skip to content

Replace invalid characters when creating a Cumulocity measurement #3792

@reubenmiller

Description

@reubenmiller

Is your feature improvement request related to a problem? Please describe.

If the tedge-mapper-c8y publishes a measurement which contains a . (full stop) in either the measurement value fragment, or value fragment series, then the created measurement is incompatible with some of the Cumulocity measurement series API which is used by the Device Management UI, and shows an error every time a user opens the Device Management Measurements page.

Below shows an example of the Cumulocity Device Management error which the user is faced with in such a scenario.

Image

The Cumulocity OpenAPI states the following about using special characters within the fragment and series names:

⚠️ Important: Property names used for fragment and series must not contain whitespaces nor the special characters . , * [ ] ( ) @ $. This is required to ensure a correct processing and visualization of measurement series on UI graphs.

Example tedge payload which is converted to a Cumulocity measurement incorrectly

The following show an example where the tedge measurement is published (and is valid), but when transformed to a Cumulocity measurement.

tedge mqtt pub 'te/device/main///m/example' '{
    "example.some.value": 12.0
}'

Describe the solution you'd like

The tedge-mapper-c8y should substitute any of the following characters with an underscore (_) when sending the measurement to Cumulocity.

  • whitespace
  • ., * [ ] ( ) @ $

Example

tedge mqtt pub 'te/device/main///m/example' '{
    "example.some.value": 12.0
}'
[c8y/s/us] {
    "example_some_value": {
        "example_some_value": {
            "value": 12.0,
        }
    }
}'

Describe alternatives you've considered

Alternatively thin-edge.io could reject the measurement, however this would result in a loss of the measurements if the data being published is not under the user's control. For instance, some of the collectd data which is published includes a full stop . in the metrics names. The user is unable to change the format of the collectd data, so it would result in the data not being published to Cumulocity at all.

Additional context

Metadata

Metadata

Assignees

No one assigned

    Labels

    improvementUser valuetheme:c8yTheme: Cumulocity related topics

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions