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

V3 #114

Open
wants to merge 263 commits into
base: master
Choose a base branch
from
Open

Conversation

followynne
Copy link
Member

@followynne followynne commented Feb 21, 2024

UI v3!

What to expect in the new UI:

  • a complete restyle of the page
  • mobile/desktop mode! Mobile version shows logs as cards and have a different way of exposing filters/buttons etc
  • show dates in UTC or browser-local conversion
  • light/dark mode
  • sorting logs!
  • filter to seconds Missing seconds  #69
  • a new modal to manage Basic Authorization

What to expect in the Backend:

  • additional columns support (supported sinks: MsSql, MariaDb, PostgreSql)
  • all providers support multiple registration
  • sink registration refactor towards Fluent interface
  • additional UI options
  • option to customize the Provider name (fixes Support provider name customization #119 )

Breaking changes

  • minimum supported .NET version => 6.0
  • IDataProvider public API parameters changed (to support future developments)
  • Home path lands on {ui-path}/ instead of {ui-path}/index.html [which redirects to {ui-path}/]. It helps to implement routing on client-app side
  • namespaces updated to match repository structure
  • all sinks extensions method and UseSerilogUi work through Fluent Interface
  • Authorization filters
    • existing interfaces and filters were moved to different namespace
    • changed contract: HttpContext isn't passed to the Authorize methods but it can be accessed using IHttpContextAccessor interface
    • how we register filters (from new/options list to DI, check below)

New features - BE

Sort option

The user can now sort the search by: timestamp | message | level
with direction ASC | DESC

Known limitation: ElasticSearch provider has a fixed sort by timestamp, due to the sink indexes limitation.

Authorization filters

Registration is now managed by DI; there are some new extensions method that take a T implementation of filter and register it as scoped [example: src/Serilog.Ui.Core/Extensions/SerilogUiOptionsBuilderExtensions.cs].

Added a new AuthorizationFilter: PolicyAuthorizationFilter, that check authorization based on a registered policy

MySql/MariaDB

Split provider registration in 2 extension methods, to better help user the end user choose the correct provider based on the used sink.

Refactor

  • used new C# features (example: primary constructors)
  • added Obsolete on PostgresSql sink option, as the Alternative sink is actively maintained and should be the preferred option
  • moved UiOptions extensions to correct file
  • tests: all integration Provider tests use the Provider's sink! (Insert log test data through sinks #86)

Bugfix

  • replace Mysql.Data with MySqlConnector, to fix query error on old MariaDb server versions (fixes Fails to insert data into MariaDB #113)
  • providers return UTC timestamp to help the UI better render timestamps and change the visualization between utc and local
  • replaced .nuspec files with properties set on .csproj and directory.build.props (Nuget wasn't taking the nuspec info correctly)

@followynne followynne marked this pull request as ready for review May 11, 2024 10:46
@followynne
Copy link
Member Author

Hey @mo-esmp

after a long development, I finally completed the work on the UI v3 version and I'm happy to show the results 😄

The PR became, well... enormous, I know, but it's mainly because I tried to refactor everything useful for the future and there are lots of files deleted/removed 😸

In the PR description, I added all details about it. One of the main topic is the Additional Columns feature, I described it here 😃
To give you a way to navigate the PR, you'll see that the changes can be mainly grouped as:

  • core: I changed the public API to receive a class parameter (with this change, any future extra filter won't break anymore the API) and moved there the IAuthorization interfaces, to offer them as part of the "Core" library
  • providers packages: the main changes are in the extensions methods, that now works only by Fluent Interface (again, to provide a stable public API and make any configuration available through fluent methods...)
  • web: UI options are now registered via Fluent Interface and the old FE application has been replaced by the new React one! ❤️
  • tests: I moved all integration tests to use the sink they're based on ;)
  • samples: I removed the old sample and replaced it with 2 new ones

If you're curious, code coverage will be up to a minimum of 90 %, both BE and FE 👍

BE results FE results

In the wiki, I wrote already all the required pages/info, you can check them starting from here

If you want to test it out-of-the-box, you'll only need to checkout my branch and launch WebApp project - you'll have everything up-and-running without any setup at all!! [I wrote details here]
If you want to test the Additional Columns feature, you need to run Docker and then run WebApi project - they're configured there 😄

I already published an alpha version of all packages (except RavenDB, because I'm not an owner) and used them in the repository samples! 🛩️

Anyway... I hope you'll like the changes; I'm really happy to hear back from you any feedback, suggestion, doubt, anything that we can change/redo/rework.

This was a first finale version of the v3 but I'm 100% open to work on it to improve even further based on your suggestions 😄

@followynne followynne requested a review from mo-esmp May 11, 2024 10:51
@followynne followynne changed the title V3 - Main Development V3 May 12, 2024
@mo-esmp
Copy link
Member

mo-esmp commented May 12, 2024

Hi Matt,

I wanted to thank you for all the time and effort you put into v3. As it is a significant PR, I won't be checking the code style or minor details. Instead, I will do some manual testing and approve the PR. Later on, I will go through each project carefully and address issues such as code style and start to improve the projects together.

Thank you again for your hard work.

@followynne
Copy link
Member Author

Update:

implemented #119 in 3.0.0-alpha.v2

@tterrag1098
Copy link

I'm attempting to test the 3.x alpha versions in my project that currently uses v2, but I'm running into issues building where it looks like the Serilog.Ui.Web dll file is referencing assemblies that are not pulled in by nuget, specifically System.Text.Json 8.0.0.0 and Microsoft.Extensions.DependencyInjection.Abstractions 8.0.0.0, see the following info I got from ildasm

.assembly extern Microsoft.Extensions.DependencyInjection.Abstractions
{
  .publickeytoken = (AD B9 79 38 29 DD AE 60 )                         // ..y8)..`
  .ver 8:0:0:0
}
.assembly extern System.Text.Json
{
  .publickeytoken = (CC 7B 13 FF CD 2D DD 51 )                         // .{...-.Q
  .ver 8:0:0:0
}

I am using the net6.0 version if that matters. Any ideas what's going on here?

@followynne
Copy link
Member Author

followynne commented Jun 1, 2024

Hey @tterrag1098

Thanks a lot for testing!

I checked those packages and they target from NET6 onwards, thus they should be fine.
In the Nuget viewer, vrs 2.6.0 references for both packages vers 7.0.0 on all target frameworks (the same as 8.0.0 does today)

If you comment any serilog-ui setup code, does the project compile or it still fails to restore the dlls?

(EDIT: another guess that came to my mind is about mismatching versions of the same assembly, you could check if those two dlls are included from other packages)

EDIT2: (on a similar topic, not sure if it could help: dotnet/runtime#93780)

Can I ask you, when you have time, to try the following:

  • clone the PR branch and try out sample WebApp, which doesn't have any setup requirement, setting the target framework to NET6
  • create a clean C# NET8 project and test the alpha version
  • create a clean C# NET6 project and test the alpha version

I want to understand if it happens on the samples/clean projects or if it is an issue with migrating the project (or the nuget local cache)...
If you don't have time, I'll try it out those days. 😊

@followynne
Copy link
Member Author

I'm attempting to test the 3.x alpha versions in my project that currently uses v2, but I'm running into issues building where it looks like the Serilog.Ui.Web dll file is referencing assemblies that are not pulled in by nuget, specifically System.Text.Json 8.0.0.0 and Microsoft.Extensions.DependencyInjection.Abstractions 8.0.0.0, see the following info I got from ildasm

.assembly extern Microsoft.Extensions.DependencyInjection.Abstractions
{
  .publickeytoken = (AD B9 79 38 29 DD AE 60 )                         // ..y8)..`
  .ver 8:0:0:0
}
.assembly extern System.Text.Json
{
  .publickeytoken = (CC 7B 13 FF CD 2D DD 51 )                         // .{...-.Q
  .ver 8:0:0:0
}

I am using the net6.0 version if that matters. Any ideas what's going on here?

@tterrag1098: a small update, I tried running the repository sample and a new clean project targeting NET6 and they both worked. Can you kindly let me know if the issue still occurs and add any additional detail on which provider are you using?

@tterrag1098
Copy link

I'm not sure what you're referring to by "provider", but it's a VS solution with quite a few dependencies. However I've looked through the entire manifest and nothing directly refers to these versions of Json/DI. Can you use ildasm on the dlls you have and see if these extern entries exist there too?

@tterrag1098
Copy link

This is the specific error I get from CSC:

Error CS1705 Assembly 'Serilog.Ui.Web' with identity 'Serilog.Ui.Web, Version=3.0.0.0, Culture=neutral, PublicKeyToken=null' uses 'Microsoft.Extensions.DependencyInjection.Abstractions, Version=8.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60' which has a higher version than referenced assembly 'Microsoft.Extensions.DependencyInjection.Abstractions' with identity 'Microsoft.Extensions.DependencyInjection.Abstractions, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants