Skip to content

Commit ce3dfee

Browse files
mark clientSpan and traceId nullable + add logs
1 parent 792b012 commit ce3dfee

File tree

4 files changed

+10
-3
lines changed

4 files changed

+10
-3
lines changed

ide-common/src/main/java/org/digma/intellij/plugin/analytics/AnalyticsService.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,16 +160,19 @@ public void sendDebuggerEvent(int eventType,String timestamp) throws AnalyticsSe
160160

161161
public List<GlobalInsight> getGlobalInsights() throws AnalyticsServiceException {
162162
var env = getCurrentEnvironment();
163+
Log.log(LOGGER::debug, "Requesting Global Insights for next environment {}", env);
163164
return executeCatching(() -> analyticsProviderProxy.getGlobalInsights(new InsightsRequest(env, Collections.emptyList())));
164165
}
165166

166167
public List<CodeObjectInsight> getInsights(List<String> objectIds) throws AnalyticsServiceException {
167168
var env = getCurrentEnvironment();
169+
Log.log(LOGGER::debug, "Requesting insights for next objectIds {} and next environment {}", objectIds, env);
168170
return executeCatching(() -> analyticsProviderProxy.getInsights(new InsightsRequest(env, objectIds)));
169171
}
170172

171173
public List<CodeObjectError> getErrorsOfCodeObject(String codeObjectId) throws AnalyticsServiceException {
172174
var env = getCurrentEnvironment();
175+
Log.log(LOGGER::debug, "Requesting insights for next codeObjectId {} and next environment {}", codeObjectId, env);
173176
return executeCatching(() -> analyticsProviderProxy.getErrorsOfCodeObject(env, codeObjectId));
174177
}
175178

ide-common/src/main/java/org/digma/intellij/plugin/document/DocumentInfoContainer.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ private void loadAllInsightsForCurrentDocument() {
8585
//insights = Collections.emptyList() means there was an error loading insights, usually if the backend is not available.
8686
//don't log the exception, it was logged in AnalyticsService, keep the log quite because it can happen many times.
8787
insights = Collections.emptyList();
88+
Log.log(LOGGER::debug, "Cannot get insights with ids: {}. Because: {}", objectIds, e.getMessage());
8889
}
8990

9091
try {

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ data class HighlyOccurringSpanInfo
1111
constructor(
1212
val occurrences: Double,
1313
val internalSpan: SpanInfo?,
14-
val clientSpan: SpanInfo,
15-
val traceId: String,
14+
val clientSpan: SpanInfo?,
15+
val traceId: String?,
1616
val duration: Duration,
1717
val fraction: Double,
1818
)

src/main/kotlin/org/digma/intellij/plugin/ui/list/insights/EPNPlusSpansPanel.kt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,10 @@ fun ePNPlusSpansPanel(project: Project, insight: EPNPlusSpansInsight): JPanel {
4141
}
4242

4343
private fun getSQLRowPanel(insight: EPNPlusSpansInsight): JPanel {
44-
val sqlStatement = insight.spans.first().clientSpan.displayName
44+
var sqlStatement = insight.spans.first().clientSpan?.displayName
45+
if (sqlStatement == null) {
46+
sqlStatement = insight.spans.first().internalSpan?.displayName
47+
}
4548
val normalizedDisplayName = StringUtils.normalizeSpace(sqlStatement)
4649
val displayNameLabel = JBLabel(normalizedDisplayName, SwingConstants.TRAILING)
4750
displayNameLabel.toolTipText = asHtml(sqlStatement)

0 commit comments

Comments
 (0)