Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce IncludeSharedGuardSource property #1430

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions build/Common.props
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@
<PackageReference Include="StyleCop.Analyzers" Version="$(StyleCopAnalyzersPkgVer)" Condition="'$(SkipAnalysis)'!='true'" PrivateAssets="All" />
</ItemGroup>

<ItemGroup Condition="'$(IncludeSharedGuardSource)'=='true'">
<Compile Include="$(RepoRoot)\src\Shared\Guard.cs" Link="Includes\Guard.cs" />
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see much value in extracting this into a variable. It's a single compile include item. I think extracting it into a variable is adding another layer of indirection to figure out what the project needs.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like most project use it what if we made it included by default and only opted-out where a project didn't want to use it?

Copy link
Contributor

@utpilla utpilla Nov 9, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My only issue with that would be that anytime someone contributes a new project to repo they would now have to be aware of this. We would probably have to update Contributing,md file for new contributors to look out for these "magically" added file(s).

I wouldn't want to surprise them 😄

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO we are in the worst place right now.
One part of the shared files is included by properties, the other part by direct Compile calls.

We should move all projects in one direction. When we have agreement, I am fine to extend contribution guide :) .

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO we are in the worst place right now.
One part of the shared files is included by properties, the other part by direct Compile calls.

I see value in extracting multiple Compile includes into a property. There are a bunch of projects that use a common set of Compile includes. But extracting a single compile include into a property doesn't make sense to me. If that's what we want to do then, where do we stop? Why don't we create a property for every single PackageReference and ProjectReference as well?

We should move all projects in one direction. When we have agreement, I am fine to extend contribution guide :) .

If we want to be consistent, I would be in favor of removing these properties altogether and have each project explicitly add the individual Compile Include they need.

</ItemGroup>

<ItemGroup Condition="'$(IncludeSharedExceptionExtensionsSource)'=='true'">
<Compile Include="$(RepoRoot)\src\Shared\ExceptionExtensions.cs" Link="Includes\ExceptionExtensions.cs" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,12 @@
<TargetFrameworks Condition="$(OS) == 'Windows_NT'">$(TargetFrameworks);net462</TargetFrameworks>
<MinVerTagPrefix>Exporter.Geneva-</MinVerTagPrefix>
<IncludeSharedExceptionExtensionsSource>true</IncludeSharedExceptionExtensionsSource>
<IncludeSharedGuardSource>true</IncludeSharedGuardSource>
<Nullable>disable</Nullable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="OpenTelemetry" Version="$(OTelSdkVersion)" />
</ItemGroup>

<ItemGroup>
<Compile Include="$(RepoRoot)\src\Shared\Guard.cs" Link="Includes\Guard.cs" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,11 @@
<TargetFrameworks>$(NetMinimumSupportedVersion);$(NetStandardMinimumSupportedVersion)</TargetFrameworks>
<MinVerTagPrefix>Exporter.InfluxDB-</MinVerTagPrefix>
<IncludeSharedExceptionExtensionsSource>true</IncludeSharedExceptionExtensionsSource>
<IncludeSharedGuardSource>true</IncludeSharedGuardSource>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="InfluxDB.Client" Version="4.12.0" />
<PackageReference Include="OpenTelemetry" Version="$(OpenTelemetryCoreLatestVersion)" />
</ItemGroup>

<ItemGroup>
<Compile Include="$(RepoRoot)\src\Shared\Guard.cs" Link="Includes\Guard.cs" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
<MinVerTagPrefix>Exporter.OneCollector-</MinVerTagPrefix>
<ImplicitUsings>true</ImplicitUsings>
<IncludeSharedExceptionExtensionsSource>true</IncludeSharedExceptionExtensionsSource>
<IncludeSharedGuardSource>true</IncludeSharedGuardSource>
</PropertyGroup>

<ItemGroup>
Expand All @@ -17,7 +18,6 @@
</ItemGroup>

