Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Dynamic Instrumentation] DEBUG-2256 Do not create ProbeProcessor when LiveDebugger isn't fully initialized #6092

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@ internal static ProbeExpressionsProcessor Instance

internal void AddProbeProcessor(ProbeDefinition probe)
{
if (LiveDebugger.Instance?.IsInitialized == false)
{
Log.Error("Failed to create probe processor for probe: {Id}", probe.Id);
throw new Exception("AddProbeProcessor can be called only when LiveDebugger is initialized");
}

try
{
_processors.AddOrUpdate(
Expand Down
7 changes: 4 additions & 3 deletions tracer/src/Datadog.Trace/Debugger/LiveDebugger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ internal class LiveDebugger
private readonly ConfigurationUpdater _configurationUpdater;
private readonly IDogStatsd _dogStats;
private readonly object _instanceLock = new();
private bool _isInitialized;
private bool _isRcmAvailable;

private LiveDebugger(
Expand Down Expand Up @@ -88,6 +87,8 @@ private LiveDebugger(

public static LiveDebugger Instance { get; private set; }

public bool IsInitialized { get; private set; }

public string ServiceName { get; }

internal DebuggerSettings Settings { get; }
Expand Down Expand Up @@ -132,7 +133,7 @@ public async Task InitializeAsync()
return;
}

_isInitialized = true;
IsInitialized = true;
}

try
Expand All @@ -153,7 +154,7 @@ public async Task InitializeAsync()

bool CanInitialize()
{
if (_isInitialized)
if (IsInitialized)
{
return false;
}
Expand Down
Loading