function transformMetric()

in packages/opentelemetry-cloud-monitoring-exporter/src/transform.ts [153:165]


function transformMetric<T>(
  point: DataPoint<T>,
  instrumentDescriptor: InstrumentDescriptor,
  metricPrefix: string
): {type: string; labels: {[key: string]: string}} {
  const type = transformMetricType(metricPrefix, instrumentDescriptor.name);
  const labels: {[key: string]: string} = {};

  Object.keys(point.attributes).forEach(key => {
    labels[normalizeLabelKey(key)] = `${point.attributes[key]}`;
  });
  return {type, labels};
}