<ItemGroup>
<Compile Include="$(RepoRoot)\src\Shared\Guard.cs" Link="Includes\Guard.cs" />
<Compile Include="$(RepoRoot)\src\Shared\IsExternalInit.cs" Link="Includes\IsExternalInit.cs" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,11 @@
<PackageTags>$(PackageTags);Stackdriver;Google;GCP;distributed-tracing</PackageTags>
<MinVerTagPrefix>Exporter.Stackdriver-</MinVerTagPrefix>
<IncludeSharedExceptionExtensionsSource>true</IncludeSharedExceptionExtensionsSource>
<IncludeSharedGuardSource>true</IncludeSharedGuardSource>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Google.Cloud.Monitoring.V3" Version="[2.6.0,4.0)" />
<PackageReference Include="Google.Cloud.Trace.V2" Version="[2.3.0,4.0)" />
<PackageReference Include="OpenTelemetry" Version="$(OpenTelemetryCoreLatestVersion)" />
</ItemGroup>

<ItemGroup>
<Compile Include="$(RepoRoot)\src\Shared\Guard.cs" Link="Includes\Guard.cs" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
<Description>OpenTelemetry extensions for AWS.</Description>
<MinVerTagPrefix>Extensions.AWS-</MinVerTagPrefix>
<IncludeSharedExceptionExtensionsSource>true</IncludeSharedExceptionExtensionsSource>
<IncludeSharedGuardSource>true</IncludeSharedGuardSource>
</PropertyGroup>

<ItemGroup>
Expand All @@ -16,9 +17,4 @@
<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0' Or '$(TargetFramework)' == '$(NetFrameworkMinimumSupportedVersion)'">
<PackageReference Include="System.Text.Json" Version="6.0.0" />
</ItemGroup>

<ItemGroup>
<Compile Include="$(RepoRoot)\src\Shared\Guard.cs" Link="Includes\Guard.cs" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@
<NoWarn>$(NoWarn),CS1591</NoWarn>
<MinVerTagPrefix>Extensions.Enrichment-</MinVerTagPrefix>
<AnalysisLevel>latest-all</AnalysisLevel>
<IncludeSharedGuardSource>true</IncludeSharedGuardSource>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="OpenTelemetry" Version="$(OpenTelemetryCoreLatestVersion)" />
</ItemGroup>

<ItemGroup>
<Compile Include="$(RepoRoot)\src\Shared\Guard.cs" Link="Includes\Guard.cs" />
<Compile Include="$(RepoRoot)\src\Shared\IsExternalInit.cs" Link="Includes\IsExternalInit.cs" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,9 @@
<IncludeSharedExceptionExtensionsSource>true</IncludeSharedExceptionExtensionsSource>
<Description>OpenTelemetry .NET SDK preview features and extensions</Description>
<MinVerTagPrefix>Extensions-</MinVerTagPrefix>
<IncludeSharedGuardSource>true</IncludeSharedGuardSource>
</PropertyGroup>

<ItemGroup>
<Compile Include="$(RepoRoot)\src\Shared\Guard.cs" Link="Includes\Guard.cs" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="OpenTelemetry" Version="$(OpenTelemetryCoreLatestVersion)" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
<TargetFrameworks Condition="$(OS) == 'Windows_NT'">$(TargetFrameworks);$(NetFrameworkMinimumSupportedVersion)</TargetFrameworks>
<Description>AWS client instrumentation for OpenTelemetry .NET</Description>
<MinVerTagPrefix>Instrumentation.AWS-</MinVerTagPrefix>
<IncludeSharedGuardSource>true</IncludeSharedGuardSource>
</PropertyGroup>

<ItemGroup>
Expand All @@ -16,7 +17,6 @@
</ItemGroup>

