Skip to content

Commit 4bf9ff9

Browse files
committed
Added shortDisplayInfo to codeObjectId and use it in SpanScalingInsight
1 parent d9619c9 commit 4bf9ff9

File tree

20 files changed

+68
-21
lines changed

20 files changed

+68
-21
lines changed

analytics-provider/src/test/java/org/digma/intellij/plugin/analytics/InsightsTests.java

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -76,30 +76,30 @@ void getInsights() throws JsonProcessingException {
7676
Date customStartTimeFiveDaysBefore = Date.from(actualStartTimeNow.toInstant().minus(5, ChronoUnit.DAYS));
7777
List<CodeObjectInsight> expectedCodeObjectInsights = new ArrayList<>();
7878

79-
HotspotInsight expectedHotspotInsight = new HotspotInsight(codeObjectId, ENV_1, SCOPE_1, IMPORTANCE_3, null, actualStartTimeNow, customStartTimeFiveDaysBefore, prefixedCodeObjectId, 75);
79+
HotspotInsight expectedHotspotInsight = new HotspotInsight(codeObjectId, ENV_1, SCOPE_1, IMPORTANCE_3, null, actualStartTimeNow, customStartTimeFiveDaysBefore, prefixedCodeObjectId, null, 75);
8080
expectedCodeObjectInsights.add(expectedHotspotInsight);
8181

8282
ErrorInsightNamedError namedError1 = new ErrorInsightNamedError("e0a4d03c-c609-11ec-a9d6-0242ac130006", "System.NullReferenceException", codeObjectId, "Sample.MoneyTransfer.API.Controllers.TransferController$_$TransferFunds");
8383
ErrorInsightNamedError namedError2 = new ErrorInsightNamedError("de63a938-c609-11ec-b388-0242ac130006", "System.Exception", codeObjectId, "Sample.MoneyTransfer.API.Controllers.TransferController$_$TransferFunds");
8484
List<ErrorInsightNamedError> namedErrors = new ArrayList<>();
8585
namedErrors.add(namedError1);
8686
namedErrors.add(namedError2);
87-
ErrorInsight expectedErrorInsight = new ErrorInsight(codeObjectId, ENV_1, SCOPE_1, IMPORTANCE_3, null, actualStartTimeNow, customStartTimeFiveDaysBefore, prefixedCodeObjectId, 1, 0, 0, namedErrors);
87+
ErrorInsight expectedErrorInsight = new ErrorInsight(codeObjectId, ENV_1, SCOPE_1, IMPORTANCE_3, null, actualStartTimeNow, customStartTimeFiveDaysBefore, prefixedCodeObjectId, null, 1, 0, 0, namedErrors);
8888
expectedCodeObjectInsights.add(expectedErrorInsight);
8989

9090
String expectedNormalUsageInsightCodeObjectId = "Sample.MoneyTransfer.API.Domain.Services.MoneyTransferDomainService$_$TransferFunds";
9191
NormalUsageInsight expectedNormalUsageInsight = new NormalUsageInsight( expectedNormalUsageInsightCodeObjectId, ENV_1, SCOPE_1, IMPORTANCE_3, null,
92-
ROUTE, ENDPOINT_SPAN, actualStartTimeNow, customStartTimeFiveDaysBefore, addPrefixToCodeObjectId(expectedNormalUsageInsightCodeObjectId), 40);
92+
ROUTE, ENDPOINT_SPAN, actualStartTimeNow, customStartTimeFiveDaysBefore, addPrefixToCodeObjectId(expectedNormalUsageInsightCodeObjectId), null, 40);
9393
expectedCodeObjectInsights.add(expectedNormalUsageInsight);
9494

9595
String expectedLowUsageInsightCodeObjectId = "Sample.MoneyTransfer.API.Domain.Services.MoneyTransferDomainService$_$Abc";
9696
LowUsageInsight expectedLowUsageInsight = new LowUsageInsight( expectedLowUsageInsightCodeObjectId, ENV_1, SCOPE_1, IMPORTANCE_3, null,
97-
ROUTE, ENDPOINT_SPAN, actualStartTimeNow, customStartTimeFiveDaysBefore, addPrefixToCodeObjectId(expectedLowUsageInsightCodeObjectId), 13);
97+
ROUTE, ENDPOINT_SPAN, actualStartTimeNow, customStartTimeFiveDaysBefore, addPrefixToCodeObjectId(expectedLowUsageInsightCodeObjectId), null, 13);
9898
expectedCodeObjectInsights.add(expectedLowUsageInsight);
9999

