Example #1
0
        public Task PublishCumulativeTelemetryAsync()
        {
            try
            {
                lock (publishLockNode)
                {
                    var ciEvent = new CustomerIntelligenceEvent
                    {
                        Area       = Area,
                        Feature    = CumulativeTelemetryFeatureName,
                        Properties = _properties.ToDictionary(entry => entry.Key, entry => entry.Value)
                    };

                    // This is to ensure that the single ci event is never fired more than once.
                    _properties.Clear();

                    return(_httpClient.PublishEventsAsync(new[] { ciEvent }));
                }
            }
            catch (Exception e)
            {
                _logger.Verbose($"TelemetryDataCollector : PublishCumulativeTelemetryAsync : Failed to publish telemtry due to {e}");
            }

            return(Task.CompletedTask);
        }
        /// <inheritdoc />
        public Task PublishTelemetryAsync(string eventArea, string eventName, Dictionary <string, object> value)
        {
            var ciEvent = new CustomerIntelligenceEvent
            {
                Area       = eventArea,
                Feature    = eventName,
                Properties = value
            };

            return(_httpClient.PublishEventsAsync(new[] { ciEvent }));
        }
Example #3
0
        public async Task CommitTelemetry(Guid planId, Guid jobId)
        {
            var ciData = new Dictionary <string, object>();

            ciData.Add("PlanId", planId);
            ciData.Add("JobId", jobId);

            ciData.Add("ChunksUploaded", this._chunksUploaded);
            ciData.Add("CompressionBytesSaved", this._compressionBytesSaved);
            ciData.Add("DedupUploadBytesSaved", this._dedupUploadBytesSaved);
            ciData.Add("LogicalContentBytesUploaded", this._logicalContentBytesUploaded);
            ciData.Add("PhysicalContentBytesUploaded", this._physicalContentBytesUploaded);
            ciData.Add("TotalNumberOfChunks", this._totalNumberOfChunks);

            var ciEvent = new CustomerIntelligenceEvent
            {
                Area       = "AzurePipelinesAgent",
                Feature    = "BuildArtifacts",
                Properties = ciData
            };
            await _ciClient.PublishEventsAsync(new [] { ciEvent });
        }
Example #4
0
 public Task PublishEventsAsync(CustomerIntelligenceEvent[] ciEvents)
 {
     return(_ciClient.PublishEventsAsync(events: ciEvents));
 }