Skip to content

Commit

Permalink
Fix missing message data (#2399)
Browse files Browse the repository at this point in the history
  • Loading branch information
trask authored Jul 15, 2022
1 parent 6fab46f commit f8d2b29
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ public void trackTrace(
Map<String, String> properties,
Map<String, String> tags,
@Nullable String instrumentationKey) {
if (Strings.isNullOrEmpty(message)) {
if (message == null) {
return;
}
MessageTelemetryBuilder telemetryBuilder =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,7 @@ private TelemetryItem createMessageTelemetryItem(LogData log) {
setExtraAttributes(telemetryBuilder, attributes);

telemetryBuilder.setSeverityLevel(toSeverityLevel(log.getSeverity()));
String body = log.getBody().asString();
if (body.isEmpty()) {
body = "n/a"; // breeze doesn't accept empty log messages
}
telemetryBuilder.setMessage(body);
telemetryBuilder.setMessage(log.getBody().asString());

// set message-specific properties
setLoggerProperties(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ private MessageTelemetryBuilder(MessageData data) {
}

public void setMessage(String message) {
if (message.trim().isEmpty()) {
// breeze doesn't accept message that is empty after trimming
message = "n/a";
}
data.setMessage(truncateTelemetry(message, MAX_MESSAGE_LENGTH, "Message.message"));
}

Expand Down

0 comments on commit f8d2b29

Please sign in to comment.