Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Conversation

@qizhanMS
Copy link
Member

No description provided.

@dnfclas
Copy link

dnfclas commented Oct 31, 2016

Hi @qizhanMS, I'm your friendly neighborhood .NET Foundation Pull Request Bot (You can call me DNFBOT). Thanks for your contribution!

In order for us to evaluate and accept your PR, we ask that you sign a contribution license agreement. It's all electronic and will take just minutes. I promise there's no faxing. https://cla2.dotnetfoundation.org.

TTYL, DNFBOT;

@karelz
Copy link
Member

karelz commented Oct 31, 2016

@jimcarley are you the owner of the System.Transactions area?

@dnfclas
Copy link

dnfclas commented Oct 31, 2016

@qizhanMS, Thanks for signing the contribution license agreement so quickly! Actual humans will now validate the agreement and then evaluate the PR.

Thanks, DNFBOT;

_cloneId = 1;
if (DiagnosticTrace.Information)
TransactionsEtwProvider etwLog = TransactionsEtwProvider.Log;
if (etwLog.IsEnabled())
Copy link
Member

Choose a reason for hiding this comment

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

would it be cleaner to move the IsEnabled check inside the etwLog methods, so it's all one line? it's no more function calls.

Copy link
Member

Choose a reason for hiding this comment

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

would it be cleaner to move the IsEnabled check inside the etwLog methods, so it's all one line? it's no more function calls.

That's likely fine in this particular case. It's less fine in cases where the call site to the tracing operation does any measurable amount of work, or if the tracing method itself can't or won't be inlined (the IsEnabled check will be).

