@@ -140,26 +140,26 @@ private async Task RunAsync()
140
140
// Configure to expire metrics for old clients if not updated for longer than a minute
141
141
int defaultTimeToLive = 60 ;
142
142
143
- // if (metricCollection == null)
144
- // {
145
- // Console.WriteLine("Creating metric collection {0}", MetricCollectionName);
146
- // DocumentCollection metricCollectionDefinition = new DocumentCollection();
147
- // metricCollectionDefinition.Id = MetricCollectionName;
148
- // metricCollectionDefinition.DefaultTimeToLive = defaultTimeToLive;
149
-
150
- // metricCollection = await ExecuteWithRetries<ResourceResponse<DocumentCollection>>(
151
- // this.client,
152
- // () => client.CreateDocumentCollectionAsync(
153
- // UriFactory.CreateDatabaseUri(DatabaseName),
154
- // new DocumentCollection { Id = MetricCollectionName },
155
- // new RequestOptions { OfferThroughput = 5000 }),
156
- // true);
157
- // }
158
- // else
159
- // {
160
- // metricCollection.DefaultTimeToLive = defaultTimeToLive;
161
- // await client.ReplaceDocumentCollectionAsync(metricCollection);
162
- // }
143
+ if ( metricCollection == null )
144
+ {
145
+ Console . WriteLine ( "Creating metric collection {0}" , MetricCollectionName ) ;
146
+ DocumentCollection metricCollectionDefinition = new DocumentCollection ( ) ;
147
+ metricCollectionDefinition . Id = MetricCollectionName ;
148
+ metricCollectionDefinition . DefaultTimeToLive = defaultTimeToLive ;
149
+
150
+ metricCollection = await ExecuteWithRetries < ResourceResponse < DocumentCollection > > (
151
+ this . client ,
152
+ ( ) => client . CreateDocumentCollectionAsync (
153
+ UriFactory . CreateDatabaseUri ( DatabaseName ) ,
154
+ new DocumentCollection { Id = MetricCollectionName } ,
155
+ new RequestOptions { OfferThroughput = 5000 } ) ,
156
+ true ) ;
157
+ }
158
+ else
159
+ {
160
+ metricCollection . DefaultTimeToLive = defaultTimeToLive ;
161
+ await client . ReplaceDocumentCollectionAsync ( metricCollection ) ;
162
+ }
163
163
164
164
Console . WriteLine ( "Starting Inserts with {0} tasks" , TaskCount ) ;
165
165
string sampleDocument = File . ReadAllText ( ConfigurationManager . AppSettings [ "DocumentTemplateFile" ] ) ;
@@ -264,7 +264,7 @@ private async Task LogOutputStats()
264
264
latestStats [ "requestUnitsPerMonthBasedOnLastSecond" ] =
265
265
Math . Round ( ( ( requestUnits - lastRequestUnits ) / ( seconds - lastSeconds ) ) * 86400 * 30 ) ;
266
266
267
- // await InsertMetricsToDocumentDB(latestStats);
267
+ await InsertMetricsToDocumentDB ( latestStats ) ;
268
268
269
269
lastCount = documentsInserted ;
270
270
lastSeconds = seconds ;
0 commit comments