Application Insights Module, HeadMeta zone alternate - This week in Orchard (11/04/2021)

Gábor Domonkos's avatar
Admin UI, Background task, This week in Orchard

The Application Insight module is now available for Orchard Core too! Check out our current post for tons of updates like the new HeadMeta zone alternate, the now() helper function in SQL Queries and many more!

Orchard Core updates

Support for now() helper function in SQL Queries

If you do a query like this in the generic SQL language we support, this will be mapped to whatever database are you using. As you can see, if you are using the new now() helper function, you can get the current date and time. Check out the where condition of the query below: where the PublishedUtc value of the published BlogPost content types is bigger than the current date and time.

Exampe of using the now helper

Add HeadMeta zone alternate for layer widget wrapper

When rendering resources using Layers in the HeadMeta zone the widget wrapper is applied, which makes for illegal HTML code inside the <head> of the webpage. Of course, you can render resources in the Content zone, but then you just end up with an empty widget wrapper. Which also makes no sense.

The solution is to in the list of layer zones, also include a list of Zones which do not wrap with the widget wrapper.

This is useful for other scenarios where the extra divs added by the widget wrapper are not wanted. Here you can see the two now Liquid templates for the Agency and the Blog theme, and the Razor one for the default TheTheme.

Add HeadMeta zone alternate

Fix migrations from RC2 to the latest dev

Dean Marcussen did some tests to validate that we can migrate easily without any issue from the RC2 release to the 1.0 release. The idea being is if you are using the RC2 release of Orchard Core and you want to migrate to 1.0, then there won't be any exception or database conflicts or whatever. This mainly means new or updated migration steps for the modules, or move something to a feature, or the migration dependencies are not ordered correctly.

Fix migrations to the latest dev

BackgroundTask Atomicity

You could see a demo in this This week in Orchard post about workflows atomicity. Now here comes a continuation of that feature, the BackgroundTask Atomicity. In a nutshell, it means some additional settings like:

  • Configurable per IBackgroundTask through a LockTimeout and an auto LockExpiration in milliseconds, by default, there are equal to 0 and in that case, it works as before without any locking.
  • Configurable by code through the background task attribute.
  • Or through the admin UI by enabling the existing OrchardCore.BackgroundTasks feature.

Right now we have just implemented the IBackgroundTask interface and navigated to Configuration -> Tasks -> Background Tasks and hit the Edit button near the new background task that appears in the list. And in the Advanced tab of that background task, you can set the lock timeout and lock expiration values. Note that you need to enable the BackgroundTasks feature.

Edit Background Task settings

Arrows for collapsible panels

It's a minor change but fixes like this one make the admin UI of Orchard Core more consistent for the users who can access the admin panel. We have different collapsible panels in Orchard Core and the arrows were not consistent in any cases. Now, if you have a Bag Part attached to your content item, the arrow near the collapsible section will be directed to the right by default. And if you open that section, the arrow will be head to down. So now we use the same kind of arrows (Right if collapsed, Down if expanded) for all collapsible panels in the admin. And this also supports Arabic and RTL languages, where we need to direct the arrow left if the panel is closed.

Consistent arrows in the collapsible sections

Demos

Azure Application Insights module

This Lombiq Hosting - Azure Application Insights Orchard Core module enables easy integration of Azure Application Insights telemetry into Orchard. Just install the module, configure the instrumentation key from a configuration source (like the appsettings.json file) as normally for AI, and collected data will start appearing in the Azure Portal.

Application Insights is an application performance monitoring tool. Withing Azure you can create such Application Insight resources and it will give you nice metrics and other data about your app that is running or production or staging or something. This is not for local but rather for seeing what happens in an application that is actually deployed somewhere.

The Readme.md file in the repository shows you how you can set up the module and do the basic configuration just by editing your appsettings.json file.

Setup and basic configuration of the Application Insight module

Let's say we have a site installed with the Blog recipe. If you add the module to your solution and enable it (Configuration -> Features -> Lombiq Hosting - Azure Application Insights) you can go to the configured corresponding Application Insights account and for example, check out the live metrics.

Or you can see what happened in a given request. You can see all the details correlated: the request, the page views, the dependency calls, everything. For example, you can see that there was a server-side request. The Item/Display action was called which actually returned you the content item that is the homepage. It happened on the development environment on the Default shell with the user named admin.

A request in Application Insights

If you would like to know more about this module, don't forget to head to the repository of the module and try out it now! And as always, here is a recording that you can check out anytime!

News from the community

Orchard Dojo Newsletter

Lombiq's Orchard Dojo Newsletter has 194 subscribers! We have started this newsletter to inform the community around Orchard with the latest news about the platform. By subscribing to this newsletter, you will get an e-mail whenever a new post published to Orchard Dojo, including This week in Orchard of course.

Do you know of other Orchard enthusiasts who you think would like to read our weekly articles? Tell them to subscribe here!

If you are interested in more news around Orchard and the details of the topics above, don't forget to check out the recording of this week's Orchard meeting!

No Comments

Add a Comment