Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/*
* Copyright 2020 bithon.org
*
* 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 org.bithon.server.topo.api;
import org.bithon.component.db.dao.EndPointType;
import org.bithon.server.common.matcher.EqualMatcher;
import org.bithon.server.common.utils.datetime.TimeSpan;
import org.bithon.server.metric.DataSourceSchema;
import org.bithon.server.metric.DataSourceSchemaManager;
import org.bithon.server.metric.input.InputRow;
import org.bithon.server.metric.storage.DimensionCondition;
import org.bithon.server.metric.storage.IMetricReader;
import org.bithon.server.metric.storage.IMetricStorage;
import org.bithon.server.topo.service.EndpointBo;
import org.bithon.server.topo.service.Link;
import org.bithon.server.topo.service.Topo;
import org.bithon.server.topo.service.TopoService;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import javax.validation.Valid;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
/**
* @author [email protected]
* @date 2021/3/20 21:39
*/
@CrossOrigin
@RestController
public class TopoApi {
private final IMetricReader metricReader;
private final DataSourceSchema topoSchema;
public TopoApi(DataSourceSchemaManager schemaManager,
TopoService topoService,
IMetricStorage metricStorage) {
this.topoSchema = schemaManager.getDataSourceSchema("topo-metrics");
this.metricReader = metricStorage.createMetricReader(topoSchema);
}
@PostMapping("/api/topo/getApplicationTopo")
public Topo getTopo(@Valid @RequestBody GetTopoRequest request) {
TimeSpan start = TimeSpan.fromISO8601(request.getStartTimeISO8601());
TimeSpan end = TimeSpan.fromISO8601(request.getEndTimeISO8601());
List