Skip to content

Commit

Permalink
scrub raw messages before passing to sentry so we have a chance of se…
Browse files Browse the repository at this point in the history
…eing them
  • Loading branch information
timcowlishaw committed Oct 27, 2023
1 parent af9a720 commit b85375a
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions app/lib/mqtt_messages_handler.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ def self.handle_topic(topic, message)
crumb = Sentry::Breadcrumb.new(
category: "MqttMessagesHandler.handle_topic",
message: "Handling topic #{topic}",
data: { topic: topic, message: message }
data: { topic: topic, message: message.scrub }
)
Sentry.add_breadcrumb(crumb)

Expand Down Expand Up @@ -33,7 +33,7 @@ def self.handle_topic(topic, message)
message: "Parsing info message",
data: {
topic: topic,
message: message,
message: message.scrub,
json: json_message,
device_id: device.id
}
Expand Down Expand Up @@ -62,7 +62,7 @@ def self.parse_raw_readings(message, device_id=nil)
crumb = Sentry::Breadcrumb.new(
category: "MqttMessagesHandler.parse_raw_readings",
message: "Parsing raw readings",
data: { message: message, device_id: device_id }
data: { message: message.scrub, device_id: device_id }
)
Sentry.add_breadcrumb(crumb)
clean_tm = message[1..-2].split(",")[0].gsub("t:", "").strip
Expand All @@ -79,7 +79,7 @@ def self.parse_raw_readings(message, device_id=nil)
crumb = Sentry::Breadcrumb.new(
category: "MqttMessagesHandler.parse_raw_readings",
message: "Readings data constructed",
data: { message: message, reading: reading, device_id: device_id }
data: { message: message.scrub, reading: reading, device_id: device_id }
)
Sentry.add_breadcrumb(crumb)

Expand Down

0 comments on commit b85375a

Please sign in to comment.