Ejemplo n.º 1
0
        public override bool Equals(object obj)
        {
            if (obj == null || GetType() != obj.GetType())
            {
                return(false);
            }

            TraceAggregationKey traceAggregationKey = (TraceAggregationKey)obj;

            return
                (this.TaskName == traceAggregationKey.TaskName &&
                 this.EventName == traceAggregationKey.EventName &&
                 this.DifferentiatorFieldName == traceAggregationKey.DifferentiatorFieldName &&
                 this.DifferentiatorFieldValue == traceAggregationKey.DifferentiatorFieldValue);
        }
Ejemplo n.º 2
0
        public void Aggregate(TraceAggregationConfig traceAggregationConfig, string diffFieldValueString, IEnumerable <KeyValuePair <string, double> > numericalFields, IEnumerable <KeyValuePair <string, string> > stringFields, DateTime timestamp)
        {
            TraceAggregator     traceAggregator;
            TraceAggregationKey traceAggregationKey = new TraceAggregationKey(traceAggregationConfig, diffFieldValueString);

            if (!this.telemetryAggregationCollection.TryGetValue(traceAggregationKey, out traceAggregator))
            {
                // initializes the aggregator for the first time the trace is seen
                traceAggregator = new TraceAggregator(traceAggregationConfig);

                // include the aggregator to the collection
                this.telemetryAggregationCollection[traceAggregationKey] = traceAggregator;
            }

            // aggregating field values
            traceAggregator.Aggregate(numericalFields);
            traceAggregator.Aggregate(stringFields);
            traceAggregator.TraceTimestamp = timestamp;
        }