HDDS-1153. Make tracing instrumentation configurable

Closes #673
This commit is contained in:
Kitti Nanasi 2019-04-02 13:47:18 +02:00 committed by Márton Elek
parent d31c86892e
commit aeb43dfba3
No known key found for this signature in database
GPG Key ID: D51EA8F00EE79B28
9 changed files with 35 additions and 11 deletions

View File

@ -372,6 +372,10 @@ public final class ScmConfigKeys {
"ozone.scm.network.topology.schema.file";
public static final String OZONE_SCM_NETWORK_TOPOLOGY_SCHEMA_FILE_DEFAULT =
"network-topology-default.xml";
public static final String HDDS_TRACING_ENABLED = "hdds.tracing.enabled";
public static final boolean HDDS_TRACING_ENABLED_DEFAULT = true;
/**
* Never constructed.
*/

View File

@ -27,6 +27,8 @@ import io.opentracing.SpanContext;
import io.opentracing.Tracer;
import io.opentracing.util.GlobalTracer;
import org.apache.hadoop.hdds.scm.ScmConfigKeys;
/**
* Utility class to collect all the tracing helper methods.
*/
@ -112,11 +114,19 @@ public final class TracingUtil {
* @param delegate the original class instance
* @param interfce the interface which should be implemented by the proxy
* @param <T> the type of the interface
* @param conf configuration
*
* @return A new interface which implements interfce but delegate all the
* calls to the delegate and also enables tracing.
*/
public static <T> T createProxy(T delegate, Class<T> interfce) {
public static <T> T createProxy(T delegate, Class<T> interfce,
org.apache.hadoop.conf.Configuration conf) {
boolean isTracingEnabled = conf.getBoolean(
ScmConfigKeys.HDDS_TRACING_ENABLED,
ScmConfigKeys.HDDS_TRACING_ENABLED_DEFAULT);
if (!isTracingEnabled) {
return delegate;
}
Class<?> aClass = delegate.getClass();
return (T) Proxy.newProxyInstance(aClass.getClassLoader(),
new Class<?>[] {interfce},

View File

@ -2377,4 +2377,12 @@
to datanodes. After this timeout the command will be retried.
</description>
</property>
<property>
<name>hdds.tracing.enabled</name>
<value>true</value>
<tag>OZONE, HDDS</tag>
<description>
If enabled, tracing information is sent to tracing server.
</description>
</property>
</configuration>

View File

@ -143,7 +143,7 @@ public class SCMCLI extends GenericCli {
scmAddress, UserGroupInformation.getCurrentUser(), ozoneConf,
NetUtils.getDefaultSocketFactory(ozoneConf),
Client.getRpcTimeout(ozoneConf))),
StorageContainerLocationProtocol.class);
StorageContainerLocationProtocol.class, ozoneConf);
return new ContainerOperationClient(
client, new XceiverClientManager(ozoneConf));
}

View File

@ -66,7 +66,7 @@ public class ObjectStore {
* @param proxy ClientProtocol proxy.
*/
public ObjectStore(Configuration conf, ClientProtocol proxy) {
this.proxy = TracingUtil.createProxy(proxy, ClientProtocol.class);
this.proxy = TracingUtil.createProxy(proxy, ClientProtocol.class, conf);
this.listCacheSize = HddsClientUtils.getListCacheSize(conf);
}

View File

@ -156,7 +156,8 @@ public class RpcClient implements ClientProtocol, KeyProviderTokenIssuer {
scmAddress, ugi, conf, NetUtils.getDefaultSocketFactory(conf),
Client.getRpcTimeout(conf)));
this.storageContainerLocationClient =
TracingUtil.createProxy(client, StorageContainerLocationProtocol.class);
TracingUtil.createProxy(client, StorageContainerLocationProtocol.class,
conf);
this.xceiverClientManager = new XceiverClientManager(conf);
int configuredChunkSize = (int) conf

View File

@ -189,7 +189,7 @@ public final class OzoneManagerProtocolClientSideTranslatorPB
this.rpcProxy = TracingUtil.createProxy(
createRetryProxy(omFailoverProxyProvider, maxRetries, maxFailovers,
sleepBase, sleepMax),
OzoneManagerProtocolPB.class);
OzoneManagerProtocolPB.class, conf);
this.clientID = clientId;
}

View File

@ -104,7 +104,7 @@ public final class ObjectStoreHandler implements Closeable {
scmAddress, UserGroupInformation.getCurrentUser(), conf,
NetUtils.getDefaultSocketFactory(conf),
Client.getRpcTimeout(conf))),
StorageContainerLocationProtocol.class);
StorageContainerLocationProtocol.class, conf);
InetSocketAddress scmBlockAddress =
getScmAddressForBlockClients(conf);
@ -115,7 +115,7 @@ public final class ObjectStoreHandler implements Closeable {
scmBlockAddress, UserGroupInformation.getCurrentUser(),
conf, NetUtils.getDefaultSocketFactory(conf),
Client.getRpcTimeout(conf))),
ScmBlockLocationProtocol.class);
ScmBlockLocationProtocol.class, conf);
RPC.setProtocolEngine(conf, OzoneManagerProtocolPB.class,
ProtobufRpcEngine.class);
@ -129,12 +129,12 @@ public final class ObjectStoreHandler implements Closeable {
omAddress, UserGroupInformation.getCurrentUser(), conf,
NetUtils.getDefaultSocketFactory(conf),
Client.getRpcTimeout(conf)), clientId.toString()),
OzoneManagerProtocol.class);
OzoneManagerProtocol.class, conf);
storageHandler = new DistributedStorageHandler(
new OzoneConfiguration(conf),
TracingUtil.createProxy(storageContainerLocationClient,
StorageContainerLocationProtocol.class),
StorageContainerLocationProtocol.class, conf),
this.ozoneManagerClient);
ApplicationAdapter aa =
new ApplicationAdapter(new ObjectStoreApplication());

View File

@ -760,7 +760,8 @@ public final class OzoneManager extends ServiceRuntimeInfoImpl
NetUtils.getDefaultSocketFactory(conf),
Client.getRpcTimeout(conf)));
return TracingUtil
.createProxy(scmBlockLocationClient, ScmBlockLocationProtocol.class);
.createProxy(scmBlockLocationClient, ScmBlockLocationProtocol.class,
conf);
}
/**
@ -807,7 +808,7 @@ public final class OzoneManager extends ServiceRuntimeInfoImpl
scmAddr, UserGroupInformation.getCurrentUser(), conf,
NetUtils.getDefaultSocketFactory(conf),
Client.getRpcTimeout(conf))),
StorageContainerLocationProtocol.class);
StorageContainerLocationProtocol.class, conf);
return scmContainerClient;
}