Azure 媒体服务遥测Azure Media Services telemetry

媒体服务徽标media services logo


备注

不会向媒体服务 v2 添加任何新特性或新功能。No new features or functionality are being added to Media Services v2.
查看最新版本:媒体服务 v3Check out the latest version, Media Services v3. 另请参阅从 v2 到 v3 的迁移指南Also, see migration guidance from v2 to v3

通过 Azure 媒体服务 (AMS) 可访问其服务的遥测/指标数据。Azure Media Services (AMS) enables you to access telemetry/metrics data for its services. 通过当前版本的 AMS,可收集活动 ChannelStreamingEndpointArchive 实体的遥测数据。The current version of AMS lets you collect telemetry data for live Channel, StreamingEndpoint, and live Archive entities.

遥测将写入指定 Azure 存储帐户的存储表中,通常情况下,应使用与 AMS 帐户关联的存储帐户。Telemetry is written to a storage table in an Azure Storage account that you specify (typically, you would use the storage account associated with your AMS account).

遥测系统不会管理数据保留。The telemetry system does not manage data retention. 通过删除存储表,可移除旧的遥测数据。You can remove the old telemetry data by deleting the storage tables.

本主题讨论如何配置和使用 AMS 遥测。This topic discusses how to configure and consume the AMS telemetry.

配置遥测Configuring telemetry

可按组件级的粒度配置遥测。You can configure telemetry on a component level granularity. 有两种详细级别:“正常”和“详细”。There are two detail levels "Normal" and "Verbose". 目前,这两种级别会返回相同的信息。Currently, both levels return the same information. 建议使用“正常”。It is recommended to use "Normal.

以下主题说明如何启用遥测:The following topics show how to enable telemetry:

通过 .NET 启用遥测Enabling telemetry with .NET

通过 REST 启用遥测Enabling telemetry with REST

使用遥测信息Consuming telemetry information

如果为媒体服务帐户配置了遥测,遥测将写入指定存储帐户的 Azure 存储表中。Telemetry is written to an Azure Storage Table in the storage account that you specified when you configured telemetry for the Media Services account. 本部分介绍适用于各项指标的存储表。This section describes the storage tables for the metrics.

可通过以下方式之一使用遥测数据:You can consume telemetry data in one of the following ways:

  • 直接从 Azure 表存储中读取数据(例如使用存储 SDK)。Read data directly from Azure Table Storage (e.g. using the Storage SDK). 有关遥测存储表的说明,请参阅主题中的使用遥测信息For the description of telemetry storage tables, see the Consuming telemetry information in this topic.

Or

  • 使用媒体服务 .NET SDK 中支持的内容来读取存储数据,如主题中所述。Use the support in the Media Services .NET SDK for reading storage data, as described in this topic.

下述遥测架构的设计目的是在 Azure 表存储限制内提供良好性能:The telemetry schema described below is designed to give good performance within the limits of Azure Table Storage:

  • 按照帐户 ID 和服务 ID 对数据进行分区,允许单独查询每个服务中的遥测。Data is partitioned by account ID and service ID to allow telemetry from each service to be queried independently.
  • 分区包含日期,以便为分区大小提供合理的上限。Partitions contain the date to give a reasonable upper bound on the partition size.
  • 行键采用相反的时间顺序,可允许查询给定服务的最新遥测项。Row keys are in reverse time order to allow the most recent telemetry items to be queried for a given service.

这应使许多常见查询更高效:This should allow many of the common queries to be efficient:

  • 单独服务数据的并行、独立下载。Parallel, independent downloading of data for separate services.
  • 检索某一日期范围内给定服务的所有数据。Retrieving all data for a given service in a date range.
  • 检索某项服务的最新数据。Retrieving the most recent data for a service.

遥测表存储输出架构Telemetry table storage output schema

