-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[#9597] add inspector api for application stat
- Loading branch information
1 parent
f83fcf6
commit 281dff9
Showing
70 changed files
with
1,024 additions
and
407 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
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
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
47 changes: 47 additions & 0 deletions
47
...ain/java/com/navercorp/pinpoint/inspector/web/controller/ApplicationStatV2Controller.java
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,47 @@ | ||
package com.navercorp.pinpoint.inspector.web.controller; | ||
|
||
|
||
import com.navercorp.pinpoint.inspector.web.model.InspectorDataSearchKey; | ||
import com.navercorp.pinpoint.inspector.web.model.InspectorMetricData; | ||
import com.navercorp.pinpoint.inspector.web.service.ApplicationStatService; | ||
import com.navercorp.pinpoint.inspector.web.view.InspectorMetricView; | ||
import com.navercorp.pinpoint.metric.common.model.Range; | ||
import com.navercorp.pinpoint.metric.common.model.TimeWindow; | ||
import com.navercorp.pinpoint.metric.common.util.TimeWindowSampler; | ||
import com.navercorp.pinpoint.metric.common.util.TimeWindowSlotCentricSampler; | ||
import com.navercorp.pinpoint.pinot.tenant.TenantProvider; | ||
import org.springframework.web.bind.annotation.GetMapping; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RequestParam; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
import java.util.Objects; | ||
|
||
@RestController | ||
@RequestMapping("/getApplicationStatV2") | ||
public class ApplicationStatV2Controller { | ||
|
||
private final TimeWindowSampler DEFAULT_TIME_WINDOW_SAMPLER = new TimeWindowSlotCentricSampler(5000L, 200); | ||
|
||
private final TenantProvider tenantProvider; | ||
private final ApplicationStatService applicationStatService; | ||
|
||
public ApplicationStatV2Controller(ApplicationStatService applicationStatService, TenantProvider tenantProvider) { | ||
this.applicationStatService = Objects.requireNonNull(applicationStatService, "applicationStatService"); | ||
this.tenantProvider = Objects.requireNonNull(tenantProvider, "tenantProvider"); | ||
} | ||
|
||
@GetMapping(value = "/chart") | ||
public InspectorMetricView getApplicationStatChart( | ||
@RequestParam("applicationName") String applicationName, | ||
@RequestParam("metricDefinitionId") String metricDefinitionId, | ||
@RequestParam("from") long from, | ||
@RequestParam("to") long to) { | ||
String tenantId = tenantProvider.getTenantId(); | ||
TimeWindow timeWindow = new TimeWindow(Range.newRange(from, to), DEFAULT_TIME_WINDOW_SAMPLER); | ||
InspectorDataSearchKey inspectorDataSearchKey = new InspectorDataSearchKey(tenantId, applicationName, InspectorDataSearchKey.UNKNOWN_NAME, metricDefinitionId, timeWindow); | ||
|
||
InspectorMetricData inspectorMetricData = applicationStatService.selectApplicationStat(inspectorDataSearchKey, timeWindow); | ||
return new InspectorMetricView(inspectorMetricData); | ||
} | ||
} |
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
34 changes: 34 additions & 0 deletions
34
...pector-web/src/main/java/com/navercorp/pinpoint/inspector/web/dao/ApplicationStatDao.java
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,34 @@ | ||
/* | ||
* | ||
* * Copyright 2024 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.inspector.web.dao; | ||
|
||
import com.navercorp.pinpoint.inspector.web.definition.metric.field.Field; | ||
import com.navercorp.pinpoint.inspector.web.model.InspectorDataSearchKey; | ||
import com.navercorp.pinpoint.metric.common.model.chart.AvgMinMaxMetricPoint; | ||
|
||
import java.util.List; | ||
import java.util.concurrent.Future; | ||
|
||
/** | ||
* @author minwoo-jung | ||
*/ | ||
public interface ApplicationStatDao { | ||
Future<List<AvgMinMaxMetricPoint<Double>>> selectAgentStatAvgMinMax(InspectorDataSearchKey inspectorDataSearchKey, String metricName, Field field); | ||
} |
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
53 changes: 53 additions & 0 deletions
53
...src/main/java/com/navercorp/pinpoint/inspector/web/dao/pinot/PinotApplicationStatDao.java
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,53 @@ | ||
/* | ||
* | ||
* * Copyright 2024 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.inspector.web.dao.pinot; | ||
|
||
import com.navercorp.pinpoint.inspector.web.dao.ApplicationStatDao; | ||
import com.navercorp.pinpoint.inspector.web.dao.model.InspectorQueryParameter; | ||
import com.navercorp.pinpoint.inspector.web.definition.metric.field.Field; | ||
import com.navercorp.pinpoint.inspector.web.model.InspectorDataSearchKey; | ||
import com.navercorp.pinpoint.metric.common.model.chart.AvgMinMaxMetricPoint; | ||
import com.navercorp.pinpoint.pinot.mybatis.PinotAsyncTemplate; | ||
import org.springframework.beans.factory.annotation.Qualifier; | ||
import org.springframework.stereotype.Repository; | ||
|
||
import java.util.List; | ||
import java.util.Objects; | ||
import java.util.concurrent.Future; | ||
|
||
/** | ||
* @author minwoo-jung | ||
*/ | ||
@Repository | ||
public class PinotApplicationStatDao implements ApplicationStatDao { | ||
|
||
private static final String NAMESPACE = PinotApplicationStatDao.class.getName() + "."; | ||
private final PinotAsyncTemplate asyncTemplate; | ||
|
||
public PinotApplicationStatDao(@Qualifier("inspectorPinotAsyncTemplate") PinotAsyncTemplate asyncTemplate) { | ||
this.asyncTemplate = Objects.requireNonNull(asyncTemplate, "asyncTemplate"); | ||
} | ||
|
||
@Override | ||
public Future<List<AvgMinMaxMetricPoint<Double>>> selectAgentStatAvgMinMax(InspectorDataSearchKey inspectorDataSearchKey, String metricName, Field field) { | ||
InspectorQueryParameter inspectorQueryParameter = new InspectorQueryParameter(inspectorDataSearchKey, metricName, field.getFieldName()); | ||
return asyncTemplate.selectList(NAMESPACE + "selectInspectorAvgMinMaxData", inspectorQueryParameter); | ||
} | ||
} |
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
Oops, something went wrong.