diff --git a/integrations/Gemfile.lock b/integrations/Gemfile.lock index 846de3fe..13f1c643 100644 --- a/integrations/Gemfile.lock +++ b/integrations/Gemfile.lock @@ -7,7 +7,7 @@ GIT PATH remote: . specs: - multiwoven-integrations (0.7.1) + multiwoven-integrations (0.7.2) activesupport async-websocket aws-sdk-athena diff --git a/integrations/lib/multiwoven/integrations/destination/maria_db/client.rb b/integrations/lib/multiwoven/integrations/destination/maria_db/client.rb index ccb74107..955f5371 100644 --- a/integrations/lib/multiwoven/integrations/destination/maria_db/client.rb +++ b/integrations/lib/multiwoven/integrations/destination/maria_db/client.rb @@ -41,6 +41,7 @@ def write(sync_config, records, action = "destination_insert") primary_key = sync_config.model.primary_key db = create_connection(connection_config) + log_message_array = [] write_success = 0 write_failure = 0 @@ -50,6 +51,7 @@ def write(sync_config, records, action = "destination_insert") begin db.run(query) write_success += 1 + log_message_array << log_request_response("info", query, "Successful") rescue StandardError => e handle_exception(e, { context: "MARIA:DB:RECORD:WRITE:EXCEPTION", @@ -58,9 +60,10 @@ def write(sync_config, records, action = "destination_insert") sync_run_id: sync_config.sync_run_id }) write_failure += 1 + log_message_array << log_request_response("error", query, e.message) end end - tracking_message(write_success, write_failure) + tracking_message(write_success, write_failure, log_message_array) rescue StandardError => e handle_exception(e, { context: "MARIA:DB:RECORD:WRITE:EXCEPTION", @@ -106,12 +109,6 @@ def group_by_table(records) { tablename: entries.first[:tablename], columns: entries.flat_map { |entry| entry[:columns] } } end end - - def tracking_message(success, failure) - Multiwoven::Integrations::Protocol::TrackingMessage.new( - success: success, failed: failure - ).to_multiwoven_message - end end end end diff --git a/integrations/lib/multiwoven/integrations/rollout.rb b/integrations/lib/multiwoven/integrations/rollout.rb index dd0b7129..779161a8 100644 --- a/integrations/lib/multiwoven/integrations/rollout.rb +++ b/integrations/lib/multiwoven/integrations/rollout.rb @@ -2,7 +2,7 @@ module Multiwoven module Integrations - VERSION = "0.7.1" + VERSION = "0.7.2" ENABLED_SOURCES = %w[ Snowflake diff --git a/integrations/spec/multiwoven/integrations/destination/maria_db/client_spec.rb b/integrations/spec/multiwoven/integrations/destination/maria_db/client_spec.rb index fa8e4b0e..81efbf43 100644 --- a/integrations/spec/multiwoven/integrations/destination/maria_db/client_spec.rb +++ b/integrations/spec/multiwoven/integrations/destination/maria_db/client_spec.rb @@ -114,6 +114,12 @@ response = client.write(sync_config, records) expect(response.tracking.success).to eq(records.size) expect(response.tracking.failed).to eq(0) + log_message = response.tracking.logs.first + expect(log_message).to be_a(Multiwoven::Integrations::Protocol::LogMessage) + expect(log_message.level).to eql("info") + + expect(log_message.message).to include("request") + expect(log_message.message).to include("response") end end @@ -135,6 +141,12 @@ response = client.write(sync_config, records) expect(response.tracking.failed).to eq(records.size) expect(response.tracking.success).to eq(0) + log_message = response.tracking.logs.first + expect(log_message).to be_a(Multiwoven::Integrations::Protocol::LogMessage) + expect(log_message.level).to eql("error") + + expect(log_message.message).to include("request") + expect(log_message.message).to include("response") end end end