-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[5.x][status api] opt in to v6 metrics (#10481)
* [status api] opt in to viewing new metrics * [status] Add config flag to opt in to the v6 api * [status api] Fix returning old status * [status] Expose new format on global metrics, turn off by default
- Loading branch information
Showing
9 changed files
with
147 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,6 +36,7 @@ | |
border: 0; | ||
|
||
.content { | ||
display: block; | ||
text-align: right; | ||
padding: 15px; | ||
padding-right: 20px; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
import _ from 'lodash'; | ||
import expect from 'expect.js'; | ||
|
||
import { getMetrics } from '../metrics'; | ||
|
||
describe('Metrics', function () { | ||
const mockOps = { | ||
'requests': { '5603': { 'total': 22, 'disconnects': 0, 'statusCodes': { '200': 22 } } }, | ||
'responseTimes': { '5603': { 'avg': 1.8636363636363635, 'max': 4 } }, | ||
'sockets': { | ||
'http': { 'total': 0 }, | ||
'https': { 'total': 0 } | ||
}, | ||
'osload': [2.20751953125, 2.02294921875, 1.89794921875], | ||
'osmem': { 'total': 17179869184, 'free': 102318080 }, | ||
'osup': 1008991, | ||
'psup': 7.168, | ||
'psmem': { 'rss': 193716224, 'heapTotal': 168194048, 'heapUsed': 130553400 }, | ||
'concurrents': { '5603': 0 }, | ||
'psdelay': 1.6091690063476562, | ||
'host': '123' | ||
}; | ||
const config = { | ||
ops: { | ||
interval: 5000 | ||
}, | ||
server: { | ||
port: 5603 | ||
} | ||
}; | ||
|
||
let metrics; | ||
beforeEach(() => { | ||
metrics = getMetrics({ | ||
event: _.cloneDeep(mockOps), | ||
config: { | ||
get: path => _.get(config, path) | ||
} | ||
}); | ||
}); | ||
|
||
it('should snake case the request object', () => { | ||
expect(metrics.requests.status_codes).not.to.be(undefined); | ||
expect(metrics.requests.statusCodes).to.be(undefined); | ||
}); | ||
|
||
it('should provide defined metrics', () => { | ||
(function checkMetrics(currentMetric) { | ||
_.forOwn(currentMetric, value => { | ||
if (typeof value === 'object') return checkMetrics(value); | ||
expect(currentMetric).not.to.be(undefined); | ||
}); | ||
|
||
}(metrics)); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.