遥测数据汇总存储在表“TelemetryMetrics20160321”中,其中“20160321”是创建表的日期。Telemetry data is stored in aggregate in one table, "TelemetryMetrics20160321" where "20160321" is date of the created table. 遥测系统为每个新日期(基于 00:00 UTC)单独创建一个表。Telemetry system creates a separate table for each new day based at 00:00 UTC. 该表用于存储重复值,如给定时间范围内的引入比特率、发送的字节数等。The table is used to store recurring values such as ingest bitrate within a given window of time, bytes sent, etc.

propertiesProperty Value 示例/说明Examples/notes
PartitionKeyPartitionKey {account ID}{entity ID}{account ID}{entity ID} e49bef329c29495f9b9570989682069d_64435281c50a4dd8ab7011cb0f4cdf66<br/e49bef329c29495f9b9570989682069d_64435281c50a4dd8ab7011cb0f4cdf66<br/
帐户 ID 包括在分区键中,可简化将多个媒体服务帐户写入同一存储帐户的工作流。The account ID is included in the partition key to simplify workflows where multiple Media Services accounts are writing to the same storage account.
RowKeyRowKey {seconds to midnight}{random value}{seconds to midnight}{random value} 01688_0019901688_00199

行键以距午夜的秒数开头,可允许分区内的前 n 个样式查询。The row key starts with the number of seconds to midnight to allow top n style queries within a partition. 有关详细信息,请参阅文章。For more information, see this article.
时间戳Timestamp 日期/时间Date/Time Azure 表中的自动时间戳 2016-09-09T22:43:42.241ZAuto timestamp from the Azure table 2016-09-09T22:43:42.241Z
类型Type 提供遥测数据的实体类型The type of the entity providing telemetry data Channel/StreamingEndpoint/ArchiveChannel/StreamingEndpoint/Archive

事件类型只是字符串值。Event type is just a string value.
名称Name 遥测事件的名称The name of the telemetry event ChannelHeartbeat/StreamingEndpointRequestLogChannelHeartbeat/StreamingEndpointRequestLog
ObservedTimeObservedTime 发生遥测事件的时间 (UTC)The time the telemetry event occurred (UTC) 2016-09-09T22:42:36.924Z2016-09-09T22:42:36.924Z

观察时间由发送遥测的实体(例如通道)提供。The observed time is provided by the entity sending the telemetry (for example a channel). 组件之间可能存在时间同步问题,因此此值为近似值There can be time synchronization issues between components so this value is approximate
ServiceIDServiceID {service ID}{service ID} f70bd731-691d-41c6-8f2d-671d0bdc9c7ef70bd731-691d-41c6-8f2d-671d0bdc9c7e
特定于实体的属性Entity-specific properties 由事件定义As defined by the event StreamName: stream1, Bitrate 10123, …StreamName: stream1, Bitrate 10123, …

其余属性针对给定时间类型定义。The remaining properties are defined for the given event type. Azure 表内容是键值对。Azure Table content is key value pairs. (即,表中的不同行具有不同的属性集)。(that is, different rows in the table have different sets of properties).

特定于实体的架构Entity-specific schema

特定于实体的遥测数据条目有三种类型,每种类型的推送频率如下:There are three types of entity-specific telemetric data entries each pushed with the following frequency:

  • 流式处理终结点:每 30 秒Streaming endpoints: Every 30 seconds
  • 实时频道:每分钟Live channels: Every minute
  • 实时存档:每分钟Live archive: Every minute

流式处理终结点Streaming Endpoint