100100
String expectedHighUsageInsightCodeObjectId = "Sample.MoneyTransfer.API.Domain.Services.MoneyTransferDomainService$_$Defg";
101101
HighUsageInsight expectedHighUsageInsight = new HighUsageInsight( expectedHighUsageInsightCodeObjectId, ENV_1, SCOPE_1, IMPORTANCE_3, null,
102-
ROUTE, ENDPOINT_SPAN, actualStartTimeNow, customStartTimeFiveDaysBefore, addPrefixToCodeObjectId(expectedHighUsageInsightCodeObjectId), 98);
102+
ROUTE, ENDPOINT_SPAN, actualStartTimeNow, customStartTimeFiveDaysBefore, addPrefixToCodeObjectId(expectedHighUsageInsightCodeObjectId), null, 98);
103103
expectedCodeObjectInsights.add(expectedHighUsageInsight);
104104

105105
SpanInfo spanInfo = new SpanInfo("Retrieving account", "Retrieving account", "MoneyTransferDomainService", "Sample.MoneyTransfer.API","Sample.MoneyTransfer.API.MoneyTransferDomainService$_$Error");
@@ -111,7 +111,7 @@ void getInsights() throws JsonProcessingException {
111111

112112
String expectedSlowestSpansInsightCodeObjectId = "Sample.MoneyTransfer.API.Domain.Services.MoneyTransferDomainService$_$TransferFunds";
113113
SlowestSpansInsight expectedSlowestSpansInsight = new SlowestSpansInsight( expectedSlowestSpansInsightCodeObjectId, ENV_1, SCOPE_1, IMPORTANCE_3, null,
114-
ROUTE, ENDPOINT_SPAN, actualStartTimeNow, customStartTimeFiveDaysBefore, addPrefixToCodeObjectId(expectedSlowestSpansInsightCodeObjectId), Collections.singletonList(slowSpanInfo));
114+
ROUTE, ENDPOINT_SPAN, actualStartTimeNow, customStartTimeFiveDaysBefore, addPrefixToCodeObjectId(expectedSlowestSpansInsightCodeObjectId), null, Collections.singletonList(slowSpanInfo));
115115
expectedCodeObjectInsights.add(expectedSlowestSpansInsight);
116116

