Skip to content

Commit ca95a0d

Browse files
committed
Revert "Merged PR 722185: Revert "Merged PR 718998: Revert "Merged PR 717355: Send ETW events on symbol..."
This reverts commit f658365.
1 parent 1187e69 commit ca95a0d

File tree

2 files changed

+38
-76
lines changed

2 files changed

+38
-76
lines changed

Public/Src/Tools/SymbolDaemon/SymbolDaemon.cs

Lines changed: 31 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,8 @@
1515
using BuildXL.Ipc.ExternalApi;
1616
using BuildXL.Ipc.Interfaces;
1717
using BuildXL.Storage;
18-
using BuildXL.Tracing.CloudBuild;
19-
using BuildXL.Utilities.CLI;
2018
using BuildXL.Utilities.Core;
19+
using BuildXL.Utilities.CLI;
2120
using BuildXL.Utilities.Core.Tasks;
2221
using Microsoft.VisualStudio.Services.Common;
2322
using Microsoft.VisualStudio.Services.Symbol.App.Core.Tracing;
@@ -161,7 +160,7 @@ public sealed class SymbolDaemon : ServicePipDaemon.FinalizedByCreatorServicePip
161160
IsRequired = false,
162161
DefaultValue = true,
163162
});
164-
163+
165164
internal static readonly StrOption PersonalAccessTokenEnv = RegisterSymbolConfigOption(new StrOption("PersonalAccessTokenEnv")
166165
{
167166
ShortName = "patenv",
@@ -731,11 +730,20 @@ internal static void EnsureCommandsInitialized()
731730
/// </summary>
732731
protected override async Task<IIpcResult> DoCreateAsync(string name = null)
733732
{
734-
var dropCreationEvent = await HandleResultAndSendSymbolEtwEventAsync(InternalCreateAsync());
733+
// TODO(olkonone): add logging
734+
Request createRequestResult;
735+
736+
try
737+
{
738+
createRequestResult = await InternalCreateAsync();
739+
}
740+
catch (Exception e)
741+
{
742+
return new IpcResult(IpcResultStatus.GenericError, e.DemystifyToString());
743+
}
735744

736-
return dropCreationEvent.Succeeded
737-
? IpcResult.Success(I($"Symbol request '{RequestName}' created (url: '{dropCreationEvent.DropUrl}')."))
738-
: new IpcResult(IpcResultStatus.GenericError, dropCreationEvent.ErrorMessage);
745+
// get and return RequestId ?
746+
return IpcResult.Success(I($"Symbol request '{RequestName}' created (assigned request ID: '{createRequestResult.Id}')."));
739747
}
740748

741749
/// <summary>
@@ -769,11 +777,19 @@ private async Task<IIpcResult> AddSymbolFileAsync(SymbolFile file)
769777
/// </summary>
770778
protected override async Task<IIpcResult> DoFinalizeAsync()
771779
{
772-
var dropFinalizationEvent = await HandleResultAndSendSymbolEtwEventAsync(InternalFinalizeAsync());
780+
// TODO(olkonone): add logging
781+
Request finalizeRequestResult;
782+
783+
try
784+
{
785+
finalizeRequestResult = await InternalFinalizeAsync();
786+
}
787+
catch (Exception e)
788+
{
789+
return new IpcResult(IpcResultStatus.GenericError, e.DemystifyToString());
790+
}
773791

774-
return dropFinalizationEvent.Succeeded
775-
? IpcResult.Success(I($"Symbol request '{RequestName}' finalized."))
776-
: new IpcResult(IpcResultStatus.GenericError, dropFinalizationEvent.ErrorMessage);
792+
return IpcResult.Success(I($"Symbol request '{RequestName}' finalized; the request expires on '{finalizeRequestResult.ExpirationDate}'."));
777793
}
778794

779795
/// <nodoc />
@@ -789,42 +805,25 @@ public override void Dispose()
789805
base.Dispose();
790806
}
791807

792-
private async Task<DropCreationEvent> InternalCreateAsync()
808+
private async Task<Request> InternalCreateAsync()
793809
{
794810
var symbolClient = await m_symbolServiceClientTask;
795811
var result = await symbolClient.CreateAsync();
796812

797813
Contract.Assert(result.Status == RequestStatus.Created);
798814

799-
var serializedResult = SymbolRequesToString(result);
800-
m_logger.Info($"CreateAsync completed:{Environment.NewLine}{serializedResult}");
801-
802-
return new DropCreationEvent()
803-
{
804-
Succeeded = true,
805-
DropUrl = result.Url.ToString(),
806-
// For Symbols, expiration is set during finalization, so we are using a value we will be assigning later.
807-
DropExpirationInDays = (int)SymbolConfig.Retention.TotalDays,
808-
AdditionalInformation = serializedResult
809-
};
815+
return result;
810816
}
811817

812-
private async Task<DropFinalizationEvent> InternalFinalizeAsync()
818+
private async Task<Request> InternalFinalizeAsync()
813819
{
814820
var symbolClient = await m_symbolServiceClientTask;
815821
var result = await symbolClient.FinalizeAsync();
816822

817823
Contract.Assert(result.Status == RequestStatus.Sealed);
818824
Contract.Assert(result.ExpirationDate.HasValue);
819825

820-
var serializedResult = SymbolRequesToString(result);
821-
m_logger.Info($"FinalizeAsync completed:{Environment.NewLine}{serializedResult}");
822-
823-
return new DropFinalizationEvent()
824-
{
825-
Succeeded = true,
826-
DropUrl = result.Url.ToString(),
827-
};
826+
return result;
828827
}
829828

830829
private async Task ReportStatisticsAsync()
@@ -871,46 +870,5 @@ private async Task ReportStatisticsAsync()
871870
m_logger.Warning("No stats recorded by symbol client of type " + symbolClient.GetType().Name);
872871
}
873872
}
874-
875-
private async Task<T> HandleResultAndSendSymbolEtwEventAsync<T>(Task<T> task) where T : DropOperationBaseEvent
876-
{
877-
var sw = Stopwatch.StartNew();
878-
T dropEvent;
879-
try
880-
{
881-
dropEvent = await task;
882-
}
883-
catch (Exception e)
884-
{
885-
dropEvent = Activator.CreateInstance<T>();
886-
dropEvent.Succeeded = false;
887-
dropEvent.ErrorMessage = e.DemystifyToString();
888-
// For symbols, url is something that is only defined for successful operations
889-
// (it's based on a requestId which is not available until successful execution of 'symbol create').
890-
dropEvent.DropUrl = null;
891-
}
892-
893-
// common properties: execution time, drop type
894-
dropEvent.ElapsedTimeTicks = sw.ElapsedTicks;
895-
dropEvent.DropType = "SymbolIndex";
896-
897-
// send event
898-
m_etwLogger.Log(dropEvent);
899-
900-
return dropEvent;
901-
}
902-
903-
private static string SymbolRequesToString(Request request)
904-
{
905-
try
906-
{
907-
return request.ToJson();
908-
}
909-
catch (Exception e)
910-
{
911-
// The value is only used for debugging, so it's not a big deal if we fail to create the string.
912-
return $"Failed to serialized Request. Exception: {e}";
913-
}
914-
}
915873
}
916874
}

