HADOOP-15024. AliyunOSS: Support user agent configuration and include that & Hadoop version information to oss server.
(cherry picked from commit 94390fcd52d44aa678bfda835225f6b2ccff61b5)
This commit is contained in:
parent
0f95a1d26a
commit
4a064dd644
@ -47,6 +47,7 @@
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.hadoop.conf.Configuration;
|
||||
import org.apache.hadoop.fs.FileSystem;
|
||||
import org.apache.hadoop.util.VersionInfo;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@ -93,6 +94,9 @@ public void initialize(URI uri, Configuration conf,
|
||||
ESTABLISH_TIMEOUT_DEFAULT));
|
||||
clientConf.setSocketTimeout(conf.getInt(SOCKET_TIMEOUT_KEY,
|
||||
SOCKET_TIMEOUT_DEFAULT));
|
||||
clientConf.setUserAgent(
|
||||
conf.get(USER_AGENT_PREFIX, USER_AGENT_PREFIX_DEFAULT) + ", Hadoop/"
|
||||
+ VersionInfo.getVersion());
|
||||
|
||||
String proxyHost = conf.getTrimmed(PROXY_HOST_KEY, "");
|
||||
int proxyPort = conf.getInt(PROXY_PORT_KEY, -1);
|
||||
|
@ -18,6 +18,8 @@
|
||||
|
||||
package org.apache.hadoop.fs.aliyun.oss;
|
||||
|
||||
import com.aliyun.oss.common.utils.VersionInfoUtils;
|
||||
|
||||
/**
|
||||
* ALL configuration constants for OSS filesystem.
|
||||
*/
|
||||
@ -26,6 +28,11 @@ public final class Constants {
|
||||
private Constants() {
|
||||
}
|
||||
|
||||
// User agent
|
||||
public static final String USER_AGENT_PREFIX = "fs.oss.user.agent.prefix";
|
||||
public static final String USER_AGENT_PREFIX_DEFAULT =
|
||||
VersionInfoUtils.getDefaultUserAgent();
|
||||
|
||||
// Class of credential provider
|
||||
public static final String ALIYUN_OSS_CREDENTIALS_PROVIDER_KEY =
|
||||
"fs.oss.credentials.provider";
|
||||
|
Loading…
x
Reference in New Issue
Block a user