diff --git a/sdk/src/Handlers/AwsSdk/AWSSDKHandler.cs b/sdk/src/Handlers/AwsSdk/AWSSDKHandler.cs
index 3a2ef877..468ee28f 100644
--- a/sdk/src/Handlers/AwsSdk/AWSSDKHandler.cs
+++ b/sdk/src/Handlers/AwsSdk/AWSSDKHandler.cs
@@ -14,6 +14,7 @@
// permissions and limitations under the License.
//
//-----------------------------------------------------------------------------
+using Amazon.Runtime;
using Amazon.Runtime.Internal;
using Amazon.XRay.Recorder.Handlers.AwsSdk.Internal;
using System;
@@ -51,10 +52,10 @@ public static void RegisterXRayForAllServices(String path)
///
/// Registers X-Ray for the given type of .
///
- public static void RegisterXRay()
+ public static void RegisterXRay() where T : IAmazonService
{
_customizer = GetCustomizer();
- _customizer.AddType(typeof(T));
+ _customizer.AddType();
}
///
diff --git a/sdk/src/Handlers/AwsSdk/Internal/XRayPipelineHandler.cs b/sdk/src/Handlers/AwsSdk/Internal/XRayPipelineHandler.cs
index 67fa9d30..8b5f02da 100755
--- a/sdk/src/Handlers/AwsSdk/Internal/XRayPipelineHandler.cs
+++ b/sdk/src/Handlers/AwsSdk/Internal/XRayPipelineHandler.cs
@@ -56,7 +56,7 @@ public class XRayPipelineHandler : PipelineHandler
public XRayPipelineHandler()
{
_recorder = AWSXRayRecorder.Instance;
- AWSServiceHandlerManifest = GetDefaultAWSWhitelist();
+ AWSServiceHandlerManifest = GetDefaultAWSWhitelist();
}
///
@@ -342,9 +342,9 @@ private void ProcessEndRequest(IExecutionContext executionContext)
{
subsegment = _recorder.GetEntity();
}
- catch(EntityNotAvailableException e)
+ catch (EntityNotAvailableException e)
{
- _recorder.TraceContext.HandleEntityMissing(_recorder,e,"Cannot get entity from the trace context while processing response of AWS SDK request.");
+ _recorder.TraceContext.HandleEntityMissing(_recorder, e, "Cannot get entity from the trace context while processing response of AWS SDK request.");
return;
}
@@ -665,7 +665,7 @@ private bool ExcludeServiceOperation(IExecutionContext executionContext)
var serviceName = RemoveAmazonPrefixFromServiceName(requestContext.Request.ServiceName);
var operation = RemoveSuffix(requestContext.OriginalRequest.GetType().Name, "Request");
- return AWSXRaySDKUtils.IsBlacklistedOperation(serviceName,operation);
+ return AWSXRaySDKUtils.IsBlacklistedOperation(serviceName, operation);
}
private bool IsTracingDisabled()
@@ -719,13 +719,13 @@ public override async Task InvokeAsync(IExecutionContext executionContext)
/// Pipeline Customizer for registering instances with AWS X-Ray.
/// Note: This class should not be instantiated or used in anyway. It is used internally within SDK.
///
- public class XRayPipelineCustomizer : IRuntimePipelineCustomizer
+ internal class XRayPipelineCustomizer : IRuntimePipelineCustomizer
{
public string UniqueName { get { return "X-Ray Registration Customization"; } }
private Boolean registerAll;
private List types = new List();
private ReaderWriterLockSlim rwLock = new ReaderWriterLockSlim();
-
+
public bool RegisterAll { get => registerAll; set => registerAll = value; }
public string Path { get; set; } // TODO :: This is not used anymore, remove in next breaking change
public XRayPipelineHandler XRayPipelineHandler { get; set; } = null; // TODO :: This is not used anymore, remove in next breaking change
@@ -779,14 +779,14 @@ private bool ProcessType(Type serviceClientType, bool addCustomization)
///
/// Adds type to the list of .
///
- /// Type of to be registered with X-Ray.
- public void AddType(Type type)
+ /// Type of to be registered with X-Ray.
+ public void AddType() where T : IAmazonService
{
rwLock.EnterWriteLock();
try
{
- types.Add(type);
+ types.Add(typeof(T));
}
finally
{