Skip to content

Commit 7069432

Browse files
committed
Allow to restrict measures by start and end timestamp
1 parent b13093e commit 7069432

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

src/Metric/v1/Gnocchi/Api.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,8 @@ public function getResourceMetricMeasures(): array
123123
'type' => $this->params->resourceType(),
124124
'granularity' => $this->params->granularity(),
125125
'aggregation' => $this->params->aggregation(),
126+
'start' => $this->params->measureStart(),
127+
'stop' => $this->params->measureStop()
126128
],
127129
];
128130
}

src/Metric/v1/Gnocchi/Params.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,4 +70,24 @@ public function aggregation(): array
7070
'type' => self::STRING_TYPE
7171
];
7272
}
73+
74+
private function measureTimestamp(string $sentAs): array
75+
{
76+
return [
77+
'location' => self::QUERY,
78+
'type' => self::STRING_TYPE,
79+
'sentAs' => $sentAs,
80+
'description' => 'Measure start timestamp which can be either a floating number (UNIX epoch) or an ISO8601 formatted timestamp'
81+
];
82+
}
83+
84+
public function measureStart(): array
85+
{
86+
return $this->measureTimestamp('start');
87+
}
88+
89+
public function measureStop(): array
90+
{
91+
return $this->measureTimestamp('stop');
92+
}
7393
}

0 commit comments

Comments
 (0)