Skip to content

Commit 0458675

Browse files
authored
Merge pull request Azure#3788 from begoldsm/preview
Target perf regression fix to preview branch - ADLS
2 parents d1f2f08 + 45b9f06 commit 0458675

File tree

3 files changed

+24
-1
lines changed

3 files changed

+24
-1
lines changed

src/ResourceManager/DataLakeStore/ChangeLog.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!--
1+
<!--
22
Please leave this section at the top of the change log.
33
44
Changes for the current release should go under the section titled "Current Release", and should adhere to the following format:
@@ -18,6 +18,7 @@
1818
- Additional information about change #1
1919
-->
2020
## Current Release
21+
* For `Import-AzureRMDataLakeStoreItem` and `Export-AzureRMDataLakeStoreItem` trace logging has been disabled by default to improve performance. If trace logging is desired please use the `-DiagnosticLogLevel` and `-DiagnosticLogPath` parameters
2122

2223
## Version 3.6.0
2324
* Add support for head and tail to the `Get-AzureRMDataLakeStoreItemContent` cmdlet. This enables returning the top N or last N new line delimited rows to be displayed.

src/ResourceManager/DataLakeStore/Commands.DataLakeStore/Commands/ExportAzureRmDataLakeStoreItem.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
using Microsoft.Rest.Azure;
1919
using System.Management.Automation;
2020
using Microsoft.IdentityModel.Clients.ActiveDirectory;
21+
using Microsoft.Rest;
2122

2223
namespace Microsoft.Azure.Commands.DataLakeStore
2324
{
@@ -148,6 +149,7 @@ public override void ExecuteCmdlet()
148149
DataLakeStoreTraceLogger logger = null;
149150
var originalLevel = AdalTrace.TraceSource.Switch.Level;
150151
var originalLegacyLevel = AdalTrace.LegacyTraceSwitch.Level;
152+
var previousTracing = ServiceClientTracing.IsEnabled;
151153
try
152154
{
153155
if (ParameterSetName.Equals(DiagnosticParameterSetName) && DiagnosticLogLevel != LogLevel.None)
@@ -156,6 +158,13 @@ public override void ExecuteCmdlet()
156158
logger = new DataLakeStoreTraceLogger(this, diagnosticPath, DiagnosticLogLevel);
157159
}
158160

161+
if (logger == null)
162+
{
163+
// if the caller does not explicitly want logging, we will explicitly turn it off
164+
// for performance reasons
165+
ServiceClientTracing.IsEnabled = false;
166+
}
167+
159168
if (type == FileType.FILE)
160169
{
161170
DataLakeStoreFileSystemClient.CopyFile(powerShellReadyPath, Account, Path.TransformedPath, CmdletCancellationToken,
@@ -173,6 +182,8 @@ public override void ExecuteCmdlet()
173182
}
174183
finally
175184
{
185+
// set service client tracing back always
186+
ServiceClientTracing.IsEnabled = previousTracing;
176187
if (logger != null)
177188
{
178189
// dispose and free the logger.

src/ResourceManager/DataLakeStore/Commands.DataLakeStore/Commands/ImportAzureRmDataLakeStoreItem.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
using Microsoft.Azure.Commands.DataLakeStore.Models;
1616
using Microsoft.Azure.Commands.DataLakeStore.Properties;
1717
using Microsoft.IdentityModel.Clients.ActiveDirectory;
18+
using Microsoft.Rest;
1819
using System.IO;
1920
using System.Management.Automation;
2021

@@ -153,6 +154,7 @@ public override void ExecuteCmdlet()
153154
DataLakeStoreTraceLogger logger = null;
154155
var originalLevel = AdalTrace.TraceSource.Switch.Level;
155156
var originalLegacyLevel = AdalTrace.LegacyTraceSwitch.Level;
157+
var previousTracing = ServiceClientTracing.IsEnabled;
156158
try
157159
{
158160
if (ParameterSetName.Equals(DiagnosticParameterSetName) && DiagnosticLogLevel != LogLevel.None)
@@ -161,6 +163,13 @@ public override void ExecuteCmdlet()
161163
logger = new DataLakeStoreTraceLogger(this, diagnosticPath, DiagnosticLogLevel);
162164
}
163165

166+
if (logger == null)
167+
{
168+
// if the caller does not explicitly want logging, we will explicitly turn it off
169+
// for performance reasons
170+
ServiceClientTracing.IsEnabled = false;
171+
}
172+
164173
if (Directory.Exists(powerShellSourcePath))
165174
{
166175
DataLakeStoreFileSystemClient.CopyDirectory(
@@ -200,6 +209,8 @@ public override void ExecuteCmdlet()
200209
}
201210
finally
202211
{
212+
// set service client tracing back always
213+
ServiceClientTracing.IsEnabled = previousTracing;
203214
if (logger != null)
204215
{
205216
// dispose and free the logger.

0 commit comments

Comments
 (0)