예제 #1
0
 public TraceAggregationKey(TraceAggregationConfig traceAggregationConfig, string differentiatorFieldValue)
 {
     this.TaskName  = traceAggregationConfig.TaskName;
     this.EventName = traceAggregationConfig.EventName;
     this.DifferentiatorFieldName  = traceAggregationConfig.DifferentiatorFieldName;
     this.DifferentiatorFieldValue = differentiatorFieldValue;
 }
        // this method is used to simplify the creation of a TraceAggregationConfig containing only snapshots type of aggregation
        public static TraceAggregationConfig CreateTraceAggregatorConfig(
            string taskName,
            string eventName,
            string differentiatorFieldName,
            IEnumerable <string> properties,
            IEnumerable <Aggregation.Kinds> aggrKindsProperties,
            IEnumerable <string> metrics,
            IEnumerable <Aggregation.Kinds> aggrKindsMetrics)
        {
            // all fields have only the snapshot

            // creating the list of all fields of the TraceAggregator
            List <FieldAggregationConfig> aggrFieldConfigs = new List <FieldAggregationConfig>();

            foreach (var p in properties)
            {
                aggrFieldConfigs.Add(new FieldAggregationConfig(new Field(p, Field.Kind.Property), aggrKindsProperties));
            }

            foreach (var m in metrics)
            {
                aggrFieldConfigs.Add(new FieldAggregationConfig(new Field(m, Field.Kind.Metric), aggrKindsMetrics));
            }

            // constructing the configuration of the aggregationConfig
            TraceAggregationConfig aggrConfig = new TraceAggregationConfig(taskName, eventName, differentiatorFieldName);

            aggrConfig.AddAggregationEntries(aggrFieldConfigs);

            return(aggrConfig);
        }
예제 #3
0
 public TraceAggregator(TraceAggregationConfig configEntry)
 {
     this.TraceAggrConfig  = configEntry;
     this.exceptionCount   = 0;
     this.fieldAggregators = new Dictionary <string, FieldAggregator>();
     foreach (var fieldAggregatorConfig in configEntry.FieldsAndAggregationConfigs)
     {
         this.fieldAggregators.Add(fieldAggregatorConfig.Key, new FieldAggregator(fieldAggregatorConfig.Value));
     }
 }
예제 #4
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;
        }
 // this method is used to simplify the creation of a TraceAggregationConfig containing only snapshots type of aggregation
 public static TraceAggregationConfig CreateSnapshotTraceAggregatorConfig(
     string taskName,
     string eventName,
     string differentiatorFieldName,
     IEnumerable <string> properties,
     IEnumerable <string> metrics)
 {
     // all fields have only the snapshot
     return(TraceAggregationConfig.CreateTraceAggregatorConfig(
                taskName,
                eventName,
                differentiatorFieldName,
                properties,
                new List <Aggregation.Kinds>()
     {
         Aggregation.Kinds.Snapshot
     },
                metrics,
                new List <Aggregation.Kinds>()
     {
         Aggregation.Kinds.Snapshot
     }));
 }