<ItemGroup>
<Compile Include="$(RepoRoot)\src\Shared\Guard.cs" Link="Includes\Guard.cs" />
<Compile Include="$(RepoRoot)\src\Shared\SemanticConventions.cs" Link="Includes\SemanticConventions.cs"/>
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<Description>AWS Lambda tracing wrapper for OpenTelemetry .NET</Description>
<PackageTags>$(PackageTags);AWS Lambda</PackageTags>
<MinVerTagPrefix>Instrumentation.AWSLambda-</MinVerTagPrefix>
<IncludeSharedGuardSource>true</IncludeSharedGuardSource>
</PropertyGroup>

<ItemGroup>
Expand All @@ -17,7 +18,6 @@
</ItemGroup>

<ItemGroup>
<Compile Include="$(RepoRoot)\src\Shared\Guard.cs" Link="Includes\Guard.cs" />
<Compile Include="$(RepoRoot)\src\Shared\SemanticConventions.cs" Link="Includes\SemanticConventions.cs"/>
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,12 @@
<!-- OmniSharp/VS Code requires TargetFrameworks to be in descending order for IntelliSense and analysis. -->
<TargetFrameworks>$(NetFrameworkMinimumSupportedVersion)</TargetFrameworks>
<IncludeSharedExceptionExtensionsSource>true</IncludeSharedExceptionExtensionsSource>
<IncludeSharedGuardSource>true</IncludeSharedGuardSource>
<Description>A module that instruments incoming request with System.Diagnostics.Activity and notifies listeners with DiagnosticsSource.</Description>
<PackageTags>$(PackageTags);distributed-tracing;AspNet;MVC;WebAPI</PackageTags>
<MinVerTagPrefix>Instrumentation.AspNet-</MinVerTagPrefix>
</PropertyGroup>

<ItemGroup>
<Compile Include="$(RepoRoot)\src\Shared\Guard.cs" Link="Includes\Guard.cs" />
</ItemGroup>

<ItemGroup>
<Reference Include="System.Web" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
<Description>ASP.NET instrumentation for OpenTelemetry .NET</Description>
<PackageTags>$(PackageTags);distributed-tracing;AspNet;MVC;WebAPI</PackageTags>
<IncludeInstrumentationHelpers>true</IncludeInstrumentationHelpers>
<IncludeSharedGuardSource>true</IncludeSharedGuardSource>
<MinVerTagPrefix>Instrumentation.AspNet-</MinVerTagPrefix>
</PropertyGroup>

Expand All @@ -16,7 +17,6 @@
<ItemGroup>
<Compile Include="$(RepoRoot)\src\Shared\SemanticConventions.cs" Link="Includes\SemanticConventions.cs" />
<Compile Include="$(RepoRoot)\src\Shared\PropertyFetcher.cs" Link="Includes\PropertyFetcher.cs" />
<Compile Include="$(RepoRoot)\src\Shared\Guard.cs" Link="Includes\Guard.cs" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,12 @@
<Description>OpenTelemetry Cassandra Instrumentation</Description>
<PackageTags>$(PackageTags);Cassandra;CassandraCSharpDriver</PackageTags>
<MinVerTagPrefix>Instrumentation.Cassandra-</MinVerTagPrefix>
<IncludeSharedGuardSource>true</IncludeSharedGuardSource>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="CassandraCSharpDriver" Version="$(CassandraCSharpDriverPkgVer)" />
<PackageReference Include="OpenTelemetry.Api" Version="$(OpenTelemetryCoreLatestVersion)" />
</ItemGroup>

<ItemGroup>
<Compile Include="$(RepoRoot)\src\Shared\Guard.cs" Link="Includes\Guard.cs" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,11 @@
<IncludeSharedDiagnosticSourceSubscriber>true</IncludeSharedDiagnosticSourceSubscriber>
<IncludeSharedActivityInstrumentationHelper>true</IncludeSharedActivityInstrumentationHelper>
<IncludeSharedSpanHelper>true</IncludeSharedSpanHelper>
<IncludeSharedGuardSource>true</IncludeSharedGuardSource>
<Nullable>disable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="OpenTelemetry" Version="$(OpenTelemetryCoreLatestVersion)" />
<PackageReference Include="System.Text.Json" Version="6.0.4" />
</ItemGroup>