if (etwLog.IsEnabled())
{
TransactionCreatedTraceRecord.Trace(SR.TraceSourceLtm, TransactionTraceId);
etwLog.TransactionCreated(this, "CommittableTransaction");
Copy link
Member

Choose a reason for hiding this comment

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

You might consider taking advantage of some newer C# features, like [CallerMemberName], [CallerLineNumber], etc. I recently did so in #13134 if you're looking for an example.

Copy link
Member Author

Choose a reason for hiding this comment

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

Do you know which value to use for "thisOrContextObject" when "this" is not available, such as in static method or static class?

Copy link
Member

Choose a reason for hiding this comment

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

Do you know which value to use for "thisOrContextObject" when "this" is not available, such as in static method or static class?

It's up to you. I named it that for the networking logging as often the right value was just null, but sometimes functions were static but had an argument that was sort of the logical this, some object that represented the overall state for the operation, a "context" object, so I named it "thisOrContextObject" so that the code could pass in this, null, or whatever else made sense.


namespace System.Transactions.Diagnostics
{
/*
Copy link

Choose a reason for hiding this comment

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

Just delete these files instead of commenting them out.

Copy link
Member Author

Choose a reason for hiding this comment

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

ok.

EnlistmentType.PromotableSinglePhase,
EnlistmentOptions.None
);
etwLog.TransactionstateEnlist(tx._durableEnlistment.EnlistmentTraceId, "PromotableSinglePhase", "None");
Copy link

Choose a reason for hiding this comment

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

I'd prefer the ETW event method takes the EnlistmentType and EnlistmentOptions enums as parameters and calls ToString() on the values rather than passing in the strings "PromotableSinglePhase" and "None".

Copy link
Member Author

Choose a reason for hiding this comment

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

Done.

// Transactions Events
//

#region Transcation Creation
Copy link

Choose a reason for hiding this comment

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

Typo

Copy link
Member Author

Choose a reason for hiding this comment

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

Done.

}
#endregion

#region Transcation Dependent Clone Complete
Copy link

Choose a reason for hiding this comment

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

Typo

Copy link
Member Author

Choose a reason for hiding this comment

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

Done.


#region Enlistment Commited
/// <summary>Trace an enlistment that commited.</summary>
/// <param name="enlistment">The enlistment aborted.</param>
Copy link

Choose a reason for hiding this comment

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

param should be "The enlistment that committed"

Copy link
Member Author

Choose a reason for hiding this comment

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

Done.

/// <summary>Trace an enlistment that commited.</summary>
/// <param name="enlistment">The enlistment aborted.</param>
[NonEvent]
internal void EnlistmentCommited(InternalEnlistment enlistment)
Copy link

Choose a reason for hiding this comment

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

Please search/replace "Commited" with "Committed".

Copy link
Member Author

Choose a reason for hiding this comment

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

Done.

public const EventOpcode ForceRollback = (EventOpcode)102;
public const EventOpcode Incomplete = (EventOpcode)123;
public const EventOpcode InDoubt = (EventOpcode)105;
public const EventOpcode IntrenalError = (EventOpcode)124;
Copy link

Choose a reason for hiding this comment

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

Typo

Copy link
Member Author

Choose a reason for hiding this comment

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

put number in order?

Copy link

Choose a reason for hiding this comment

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

Well, change IntrenalError to InternalError. You have to pick whether to order the properties alphabetically or by opcode number. You can't do both because when the list is modified in the future, it will be out of order.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done with the typo. For the ordering, we can do alphabetically and if we need to add more, we just update all eventOpcode after the inserted one.

public const EventOpcode Commited = (EventOpcode)104;
public const EventOpcode Create = (EventOpcode)100;
public const EventOpcode Created = (EventOpcode)119;
public const EventOpcode CurentChanged = (EventOpcode)120;
Copy link

Choose a reason for hiding this comment

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

Typo

Copy link
Member Author

Choose a reason for hiding this comment

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

put number in order?

Copy link

Choose a reason for hiding this comment

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

Change CurentChanged to CurrentChanged. Same not as above regarding the order.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done

@dmetzgar
Copy link

dmetzgar commented Nov 1, 2016

It looks like you have removed the TraceSource* distinction from each event. From what I could find there's Base, Ltm, and Distributed. This data might be useful for filtering so consider creating keywords for each.

[QizhanMS's response] We already use Task and Opcode in the ETW tracing, user can easily check the event they are interested in. If we use Base, Ltm and Distributed in the event message, we can help user to narrow down a lit bit of their events. The trade off is a lit bit longer message. I am ok to add it.

[QizhanMS's update] using TraceSource* and code change is in commit #3

@jimcarley
Copy link

Qi and I are both working on it, yes.


In reply to: 257407084 [](ancestors = 257407084)

<Compile Include="System\Transactions\Configuration\ConfigurationStrings.cs" />
<Compile Include="System\Transactions\Configuration\DefaultSettingsSection.cs" />
<Compile Include="System\Transactions\Configuration\MachineSettingsSection.cs" />
<Compile Include="System\Transactions\Trace\TraceRecord.cs" />

Choose a reason for hiding this comment

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

e\TraceRecord.cs" / [](start = 46, length = 19)

I am wondering if we can keep these files and "hide" the usage of ETW inside these methods. This might prevent the need for changing all of the scattered locations in the code where the tracing is produced.

Copy link
Member Author

Choose a reason for hiding this comment

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

If we reuse the TraceRecord, we may not be able to use [callermethodname]. Also, the code will have one extra layer of function call and not look like other ETW tracing code. This will increase confusing on other developers.

@jimcarley
Copy link

🕐

@qizhanMS
Copy link
Member Author

qizhanMS commented Nov 8, 2016

@dotnet-bot test ci please

@dmetzgar
Copy link

LGTM once you fix the merge conflicts

# Conflicts:
#	src/System.Transactions/src/project.json
@qizhanMS qizhanMS merged commit a243763 into master Nov 13, 2016
@karelz karelz modified the milestone: 1.2.0 Dec 3, 2016
@jkotas jkotas deleted the qizhanMS branch December 10, 2016 14:53
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants