Skip to content

Commit

Permalink
Implement OpenTelemetry infrastructure (#11255)
Browse files Browse the repository at this point in the history
  • Loading branch information
JanProvaznik authored Feb 21, 2025
1 parent 647fa95 commit 072c659
Show file tree
Hide file tree
Showing 32 changed files with 1,213 additions and 74 deletions.
8 changes: 8 additions & 0 deletions NuGet.config
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,14 @@
<add key="dotnet8" value="https://dnceng.pkgs.visualstudio.com/public/_packaging/dotnet8/nuget/v3/index.json" />
<add key="dotnet8-transport" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet8-transport/nuget/v3/index.json" />
<add key="dotnet9" value="https://dnceng.pkgs.visualstudio.com/public/_packaging/dotnet9/nuget/v3/index.json" />
<add key="vs-impl" value="https://pkgs.dev.azure.com/azure-public/vside/_packaging/vs-impl/nuget/v3/index.json" />

<!-- We don't want other than VS OpenTelemetry libraries from vs-impl -->
<packageSourceMapping>
<packageSource key="vs-impl">
<package pattern="Microsoft.VisualStudio.OpenTelemetry*" />
</packageSource>
</packageSourceMapping>
</packageSources>
<disabledPackageSources>
<!--Begin: Package sources managed by Dependency Flow automation. Do not edit the sources below.-->
Expand Down
45 changes: 37 additions & 8 deletions THIRDPARTYNOTICES.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
MSBuild uses third-party material as listed below. The attached notices are
provided for informational purposes only.
MSBuild uses third-party material as listed below. The attached notices are
provided for informational purposes only.

Notice for LockCheck
Notice for LockCheck
-------------------------------
The MIT License (MIT)

Expand All @@ -27,20 +27,49 @@ SOFTWARE.

-------------------------------

Notice for Samples for xUnit.net
Notice for Samples for xUnit.net
-------------------------------

Copyright (c) .NET Foundation and Contributors
Copyright (c) .NET Foundation and Contributors

All Rights Reserved
All Rights Reserved

Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License.
this file except in compliance with the License.

You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed
under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
CONDITIONS OF ANY KIND, either express or implied. See the License for the specific
language governing permissions and limitations under the License.

-------------------------------

Notice for OpenTelemetry .NET
-------------------------------
MSBuild.exe is distributed with OpenTelemetry .NET binaries.

Copyright (c) OpenTelemetry Authors
Source: https://github.com/open-telemetry/opentelemetry-dotnet

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed
under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
CONDITIONS OF ANY KIND, either express or implied. See the License for the specific
language governing permissions and limitations under the License.

-------------------------------

Notice for Microsoft.VisualStudio.OpenTelemetry.*
-------------------------------
MSBuild.exe is distributed with Microsoft.VisualStudio.OpenTelemetry.* binaries.

Project: Microsoft.VisualStudio.OpenTelemetry
Copyright: (c) Microsoft Corporation
License: https://visualstudio.microsoft.com/license-terms/mt736442/
6 changes: 6 additions & 0 deletions documentation/release-checklist.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,3 +130,9 @@ Timing based on the [(Microsoft-internal) release schedule](https://dev.azure.co
git push upstream v{{THIS_RELEASE_VERSION}}.3
```
- [ ] Create Release in Github with `Create Release from Tag` GH option (https://github.com/dotnet/msbuild/releases/new?tag=v17.9.3) - the release notes can be prepopulated (`Generate Release Notes`)

## After release

If v{{NEXT_VERSION}} is a new major version

- [ ] do Major version extra update steps from [release.md](./release.md)
8 changes: 8 additions & 0 deletions documentation/release.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,11 @@ As of [#7018](https://github.com/dotnet/msbuild/pull/7018), MSBuild uses a Rosly
3. At release time, we must manually promote the `Unshipped` public API to `Shipped`.

That is a new step in our release process for each formal release (including patch releases if they change API surface).

## Major version extra update steps

Update major version of VS in

- [BuildEnvironmentHelper.cs](../src/Shared/BuildEnvironmentHelper.cs)
- [Constants.cs](../src/Shared/Constants.cs)
- [TelemetryConstants.cs](../src/Framework/Telemetry/TelemetryConstants.cs)
1 change: 1 addition & 0 deletions documentation/wiki/ChangeWaves.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ A wave of features is set to "rotate out" (i.e. become standard functionality) t
### 17.14
- [.SLNX support - use the new parser for .sln and .slnx](https://github.com/dotnet/msbuild/pull/10836)
- [Support custom culture in RAR](https://github.com/dotnet/msbuild/pull/11000)
- [VS Telemetry](https://github.com/dotnet/msbuild/pull/11255)

### 17.12
- [Log TaskParameterEvent for scalar parameters](https://github.com/dotnet/msbuild/pull/9908)
Expand Down
3 changes: 3 additions & 0 deletions eng/Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,8 @@
<PackageVersion Include="System.Threading.Channels" Version="$(SystemThreadingChannelsVersion)" />
<PackageVersion Include="System.Threading.Tasks.Dataflow" Version="$(SystemThreadingTasksDataflowVersion)" />
<PackageVersion Include="xunit.console" Version="$(XUnitVersion)" />
<PackageVersion Include="Microsoft.VisualStudio.OpenTelemetry.Collector" Version="$(MicrosoftVisualStudioOpenTelemetryVersion)" />
<PackageVersion Include="Microsoft.VisualStudio.OpenTelemetry.ClientExtensions" Version="$(MicrosoftVisualStudioOpenTelemetryVersion)" />
<PackageVersion Include="System.Diagnostics.DiagnosticSource" Version="$(SystemDiagnosticsDiagnosticSourceVersion)" />
</ItemGroup>
</Project>
6 changes: 6 additions & 0 deletions eng/Signing.props
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@
<ItemsToSign Include="$(ArtifactsDir)\xsd\Update-MSBuildXsds.ps1" />

<FileSignInfo Include="RuntimeContracts.dll" CertificateName="3PartySHA2" />

<!-- For Telemetry in VS.-->
<FileSignInfo Include="OpenTelemetry.dll" CertificateName="3PartySHA2" />
<FileSignInfo Include="OpenTelemetry.Api.dll" CertificateName="3PartySHA2" />
<FileSignInfo Include="OpenTelemetry.Api.ProviderBuilderExtensions.dll" CertificateName="3PartySHA2" />
<FileSignInfo Include="Newtonsoft.Json.dll" CertificateName="3PartySHA2" />
</ItemGroup>

<PropertyGroup>
Expand Down
2 changes: 2 additions & 0 deletions eng/SourceBuildPrebuiltBaseline.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
<UsagePattern IdentityGlob="System.Threading.Tasks.Dataflow/*8.0.0*" />
<UsagePattern IdentityGlob="System.Formats.Asn1/*8.0.1*" />
<UsagePattern IdentityGlob="Microsoft.VisualStudio.SolutionPersistence/*1.0.*" />
<!-- Defined in Version.Details.xml - live version used in SB. -->
<UsagePattern IdentityGlob="System.Diagnostics.DiagnosticSource/*8.0.1*" />
</IgnorePatterns>
<Usages>
</Usages>
Expand Down
4 changes: 4 additions & 0 deletions eng/Version.Details.xml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@
<Uri>https://dev.azure.com/dnceng/internal/_git/dotnet-runtime</Uri>
<Sha>2aade6beb02ea367fd97c4070a4198802fe61c03</Sha>
</Dependency>
<Dependency Name="System.Diagnostics.DiagnosticSource" Version="8.0.1">
<Uri>https://dev.azure.com/dnceng/internal/_git/dotnet-runtime</Uri>
<Sha>2d7eea252964e69be94cb9c847b371b23e4dd470</Sha>
</Dependency>
</ProductDependencies>
<ToolsetDependencies>
<Dependency Name="Microsoft.DotNet.Arcade.Sdk" Version="9.0.0-beta.25111.5">
Expand Down
2 changes: 2 additions & 0 deletions eng/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@
<SystemTextJsonVersion>8.0.5</SystemTextJsonVersion>
<SystemThreadingChannelsVersion>8.0.0</SystemThreadingChannelsVersion>
<SystemThreadingTasksDataflowVersion>8.0.0</SystemThreadingTasksDataflowVersion>
<SystemDiagnosticsDiagnosticSourceVersion>8.0.1</SystemDiagnosticsDiagnosticSourceVersion>
<MicrosoftVisualStudioOpenTelemetryVersion>0.2.104-beta</MicrosoftVisualStudioOpenTelemetryVersion>
</PropertyGroup>
<!-- Toolset Dependencies -->
<PropertyGroup>
Expand Down
32 changes: 16 additions & 16 deletions src/Build.UnitTests/BackEnd/KnownTelemetry_Tests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,19 +35,19 @@ public void BuildTelemetryConstructedHasNoProperties()
{
BuildTelemetry buildTelemetry = new BuildTelemetry();

buildTelemetry.DisplayVersion.ShouldBeNull();
buildTelemetry.BuildEngineDisplayVersion.ShouldBeNull();
buildTelemetry.EventName.ShouldBe("build");
buildTelemetry.FinishedAt.ShouldBeNull();
buildTelemetry.FrameworkName.ShouldBeNull();
buildTelemetry.Host.ShouldBeNull();
buildTelemetry.InitialServerState.ShouldBeNull();
buildTelemetry.BuildEngineFrameworkName.ShouldBeNull();
buildTelemetry.BuildEngineHost.ShouldBeNull();
buildTelemetry.InitialMSBuildServerState.ShouldBeNull();
buildTelemetry.InnerStartAt.ShouldBeNull();
buildTelemetry.Project.ShouldBeNull();
buildTelemetry.ProjectPath.ShouldBeNull();
buildTelemetry.ServerFallbackReason.ShouldBeNull();
buildTelemetry.StartAt.ShouldBeNull();
buildTelemetry.Success.ShouldBeNull();
buildTelemetry.Target.ShouldBeNull();
buildTelemetry.Version.ShouldBeNull();
buildTelemetry.BuildSuccess.ShouldBeNull();
buildTelemetry.BuildTarget.ShouldBeNull();
buildTelemetry.BuildEngineVersion.ShouldBeNull();

buildTelemetry.GetProperties().ShouldBeEmpty();
}
Expand All @@ -61,18 +61,18 @@ public void BuildTelemetryCreateProperProperties()
DateTime innerStartAt = new DateTime(2023, 01, 02, 10, 20, 30);
DateTime finishedAt = new DateTime(2023, 12, 13, 14, 15, 16);

buildTelemetry.DisplayVersion = "Some Display Version";
buildTelemetry.BuildEngineDisplayVersion = "Some Display Version";
buildTelemetry.FinishedAt = finishedAt;
buildTelemetry.FrameworkName = "new .NET";
buildTelemetry.Host = "Host description";
buildTelemetry.InitialServerState = "hot";
buildTelemetry.BuildEngineFrameworkName = "new .NET";
buildTelemetry.BuildEngineHost = "Host description";
buildTelemetry.InitialMSBuildServerState = "hot";
buildTelemetry.InnerStartAt = innerStartAt;
buildTelemetry.Project = @"C:\\dev\\theProject";
buildTelemetry.ProjectPath = @"C:\\dev\\theProject";
buildTelemetry.ServerFallbackReason = "busy";
buildTelemetry.StartAt = startAt;
buildTelemetry.Success = true;
buildTelemetry.Target = "clean";
buildTelemetry.Version = new Version(1, 2, 3, 4);
buildTelemetry.BuildSuccess = true;
buildTelemetry.BuildTarget = "clean";
buildTelemetry.BuildEngineVersion = new Version(1, 2, 3, 4);

var properties = buildTelemetry.GetProperties();

Expand Down
Loading

0 comments on commit 072c659

Please sign in to comment.