propertiesProperty Value 示例Examples
PartitionKeyPartitionKey PartitionKeyPartitionKey e49bef329c29495f9b9570989682069d_64435281c50a4dd8ab7011cb0f4cdf66e49bef329c29495f9b9570989682069d_64435281c50a4dd8ab7011cb0f4cdf66
RowKeyRowKey RowKeyRowKey 01688_0019901688_00199
时间戳Timestamp 时间戳Timestamp Azure 表中的自动时间戳 2016-09-09T22:43:42.241ZAuto timestamp from Azure Table 2016-09-09T22:43:42.241Z
类型Type 类型Type StreamingEndpointStreamingEndpoint
名称Name 名称Name StreamingEndpointRequestLogStreamingEndpointRequestLog
ObservedTimeObservedTime ObservedTimeObservedTime 2016-09-09T22:42:36.924Z2016-09-09T22:42:36.924Z
ServiceIDServiceID 服务 IDService ID f70bd731-691d-41c6-8f2d-671d0bdc9c7ef70bd731-691d-41c6-8f2d-671d0bdc9c7e
HostNameHostName 终结点的主机名Hostname of the endpoint builddemoserver.origin.mediaservices.chinacloudapi.cnbuilddemoserver.origin.mediaservices.chinacloudapi.cn
StatusCodeStatusCode 记录 HTTP 状态Records HTTP status 200200
ResultCodeResultCode 结果代码详细信息Result code detail S_OKS_OK
RequestCountRequestCount 聚合中的总请求数Total request in the aggregation 33
BytesSentBytesSent 发送的聚合字节数Aggregated bytes sent 29873582987358
ServerLatencyServerLatency 平均服务器延迟(包括存储)Average server latency (including storage) 129129
E2ELatencyE2ELatency 平均端到端延迟Average end-to-end latency 250250

实时频道Live channel

propertiesProperty Value 示例/说明Examples/notes
PartitionKeyPartitionKey PartitionKeyPartitionKey e49bef329c29495f9b9570989682069d_64435281c50a4dd8ab7011cb0f4cdf66e49bef329c29495f9b9570989682069d_64435281c50a4dd8ab7011cb0f4cdf66
RowKeyRowKey RowKeyRowKey 01688_0019901688_00199
时间戳Timestamp 时间戳Timestamp Azure 表中的自动时间戳 2016-09-09T22:43:42.241ZAuto timestamp from the Azure table 2016-09-09T22:43:42.241Z
类型Type 类型Type ChannelChannel
名称Name 名称Name ChannelHeartbeatChannelHeartbeat
ObservedTimeObservedTime ObservedTimeObservedTime 2016-09-09T22:42:36.924Z2016-09-09T22:42:36.924Z
ServiceIDServiceID 服务 IDService ID f70bd731-691d-41c6-8f2d-671d0bdc9c7ef70bd731-691d-41c6-8f2d-671d0bdc9c7e
TrackTypeTrackType 轨道视频/音频/文本的类型Type of track video/audio/text 视频/音频video/audio
TrackNameTrackName 轨道名称Name of the track video/audio_1video/audio_1
BitrateBitrate 轨道比特率Track bitrate 785000785000
CustomAttributesCustomAttributes
IncomingBitrateIncomingBitrate 实际传入比特率Actual incoming bitrate 784548784548
OverlapCountOverlapCount 引入中的重叠Overlap in the ingest 00
DiscontinuityCountDiscontinuityCount 轨道的中断Discontinuity for track 00
LastTimestampLastTimestamp 上次引入数据的时间戳Last ingested data timestamp 18004888001800488800
NonincreasingCountNonincreasingCount 由于非递增时间戳而丢弃的片段计数Count of fragments discarded due to non-increasing timestamp 22
UnalignedKeyFramesUnalignedKeyFrames 是否收到关键帧不一致的片段(跨音质级别)Whether we received fragment(s) (across quality levels) where key frames not aligned TrueTrue
UnalignedPresentationTimeUnalignedPresentationTime 是否收到演示时间不一致的片段(跨音质级别/轨道)Whether we received fragment(s) (across quality levels/tracks) where presentation time is not aligned TrueTrue
UnexpectedBitrateUnexpectedBitrate 如果音频/视频轨道的计算/实际比特率 > 40,000 bps 且 IncomingBitrate == 0,或者 IncomingBitrate 和 actualBitrate 相差 50%,则为 trueTrue, if calculated/actual bitrate for audio/video track > 40,000 bps and IncomingBitrate == 0 OR IncomingBitrate and actualBitrate differ by 50% TrueTrue
正常Healthy 如果满足以下条件,则为 true:True, if
overlapCount、overlapCount,
DiscontinuityCount、DiscontinuityCount,
NonIncreasingCount、NonIncreasingCount,
UnalignedKeyFrames、UnalignedKeyFrames,
UnalignedPresentationTime、UnalignedPresentationTime,
UnexpectedBitrateUnexpectedBitrate
都为 0are all 0
TrueTrue

