wu-sheng commented on a change in pull request #4783: URL: https://github.com/apache/skywalking/pull/4783#discussion_r433554140
########## File path: oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/analysis/meter/function/AvgHistogramFunction.java ########## @@ -0,0 +1,219 @@ +/* + * 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.analysis.meter.function; + +import java.util.Comparator; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; +import lombok.extern.slf4j.Slf4j; +import org.apache.skywalking.oap.server.core.Const; +import org.apache.skywalking.oap.server.core.UnexpectedException; +import org.apache.skywalking.oap.server.core.analysis.meter.MeterEntity; +import org.apache.skywalking.oap.server.core.analysis.metrics.DataTable; +import org.apache.skywalking.oap.server.core.analysis.metrics.Metrics; +import org.apache.skywalking.oap.server.core.remote.grpc.proto.RemoteData; +import org.apache.skywalking.oap.server.core.storage.StorageBuilder; +import org.apache.skywalking.oap.server.core.storage.annotation.Column; + +/** + * AvgHistogram intends to aggregate raw values over the interval (minute, hour or day). When users query a value + * from such a interval, an average over it will be sent back. + * + * The acceptable bucket value should be a result from one of "increase", "rate" and "irate" query functions. + * That means the value is the increase or per-second instant rate of increase in a specific range. + * + * Example: + * "persistence_timer_bulk_execute_latency" is histogram, the possible PromQL format of acceptable bucket value should be: + * "increase(persistence_timer_bulk_execute_latency{service="oap-server", instance="localhost:1234"}[5m])" Review comment: I think this function, including AvgPercentile, is a quite Prometheus style. Should we consider to move this into the Prometheus fetcher only? Seems more reasonable to me. ########## File path: oap-server/server-bootstrap/src/main/resources/fetcher-prom-rules/self.yaml ########## @@ -0,0 +1,170 @@ +# 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. + +# This will parse a textual representation of a duration. The formats +# accepted are based on the ISO-8601 duration format {@code PnDTnHnMn.nS} +# with days considered to be exactly 24 hours. +# <p> +# Examples: +# <pre> +# "PT20.345S" -- parses as "20.345 seconds" +# "PT15M" -- parses as "15 minutes" (where a minute is 60 seconds) +# "PT10H" -- parses as "10 hours" (where an hour is 3600 seconds) +# "P2D" -- parses as "2 days" (where a day is 24 hours or 86400 seconds) +# "P2DT3H4M" -- parses as "2 days, 3 hours and 4 minutes" +# "P-6H3M" -- parses as "-6 hours and +3 minutes" +# "-P6H3M" -- parses as "-6 hours and -3 minutes" +# "-P-6H+3M" -- parses as "+6 hours and -3 minutes" +# </pre> +fetcherInterval: PT15S +fetcherTimeout: PT10S +metricsPath: /metrics +staticConfig: + # targets will be labeled as "instance" + targets: + - localhost:1234 + labels: + app: oap-server +metricsRules: + - name: instance_cpu_percentage + scope: SERVICE_INSTANCE + operation: avg + sources: + process_cpu_seconds_total: + counterFunction: RATE + range: PT1M + scale: 2 + relabel: + service: + - app Review comment: What is the `app` label used in the codes? Do we have a filterable name?(In the UI perspective) If not, I think we should consider to rename it. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected]
