public DataflowMessageStatus OfferMessage(DataflowMessageHeader messageHeader, Bucket messageValue, ISourceBlock<Bucket> source, bool consumeToAccept) { _preprocessorBlock.Post(messageValue); return DataflowMessageStatus.Accepted; }
private void ProcessBucket(Bucket bucket) { switch (bucket.BucketType) { case BucketType.Count: var counterBucket = bucket as CounterBucket; foreach (var count in counterBucket.Items) { if (_config.CountersAsGauges) { _batchBlock.Post(new LibratoGauge(counterBucket.RootNamespace + count.Key, count.Value, bucket.Epoch)); } else { _batchBlock.Post(new LibratoCounter(counterBucket.RootNamespace + count.Key, count.Value, bucket.Epoch)); } } break; case BucketType.Gauge: var gaugeBucket = bucket as GaugesBucket; foreach (var gauge in gaugeBucket.Gauges) { _batchBlock.Post(new LibratoGauge(gaugeBucket.RootNamespace + gauge.Key, gauge.Value, bucket.Epoch)); } break; case BucketType.Timing: var timingBucket = bucket as LatencyBucket; foreach (var timing in timingBucket.Latencies) { _batchBlock.Post(new LibratoTiming(timingBucket.RootNamespace + timing.Key, timing.Value.Count, timing.Value.Sum, timing.Value.SumSquares, timing.Value.Min, timing.Value.Max, bucket.Epoch)); } break; case BucketType.Percentile: var percentileBucket = bucket as PercentileBucket; double percentileValue; foreach (var pair in percentileBucket.Timings) { if (percentileBucket.TryComputePercentile(pair, out percentileValue)) { _batchBlock.Post(new LibratoGauge(percentileBucket.RootNamespace + pair.Key + percentileBucket.PercentileName, percentileValue, bucket.Epoch)); } } break; } }
public DataflowMessageStatus OfferMessage(DataflowMessageHeader messageHeader, Bucket bucket, ISourceBlock<Bucket> source, bool consumeToAccept) { Console.WriteLine(bucket.ToString()); return DataflowMessageStatus.Accepted; }
public static Bucket Clone(Bucket bucket) { // Don't clone the bucket, just send back this reference since nobody // needs to modify the data anyways. return bucket; }
public DataflowMessageStatus OfferMessage(DataflowMessageHeader messageHeader, Bucket messageValue, ISourceBlock<Bucket> source, bool consumeToAccept) { var lines = messageValue.ToLines(); _bufferBlock.Post(lines); return DataflowMessageStatus.Accepted; }
public static Bucket Clone(Bucket bucket) { // Don't clone the bucket, just send back this reference since nobody // needs to modify the data anyways. return(bucket); }
public DataflowMessageStatus OfferMessage(DataflowMessageHeader messageHeader, Bucket messageValue, ISourceBlock<Bucket> source, bool consumeToAccept) { messageValue.FeedTarget(_batchBlock); return DataflowMessageStatus.Accepted; }