Is it possible to profile Azure App Service using DotTrace remotely?

Here's what I tried so far:

1) Uploading console tools to the app using Kudu and running them. Im getting:

D:\home\site\wwwroot\JetBrains.dotTrace.CommandLineTools.2019.2.3>ConsoleProfiler.exe attach 18304 --save-to=snapshot.dtp
    dotTrace Console Profiler 2019.2.3 build 777.0.20191016.60146. Copyright (C) 2019 JetBrains s.r.o.
    Could not create the Software\JavaSoft\Prefs\jetbrains Registry key in HKEY_CURRENT_USER hive. The system cannot find the file specified
    Could not create the Software\JetBrains\Platform Registry key in HKEY_CURRENT_USER hive. The system cannot find the file specified
    Attach Helper v192.0.18183.30839 Copyright (C) 2010-2019 JetBrains s.r.o.
    Attach Helper v192.0.18183.30839 Copyright (C) 2010-2019 JetBrains s.r.o.
    Profiling in progress...
    Attach Helper v192.0.18183.30839 Copyright (C) 2010-2019 JetBrains s.r.o.
    Attach Helper v192.0.18183.30839 Copyright (C) 2010-2019 JetBrains s.r.o.
    Unable to start profiling. Could not create the Software\JetBrains\Profiler\Upid_18304_1d58c471074c27a Registry key in HKEY_CURRENT_USER hive...

2) Uploading RemoteAgent using Kudu and running it. I'm getting: No DNS entries exist for host xxx. No such host is known.

8 comments
Comment actions Permalink

Hi Karol,

 

Currently, neither Console Profiler nor Remote Agent can be used to profile applications hosted on Azure App Services. The only currently available way to profile such applications with dotTrace is our profiling SDK. But we are currently researching the possibility of profiling Azure App Services using console profiler or maybe some extension for Azure.

I've also answered you in the corresponding support ticket.

 

0
Comment actions Permalink

Hi, thanks for the replies.

Using the SDK + Nuget package I get to the timeout exception when trying to attach the profiler using the following code (on the app service, but not locally where it works fine).

private void AttachProfiler(ProfilingType profilingType)
    {
        var folder = AppDomain.CurrentDomain.BaseDirectory;
        CurrentProfilingType = profilingType.ToString();

        SelfAttach.Attach(new SaveSnapshotProfilingConfig
        {
            ProfilingControlKind = ProfilingControlKind.Api,
            SaveDir = Path.Combine(folder, "Temp") ,
            RedistDir = Path.Combine(folder, "_JetBrains.Profiler.SelfSdk.2019.1.3"),
            ProfilingType = profilingType,
            ListFile = GetListFile(folder)
        });
        SleepUntilAttachedOrTimedOut();
    }

    private static string GetListFile(string folder)
    {
        return Path.Combine(folder, "snapshot_list.xml");
    }

    private void SleepUntilAttachedOrTimedOut()
    {
        var totalMilliseconds = 0;

        while (!CheckProfilerAttached())
        {
            var intervalMilliseconds = 250;

            Thread.Sleep(intervalMilliseconds);

            totalMilliseconds += intervalMilliseconds;

            if (totalMilliseconds >= 60000)
            {
                throw new TimeoutException("Could not attach profiler. Timeout.");
            }
        }
    }

    private bool CheckProfilerAttached() => SelfAttach.State == SelfApiState.Active;

 

0
Comment actions Permalink

You're right, there is a permission issue inside SelfAttach.Attach() method, it can't work without an access to the registry. I'm sorry for misleading you. So, unfortunately, currently you can't profile Azure App Service with our SDK.

0
Comment actions Permalink

I'd love to see this supported because there is currently no way to profile azure functions

0
Comment actions Permalink

We are currently working on it and even have a working prototype. We are going to release Azure profiling in 2021.1 version of dotTrace (~ April 2021, also will be available in EAP builds).

1
Comment actions Permalink

Great news :) 

0
Comment actions Permalink

Hi Konstantin,

what is the current status about Azure profiling? Will dotTrace 2021.1 or 2021.2 do the job?
Do we need to consider something?

Warm regards,
Nils

0
Comment actions Permalink

Unfortunately, this feature is postponed. It is still in our plans, but I can't say for sure when it will be available.

0

Please sign in to leave a comment.