Healthy 是一个复合函数,满足以下任何条件时返回 false:Healthy is a composite function that returns false when any of the following conditions hold:

- OverlapCount > 0- OverlapCount > 0
- DiscontinuityCount > 0- DiscontinuityCount > 0
- NonincreasingCount > 0- NonincreasingCount > 0
- UnalignedKeyFrames == True- UnalignedKeyFrames == True
- UnalignedPresentationTime == True- UnalignedPresentationTime == True
- UnexpectedBitrate == True- UnexpectedBitrate == True

实时存档Live archive

propertiesProperty Value 示例/说明Examples/notes
PartitionKeyPartitionKey PartitionKeyPartitionKey e49bef329c29495f9b9570989682069d_64435281c50a4dd8ab7011cb0f4cdf66e49bef329c29495f9b9570989682069d_64435281c50a4dd8ab7011cb0f4cdf66
RowKeyRowKey RowKeyRowKey 01688_0019901688_00199
时间戳Timestamp 时间戳Timestamp Azure 表中的自动时间戳 2016-09-09T22:43:42.241ZAuto timestamp from the Azure table 2016-09-09T22:43:42.241Z
类型Type 类型Type 存档Archive
名称Name 名称Name ArchiveHeartbeatArchiveHeartbeat
ObservedTimeObservedTime ObservedTimeObservedTime 2016-09-09T22:42:36.924Z2016-09-09T22:42:36.924Z
ServiceIDServiceID 服务 IDService ID f70bd731-691d-41c6-8f2d-671d0bdc9c7ef70bd731-691d-41c6-8f2d-671d0bdc9c7e
ManifestNameManifestName 节目 URLProgram url asset-eb149703-ed0a-483c-91c4-e4066e72cce3/a0a5cfbf-71ec-4bd2-8c01-a92a2b38c9ba.ismasset-eb149703-ed0a-483c-91c4-e4066e72cce3/a0a5cfbf-71ec-4bd2-8c01-a92a2b38c9ba.ism
TrackNameTrackName 轨道名称Name of the track audio_1audio_1
TrackTypeTrackType 轨道类型Type of the track 音频/视频Audio/video
CustomAttributeCustomAttribute 十六进制字符串,用于区分具有相同名称和比特率的不同轨道(多摄像机角度)Hex string that differentiates between different track with same name and bitrate (multi camera angle)
BitrateBitrate 轨道比特率Track bitrate 785000785000
正常Healthy 如果 FragmentDiscardedCount == 0 且 ArchiveAcquisitionError == False,则为 trueTrue, if FragmentDiscardedCount == 0 && ArchiveAcquisitionError == False True(这两个值不存在于指标中,但存在于源事件中)True (these two values are not present in the metric but they are present in the source event)

Healthy 是一个复合函数,满足以下任何条件时返回 false:Healthy is a composite function that returns false when any of the following conditions hold:

- FragmentDiscardedCount > 0- FragmentDiscardedCount > 0
- ArchiveAcquisitionError == True- ArchiveAcquisitionError == True

常见问答General Q&A

如何使用指标数据?How to consume metrics data?

指标数据存储为客户存储帐户中的一系列 Azure 表。Metrics data is stored as a series of Azure Tables in the customer’s storage account. 可通过以下工具使用此数据:This data can be consumed using the following tools:

  • AMS SDKAMS SDK
  • Microsoft Azure 存储资源管理器(支持导出逗号分隔值格式并在 Excel 中进行处理)Microsoft Azure Storage Explorer (supports export to comma-separated value format and processed in Excel)
  • REST APIREST API

如何查找平均带宽消耗?How to find average bandwidth consumption?

平均带宽消耗是一段时间内 BytesSent 的平均值。The average bandwidth consumption is the average of BytesSent over a span of time.

如何定义流式处理单元数?How to define streaming unit count?

