mozilla / gcp-ingestion

Documentation and implementation of telemetry ingestion on Google Cloud Platform
https://mozilla.github.io/gcp-ingestion/
Mozilla Public License 2.0
79 stars 32 forks source link

Normalize namespace and docType within ParseUri #1839

Open jklukas opened 3 years ago

jklukas commented 3 years ago

In ParseUri we don't normalize the doctype and namespace names. Instead, we rely on SchemaStore to normalize those attributes when looking up schemas.

This means that the metadata.uri.document_namespace field in BQ may contain weird things like capital letters or extraneous punctuation like ". This sometimes complicates monitoring queries and is generally unexpected behavior. See https://github.com/mozilla/bigquery-etl/pull/2388 for an example of needing to apply normalization.

jklukas commented 3 years ago

SchemaStore uses SnakeCase for normalization, so assuming the BQ form with underscores rather than the ping form with hyphens. So I guess we don't actually have canonical logic implemented for normalizing doctype and namespace URI elements to the hyphenated form.

Another way of looking at this is that our current pipeline behavior is too lenient. We should probably be sending documents to error output if the URI contains extraneous characters like " in the doctype or namespace places. But it's probably a good thing to be tolerant of casing anomalies.