<ItemGroup>
<Compile Include="$(RepoRoot)\src\Shared\Guard.cs" Link="Includes\Guard.cs" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,12 @@
<IncludeSharedInstrumentationSource>true</IncludeSharedInstrumentationSource>
<IncludeSharedExceptionExtensionsSource>true</IncludeSharedExceptionExtensionsSource>
<IncludeSharedDiagnosticSourceSubscriber>true</IncludeSharedDiagnosticSourceSubscriber>
<IncludeSharedGuardSource>true</IncludeSharedGuardSource>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Options" Version="$(MicrosoftExtensionsOptionsPkgVer)" />
<PackageReference Include="OpenTelemetry.Api.ProviderBuilderExtensions" Version="$(OpenTelemetryCoreLatestVersion)" />
</ItemGroup>

<ItemGroup>
<Compile Include="$(RepoRoot)\src\Shared\Guard.cs" Link="Includes\Guard.cs" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<Description>OpenTelemetry Metrics instrumentation for Dotnet EventCounters</Description>
<PackageTags>$(PackageTags);metrics;eventcounters</PackageTags>
<MinVerTagPrefix>Instrumentation.EventCounters-</MinVerTagPrefix>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="OpenTelemetry.Api" Version="$(OpenTelemetryCoreLatestVersion)" />
</ItemGroup>

<ItemGroup>
<Compile Include="$(RepoRoot)\src\Shared\Guard.cs" Link="Includes\Guard.cs" />
</ItemGroup>
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<Description>OpenTelemetry Metrics instrumentation for Dotnet EventCounters</Description>
<PackageTags>$(PackageTags);metrics;eventcounters</PackageTags>
<MinVerTagPrefix>Instrumentation.EventCounters-</MinVerTagPrefix>
<IncludeSharedGuardSource>true</IncludeSharedGuardSource>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="OpenTelemetry.Api" Version="$(OpenTelemetryCoreLatestVersion)" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,11 @@
<PackageTags>$(PackageTags);gRPC Core;interceptors</PackageTags>
<MinVerTagPrefix>Instrumentation.GrpcCore-</MinVerTagPrefix>
<Nullable>disable</Nullable>
<IncludeSharedGuardSource>true</IncludeSharedGuardSource>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Google.Protobuf" Version="[3.6.1,4.0)" />
<PackageReference Include="Grpc.Core.Api" Version="[2.23.0,3.0)" />
<PackageReference Include="OpenTelemetry.Api" Version="$(OpenTelemetryCoreLatestVersion)" />
</ItemGroup>

<ItemGroup>
<Compile Include="$(RepoRoot)\src\Shared\Guard.cs" Link="Includes\Guard.cs" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,10 @@
<PackageTags>$(PackageTags);Hangfire</PackageTags>
<MinVerTagPrefix>Instrumentation.Hangfire-</MinVerTagPrefix>
<SignAssembly>false</SignAssembly>
<IncludeSharedGuardSource>true</IncludeSharedGuardSource>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Hangfire.Core" Version="[1.7.0,1.9.0)" />
<PackageReference Include="OpenTelemetry.Api" Version="$(OpenTelemetryCoreLatestVersion)" />
</ItemGroup>
<ItemGroup>
<Compile Include="$(RepoRoot)\src\Shared\Guard.cs" Link="Includes\Guard.cs" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
<PackageTags>$(PackageTags);distributed-tracing;OWIN</PackageTags>
<MinVerTagPrefix>Instrumentation.Owin-</MinVerTagPrefix>
<IncludeSharedSpanHelper>true</IncludeSharedSpanHelper>
<IncludeSharedGuardSource>true</IncludeSharedGuardSource>
<Nullable>disable</Nullable>
</PropertyGroup>

