From 8f7ceab27b6baff52f40cb3aa169fef83298d047 Mon Sep 17 00:00:00 2001 From: Javad Rahnama Date: Thu, 9 Sep 2021 13:51:19 -0700 Subject: [PATCH 1/7] revert changes --- .../src/Microsoft/Data/SqlClient/SqlCommand.cs | 4 ++-- .../netfx/src/Microsoft/Data/SqlClient/SqlCommand.cs | 12 ++++++------ .../Microsoft/Data/SqlClient/SqlClientEventSource.cs | 10 +++++----- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlCommand.cs b/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlCommand.cs index 5329d1ff08..e505610f95 100644 --- a/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlCommand.cs +++ b/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlCommand.cs @@ -6594,7 +6594,7 @@ public SqlCommand Clone() private void WriteBeginExecuteEvent() { - SqlClientEventSource.Log.TryBeginExecuteEvent(ObjectID, Connection?.ClientConnectionId, CommandText); + SqlClientEventSource.Log.TryBeginExecuteEvent(ObjectID, Connection?.DataSource, Connection?.Database, CommandText); } private void WriteEndExecuteEvent(bool success, int? sqlExceptionNumber, bool synchronous) @@ -6615,7 +6615,7 @@ private void WriteEndExecuteEvent(bool success, int? sqlExceptionNumber, bool sy int compositeState = successFlag | isSqlExceptionFlag | synchronousFlag; - SqlClientEventSource.Log.TryEndExecuteEvent(ObjectID, Connection?.ClientConnectionId, compositeState, sqlExceptionNumber.GetValueOrDefault()); + SqlClientEventSource.Log.TryEndExecuteEvent(ObjectID, compositeState, sqlExceptionNumber.GetValueOrDefault()); } } } diff --git a/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/SqlCommand.cs b/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/SqlCommand.cs index 774ee07582..5b22b41d55 100644 --- a/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/SqlCommand.cs +++ b/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/SqlCommand.cs @@ -915,7 +915,7 @@ protected override DbParameterCollection DbParameterCollection return Parameters; } } - + internal static void CancelIgnoreFailureCallback(object state) { SqlCommand command = (SqlCommand)state; @@ -3027,9 +3027,9 @@ protected override Task ExecuteDbDataReaderAsync(CommandBehavior b throw result.Exception.InnerException; } return result.Result; - }, - CancellationToken.None, - TaskContinuationOptions.ExecuteSynchronously | TaskContinuationOptions.NotOnCanceled, + }, + CancellationToken.None, + TaskContinuationOptions.ExecuteSynchronously | TaskContinuationOptions.NotOnCanceled, TaskScheduler.Default ); } @@ -7626,7 +7626,7 @@ private SmiRequestExecutor SetUpSmiRequest(SqlInternalConnectionSmi innerConnect private void WriteBeginExecuteEvent() { - SqlClientEventSource.Log.TryBeginExecuteEvent(ObjectID, Connection?.ClientConnectionId, CommandText); + SqlClientEventSource.Log.TryBeginExecuteEvent(ObjectID, Connection?.DataSource, Connection?.Database, CommandText); } /// @@ -7653,7 +7653,7 @@ private void WriteEndExecuteEvent(bool success, int? sqlExceptionNumber, bool sy int compositeState = successFlag | isSqlExceptionFlag | synchronousFlag; - SqlClientEventSource.Log.TryEndExecuteEvent(ObjectID, Connection?.ClientConnectionId, compositeState, sqlExceptionNumber.GetValueOrDefault()); + SqlClientEventSource.Log.TryEndExecuteEvent(ObjectID, compositeState, sqlExceptionNumber.GetValueOrDefault()); } } diff --git a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlClientEventSource.cs b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlClientEventSource.cs index 210defcc58..5a79021125 100644 --- a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlClientEventSource.cs +++ b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlClientEventSource.cs @@ -510,22 +510,22 @@ internal void TryScopeLeaveEvent(long scopeId) #region Execution Trace [NonEvent] - internal void TryBeginExecuteEvent(int objectId, Guid? connectionId, string commandText, [System.Runtime.CompilerServices.CallerMemberName] string memberName = "") + internal void TryBeginExecuteEvent(int objectId, string datasource, string database, string commandText, [System.Runtime.CompilerServices.CallerMemberName] string memberName = "") { if (Log.IsExecutionTraceEnabled()) { BeginExecute(GetFormattedMessage(SqlCommand_ClassName, memberName, EventType.INFO, - string.Format("Object Id {0}, Client Connection Id {1}, Command Text {2}", objectId, connectionId, commandText))); + string.Format("Object Id {0}, Data Source Id {1}, Database {2}, Command Text {3}", objectId, datasource, database, commandText))); } } [NonEvent] - internal void TryEndExecuteEvent(int objectId, Guid? connectionId, int compositeState, int sqlExceptionNumber, [System.Runtime.CompilerServices.CallerMemberName] string memberName = "") + internal void TryEndExecuteEvent(int objectId, int compositeState, int sqlExceptionNumber, [System.Runtime.CompilerServices.CallerMemberName] string memberName = "") { if (Log.IsExecutionTraceEnabled()) { EndExecute(GetFormattedMessage(SqlCommand_ClassName, memberName, EventType.INFO, - string.Format("Object Id {0}, Client Connection Id {1}, Composite State {2}, Sql Exception Number {3}", objectId, connectionId, compositeState, sqlExceptionNumber))); + string.Format("Object Id {0}, Client Connection Id {1}, Composite State {2}, Sql Exception Number {3}", objectId, compositeState, sqlExceptionNumber))); } } #endregion @@ -1106,7 +1106,7 @@ internal static class EventType public const string INFO = " | INFO | "; public const string ERR = " | ERR | "; } - + internal readonly struct TrySNIEventScope : IDisposable { private readonly long _scopeId; From b8cdd5f5f3708deddf6d41a34fda0d53b48200ab Mon Sep 17 00:00:00 2001 From: Javad Rahnama Date: Thu, 9 Sep 2021 15:01:49 -0700 Subject: [PATCH 2/7] commit --- .../src/Microsoft/Data/SqlClient/SqlClientEventSource.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlClientEventSource.cs b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlClientEventSource.cs index 5a79021125..c3e9ec53d0 100644 --- a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlClientEventSource.cs +++ b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlClientEventSource.cs @@ -525,7 +525,7 @@ internal void TryEndExecuteEvent(int objectId, int compositeState, int sqlExcept if (Log.IsExecutionTraceEnabled()) { EndExecute(GetFormattedMessage(SqlCommand_ClassName, memberName, EventType.INFO, - string.Format("Object Id {0}, Client Connection Id {1}, Composite State {2}, Sql Exception Number {3}", objectId, compositeState, sqlExceptionNumber))); + string.Format("Object Id {0}, Composite State {1}, Sql Exception Number {2}", objectId, compositeState, sqlExceptionNumber))); } } #endregion From 27a74d636ca3682aa837312c6df8e7ed2413c3a9 Mon Sep 17 00:00:00 2001 From: Javad Rahnama Date: Thu, 9 Sep 2021 16:12:52 -0700 Subject: [PATCH 3/7] commit --- .../Microsoft/Data/SqlClient/SqlCommand.cs | 4 +- .../Microsoft/Data/SqlClient/SqlCommand.cs | 4 +- .../Data/SqlClient/SqlClientEventSource.cs | 46 ++++++++----------- 3 files changed, 22 insertions(+), 32 deletions(-) diff --git a/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlCommand.cs b/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlCommand.cs index e505610f95..3e59bf145a 100644 --- a/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlCommand.cs +++ b/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlCommand.cs @@ -6594,7 +6594,7 @@ public SqlCommand Clone() private void WriteBeginExecuteEvent() { - SqlClientEventSource.Log.TryBeginExecuteEvent(ObjectID, Connection?.DataSource, Connection?.Database, CommandText); + SqlClientEventSource.Log.BeginExecute(ObjectID, Connection?.DataSource, Connection?.Database, CommandText); } private void WriteEndExecuteEvent(bool success, int? sqlExceptionNumber, bool synchronous) @@ -6615,7 +6615,7 @@ private void WriteEndExecuteEvent(bool success, int? sqlExceptionNumber, bool sy int compositeState = successFlag | isSqlExceptionFlag | synchronousFlag; - SqlClientEventSource.Log.TryEndExecuteEvent(ObjectID, compositeState, sqlExceptionNumber.GetValueOrDefault()); + SqlClientEventSource.Log.EndExecute(ObjectID, compositeState, sqlExceptionNumber.GetValueOrDefault()); } } } diff --git a/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/SqlCommand.cs b/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/SqlCommand.cs index 5b22b41d55..ad19c24da7 100644 --- a/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/SqlCommand.cs +++ b/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/SqlCommand.cs @@ -7626,7 +7626,7 @@ private SmiRequestExecutor SetUpSmiRequest(SqlInternalConnectionSmi innerConnect private void WriteBeginExecuteEvent() { - SqlClientEventSource.Log.TryBeginExecuteEvent(ObjectID, Connection?.DataSource, Connection?.Database, CommandText); + SqlClientEventSource.Log.BeginExecute(ObjectID, Connection?.DataSource, Connection?.Database, CommandText); } /// @@ -7653,7 +7653,7 @@ private void WriteEndExecuteEvent(bool success, int? sqlExceptionNumber, bool sy int compositeState = successFlag | isSqlExceptionFlag | synchronousFlag; - SqlClientEventSource.Log.TryEndExecuteEvent(ObjectID, compositeState, sqlExceptionNumber.GetValueOrDefault()); + SqlClientEventSource.Log.EndExecute(ObjectID, compositeState, sqlExceptionNumber.GetValueOrDefault()); } } diff --git a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlClientEventSource.cs b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlClientEventSource.cs index c3e9ec53d0..41c2b9ca98 100644 --- a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlClientEventSource.cs +++ b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlClientEventSource.cs @@ -508,28 +508,6 @@ internal void TryScopeLeaveEvent(long scopeId) } #endregion - #region Execution Trace - [NonEvent] - internal void TryBeginExecuteEvent(int objectId, string datasource, string database, string commandText, [System.Runtime.CompilerServices.CallerMemberName] string memberName = "") - { - if (Log.IsExecutionTraceEnabled()) - { - BeginExecute(GetFormattedMessage(SqlCommand_ClassName, memberName, EventType.INFO, - string.Format("Object Id {0}, Data Source Id {1}, Database {2}, Command Text {3}", objectId, datasource, database, commandText))); - } - } - - [NonEvent] - internal void TryEndExecuteEvent(int objectId, int compositeState, int sqlExceptionNumber, [System.Runtime.CompilerServices.CallerMemberName] string memberName = "") - { - if (Log.IsExecutionTraceEnabled()) - { - EndExecute(GetFormattedMessage(SqlCommand_ClassName, memberName, EventType.INFO, - string.Format("Object Id {0}, Composite State {1}, Sql Exception Number {2}", objectId, compositeState, sqlExceptionNumber))); - } - } - #endregion - #region Notification Trace #region Notification Traces without if statements @@ -995,13 +973,25 @@ internal void TrySNIScopeLeaveEvent(long scopeId) #endregion #region Write Events - [Event(BeginExecuteEventId, Keywords = Keywords.ExecutionTrace, Task = Tasks.ExecuteCommand, Opcode = EventOpcode.Start)] - internal void BeginExecute(string message) => - WriteEvent(BeginExecuteEventId, message); + // Do no not change this Event writer as OpenTelemetry and ApplicationInsight are relating to the same format, unless you have check with them and they are able to change their design. + [Event(BeginExecuteEventId, Message = "SqlCommand.BeginExecute | INFO | Object ID {0}, Data Source {1}, Database{2} Command Text {3}", Keywords = Keywords.ExecutionTrace, Task = Tasks.ExecuteCommand, Opcode = EventOpcode.Start)] + internal void BeginExecute(int objectId, string dataSource, string database, string commandText) + { + if (Log.IsExecutionTraceEnabled()) + { + WriteEvent(BeginExecuteEventId, objectId, dataSource, database, commandText); + } + } - [Event(EndExecuteEventId, Keywords = Keywords.ExecutionTrace, Task = Tasks.ExecuteCommand, Opcode = EventOpcode.Stop)] - internal void EndExecute(string message) => - WriteEvent(EndExecuteEventId, message); + // Do no not change this Event writer as OpenTelemetry and ApplicationInsight are relating to the same format, unless you have check with them and they are able to change their design. + [Event(EndExecuteEventId, Message = "SqlCommand.EndExecute | INFO | Object ID {0}, Composite State {1}, SqlException Number {2}", Keywords = Keywords.ExecutionTrace, Task = Tasks.ExecuteCommand, Opcode = EventOpcode.Stop)] + internal void EndExecute(int objectId, int compositestate, int sqlExceptionNumber) + { + if (Log.IsExecutionTraceEnabled()) + { + WriteEvent(EndExecuteEventId, objectId, compositestate, sqlExceptionNumber); + } + } [Event(TraceEventId, Level = EventLevel.Informational, Keywords = Keywords.Trace)] internal void Trace(string message) => From 395834298228c3814bc6c591f28d397e4b63cf5b Mon Sep 17 00:00:00 2001 From: JRahnama Date: Wed, 15 Sep 2021 23:58:00 -0700 Subject: [PATCH 4/7] Adding message --- .../Microsoft/Data/SqlClient/SqlCommand.cs | 4 +- .../Microsoft/Data/SqlClient/SqlCommand.cs | 4 +- .../Data/SqlClient/SqlClientEventSource.cs | 43 +++++++++++++------ 3 files changed, 33 insertions(+), 18 deletions(-) diff --git a/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlCommand.cs b/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlCommand.cs index 3e59bf145a..daf24c1b57 100644 --- a/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlCommand.cs +++ b/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlCommand.cs @@ -6594,7 +6594,7 @@ public SqlCommand Clone() private void WriteBeginExecuteEvent() { - SqlClientEventSource.Log.BeginExecute(ObjectID, Connection?.DataSource, Connection?.Database, CommandText); + SqlClientEventSource.Log.TryBeginExecuteEvent(ObjectID, Connection?.DataSource, Connection?.Database, CommandText, Connection?.ClientConnectionId); } private void WriteEndExecuteEvent(bool success, int? sqlExceptionNumber, bool synchronous) @@ -6615,7 +6615,7 @@ private void WriteEndExecuteEvent(bool success, int? sqlExceptionNumber, bool sy int compositeState = successFlag | isSqlExceptionFlag | synchronousFlag; - SqlClientEventSource.Log.EndExecute(ObjectID, compositeState, sqlExceptionNumber.GetValueOrDefault()); + SqlClientEventSource.Log.TryEndExecuteEvent(ObjectID, compositeState, sqlExceptionNumber.GetValueOrDefault(), Connection?.ClientConnectionId); } } } diff --git a/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/SqlCommand.cs b/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/SqlCommand.cs index ad19c24da7..ef8b0a653d 100644 --- a/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/SqlCommand.cs +++ b/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/SqlCommand.cs @@ -7626,7 +7626,7 @@ private SmiRequestExecutor SetUpSmiRequest(SqlInternalConnectionSmi innerConnect private void WriteBeginExecuteEvent() { - SqlClientEventSource.Log.BeginExecute(ObjectID, Connection?.DataSource, Connection?.Database, CommandText); + SqlClientEventSource.Log.TryBeginExecuteEvent(ObjectID, Connection?.DataSource, Connection?.Database, CommandText, Connection?.ClientConnectionId); } /// @@ -7653,7 +7653,7 @@ private void WriteEndExecuteEvent(bool success, int? sqlExceptionNumber, bool sy int compositeState = successFlag | isSqlExceptionFlag | synchronousFlag; - SqlClientEventSource.Log.EndExecute(ObjectID, compositeState, sqlExceptionNumber.GetValueOrDefault()); + SqlClientEventSource.Log.TryEndExecuteEvent(ObjectID, compositeState, sqlExceptionNumber.GetValueOrDefault(), Connection?.ClientConnectionId); } } diff --git a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlClientEventSource.cs b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlClientEventSource.cs index 41c2b9ca98..fd72886bfd 100644 --- a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlClientEventSource.cs +++ b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlClientEventSource.cs @@ -508,6 +508,26 @@ internal void TryScopeLeaveEvent(long scopeId) } #endregion + #region Execution Trace + [NonEvent] + internal void TryBeginExecuteEvent(int objectId, string dataSource, string database, string commandText, Guid? connectionId, [System.Runtime.CompilerServices.CallerMemberName] string memberName = "") + { + if (Log.IsExecutionTraceEnabled()) + { + BeginExecute(objectId, dataSource, database, commandText, GetFormattedMessage(SqlCommand_ClassName, memberName, EventType.INFO, $"Object Id {objectId}, Client connection Id {connectionId}, Command Text {commandText}")); + } + } + + [NonEvent] + internal void TryEndExecuteEvent(int objectId, int compositeState, int sqlExceptionNumber, Guid? connectionId, [System.Runtime.CompilerServices.CallerMemberName] string memberName = "") + { + if (Log.IsExecutionTraceEnabled()) + { + EndExecute(objectId, compositeState, sqlExceptionNumber, GetFormattedMessage(SqlCommand_ClassName, memberName, EventType.INFO, $"Object Id {objectId}, Client Connection Id {connectionId}, Composite State {compositeState}, Sql Exception Number {sqlExceptionNumber}")); + } + } + #endregion + #region Notification Trace #region Notification Traces without if statements @@ -973,24 +993,19 @@ internal void TrySNIScopeLeaveEvent(long scopeId) #endregion #region Write Events - // Do no not change this Event writer as OpenTelemetry and ApplicationInsight are relating to the same format, unless you have check with them and they are able to change their design. - [Event(BeginExecuteEventId, Message = "SqlCommand.BeginExecute | INFO | Object ID {0}, Data Source {1}, Database{2} Command Text {3}", Keywords = Keywords.ExecutionTrace, Task = Tasks.ExecuteCommand, Opcode = EventOpcode.Start)] - internal void BeginExecute(int objectId, string dataSource, string database, string commandText) + // Do no not change the first 4 arguments in this Event writer as OpenTelemetry and ApplicationInsight are relating to the same format, unless you have checked with them and they are able to change their design. Additional items could be added at the end. + [Event(BeginExecuteEventId, Keywords = Keywords.ExecutionTrace, Task = Tasks.ExecuteCommand, Opcode = EventOpcode.Start)] + internal void BeginExecute(int objectId, string dataSource, string database, string commandText, string message) { - if (Log.IsExecutionTraceEnabled()) - { - WriteEvent(BeginExecuteEventId, objectId, dataSource, database, commandText); - } + WriteEvent(BeginExecuteEventId, objectId, dataSource, database, commandText, message); } - // Do no not change this Event writer as OpenTelemetry and ApplicationInsight are relating to the same format, unless you have check with them and they are able to change their design. - [Event(EndExecuteEventId, Message = "SqlCommand.EndExecute | INFO | Object ID {0}, Composite State {1}, SqlException Number {2}", Keywords = Keywords.ExecutionTrace, Task = Tasks.ExecuteCommand, Opcode = EventOpcode.Stop)] - internal void EndExecute(int objectId, int compositestate, int sqlExceptionNumber) + // Do no not change the first 3 arguments in this Event writer as OpenTelemetry and ApplicationInsight are relating to the same format, unless you have checked with them and they are able to change their design. Additional items could be added at the end. + [Event(EndExecuteEventId, Keywords = Keywords.ExecutionTrace, Task = Tasks.ExecuteCommand, Opcode = EventOpcode.Stop)] + internal void EndExecute(int objectId, int compositestate, int sqlExceptionNumber, string message) { - if (Log.IsExecutionTraceEnabled()) - { - WriteEvent(EndExecuteEventId, objectId, compositestate, sqlExceptionNumber); - } + + WriteEvent(EndExecuteEventId, objectId, compositestate, sqlExceptionNumber, message); } [Event(TraceEventId, Level = EventLevel.Informational, Keywords = Keywords.Trace)] From ee699e190b906a37c227612282ff7267d40d351b Mon Sep 17 00:00:00 2001 From: Javad Date: Fri, 17 Sep 2021 09:22:52 -0700 Subject: [PATCH 5/7] Update src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlClientEventSource.cs Co-authored-by: DavoudEshtehari <61173489+DavoudEshtehari@users.noreply.github.com> --- .../src/Microsoft/Data/SqlClient/SqlClientEventSource.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlClientEventSource.cs b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlClientEventSource.cs index fd72886bfd..d214ab2104 100644 --- a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlClientEventSource.cs +++ b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlClientEventSource.cs @@ -993,7 +993,8 @@ internal void TrySNIScopeLeaveEvent(long scopeId) #endregion #region Write Events - // Do no not change the first 4 arguments in this Event writer as OpenTelemetry and ApplicationInsight are relating to the same format, unless you have checked with them and they are able to change their design. Additional items could be added at the end. + // Do not change the first 4 arguments in this Event writer as OpenTelemetry and ApplicationInsight are relating to the same format, + // unless you have checked with them and they are able to change their design. Additional items could be added at the end. [Event(BeginExecuteEventId, Keywords = Keywords.ExecutionTrace, Task = Tasks.ExecuteCommand, Opcode = EventOpcode.Start)] internal void BeginExecute(int objectId, string dataSource, string database, string commandText, string message) { From 1b9083ef369e3d073c799a51d88a59659c8e5cfb Mon Sep 17 00:00:00 2001 From: Javad Date: Fri, 17 Sep 2021 09:23:06 -0700 Subject: [PATCH 6/7] Update src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlClientEventSource.cs Co-authored-by: DavoudEshtehari <61173489+DavoudEshtehari@users.noreply.github.com> --- .../src/Microsoft/Data/SqlClient/SqlClientEventSource.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlClientEventSource.cs b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlClientEventSource.cs index d214ab2104..e37aa7ecd8 100644 --- a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlClientEventSource.cs +++ b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlClientEventSource.cs @@ -1001,7 +1001,8 @@ internal void BeginExecute(int objectId, string dataSource, string database, str WriteEvent(BeginExecuteEventId, objectId, dataSource, database, commandText, message); } - // Do no not change the first 3 arguments in this Event writer as OpenTelemetry and ApplicationInsight are relating to the same format, unless you have checked with them and they are able to change their design. Additional items could be added at the end. + // Do not change the first 3 arguments in this Event writer as OpenTelemetry and ApplicationInsight are relating to the same format, + // unless you have checked with them and they are able to change their design. Additional items could be added at the end. [Event(EndExecuteEventId, Keywords = Keywords.ExecutionTrace, Task = Tasks.ExecuteCommand, Opcode = EventOpcode.Stop)] internal void EndExecute(int objectId, int compositestate, int sqlExceptionNumber, string message) { From d9747ccec8782fd553be3c0a60c2c8d5ffddf5d1 Mon Sep 17 00:00:00 2001 From: JRahnama Date: Fri, 17 Sep 2021 12:59:14 -0700 Subject: [PATCH 7/7] Add comments --- .../src/Microsoft/Data/SqlClient/SqlClientEventSource.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlClientEventSource.cs b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlClientEventSource.cs index e37aa7ecd8..4bb5621c29 100644 --- a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlClientEventSource.cs +++ b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlClientEventSource.cs @@ -68,6 +68,8 @@ internal virtual void ReclaimedConnectionRequest() { /*no-op*/ } #endregion } + // Any changes to event writers might be considered as a breaking change. + // Other libraries such as OpenTelemetry and ApplicationInsight have based part of their code on BeginExecute and EndExecute arguments number. [EventSource(Name = "Microsoft.Data.SqlClient.EventSource")] internal partial class SqlClientEventSource : SqlClientEventSourceBase {