Вопрос

I carefully looked through Tailspin Surveys sample for Wasabi autoscaling block. There's Tailspin_TenantCount_Avg_10m rule that is implemented in TenantCountOperandElement class which in turn supplies a TenantCountDataPointsCollector class instance for collecting data.

The latter has

public IEnumerable<DataPoint> Collect(DateTimeOffset collectionTime)

method that does actual retrieval of metric data. The method is invoked by the Wasabi block.

How often is that method invoked?

Это было полезно?

Решение

When writing custom operands, you are the one that specifies how often you want the Collect method to be called. Wasabi will check the IDataPointsCollection.SamplingRate propery for that (implemented by your collector).

This is probably knowledge that the developer will have (as he knows better when new data could be available to be collected), but you could also let this parameter be excplicitly specified in XML too (although I wouldn't recommend it in production).

You could even derive this sampling rate depending on what is the timespan used in the aggregate function, so for example, if the operand does an average of the last 2 hours of data, it might be an overkill to sample the data every 2 minutes.

Другие советы

The invocation period of the Collect method, i.e. when Wasabi will call through to the IDataPointsCollector, is governed by the SamplingRate property on the data collector.

This interval is ultimately passed through by the Operand when it creates the IDataPointsCollector. The Operand element that you specify in the XML can always have a timespan attribute applied to it. So for example I could define the operand you list above with a shorter timespan using simething like.

<rules ...>
  ...
  <operands>
    <tenantCountOperand alias="Tailspin_TenantCount_Avg_2m" timespan="00:2:00" 
       aggregate="Average" xmlns="http://Tailspin/TenantCount" />
  </operands>
</rules>
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top