This is IMHO user error and I’m really not sure if it is correct from the Grafana to modify user input. This type of the problem is also applicable for other fields, not just namespace.
It is common problem when you do copy&paste. Some tools select also space after words, so you pasted word contains the space at the end.
Users will be confused if they really need to use space at the end on purpose.
i understand your sentiment - i was suggesting that in the case of custom metrics for cloudwatch, that the namespace values be trimmed, if they are input with spaces. this is simply because spaces are invalid in cloudwatch dimension names:
Dimension names cannot contain blank spaces or non-ASCII characters.
another option would be to not accept the input if there are spaces in the comma-separated string.
or a callout about that in the little help popup.