-
Notifications
You must be signed in to change notification settings - Fork 364
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[CELEBORN-1797] Support to adjust the logger level with RESTful API d…
…uring runtime ### What changes were proposed in this pull request? Support to adjust the logger level during runtime without restarting the server. ### Why are the changes needed? It is useful for debug, likes hadoop daemonlog command: https://hadoop.apache.org/docs/r3.4.1/hadoop-project-dist/hadoop-common/CommandsManual.html#daemonlog ### Does this PR introduce _any_ user-facing change? Yes, new RESTful api. ### How was this patch tested? GA. <img width="1430" alt="image" src="https://github.com/user-attachments/assets/9d974fd9-21f3-429a-a35f-e15662aa75ac" /> <img width="1428" alt="image" src="https://github.com/user-attachments/assets/ca32b596-12a1-4038-9e1b-4fdc6a377b54" /> <img width="1255" alt="image" src="https://github.com/user-attachments/assets/5c399a73-9f53-43a8-b337-5a79621abea4" /> <img width="1244" alt="image" src="https://github.com/user-attachments/assets/16dc9ede-01bb-4e38-80fe-acb044ae6cc7" /> Closes #3022 from turboFei/log_level. Lead-authored-by: Wang, Fei <[email protected]> Co-authored-by: Fei Wang <[email protected]> Signed-off-by: mingji <[email protected]>
- Loading branch information
Showing
11 changed files
with
1,045 additions
and
1 deletion.
There are no files selected for viewing
233 changes: 233 additions & 0 deletions
233
openapi/openapi-client/src/main/java/org/apache/celeborn/rest/v1/master/LoggerApi.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,233 @@ | ||
/* | ||
* 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.celeborn.rest.v1.master; | ||
|
||
import com.fasterxml.jackson.core.type.TypeReference; | ||
|
||
import org.apache.celeborn.rest.v1.master.invoker.ApiException; | ||
import org.apache.celeborn.rest.v1.master.invoker.ApiClient; | ||
import org.apache.celeborn.rest.v1.master.invoker.BaseApi; | ||
import org.apache.celeborn.rest.v1.master.invoker.Configuration; | ||
import org.apache.celeborn.rest.v1.master.invoker.Pair; | ||
|
||
import org.apache.celeborn.rest.v1.model.HandleResponse; | ||
import org.apache.celeborn.rest.v1.model.LoggerInfo; | ||
import org.apache.celeborn.rest.v1.model.LoggerInfos; | ||
|
||
|
||
import java.util.ArrayList; | ||
import java.util.Collections; | ||
import java.util.HashMap; | ||
import java.util.List; | ||
import java.util.Map; | ||
import java.util.StringJoiner; | ||
|
||
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") | ||
public class LoggerApi extends BaseApi { | ||
|
||
public LoggerApi() { | ||
super(Configuration.getDefaultApiClient()); | ||
} | ||
|
||
public LoggerApi(ApiClient apiClient) { | ||
super(apiClient); | ||
} | ||
|
||
/** | ||
* | ||
* Get the logger level, return all loggers if no name specified. | ||
* @param name The logger name. (optional) | ||
* @param all Return all logger instances if true, otherwise return all configured loggers. (optional, default to false) | ||
* @return LoggerInfos | ||
* @throws ApiException if fails to make API call | ||
*/ | ||
public LoggerInfos getLogger(String name, Boolean all) throws ApiException { | ||
return this.getLogger(name, all, Collections.emptyMap()); | ||
} | ||
|
||
|
||
/** | ||
* | ||
* Get the logger level, return all loggers if no name specified. | ||
* @param name The logger name. (optional) | ||
* @param all Return all logger instances if true, otherwise return all configured loggers. (optional, default to false) | ||
* @param additionalHeaders additionalHeaders for this call | ||
* @return LoggerInfos | ||
* @throws ApiException if fails to make API call | ||
*/ | ||
public LoggerInfos getLogger(String name, Boolean all, Map<String, String> additionalHeaders) throws ApiException { | ||
Object localVarPostBody = null; | ||
|
||
// create path and map variables | ||
String localVarPath = "/api/v1/loggers"; | ||
|
||
StringJoiner localVarQueryStringJoiner = new StringJoiner("&"); | ||
String localVarQueryParameterBaseName; | ||
List<Pair> localVarQueryParams = new ArrayList<Pair>(); | ||
List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>(); | ||
Map<String, String> localVarHeaderParams = new HashMap<String, String>(); | ||
Map<String, String> localVarCookieParams = new HashMap<String, String>(); | ||
Map<String, Object> localVarFormParams = new HashMap<String, Object>(); | ||
|
||
localVarQueryParams.addAll(apiClient.parameterToPair("name", name)); | ||
localVarQueryParams.addAll(apiClient.parameterToPair("all", all)); | ||
|
||
localVarHeaderParams.putAll(additionalHeaders); | ||
|
||
|
||
|
||
final String[] localVarAccepts = { | ||
"application/json" | ||
}; | ||
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); | ||
|
||
final String[] localVarContentTypes = { | ||
|
||
}; | ||
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); | ||
|
||
String[] localVarAuthNames = new String[] { "basic" }; | ||
|
||
TypeReference<LoggerInfos> localVarReturnType = new TypeReference<LoggerInfos>() {}; | ||
return apiClient.invokeAPI( | ||
localVarPath, | ||
"GET", | ||
localVarQueryParams, | ||
localVarCollectionQueryParams, | ||
localVarQueryStringJoiner.toString(), | ||
localVarPostBody, | ||
localVarHeaderParams, | ||
localVarCookieParams, | ||
localVarFormParams, | ||
localVarAccept, | ||
localVarContentType, | ||
localVarAuthNames, | ||
localVarReturnType | ||
); | ||
} | ||
|
||
/** | ||
* | ||
* Set the logger level. | ||
* @param loggerInfo (optional) | ||
* @return HandleResponse | ||
* @throws ApiException if fails to make API call | ||
*/ | ||
public HandleResponse setLogger(LoggerInfo loggerInfo) throws ApiException { | ||
return this.setLogger(loggerInfo, Collections.emptyMap()); | ||
} | ||
|
||
|
||
/** | ||
* | ||
* Set the logger level. | ||
* @param loggerInfo (optional) | ||
* @param additionalHeaders additionalHeaders for this call | ||
* @return HandleResponse | ||
* @throws ApiException if fails to make API call | ||
*/ | ||
public HandleResponse setLogger(LoggerInfo loggerInfo, Map<String, String> additionalHeaders) throws ApiException { | ||
Object localVarPostBody = loggerInfo; | ||
|
||
// create path and map variables | ||
String localVarPath = "/api/v1/loggers"; | ||
|
||
StringJoiner localVarQueryStringJoiner = new StringJoiner("&"); | ||
String localVarQueryParameterBaseName; | ||
List<Pair> localVarQueryParams = new ArrayList<Pair>(); | ||
List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>(); | ||
Map<String, String> localVarHeaderParams = new HashMap<String, String>(); | ||
Map<String, String> localVarCookieParams = new HashMap<String, String>(); | ||
Map<String, Object> localVarFormParams = new HashMap<String, Object>(); | ||
|
||
|
||
localVarHeaderParams.putAll(additionalHeaders); | ||
|
||
|
||
|
||
final String[] localVarAccepts = { | ||
"application/json" | ||
}; | ||
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); | ||
|
||
final String[] localVarContentTypes = { | ||
"application/json" | ||
}; | ||
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); | ||
|
||
String[] localVarAuthNames = new String[] { "basic" }; | ||
|
||
TypeReference<HandleResponse> localVarReturnType = new TypeReference<HandleResponse>() {}; | ||
return apiClient.invokeAPI( | ||
localVarPath, | ||
"POST", | ||
localVarQueryParams, | ||
localVarCollectionQueryParams, | ||
localVarQueryStringJoiner.toString(), | ||
localVarPostBody, | ||
localVarHeaderParams, | ||
localVarCookieParams, | ||
localVarFormParams, | ||
localVarAccept, | ||
localVarContentType, | ||
localVarAuthNames, | ||
localVarReturnType | ||
); | ||
} | ||
|
||
@Override | ||
public <T> T invokeAPI(String url, String method, Object request, TypeReference<T> returnType, Map<String, String> additionalHeaders) throws ApiException { | ||
String localVarPath = url.replace(apiClient.getBaseURL(), ""); | ||
StringJoiner localVarQueryStringJoiner = new StringJoiner("&"); | ||
List<Pair> localVarQueryParams = new ArrayList<Pair>(); | ||
List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>(); | ||
Map<String, String> localVarHeaderParams = new HashMap<String, String>(); | ||
Map<String, String> localVarCookieParams = new HashMap<String, String>(); | ||
Map<String, Object> localVarFormParams = new HashMap<String, Object>(); | ||
|
||
localVarHeaderParams.putAll(additionalHeaders); | ||
|
||
final String[] localVarAccepts = { | ||
"application/json" | ||
}; | ||
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); | ||
|
||
final String[] localVarContentTypes = { | ||
"application/json" | ||
}; | ||
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); | ||
|
||
String[] localVarAuthNames = new String[] { "basic" }; | ||
|
||
return apiClient.invokeAPI( | ||
localVarPath, | ||
method, | ||
localVarQueryParams, | ||
localVarCollectionQueryParams, | ||
localVarQueryStringJoiner.toString(), | ||
request, | ||
localVarHeaderParams, | ||
localVarCookieParams, | ||
localVarFormParams, | ||
localVarAccept, | ||
localVarContentType, | ||
localVarAuthNames, | ||
returnType | ||
); | ||
} | ||
} |
139 changes: 139 additions & 0 deletions
139
openapi/openapi-client/src/main/java/org/apache/celeborn/rest/v1/model/LoggerInfo.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,139 @@ | ||
/* | ||
* 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.celeborn.rest.v1.model; | ||
|
||
import java.util.Objects; | ||
import java.util.Arrays; | ||
import com.fasterxml.jackson.annotation.JsonInclude; | ||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import com.fasterxml.jackson.annotation.JsonCreator; | ||
import com.fasterxml.jackson.annotation.JsonTypeName; | ||
import com.fasterxml.jackson.annotation.JsonValue; | ||
import com.fasterxml.jackson.annotation.JsonPropertyOrder; | ||
import com.fasterxml.jackson.annotation.JsonTypeName; | ||
|
||
/** | ||
* LoggerInfo | ||
*/ | ||
@JsonPropertyOrder({ | ||
LoggerInfo.JSON_PROPERTY_NAME, | ||
LoggerInfo.JSON_PROPERTY_LEVEL | ||
}) | ||
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0") | ||
public class LoggerInfo { | ||
public static final String JSON_PROPERTY_NAME = "name"; | ||
private String name; | ||
|
||
public static final String JSON_PROPERTY_LEVEL = "level"; | ||
private String level; | ||
|
||
public LoggerInfo() { | ||
} | ||
|
||
public LoggerInfo name(String name) { | ||
|
||
this.name = name; | ||
return this; | ||
} | ||
|
||
/** | ||
* The logger name. | ||
* @return name | ||
*/ | ||
@javax.annotation.Nonnull | ||
@JsonProperty(JSON_PROPERTY_NAME) | ||
@JsonInclude(value = JsonInclude.Include.ALWAYS) | ||
|
||
public String getName() { | ||
return name; | ||
} | ||
|
||
|
||
@JsonProperty(JSON_PROPERTY_NAME) | ||
@JsonInclude(value = JsonInclude.Include.ALWAYS) | ||
public void setName(String name) { | ||
this.name = name; | ||
} | ||
|
||
public LoggerInfo level(String level) { | ||
|
||
this.level = level; | ||
return this; | ||
} | ||
|
||
/** | ||
* The logger level. | ||
* @return level | ||
*/ | ||
@javax.annotation.Nonnull | ||
@JsonProperty(JSON_PROPERTY_LEVEL) | ||
@JsonInclude(value = JsonInclude.Include.ALWAYS) | ||
|
||
public String getLevel() { | ||
return level; | ||
} | ||
|
||
|
||
@JsonProperty(JSON_PROPERTY_LEVEL) | ||
@JsonInclude(value = JsonInclude.Include.ALWAYS) | ||
public void setLevel(String level) { | ||
this.level = level; | ||
} | ||
|
||
@Override | ||
public boolean equals(Object o) { | ||
if (this == o) { | ||
return true; | ||
} | ||
if (o == null || getClass() != o.getClass()) { | ||
return false; | ||
} | ||
LoggerInfo loggerInfo = (LoggerInfo) o; | ||
return Objects.equals(this.name, loggerInfo.name) && | ||
Objects.equals(this.level, loggerInfo.level); | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return Objects.hash(name, level); | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
StringBuilder sb = new StringBuilder(); | ||
sb.append("class LoggerInfo {\n"); | ||
sb.append(" name: ").append(toIndentedString(name)).append("\n"); | ||
sb.append(" level: ").append(toIndentedString(level)).append("\n"); | ||
sb.append("}"); | ||
return sb.toString(); | ||
} | ||
|
||
/** | ||
* Convert the given object to string with each line indented by 4 spaces | ||
* (except the first line). | ||
*/ | ||
private String toIndentedString(Object o) { | ||
if (o == null) { | ||
return "null"; | ||
} | ||
return o.toString().replace("\n", "\n "); | ||
} | ||
|
||
} | ||
|
Oops, something went wrong.