Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
feat(sdk-metrics-base): add assertions for isMonotonic in Instrument …
…tests.
  • Loading branch information
pichlermarc committed Jul 8, 2022
commit 0291a654eaac263421c5b221c26742c9c7ff2b04
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ describe('Instruments', () => {
valueType: ValueType.INT,
},
dataPointType: DataPointType.SUM,
isMonotonic: true,
dataPoints: [
{
attributes: {},
Expand All @@ -100,6 +101,7 @@ describe('Instruments', () => {
counter.add(-1.1);
await validateExport(cumulativeReader, {
dataPointType: DataPointType.SUM,
isMonotonic: true,
dataPoints: [
{
attributes: {},
Expand All @@ -126,6 +128,7 @@ describe('Instruments', () => {
counter.add(1.2, { foo: 'bar' });
await validateExport(cumulativeReader, {
dataPointType: DataPointType.SUM,
isMonotonic: true,
dataPoints: [
{
attributes: {},
Expand All @@ -142,6 +145,7 @@ describe('Instruments', () => {
counter.add(-1.1);
await validateExport(cumulativeReader, {
dataPointType: DataPointType.SUM,
isMonotonic: true,
dataPoints: [
{
attributes: {},
Expand Down Expand Up @@ -200,6 +204,7 @@ describe('Instruments', () => {
valueType: ValueType.INT,
},
dataPointType: DataPointType.SUM,
isMonotonic: false,
dataPoints: [
{
attributes: {},
Expand All @@ -225,6 +230,7 @@ describe('Instruments', () => {
upDownCounter.add(1.1, { foo: 'bar' });
await validateExport(deltaReader, {
dataPointType: DataPointType.SUM,
isMonotonic: false,
dataPoints: [
{
attributes: {},
Expand Down Expand Up @@ -489,6 +495,7 @@ describe('Instruments', () => {

await validateExport(cumulativeReader, {
dataPointType: DataPointType.SUM,
isMonotonic: false,
dataPoints: [
{
attributes: {},
Expand All @@ -502,6 +509,7 @@ describe('Instruments', () => {
});
await validateExport(cumulativeReader, {
dataPointType: DataPointType.SUM,
isMonotonic: false,
dataPoints: [
{
attributes: {},
Expand Down Expand Up @@ -544,6 +552,7 @@ describe('Instruments', () => {

await validateExport(cumulativeReader, {
dataPointType: DataPointType.SUM,
isMonotonic: false,
dataPoints: [
{
attributes: {},
Expand All @@ -557,6 +566,7 @@ describe('Instruments', () => {
});
await validateExport(cumulativeReader, {
dataPointType: DataPointType.SUM,
isMonotonic: false,
dataPoints: [
{
attributes: {},
Expand Down Expand Up @@ -667,8 +677,9 @@ interface ValidateMetricData {
resource?: Resource;
instrumentationScope?: InstrumentationScope;
descriptor?: InstrumentDescriptor;
dataPointType?: DataPointType,
dataPointType?: DataPointType;
dataPoints?: Partial<DataPoint<number | Partial<Histogram>>>[];
isMonotonic?: boolean;
}

async function validateExport(reader: MetricReader, expected: ValidateMetricData) {
Expand Down