Skip to content

Commit b269d91

Browse files
committed
Add retry metric in producer C
1 parent c310d1a commit b269d91

2 files changed

Lines changed: 31 additions & 11 deletions

File tree

canary/producer-c/CMake/Dependencies/libkvsProducerC-CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ include(ExternalProject)
66

77
ExternalProject_Add(libkvsProducerC-download
88
GIT_REPOSITORY https://github.com/awslabs/amazon-kinesis-video-streams-producer-c.git
9-
GIT_TAG 3a5faed415bee295feed3371860cd19b6b34a4a1
9+
GIT_TAG 18ab7ffc0e8f078f586d4e249dc6907b0366b8eb
1010
PREFIX ${CMAKE_CURRENT_BINARY_DIR}/build
1111
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${OPEN_SRC_INSTALL_PREFIX} -DBUILD_COMMON_LWS=ON -DBUILD_COMMON_CURL=ON -DBUILD_DEPENDENCIES=TRUE -DOPEN_SRC_INSTALL_PREFIX=${OPEN_SRC_INSTALL_PREFIX}
1212
BUILD_ALWAYS TRUE

canary/producer-c/canary/CanaryStreamUtils.cpp

Lines changed: 30 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ STATUS computeStreamMetricsFromCanary(STREAM_HANDLE streamHandle, PCanaryStreamC
336336
STATUS retStatus = STATUS_SUCCESS;
337337
StreamMetrics canaryStreamMetrics;
338338
canaryStreamMetrics.version = STREAM_METRICS_CURRENT_VERSION;
339-
Aws::CloudWatch::Model::MetricDatum streamDatum, aggStreamDatum, currentViewDatum, aggCurrentViewDatum;
339+
Aws::CloudWatch::Model::MetricDatum streamDatum, currentViewDatum, streamApiCallRetryCountDatum;
340340
CHK_STATUS(getKinesisVideoStreamMetrics(streamHandle, &canaryStreamMetrics));
341341

342342
streamDatum.SetMetricName("FrameRate");
@@ -348,8 +348,13 @@ STATUS computeStreamMetricsFromCanary(STREAM_HANDLE streamHandle, PCanaryStreamC
348348
pushMetric(pCanaryStreamCallbacks, currentViewDatum, Aws::CloudWatch::Model::StandardUnit::Milliseconds,
349349
canaryStreamMetrics.currentViewDuration / HUNDREDS_OF_NANOS_IN_A_MILLISECOND);
350350

351+
streamApiCallRetryCountDatum.SetMetricName("StreamRetryCount");
352+
streamApiCallRetryCountDatum.AddDimensions(pCanaryStreamCallbacks->dimensionPerStream);
353+
pushMetric(pCanaryStreamCallbacks, streamApiCallRetryCountDatum, Aws::CloudWatch::Model::StandardUnit::Count,
354+
canaryStreamMetrics.streamApiCallRetryCount);
355+
351356
if (pCanaryStreamCallbacks->aggregateMetrics) {
352-
Aws::CloudWatch::Model::MetricDatum aggStreamDatum, aggCurrentViewDatum;
357+
Aws::CloudWatch::Model::MetricDatum aggStreamDatum, aggCurrentViewDatum, aggStreamApiCallRetryCountDatum;
353358
aggStreamDatum.SetMetricName("FrameRate");
354359
aggStreamDatum.AddDimensions(pCanaryStreamCallbacks->aggregatedDimension);
355360
pushMetric(pCanaryStreamCallbacks, aggStreamDatum, Aws::CloudWatch::Model::StandardUnit::Count_Second, canaryStreamMetrics.currentFrameRate);
@@ -359,6 +364,11 @@ STATUS computeStreamMetricsFromCanary(STREAM_HANDLE streamHandle, PCanaryStreamC
359364
pushMetric(pCanaryStreamCallbacks, aggCurrentViewDatum, Aws::CloudWatch::Model::StandardUnit::Milliseconds,
360365
canaryStreamMetrics.currentViewDuration / HUNDREDS_OF_NANOS_IN_A_MILLISECOND);
361366

367+
aggStreamApiCallRetryCountDatum.SetMetricName("StreamRetryCount");
368+
aggStreamApiCallRetryCountDatum.AddDimensions(pCanaryStreamCallbacks->aggregatedDimension);
369+
pushMetric(pCanaryStreamCallbacks, aggStreamApiCallRetryCountDatum, Aws::CloudWatch::Model::StandardUnit::Count,
370+
canaryStreamMetrics.streamApiCallRetryCount);
371+
362372
}
363373
CleanUp:
364374
return retStatus;
@@ -369,20 +379,30 @@ STATUS computeClientMetricsFromCanary(CLIENT_HANDLE clientHandle, PCanaryStreamC
369379
STATUS retStatus = STATUS_SUCCESS;
370380
ClientMetrics canaryClientMetrics;
371381
canaryClientMetrics.version = CLIENT_METRICS_CURRENT_VERSION;
372-
Aws::CloudWatch::Model::MetricDatum clientDatum, aggClientDatum;
382+
Aws::CloudWatch::Model::MetricDatum storageSizeDatum, avgApiRetryCountDatum;
373383
CHK_STATUS(getKinesisVideoMetrics(clientHandle, &canaryClientMetrics));
374384

375-
clientDatum.SetMetricName("StorageSizeAvailable");
376-
clientDatum.AddDimensions(pCanaryStreamCallbacks->dimensionPerStream);
377-
pushMetric(pCanaryStreamCallbacks, clientDatum, Aws::CloudWatch::Model::StandardUnit::Kilobytes,
385+
storageSizeDatum.SetMetricName("StorageSizeAvailable");
386+
storageSizeDatum.AddDimensions(pCanaryStreamCallbacks->dimensionPerStream);
387+
pushMetric(pCanaryStreamCallbacks, storageSizeDatum, Aws::CloudWatch::Model::StandardUnit::Kilobytes,
378388
canaryClientMetrics.contentStoreAvailableSize / 1024);
379389

390+
avgApiRetryCountDatum.SetMetricName("AvgClientApiCallRetryCount");
391+
avgApiRetryCountDatum.AddDimensions(pCanaryStreamCallbacks->dimensionPerStream);
392+
pushMetric(pCanaryStreamCallbacks, avgApiRetryCountDatum, Aws::CloudWatch::Model::StandardUnit::Count,
393+
canaryClientMetrics.clientAvgApiCallRetryCount);
394+
380395
if (pCanaryStreamCallbacks->aggregateMetrics) {
381-
Aws::CloudWatch::Model::MetricDatum aggClientDatum;
382-
aggClientDatum.SetMetricName("StorageSizeAvailable");
383-
aggClientDatum.AddDimensions(pCanaryStreamCallbacks->aggregatedDimension);
384-
pushMetric(pCanaryStreamCallbacks, aggClientDatum, Aws::CloudWatch::Model::StandardUnit::Kilobytes,
396+
Aws::CloudWatch::Model::MetricDatum aggStorageSizeDatum, aggAvgApiRetryCountDatum;
397+
aggStorageSizeDatum.SetMetricName("StorageSizeAvailable");
398+
aggStorageSizeDatum.AddDimensions(pCanaryStreamCallbacks->aggregatedDimension);
399+
pushMetric(pCanaryStreamCallbacks, aggStorageSizeDatum, Aws::CloudWatch::Model::StandardUnit::Kilobytes,
385400
canaryClientMetrics.contentStoreAvailableSize / 1024);
401+
402+
aggAvgApiRetryCountDatum.SetMetricName("AvgClientApiCallRetryCount");
403+
aggAvgApiRetryCountDatum.AddDimensions(pCanaryStreamCallbacks->aggregatedDimension);
404+
pushMetric(pCanaryStreamCallbacks, aggAvgApiRetryCountDatum, Aws::CloudWatch::Model::StandardUnit::Count,
405+
canaryClientMetrics.clientAvgApiCallRetryCount);
386406
}
387407
CleanUp:
388408
return retStatus;

0 commit comments

Comments
 (0)