mirror of
https://github.com/Unleash/unleash.git
synced 2025-02-23 00:22:19 +01:00
fix: version should be part of ui-config (#616)
This commit is contained in:
parent
e42337e523
commit
1bb0d03855
@ -8,21 +8,16 @@ const {
|
||||
FEATURE_ARCHIVED,
|
||||
FEATURE_REVIVED,
|
||||
} = require('./event-type');
|
||||
const { version } = require('./routes/api-def');
|
||||
|
||||
const THREE_HOURS = 3 * 60 * 60 * 1000;
|
||||
|
||||
exports.startMonitoring = (
|
||||
enable,
|
||||
eventBus,
|
||||
eventStore,
|
||||
clientMetricsStore,
|
||||
featureToggleStore,
|
||||
) => {
|
||||
if (!enable) {
|
||||
exports.startMonitoring = ({ serverMetrics, eventBus, stores, version }) => {
|
||||
if (!serverMetrics) {
|
||||
return;
|
||||
}
|
||||
|
||||
const { eventStore, clientMetricsStore, featureToggleStore } = stores;
|
||||
|
||||
client.collectDefaultMetrics();
|
||||
|
||||
const requestDuration = new client.Summary({
|
||||
|
@ -15,13 +15,17 @@ test.before(() => {
|
||||
const featureToggleStore = {
|
||||
count: () => 123,
|
||||
};
|
||||
startMonitoring(
|
||||
true,
|
||||
const config = {
|
||||
serverMetrics: true,
|
||||
eventBus,
|
||||
eventStore,
|
||||
clientMetricsStore,
|
||||
featureToggleStore,
|
||||
);
|
||||
stores: {
|
||||
eventStore,
|
||||
clientMetricsStore,
|
||||
featureToggleStore,
|
||||
},
|
||||
version: '3.4.1',
|
||||
};
|
||||
startMonitoring(config);
|
||||
});
|
||||
|
||||
test('should collect metrics for requests', t => {
|
||||
|
@ -5,6 +5,7 @@ const parseDbUrl = require('parse-database-url');
|
||||
const merge = require('deepmerge');
|
||||
const { publicFolder } = require('unleash-frontend');
|
||||
const { defaultLogProvider, validateLogProvider } = require('./logger');
|
||||
const version = require('./util/version');
|
||||
|
||||
const THIRTY_DAYS = 30 * 24 * 60 * 60 * 1000;
|
||||
|
||||
@ -54,6 +55,7 @@ function defaultOptions() {
|
||||
start: true,
|
||||
keepAliveTimeout: 60 * 1000,
|
||||
headersTimeout: 61 * 1000,
|
||||
version,
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
{
|
||||
"version": 2,
|
||||
"version": 3,
|
||||
"links": {
|
||||
"feature-toggles": {
|
||||
"uri": "/api/admin/features"
|
||||
|
@ -5,7 +5,7 @@ const Controller = require('../controller');
|
||||
class ConfigController extends Controller {
|
||||
constructor(config) {
|
||||
super(config);
|
||||
this.uiConfig = config.ui;
|
||||
this.uiConfig = { ...config.ui, version: config.version };
|
||||
|
||||
this.get('/', this.getUIConfig);
|
||||
}
|
||||
|
@ -1,11 +1,8 @@
|
||||
'use strict';
|
||||
|
||||
// export module version
|
||||
require('pkginfo')(module, 'version');
|
||||
|
||||
const { version } = module.exports;
|
||||
const clientApiDef = require('./client-api/api-def.json');
|
||||
const adminApiDef = require('./admin-api/api-def.json');
|
||||
const version = require('../util/version');
|
||||
|
||||
const apiDef = {
|
||||
name: 'unleash-server',
|
||||
|
@ -1,5 +1,5 @@
|
||||
{
|
||||
"version": 2,
|
||||
"version": 3,
|
||||
"links": {
|
||||
"feature-toggles": {
|
||||
"uri": "/api/client/features"
|
||||
|
@ -31,13 +31,7 @@ async function createApp(options) {
|
||||
};
|
||||
|
||||
const app = getApp(config);
|
||||
startMonitoring(
|
||||
options.serverMetrics,
|
||||
eventBus,
|
||||
stores.eventStore,
|
||||
stores.clientMetricsStore,
|
||||
stores.featureToggleStore,
|
||||
);
|
||||
startMonitoring(config);
|
||||
|
||||
if (typeof config.eventHook === 'function') {
|
||||
addEventHook(config.eventHook, stores.eventStore);
|
||||
|
7
lib/util/version.js
Normal file
7
lib/util/version.js
Normal file
@ -0,0 +1,7 @@
|
||||
'use strict';
|
||||
|
||||
// export module version
|
||||
require('pkginfo')(module, 'version');
|
||||
|
||||
const { version } = module.exports;
|
||||
module.exports = version;
|
Loading…
Reference in New Issue
Block a user