/// <summary> /// Creates the new telemetry event instance with specific information. /// </summary> /// <param name="eventName">Event name that is unique, not null and not empty.</param> /// <param name="severity">Severity level of the event.</param> /// <param name="correlation">Correlation value for this event.</param> internal TelemetryEvent(string eventName, TelemetrySeverity severity, TelemetryEventCorrelation correlation) { CodeContract.RequiresArgumentNotNullAndNotWhiteSpace(eventName, "eventName"); correlation.RequireNotEmpty("correlation"); TelemetryService.EnsureEtwProviderInitialized(); this.eventName = eventName.ToLower(CultureInfo.InvariantCulture); Severity = severity; Correlation = correlation; EventSchemaVersion = 5; InitDataModelBasicProperties(); }
public object CreateTelemetryOperationEventScope(string eventName, TelemetrySeverity severity, object[] correlations, IDictionary <string, object> startingProperties) { return(null); }
/// <summary> /// Creates the new telemetry event instance with specific information. /// </summary> /// <param name="eventName">Event name that is unique, not null and not empty.</param> /// <param name="severity">Severity level of the event.</param> /// <param name="eventType">Data Model type of this event. check <see cref="T:Coding4Fun.VisualStudio.Telemetry.DataModelEventType" /> for full type list. </param> internal TelemetryEvent(string eventName, TelemetrySeverity severity, DataModelEventType eventType) : this(eventName, severity, new TelemetryEventCorrelation(Guid.NewGuid(), eventType)) { }
/// <summary> /// Creates the new telemetry event instance with severity information. /// You should consider choosing <see cref="T:Coding4Fun.VisualStudio.Telemetry.UserTaskEvent" />, <see cref="T:Coding4Fun.VisualStudio.Telemetry.OperationEvent" />, <see cref="T:Coding4Fun.VisualStudio.Telemetry.FaultEvent" />, <see cref="T:Coding4Fun.VisualStudio.Telemetry.AssetEvent" />, /// <see cref="T:Coding4Fun.VisualStudio.Telemetry.TelemetrySettingProperty" /> or <see cref="T:Coding4Fun.VisualStudio.Telemetry.TelemetryMetricProperty" /> /// These will enable a richer telemetry experience with additional insights provided by Visual Studio Data Model. /// If your data point doesn't align with any VS Data Model entity, please don't force any association and continue to use this method. /// If you have any questions regarding VS Data Model, please email VS Data Model Crew ([email protected]). /// </summary> /// <param name="eventName">Event name that is unique, not null and not empty.</param> /// <param name="severity">Severity level of the event.</param> public TelemetryEvent(string eventName, TelemetrySeverity severity) : this(eventName, severity, DataModelEventType.Trace) { }
/// <summary> /// Start tracking operation by posting a <see cref="T:Coding4Fun.VisualStudio.Telemetry.OperationEvent" /> with specified properties at the begining of operation work, /// and return a <see cref="T:Coding4Fun.VisualStudio.Telemetry.TelemetryScope`1" /> object. /// When the user task finishes, call method <see cref="M:Coding4Fun.VisualStudio.Telemetry.TelemetryScope`1.End(Coding4Fun.VisualStudio.Telemetry.TelemetryResult,System.String)" /> to post another <see cref="T:Coding4Fun.VisualStudio.Telemetry.OperationEvent" /> for end point. /// Because the same event name is used by both start and end events, please don't use Start or End in event name. /// </summary> /// <param name="session">Telemetry Session</param> /// <param name="eventName"> /// An event name following data model schema. /// It requires that event name is a unique, not null or empty string. /// It consists of 3 parts and must follows pattern [product]/[featureName]/[entityName]. FeatureName could be a one-level feature or feature hierarchy delimited by "/". /// For examples, /// vs/platform/opensolution; /// vs/platform/editor/lightbulb/fixerror; /// </param> /// <param name="severity"> /// A severity level of the event. /// The level is used for event consumer (e.g., ETW provider, backend reporting) to organize data easier. /// </param> /// <param name="startEventProperties"> /// Event properties for the start event of this scope. They are also copied to end event. /// </param> /// <param name="correlations">Events with which this scope can correlate.</param> /// <returns><see cref="T:Coding4Fun.VisualStudio.Telemetry.TelemetryScope`1" /> instance.</returns> public static TelemetryScope <OperationEvent> StartOperation(this TelemetrySession session, string eventName, TelemetrySeverity severity, IDictionary <string, object> startEventProperties, TelemetryEventCorrelation[] correlations) { TelemetryScopeSettings settings = new TelemetryScopeSettings { Severity = severity, StartEventProperties = startEventProperties, Correlations = correlations }; return(session.StartOperation(eventName, settings)); }
/// <summary> /// Start tracking operation by posting a <see cref="T:Coding4Fun.VisualStudio.Telemetry.OperationEvent" /> with specified properties at the begining of operation work, /// and return a <see cref="T:Coding4Fun.VisualStudio.Telemetry.TelemetryScope`1" /> object. /// When the user task finishes, call method <see cref="M:Coding4Fun.VisualStudio.Telemetry.TelemetryScope`1.End(Coding4Fun.VisualStudio.Telemetry.TelemetryResult,System.String)" /> to post another <see cref="T:Coding4Fun.VisualStudio.Telemetry.OperationEvent" /> for end point. /// Because the same event name is used by both start and end events, please don't use Start or End in event name. /// </summary> /// <param name="session">Telemetry Session</param> /// <param name="eventName"> /// An event name following data model schema. /// It requires that event name is a unique, not null or empty string. /// It consists of 3 parts and must follows pattern [product]/[featureName]/[entityName]. FeatureName could be a one-level feature or feature hierarchy delimited by "/". /// For examples, /// vs/platform/opensolution; /// vs/platform/editor/lightbulb/fixerror; /// </param> /// <param name="severity"> /// A severity level of the event. /// The level is used for event consumer (e.g., ETW provider, backend reporting) to organize data easier. /// </param> /// <param name="startEventProperties"> /// Event properties for the start event of this scope. They are also copied to end event. /// </param> /// <returns><see cref="T:Coding4Fun.VisualStudio.Telemetry.TelemetryScope`1" /> instance.</returns> public static TelemetryScope <OperationEvent> StartOperation(this TelemetrySession session, string eventName, TelemetrySeverity severity, IDictionary <string, object> startEventProperties) { return(session.StartOperation(eventName, severity, startEventProperties, null)); }
/// <summary> /// Start tracking operation by posting a <see cref="T:Coding4Fun.VisualStudio.Telemetry.OperationEvent" /> at the begining of operation work, and return a <see cref="T:Coding4Fun.VisualStudio.Telemetry.TelemetryScope`1" /> object. /// When the user task finishes, call method <see cref="M:Coding4Fun.VisualStudio.Telemetry.TelemetryScope`1.End(Coding4Fun.VisualStudio.Telemetry.TelemetryResult,System.String)" /> to post another <see cref="T:Coding4Fun.VisualStudio.Telemetry.OperationEvent" /> for end point. /// Because the same event name is used by both start and end events, please don't use Start or End in event name. /// </summary> /// <param name="session">Telemetry Session</param> /// <param name="eventName"> /// An event name following data model schema. /// It requires that event name is a unique, not null or empty string. /// It consists of 3 parts and must follows pattern [product]/[featureName]/[entityName]. FeatureName could be a one-level feature or feature hierarchy delimited by "/". /// For examples, /// vs/platform/opensolution; /// vs/platform/editor/lightbulb/fixerror; /// </param> /// <param name="severity"> /// A severity level of the event. /// The level is used for event consumer (e.g., ETW provider, backend reporting) to organize data easier. /// </param> /// <returns><see cref="T:Coding4Fun.VisualStudio.Telemetry.TelemetryScope`1" /> instance.</returns> public static TelemetryScope <OperationEvent> StartOperation(this TelemetrySession session, string eventName, TelemetrySeverity severity) { return(session.StartOperation(eventName, severity, null, null)); }
/// <summary> /// Start tracking user task by posting a <see cref="T:Coding4Fun.VisualStudio.Telemetry.UserTaskEvent" /> at the beginning of user task work, and then return a <see cref="T:Coding4Fun.VisualStudio.Telemetry.TelemetryScope`1" /> object. /// When the user task finishes, call method <see cref="M:Coding4Fun.VisualStudio.Telemetry.TelemetryScope`1.End(Coding4Fun.VisualStudio.Telemetry.TelemetryResult,System.String)" /> to post another <see cref="T:Coding4Fun.VisualStudio.Telemetry.UserTaskEvent" /> for end point. /// Because the same event name is used by both start and end events, please don't use Start or End in event name. /// </summary> /// <param name="session">Telemetry Session</param> /// <param name="eventName"> /// An event name following data model schema. /// It requires that event name is a unique, not null or empty string. /// It consists of 3 parts and must follows pattern [product]/[featureName]/[entityName]. FeatureName could be a one-level feature or feature hierarchy delimited by "/". /// For examples, /// vs/platform/opensolution; /// vs/platform/editor/lightbulb/fixerror; /// </param> /// <param name="severity"> /// A severity level of the event. /// The level is used for event consumer (e.g., ETW provider, backend reporting) to organize data easier. /// </param> /// <returns><see cref="T:Coding4Fun.VisualStudio.Telemetry.TelemetryScope`1" /> instance.</returns> public static TelemetryScope <UserTaskEvent> StartUserTask(this TelemetrySession session, string eventName, TelemetrySeverity severity) { return(session.StartUserTask(eventName, severity, null, null)); }