Пример #1
0
 public TelemetryAwareComponentDto(ITelemetryAware telemetryAwareComponent, List <string> propertiesToInclude)
 {
     if (propertiesToInclude.Contains(nameof(this.ComponentKey)))
     {
         this.ComponentKey = telemetryAwareComponent.Name;
     }
     if (propertiesToInclude.Contains(nameof(this.FirstReported)))
     {
         this.FirstReported = telemetryAwareComponent.FirstReportedDate;
     }
 }
Пример #2
0
        private static async Task AddTelemetries(ITelemetryUnitOfWork work, TelemetryRootObject program, string ipAddress
                                                 , IGrouping <TelemetryItemTypes, TelemetryItem> typeGrouping, ClientAppUser clientAppUser, List <TelemetrySummary> summaries)
        {
            foreach (IGrouping <string, TelemetryItem> keyGroupings in typeGrouping.GroupBy(x => x.EntryKey))
            {
                ITelemetryAware trackedComponent = await GetTrackedComponent(work, typeGrouping.Key, keyGroupings.Key, program)
                                                   .ConfigureAwait(false);

                TelemetrySummary summary = GetTelemetrySummary(clientAppUser, trackedComponent);
                foreach (TelemetryItem telemetryItem in keyGroupings)
                {
                    summary.UpdateTelemetry(keyGroupings.First().VersionData, ipAddress, telemetryItem);
                }

                summaries.Add(summary);
            }
        }
        private static void ProcessComponents(TelemetryQueryRequest request, TelemetryQueryResponse queryResult, ITelemetryAware telemetryAwareComponent)
        {
            if (queryResult.TelemetryAware == null)
            {
                queryResult.TelemetryAware = new List <TelemetryAwareComponentDto>();
            }
            TelemetryAwareComponentDto componentDto = new TelemetryAwareComponentDto(telemetryAwareComponent, request.PropertiesToInclude);

            queryResult.TelemetryAware.Add(componentDto);

            if (request.Granularity >= TelemetryRequestGranularity.Summaries)
            {
                foreach (TelemetrySummary telemetrySummary in telemetryAwareComponent.GetTelemetrySummaries())
                {
                    ProcessSummaries(request, telemetrySummary, componentDto);
                }
            }
        }
Пример #4
0
        public static TelemetrySummary GetTelemetrySummary(ClientAppUser clientAppUser, ITelemetryAware component)
        {
            TelemetrySummary summary = component.GetTelemetrySummary(clientAppUser.Id);

            if (summary == null)
            {
                summary = component.AddTelemetrySummary(clientAppUser.Id);
            }

            return(summary);
        }