117117
String expectedSlowEndpointInsightCodeObjectId = "Sample.MoneyTransfer.API.Domain.Services.MoneyTransferDomainService$_$TransferFunds";
@@ -126,6 +126,7 @@ void getInsights() throws JsonProcessingException {
126126
, actualStartTimeNow
127127
, customStartTimeFiveDaysBefore
128128
, addPrefixToCodeObjectId(expectedSlowEndpointInsightCodeObjectId)
129+
, null
129130
, new Duration(0.11D, "ms", 11000)
130131
, new Duration(0.12D, "ms", 12000)
131132
, new Duration(0.13D, "ms", 13000)

model/src/main/kotlin/org/digma/intellij/plugin/model/rest/insights/CodeObjectInsight.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,5 @@ interface CodeObjectInsight {
4141
val actualStartTime: Date?
4242
val customStartTime: Date?
4343
val prefixedCodeObjectId: String?
44+
val shortDisplayInfo: ShortDisplayInfo?
4445
}

model/src/main/kotlin/org/digma/intellij/plugin/model/rest/insights/EPNPlusSpansInsight.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ data class EPNPlusSpansInsight
1818
"actualStartTime",
1919
"customStartTime",
2020
"prefixedCodeObjectId",
21+
"shortDisplayInfo",
2122
"spans"
2223
)
2324
constructor(
@@ -31,6 +32,7 @@ constructor(
3132
override val actualStartTime: Date?,
3233
override val customStartTime: Date?,
3334
override val prefixedCodeObjectId: String?,
35+
override val shortDisplayInfo: ShortDisplayInfo?,
3436
val spans: List<HighlyOccurringSpanInfo>,
3537
) : EndpointInsight {
3638
override val type: InsightType = InsightType.EndpointSpaNPlusOne

model/src/main/kotlin/org/digma/intellij/plugin/model/rest/insights/ErrorInsight.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ data class ErrorInsight
1717
"actualStartTime",
1818
"customStartTime",
1919
"prefixedCodeObjectId",
20+
"shortDisplayInfo",
2021
"errorCount",
2122
"unhandledCount",
2223
"unexpectedCount",
@@ -31,6 +32,7 @@ constructor(
3132
override val actualStartTime: Date?,
3233
override val customStartTime: Date?,
3334
override val prefixedCodeObjectId: String?,
35+
override val shortDisplayInfo: ShortDisplayInfo?,
3436
val errorCount: Int = 0,
3537
val unhandledCount: Int = 0,
3638
val unexpectedCount: Int = 0,

model/src/main/kotlin/org/digma/intellij/plugin/model/rest/insights/HighUsageInsight.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ data class HighUsageInsight
1818
"actualStartTime",
1919
"customStartTime",
2020
"prefixedCodeObjectId",
21+
"shortDisplayInfo",
2122
"maxCallsIn1Min")
2223
constructor(
2324
override val codeObjectId: String,
@@ -30,6 +31,7 @@ constructor(
3031
override val actualStartTime: Date?,
3132
override val customStartTime: Date?,
3233
override val prefixedCodeObjectId: String?,
34+
override val shortDisplayInfo: ShortDisplayInfo?,
3335
val maxCallsIn1Min: Int,
3436
) : EndpointInsight {
3537
override val type: InsightType = InsightType.HighUsage

model/src/main/kotlin/org/digma/intellij/plugin/model/rest/insights/HotspotInsight.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ data class HotspotInsight
1717
"actualStartTime",
1818
"customStartTime",
1919
"prefixedCodeObjectId",
20+
"shortDisplayInfo",
2021
"score"
2122
)
2223
constructor(
@@ -28,6 +29,7 @@ constructor(
2829
override val actualStartTime: Date?,
2930
override val customStartTime: Date?,
3031
override val prefixedCodeObjectId: String?,
32+
override val shortDisplayInfo: ShortDisplayInfo?,
3133
val score: Int = 0,
3234
) : CodeObjectInsight {
3335

model/src/main/kotlin/org/digma/intellij/plugin/model/rest/insights/LowUsageInsight.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ data class LowUsageInsight
1818
"actualStartTime",
1919
"customStartTime",
2020
"prefixedCodeObjectId",
21+
"shortDisplayInfo",
2122
"maxCallsIn1Min"
2223
)
2324
constructor(
@@ -31,6 +32,7 @@ constructor(
3132
override val actualStartTime: Date?,
3233
override val customStartTime: Date?,
3334
override val prefixedCodeObjectId: String?,
35+
override val shortDisplayInfo: ShortDisplayInfo?,
3436
val maxCallsIn1Min: Int,
3537
) : EndpointInsight {
3638
override val type: InsightType = InsightType.LowUsage

model/src/main/kotlin/org/digma/intellij/plugin/model/rest/insights/NormalUsageInsight.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ data class NormalUsageInsight
1818
"actualStartTime",
1919
"customStartTime",
2020
"prefixedCodeObjectId",
21+
"shortDisplayInfo",
2122
"maxCallsIn1Min"
2223
)
2324
constructor(
@@ -31,6 +32,7 @@ constructor(
3132
override val actualStartTime: Date?,
3233
override val customStartTime: Date?,
3334
override val prefixedCodeObjectId: String?,
35+
override val shortDisplayInfo: ShortDisplayInfo?,
3436
val maxCallsIn1Min: Int,
3537
) : EndpointInsight {
3638
override val type: InsightType = InsightType.NormalUsage
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package org.digma.intellij.plugin.model.rest.insights
2+
3+
import com.fasterxml.jackson.annotation.JsonCreator
4+
import com.fasterxml.jackson.annotation.JsonIgnoreProperties
5+
import java.beans.ConstructorProperties
6+
7+
@JsonIgnoreProperties(ignoreUnknown = true)
8+
data class ShortDisplayInfo
9+
@JsonCreator(mode = JsonCreator.Mode.PROPERTIES)
10+
@ConstructorProperties(
11+
"title",
12+
"targetDisplayName",
13+
"subtitle",
14+
"description",
15+
)
16+
constructor(
17+
val title: String?,
18+
val targetDisplayName: String?,
19+
val subtitle: String?,
20+
val description: String?
21+
)

model/src/main/kotlin/org/digma/intellij/plugin/model/rest/insights/SlowEndpointInsight.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ data class SlowEndpointInsight
1818
"actualStartTime",
1919
"customStartTime",
2020
"prefixedCodeObjectId",
21+
"shortDisplayInfo",
2122
"endpointsMedian",
2223
"endpointsMedianOfMedians",
2324
"endpointsMedianOfP75",
@@ -41,6 +42,7 @@ constructor(
4142
override val actualStartTime: Date?,
4243
override val customStartTime: Date?,
4344
override val prefixedCodeObjectId: String?,
45+
override val shortDisplayInfo: ShortDisplayInfo?,
4446
val endpointsMedian: Duration,
4547
val endpointsMedianOfMedians: Duration,
4648
val endpointsMedianOfP75: Duration,

0 commit comments

Comments
 (0)