流式处理单元数可定义为:服务的流式处理终结点中的最大吞吐量除以单个流式处理终结点的最大吞吐量。The streaming unit count can be defined as the peak throughput from the service’s streaming endpoints divided by the peak throughput of one streaming endpoint. 单个流式处理终结点的最大可用吞吐量为 160 Mbps。The peak usable throughput of one streaming endpoint is 160 Mbps. 例如,假设客户服务中的最大吞吐量为 40 MBps(一段时间内 BytesSent 的最大值)。For example, suppose the peak throughput from a customer’s service is 40 MBps (the maximum value of BytesSent over a span of time). 然后,流式处理单位数等于 (40 MBps)*(8 位/字节)/(160 Mbps) = 2 流式处理单位。Then, the streaming unit count is equal to (40 MBps)*(8 bits/byte)/(160 Mbps) = 2 streaming units.

如何查找每秒平均请求数?How to find average requests/second?

若要查找每秒平均请求数,可计算一段时间内的平均请求数 (RequestCount)。To find the average number of requests/second, compute the average number of requests (RequestCount) over a span of time.

如何定义频道运行状况?How to define channel health?

可将频道运行状况定义为复合布尔函数,使其在满足以下任意条件时为 false:Channel health can be defined as a composite Boolean function such that it is false when any of the following conditions hold:

  • OverlapCount > 0OverlapCount > 0
  • DiscontinuityCount > 0DiscontinuityCount > 0
  • NonincreasingCount > 0NonincreasingCount > 0
  • UnalignedKeyFrames == TrueUnalignedKeyFrames == True
  • UnalignedPresentationTime == TrueUnalignedPresentationTime == True
  • UnexpectedBitrate == TrueUnexpectedBitrate == True

如何检测中断?How to detect discontinuities?

若要检测中断,请查找 DiscontinuityCount > 0 的所有频道数据条目。To detect discontinuities, find all Channel data entries where DiscontinuityCount > 0. 对应的 ObservedTime 时间戳指示发生中断的时间。The corresponding ObservedTime timestamp indicates the times at which the discontinuities occurred.

如何检测时间戳重叠?How to detect timestamp overlaps?

若要检测时间戳重叠,请查找 OverlapCount > 0 的所有频道数据条目。To detect timestamp overlaps, find all Channel data entries where OverlapCount > 0. 对应的 ObservedTime 时间戳指示发生时间戳重叠的时间。The corresponding ObservedTime timestamp indicates the times at which the timestamp overlaps occurred.

如何查找失败的流式处理请求及其原因?How to find streaming request failures and reasons?

若要查找失败的流式处理请求及其原因,请查找 ResultCode 不等于 S_OK 的所有流式处理终结点数据条目。To find streaming request failures and reasons, find all Streaming Endpoint data entries where ResultCode is not equal to S_OK. 对应的 StatusCode 字段指示请求失败的原因。The corresponding StatusCode field indicates the reason for the request failure.

如何通过外部工具使用数据?How to consume data with external tools?

可使用以下工具对遥测数据进行处理和可视化:Telemetric data can be processed and visualized with the following tools:

  • PowerBIPowerBI
  • Application InsightsApplication Insights
  • Azure Monitor(以前称为 Shoebox)Azure Monitor (formerly Shoebox)
  • AMS 实时仪表板AMS Live Dashboard
  • Azure 门户(尚未发行)Azure Portal (pending release)

如何管理数据保留?How to manage data retention?

遥测系统不提供数据保留管理,也不会自动删除旧记录。The telemetry system does not provide data retention management or auto deletion of old records. 因此,需要手动管理和删除存储表中的旧记录。Thus, you need to manage and delete old records manually from the storage table. 可参阅存储 SDK 以了解如何执行此操作。You can refer to storage SDK for how to do it.

后续步骤Next steps

媒体服务 v3(最新版本)Media Services v3 (latest)

查看最新版本的 Azure 媒体服务!Check out the latest version of Azure Media Services!

媒体服务 v2(旧版)Media Services v2 (legacy)