Skip to content

Commit

Permalink
Merge branch 'main' into cherry-pick-ce-commit-87c1fa2f2a8e15040c25d2…
Browse files Browse the repository at this point in the history
…028e51af933ac4f171
  • Loading branch information
afthabvp committed Aug 21, 2024
2 parents 4d092f8 + 9537945 commit 7e9e82f
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 17 deletions.
4 changes: 0 additions & 4 deletions integrations/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,7 @@ GIT
PATH
remote: .
specs:
<<<<<<< HEAD
multiwoven-integrations (0.8.4)
=======
multiwoven-integrations (0.8.6)
>>>>>>> 87c1fa2f (chore(CE): add request response log for SalesforceCrm (#344))
activesupport
async-websocket
aws-sdk-athena
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,17 @@ def initialize_client(config)
end

def process_records(records, stream)
log_message_array = []
write_success = 0
write_failure = 0
properties = stream.json_schema[:properties]
records.each do |record_object|
record = extract_data(record_object, properties)
klass = @client.const_get(stream.name)
klass.send(@action, record)
args = [stream.name, "Id", record]
klass = @client.const_get(stream.name)
response = klass.send(@action, record)
write_success += 1
log_message_array << log_request_response("info", args, response)
rescue StandardError => e
handle_exception(e, {
context: "STRIPE:CRM:WRITE:EXCEPTION",
Expand All @@ -68,8 +71,9 @@ def process_records(records, stream)
sync_run_id: @sync_config.sync_run_id
})
write_failure += 1
log_message_array << log_request_response("error", args, e.message)
end
tracking_message(write_success, write_failure)
tracking_message(write_success, write_failure, log_message_array)
end

def authenticate_client
Expand All @@ -80,12 +84,6 @@ def load_catalog
read_json(CATALOG_SPEC_PATH)
end

def tracking_message(success, failure)
Multiwoven::Integrations::Protocol::TrackingMessage.new(
success: success, failed: failure
).to_multiwoven_message
end

def log_debug(message)
Multiwoven::Integrations::Service.logger.debug(message)
end
Expand Down
4 changes: 0 additions & 4 deletions integrations/lib/multiwoven/integrations/rollout.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,7 @@

module Multiwoven
module Integrations
<<<<<<< HEAD
VERSION = "0.8.4"
=======
VERSION = "0.8.6"
>>>>>>> 87c1fa2f (chore(CE): add request response log for SalesforceCrm (#344))

ENABLED_SOURCES = %w[
Snowflake
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,12 @@

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

Expand All @@ -111,6 +117,12 @@

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
Expand Down

0 comments on commit 7e9e82f

Please sign in to comment.