Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public void testGetStackTracesUnfiltered() throws Exception {
);
GetFlamegraphResponse response = client().execute(GetFlamegraphAction.INSTANCE, request).get();
// only spot-check top level properties - detailed tests are done in unit tests
assertEquals(1010, response.getSize());
assertEquals(1008, response.getSize());
assertEquals(1.0d, response.getSamplingRate(), 0.001d);
assertEquals(46, response.getSelfCPU());
assertEquals(1995, response.getTotalCPU());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public void testGetTopNFunctionsUnfiltered() throws Exception {
);
request.setAdjustSampleCount(true);
GetTopNFunctionsResponse response = client().execute(GetTopNFunctionsAction.INSTANCE, request).get();
assertEquals(747, response.getTopN().size());
assertEquals(671, response.getTopN().size());
}

public void testGetTopNFunctionsGroupedByServiceName() throws Exception {
Expand Down Expand Up @@ -76,6 +76,6 @@ public void testGetTopNFunctionsFromAPM() throws Exception {
null
);
GetTopNFunctionsResponse response = client().execute(GetTopNFunctionsAction.INSTANCE, request).get();
assertEquals(45, response.getTopN().size());
assertEquals(42, response.getTopN().size());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,10 @@ public static String getBasenameAndParent(String fullPath) {

public static String create(String fileId, Integer addressOrLine, String exeFilename, String sourceFilename, String functionName) {
if (Strings.isEmpty(functionName)) {
return Integer.toString(Objects.hash(fileId, addressOrLine));
if (Strings.isEmpty(exeFilename)) {
return Integer.toString(Objects.hash(fileId, addressOrLine));
}
return Integer.toString(Objects.hash(exeFilename));
}
if (Strings.isEmpty(sourceFilename)) {
return Integer.toString(Objects.hash(fileId, functionName));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,19 +62,21 @@ public void testCreateFlamegraph() {
assertEquals(1.0d, response.getSamplingRate(), 0.001d);
assertEquals(List.of(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L), response.getCountInclusive());
assertEquals(List.of(0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 1L), response.getCountExclusive());
// {145245218=3}, {145245218=4}, {145245218=5}, {145245218=6}, {145245218=7}, {145245218=8}, {145245218=9}, {145245218=10},
// {145245218=11}
assertEquals(
List.of(
Map.of("1220", 1),
Map.of("1219", 2),
Map.of("174640828", 3),
Map.of("181190529", 4),
Map.of("181192637", 5),
Map.of("180652335", 6),
Map.of("180479184", 7),
Map.of("180475689", 8),
Map.of("174846197", 9),
Map.of("175515318", 10),
Map.of("178196121", 11),
Map.of("145245218", 3),
Map.of("145245218", 4),
Map.of("145245218", 5),
Map.of("145245218", 6),
Map.of("145245218", 7),
Map.of("145245218", 8),
Map.of("145245218", 9),
Map.of("145245218", 10),
Map.of("145245218", 11),
Map.of()
),
response.getEdges()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,26 +60,13 @@ public void testCreateAllTopNFunctions() {
GetTopNFunctionsResponse response = TransportGetTopNFunctionsAction.buildTopNFunctions(stacktraces, null);
assertNotNull(response);
assertEquals(1, response.getSelfCount());
assertEquals(9, response.getTotalCount());
assertEquals(1, response.getTotalCount());

List<TopNFunction> topNFunctions = response.getTopN();
assertNotNull(topNFunctions);
assertEquals(9, topNFunctions.size());

assertEquals(
List.of(
topN("178196121", 1, 16339645, 1L, 1L, 0.3d, 0.3d, 2.7d, 2.7d),
topN("181192637", 2, 19336161, 0L, 1L, 0.0d, 0.3d, 0.0d, 2.7d),
topN("181190529", 3, 19334053, 0L, 1L, 0.0d, 0.3d, 0.0d, 2.7d),
topN("180652335", 4, 18795859, 0L, 1L, 0.0d, 0.3d, 0.0d, 2.7d),
topN("180479184", 5, 18622708, 0L, 1L, 0.0d, 0.3d, 0.0d, 2.7d),
topN("180475689", 6, 18619213, 0L, 1L, 0.0d, 0.3d, 0.0d, 2.7d),
topN("175515318", 7, 13658842, 0L, 1L, 0.0d, 0.3d, 0.0d, 2.7d),
topN("174846197", 8, 12989721, 0L, 1L, 0.0d, 0.3d, 0.0d, 2.7d),
topN("174640828", 9, 12784352, 0L, 1L, 0.0d, 0.3d, 0.0d, 2.7d)
),
topNFunctions
);
assertEquals(1, topNFunctions.size());

assertEquals(List.of(topN("145245218", 1, 12784352, 1L, 1L, 0.3d, 0.3d, 2.7d, 2.7d)), topNFunctions);
}

public void testCreateTopNFunctionsWithLimit() {
Expand Down Expand Up @@ -129,20 +116,13 @@ public void testCreateTopNFunctionsWithLimit() {
GetTopNFunctionsResponse response = TransportGetTopNFunctionsAction.buildTopNFunctions(stacktraces, 3);
assertNotNull(response);
assertEquals(1, response.getSelfCount());
assertEquals(9, response.getTotalCount());
assertEquals(1, response.getTotalCount());

List<TopNFunction> topNFunctions = response.getTopN();
assertNotNull(topNFunctions);
assertEquals(3, topNFunctions.size());
assertEquals(1, topNFunctions.size());

assertEquals(
List.of(
topN("178196121", 1, 16339645, 1L, 1L, 0.3d, 0.3d, 2.7d, 2.7d),
topN("181192637", 2, 19336161, 0L, 1L, 0.0d, 0.3d, 0.0d, 2.7d),
topN("181190529", 3, 19334053, 0L, 1L, 0.0d, 0.3d, 0.0d, 2.7d)
),
topNFunctions
);
assertEquals(List.of(topN("145245218", 1, 12784352, 1L, 1L, 0.3d, 0.3d, 2.7d, 2.7d)), topNFunctions);
}

private TopNFunction topN(
Expand Down