Skip to content

Commit

Permalink
Add method, that get scatter data made of dot group . #1518
Browse files Browse the repository at this point in the history
added getFilteredServerMapDataMadeOfDotGroup method.
  • Loading branch information
koo-taejin committed Feb 24, 2016
1 parent bce3f0f commit a9d84f7
Show file tree
Hide file tree
Showing 16 changed files with 408 additions and 118 deletions.
@@ -1,86 +1,29 @@
/*
* Copyright 2014 NAVER Corp.
* Copyright 2016 NAVER Corp.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.navercorp.pinpoint.web.applicationmap;

import java.util.*;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.navercorp.pinpoint.web.vo.*;
import com.navercorp.pinpoint.web.vo.scatter.ApplicationScatterScanResult;
import com.fasterxml.jackson.annotation.JsonProperty;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.Collection;

/**
* Node map
*
* @author netspider
* @author emeroad
* @Author Taejin Koo
*/
public class ApplicationMap {

private final Logger logger = LoggerFactory.getLogger(this.getClass());

private final NodeList nodeList;
private final LinkList linkList;

private final Range range;

private List<ApplicationScatterScanResult> applicationScatterScanResultList;


ApplicationMap(Range range, NodeList nodeList, LinkList linkList) {
if (range == null) {
throw new NullPointerException("range must not be null");
}
if (nodeList == null) {
throw new NullPointerException("nodeList must not be null");
}
if (linkList == null) {
throw new NullPointerException("linkList must not be null");
}
this.range = range;
this.nodeList = nodeList;
this.linkList = linkList;
}

@JsonProperty("nodeDataArray")
public Collection<Node> getNodes() {
return this.nodeList.getNodeList();
}

@JsonProperty("linkDataArray")
public Collection<Link> getLinks() {
return this.linkList.getLinkList();
}


public void setApplicationScatterScanResult(List<ApplicationScatterScanResult> applicationScatterScanResultList) {
this.applicationScatterScanResultList = applicationScatterScanResultList;
}

@JsonIgnore
public List<ApplicationScatterScanResult> getApplicationScatterScanResultList() {
return applicationScatterScanResultList;
}


public interface ApplicationMap {

Collection<Node> getNodes();

Collection<Link> getLinks();

}
Expand Up @@ -64,15 +64,15 @@ public ApplicationMap build(Application application, AgentInfoService agentInfoS
}
}
if (runningAgents.isEmpty()) {
return new ApplicationMap(range, nodeList, emptyLinkList);
return new DefaultApplicationMap(range, nodeList, emptyLinkList);
} else {
ServerBuilder serverBuilder = new ServerBuilder();
serverBuilder.addAgentInfo(runningAgents);
ServerInstanceList serverInstanceList = serverBuilder.build();
node.setServerInstanceList(serverInstanceList);
node.setNodeHistogram(new NodeHistogram(application, range));
nodeList.addNode(node);
return new ApplicationMap(range, nodeList, emptyLinkList);
return new DefaultApplicationMap(range, nodeList, emptyLinkList);
}
}

Expand All @@ -91,7 +91,7 @@ public ApplicationMap build(LinkDataDuplexMap linkDataDuplexMap, AgentInfoPopula
appendNodeResponseTime(nodeList, linkList, nodeHistogramDataSource);
appendAgentInfo(nodeList, linkDataDuplexMap, agentInfoPopulator);

final ApplicationMap map = new ApplicationMap(range, nodeList, linkList);
final ApplicationMap map = new DefaultApplicationMap(range, nodeList, linkList);
return map;
}

Expand Down
@@ -0,0 +1,53 @@
/*
* Copyright 2016 NAVER Corp.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.navercorp.pinpoint.web.applicationmap;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.navercorp.pinpoint.web.scatter.ScatterData;
import com.navercorp.pinpoint.web.vo.Application;

import java.util.Collection;
import java.util.Map;

/**
* @Author Taejin Koo
*/
public class ApplicationMapWithScatterData implements ApplicationMap {

private final ApplicationMap applicationMap;
private final Map<Application, ScatterData> applicationScatterDataMap;

public ApplicationMapWithScatterData(ApplicationMap applicationMap, Map<Application, ScatterData> applicationScatterDataMap) {
this.applicationMap = applicationMap;
this.applicationScatterDataMap = applicationScatterDataMap;
}

@Override
public Collection<Node> getNodes() {
return applicationMap.getNodes();
}

@Override
public Collection<Link> getLinks() {
return applicationMap.getLinks();
}

@JsonIgnore
public Map<Application, ScatterData> getApplicationScatterDataMap() {
return applicationScatterDataMap;
}

}
@@ -0,0 +1,52 @@
/*
* Copyright 2016 NAVER Corp.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.navercorp.pinpoint.web.applicationmap;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.navercorp.pinpoint.web.vo.scatter.ApplicationScatterScanResult;

import java.util.Collection;
import java.util.List;

/**
* @Author Taejin Koo
*/
public class ApplicationMapWithScatterScanResult implements ApplicationMap {

private final ApplicationMap applicationMap;
private final List<ApplicationScatterScanResult> applicationScatterScanResultList;

public ApplicationMapWithScatterScanResult(ApplicationMap applicationMap, List<ApplicationScatterScanResult> applicationScatterScanResultList) {
this.applicationMap = applicationMap;
this.applicationScatterScanResultList = applicationScatterScanResultList;
}

@Override
public Collection<Node> getNodes() {
return applicationMap.getNodes();
}

@Override
public Collection<Link> getLinks() {
return applicationMap.getLinks();
}

@JsonIgnore
public List<ApplicationScatterScanResult> getApplicationScatterScanResultList() {
return applicationScatterScanResultList;
}

}
@@ -0,0 +1,66 @@
/*
* Copyright 2014 NAVER Corp.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.navercorp.pinpoint.web.applicationmap;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.navercorp.pinpoint.web.vo.Range;
import com.navercorp.pinpoint.web.vo.scatter.ApplicationScatterScanResult;

import java.util.Collection;
import java.util.List;

/**
* Node map
*
* @author netspider
* @author emeroad
*/
public class DefaultApplicationMap implements ApplicationMap {

private final NodeList nodeList;
private final LinkList linkList;

private final Range range;

private List<ApplicationScatterScanResult> applicationScatterScanResultList;

DefaultApplicationMap(Range range, NodeList nodeList, LinkList linkList) {
if (range == null) {
throw new NullPointerException("range must not be null");
}
if (nodeList == null) {
throw new NullPointerException("nodeList must not be null");
}
if (linkList == null) {
throw new NullPointerException("linkList must not be null");
}
this.range = range;
this.nodeList = nodeList;
this.linkList = linkList;
}

@JsonProperty("nodeDataArray")
public Collection<Node> getNodes() {
return this.nodeList.getNodeList();
}

@JsonProperty("linkDataArray")
public Collection<Link> getLinks() {
return this.linkList.getLinkList();
}

}
Expand Up @@ -18,9 +18,6 @@

import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.navercorp.pinpoint.web.view.FilterMapWrapSerializer;
import com.navercorp.pinpoint.web.vo.scatter.ApplicationScatterScanResult;

import java.util.List;

/**
* @author emeroad
Expand All @@ -47,7 +44,4 @@ public Long getLastFetchedTimestamp() {
return lastFetchedTimestamp;
}

public List<ApplicationScatterScanResult> getApplicationScatterScanResult() {
return this.applicationMap.getApplicationScatterScanResultList();
}
}

0 comments on commit a9d84f7

Please sign in to comment.