-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Extend the use of OpenTelemetry to Core API entry points (#2054)
* Update projects for OpenTelemetry dependencies * Activate telemetry on completions endpoint * Add OpenTelemetry logging provider * Improve telemetry activity tag names * Changed OpenTelemetry.Instrumentation.Http and AspNetCore to 1.9.0 --------- Co-authored-by: Carey Payette <[email protected]>
- Loading branch information
1 parent
2d32d35
commit 316c8be
Showing
32 changed files
with
253 additions
and
85 deletions.
There are no files selected for viewing
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
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
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
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,13 @@ | ||
[ | ||
{ | ||
"telemetry_activity_source": "CoreAPI", | ||
"telemetry_activities": [ | ||
{ | ||
"name": "AsyncCompletions_StartCompletionOperation" | ||
}, | ||
{ | ||
"name": "Completions_GetCompletion" | ||
} | ||
] | ||
} | ||
] |
33 changes: 33 additions & 0 deletions
33
src/dotnet/Common/Constants/Telemetry/TelemetryActivityTagNames.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,33 @@ | ||
namespace FoundationaLLM.Common.Constants.Telemetry | ||
{ | ||
/// <summary> | ||
/// Provides the names of the tags used in telemetry activities. | ||
/// </summary> | ||
public static class TelemetryActivityTagNames | ||
{ | ||
/// <summary> | ||
/// The FoundationaLLM instance identifier tag. | ||
/// </summary> | ||
public const string InstanceId = "FoundationaLLM-InstanceId"; | ||
|
||
/// <summary> | ||
/// The FoundationaLLM conversation identifier tag. | ||
/// </summary> | ||
public const string ConversationId = "FoundationaLLM-ConversationId"; | ||
|
||
/// <summary> | ||
/// The FoundationaLLM operation identifier tag. | ||
/// </summary> | ||
public const string OperationId = "FoundationaLLM-OperationId"; | ||
|
||
/// <summary> | ||
/// The FoundationaLLM user principal name tag. | ||
/// </summary> | ||
public const string UPN = "FoundationaLLM-UPN"; | ||
|
||
/// <summary> | ||
/// The FoundationaLLM user identifier tag. | ||
/// </summary> | ||
public const string UserId = "FoundationaLLM-UserId"; | ||
} | ||
} |
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
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,16 @@ | ||
using FoundationaLLM.Common.Constants; | ||
using System.Diagnostics; | ||
|
||
namespace FoundationaLLM.Common.Telemetry | ||
{ | ||
/// <summary> | ||
/// Provides predefined telemetry activity sources for the components of the platform. | ||
/// </summary> | ||
public class TelemetryActivitySources | ||
{ | ||
/// <summary> | ||
/// The activity source for the Core API. | ||
/// </summary> | ||
public static readonly ActivitySource CoreAPIActivitySource = new (ServiceNames.CoreAPI); | ||
} | ||
} |
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,19 @@ | ||
namespace FoundationaLLM.Common.Constants.Telemetry | ||
{ | ||
/// <summary> | ||
/// Defines constants for all telemetry activity names. | ||
/// </summary> | ||
public static class TelemetryActivityNames | ||
{ | ||
/// <summary> | ||
/// The telemetry activity name for the CoreAPI AsyncCompletions_StartCompletionOperation action. | ||
/// </summary> | ||
public const string CoreAPI_AsyncCompletions_StartCompletionOperation = "AsyncCompletions_StartCompletionOperation"; | ||
|
||
/// <summary> | ||
/// The telemetry activity name for the CoreAPI Completions_GetCompletion action. | ||
/// </summary> | ||
public const string CoreAPI_Completions_GetCompletion = "Completions_GetCompletion"; | ||
|
||
} | ||
} |
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,36 @@ | ||
<#@ template debug="false" hostspecific="true" language="C#" #> | ||
<#@ assembly name="System.Core" #> | ||
<#@ import namespace="System.IO" #> | ||
<#@ assembly name="System.Text.Json" #> | ||
<#@ import namespace="System.Collections.Generic" #> | ||
<#@ assembly name="System.Memory" #> | ||
<#@ import namespace="System.Text.Json" #> | ||
<#@ import namespace="System.Text.Json.Nodes" #> | ||
<#@ output extension=".cs" #> | ||
<# | ||
string inputFileName = this.Host.ResolvePath($"../Constants/Data/TelemetryActivities.json"); | ||
string inputContent = File.ReadAllText(inputFileName); | ||
var jsonObjects = JsonNode.Parse(inputContent)!; | ||
#> | ||
namespace FoundationaLLM.Common.Constants.Telemetry | ||
{ | ||
/// <summary> | ||
/// Defines constants for all telemetry activity names. | ||
/// </summary> | ||
public static class TelemetryActivityNames | ||
{ | ||
<# | ||
foreach (var jsonObject in jsonObjects.AsArray()) | ||
{ | ||
foreach (var telemetryActivity in jsonObject["telemetry_activities"].AsArray()) | ||
{#> | ||
/// <summary> | ||
/// The telemetry activity name for the <#= jsonObject["telemetry_activity_source"] #> <#= telemetryActivity["name"] #> action. | ||
/// </summary> | ||
public const string <#= jsonObject["telemetry_activity_source"] #>_<#= telemetryActivity["name"] #> = "<#= telemetryActivity["name"] #>"; | ||
|
||
<#} | ||
} | ||
#> | ||
} | ||
} |
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
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
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.