Skip to content

Commit 79f1712

Browse files
return ActivitySource + more polishing
1 parent 6f6ce1f commit 79f1712

33 files changed

+229
-569
lines changed

THIRDPARTYNOTICES.txt

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -43,25 +43,3 @@ Unless required by applicable law or agreed to in writing, software distributed
4343
under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
4444
CONDITIONS OF ANY KIND, either express or implied. See the License for the specific
4545
language governing permissions and limitations under the License.
46-
47-
-------------------------------
48-
49-
Notice for OpenTelemetry .NET
50-
-------------------------------
51-
MSBuild.exe is distributed with OpenTelemetry .NET binaries.
52-
53-
Copyright (c) OpenTelemetry Authors
54-
Source: https://github.com/open-telemetry/opentelemetry-dotnet
55-
56-
Licensed under the Apache License, Version 2.0 (the "License");
57-
you may not use this file except in compliance with the License.
58-
You may obtain a copy of the License at
59-
60-
http://www.apache.org/licenses/LICENSE-2.0
61-
62-
Unless required by applicable law or agreed to in writing, software distributed
63-
under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
64-
CONDITIONS OF ANY KIND, either express or implied. See the License for the specific
65-
language governing permissions and limitations under the License.
66-
67-
-------------------------------

documentation/specs/VS-OpenTelemetry.md

Lines changed: 0 additions & 198 deletions
This file was deleted.

documentation/specs/proposed/telemetry-onepager.md

Lines changed: 0 additions & 77 deletions
This file was deleted.

eng/Signing.props

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,6 @@
1111
<ItemsToSign Include="$(ArtifactsDir)\xsd\Update-MSBuildXsds.ps1" />
1212

1313
<FileSignInfo Include="RuntimeContracts.dll" CertificateName="3PartySHA2" />
14-
15-
<!-- For Telemetry in VS.-->
16-
<FileSignInfo Include="OpenTelemetry.dll" CertificateName="3PartySHA2" />
17-
<FileSignInfo Include="OpenTelemetry.Api.dll" CertificateName="3PartySHA2" />
18-
<FileSignInfo Include="OpenTelemetry.Api.ProviderBuilderExtensions.dll" CertificateName="3PartySHA2" />
19-
<FileSignInfo Include="Newtonsoft.Json.dll" CertificateName="3PartySHA2" />
2014
</ItemGroup>
2115

2216
<!-- Remove existing .nupkg signing info and set to None for testing to workaround the existing issue in arcade. -->

src/Build/BackEnd/BuildManager/BuildManager.cs

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -463,9 +463,6 @@ private void UpdatePriority(Process p, ProcessPriorityClass priority)
463463
/// <exception cref="InvalidOperationException">Thrown if a build is already in progress.</exception>
464464
public void BeginBuild(BuildParameters parameters)
465465
{
466-
#if NETFRAMEWORK
467-
TelemetryManager.Instance.Initialize(isStandalone: false);
468-
#endif
469466
if (_previousLowPriority != null)
470467
{
471468
if (parameters.LowPriority != _previousLowPriority)
@@ -1115,9 +1112,8 @@ public void EndBuild()
11151112
_buildTelemetry.SACEnabled = sacState == NativeMethodsShared.SAC_State.Evaluation || sacState == NativeMethodsShared.SAC_State.Enforcement;
11161113

11171114
loggingService.LogTelemetry(buildEventContext: null, _buildTelemetry.EventName, _buildTelemetry.GetProperties());
1118-
#if NETFRAMEWORK
11191115
EndBuildTelemetry();
1120-
#endif
1116+
11211117
// Clean telemetry to make it ready for next build submission.
11221118
_buildTelemetry = null;
11231119
}
@@ -1160,17 +1156,15 @@ void SerializeCaches()
11601156
}
11611157
}
11621158

1163-
#if NETFRAMEWORK
1164-
[MethodImpl(MethodImplOptions.NoInlining)]
11651159
private void EndBuildTelemetry()
11661160
{
1167-
using IActivity? activity = TelemetryManager.Instance.StartActivity(TelemetryConstants.Build)
1161+
using IActivity? activity = TelemetryManager.Instance?.DefaultActivitySource
1162+
?.StartActivity(TelemetryConstants.Build)
11681163
?.SetTags(_buildTelemetry)
11691164
?.SetTags(_telemetryConsumingLogger?.WorkerNodeTelemetryData.AsActivityDataHolder(
11701165
includeTasksDetails: !Traits.Instance.ExcludeTasksDetailsFromTelemetry,
11711166
includeTargetDetails: false));
11721167
}
1173-
#endif
11741168

11751169
/// <summary>
11761170
/// Convenience method. Submits a lone build request and blocks until results are available.
@@ -3013,6 +3007,8 @@ private ILoggingService CreateLoggingService(
30133007

30143008
if (_buildParameters.IsTelemetryEnabled)
30153009
{
3010+
TelemetryManager.Instance.Initialize(isStandalone: false);
3011+
30163012
// We do want to dictate our own forwarding logger (otherwise CentralForwardingLogger with minimum transferred importance MessageImportance.Low is used)
30173013
// In the future we might optimize for single, in-node build scenario - where forwarding logger is not needed (but it's just quick pass-through)
30183014
LoggerDescription forwardingLoggerDescription = new LoggerDescription(
@@ -3245,6 +3241,8 @@ private void Dispose(bool disposing)
32453241
s_singletonInstance = null;
32463242
}
32473243

3244+
TelemetryManager.Instance?.Dispose();
3245+
32483246
_disposed = true;
32493247
}
32503248
}

src/Build/Resources/Strings.resx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2430,9 +2430,6 @@ Utilization: {0} Average Utilization: {1:###.0}</value>
24302430
<value>succeeded: {0}</value>
24312431
<comment>{0} whole number</comment>
24322432
</data>
2433-
<data name="OpenTelemetryLoadFailed" xml:space="preserve">
2434-
<value>Loading telemetry libraries failed with exception: {0}.</value>
2435-
</data>
24362433
<data name="CustomTaskFactoryOutOfProcNotSupported" xml:space="preserve">
24372434
<value>Custom TaskFactory '{0}' for Task '{1}' does not support out of process TaskHost execution. Turn off the multithreaded build mode or remove the custom TaskFactory from your &lt;UsingTask&gt; definitions in project files.</value>
24382435
</data>

src/Build/Resources/xlf/Strings.cs.xlf

Lines changed: 0 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)