OpenTelemetry 0.7.0 格式化 - Amazon CloudWatch

本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。

OpenTelemetry 0.7.0 格式化

OpenTelemetry 是工具、APIs、和的集合SDKs。您可以使用它來檢測、產生、收集和匯出遙測資料 (度量、記錄和追蹤) 以進行分析。 OpenTelemetry 是雲端原生運算基金會的一部分。如需詳細資訊,請參閱OpenTelemetry

如需完整 OpenTelemetry 0.7.0 規格的相關資訊,請參閱 v0. 7.0 版本。

Kinesis 記錄可以包含一或多個ExportMetricsServiceRequest OpenTelemetry 資料結構。每個資料結構都以具有 UnsignedVarInt32 的標題為開頭,該標題可指示記錄長度 (以位元組為單位)。每個 ExportMetricsServiceRequest 可能一次包含來自多個指標的資料。

以下是ExportMetricsServiceRequest OpenTelemetry 數據結構的消息的字符串表示。 OpenTelemetry 序列化 Google 協議緩衝區二進制協議,這不是人類可讀的。

resource_metrics { resource { attributes { key: "cloud.provider" value { string_value: "aws" } } attributes { key: "cloud.account.id" value { string_value: "2345678901" } } attributes { key: "cloud.region" value { string_value: "us-east-1" } } attributes { key: "aws.exporter.arn" value { string_value: "arn:aws:cloudwatch:us-east-1:123456789012:metric-stream/MyMetricStream" } } } instrumentation_library_metrics { metrics { name: "amazonaws.com/AWS/DynamoDB/ConsumedReadCapacityUnits" unit: "1" double_summary { data_points { labels { key: "Namespace" value: "AWS/DynamoDB" } labels { key: "MetricName" value: "ConsumedReadCapacityUnits" } labels { key: "TableName" value: "MyTable" } start_time_unix_nano: 1604948400000000000 time_unix_nano: 1604948460000000000 count: 1 sum: 1.0 quantile_values { quantile: 0.0 value: 1.0 } quantile_values { quantile: 0.95 value: 1.0 } quantile_values { quantile: 0.99 value: 1.0 } quantile_values { quantile: 1.0 value: 1.0 } } data_points { labels { key: "Namespace" value: "AWS/DynamoDB" } labels { key: "MetricName" value: "ConsumedReadCapacityUnits" } labels { key: "TableName" value: "MyTable" } start_time_unix_nano: 1604948460000000000 time_unix_nano: 1604948520000000000 count: 2 sum: 5.0 quantile_values { quantile: 0.0 value: 2.0 } quantile_values { quantile: 1.0 value: 3.0 } } } } } }

序列化 OpenTelemetry 指標資料的頂層物件

ExportMetricsServiceRequest是序列化 OpenTelemetry 匯出器有效載荷的頂層包裝器。它包含一個或多個 ResourceMetrics

message ExportMetricsServiceRequest { // An array of ResourceMetrics. // For data coming from a single resource this array will typically contain one // element. Intermediary nodes (such as OpenTelemetry Collector) that receive // data from multiple origins typically batch the data before forwarding further and // in that case this array will contain multiple elements. repeated opentelemetry.proto.metrics.v1.ResourceMetrics resource_metrics = 1; }

ResourceMetrics是表示 MetricData 物件的頂層物件。

// A collection of InstrumentationLibraryMetrics from a Resource. message ResourceMetrics { // The resource for the metrics in this message. // If this field is not set then no resource info is known. opentelemetry.proto.resource.v1.Resource resource = 1; // A list of metrics that originate from a resource. repeated InstrumentationLibraryMetrics instrumentation_library_metrics = 2; }

資源物件

Resource 物件是值對物件,其中包含有關產生指標之資源的一些資訊。對於由建立的指標 AWS,資料結構包含與指標相關的資源 ARN (例如EC2執行個體或 S3 儲存貯體) 的 Amazon 資源名稱 ()。

Resource 物件包含稱為 attributes 的屬性,其中會存放鍵/值對的清單。

  • cloud.account.id 包含帳戶 ID

  • cloud.region 包含區域

  • aws.exporter.arn包含度量資料流 ARN

  • cloud.provider 始終是 aws

// Resource information. message Resource { // Set of labels that describe the resource. repeated opentelemetry.proto.common.v1.KeyValue attributes = 1; // dropped_attributes_count is the number of dropped attributes. If the value is 0, // no attributes were dropped. uint32 dropped_attributes_count = 2; }

該 InstrumentationLibraryMetrics 對象

instrumentation_library 欄位將不會被填充。我們將只填寫我們正在匯出的指標欄位。

// A collection of Metrics produced by an InstrumentationLibrary. message InstrumentationLibraryMetrics { // The instrumentation library information for the metrics in this message. // If this field is not set then no library info is known. opentelemetry.proto.common.v1.InstrumentationLibrary instrumentation_library = 1; // A list of metrics that originate from an instrumentation library. repeated Metric metrics = 2; }

指標物件

指標物件包含 DoubleSummary 資料欄位,其中包含 DoubleSummaryDataPoint 的清單。

message Metric { // name of the metric, including its DNS name prefix. It must be unique. string name = 1; // description of the metric, which can be used in documentation. string description = 2; // unit in which the metric value is reported. Follows the format // described by http://unitsofmeasure.org/ucum.html. string unit = 3; oneof data { IntGauge int_gauge = 4; DoubleGauge double_gauge = 5; IntSum int_sum = 6; DoubleSum double_sum = 7; IntHistogram int_histogram = 8; DoubleHistogram double_histogram = 9; DoubleSummary double_summary = 11; } } message DoubleSummary { repeated DoubleSummaryDataPoint data_points = 1; }

該 MetricDescriptor 對象

MetricDescriptor 物件包含中繼資料。如需詳細資訊,請參閱上的量度。 GitHub

對於測量結果串流, MetricDescriptor 具有下列內容:

該 DoubleSummaryDataPoint 對象

DoubleSummaryDataPoint 物件包含量度中時間序列中單一資料點的 DoubleSummary 值。

// DoubleSummaryDataPoint is a single data point in a timeseries that describes the // time-varying values of a Summary metric. message DoubleSummaryDataPoint { // The set of labels that uniquely identify this timeseries. repeated opentelemetry.proto.common.v1.StringKeyValue labels = 1; // start_time_unix_nano is the last time when the aggregation value was reset // to "zero". For some metric types this is ignored, see data types for more // details. // // The aggregation value is over the time interval (start_time_unix_nano, // time_unix_nano]. // // Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January // 1970. // // Value of 0 indicates that the timestamp is unspecified. In that case the // timestamp may be decided by the backend. fixed64 start_time_unix_nano = 2; // time_unix_nano is the moment when this aggregation value was reported. // // Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January // 1970. fixed64 time_unix_nano = 3; // count is the number of values in the population. Must be non-negative. fixed64 count = 4; // sum of the values in the population. If count is zero then this field // must be zero. double sum = 5; // Represents the value at a given quantile of a distribution. // // To record Min and Max values following conventions are used: // - The 1.0 quantile is equivalent to the maximum value observed. // - The 0.0 quantile is equivalent to the minimum value observed. message ValueAtQuantile { // The quantile of a distribution. Must be in the interval // [0.0, 1.0]. double quantile = 1; // The value at the given quantile of a distribution. double value = 2; } // (Optional) list of values at different quantiles of the distribution calculated // from the current snapshot. The quantiles must be strictly increasing. repeated ValueAtQuantile quantile_values = 6; }

如需詳細資訊,請參閱 使用 OpenTelemetry 0.7.0 格式的翻譯