in packages/opentelemetry-cloud-monitoring-exporter/src/transform.ts [100:130]
function transformValueType(metric: MetricData): ValueType {
const {
dataPointType,
descriptor: {valueType},
} = metric;
switch (dataPointType) {
case DataPointType.HISTOGRAM:
case DataPointType.EXPONENTIAL_HISTOGRAM:
return ValueType.DISTRIBUTION;
case DataPointType.GAUGE:
case DataPointType.SUM:
// handle below
break;
default:
exhaust(dataPointType);
// No logging needed as it will be done in transformPoints()
return ValueType.VALUE_TYPE_UNSPECIFIED;
}
switch (valueType) {
case OTValueType.DOUBLE:
return ValueType.DOUBLE;
case OTValueType.INT:
return ValueType.INT64;
default:
exhaust(valueType);
diag.info('Encountered unexpected value type %s', valueType);
return ValueType.VALUE_TYPE_UNSPECIFIED;
}
}