Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
trask committed Aug 28, 2022
1 parent 494261c commit 3b5a80c
Showing 1 changed file with 14 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import com.microsoft.applicationinsights.smoketest.schemav2.Data;
import com.microsoft.applicationinsights.smoketest.schemav2.Domain;
import com.microsoft.applicationinsights.smoketest.schemav2.Envelope;
import com.microsoft.applicationinsights.smoketest.schemav2.MessageData;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
Expand Down Expand Up @@ -222,18 +223,26 @@ public List<Envelope> waitForItemsInOperation(
return waitForItems(type, numItems, operationId, condition);
}

// TODO (trask) can remove operationId in majority of cases now that restricted to "smoketestapp"
// logger?
//
// this is used to filter out some sporadic messages that are captured via java.util.logging
// instrumentation
public List<Envelope> waitForMessageItemsInRequest(int numItems, String operationId)
throws ExecutionException, InterruptedException, TimeoutException {
List<Envelope> items =
waitForItems(
new Predicate<Envelope>() {
@Override
public boolean test(Envelope input) {
return input.getData().getBaseType().equals("MessageData")
&& operationId.equals(input.getTags().get("ai.operation.id"));
input -> {
if (!operationId.equals(input.getTags().get("ai.operation.id"))) {
return false;
}
Data<?> data = (Data<?>) input.getData();
if (!data.getBaseType().equals("MessageData")) {
return false;
}
MessageData messageData = (MessageData) data.getBaseData();
String loggerName = messageData.getProperties().get("LoggerName");
return loggerName != null && loggerName.equals("smoketestapp");
},
numItems,
10,
Expand Down

0 comments on commit 3b5a80c

Please sign in to comment.