Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Send a few additional metrics to backend #2750

Merged
merged 1 commit into from
Sep 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Added
- Support sending and receiving redundant audio data to help reduce the effects of packet loss on audio quality. See README for more details.
- Send a few additional metrics to backend

### Removed

Expand Down
5,754 changes: 2,895 additions & 2,859 deletions docs/assets/js/search.js

Large diffs are not rendered by default.

70 changes: 50 additions & 20 deletions docs/classes/clientmetricreport.html

Large diffs are not rendered by default.

44 changes: 44 additions & 0 deletions docs/classes/globalmetricreport.html
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,10 @@ <h3>Constructors</h3>
<h3>Properties</h3>
<ul class="tsd-index-list">
<li class="tsd-kind-property tsd-parent-kind-class"><a href="globalmetricreport.html#currentmetrics" class="tsd-kind-icon">current<wbr>Metrics</a></li>
<li class="tsd-kind-property tsd-parent-kind-class"><a href="globalmetricreport.html#currentobjectmetrics" class="tsd-kind-icon">current<wbr>Object<wbr>Metrics</a></li>
<li class="tsd-kind-property tsd-parent-kind-class"><a href="globalmetricreport.html#currentstringmetrics" class="tsd-kind-icon">current<wbr>String<wbr>Metrics</a></li>
<li class="tsd-kind-property tsd-parent-kind-class"><a href="globalmetricreport.html#previousmetrics" class="tsd-kind-icon">previous<wbr>Metrics</a></li>
<li class="tsd-kind-property tsd-parent-kind-class"><a href="globalmetricreport.html#previousobjectmetrics" class="tsd-kind-icon">previous<wbr>Object<wbr>Metrics</a></li>
</ul>
</section>
</div>
Expand Down Expand Up @@ -131,6 +133,24 @@ <h5><span class="tsd-signature-symbol">[</span>id: <span class="tsd-signature-ty
</ul>
</div>
</section>
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class">
<a name="currentobjectmetrics" class="tsd-anchor"></a>
<h3>current<wbr>Object<wbr>Metrics</h3>
<div class="tsd-signature tsd-kind-icon">current<wbr>Object<wbr>Metrics<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">{}</span><span class="tsd-signature-symbol"> = {}</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/aws/amazon-chime-sdk-js/blob/main/src/clientmetricreport/GlobalMetricReport.ts#L10">src/clientmetricreport/GlobalMetricReport.ts:10</a></li>
</ul>
</aside>
<div class="tsd-type-declaration">
<h4>Type declaration</h4>
<ul class="tsd-parameters">
<li class="tsd-parameter-index-signature">
<h5><span class="tsd-signature-symbol">[</span>id: <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">]: </span><span class="tsd-signature-type">object</span></h5>
</li>
</ul>
</div>
</section>
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class">
<a name="currentstringmetrics" class="tsd-anchor"></a>
<h3>current<wbr>String<wbr>Metrics</h3>
Expand Down Expand Up @@ -167,6 +187,24 @@ <h5><span class="tsd-signature-symbol">[</span>id: <span class="tsd-signature-ty
</ul>
</div>
</section>
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class">
<a name="previousobjectmetrics" class="tsd-anchor"></a>
<h3>previous<wbr>Object<wbr>Metrics</h3>
<div class="tsd-signature tsd-kind-icon">previous<wbr>Object<wbr>Metrics<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">{}</span><span class="tsd-signature-symbol"> = {}</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/aws/amazon-chime-sdk-js/blob/main/src/clientmetricreport/GlobalMetricReport.ts#L9">src/clientmetricreport/GlobalMetricReport.ts:9</a></li>
</ul>
</aside>
<div class="tsd-type-declaration">
<h4>Type declaration</h4>
<ul class="tsd-parameters">
<li class="tsd-parameter-index-signature">
<h5><span class="tsd-signature-symbol">[</span>id: <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">]: </span><span class="tsd-signature-type">object</span></h5>
</li>
</ul>
</div>
</section>
</section>
</div>
<div class="col-4 col-menu menu-sticky-wrap menu-highlight">
Expand All @@ -190,12 +228,18 @@ <h5><span class="tsd-signature-symbol">[</span>id: <span class="tsd-signature-ty
<li class=" tsd-kind-property tsd-parent-kind-class">
<a href="globalmetricreport.html#currentmetrics" class="tsd-kind-icon">current<wbr>Metrics</a>
</li>
<li class=" tsd-kind-property tsd-parent-kind-class">
<a href="globalmetricreport.html#currentobjectmetrics" class="tsd-kind-icon">current<wbr>Object<wbr>Metrics</a>
</li>
<li class=" tsd-kind-property tsd-parent-kind-class">
<a href="globalmetricreport.html#currentstringmetrics" class="tsd-kind-icon">current<wbr>String<wbr>Metrics</a>
</li>
<li class=" tsd-kind-property tsd-parent-kind-class">
<a href="globalmetricreport.html#previousmetrics" class="tsd-kind-icon">previous<wbr>Metrics</a>
</li>
<li class=" tsd-kind-property tsd-parent-kind-class">
<a href="globalmetricreport.html#previousobjectmetrics" class="tsd-kind-icon">previous<wbr>Object<wbr>Metrics</a>
</li>
</ul>
</li>
</ul>
Expand Down
44 changes: 44 additions & 0 deletions docs/classes/streammetricreport.html
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,13 @@ <h3>Constructors</h3>
<h3>Properties</h3>
<ul class="tsd-index-list">
<li class="tsd-kind-property tsd-parent-kind-class"><a href="streammetricreport.html#currentmetrics" class="tsd-kind-icon">current<wbr>Metrics</a></li>
<li class="tsd-kind-property tsd-parent-kind-class"><a href="streammetricreport.html#currentobjectmetrics" class="tsd-kind-icon">current<wbr>Object<wbr>Metrics</a></li>
<li class="tsd-kind-property tsd-parent-kind-class"><a href="streammetricreport.html#currentstringmetrics" class="tsd-kind-icon">current<wbr>String<wbr>Metrics</a></li>
<li class="tsd-kind-property tsd-parent-kind-class"><a href="streammetricreport.html#direction" class="tsd-kind-icon">direction</a></li>
<li class="tsd-kind-property tsd-parent-kind-class"><a href="streammetricreport.html#groupid" class="tsd-kind-icon">group<wbr>Id</a></li>
<li class="tsd-kind-property tsd-parent-kind-class"><a href="streammetricreport.html#mediatype" class="tsd-kind-icon">media<wbr>Type</a></li>
<li class="tsd-kind-property tsd-parent-kind-class"><a href="streammetricreport.html#previousmetrics" class="tsd-kind-icon">previous<wbr>Metrics</a></li>
<li class="tsd-kind-property tsd-parent-kind-class"><a href="streammetricreport.html#previousobjectmetrics" class="tsd-kind-icon">previous<wbr>Object<wbr>Metrics</a></li>
<li class="tsd-kind-property tsd-parent-kind-class"><a href="streammetricreport.html#streamid" class="tsd-kind-icon">stream<wbr>Id</a></li>
</ul>
</section>
Expand Down Expand Up @@ -135,6 +137,24 @@ <h5><span class="tsd-signature-symbol">[</span>id: <span class="tsd-signature-ty
</ul>
</div>
</section>
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class">
<a name="currentobjectmetrics" class="tsd-anchor"></a>
<h3>current<wbr>Object<wbr>Metrics</h3>
<div class="tsd-signature tsd-kind-icon">current<wbr>Object<wbr>Metrics<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">{}</span><span class="tsd-signature-symbol"> = {}</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/aws/amazon-chime-sdk-js/blob/main/src/clientmetricreport/StreamMetricReport.ts#L17">src/clientmetricreport/StreamMetricReport.ts:17</a></li>
</ul>
</aside>
<div class="tsd-type-declaration">
<h4>Type declaration</h4>
<ul class="tsd-parameters">
<li class="tsd-parameter-index-signature">
<h5><span class="tsd-signature-symbol">[</span>id: <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">]: </span><span class="tsd-signature-type">object</span></h5>
</li>
</ul>
</div>
</section>
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class">
<a name="currentstringmetrics" class="tsd-anchor"></a>
<h3>current<wbr>String<wbr>Metrics</h3>
Expand Down Expand Up @@ -201,6 +221,24 @@ <h5><span class="tsd-signature-symbol">[</span>id: <span class="tsd-signature-ty
</ul>
</div>
</section>
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class">
<a name="previousobjectmetrics" class="tsd-anchor"></a>
<h3>previous<wbr>Object<wbr>Metrics</h3>
<div class="tsd-signature tsd-kind-icon">previous<wbr>Object<wbr>Metrics<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">{}</span><span class="tsd-signature-symbol"> = {}</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/aws/amazon-chime-sdk-js/blob/main/src/clientmetricreport/StreamMetricReport.ts#L16">src/clientmetricreport/StreamMetricReport.ts:16</a></li>
</ul>
</aside>
<div class="tsd-type-declaration">
<h4>Type declaration</h4>
<ul class="tsd-parameters">
<li class="tsd-parameter-index-signature">
<h5><span class="tsd-signature-symbol">[</span>id: <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">]: </span><span class="tsd-signature-type">object</span></h5>
</li>
</ul>
</div>
</section>
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class">
<a name="streamid" class="tsd-anchor"></a>
<h3>stream<wbr>Id</h3>
Expand Down Expand Up @@ -234,6 +272,9 @@ <h3>stream<wbr>Id</h3>
<li class=" tsd-kind-property tsd-parent-kind-class">
<a href="streammetricreport.html#currentmetrics" class="tsd-kind-icon">current<wbr>Metrics</a>
</li>
<li class=" tsd-kind-property tsd-parent-kind-class">
<a href="streammetricreport.html#currentobjectmetrics" class="tsd-kind-icon">current<wbr>Object<wbr>Metrics</a>
</li>
<li class=" tsd-kind-property tsd-parent-kind-class">
<a href="streammetricreport.html#currentstringmetrics" class="tsd-kind-icon">current<wbr>String<wbr>Metrics</a>
</li>
Expand All @@ -249,6 +290,9 @@ <h3>stream<wbr>Id</h3>
<li class=" tsd-kind-property tsd-parent-kind-class">
<a href="streammetricreport.html#previousmetrics" class="tsd-kind-icon">previous<wbr>Metrics</a>
</li>
<li class=" tsd-kind-property tsd-parent-kind-class">
<a href="streammetricreport.html#previousobjectmetrics" class="tsd-kind-icon">previous<wbr>Object<wbr>Metrics</a>
</li>
<li class=" tsd-kind-property tsd-parent-kind-class">
<a href="streammetricreport.html#streamid" class="tsd-kind-icon">stream<wbr>Id</a>
</li>
Expand Down
7 changes: 7 additions & 0 deletions protocol/SignalingProtocol.proto
Original file line number Diff line number Diff line change
Expand Up @@ -286,12 +286,19 @@ message SdkMetric {
VIDEO_DECODE_WIDTH = 87;
VIDEO_ENCODER_IS_HARDWARE = 88;
VIDEO_DECODER_IS_HARDWARE = 89;
VIDEO_FREEZE_COUNT = 90;
VIDEO_FREEZE_DURATION = 91;
VIDEO_PAUSE_COUNT = 92;
VIDEO_PAUSE_DURATION = 93;
VIDEO_QUALITY_REASON = 94;
VIDEO_PROCESSING_TIME = 95;
RTC_SPK_AUDIO_LEVEL = 96;
RTC_MIC_AUDIO_LEVEL = 97;
RTC_SPK_TOTAL_LOST = 98;
RTC_SPK_TOTAL_EXPECTED = 99;
RTC_SPK_TOTAL_RECOVERED_RED = 100;
RTC_SPK_TOTAL_RECOVERED_FEC = 101;
VIDEO_QUALITY_LIMITATION_DURATION_CPU = 102;
}
optional Type type = 1;
optional double value = 2;
Expand Down
57 changes: 57 additions & 0 deletions src/clientmetricreport/ClientMetricReport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,39 @@ export default class ClientMetricReport {
return (diff * 1000) / intervalSeconds;
};

averageCpuQualityLimitationDurationPerSecondInMilliseconds = (
metricName?: string,
ssrc?: number
): number => {
const metricReport = this.streamMetricReports[ssrc];
let intervalSeconds = (this.currentTimestampMs - this.previousTimestampMs) / 1000;
if (intervalSeconds <= 0) {
return 0;
}
if (this.previousTimestampMs <= 0) {
intervalSeconds = 1;
}

let previousValue = 0;
let currentValue = 0;
for (const [key, value] of Object.entries(metricReport.previousObjectMetrics[metricName])) {
if (key === 'cpu') {
previousValue = value;
}
}
for (const [key, value] of Object.entries(metricReport.currentObjectMetrics[metricName])) {
if (key === 'cpu') {
currentValue = value;
}
}

const diff = currentValue - previousValue;
if (diff <= 0) {
return 0;
}
return (diff * 1000) / intervalSeconds;
};

isHardwareImplementation = (metricName?: string, ssrc?: number): number => {
const metricReport = this.streamMetricReports[ssrc];
const implName = String(metricReport.currentStringMetrics[metricName]);
Expand Down Expand Up @@ -322,6 +355,10 @@ export default class ClientMetricReport {
transform: this.isHardwareImplementation,
type: SdkMetric.Type.VIDEO_ENCODER_IS_HARDWARE,
},
qualityLimitationDurations: {
transform: this.averageCpuQualityLimitationDurationPerSecondInMilliseconds,
type: SdkMetric.Type.VIDEO_QUALITY_LIMITATION_DURATION_CPU,
},
};

readonly videoDownstreamMetricMap: {
Expand Down Expand Up @@ -374,6 +411,26 @@ export default class ClientMetricReport {
transform: this.isHardwareImplementation,
type: SdkMetric.Type.VIDEO_DECODER_IS_HARDWARE,
},
totalFreezeDuration: {
transform: this.averageTimeSpentPerSecondInMilliseconds,
type: SdkMetric.Type.VIDEO_FREEZE_DURATION,
},
freezeCount: {
transform: this.countPerSecond,
type: SdkMetric.Type.VIDEO_FREEZE_COUNT,
},
totalPauseDuration: {
transform: this.averageTimeSpentPerSecondInMilliseconds,
type: SdkMetric.Type.VIDEO_PAUSE_DURATION,
},
pauseCount: {
transform: this.countPerSecond,
type: SdkMetric.Type.VIDEO_PAUSE_COUNT,
},
framesDropped: {
transform: this.countPerSecond,
type: SdkMetric.Type.VIDEO_DROPPED_FPS,
},
};

getMetricMap(
Expand Down
2 changes: 2 additions & 0 deletions src/clientmetricreport/GlobalMetricReport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,6 @@ export default class GlobalMetricReport {
currentMetrics: { [id: string]: number } = {};
// As metric values do not necessarily be number, this is a workaround in case metric value is string
currentStringMetrics: { [id: string]: string } = {};
previousObjectMetrics: { [id: string]: object } = {};
currentObjectMetrics: { [id: string]: object } = {};
}
2 changes: 2 additions & 0 deletions src/clientmetricreport/StreamMetricReport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,6 @@ export default class StreamMetricReport {
currentMetrics: { [id: string]: number } = {};
// As metric values do not necessarily be number, this is a workaround in case metric value is string
currentStringMetrics: { [id: string]: string } = {};
previousObjectMetrics: { [id: string]: object } = {};
currentObjectMetrics: { [id: string]: object } = {};
}
9 changes: 8 additions & 1 deletion src/signalingprotocol/SignalingProtocol.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2770,12 +2770,19 @@ export namespace SdkMetric {
VIDEO_DECODE_WIDTH = 87,
VIDEO_ENCODER_IS_HARDWARE = 88,
VIDEO_DECODER_IS_HARDWARE = 89,
VIDEO_FREEZE_COUNT = 90,
VIDEO_FREEZE_DURATION = 91,
VIDEO_PAUSE_COUNT = 92,
VIDEO_PAUSE_DURATION = 93,
VIDEO_QUALITY_REASON = 94,
VIDEO_PROCESSING_TIME = 95,
RTC_SPK_AUDIO_LEVEL = 96,
RTC_MIC_AUDIO_LEVEL = 97,
RTC_SPK_TOTAL_LOST = 98,
RTC_SPK_TOTAL_EXPECTED = 99,
RTC_SPK_TOTAL_RECOVERED_RED = 100,
RTC_SPK_TOTAL_RECOVERED_FEC = 101
RTC_SPK_TOTAL_RECOVERED_FEC = 101,
VIDEO_QUALITY_LIMITATION_DURATION_CPU = 102
}
}

Expand Down
Loading