|
33 | 33 | import com.microsoft.applicationinsights.profiler.config.AlertConfigParser; |
34 | 34 | import com.microsoft.applicationinsights.profiler.config.ServiceProfilerServiceConfig; |
35 | 35 | import com.microsoft.applicationinsights.telemetry.EventTelemetry; |
| 36 | +import com.microsoft.applicationinsights.telemetry.TraceTelemetry; |
36 | 37 | import org.apache.http.impl.client.CloseableHttpClient; |
37 | 38 | import org.slf4j.Logger; |
38 | 39 | import org.slf4j.LoggerFactory; |
@@ -162,19 +163,23 @@ static UploadCompleteHandler sendServiceProfilerIndex(TelemetryClient telemetryC |
162 | 163 | event.getProperties().putAll(done.getServiceProfilerIndex().getProperties()); |
163 | 164 | event.getMetrics().putAll(done.getServiceProfilerIndex().getMetrics()); |
164 | 165 | telemetryClient.track(event); |
| 166 | + // This is an event that the backend specifically looks for to track when a profile is complete |
| 167 | + telemetryClient.track(new TraceTelemetry("StopProfiler succeeded.")); |
165 | 168 | }; |
166 | 169 | } |
167 | 170 |
|
168 | 171 | static AlertingSubsystem createAlertMonitor( |
169 | 172 | ScheduledExecutorService alertServiceExecutorService, |
170 | 173 | TelemetryClient telemetryClient, |
171 | 174 | GcEventMonitor.GcEventMonitorConfiguration gcEventMonitorConfiguration) { |
172 | | - return AlertingServiceFactory.create(alertAction(), TelemetryObservers.INSTANCE, telemetryClient, alertServiceExecutorService, gcEventMonitorConfiguration); |
| 175 | + return AlertingServiceFactory.create(alertAction(telemetryClient), TelemetryObservers.INSTANCE, telemetryClient, alertServiceExecutorService, gcEventMonitorConfiguration); |
173 | 176 | } |
174 | 177 |
|
175 | | - private static Consumer<AlertBreach> alertAction() { |
| 178 | + private static Consumer<AlertBreach> alertAction(TelemetryClient telemetryClient) { |
176 | 179 | return alert -> { |
177 | 180 | if (profilerService != null) { |
| 181 | + // This is an event that the backend specifically looks for to track when a profile is started |
| 182 | + telemetryClient.track(new TraceTelemetry("StartProfiler triggered.")); |
178 | 183 | profilerService.getProfiler().accept(alert); |
179 | 184 | } |
180 | 185 | }; |
|
0 commit comments