-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for OpenTelemetry in worker (#1058)
* OpenTelemetry support in worker (#1049) * Detect if OpenTelemetry module is present and environment variable is set * Pre-instrument invocations with a span using Invocation ID + parent span ID * Forward all user logs to the module to be sent to OTel endpoint (cherry picked from commit f0c7eec)
- Loading branch information
1 parent
468617c
commit 684a843
Showing
16 changed files
with
657 additions
and
74 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
|
||
namespace Microsoft.Azure.Functions.PowerShellWorker.Utility | ||
{ | ||
internal class LoggingEventHandler | ||
{ | ||
private Action<string, string, Exception> _eventHandler = (a, b, c) => { }; | ||
|
||
public void Subscribe(Action<string, string, Exception> handler) | ||
{ | ||
_eventHandler = handler; | ||
} | ||
|
||
public void LogToHandlers(string level, string message, Exception exception = null) | ||
{ | ||
_eventHandler(level, message, exception); | ||
} | ||
} | ||
} |
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 System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace Microsoft.Azure.Functions.PowerShellWorker.OpenTelemetry | ||
{ | ||
internal interface IPowerShellServicesForOpenTelemetry | ||
{ | ||
bool? IsModuleLoaded(); | ||
void AddStartOpenTelemetryInvocationCommand(OpenTelemetryInvocationContext otelContext); | ||
void StopOpenTelemetryInvocation(OpenTelemetryInvocationContext otelContext, bool invokeCommands); | ||
void StartFunctionsLoggingListener(bool invokeCommands); | ||
} | ||
} |
Oops, something went wrong.