Inheritance: IAutoscalingConfigurationSet
Ejemplo n.º 1
0
 internal async Task EnsureProvisionAsync(
     bool isCircuitBreakerTripped,
     AutoscalingConfigurationSet configurationSet,
     CancellationToken cancellationToken = default(CancellationToken))
 {
     if (configurationSet is GlobalSecondaryIndexAutoscalingConfigurationSet)
     {
         var indexConfiguration = configurationSet as GlobalSecondaryIndexAutoscalingConfigurationSet;
         if (indexConfiguration.IndexName.Equals("*"))
         {
             await EnsureAllGlobalSecondaryIndexProvisionAsync(isCircuitBreakerTripped, indexConfiguration, cancellationToken).ConfigureAwait(false);
         }
         else
         {
             await EnsureGlobalSecondaryIndexProvisionAsync(isCircuitBreakerTripped, indexConfiguration, cancellationToken).ConfigureAwait(false);
         }
     }
     else if (configurationSet is TableAutoscalingConfigurationSet)
     {
         var tableConfiguration = configurationSet as TableAutoscalingConfigurationSet;
         await EnsureTableProvisionAsync(isCircuitBreakerTripped, tableConfiguration, cancellationToken).ConfigureAwait(false);
     }
 }
Ejemplo n.º 2
0
        private void LogStats(AutoscalingConfigurationSet configuration, DynamoDbThroughput throughput, DynamoDbMetrics metrics)
        {
            var entityName = configuration.EntityName;
            var readsProvisioned = throughput.ReadThroughput;
            var writesProvisioned = throughput.WriteThroughput;
            var readsConsumed = metrics.ConsumedReadCapacityUnits;
            var writesConsumed = metrics.ConsumedWriteCapacityUnits;
            var readsPercent = readsConsumed.ToPercentage(readsProvisioned);
            var writesPercent = writesConsumed.ToPercentage(writesProvisioned);

            structuredLogger.Information(
                "{EntityName}:reads {ReadsConsumed}/{ReadsProvisioned},{ReadsPercent}%,->{ReadConsumptionDirection},{ReadThrottleEvents}",
                entityName, readsConsumed, readsProvisioned, readsPercent, metrics.ReadConsumptionDirection.ToString("F4"), metrics.ReadThrottleEvents);

            structuredLogger.Information(
                "{EntityName}:writes {WritesConsumed}/{WritesProvisioned},{WritesPercent}%,->{WriteConsumptionDirection},{WriteThrottleEvents}",
                entityName, writesConsumed, writesProvisioned, writesPercent, metrics.WriteConsumptionDirection.ToString("F4"), metrics.WriteThrottleEvents);
        }
Ejemplo n.º 3
0
 internal DynamoDbTableThroughput EnsureProvision(
     bool isCircuitBreakerTripped,
     DynamoDbTableThroughput provisioned,
     DynamoDbMetrics metrics,
     AutoscalingConfigurationSet configuration)
 {
     var updatedReads = EnsureProvision(isCircuitBreakerTripped, provisioned.ReadThroughput, metrics.ReadsThroughputMetrics, configuration.Reads);
     var updatedWrites = EnsureProvision(isCircuitBreakerTripped, provisioned.WriteThroughput, metrics.WritesThroughputMetrics, configuration.Writes);
     var updated = new DynamoDbTableThroughput { ReadThroughput = updatedReads, WriteThroughput = updatedWrites };
     return updated;
 }