forked from dotnet/project-system
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request dotnet#8921 from tmeschter/230314-AddTelemetryAPI
Add support for reporting operations via telemetry
- Loading branch information
Showing
4 changed files
with
266 additions
and
129 deletions.
There are no files selected for viewing
39 changes: 39 additions & 0 deletions
39
src/Microsoft.VisualStudio.ProjectSystem.Managed/Telemetry/ITelemetryOperation.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. The .NET Foundation licenses this file to you under the MIT license. See the LICENSE.md file in the project root for more information. | ||
|
||
namespace Microsoft.VisualStudio.Telemetry; | ||
|
||
/// <summary> | ||
/// <para> | ||
/// Represents an operation with associated start and end events. An <see cref="ITelemetryOperation"/> | ||
/// is started by calling <see cref="ITelemetryService.BeginOperation(string)"/>. | ||
/// </para> | ||
/// <para> | ||
/// This type implements <see cref="IDisposable"/> to ensure that operations are completed and reported, | ||
/// but consumers must also call <see cref="End(TelemetryResult)"/> to report the success or failure of | ||
/// the operation. | ||
/// </para> | ||
/// </summary> | ||
internal interface ITelemetryOperation : IDisposable | ||
{ | ||
/// <summary> | ||
/// Associates the given properties with the "end" event of the operation. | ||
/// </summary> | ||
/// <param name="properties"> | ||
/// An <see cref="IEnumerable{T}"/> of property names and values. | ||
/// </param> | ||
/// <exception cref="ArgumentNullException"> | ||
/// <paramref name="properties"/> is <see langword="null"/>. | ||
/// </exception> | ||
/// <exception cref="ArgumentException"> | ||
/// <paramref name="properties"/> is contains no elements. | ||
/// </exception> | ||
void SetProperties(IEnumerable<(string propertyName, object propertyValue)> properties); | ||
|
||
/// <summary> | ||
/// Ends the operation and reports the result. | ||
/// </summary> | ||
/// <param name="result"> | ||
/// A <see cref="TelemetryResult"/> value indicating the result of the operation. | ||
/// </param> | ||
void End(TelemetryResult result); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.