Module: AnalyticsOps::Configuration
- Defined in:
- lib/analytics_ops/configuration.rb,
lib/analytics_ops/configuration/loader.rb,
lib/analytics_ops/configuration/schema.rb,
lib/analytics_ops/configuration/writer.rb,
lib/analytics_ops/configuration/document.rb,
lib/analytics_ops/configuration/validator.rb,
lib/analytics_ops/configuration/validator_reporting.rb,
lib/analytics_ops/configuration/validator_experimental.rb,
sig/analytics_ops.rbs
Overview
Strict versioned desired-state loading.
Defined Under Namespace
Classes: Document, Loader, Validator, Writer
Constant Summary collapse
- SCHEMA =
Public machine-readable summary. Runtime validation also enforces cross-field identity rules and printable user-visible values.
Canonical.deep_freeze( "$schema" => "https://json-schema.org/draft/2020-12/schema", "$id" => "https://github.com/nelsonchaves/analytics_ops/blob/master/docs/configuration-schema-v1.json", "title" => "Analytics Ops configuration version 1", "type" => "object", "additionalProperties" => false, "required" => %w[version profiles], "properties" => { "version" => { "const" => 1 }, "profiles" => { "type" => "object", "minProperties" => 1, "propertyNames" => { "pattern" => "^[A-Za-z][A-Za-z0-9_]{0,63}$" }, "additionalProperties" => { "$ref" => "#/$defs/profile" } } }, "$defs" => { "id" => { "type" => "string", "pattern" => "^(?:[0-9]{1,50}|\\$\\{[A-Z][A-Z0-9_]*\\})$" }, "profile" => { "type" => "object", "additionalProperties" => false, "required" => ["property_id"], "properties" => { "property_id" => { "$ref" => "#/$defs/id" }, "streams" => { "type" => "object", "propertyNames" => { "pattern" => "^[A-Za-z][A-Za-z0-9_]{0,63}$" }, "additionalProperties" => { "$ref" => "#/$defs/stream" } }, "retention" => { "$ref" => "#/$defs/retention" }, "google_signals" => { "$ref" => "#/$defs/googleSignals" }, "key_events" => { "type" => "array", "uniqueItems" => true, "items" => { "type" => "string", "pattern" => "^[A-Za-z][A-Za-z0-9_]{0,39}$" } }, "custom_dimensions" => { "type" => "array", "items" => { "$ref" => "#/$defs/customDimension" } }, "custom_metrics" => { "type" => "array", "items" => { "$ref" => "#/$defs/customMetric" } }, "manual_requirements" => { "type" => "array", "uniqueItems" => true, "items" => { "type" => "string", "pattern" => "^[A-Za-z][A-Za-z0-9_]{0,63}$" } }, "labels" => { "$ref" => "#/$defs/labels" }, "reports" => { "$ref" => "#/$defs/reports" }, "health" => { "$ref" => "#/$defs/health" }, "governance" => { "$ref" => "#/$defs/governance" }, "bigquery" => { "$ref" => "#/$defs/bigquery" }, "funnels" => { "$ref" => "#/$defs/funnels" } } }, "stream" => { "type" => "object", "additionalProperties" => false, "required" => ["stream_id"], "properties" => { "stream_id" => { "$ref" => "#/$defs/id" }, "default_uri" => { "type" => "string", "maxLength" => 2_048, "pattern" => "^(?:https?://|\\$\\{)" }, "enhanced_measurement" => { "type" => "object", "additionalProperties" => false, "required" => %w[enabled experimental], "properties" => { "enabled" => { "type" => "boolean" }, "experimental" => { "const" => true } } } } }, "retention" => { "type" => "object", "additionalProperties" => false, "required" => %w[event_data user_data reset_on_new_activity], "properties" => { "event_data" => { "$ref" => "#/$defs/retentionValue" }, "user_data" => { "$ref" => "#/$defs/userRetentionValue" }, "reset_on_new_activity" => { "type" => "boolean" } } }, "retentionValue" => { "enum" => Configuration::Validator::RETENTION_VALUES }, "userRetentionValue" => { "enum" => Configuration::Validator::USER_RETENTION_VALUES }, "googleSignals" => { "type" => "object", "additionalProperties" => false, "required" => %w[state experimental], "properties" => { "state" => { "enum" => %w[enabled disabled] }, "experimental" => { "const" => true } } }, "customDimension" => { "type" => "object", "additionalProperties" => false, "required" => %w[parameter_name display_name scope], "properties" => { "parameter_name" => { "type" => "string", "pattern" => "^[A-Za-z][A-Za-z0-9_]{0,39}$" }, "display_name" => { "type" => "string", "pattern" => "^[A-Za-z][A-Za-z0-9_ ]{0,81}$" }, "description" => { "type" => "string", "maxLength" => 150, "pattern" => "^[^\\u0000-\\u001F\\u007F]*$" }, "scope" => { "enum" => Configuration::Validator::DIMENSION_SCOPES }, "disallow_ads_personalization" => { "type" => "boolean" } }, "allOf" => [ { "if" => { "properties" => { "scope" => { "const" => "user" } } }, "then" => { "properties" => { "parameter_name" => { "type" => "string", "pattern" => "^[A-Za-z][A-Za-z0-9_]{0,23}$" } } } }, { "if" => { "required" => ["disallow_ads_personalization"], "properties" => { "disallow_ads_personalization" => { "const" => true } } }, "then" => { "properties" => { "scope" => { "const" => "user" } } } } ] }, "customMetric" => { "type" => "object", "additionalProperties" => false, "required" => %w[parameter_name display_name scope], "properties" => { "parameter_name" => { "type" => "string", "pattern" => "^[A-Za-z][A-Za-z0-9_]{0,39}$" }, "display_name" => { "type" => "string", "pattern" => "^[A-Za-z][A-Za-z0-9_ ]{0,81}$" }, "description" => { "type" => "string", "maxLength" => 150, "pattern" => "^[^\\u0000-\\u001F\\u007F]*$" }, "scope" => { "const" => "event" }, "measurement_unit" => { "enum" => Configuration::Validator::METRIC_UNITS }, "restricted_metric_types" => { "type" => "array", "uniqueItems" => true, "items" => { "enum" => Configuration::Validator::RESTRICTED_METRIC_TYPES } } }, "allOf" => [ { "if" => { "required" => ["measurement_unit"], "properties" => { "measurement_unit" => { "const" => "currency" } } }, "then" => { "required" => ["restricted_metric_types"], "properties" => { "restricted_metric_types" => { "minItems" => 1 } } }, "else" => { "properties" => { "restricted_metric_types" => { "maxItems" => 0 } } } } ] }, "labels" => { "type" => "object", "maxProperties" => 16, "propertyNames" => { "pattern" => "^[A-Za-z][A-Za-z0-9_]{0,63}$" }, "additionalProperties" => { "type" => "string", "minLength" => 1, "maxLength" => 64, "pattern" => "^[^\\u0000-\\u001F\\u007F]+$" } }, "apiName" => { "type" => "string", "pattern" => "^[a-z][a-zA-Z0-9_]*(?::[a-zA-Z][a-zA-Z0-9_]*)?$" }, "dateRange" => { "type" => "object", "additionalProperties" => false, "required" => %w[start_date end_date], "properties" => { "start_date" => { "type" => "string" }, "end_date" => { "type" => "string" }, "name" => { "type" => "string", "pattern" => "^[a-z][a-z0-9_]{0,39}$" } } }, "filterExpression" => { "oneOf" => [ { "type" => "object", "additionalProperties" => false, "required" => ["and"], "properties" => { "and" => { "type" => "array", "minItems" => 2, "maxItems" => 20, "items" => { "$ref" => "#/$defs/filterExpression" } } } }, { "type" => "object", "additionalProperties" => false, "required" => ["or"], "properties" => { "or" => { "type" => "array", "minItems" => 2, "maxItems" => 20, "items" => { "$ref" => "#/$defs/filterExpression" } } } }, { "type" => "object", "additionalProperties" => false, "required" => ["not"], "properties" => { "not" => { "$ref" => "#/$defs/filterExpression" } } }, { "type" => "object", "required" => ["field"], "properties" => { "field" => { "$ref" => "#/$defs/apiName" }, "match_type" => { "enum" => Reports::Definition::MATCH_TYPES }, "value" => { "type" => %w[string number] }, "case_sensitive" => { "type" => "boolean" }, "in_list" => { "type" => "array", "minItems" => 1, "maxItems" => 100, "uniqueItems" => true, "items" => { "type" => "string" } }, "operation" => { "enum" => Reports::Definition::NUMERIC_OPERATIONS }, "between" => { "type" => "array", "minItems" => 2, "maxItems" => 2, "items" => { "type" => "number" } }, "null" => { "const" => true } }, "additionalProperties" => false } ] }, "report" => { "type" => "object", "additionalProperties" => false, "required" => ["metrics"], "properties" => { "kind" => { "enum" => Reports::Definition::KINDS }, "dimensions" => { "type" => "array", "maxItems" => 9, "uniqueItems" => true, "items" => { "$ref" => "#/$defs/apiName" } }, "metrics" => { "type" => "array", "minItems" => 1, "maxItems" => 10, "uniqueItems" => true, "items" => { "$ref" => "#/$defs/apiName" } }, "date_ranges" => { "type" => "array", "maxItems" => 4, "items" => { "$ref" => "#/$defs/dateRange" } }, "dimension_filter" => { "$ref" => "#/$defs/filterExpression" }, "metric_filter" => { "$ref" => "#/$defs/filterExpression" }, "order_bys" => { "type" => "array", "maxItems" => 10, "items" => { "type" => "object" } }, "limit" => { "type" => "integer", "minimum" => 1, "maximum" => 250_000 } } }, "reports" => { "type" => "object", "maxProperties" => 50, "propertyNames" => { "pattern" => "^[A-Za-z][A-Za-z0-9_]{0,63}$" }, "additionalProperties" => { "$ref" => "#/$defs/report" } }, "health" => { "type" => "object", "additionalProperties" => false, "properties" => { "expected_events" => { "type" => "array", "uniqueItems" => true, "items" => { "type" => "string", "pattern" => "^[A-Za-z][A-Za-z0-9_]{0,39}$" } }, "minimum_sessions" => { "type" => "integer", "minimum" => 0, "maximum" => 1_000_000_000 }, "traffic_drop_percent" => { "type" => "number", "minimum" => 0, "maximum" => 100 }, "key_event_drop_percent" => { "type" => "number", "minimum" => 0, "maximum" => 100 }, "unassigned_percent" => { "type" => "number", "minimum" => 0, "maximum" => 100 }, "not_set_percent" => { "type" => "number", "minimum" => 0, "maximum" => 100 } } }, "governance" => { "type" => "object", "additionalProperties" => false, "required" => ["experimental"], "properties" => { "experimental" => { "const" => true }, "enhanced_measurement_required" => { "type" => "boolean" }, "email_redaction_required" => { "type" => "boolean" }, "query_parameter_redaction_required" => { "type" => "boolean" }, "reporting_identity" => { "enum" => %w[blended observed device_based] }, "bigquery_link_required" => { "type" => "boolean" }, "expected_channel_groups" => { "$ref" => "#/$defs/stringList" }, "expected_calculated_metrics" => { "$ref" => "#/$defs/stringList" }, "expected_event_create_rules" => { "$ref" => "#/$defs/stringList" }, "expected_event_edit_rules" => { "$ref" => "#/$defs/stringList" } } }, "stringList" => { "type" => "array", "uniqueItems" => true, "items" => { "type" => "string", "minLength" => 1, "maxLength" => 128 } }, "bigquery" => { "type" => "object", "additionalProperties" => false, "required" => %w[project_id dataset maximum_bytes_billed experimental], "properties" => { "project_id" => { "type" => "string", "pattern" => "^[a-z][a-z0-9-]{4,28}[a-z0-9]$" }, "dataset" => { "type" => "string", "pattern" => "^[A-Za-z_][A-Za-z0-9_]{0,1023}$" }, "location" => { "type" => "string", "pattern" => "^[A-Za-z][A-Za-z0-9-]{0,31}$" }, "maximum_bytes_billed" => { "type" => "integer", "minimum" => 1, "maximum" => 10_000_000_000_000_000 }, "experimental" => { "const" => true } } }, "funnelStep" => { "type" => "object", "additionalProperties" => false, "required" => %w[name event_name], "properties" => { "name" => { "type" => "string", "minLength" => 1, "maxLength" => 64 }, "event_name" => { "type" => "string", "pattern" => "^[A-Za-z][A-Za-z0-9_]{0,39}$" } } }, "funnel" => { "type" => "object", "additionalProperties" => false, "required" => %w[steps experimental], "properties" => { "steps" => { "type" => "array", "minItems" => 2, "maxItems" => 10, "items" => { "$ref" => "#/$defs/funnelStep" } }, "experimental" => { "const" => true } } }, "funnels" => { "type" => "object", "maxProperties" => 20, "propertyNames" => { "pattern" => "^[A-Za-z][A-Za-z0-9_]{0,63}$" }, "additionalProperties" => { "$ref" => "#/$defs/funnel" } } } )