Telemetry S3 Path Dimension Specification Parser/Validator

1. Functions

1.1. validate_dimensions

Loads and validates the dimension specification from disk.


  • filename (string) - name of the file containing the JSON dimension specification


  • table - contains the parsed/validated dimensions array with the following modifications
    • header_name is re-mapped to field_name and and field_name values are expanded to 'Fields[name]'
    • matcher_type string is added (wildcard|string|list|minmax)
    • matcher function is added (returns true if a value matches the specification)

1.2. sanitize_dimension

Returns a string suitable for use as an S3 path component.


  • value (string, number, bool) - converted to a string, sanitized and returned


  • string - nil if the value was not convertible to a string

1.3. read_dimension

Returns a sanitized value for a particular dimension


  • dimension (table) - dimension entry
  • variables (table, nil) - optional table containing data for is_variable dimensions


  • string - If the dimension is not found UNKNOWN is returned. If the dimension does not match the allowed_values then OTHER is returned.

2. Dimension Specification

2.1. Sample Dimension Specification

    "version": 1,
    "dimensions": [
      {"header_name": "Type", "allowed_values": "telemetry"},

      {"field_name": "submissionDate", "allowed_values": {"min": "20140120", "max": "20140125"}},
      {"field_name": "sourceName", "allowed_values": "*"},
      {"field_name": "sourceVersion", "allowed_values": "*"},
      {"field_name": "reason", "allowed_values": ["idle-daily", "saved-session"]},
      {"field_name": "appName", "allowed_values": ["Firefox", "Fennec"]},
      {"field_name": "appUpdateChannel", "allowed_values": ["nightly", "beta", "release"]},
      {"field_name": "appVersion", "allowed_values": "*"}
      {"field_name": "experimentId", "allowed_values": "*", "is_variable": true}

Note: This specification does not include:

  • field/array index support
  • pattern matches

source code: s3.lua

results matching ""

    No results matching ""