orleans_如何设置Microsoft Orleans的报告仪表板

orleans

by Russell Hammett Jr. (Kritner)

小罗素·哈米特(Kritner)

如何设置Microsoft Orleans的报告仪表板 (How to set up Microsoft Orleans’ Reporting Dashboard)

Orleans is an easy to use actor framework, but how can you monitor your deployment? Luckily, there’s something simple to use — Orleans Dashboard!

Orleans是一个易于使用的actor框架,但是如何监视部署? 幸运的是,有一些简单易用的东西-Orleans Dashboard

As a refresher — Orleans, like other actor model frameworks, is a means of distributing compute across a series of machines that act as a cluster. In the case of Orleans, a lot of that cluster management is seemingly transparent, and abstracted away from the user. That is both awesome, and makes me a bit uncomfortable! Thankfully, the awesome people that built and/or use the product built an add-on dashboard to help alleviate some stress.

作为更新,Orleans像其他参与者模型框架一样,是一种在一系列充当集群的机器之间分布计算的方法。 以奥尔良为例,许多集群管理看似透明,并且从用户那里抽象出来。 太棒了,这让我有点不舒服! 值得庆幸的是,构建和/或使用该产品的出色人员构建了一个附加仪表板,以帮助减轻压力。

Orleans Dashboard was suggested to me in the Orleans Gitter when I was inquiring about how to look into “how my system is doing” when running a cluster. The dashboard is stupid simple to get started with, so let’s get going!

当我询问运行集群时如何研究“我的系统运行情况”时, Orleans DashboardOrleans Gitter中被建议给我。 仪表板很容易上手,所以让我们开始吧!

I’m using release v0.30 of Kritner-Blogs/OrleansGettingStarted as my starting point. This will give us a few different grain types to play around with to watch the fancy new dashboard.

我使用的版本v0.30Kritner,博客/ OrleansGettingStarted作为我的出发点。 这将为我们提供一些不同的谷物类型,以观看精美的新仪表板。

The README.md from OrleansDashboard covers the setup very well. Since it’s so short and sweet, here are the basic steps:

OrleansDashboard的README.md很好地涵盖了设置。 由于它又短又可爱,因此以下是基本步骤:

  • Add the OrleansDashboard package to our Kritner.OrleansGettingStarted.SiloHost project.

    OrleansDashboard包添加到我们的Kritner.OrleansGettingStarted.SiloHost项目。

  • Add a new option to the ISiloHostBuilder configuration.

    ISiloHostBuilder配置添加一个新选项。

That’s it!

而已!

套件安装 (Package Installation)

Within the Kritner.OrleansGettingStarted.SiloHost project, add the following line (highlighted)

Kritner.OrleansGettingStarted.SiloHost项目中,添加以下行(突出显示)

配置SiloHostBuilder (Configure SiloHostBuilder)

Again within the SiloHost project, modify the ISiloHostBuilder to have the following line prior to Build():

在SiloHost项目中,再次将ISiloHostBuilder修改为在Build()之前添加以下行:

.UseDashboard(options => { })

Should look like:

应该看起来像:

There are a few configuration options we could make use of, but for simplicity, let’s just see what we have right now.

我们可以使用一些配置选项,但是为了简单起见,让我们看看我们现在拥有什么。

开火 (Firing it up)

The only thing we need to do now is start up the SiloHost, and navigate to the default URL of localhost:8080. We’ll start the SiloHost as normal, by navigating to the SiloHost folder in a command prompt, and running dotnet run. Next navigate to http://localhost:8080. We should now be greeted with something like:

现在我们唯一需要做的就是启动SiloHost,并导航到默认URL localhost:8080 。 我们将正常启动SiloHost,方法是在命令提示符下导航到SiloHost文件夹,然后运行dotnet run 。 接下来导航到http:// localhost:8080。 现在,我们应该受到如下欢迎:

There’s a fair amount of information present on this, and the other pages that are provided in the OrleansDashboard. Additionally, the front end code is customizable so you could theoretically work in your own metrics. As you can see from the above, there are already some grains working their magic — new grains introduced by the dashboard itself.

