mirror of
https://github.com/nextcloud/server.git
synced 2026-06-10 17:23:59 -04:00
chore(openmetrics): use "app_id" label instead of "app_name"
Signed-off-by: Jyrki Gadinger <nilsding@nilsding.org>
This commit is contained in:
parent
3e5daac0c5
commit
e7b1b69e66
2 changed files with 6 additions and 6 deletions
|
|
@ -50,7 +50,7 @@ class AppInfo implements IMetricFamily {
|
|||
$apps = [];
|
||||
$enabledApps = $this->appManager->getEnabledApps();
|
||||
foreach ($this->appManager->getAppInstalledVersions(false) as $appId => $version) {
|
||||
yield new Metric(in_array($appId, $enabledApps, true) ? 1 : 0, ['app_name' => $appId, 'version' => $version]);
|
||||
yield new Metric(in_array($appId, $enabledApps, true) ? 1 : 0, ['app_id' => $appId, 'version' => $version]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,14 +39,14 @@ class AppInfoTest extends ExporterTestCase {
|
|||
|
||||
public function testMetrics(): void {
|
||||
$this->assertCount(4, $this->metrics);
|
||||
foreach ($this->appList as $appName => $appVersion) {
|
||||
$metricForApp = array_find($this->metrics, function (Metric $metric) use ($appName) {
|
||||
return $metric->label('app_name') === $appName;
|
||||
foreach ($this->appList as $appId => $appVersion) {
|
||||
$metricForApp = array_find($this->metrics, function (Metric $metric) use ($appId) {
|
||||
return $metric->label('app_id') === $appId;
|
||||
});
|
||||
|
||||
$expectedMetricValue = in_array($appName, $this->installedAppsList) ? 1 : 0;
|
||||
$expectedMetricValue = in_array($appId, $this->installedAppsList) ? 1 : 0;
|
||||
$this->assertEquals($expectedMetricValue, $metricForApp->value);
|
||||
$this->assertSame(['app_name' => $appName, 'version' => $appVersion], $metricForApp->labels);
|
||||
$this->assertSame(['app_id' => $appId, 'version' => $appVersion], $metricForApp->labels);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue