Skip to content

Commit

Permalink
Add counters of each type of telemetry and small UI improvment
Browse files Browse the repository at this point in the history
  • Loading branch information
Socolin committed Mar 26, 2020
1 parent 28cd90f commit c2ee9b7
Show file tree
Hide file tree
Showing 7 changed files with 257 additions and 26 deletions.
5 changes: 5 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,11 @@ patchPluginXml {
version = project.version
changeNotes """
<ul>
<li>1.0.4</li>
<ul>
<li>Add numbers of each metrics. It allow to notify there are metrics coming in even when they are filtered out</li>
<li>Small improvement on UI</li>
</ul>
<li>1.0.3</li>
<ul>
<li>Move Application Insights tool window to the debugger panel, in a new tab</li>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import org.jetbrains.annotations.Nullable;

import java.util.*;
import java.util.function.BiConsumer;
import java.util.function.Consumer;
import java.util.stream.Collectors;

Expand All @@ -16,9 +17,11 @@ public class ApplicationInsightsSession {
private DotNetDebugProcess dotNetDebugProcess;
private Set<TelemetryType> enabledTelemetryTypes = new HashSet<>();
@Nullable
private Consumer<Telemetry> addedTelemetry;
private BiConsumer<Telemetry, Boolean> addedTelemetry;
@Nullable
private Consumer<List<Telemetry>> updateAllTelemetries;
@Nullable
private Consumer<List<Telemetry>> updateVisibleTelemetries;

public ApplicationInsightsSession(
TelemetryFactory telemetryFactory,
Expand Down Expand Up @@ -62,8 +65,8 @@ private void addTelemetry(Telemetry telemetry) {
visible = true;
}
}
if (visible && addedTelemetry != null)
addedTelemetry.accept(telemetry);
if (addedTelemetry != null)
addedTelemetry.accept(telemetry, visible);
}

private void updateFilteredTelemetries() {
Expand All @@ -80,9 +83,10 @@ public boolean isEnabled(TelemetryType telemetryType) {
return this.enabledTelemetryTypes.contains(telemetryType);
}

public void registerChanges(Consumer<Telemetry> addedTelemetry, Consumer<List<Telemetry>> updateAllTelemetries) {
public void registerChanges(BiConsumer<Telemetry, Boolean> addedTelemetry, Consumer<List<Telemetry>> updateAllTelemetries, Consumer<List<Telemetry>> updateVisibleTelemetries) {
this.addedTelemetry = addedTelemetry;
this.updateAllTelemetries = updateAllTelemetries;
this.updateVisibleTelemetries = updateVisibleTelemetries;
}

public List<Telemetry> getFilteredTelemetries() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package fr.socolin.applicationinsights;

import com.intellij.execution.ui.layout.PlaceInGrid;
import com.intellij.ui.content.Content;
import com.intellij.util.IconUtil;
import com.intellij.xdebugger.XDebugProcess;
Expand Down Expand Up @@ -52,10 +53,10 @@ public void selectSession(@Nullable XDebugSession debugSession) {
AppInsightsToolWindow appInsightsToolWindow = new AppInsightsToolWindow(debugSession.getProject());

Content content = debugSession.getUI().createContent(
"hello",
"appinsights",
appInsightsToolWindow.getContent(),
"Application Insights",
IconUtil.getAddIcon(),
IconUtil.getAddIcon(), // FIXME replace with icon
null
);
debugSession.getUI().addContent(content);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,49 +49,163 @@
</scrollpane>
</children>
</splitpane>
<grid id="53d4d" layout-manager="FlowLayout" hgap="0" vgap="0" flow-align="0">
<grid id="53d4d" layout-manager="GridBagLayout">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="1" anchor="9" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<component id="81b36" class="javax.swing.JCheckBox" binding="metricCheckBox">
<constraints/>
<constraints>
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="0" indent="0" use-parent-layout="false"/>
<gridbag weightx="0.0" weighty="0.0"/>
</constraints>
<properties>
<text value="Metric"/>
</properties>
</component>
<component id="700f7" class="javax.swing.JCheckBox" binding="exceptionCheckBox" default-binding="true">
<constraints/>
<constraints>
<grid row="0" column="3" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="0" indent="0" use-parent-layout="false"/>
<gridbag weightx="0.0" weighty="0.0"/>
</constraints>
<properties>
<text value="Exception"/>
</properties>
</component>
<component id="866e3" class="javax.swing.JCheckBox" binding="messageCheckBox" default-binding="true">
<constraints/>
<constraints>
<grid row="0" column="5" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="0" indent="0" use-parent-layout="false"/>
<gridbag weightx="0.0" weighty="0.0"/>
</constraints>
<properties>
<text value="Message"/>
</properties>
</component>
<component id="87afa" class="javax.swing.JCheckBox" binding="dependencyCheckBox" default-binding="true">
<constraints/>
<constraints>
<grid row="0" column="7" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="0" indent="0" use-parent-layout="false"/>
<gridbag weightx="0.0" weighty="0.0"/>
</constraints>
<properties>
<text value="Dependency"/>
</properties>
</component>
<component id="dc2cc" class="javax.swing.JCheckBox" binding="requestCheckBox" default-binding="true">
<constraints/>
<constraints>
<grid row="0" column="9" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="0" indent="0" use-parent-layout="false"/>
<gridbag weightx="0.0" weighty="0.0"/>
</constraints>
<properties>
<text value="Request"/>
</properties>
</component>
<component id="c3250" class="javax.swing.JCheckBox" binding="eventCheckBox" default-binding="true">
<constraints/>
<constraints>
<grid row="0" column="11" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="0" indent="0" use-parent-layout="false"/>
<gridbag weightx="0.0" weighty="0.0"/>
</constraints>
<properties>
<text value="Event"/>
</properties>
</component>
<component id="59fe1" class="javax.swing.JLabel" binding="metricCounter">
<constraints>
<grid row="1" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="5" fill="0" indent="0" use-parent-layout="false"/>
<gridbag weightx="0.0" weighty="0.0"/>
</constraints>
<properties>
<text value="0"/>
</properties>
</component>
<component id="a5ba8" class="javax.swing.JLabel" binding="exceptionCounter">
<constraints>
<grid row="1" column="3" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="4" fill="0" indent="0" use-parent-layout="false"/>
<gridbag weightx="0.0" weighty="0.0"/>
</constraints>
<properties>
<text value="0"/>
</properties>
</component>
<component id="aa4dd" class="javax.swing.JLabel" binding="messageCounter">
<constraints>
<grid row="1" column="5" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="4" fill="0" indent="0" use-parent-layout="false"/>
<gridbag weightx="0.0" weighty="0.0"/>
</constraints>
<properties>
<text value="0"/>
</properties>
</component>
<component id="5718a" class="javax.swing.JLabel" binding="dependencyCounter">
<constraints>
<grid row="1" column="7" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="4" fill="0" indent="0" use-parent-layout="false"/>
<gridbag weightx="0.0" weighty="0.0"/>
</constraints>
<properties>
<text value="0"/>
</properties>
</component>
<component id="ca51c" class="javax.swing.JLabel" binding="requestCounter">
<constraints>
<grid row="1" column="9" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="4" fill="0" indent="0" use-parent-layout="false"/>
<gridbag weightx="0.0" weighty="0.0"/>
</constraints>
<properties>
<text value="0"/>
</properties>
</component>
<component id="f4241" class="javax.swing.JLabel" binding="eventCounter">
<constraints>
<grid row="1" column="11" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="4" fill="0" indent="0" use-parent-layout="false"/>
<gridbag weightx="0.0" weighty="0.0"/>
</constraints>
<properties>
<text value="0"/>
</properties>
</component>
<component id="1b1ae" class="fr.socolin.applicationinsights.toolwindows.components.ColorBox" binding="metricColorBox" custom-create="true">
<constraints>
<grid row="0" column="0" row-span="2" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
<gridbag weightx="0.0" weighty="0.0"/>
</constraints>
<properties/>
</component>
<component id="1dc61" class="fr.socolin.applicationinsights.toolwindows.components.ColorBox" binding="exceptionColorBox" custom-create="true">
<constraints>
<grid row="0" column="2" row-span="2" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
<gridbag weightx="0.0" weighty="0.0"/>
</constraints>
<properties/>
</component>
<component id="b9e4f" class="fr.socolin.applicationinsights.toolwindows.components.ColorBox" binding="messageColorBox" custom-create="true">
<constraints>
<grid row="0" column="4" row-span="2" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
<gridbag weightx="0.0" weighty="0.0"/>
</constraints>
<properties/>
</component>
<component id="ba4e9" class="fr.socolin.applicationinsights.toolwindows.components.ColorBox" binding="dependencyColorBox" custom-create="true">
<constraints>
<grid row="0" column="6" row-span="2" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
<gridbag weightx="0.0" weighty="0.0"/>
</constraints>
<properties/>
</component>
<component id="70581" class="fr.socolin.applicationinsights.toolwindows.components.ColorBox" binding="requestColorBox" custom-create="true">
<constraints>
<grid row="0" column="8" row-span="2" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
<gridbag weightx="0.0" weighty="0.0"/>
</constraints>
<properties/>
</component>
<component id="57634" class="fr.socolin.applicationinsights.toolwindows.components.ColorBox" binding="eventColorBox" custom-create="true">
<constraints>
<grid row="0" column="10" row-span="2" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
<gridbag weightx="0.0" weighty="0.0"/>
</constraints>
<properties/>
</component>
</children>
</grid>
</children>
Expand Down
Loading

0 comments on commit c2ee9b7

Please sign in to comment.