关于此内容以及OrleansDashboard中提供的其他页面上有很多信息。 此外,前端代码是可定制的,因此理论上您可以按照自己的指标进行工作。 从上面可以看到,已经有一些谷物发挥其神奇作用-仪表板本身引入了新的谷物。

Currently CPU/Memory usage is not visible from the .net core implementation of Orleans. Hopefully something will be done to remedy that in the future? Perhaps it’s a limitation of the API available in netstandard?

当前,从Orleans的.net核心实现中看不到CPU /内存使用情况。 希望将来能做些什么来补救? 也许这是netstandard中可用API的限制?

炫耀更多谷物激活 (Showing off more grain activations)

This dashboard is great and all, but how do I see it in action? Rather, not the default grains action? Well that’s easy! We just need to run a few grains.

这个仪表板非常棒,但是我如何看待它呢? 而是不是默认的谷物动作? 好吧,这很容易! 我们只需要运行一些谷物。

I want to run a potentially large number of grains, perhaps the number of which is input by the user. To do that, I’m going to expand on the Polymorphism-based work we did in “Updating Orleans Project to be more ready for new Orleans Examples!”, by adding a new menu option.

我想运行大量的谷物,也许数量由用户输入。 为此,我将扩展在“ 更新奥尔良项目 ”中所做的基于多态性的工作, 以便为新的奥尔良示例做好准备! ”,添加新的菜单选项。

Note, I was having some trouble with my Client or Server getting or serving instances of grains. I have corrected this but will likely put in a GitHub issue and/or separate post to try to understand the reasoning behind it being an issue. The gist of the issue was code generation did not seem to be running on the silo builds for some reason, even though it did previously.
注意,我的客户端或服务器获取或提供谷物实例时遇到了一些麻烦。 我已更正此问题,但可能会在GitHub问题和/或单独发布文章,以试图了解其背后的原因。 问题的要点是由于某些原因,代码生成似乎没有在筒仓版本上运行,即使以前已经这样做了。

Anyway, onto the new IOrleansFunction:

无论如何,到新的IOrleansFunction

public class ShowoffDashboard : IOrleansFunction{ public string Description => "Starts new activations of several grains, as to show off the OrleansDashboard.";
public async Task PerformFunction(IClusterClient clusterClient) {  Console.WriteLine("How many activations would you like to do per grain? (100-500 perhaps?)");  var times = Console.ReadLine();
if (!int.TryParse(times, out var result))  {   Console.WriteLine("invalid input, returning to menu.");   ConsoleHelpers.ReturnToMenu();  }
Console.WriteLine($"About to start {result} instances of a grain.  Hold onto your butts.");  Console.WriteLine("Press any key to get started.");  Console.ReadKey();
for (int i = 0; i < result; i++)  {   var helloGrain = clusterClient.GetGrain<IHelloWorld>(    Guid.NewGuid()   );   await helloGrain.SayHello(i.ToString());
var statefulGrain = clusterClient.GetGrain<IVisitTracker>(    i.ToString()   );   await statefulGrain.Visit();  }
Console.WriteLine("All done!");  ConsoleHelpers.ReturnToMenu(); }}

In the above, we’re simply prompting the user for a number input. Then running our two implemented grains that many times. We should be able to demonstrate the dashboard picking up the grain activations quite easily using this new IOrleansFunction.

在上面,我们只是在提示用户输入数字。 然后多次运行我们的两个实现的谷物。 我们应该能够使用这个新的IOrleansFunction演示仪表盘很容易地获取谷物激活IOrleansFunction

It should look something like this when running:

运行时应该看起来像这样:

Code changes (though minimal from the previous post) can be found here: https://github.com/Kritner-Blogs/OrleansGettingStarted/releases/tag/v0.35.

可以在以下位置找到代码更改(尽管与以前的帖子相比很少): https : //github.com/Kritner-Blogs/OrleansGettingStarted/releases/tag/v0.35

Note that there are additional changes not covered in this post between v0.3 and v0.35 related to the grain generation not firing. I will (probably) have another post regarding that at some point.

请注意,在v0.3和v0.35之间,此帖子中未涉及与未生成谷物相关的其他更改。 在某个时候,我可能会再发表一篇文章。

Related:

有关:

翻译自: https://www.freecodecamp.org/news/microsoft-orleans-reporting-dashboard-16465d255199/

orleans

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值