Skip to content

Commit 653fb68

Browse files
#282 Implement N+1 insight V1 (endpoint version without links)
1 parent 1a183bc commit 653fb68

File tree

21 files changed

+193
-64
lines changed

21 files changed

+193
-64
lines changed

ide-common/src/main/java/org/digma/intellij/plugin/insights/view/BuildersHolder.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ private ListViewItemBuilder<? extends CodeObjectInsight> newBuilder(InsightType
5555
return new GroupListViewItemBuilder<HighUsageInsight>(InsightGroupType.HttpEndpoint, HighUsageInsight::getRoute, HighUsageInsight::getEndpointSpan);
5656
case SlowEndpoint:
5757
return new GroupListViewItemBuilder<SlowEndpointInsight>(InsightGroupType.HttpEndpoint, SlowEndpointInsight::getRoute, SlowEndpointInsight::getEndpointSpan);
58+
case EndpointSpaNPlusOne:
59+
return new GroupListViewItemBuilder<EPNPlusSpansInsight>(InsightGroupType.HttpEndpoint, EPNPlusSpansInsight::getRoute, EPNPlusSpansInsight::getEndpointSpan);
5860
case Unmapped:
5961
return new NoGroupListViewItemBuilder<UnmappedInsight>();
6062
default:

model/src/main/kotlin/org/digma/intellij/plugin/model/model.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ enum class InsightType {
2727
NormalUsage,
2828
HighUsage,
2929
SlowEndpoint,
30+
EndpointSpaNPlusOne,
3031
Unmapped,
3132
TopErrorFlows,
3233
SpanDurationChange,

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
@@ -23,6 +23,7 @@ import java.util.*
2323
JsonSubTypes.Type(value = LowUsageInsight::class, name = "LowUsage"),
2424
JsonSubTypes.Type(value = NormalUsageInsight::class, name = "NormalUsage"),
2525
JsonSubTypes.Type(value = HighUsageInsight::class, name = "HighUsage"),
26+
JsonSubTypes.Type(value = EPNPlusSpansInsight::class, name = "EndpointSpaNPlusOne"),
2627
JsonSubTypes.Type(value = SlowEndpointInsight::class, name = "SlowEndpoint"),
2728
JsonSubTypes.Type(value = SpanScalingInsight::class, name = "SpanScaling"),
2829
JsonSubTypes.Type(value = SpanDurationsInsight::class, name = "SpanDurations"),
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
package org.digma.intellij.plugin.model.rest.insights
2+
3+
import com.fasterxml.jackson.annotation.JsonCreator
4+
import org.digma.intellij.plugin.model.InsightType
5+
import java.beans.ConstructorProperties
6+
import java.util.*
7+
8+
data class EPNPlusSpansInsight
9+
@JsonCreator(mode = JsonCreator.Mode.PROPERTIES)
10+
@ConstructorProperties(
11+
"codeObjectId",
12+
"environment",
13+
"scope",
14+
"importance",
15+
"decorators",
16+
"route",
17+
"endpointSpan",
18+
"actualStartTime",
19+
"customStartTime",
20+
"prefixedCodeObjectId",
21+
"spans",
22+
)
23+
constructor(
24+
override val codeObjectId: String,
25+
override val environment: String,
26+
override val scope: String,
27+
override val importance: Int,
28+
override val decorators: List<CodeObjectDecorator>?,
29+
override var route: String,
30+
override var endpointSpan: String,
31+
override val actualStartTime: Date?,
32+
override val customStartTime: Date?,
33+
override val prefixedCodeObjectId: String?,
34+
val spans: List<HighlyOccurringSpanInfo>,
35+
) : EndpointInsight {
36+
override val type: InsightType = InsightType.EndpointSpaNPlusOne
37+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
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 HighlyOccurringSpanInfo
9+
@JsonCreator(mode = JsonCreator.Mode.PROPERTIES)
10+
@ConstructorProperties("occurrences", "internalSpan", "clientSpan", "traceId", "duration", "fraction")
11+
constructor(
12+
val occurrences: Double,
13+
val internalSpan: SpanInfo,
14+
val clientSpan: SpanInfo,
15+
val traceId: String,
16+
val duration: Duration,
17+
val fraction: Double,
18+
)

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,5 @@ constructor(val spanInfo: SpanInfo,
1212
val p50: Percentile, // Obsolete
1313
val p95: Percentile, // Obsolete
1414
val p99: Percentile, // Obsolete
15-
val ProbabilityOfBeingBottleneck: Double?,
16-
val AvgDurationWhenBeingBottleneck: Duration?)
15+
val probabilityOfBeingBottleneck: Double?,
16+
val avgDurationWhenBeingBottleneck: Duration?)

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@ data class SpanInfo
1010
@ConstructorProperties("instrumentationLibrary", "name", "displayName", "serviceName", "codeObjectId")
1111
constructor(val instrumentationLibrary: String,
1212
val name: String,
13-
val displayName: String,
13+
val displayName: String?,
1414
val serviceName: String?,
1515
val codeObjectId: String?)

model/src/main/kotlin/org/digma/intellij/plugin/ui/model/insights/InsightListViewItem.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ open class InsightListViewItem<INSIGHT : CodeObjectInsight>(insight: INSIGHT) :
2222
InsightType.SpanEndpointBottleneck -> 67
2323
InsightType.SpanDurationBreakdown -> 68
2424
// HTTP Endpoints
25+
InsightType.EndpointSpaNPlusOne -> 55
2526
InsightType.SlowestSpans -> 40
2627
InsightType.LowUsage -> 30
2728
InsightType.NormalUsage -> 50

src/main/kotlin/org/digma/intellij/plugin/ui/common/HtmlUtil.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ fun asHtmlNoBoby(value: String): String{
1414
}
1515

1616

17-
fun asHtml(content: String): String {
18-
return "<html><body>${content}</body>"
17+
fun asHtml(content: String?): String {
18+
return "<html><body>${content.orEmpty()}</body>"
1919
}
2020

2121

src/main/kotlin/org/digma/intellij/plugin/ui/common/Laf.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import com.intellij.icons.AllIcons
44
import com.intellij.ui.JBColor
55
import com.intellij.util.ui.JBUI
66
import org.digma.intellij.plugin.icons.IconsUtil
7+
import org.digma.intellij.plugin.ui.common.Laf.Sizes.Companion.BUTTON_SIZE_24
78
import org.digma.intellij.plugin.ui.common.Laf.Sizes.Companion.INSIGHT_ICON_SIZE_32
89
import org.digma.intellij.plugin.ui.list.insights.ThreeDotsIcon
910
import java.awt.Color
@@ -93,6 +94,7 @@ object Laf {
9394
@JvmStatic val ERRORS = SvgIcon.asIs("/icons/errors.svg")
9495
@JvmStatic val HOTSPOT = SvgIcon.asIs("/icons/hotspot.svg")
9596
@JvmStatic val LOW_USAGE = SvgIcon.asIs("/icons/traffic-low.svg")
97+
@JvmStatic val N_PLUS_ONE = loadAndScaleIconByWidth("/icons/sql.png", BUTTON_SIZE_24)
9698
@JvmStatic val NORMAL_USAGE = SvgIcon.asIs("/icons/traffic-normal.svg")
9799
@JvmStatic val HIGH_USAGE = SvgIcon.asIs("/icons/traffic-high.svg")
98100
@JvmStatic val WAITING_DATA = SvgIcon.asIs("/icons/sand-watch.svg")

0 commit comments

Comments
 (0)