<ItemGroup>
<Compile Include="$(RepoRoot)\src\Shared\SemanticConventions.cs" Link="Includes\SemanticConventions.cs"/>
<Compile Include="$(RepoRoot)\src\Shared\Guard.cs" Link="Includes\Guard.cs" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,10 @@
<Description>dotnet process instrumentation for OpenTelemetry .NET</Description>
<PackageTags>$(PackageTags);process</PackageTags>
<MinVerTagPrefix>Instrumentation.Process-</MinVerTagPrefix>
<IncludeSharedGuardSource>true</IncludeSharedGuardSource>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="OpenTelemetry.Api" Version="$(OpenTelemetryCoreLatestVersion)" />
</ItemGroup>

<ItemGroup>
<Compile Include="$(RepoRoot)\src\Shared\Guard.cs" Link="Includes\Guard.cs" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,9 @@
<IncludeSharedExceptionExtensionsSource>true</IncludeSharedExceptionExtensionsSource>
<IncludeSharedDiagnosticSourceSubscriber>true</IncludeSharedDiagnosticSourceSubscriber>
<IncludeSharedActivityInstrumentationHelper>true</IncludeSharedActivityInstrumentationHelper>
<IncludeSharedGuardSource>true</IncludeSharedGuardSource>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="OpenTelemetry.Api" Version="$(OpenTelemetryCoreLatestVersion)" />
</ItemGroup>

<ItemGroup>
<Compile Include="$(RepoRoot)\src\Shared\Guard.cs" Link="Includes\Guard.cs" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,10 @@
<Description>dotnet runtime instrumentation for OpenTelemetry .NET</Description>
<PackageTags>$(PackageTags);runtime</PackageTags>
<MinVerTagPrefix>Instrumentation.Runtime-</MinVerTagPrefix>
<IncludeSharedGuardSource>true</IncludeSharedGuardSource>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="OpenTelemetry.Api" Version="$(OpenTelemetryCoreLatestVersion)" />
</ItemGroup>

<ItemGroup>
<Compile Include="$(RepoRoot)\src\Shared\Guard.cs" Link="Includes\Guard.cs" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
<Description>StackExchange.Redis instrumentation for OpenTelemetry .NET</Description>
<PackageTags>$(PackageTags);distributed-tracing;Redis;StackExchange.Redis</PackageTags>
<IncludeSharedExceptionExtensionsSource>true</IncludeSharedExceptionExtensionsSource>
<IncludeSharedGuardSource>true</IncludeSharedGuardSource>
<MinVerTagPrefix>Instrumentation.StackExchangeRedis-</MinVerTagPrefix>
<ImplicitUsings>true</ImplicitUsings>
</PropertyGroup>

<ItemGroup>
<Compile Include="$(RepoRoot)\src\Shared\Guard.cs" Link="Includes\Guard.cs" />
<Compile Include="$(RepoRoot)\src\Shared\PropertyFetcher.AOT.cs" Link="Includes\PropertyFetcher.AOT.cs" />
<Compile Include="$(RepoRoot)\src\Shared\SemanticConventions.cs" Link="Includes\SemanticConventions.cs" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<!-- OmniSharp/VS Code requires TargetFrameworks to be in descending order for IntelliSense and analysis. -->
<TargetFrameworks>netstandard2.0;net462</TargetFrameworks>
<IncludeSharedExceptionExtensionsSource>true</IncludeSharedExceptionExtensionsSource>
<IncludeSharedGuardSource>true</IncludeSharedGuardSource>
<Description>OpenTelemetry instrumentation for WCF</Description>
<PackageTags>$(PackageTags);distributed-tracing;WCF</PackageTags>
<MinVerTagPrefix>Instrumentation.Wcf-</MinVerTagPrefix>
Expand All @@ -23,7 +24,6 @@
</ItemGroup>

<ItemGroup>
<Compile Include="$(RepoRoot)\src\Shared\Guard.cs" Link="Includes\Guard.cs" />
<Compile Include="$(RepoRoot)\src\Shared\PropertyFetcher.cs" Link="Includes\PropertyFetcher.cs" />
</ItemGroup>

Expand Down
Loading
Loading