Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CELEBORN-1797] Support to adjust the logger level with RESTful API during runtime #3022

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
);
}
}
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 ");
}

}

Loading
Loading