-
Notifications
You must be signed in to change notification settings - Fork 6.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support
Get Effective TTL Configurations
API. (#12847)
* [Breaking Change] Rename `debugging-query` module to `status-query` module. Relative exposed APIs are **UNCHANGED**. * Support `Get Effective TTL Configurations` API.
- Loading branch information
Showing
45 changed files
with
527 additions
and
58 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# Get Effective TTL Configurations | ||
|
||
Time To Live (TTL) mechanism has different behaviors according to different storage implementations. By default, the | ||
core module provides two TTL configurations: [`recordDataTTL` and `metricsDataTTL`](../setup/backend/ttl.md). | ||
But some storage implementations could override these settings and provide its own TTL configurations, for example, | ||
BanyanDB provides its native TTL mechanism to support [progressive TTL](../banyandb/ttl.md) feature. | ||
|
||
This API is used to get the unified and effective TTL configurations. | ||
- URL, `http://{core restHost}:{core restPort}/status/config/ttl` | ||
- HTTP GET method. | ||
|
||
```shell | ||
> curl -X GET "http://127.0.0.1:12800/status/config/ttl" | ||
# Metrics TTL includes the definition of the TTL of the metrics-ish data in the storage, | ||
# e.g. | ||
# 1. The metadata of the service, instance, endpoint, topology map, etc. | ||
# 2. Generated metrics data from OAL and MAL engines. | ||
# | ||
# TTLs for each granularity metrics are listed separately. | ||
metrics.minute=7 | ||
metrics.hour=7 | ||
metrics.day=7 | ||
|
||
# Records TTL includes the definition of the TTL of the records data in the storage, | ||
# Records include traces, logs, sampled slow SQL statements, HTTP requests(by Rover), alarms, etc. | ||
# Super dataset of records are traces and logs, which volume should be much larger. | ||
records.default=3 | ||
records.superDataset=3 | ||
``` | ||
|
||
This API also provides the response in JSON format, which is more friendly for programmatic usage. | ||
|
||
```shell | ||
> curl -X GET "http://127.0.0.1:12800/status/config/ttl" \ | ||
-H "Accept: application/json" | ||
|
||
{ | ||
"metrics": { | ||
"minute": 7, | ||
"hour": 7, | ||
"day": 7 | ||
}, | ||
"records": { | ||
"default": 3, | ||
"superDataset": 3 | ||
} | ||
} | ||
``` |
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
60 changes: 60 additions & 0 deletions
60
...server-core/src/main/java/org/apache/skywalking/oap/server/core/query/TTLStatusQuery.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,60 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You 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.apache.skywalking.oap.server.core.query; | ||
|
||
import lombok.RequiredArgsConstructor; | ||
import org.apache.skywalking.oap.server.core.storage.StorageModule; | ||
import org.apache.skywalking.oap.server.core.storage.ttl.MetricsTTL; | ||
import org.apache.skywalking.oap.server.core.storage.ttl.RecordsTTL; | ||
import org.apache.skywalking.oap.server.core.storage.ttl.StorageTTLStatusQuery; | ||
import org.apache.skywalking.oap.server.core.storage.ttl.TTLDefinition; | ||
import org.apache.skywalking.oap.server.library.module.ModuleManager; | ||
import org.apache.skywalking.oap.server.library.module.Service; | ||
|
||
@RequiredArgsConstructor | ||
public class TTLStatusQuery implements Service { | ||
private final ModuleManager moduleManager; | ||
private final int coreMetricsDataTTL; | ||
private final int coreRecordDataTTL; | ||
|
||
private StorageTTLStatusQuery storageTTLStatusQuery; | ||
|
||
private StorageTTLStatusQuery getStorageTTLStatusQuery() { | ||
if (storageTTLStatusQuery == null) { | ||
storageTTLStatusQuery = moduleManager.find(StorageModule.NAME) | ||
.provider() | ||
.getService(StorageTTLStatusQuery.class); | ||
} | ||
return storageTTLStatusQuery; | ||
} | ||
|
||
/** | ||
* @return effective TTL configuration values. | ||
*/ | ||
public TTLDefinition getTTL() { | ||
TTLDefinition ttlDefinition = getStorageTTLStatusQuery().getTTL(); | ||
if (ttlDefinition == null) { | ||
ttlDefinition = new TTLDefinition( | ||
new MetricsTTL(coreMetricsDataTTL, coreMetricsDataTTL, coreMetricsDataTTL), | ||
new RecordsTTL(coreRecordDataTTL, coreRecordDataTTL) | ||
); | ||
} | ||
return ttlDefinition; | ||
} | ||
} |
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.