【问题标题】:Is it possible to profile Azure App Service using Jetbrains DotTrace?是否可以使用 Jetbrains DotTrace 分析 Azure 应用服务?
【发布时间】:2020-02-21 23:02:15
【问题描述】:

到目前为止,这是我尝试过的:

1) 使用 Kudu 将控制台工具上传到应用程序并运行它们。好吧,这是不可能的,因为不允许写入注册表。

2) 使用 Kudu 上传 RemoteAgent 并运行它。我越来越: 连接到 Kudu 控制台中打印的 URL 时,来自 dotTrace UI 的No DNS entries exist for host xxx. No such host is known.。 App 服务只能监听 80 和 443 端口。

3) 使用 dotTrace SDK 和 JetBrains.Profiler.Api 看起来很有希望。它不想在 Azure 上附加探查器(而不是在本地没有问题),使用此代码会遇到超时异常。

private void AttachProfiler(ProfilingType profilingType)
    {
        var folder = AppDomain.CurrentDomain.BaseDirectory;
        FileList = GetListFile(folder);
        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 = FileList
        });
        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;

【问题讨论】:

    标签: c# asp.net azure asp.net-core dottrace


    【解决方案1】:

    目前不可能。此处创建的问题:https://youtrack.jetbrains.com/issue/PROF-921

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2010-10-10
      • 1970-01-01
      • 2021-12-15
      • 1970-01-01
      • 1970-01-01
      • 2015-11-18
      相关资源
      最近更新 更多