The Validator#validateNamespace function uses the regex ^[a-zA-Z0-9._#:/-]+$, which does not allow whitespace in namespaces.
However, per CloudWatch docs:
Possible [namespace] characters are: alphanumeric characters (0-9A-Za-z), period (.), hyphen (-), underscore (_), forward slash (/), hash (#), colon (:), and the space character.
Changing this to ^[a-zA-Z0-9 ._#:/-]+$ would solve the problem.
This is an issue for me, as I am trying to upgrade an old codebase from version 1.0 to version 4.0, however we used (out of my control) a namespace with whitespace in it. To retain continuity, and not have to manually finagle with alarms, I'd like to see this changed to allow whitespace.
I can submit PR for this, but want to confirm if this deviation from CloudWatch standard was on purpose?