Benchmark: Fixes to show estimated cost of a container only when new container is getting created (#4109)
* Showing Estimated Cost only when new container is getting created * read container to get container response * disable client telemetry by default * removed unused imports * resolve merge conflict * fixed name * fix container not found * removed the message * Update Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/Program.cs Co-authored-by: Matias Quaranta <ealsur@users.noreply.github.com> * removed line space --------- Co-authored-by: Kiran Kumar Kolli <kirankk@microsoft.com> Co-authored-by: Matias Quaranta <ealsur@users.noreply.github.com>
This commit is contained in:
Родитель
7ed22ac55b
Коммит
75eec5c33a
|
@ -103,8 +103,8 @@ namespace CosmosBenchmark
|
|||
[Option(Required = false, HelpText = "Disable core SDK logging")]
|
||||
public bool DisableCoreSdkLogging { get; set; }
|
||||
|
||||
[Option(Required = false, HelpText = "Disable Distributed Tracing feature from source")]
|
||||
public bool DisableDistributedTracing { get; set; } = false;
|
||||
[Option(Required = false, HelpText = "Enable Distributed Tracing")]
|
||||
public bool EnableDistributedTracing { get; set; } = false;
|
||||
|
||||
[Option(Required = false, HelpText = "Client Telemetry Schedule in Seconds")]
|
||||
public int TelemetryScheduleInSec { get; set; }
|
||||
|
@ -138,8 +138,8 @@ namespace CosmosBenchmark
|
|||
[Option(Required = false, HelpText = "Application Insights connection string")]
|
||||
public string AppInsightsConnectionString { get; set; }
|
||||
|
||||
[Option(Required = false, HelpText = "Disable Client Telemetry Feature in SDK. Make sure you enable it from the portal also.")]
|
||||
public bool DisableClientTelemetry { get; set; } = false;
|
||||
[Option(Required = false, HelpText = "Enable Client Telemetry Feature in SDK. Make sure you enable it from the portal also.")]
|
||||
public bool EnableTelemetry { get; set; } = false;
|
||||
|
||||
internal int GetTaskCount(int containerThroughput)
|
||||
{
|
||||
|
@ -222,8 +222,8 @@ namespace CosmosBenchmark
|
|||
MaxTcpConnectionsPerEndpoint = this.MaxTcpConnectionsPerEndpoint,
|
||||
CosmosClientTelemetryOptions = new Microsoft.Azure.Cosmos.CosmosClientTelemetryOptions()
|
||||
{
|
||||
DisableSendingMetricsToService = this.DisableClientTelemetry,
|
||||
DisableDistributedTracing = this.DisableDistributedTracing
|
||||
DisableSendingMetricsToService = !this.EnableTelemetry,
|
||||
DisableDistributedTracing = !this.EnableDistributedTracing
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -7,10 +7,8 @@ namespace CosmosBenchmark
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Diagnostics.Tracing;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Reflection;
|
||||
using System.Threading;
|
||||
|
@ -18,7 +16,6 @@ namespace CosmosBenchmark
|
|||
using Azure.Monitor.OpenTelemetry.Exporter;
|
||||
using CosmosBenchmark.Fx;
|
||||
using Microsoft.Azure.Cosmos;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using OpenTelemetry;
|
||||
using OpenTelemetry.Metrics;
|
||||
|
@ -323,14 +320,7 @@ namespace CosmosBenchmark
|
|||
private static async Task<ContainerResponse> CreatePartitionedContainerAsync(BenchmarkConfig options, CosmosClient cosmosClient)
|
||||
{
|
||||
Microsoft.Azure.Cosmos.Database database = await cosmosClient.CreateDatabaseIfNotExistsAsync(options.Database);
|
||||
|
||||
// Show user cost of running this test
|
||||
double estimatedCostPerMonth = 0.06 * options.Throughput;
|
||||
double estimatedCostPerHour = estimatedCostPerMonth / (24 * 30);
|
||||
Utility.TeeTraceInformation($"The container will cost an estimated ${Math.Round(estimatedCostPerHour, 2)} per hour (${Math.Round(estimatedCostPerMonth, 2)} per month)");
|
||||
Utility.TeeTraceInformation("Press enter to continue ...");
|
||||
Console.ReadLine();
|
||||
|
||||
|
||||
string partitionKeyPath = options.PartitionKeyPath;
|
||||
return await database.CreateContainerIfNotExistsAsync(options.Container, partitionKeyPath, options.Throughput);
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче