

Le traduzioni sono generate tramite traduzione automatica. In caso di conflitto tra il contenuto di una traduzione e la versione originale in Inglese, quest'ultima prevarrà.

# CloudWatch flusso metrico in uscita in formato 0.7.0 OpenTelemetry
<a name="CloudWatch-metric-streams-formats-opentelemetry"></a>

OpenTelemetry è una raccolta di strumenti e. APIs SDKs È possibile utilizzarlo per strumentare, generare, raccogliere ed esportare dati di telemetria (metriche, log e tracce) per l'analisi. OpenTelemetry fa parte della Cloud Native Computing Foundation. Per ulteriori informazioni, consulta [OpenTelemetry](https://opentelemetry.io/).

Per informazioni sulla specifica OpenTelemetry 0.7.0 completa, vedere la versione [v0.7.0](https://github.com/open-telemetry/opentelemetry-proto/releases/tag/v0.7.0).

Un record Kinesis può contenere una o più strutture di `ExportMetricsServiceRequest` OpenTelemetry dati. Ogni struttura dati inizia con un'intestazione con `UnsignedVarInt32` che indica la lunghezza del record in byte. Ciascuna `ExportMetricsServiceRequest` può contenere dati provenienti da più parametri contemporaneamente.

Quanto segue è una rappresentazione in formato stringa del messaggio della struttura `ExportMetricsServiceRequest` OpenTelemetry dati. OpenTelemetry serializza il protocollo binario di Google Protocol Buffers e questo non è leggibile dall'uomo.

```
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
          }
        }
      }
    }
  }
}
```

**Oggetto di primo livello per serializzare i dati metrici OpenTelemetry **

`ExportMetricsServiceRequest`è il wrapper di primo livello per serializzare un payload di esportazione. OpenTelemetry Contiene uno o più `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`è l'oggetto di primo livello per rappresentare gli oggetti. 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;
}
```

**Oggetto della risorsa**

Un oggetto `Resource` è un oggetto coppia di valori che contiene alcune informazioni sulla risorsa che ha generato i parametri. Per i parametri creati da AWS, la struttura dati contiene l'ARN (Amazon Resource Name) della risorsa correlata al parametro, ad esempio un'istanza EC2 o un bucket S3.

L'oggetto `Resource` contiene un attributo denominato `attributes`, che memorizza un elenco di coppie chiave-valore.
+ `cloud.account.id` contiene l'ID dell'account
+ `cloud.region` contiene la regione
+ `aws.exporter.arn` contiene l'ARN del flusso di parametri
+ `cloud.provider` è sempre `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;
}
```

**L'oggetto InstrumentationLibraryMetrics **

Il campo instrumentation\_library non verrà compilato. Compileremo solo il campo dei parametri che stiamo esportando.

```
// 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;
}
```

**L'oggetto Metric**

L'oggetto Metric contiene un campo dati `DoubleSummary` che contiene un elenco di `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;
}
```

**L' MetricDescriptor oggetto**

L' MetricDescriptor oggetto contiene metadati. Per ulteriori informazioni, vedete [metrics.proto](https://github.com/open-telemetry/opentelemetry-proto/blob/main/opentelemetry/proto/metrics/v1/metrics.proto#L110) on. GitHub

Per gli stream metrici, ha i seguenti contenuti: MetricDescriptor 
+ `name` sarà `amazonaws.com/{{metric_namespace}}/{{metric_name}}`
+ `description` sarà vuoto.
+ `unit` verrà compilato mappando l'unità del dato del parametro alla variante con distinzione tra maiuscole e minuscole del codice unificato per le unità di misura. Per ulteriori informazioni, consulta [Traduzioni con formato OpenTelemetry 0.7.0 in CloudWatch](CloudWatch-metric-streams-formats-opentelemetry-translation.md) and [Il codice unificato per le unità di misura](https://ucum.org/ucum.html).
+ `type` sarà `SUMMARY`.

**L'oggetto DoubleSummaryDataPoint **

L' DoubleSummaryDataPoint oggetto contiene il valore di un singolo punto dati in una serie temporale in una DoubleSummary metrica.

```
// 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;
}
```

Per ulteriori informazioni, consulta [Traduzioni con formato OpenTelemetry 0.7.0 in CloudWatch](CloudWatch-metric-streams-formats-opentelemetry-translation.md).