-
Notifications
You must be signed in to change notification settings - Fork 418
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FLINK-36129][autoscaler] Autoscaler is compatible with Flink 1.20
- Loading branch information
1 parent
024b70b
commit b26a0f5
Showing
9 changed files
with
495 additions
and
24 deletions.
There are no files selected for viewing
147 changes: 147 additions & 0 deletions
147
...ne/src/main/java/org/apache/flink/runtime/rest/messages/job/metrics/AggregatedMetric.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,147 @@ | ||
/* | ||
* 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.flink.runtime.rest.messages.job.metrics; | ||
|
||
import org.apache.flink.shaded.jackson2.com.fasterxml.jackson.annotation.JsonCreator; | ||
import org.apache.flink.shaded.jackson2.com.fasterxml.jackson.annotation.JsonIgnore; | ||
import org.apache.flink.shaded.jackson2.com.fasterxml.jackson.annotation.JsonInclude; | ||
import org.apache.flink.shaded.jackson2.com.fasterxml.jackson.annotation.JsonProperty; | ||
|
||
import javax.annotation.Nullable; | ||
|
||
import static java.util.Objects.requireNonNull; | ||
|
||
/** | ||
* TODO : It can be removed after upgrading flink dependency to 1.20. | ||
* | ||
* <p>Response type for aggregated metrics. Contains the metric name and optionally the sum, | ||
* average, minimum and maximum. | ||
*/ | ||
public class AggregatedMetric { | ||
|
||
private static final String FIELD_NAME_ID = "id"; | ||
|
||
private static final String FIELD_NAME_MIN = "min"; | ||
|
||
private static final String FIELD_NAME_MAX = "max"; | ||
|
||
private static final String FIELD_NAME_AVG = "avg"; | ||
|
||
private static final String FIELD_NAME_SUM = "sum"; | ||
|
||
private static final String FIELD_NAME_SKEW = "skew"; | ||
|
||
@JsonProperty(value = FIELD_NAME_ID, required = true) | ||
private final String id; | ||
|
||
@JsonInclude(JsonInclude.Include.NON_NULL) | ||
@JsonProperty(FIELD_NAME_MIN) | ||
private final Double min; | ||
|
||
@JsonInclude(JsonInclude.Include.NON_NULL) | ||
@JsonProperty(FIELD_NAME_MAX) | ||
private final Double max; | ||
|
||
@JsonInclude(JsonInclude.Include.NON_NULL) | ||
@JsonProperty(FIELD_NAME_AVG) | ||
private final Double avg; | ||
|
||
@JsonInclude(JsonInclude.Include.NON_NULL) | ||
@JsonProperty(FIELD_NAME_SUM) | ||
private final Double sum; | ||
|
||
@JsonInclude(JsonInclude.Include.NON_NULL) | ||
@JsonProperty(FIELD_NAME_SKEW) | ||
private final Double skew; | ||
|
||
@JsonCreator | ||
public AggregatedMetric( | ||
final @JsonProperty(value = FIELD_NAME_ID, required = true) String id, | ||
final @Nullable @JsonProperty(FIELD_NAME_MIN) Double min, | ||
final @Nullable @JsonProperty(FIELD_NAME_MAX) Double max, | ||
final @Nullable @JsonProperty(FIELD_NAME_AVG) Double avg, | ||
final @Nullable @JsonProperty(FIELD_NAME_SUM) Double sum, | ||
final @Nullable @JsonProperty(FIELD_NAME_SKEW) Double skew) { | ||
|
||
this.id = requireNonNull(id, "id must not be null"); | ||
this.min = min; | ||
this.max = max; | ||
this.avg = avg; | ||
this.sum = sum; | ||
this.skew = skew; | ||
} | ||
|
||
public AggregatedMetric(final @JsonProperty(value = FIELD_NAME_ID, required = true) String id) { | ||
this(id, null, null, null, null, null); | ||
} | ||
|
||
@JsonIgnore | ||
public String getId() { | ||
return id; | ||
} | ||
|
||
@JsonIgnore | ||
public Double getMin() { | ||
return min; | ||
} | ||
|
||
@JsonIgnore | ||
public Double getMax() { | ||
return max; | ||
} | ||
|
||
@JsonIgnore | ||
public Double getSum() { | ||
return sum; | ||
} | ||
|
||
@JsonIgnore | ||
public Double getAvg() { | ||
return avg; | ||
} | ||
|
||
@JsonIgnore | ||
public Double getSkew() { | ||
return skew; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "AggregatedMetric{" | ||
+ "id='" | ||
+ id | ||
+ '\'' | ||
+ ", mim='" | ||
+ min | ||
+ '\'' | ||
+ ", max='" | ||
+ max | ||
+ '\'' | ||
+ ", avg='" | ||
+ avg | ||
+ '\'' | ||
+ ", sum='" | ||
+ sum | ||
+ '\'' | ||
+ ", skew='" | ||
+ skew | ||
+ '\'' | ||
+ '}'; | ||
} | ||
} |
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
147 changes: 147 additions & 0 deletions
147
...er/src/main/java/org/apache/flink/runtime/rest/messages/job/metrics/AggregatedMetric.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,147 @@ | ||
/* | ||
* 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.flink.runtime.rest.messages.job.metrics; | ||
|
||
import org.apache.flink.shaded.jackson2.com.fasterxml.jackson.annotation.JsonCreator; | ||
import org.apache.flink.shaded.jackson2.com.fasterxml.jackson.annotation.JsonIgnore; | ||
import org.apache.flink.shaded.jackson2.com.fasterxml.jackson.annotation.JsonInclude; | ||
import org.apache.flink.shaded.jackson2.com.fasterxml.jackson.annotation.JsonProperty; | ||
|
||
import javax.annotation.Nullable; | ||
|
||
import static java.util.Objects.requireNonNull; | ||
|
||
/** | ||
* TODO : It can be removed after upgrading flink dependency to 1.20. | ||
* | ||
* <p>Response type for aggregated metrics. Contains the metric name and optionally the sum, | ||
* average, minimum and maximum. | ||
*/ | ||
public class AggregatedMetric { | ||
|
||
private static final String FIELD_NAME_ID = "id"; | ||
|
||
private static final String FIELD_NAME_MIN = "min"; | ||
|
||
private static final String FIELD_NAME_MAX = "max"; | ||
|
||
private static final String FIELD_NAME_AVG = "avg"; | ||
|
||
private static final String FIELD_NAME_SUM = "sum"; | ||
|
||
private static final String FIELD_NAME_SKEW = "skew"; | ||
|
||
@JsonProperty(value = FIELD_NAME_ID, required = true) | ||
private final String id; | ||
|
||
@JsonInclude(JsonInclude.Include.NON_NULL) | ||
@JsonProperty(FIELD_NAME_MIN) | ||
private final Double min; | ||
|
||
@JsonInclude(JsonInclude.Include.NON_NULL) | ||
@JsonProperty(FIELD_NAME_MAX) | ||
private final Double max; | ||
|
||
@JsonInclude(JsonInclude.Include.NON_NULL) | ||
@JsonProperty(FIELD_NAME_AVG) | ||
private final Double avg; | ||
|
||
@JsonInclude(JsonInclude.Include.NON_NULL) | ||
@JsonProperty(FIELD_NAME_SUM) | ||
private final Double sum; | ||
|
||
@JsonInclude(JsonInclude.Include.NON_NULL) | ||
@JsonProperty(FIELD_NAME_SKEW) | ||
private final Double skew; | ||
|
||
@JsonCreator | ||
public AggregatedMetric( | ||
final @JsonProperty(value = FIELD_NAME_ID, required = true) String id, | ||
final @Nullable @JsonProperty(FIELD_NAME_MIN) Double min, | ||
final @Nullable @JsonProperty(FIELD_NAME_MAX) Double max, | ||
final @Nullable @JsonProperty(FIELD_NAME_AVG) Double avg, | ||
final @Nullable @JsonProperty(FIELD_NAME_SUM) Double sum, | ||
final @Nullable @JsonProperty(FIELD_NAME_SKEW) Double skew) { | ||
|
||
this.id = requireNonNull(id, "id must not be null"); | ||
this.min = min; | ||
this.max = max; | ||
this.avg = avg; | ||
this.sum = sum; | ||
this.skew = skew; | ||
} | ||
|
||
public AggregatedMetric(final @JsonProperty(value = FIELD_NAME_ID, required = true) String id) { | ||
this(id, null, null, null, null, null); | ||
} | ||
|
||
@JsonIgnore | ||
public String getId() { | ||
return id; | ||
} | ||
|
||
@JsonIgnore | ||
public Double getMin() { | ||
return min; | ||
} | ||
|
||
@JsonIgnore | ||
public Double getMax() { | ||
return max; | ||
} | ||
|
||
@JsonIgnore | ||
public Double getSum() { | ||
return sum; | ||
} | ||
|
||
@JsonIgnore | ||
public Double getAvg() { | ||
return avg; | ||
} | ||
|
||
@JsonIgnore | ||
public Double getSkew() { | ||
return skew; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "AggregatedMetric{" | ||
+ "id='" | ||
+ id | ||
+ '\'' | ||
+ ", mim='" | ||
+ min | ||
+ '\'' | ||
+ ", max='" | ||
+ max | ||
+ '\'' | ||
+ ", avg='" | ||
+ avg | ||
+ '\'' | ||
+ ", sum='" | ||
+ sum | ||
+ '\'' | ||
+ ", skew='" | ||
+ skew | ||
+ '\'' | ||
+ '}'; | ||
} | ||
} |
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.