From 3f527f48136831fb3693aa2a5e2fd5f18ed8ee73 Mon Sep 17 00:00:00 2001 From: Duncan Brown Date: Thu, 21 Apr 2022 15:20:25 +0100 Subject: [PATCH 1/2] Remove event_tags from schema --- config/event-schema.json | 4 ---- 1 file changed, 4 deletions(-) diff --git a/config/event-schema.json b/config/event-schema.json index 34e01db6..e5707986 100644 --- a/config/event-schema.json +++ b/config/event-schema.json @@ -64,10 +64,6 @@ "required": ["key", "value"] } ] - }, - "event_tags": { - "type": "array", - "items" : [ { "type": "string" } ] } }, "additionalProperties": false, From 02dc49c8be7eec84c0f41b3ad844cbba75b4d087 Mon Sep 17 00:00:00 2001 From: Duncan Brown Date: Thu, 21 Apr 2022 15:42:34 +0100 Subject: [PATCH 2/2] Set ignore_unknown when inserting to BQ MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This means that if a schema in BQ lacks a field in our schema, it won’t cause an exception and the (presumably blank) field will just be dropped --- lib/dfe/analytics/send_events.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/dfe/analytics/send_events.rb b/lib/dfe/analytics/send_events.rb index fc103fd6..8c92a79a 100644 --- a/lib/dfe/analytics/send_events.rb +++ b/lib/dfe/analytics/send_events.rb @@ -17,7 +17,7 @@ def perform(events) if DfE::Analytics.log_only? Rails.logger.info('DfE::Analytics: ' + events.inspect) else - DfE::Analytics.events_client.insert(events) + DfE::Analytics.events_client.insert(events, ignore_unknown: true) end end end