Skip to content

Commit 219d682

Browse files
Build CodeLens via Decorators list + introduce Slow Endpoint codeLen (#109)
1 parent 2aa00ee commit 219d682

File tree

46 files changed

+687
-703
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+687
-703
lines changed

analytics-provider/src/main/java/org/digma/intellij/plugin/analytics/AnalyticsProvider.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@
33
import org.digma.intellij.plugin.model.rest.debugger.DebuggerEventRequest;
44
import org.digma.intellij.plugin.model.rest.errordetails.CodeObjectErrorDetails;
55
import org.digma.intellij.plugin.model.rest.errors.CodeObjectError;
6-
import org.digma.intellij.plugin.model.rest.insights.*;
7-
import org.digma.intellij.plugin.model.rest.summary.CodeObjectSummary;
8-
import org.digma.intellij.plugin.model.rest.summary.CodeObjectSummaryRequest;
6+
import org.digma.intellij.plugin.model.rest.insights.CodeObjectInsight;
7+
import org.digma.intellij.plugin.model.rest.insights.CustomStartTimeInsightRequest;
8+
import org.digma.intellij.plugin.model.rest.insights.GlobalInsight;
9+
import org.digma.intellij.plugin.model.rest.insights.InsightsRequest;
10+
import org.digma.intellij.plugin.model.rest.insights.SpanHistogramQuery;
911
import org.digma.intellij.plugin.model.rest.usage.UsageStatusRequest;
1012
import org.digma.intellij.plugin.model.rest.usage.UsageStatusResult;
1113

@@ -18,8 +20,6 @@ public interface AnalyticsProvider extends Closeable {
1820

1921
void sendDebuggerEvent(DebuggerEventRequest debuggerEventRequest);
2022

21-
List<CodeObjectSummary> getSummaries(CodeObjectSummaryRequest summaryRequest);
22-
2323
List<CodeObjectInsight> getInsights(InsightsRequest insightsRequest);
2424

2525
List<GlobalInsight> getGlobalInsights(InsightsRequest insightsRequest);

analytics-provider/src/main/java/org/digma/intellij/plugin/analytics/RestAnalyticsProvider.java

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,32 @@
99
import org.digma.intellij.plugin.model.rest.debugger.DebuggerEventRequest;
1010
import org.digma.intellij.plugin.model.rest.errordetails.CodeObjectErrorDetails;
1111
import org.digma.intellij.plugin.model.rest.errors.CodeObjectError;
12-
import org.digma.intellij.plugin.model.rest.insights.*;
13-
import org.digma.intellij.plugin.model.rest.summary.CodeObjectSummary;
14-
import org.digma.intellij.plugin.model.rest.summary.CodeObjectSummaryRequest;
12+
import org.digma.intellij.plugin.model.rest.insights.CodeObjectInsight;
13+
import org.digma.intellij.plugin.model.rest.insights.CustomStartTimeInsightRequest;
14+
import org.digma.intellij.plugin.model.rest.insights.GlobalInsight;
15+
import org.digma.intellij.plugin.model.rest.insights.InsightsRequest;
16+
import org.digma.intellij.plugin.model.rest.insights.SpanHistogramQuery;
1517
import org.digma.intellij.plugin.model.rest.usage.UsageStatusRequest;
1618
import org.digma.intellij.plugin.model.rest.usage.UsageStatusResult;
1719
import retrofit2.Call;
1820
import retrofit2.Response;
1921
import retrofit2.Retrofit;
2022
import retrofit2.converter.jackson.JacksonConverterFactory;
21-
import retrofit2.http.*;
22-
23-
import javax.net.ssl.*;
23+
import retrofit2.http.Body;
24+
import retrofit2.http.GET;
25+
import retrofit2.http.Headers;
26+
import retrofit2.http.POST;
27+
import retrofit2.http.PUT;
28+
import retrofit2.http.Path;
29+
import retrofit2.http.Query;
30+
import retrofit2.http.Streaming;
31+
32+
import javax.net.ssl.HostnameVerifier;
33+
import javax.net.ssl.SSLContext;
34+
import javax.net.ssl.SSLSession;
35+
import javax.net.ssl.SSLSocketFactory;
36+
import javax.net.ssl.TrustManager;
37+
import javax.net.ssl.X509TrustManager;
2438
import java.io.Closeable;
2539
import java.io.IOException;
2640
import java.io.Reader;
@@ -56,10 +70,6 @@ public void sendDebuggerEvent(DebuggerEventRequest debuggerEventRequest){
5670
execute(() -> client.analyticsProvider.sendDebuggerEvent(debuggerEventRequest));
5771
}
5872

59-
public List<CodeObjectSummary> getSummaries(CodeObjectSummaryRequest summaryRequest) {
60-
return execute(() -> client.analyticsProvider.getSummaries(summaryRequest));
61-
}
62-
6373
@Override
6474
public List<CodeObjectInsight> getInsights(InsightsRequest insightsRequest) {
6575
return execute(() -> client.analyticsProvider.getInsights(insightsRequest));
@@ -268,15 +278,6 @@ private interface AnalyticsProviderRetrofit {
268278
@GET("/CodeAnalytics/environments")
269279
Call<List<String>> getEnvironments();
270280

271-
272-
@Headers({
273-
"Accept: application/+json",
274-
"Content-Type:application/json"
275-
})
276-
@POST("/CodeAnalytics/summary")
277-
Call<List<CodeObjectSummary>> getSummaries(@Body CodeObjectSummaryRequest summaryRequest);
278-
279-
280281
@Headers({
281282
"Accept: application/+json",
282283
"Content-Type:application/json"

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

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -66,37 +66,40 @@ void getInsights() throws JsonProcessingException {
6666

6767
final String ROUTE = "post transfer/transferfunds";
6868
final String ENDPOINT_SPAN = "HTTP POST transfer/transferfunds";
69+
final String ENV_1 = "Env1";
70+
final String SCOPE_1 = "Scope1";
71+
final int IMPORTANCE_3 = 3;
6972

7073
String codeObjectId = "Sample.MoneyTransfer.API.Domain.Services.MoneyTransferDomainService$_$TransferFunds";
7174
String prefixedCodeObjectId = addPrefixToCodeObjectId(codeObjectId);
7275
Date actualStartTimeNow = new Date();
7376
Date customStartTimeFiveDaysBefore = Date.from(actualStartTimeNow.toInstant().minus(5, ChronoUnit.DAYS));
7477
List<CodeObjectInsight> expectedCodeObjectInsights = new ArrayList<>();
7578

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

7982
ErrorInsightNamedError namedError1 = new ErrorInsightNamedError("e0a4d03c-c609-11ec-a9d6-0242ac130006", "System.NullReferenceException", codeObjectId, "Sample.MoneyTransfer.API.Controllers.TransferController$_$TransferFunds");
8083
ErrorInsightNamedError namedError2 = new ErrorInsightNamedError("de63a938-c609-11ec-b388-0242ac130006", "System.Exception", codeObjectId, "Sample.MoneyTransfer.API.Controllers.TransferController$_$TransferFunds");
8184
List<ErrorInsightNamedError> namedErrors = new ArrayList<>();
8285
namedErrors.add(namedError1);
8386
namedErrors.add(namedError2);
84-
ErrorInsight expectedErrorInsight = new ErrorInsight(codeObjectId, actualStartTimeNow, customStartTimeFiveDaysBefore, prefixedCodeObjectId, 1, 0, 0, namedErrors);
87+
ErrorInsight expectedErrorInsight = new ErrorInsight(codeObjectId, ENV_1, SCOPE_1, IMPORTANCE_3, null, actualStartTimeNow, customStartTimeFiveDaysBefore, prefixedCodeObjectId, 1, 0, 0, namedErrors);
8588
expectedCodeObjectInsights.add(expectedErrorInsight);
8689

8790
String expectedNormalUsageInsightCodeObjectId = "Sample.MoneyTransfer.API.Domain.Services.MoneyTransferDomainService$_$TransferFunds";
88-
NormalUsageInsight expectedNormalUsageInsight = new NormalUsageInsight( expectedNormalUsageInsightCodeObjectId,
89-
ROUTE, actualStartTimeNow, customStartTimeFiveDaysBefore, addPrefixToCodeObjectId(expectedNormalUsageInsightCodeObjectId), ENDPOINT_SPAN, 40);
91+
NormalUsageInsight expectedNormalUsageInsight = new NormalUsageInsight( expectedNormalUsageInsightCodeObjectId, ENV_1, SCOPE_1, IMPORTANCE_3, null,
92+
ROUTE, ENDPOINT_SPAN, actualStartTimeNow, customStartTimeFiveDaysBefore, addPrefixToCodeObjectId(expectedNormalUsageInsightCodeObjectId), 40);
9093
expectedCodeObjectInsights.add(expectedNormalUsageInsight);
9194

9295
String expectedLowUsageInsightCodeObjectId = "Sample.MoneyTransfer.API.Domain.Services.MoneyTransferDomainService$_$Abc";
93-
LowUsageInsight expectedLowUsageInsight = new LowUsageInsight( expectedLowUsageInsightCodeObjectId,
94-
ROUTE, actualStartTimeNow, customStartTimeFiveDaysBefore, addPrefixToCodeObjectId(expectedLowUsageInsightCodeObjectId), ENDPOINT_SPAN, 13);
96+
LowUsageInsight expectedLowUsageInsight = new LowUsageInsight( expectedLowUsageInsightCodeObjectId, ENV_1, SCOPE_1, IMPORTANCE_3, null,
97+
ROUTE, ENDPOINT_SPAN, actualStartTimeNow, customStartTimeFiveDaysBefore, addPrefixToCodeObjectId(expectedLowUsageInsightCodeObjectId), 13);
9598
expectedCodeObjectInsights.add(expectedLowUsageInsight);
9699

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

102105
SpanInfo spanInfo = new SpanInfo("Retrieving account", "Retrieving account", "MoneyTransferDomainService", "Sample.MoneyTransfer.API","Sample.MoneyTransfer.API.MoneyTransferDomainService$_$Error");
@@ -107,18 +110,22 @@ void getInsights() throws JsonProcessingException {
107110
null, null);
108111

109112
String expectedSlowestSpansInsightCodeObjectId = "Sample.MoneyTransfer.API.Domain.Services.MoneyTransferDomainService$_$TransferFunds";
110-
SlowestSpansInsight expectedSlowestSpansInsight = new SlowestSpansInsight( expectedSlowestSpansInsightCodeObjectId,
111-
ROUTE, actualStartTimeNow, customStartTimeFiveDaysBefore, addPrefixToCodeObjectId(expectedSlowestSpansInsightCodeObjectId), ENDPOINT_SPAN, Collections.singletonList(slowSpanInfo));
113+
SlowestSpansInsight expectedSlowestSpansInsight = new SlowestSpansInsight( expectedSlowestSpansInsightCodeObjectId, ENV_1, SCOPE_1, IMPORTANCE_3, null,
114+
ROUTE, ENDPOINT_SPAN, actualStartTimeNow, customStartTimeFiveDaysBefore, addPrefixToCodeObjectId(expectedSlowestSpansInsightCodeObjectId), Collections.singletonList(slowSpanInfo));
112115
expectedCodeObjectInsights.add(expectedSlowestSpansInsight);
113116

114117
String expectedSlowEndpointInsightCodeObjectId = "Sample.MoneyTransfer.API.Domain.Services.MoneyTransferDomainService$_$TransferFunds";
115118
SlowEndpointInsight expectedSlowEndpointInsight = new SlowEndpointInsight(
116119
expectedSlowEndpointInsightCodeObjectId
120+
, ENV_1
121+
, SCOPE_1
122+
, IMPORTANCE_3
123+
, null
117124
, ROUTE
125+
, ENDPOINT_SPAN
118126
, actualStartTimeNow
119127
, customStartTimeFiveDaysBefore
120128
, addPrefixToCodeObjectId(expectedSlowEndpointInsightCodeObjectId)
121-
, ENDPOINT_SPAN
122129
, new Duration(0.11D, "ms", 11000)
123130
, new Duration(0.12D, "ms", 12000)
124131
, new Duration(0.13D, "ms", 13000)

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

Lines changed: 0 additions & 156 deletions
This file was deleted.

0 commit comments

Comments
 (0)