Skip to content

Commit 6f4a7ab

Browse files
authored
Merge pull request #249 from scouter-contrib/development
Development PR
2 parents 70e7249 + 64ae44e commit 6f4a7ab

File tree

21 files changed

+666
-126
lines changed

21 files changed

+666
-126
lines changed

docker/.env

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
PAPER_VERSION=2.6.0
1+
PAPER_VERSION=2.6.2-a

http/xflow.http

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,3 +72,6 @@ GET http://demo.scouterapm.com:6188/scouter/v1/xlog-data/20191017/-8542316848524
7272
GET http://demo.scouterapm.com:6188/scouter/v1/dictionary/20191020?dictKeys=[table:566700965]
7373

7474
###
75+
GET http://demo.scouterapm.com:6188/scouter/v1/dictionary/20191106?dictKeys=[error:305445213]
76+
77+
###

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@
8282
"scripts": {
8383
"start": "node scripts/start.js",
8484
"build": "node scripts/build.js",
85+
"postbuild": "cd build; zip -r ../scouter-paper.zip *",
8586
"test": "node scripts/test.js --env=jsdom"
8687
},
8788
"jest": {

src/App.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -456,7 +456,7 @@ class App extends Component {
456456
css.innerHTML += "html,body,svg text,input,select,button { font-family: '" + fontSetting.basic + "','Nanum Gothic'," + this.getFontGeneric(fontSetting.basic) + "; }";
457457
css.innerHTML += ".layout-manager .content-ilst { font-family: '" + fontSetting.basic + "','Nanum Gothic'," + this.getFontGeneric(fontSetting.basic) + "; }";
458458
css.innerHTML += ".instance-selector .list-content { font-family: '" + fontSetting.basic + "','Nanum Gothic'," + this.getFontGeneric(fontSetting.basic) + "; }";
459-
css.innerHTML += "svg text { font-family: '" + fontSetting.axis + "','Nanum Gothic'," + this.getFontGeneric(fontSetting.axis) + "; }";
459+
css.innerHTML += `svg text { font-family: '${fontSetting.axis}','Nanum Gothic',${this.getFontGeneric(fontSetting.axis)}; font-size: ${fontSetting.axisFontSize}; }`;
460460
css.innerHTML += ".tooltip { font-family: '" + fontSetting.tooltip + "','Nanum Gothic'," + this.getFontGeneric(fontSetting.tooltip) + "; }";
461461
css.innerHTML += ".xlog-profiler { font-family: '" + fontSetting.profiler + "','Nanum Gothic'," + this.getFontGeneric(fontSetting.profiler) + "; }";
462462
css.innerHTML += ".menu-div { font-family: '" + fontSetting.menu + "','Nanum Gothic'," + this.getFontGeneric(fontSetting.menu) + "; }";

src/common/InstanceColor.js

Lines changed: 36 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,49 @@
11
import * as d3 from "d3";
2-
import {schemeSet3} from "d3-scale-chromatic";
2+
import {schemeSet3,interpolateViridis} from "d3-scale-chromatic";
33
import Color from "color-js";
44

55
let instanceColors = {};
66
let metricColors = {};
7+
let xlogColors = {};
8+
const defaultRgbMapBlue10=[
9+
"#1E90FF"
10+
,"#2E8B57"
11+
,"#8B4513"
12+
,"#66CDAA"
13+
,"#0064CD"
14+
,"#698AA3"
15+
,"#5A5AFF"
16+
,"#ADA893"
17+
,"#006400"
18+
,"#6D7270"
19+
];
20+
21+
722
class InstanceColor {
23+
24+
25+
826
static setInstances(instances, colorType) {
927
instanceColors = {};
28+
const _xlogFamilly = instances.filter(_in=> _in.objFamily === 'javaee' || _in.objFamily === 'tracing');
29+
const _total = _xlogFamilly.length;
30+
_xlogFamilly.forEach((instance, n) => {
31+
xlogColors[instance.objHash] = interpolateViridis(n/_total);
32+
});
33+
1034
instances.forEach((instance, n) => {
1135
instanceColors[instance.objHash] = [];
1236
let instanceBaseColor;
13-
if (n > 9) {
37+
38+
if (n > 10) {
1439
let cnt = Math.floor(n / 10);
15-
instanceBaseColor = Color(d3.schemeCategory10[n % 10]).shiftHue(20 * cnt);
40+
instanceBaseColor = Color(defaultRgbMapBlue10[n % 10]).shiftHue(20 * cnt);
1641
} else {
17-
instanceBaseColor = d3.schemeCategory10[n]; // 10
42+
instanceBaseColor = defaultRgbMapBlue10[n]; // 10
1843
}
44+
1945
instanceColors[instance.objHash].push(instanceBaseColor);
46+
2047
for (let i=0; i<4; i++) {
2148
let color = Color(instanceBaseColor);
2249
if (colorType === "white") {
@@ -26,11 +53,16 @@ class InstanceColor {
2653
}
2754
}
2855
});
56+
57+
2958
}
3059

3160
static getInstanceColors() {
3261
return instanceColors;
3362
}
63+
static getXlogColors() {
64+
return xlogColors;
65+
}
3466

3567
static getMetricColor(metric, colorType) {
3668
if (!metricColors[metric]) {

src/common/ScouterApi.js

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
import jQuery from "jquery";
2+
import {getCurrentUser, getWithCredentials, setAuthHeader} from "./common";
3+
4+
export default class ScouterApi {
5+
//- Default Api
6+
// App, Control API List
7+
static isAuthentification(config) {
8+
const {addr,conf,user,serverId} = config;
9+
10+
return jQuery.ajax({
11+
method: "GET",
12+
async: true,
13+
url: `${addr}/scouter/v1/kv/a?serverId=${serverId}`,
14+
xhrFields: getWithCredentials(conf),
15+
beforeSend: (xhr)=> setAuthHeader(xhr, conf, user)
16+
});
17+
}
18+
static getObjectPreset(config) {
19+
const {addr,conf,user,serverId} = config;
20+
21+
return jQuery.ajax({
22+
method: "GET",
23+
async: true,
24+
url: `${addr}/scouter/v1/kv/__scouter_paper_preset?serverId=${serverId}`,
25+
xhrFields: getWithCredentials(conf),
26+
beforeSend: (xhr)=> setAuthHeader(xhr, conf, getCurrentUser(conf,user))
27+
});
28+
}
29+
static getAlertList(config,offset,objType){
30+
const {addr,conf,user,serverId} = config;
31+
const {ol,la} = offset;
32+
return jQuery.ajax({
33+
method: "GET",
34+
async: true,
35+
url: `${addr}/scouter/v1/alert/realTime/${ol}/${la}?objType=${objType}&serverId=${serverId}`,
36+
xhrFields: getWithCredentials(conf),
37+
beforeSend: (xhr)=> setAuthHeader(xhr, conf, getCurrentUser(conf,user))
38+
});
39+
}
40+
static getConterModel(config){
41+
const {addr,conf,user,serverId} = config;
42+
return jQuery.ajax({
43+
method: "GET",
44+
async: true,
45+
url: `${addr}/scouter/v1/info/counter-model?serverId=${serverId}`,
46+
xhrFields: getWithCredentials(conf),
47+
beforeSend: (xhr)=> setAuthHeader(xhr, conf, getCurrentUser(conf,user))
48+
});
49+
}
50+
51+
static getMonitoringObjects(config){
52+
const {addr,conf,user,serverId} = config;
53+
return jQuery.ajax({
54+
method: "GET",
55+
async: true,
56+
url: `${addr}scouter/v1/object?serverId=${serverId}`,
57+
xhrFields: getWithCredentials(conf),
58+
beforeSend: (xhr)=> setAuthHeader(xhr, conf, getCurrentUser(conf,user))
59+
});
60+
61+
}
62+
static getConnectedServer(config){
63+
const {addr,conf,user} = config;
64+
return jQuery.ajax({
65+
method: "GET",
66+
async: true,
67+
url: `${addr}scouter/v1/info/server`,
68+
xhrFields: getWithCredentials(conf),
69+
beforeSend: (xhr)=> setAuthHeader(xhr, conf, getCurrentUser(conf,user))
70+
});
71+
72+
}
73+
//- 실시간 쪽
74+
static getRealTimeCounter(config,params,objects){
75+
const {addr,conf,user,serverId} = config;
76+
return jQuery.ajax({
77+
method: "GET",
78+
async: true,
79+
url: `${addr}/scouter/v1/counter/realTime/${params}?objHashes=${JSON.stringify(objects.map(obj=>Number(obj.objHash)))}?serverId=${serverId}`,
80+
xhrFields: getWithCredentials(conf),
81+
beforeSend: (xhr)=> setAuthHeader(xhr, conf, getCurrentUser(conf,user))
82+
});
83+
}
84+
}

src/common/common.js

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// local storage access
22
import moment from "moment";
33
import {Dictionary, DictType} from "./dictionary";
4-
export const version = "2.6.1";
4+
export const version = "2.6.2";
55

66
export function getData(key) {
77
let ls = null;
@@ -720,7 +720,12 @@ export function getFilteredData (xlogs, filter) {
720720
if (filter.startHmsFrom && filter.startHmsTo) {
721721
let dm = dateMillis(filter.startHmsFrom, filter.startHmsTo);
722722
if(dm !== null) {
723-
datas = datas.filter((d) => (((Number(d.endTime) - Number(d.elapsed)) >= dm[0]) && ((Number(d.endTime) - Number(d.elapsed)) <= dm[1])));
723+
const [startFilter,endFilter] = dm.split(':');
724+
datas = datas.filter((d) => {
725+
const _startTime = Number(d.endTime) - Number(d.elapsed);
726+
return _startTime >= Number(startFilter) && _startTime <= Number(endFilter);
727+
});
728+
724729
}
725730
}
726731

@@ -796,3 +801,16 @@ export function updateQueryStringParameter(uri, key, value) {
796801
return uri + separator + key + "=" + value;
797802
}
798803
}
804+
export function confBuilder(addr,conf,user,serverId){
805+
return {
806+
addr : addr,
807+
conf : conf,
808+
user : user,
809+
serverId : serverId
810+
}
811+
}
812+
813+
export function timeMiToMs(min){
814+
return min * 60 * 1000;
815+
816+
}

src/components/Controller/Controller.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,10 @@ class Controller extends Component {
270270
common.setTargetServerToUrl(this.props, config);
271271
common.replaceAllLocalSettingsForServerChange(currentServer, this.props, config);
272272
common.clearAllUrlParamOfPaper(this.props, config);
273+
//- server가 바뀌어 쓰므로 해당 설정이 같이 삭제 되어야함
273274
localStorage.removeItem("selectedObjects");
275+
localStorage.removeItem("topologyOptions");
276+
localStorage.removeItem("topologyPosition");
274277
window.location.reload();
275278

276279
};
@@ -789,6 +792,7 @@ class Controller extends Component {
789792
};
790793

791794
toggleFilteredObject = (objHash) => {
795+
792796
if (this.props.filterMap[objHash]) {
793797
this.props.removeFilteredObject(objHash);
794798
} else {

src/components/Menu/Menu.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,15 @@ class Menu extends Component {
2222
showAlert: false
2323
};
2424
}
25-
25+
componentWillReceiveProps(nextProps) {
26+
const {pathname}= nextProps.location;
27+
if( pathname !== this.props.pathname){
28+
this.setState({
29+
menu: pathname
30+
});
31+
this.props.setMenu(pathname);
32+
}
33+
}
2634
componentDidMount() {
2735
this.setState({
2836
menu: this.props.location.pathname

0 commit comments

Comments
 (0)