Closed RealDotNetDave closed 4 months ago
Tagging subscribers to this area: @tarekgh, @tommcdon, @pjanotti See info in area-owners.md if you want to be subscribed.
Author: | RealDotNetDave |
---|---|
Assignees: | - |
Labels: | `api-suggestion`, `area-System.Diagnostics.Tracing`, `untriaged` |
Milestone: | - |
@tarekgh @noahfalk
CC @davmason as it looks EventSource issue.
I don't have any objection to adding the 0x80 keyword, but that is more of a domain specific issue than a general EventSource issue. Whoever owns the TPL should be included
Tagging subscribers to this area: @dotnet/area-system-threading-tasks See info in area-owners.md if you want to be subscribed.
Author: | RealDotNetDave |
---|---|
Assignees: | - |
Labels: | `api-suggestion`, `area-System.Threading.Tasks` |
Milestone: | 9.0.0 |
I don't think this value can be added to the EventKeywords enum because different classes can define values which can overlap. I see many other values are defined and not exposed too.
Something is removing the cast when I save the file
Did you figure out what removing the cast is in your project?
Common\src\System\Net\Logging\NetEventSource.Common.cs: public const EventKeywords Default = (EventKeywords)0x0001;
Common\src\System\Net\Logging\NetEventSource.Common.cs: public const EventKeywords Debug = (EventKeywords)0x0002;
Common\tests\System\Net\EventSourceTestLogging.cs: public const EventKeywords Default = (EventKeywords)0x0001;
Common\tests\System\Net\EventSourceTestLogging.cs: public const EventKeywords Debug = (EventKeywords)0x0002;
Microsoft.Extensions.DependencyInjection\src\DependencyInjectionEventSource.cs: public const EventKeywords ServiceProviderInitialized = (EventKeywords)0x1;
Microsoft.Extensions.Logging.EventSource\src\LoggingEventSource.cs: public const EventKeywords Meta = (EventKeywords)1;
Microsoft.Extensions.Logging.EventSource\src\LoggingEventSource.cs: public const EventKeywords Message = (EventKeywords)2;
Microsoft.Extensions.Logging.EventSource\src\LoggingEventSource.cs: public const EventKeywords FormattedMessage = (EventKeywords)4;
Microsoft.Extensions.Logging.EventSource\src\LoggingEventSource.cs: public const EventKeywords JsonMessage = (EventKeywords)8;
Microsoft.Extensions.Logging.EventSource\tests\EventSourceLoggerTest.cs: listenerSettings.Keywords = (EventKeywords)(-1);
Microsoft.Extensions.Logging.EventSource\tests\EventSourceLoggerTest.cs: listenerSettings.Keywords = (EventKeywords)(-1);
System.Collections.Concurrent\src\System\Collections\Concurrent\CDSCollectionETWBCLProvider.cs: private const EventKeywords ALL_KEYWORDS = (EventKeywords)(-1);
System.Diagnostics.DiagnosticSource\src\System\Diagnostics\DiagnosticSourceEventSource.cs: public const EventKeywords Messages = (EventKeywords)0x1;
System.Diagnostics.DiagnosticSource\src\System\Diagnostics\DiagnosticSourceEventSource.cs: public const EventKeywords Events = (EventKeywords)0x2;
System.Diagnostics.DiagnosticSource\src\System\Diagnostics\DiagnosticSourceEventSource.cs: public const EventKeywords IgnoreShortCutKeywords = (EventKeywords)0x0800;
System.Diagnostics.DiagnosticSource\src\System\Diagnostics\DiagnosticSourceEventSource.cs: public const EventKeywords AspNetCoreHosting = (EventKeywords)0x1000;
System.Diagnostics.DiagnosticSource\src\System\Diagnostics\DiagnosticSourceEventSource.cs: public const EventKeywords EntityFrameworkCoreCommands = (EventKeywords)0x2000;
System.Diagnostics.DiagnosticSource\src\System\Diagnostics\Metrics\MetricsEventSource.cs: public const EventKeywords Messages = (EventKeywords)0x1;
System.Diagnostics.DiagnosticSource\src\System\Diagnostics\Metrics\MetricsEventSource.cs: public const EventKeywords TimeSeriesValues = (EventKeywords)0x2;
System.Diagnostics.DiagnosticSource\src\System\Diagnostics\Metrics\MetricsEventSource.cs: public const EventKeywords InstrumentPublishing = (EventKeywords)0x4;
System.Diagnostics.DiagnosticSource\tests\DiagnosticSourceEventSourceBridgeTests.cs: var IgnoreShortCutKeywords = (EventKeywords)0x0800;
System.Diagnostics.DiagnosticSource\tests\DiagnosticSourceEventSourceBridgeTests.cs: var Messages = (EventKeywords)0x1;
System.Diagnostics.DiagnosticSource\tests\DiagnosticSourceEventSourceBridgeTests.cs: var Events = (EventKeywords)0x2;
System.Diagnostics.DiagnosticSource\tests\DiagnosticSourceEventSourceBridgeTests.cs: var AspNetCoreHosting = (EventKeywords)0x1000;
System.Diagnostics.DiagnosticSource\tests\DiagnosticSourceEventSourceBridgeTests.cs: var EntityFrameworkCoreCommands = (EventKeywords)0x2000;
System.Diagnostics.DiagnosticSource\tests\MetricEventSourceTests.cs: public const EventKeywords MessagesKeyword = (EventKeywords)0x1;
System.Diagnostics.DiagnosticSource\tests\MetricEventSourceTests.cs: public const EventKeywords TimeSeriesValues = (EventKeywords)0x2;
System.Diagnostics.DiagnosticSource\tests\MetricEventSourceTests.cs: public const EventKeywords InstrumentPublishing = (EventKeywords)0x4;
System.Diagnostics.Tracing\tests\BasicEventSourceTest\TestsUserErrors.cs: public const EventKeywords Debug = (EventKeywords)0x0002;
System.Diagnostics.Tracing\tests\CustomEventSources\EventSourceTest.cs: public const EventKeywords HasNoArgs = (EventKeywords)0x0001;
System.Diagnostics.Tracing\tests\CustomEventSources\EventSourceTest.cs: public const EventKeywords HasIntArgs = (EventKeywords)0x0002;
System.Diagnostics.Tracing\tests\CustomEventSources\EventSourceTest.cs: public const EventKeywords HasLongArgs = (EventKeywords)0x0004;
System.Diagnostics.Tracing\tests\CustomEventSources\EventSourceTest.cs: public const EventKeywords HasStringArgs = (EventKeywords)0x0008;
System.Diagnostics.Tracing\tests\CustomEventSources\EventSourceTest.cs: public const EventKeywords HasDateTimeArgs = (EventKeywords)0x0010;
System.Diagnostics.Tracing\tests\CustomEventSources\EventSourceTest.cs: public const EventKeywords HasEnumArgs = (EventKeywords)0x0020;
System.Diagnostics.Tracing\tests\CustomEventSources\EventSourceTest.cs: public const EventKeywords Transfer = (EventKeywords)0x0040;
System.Diagnostics.Tracing\tests\CustomEventSources\InvalidEventSources.cs: public const EventKeywords Kwd1 = (EventKeywords)0x0000100000000000UL;
System.Diagnostics.Tracing\tests\CustomEventSources\InvalidEventSources.cs: public const EventKeywords Op1 = (EventKeywords)0x1;
System.Diagnostics.Tracing\tests\CustomEventSources\InvalidEventSources.cs: public const EventKeywords Kwd1 = (EventKeywords)1;
System.Diagnostics.Tracing\tests\CustomEventSources\SimpleEventSource.cs: public const EventKeywords Kwd1 = (EventKeywords)1;
System.Diagnostics.Tracing\tests\CustomEventSources\SimpleEventSource.cs: public const EventKeywords Kwd2 = (EventKeywords)2;
System.Diagnostics.Tracing\tests\CustomEventSources\UseAbstractEventSource.cs: public const EventKeywords Kwd1 = (EventKeywords)1;
System.Diagnostics.Tracing\tests\CustomEventSources\UseAbstractEventSource.cs: public const EventKeywords Kwd2 = (EventKeywords)2;
System.Linq.Parallel\src\System\Linq\Parallel\Utils\PLINQETWProvider.cs: private const EventKeywords ALL_KEYWORDS = (EventKeywords)(-1);
System.Net.Http\src\System\Net\Http\HttpTelemetry.cs: public const EventKeywords RequestFailedDetailed = (EventKeywords)1;
System.Private.CoreLib\src\System\Diagnostics\Tracing\EventSource.cs: Keywords = (EventKeywords)metadata.Descriptor.Keywords,
System.Private.CoreLib\src\System\Diagnostics\Tracing\EventSource.cs: Keywords = (EventKeywords)metadata.Descriptor.Keywords,
System.Private.CoreLib\src\System\Diagnostics\Tracing\EventSource.cs: Keywords = (EventKeywords)unchecked(keywords),
System.Private.CoreLib\src\System\Diagnostics\Tracing\EventSource.cs: eventAttribute.Keywords |= (EventKeywords)manifest.GetChannelKeyword(eventAttribute.Channel, (ulong)eventAttribute.Keywords);
System.Private.CoreLib\src\System\Diagnostics\Tracing\FrameworkEventSource.cs: public const EventKeywords ThreadPool = (EventKeywords)0x0002;
System.Private.CoreLib\src\System\Diagnostics\Tracing\FrameworkEventSource.cs: public const EventKeywords ThreadTransfer = (EventKeywords)0x0010;
System.Private.CoreLib\src\System\Diagnostics\Tracing\NativeRuntimeEventSource.Threading.cs: public const EventKeywords ContentionKeyword = (EventKeywords)0x4000;
System.Private.CoreLib\src\System\Diagnostics\Tracing\NativeRuntimeEventSource.Threading.cs: public const EventKeywords ThreadingKeyword = (EventKeywords)0x10000;
System.Private.CoreLib\src\System\Diagnostics\Tracing\NativeRuntimeEventSource.Threading.cs: public const EventKeywords ThreadTransferKeyword = (EventKeywords)0x80000000;
System.Private.CoreLib\src\System\Diagnostics\Tracing\RuntimeEventSource.cs: public const EventKeywords AppContext = (EventKeywords)0x1;
System.Private.CoreLib\src\System\Diagnostics\Tracing\RuntimeEventSource.cs: public const EventKeywords ProcessorCount = (EventKeywords)0x2;
System.Private.CoreLib\src\System\Diagnostics\Tracing\TraceLogging\TraceLoggingEventSource.cs: Keywords = (EventKeywords)eventDescriptor.Keywords,
System.Private.CoreLib\src\System\Threading\Tasks\TplEventSource.cs: public const EventKeywords TaskTransfer = (EventKeywords)1;
System.Private.CoreLib\src\System\Threading\Tasks\TplEventSource.cs: public const EventKeywords Tasks = (EventKeywords)2;
System.Private.CoreLib\src\System\Threading\Tasks\TplEventSource.cs: public const EventKeywords Parallel = (EventKeywords)4;
System.Private.CoreLib\src\System\Threading\Tasks\TplEventSource.cs: public const EventKeywords AsyncCausalityOperation = (EventKeywords)8;
System.Private.CoreLib\src\System\Threading\Tasks\TplEventSource.cs: public const EventKeywords AsyncCausalityRelation = (EventKeywords)0x10;
System.Private.CoreLib\src\System\Threading\Tasks\TplEventSource.cs: public const EventKeywords AsyncCausalitySynchronousWork = (EventKeywords)0x20;
System.Private.CoreLib\src\System\Threading\Tasks\TplEventSource.cs: public const EventKeywords TaskStops = (EventKeywords)0x40;
System.Private.CoreLib\src\System\Threading\Tasks\TplEventSource.cs: public const EventKeywords TasksFlowActivityIds = (EventKeywords)0x80;
System.Private.CoreLib\src\System\Threading\Tasks\TplEventSource.cs: public const EventKeywords AsyncMethod = (EventKeywords)0x100;
System.Private.CoreLib\src\System\Threading\Tasks\TplEventSource.cs: public const EventKeywords TasksSetActivityIds = (EventKeywords)0x10000;
System.Private.CoreLib\src\System\Threading\Tasks\TplEventSource.cs: public const EventKeywords Debug = (EventKeywords)0x20000;
System.Private.CoreLib\src\System\Threading\Tasks\TplEventSource.cs: public const EventKeywords DebugActivityId = (EventKeywords)0x40000;
System.Runtime.InteropServices\gen\LibraryImportGenerator\Diagnostics\Events.cs: public const EventKeywords SourceGeneration = (EventKeywords)1;
System.Runtime.Serialization.Formatters\src\System\Runtime\Serialization\Formatters\Binary\BinaryFormatterEventSource.cs: public const EventKeywords Serialization = (EventKeywords)1;
System.Runtime.Serialization.Formatters\src\System\Runtime\Serialization\Formatters\Binary\BinaryFormatterEventSource.cs: public const EventKeywords Deserialization = (EventKeywords)2;
System.Threading\src\System\Threading\CDSsyncETWBCLProvider.cs: private const EventKeywords ALL_KEYWORDS = (EventKeywords)(-1);
System.Threading.Tasks.Dataflow\src\Internal\DataflowEtwProvider.cs: private const EventKeywords ALL_KEYWORDS = (EventKeywords)(-1);
System.Threading.Tasks.Parallel\src\System\Threading\Tasks\ParallelETWProvider.cs: private const EventKeywords ALL_KEYWORDS = (EventKeywords)(-1);
System.Threading.ThreadPool\tests\ThreadPoolTests.cs: private const EventKeywords ThreadingKeyword = (EventKeywords)0x10000;
System.Transactions.Local\src\System\Transactions\TransactionsEtwProvider.cs: private const EventKeywords ALL_KEYWORDS = (EventKeywords)(-1);
System.Transactions.Local\src\System\Transactions\TransactionsEtwProvider.cs: public const EventKeywords TraceBase = (EventKeywords)0x0001;
System.Transactions.Local\src\System\Transactions\TransactionsEtwProvider.cs: public const EventKeywords TraceLtm = (EventKeywords)0x0002;
System.Transactions.Local\src\System\Transactions\TransactionsEtwProvider.cs: public const EventKeywords TraceOleTx = (EventKeywords)0x0004;
cc: @brianrob
As @tarekgh points out, there is going to be a lot of overlap with the value 0x80. Keywords are defined at the provider level, so any provider can re-define the value 0x80 and specify which events belong to that keyword. The value TaskFlowActivityIds
is specific to the TplEventSource
, and so should not be added to the base EventKeywords
enum.
The recommended pattern here is for the consumption code (e.g. the user's code) to specify the keyword through their own defined constant. This keeps a clean separation between the produer (the EventSource
itself), which is generally not public by design, and the consuming code.
Effectively, what you're doing above - specifying the constant in your own code, is the correct pattern.
Background and motivation
I am getting a code violation on this line in my OSS project:
const EventKeywords TasksFlowActivityIds = 0x80;
Looking at the EventKeywords enum, that value is missing, but on this page, it says 0x080 is how we turn on Activity Id's: https://learn.microsoft.com/en-us/dotnet/core/diagnostics/eventsource-activity-ids
If I do as the article suggests and change it to use:
(EventKeywords)0x80);
Something is removing the cast when I save the file and I haven't figured out what it is yet. This made me wonder why 0x80 is missing from the enum or why isn't there another way to accomplish the same task.
API Proposal
0x80 needs to be added or there should be another way to enable Activity ID's.
API Usage
Alternative Designs
None
Risks
None