Skip to content

Commit

Permalink
Add build_flavor to /api/status response (elastic#176477)
Browse files Browse the repository at this point in the history
## Summary

Fix elastic#176475

Add the `version.build_flavor` field to the response of the status API

---------

Co-authored-by: kibanamachine <[email protected]>
  • Loading branch information
2 people authored and fkanout committed Mar 4, 2024
1 parent 9eed916 commit 8b16c7a
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ const buildServerVersion = (parts: Partial<ServerVersion> = {}): ServerVersion =
build_number: 9000,
build_snapshot: false,
build_date: '2023-05-15T23:12:09.000Z',
build_flavor: 'traditional',
...parts,
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ const mockedResponse: StatusResponse = {
build_number: 12,
build_snapshot: false,
build_date: '2023-05-15T23:12:09.000Z',
build_flavor: 'traditional',
},
status: {
overall: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
* Side Public License, v 1.
*/

import type { BuildFlavor } from '@kbn/config';
import type { ServiceStatusLevelId, ServiceStatus, CoreStatus } from '@kbn/core-status-common';
import type { OpsMetrics } from '@kbn/core-metrics-server';

Expand Down Expand Up @@ -34,6 +35,7 @@ export interface ServerVersion {
build_hash: string;
build_number: number;
build_snapshot: boolean;
build_flavor: BuildFlavor;
build_date: string;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
],
"kbn_references": [
"@kbn/core-status-common",
"@kbn/core-metrics-server"
"@kbn/core-metrics-server",
"@kbn/config"
],
"exclude": [
"target/**/*",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ const getFullStatusResponse = async ({
};
query: { v8format?: boolean; v7format?: boolean };
}): Promise<StatusHttpBody> => {
const { version, buildSha, buildNum, buildDate } = config.packageInfo;
const { version, buildSha, buildNum, buildDate, buildFlavor } = config.packageInfo;
const versionWithoutSnapshot = version.replace(SNAPSHOT_POSTFIX, '');

let statusInfo: StatusInfo | LegacyStatusInfo;
Expand Down Expand Up @@ -186,6 +186,7 @@ const getFullStatusResponse = async ({
build_hash: buildSha,
build_number: buildNum,
build_snapshot: SNAPSHOT_POSTFIX.test(version),
build_flavor: buildFlavor,
build_date: buildDate.toISOString(),
},
status: statusInfo,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ describe('GET /api/status', () => {
build_number: 1234,
build_snapshot: true,
build_date: new Date('2023-05-15T23:12:09.000Z').toISOString(),
build_flavor: 'traditional',
});
const metricsMockValue = await firstValueFrom(metrics.getOpsMetrics$());
expect(result.body.metrics).toEqual({
Expand Down

0 comments on commit 8b16c7a

Please sign in to comment.