...
 
Commits (2)
    https://gitcode.net/apache/skywalking/-/commit/1a2f79447297739a4e7ab44e7254e8899bca4c12 Fix `DurationUtils.getDurationPoints` exceed, when `startTimeBucket` equals... 2023-02-24T11:39:55+08:00 Wan Kai wankai123@foxmail.com Fix `DurationUtils.getDurationPoints` exceed, when `startTimeBucket` equals `endTimeBucket`. (#10441) https://gitcode.net/apache/skywalking/-/commit/62926da42acf88660b110ae4c5c9c608c888aaa3 Bump up license-eye to speed up CI (#10443) 2023-02-24T14:11:47+08:00 kezhenxu94 kezhenxu94@apache.org
......@@ -41,7 +41,7 @@ jobs:
with:
submodules: true
- name: Check license header
uses: apache/skywalking-eyes@df70871af1a8109c9a5b1dc824faaf65246c5236
uses: apache/skywalking-eyes@775fe1ffda59b7e100aa144d0ef8d7beae17f97d
code-style:
if: (github.event_name == 'schedule' && github.repository == 'apache/skywalking') || (github.event_name != 'schedule')
......@@ -78,7 +78,7 @@ jobs:
go-version: "1.16"
- name: Check Dependencies Licenses
run: |
go install github.com/apache/skywalking-eyes/cmd/license-eye@df70871af1a8109c9a5b1dc824faaf65246c5236
go install github.com/apache/skywalking-eyes/cmd/license-eye@775fe1ffda59b7e100aa144d0ef8d7beae17f97d
license-eye dependency resolve --summary ./dist-material/release-docs/LICENSE.tpl || exit 1
if [ ! -z "$(git diff -U0 ./dist-material/release-docs/LICENSE)" ]; then
echo "LICENSE file is not updated correctly"
......
......@@ -103,6 +103,7 @@
* Support prometheus HTTP API and promQL.
* `Scope` in the Entity of Metrics query v1 protocol is not required and automatical correction. The scope is determined based on the metric itself.
* Add explicit `ReadTimeout` for ConsulConfigurationWatcher to avoid `IllegalArgumentException: Cache watchInterval=10sec >= networkClientReadTimeout=10000ms`.
* Fix `DurationUtils.getDurationPoints` exceed, when `startTimeBucket` equals `endTimeBucket`.
#### UI
......
......@@ -242,7 +242,7 @@ The Configuration Vocabulary lists all available configurations provided by `app
| - | - | maxQueryComplexity | Maximum complexity allowed for the GraphQL query that can be used to abort a query if the total number of data fields queried exceeds the defined threshold. | SW_QUERY_MAX_QUERY_COMPLEXITY | 1000 |
| - | - | enableUpdateUITemplate | Allow user add,disable and update UI template. | SW_ENABLE_UPDATE_UI_TEMPLATE | false |
| - | - | enableOnDemandPodLog | Ondemand Pod log: fetch the Pod logs on users' demand, the logs are fetched and displayed in real time, and are not persisted in any kind. This is helpful when users want to do some experiments and monitor the logs and see what's happing inside the service. Note: if you print secrets in the logs, they are also visible to the UI, so for the sake of security, this feature is disabled by default, please set this configuration to enable the feature manually. | SW_ENABLE_ON_DEMAND_POD_LOG | false |
| query | graphql | - | GraphQL query implementation. | - | |
| query-zipkin | default | - | This module is for Zipkin query API and support zipkin-lens UI | - | |
| - | - | restHost | Binding IP of RESTful services. | SW_QUERY_ZIPKIN_REST_HOST | 0.0.0.0 |
| - | - | restPort | Binding port of RESTful services. | SW_QUERY_ZIPKIN_REST_PORT | 9412 |
| - | - | restContextPath | Web context path of RESTful services. | SW_QUERY_ZIPKIN_REST_CONTEXT_PATH | zipkin |
......@@ -253,6 +253,13 @@ The Configuration Vocabulary lists all available configurations provided by `app
| - | - | namesMaxAge | The Cache-Control max-age (seconds) for serviceNames, remoteServiceNames and spanNames | SW_QUERY_ZIPKIN_NAMES_MAX_AGE | 300 |
| - | - | uiQueryLimit | Default traces query max size | SW_QUERY_ZIPKIN_UI_QUERY_LIMIT | 10 |
| - | - | uiDefaultLookback | Default look back on the UI for search traces, 15 minutes in millis | SW_QUERY_ZIPKIN_UI_DEFAULT_LOOKBACK | 900000 |
| promql | default | - | This module is for PromQL API. | - | |
| - | - | restHost | Binding IP of RESTful services. | SW_PROMQL_REST_HOST | 0.0.0.0 |
| - | - | restPort | Binding port of RESTful services. | SW_PROMQL_REST_PORT | 9090 |
| - | - | restContextPath | Web context path of RESTful services. | SW_PROMQL_REST_CONTEXT_PATH | / |
| - | - | restMaxThreads | Maximum thread number of RESTful services. | SW_PROMQL_REST_MAX_THREADS | 200 |
| - | - | restIdleTimeOut | Connector idle timeout of RESTful services (in milliseconds). | SW_PROMQL_REST_IDLE_TIMEOUT | 30000 |
| - | - | restAcceptQueueSize | Maximum request header size accepted. | SW_PROMQL_REST_QUEUE_SIZE | 0 |
| alarm | default | - | Read [alarm doc](backend-alarm.md) for more details. | - | |
| telemetry | - | - | Read [telemetry doc](backend-telemetry.md) for more details. | - | |
| - | none | - | No op implementation. | - | |
......
......@@ -88,6 +88,9 @@ public enum DurationUtils {
List<PointOfTime> durations = new LinkedList<>();
durations.add(new PointOfTime(startTimeBucket));
if (startTimeBucket == endTimeBucket) {
return durations;
}
int i = 0;
do {
......
......@@ -47,7 +47,7 @@ GT: '>';
// Literals
NUMBER: Digit+ (DOT Digit+)?;
DURATION: Digit+ ('s' | 'm' | 'h' | 'd' | 'w' | 'y');
DURATION: Digit+ ('ms' | 's' | 'm' | 'h' | 'd' | 'w');
NAME_STRING: NameLetter+;
VALUE_STRING: '\'' .*? '\'' | '"' .*? '"';
......
......@@ -103,7 +103,6 @@ public class PromQLApiHandler {
}
@Get
@Post
@Path("/api/v1/metadata")
public HttpResponse metadata(
@Param("limit") Optional<Integer> limit,
......@@ -174,7 +173,6 @@ public class PromQLApiHandler {
* reserve these param to keep consistent with API protocol.
*/
@Get
@Post
@Path("/api/v1/label/{label_name}/values")
public HttpResponse labelValues(
@Param("label_name") String labelName,
......
......@@ -35,6 +35,8 @@ import org.apache.skywalking.oap.server.core.query.input.Duration;
import org.apache.skywalking.oap.server.core.query.type.MetricsValues;
import org.apache.skywalking.promql.rt.grammar.PromQLParser;
import org.joda.time.DateTime;
import org.joda.time.format.PeriodFormatter;
import org.joda.time.format.PeriodFormatterBuilder;
public class PromOpUtils {
//Adopt skywalking time step.
......@@ -252,4 +254,22 @@ public class PromOpUtils {
DecimalFormat format = new DecimalFormat("#.##");
return format.format(v);
}
/**
* Format duration string to org.joda.time.Duration.
* Don't support year and month because the days vary in length.
* @param duration such as "5d", "30m", "5d30m, "1w, "1w5d"
* @return org.joda.time.Duration
*/
public static org.joda.time.Duration formatDuration(String duration) {
PeriodFormatter f = new PeriodFormatterBuilder()
.appendWeeks().appendSuffix("w")
.appendDays().appendSuffix("d")
.appendHours().appendSuffix("h")
.appendMinutes().appendSuffix("m")
.appendSeconds().appendSuffix("s")
.appendMillis().appendSuffix("ms")
.toFormatter();
return f.parsePeriod(duration).toStandardDuration();
}
}
......@@ -58,6 +58,7 @@ import org.apache.skywalking.promql.rt.grammar.PromQLParser;
import org.apache.skywalking.promql.rt.grammar.PromQLParserBaseVisitor;
import static org.apache.skywalking.oap.query.promql.rt.PromOpUtils.buildMatrixValues;
import static org.apache.skywalking.oap.query.promql.rt.PromOpUtils.formatDuration;
import static org.apache.skywalking.oap.query.promql.rt.PromOpUtils.matrixBinaryOp;
import static org.apache.skywalking.oap.query.promql.rt.PromOpUtils.matrixCompareOp;
import static org.apache.skywalking.oap.query.promql.rt.PromOpUtils.matrixScalarBinaryOp;
......@@ -247,9 +248,9 @@ public class PromQLExprQueryVisitor extends PromQLParserBaseVisitor<ParseResult>
return result;
}
String timeRange = "PT" + ctx.DURATION().getText().toUpperCase();
String timeRange = ctx.DURATION().getText().toUpperCase();
long endTS = System.currentTimeMillis();
long startTS = endTS - java.time.Duration.parse(timeRange).toMillis();
long startTS = endTS - formatDuration(timeRange).getMillis();
duration = timestamp2Duration(startTS, endTS);
ParseResult result = visit(ctx.metricInstant());
result.setRangeExpression(true);
......
......@@ -435,12 +435,13 @@ query-zipkin:
# Default look back on the UI for search traces, 15 minutes in millis
uiDefaultLookback: ${SW_QUERY_ZIPKIN_UI_DEFAULT_LOOKBACK:900000}
#This module is for PromQL API.
promql:
selector: ${SW_PROMQL:default}
default:
# For HTTP server
restHost: ${SW_PROMQL_REST_HOST:0.0.0.0}
restPort: ${SW_PROMQL_REST_PORT:9099}
restPort: ${SW_PROMQL_REST_PORT:9090}
restContextPath: ${SW_PROMQL_REST_CONTEXT_PATH:/}
restMaxThreads: ${SW_PROMQL_REST_MAX_THREADS:200}
restIdleTimeOut: ${SW_PROMQL_REST_IDLE_TIMEOUT:30000}
......