Public/Src/Tools/SymbolDaemon/VsoSymbolClient.cs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,17 @@
1111
using BuildXL.Ipc.Common;
1212
using BuildXL.Ipc.ExternalApi;
1313
using BuildXL.Ipc.Interfaces;
14-
using BuildXL.Utilities.Authentication;
1514
using BuildXL.Utilities.Core;
16-
using BuildXL.Utilities.Core.Tasks;
15+
using BuildXL.Utilities.Authentication;
16+
using BuildXL.Utilities.Collections;
1717
using BuildXL.Utilities.ParallelAlgorithms;
18+
using BuildXL.Utilities.Core.Tasks;
19+
using BuildXL.Utilities.Tracing;
20+
using Microsoft.IdentityModel.Clients.ActiveDirectory;
1821
using Microsoft.VisualStudio.Services.BlobStore.Common;
1922
using Microsoft.VisualStudio.Services.Common;
2023
using Microsoft.VisualStudio.Services.Content.Common;
24+
using Microsoft.VisualStudio.Services.Content.Common.Authentication;
2125
using Microsoft.VisualStudio.Services.Content.Common.Tracing;
2226
using Microsoft.VisualStudio.Services.Symbol.App.Core;
2327
using Microsoft.VisualStudio.Services.Symbol.App.Core.Telemetry;
@@ -467,7 +471,7 @@ public async Task<Request> FinalizeAsync(CancellationToken token)
467471
var result = await m_symbolClient.FinalizeRequestAsync(
468472
RequestId,
469473
ComputeExpirationDate(m_config.Retention),
470-
// isUpdateOperation != true => request will be marked as 'Sealed',
474+
// isUpdateOperation == true => request will be marked as 'Sealed',
471475
// i.e., no more DebugEntries could be added to it
472476
isUpdateOperation: false,
473477
token);

0 commit comments

Comments
 (0)