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

Merged
merged 279 commits into from
Aug 10, 2024
Merged

V3 #114

merged 279 commits into from
Aug 10, 2024

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)

@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'

@followynne
Copy link
Member Author

@tterrag1098

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?

In Serilog.UI, there's the Web package and you load data using one of the provided providers packages (Mongo, SqlServer etc).

From Ildasm, I have your same situation:

.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
}

From the provided error, I think you're looking in the wrong direction using ildasm - I'd suggest the following:

  • close any IDE you have open
  • remove any bin/obj you have in your repository
  • do a clean restore and build of the project

Eventually, you should check yours .csproj for anything unexpected that could have been added automatically by an IDE.

If you don't solve the issue, can you provide me a NET6 sample project where you reproduce the issue? Without it, I won't be able to help you further.

Copy link
Member

@mo-esmp mo-esmp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @followynne and so sorry for the late review. You can consider my comments optional and ignore them. Later, we will discuss some matters and improve the project. Please update nuget packages to the latest version and comment codes inside code_quality.yml file.

src/Serilog.Ui.Core/OptionsBuilder/BaseDbOptions.cs Outdated Show resolved Hide resolved
src/Serilog.Ui.Core/OptionsBuilder/BaseDbOptions.cs Outdated Show resolved Hide resolved
src/Serilog.Ui.Core/Attributes/CodeColumnAttribute.cs Outdated Show resolved Hide resolved
src/Serilog.Ui.Core/OptionsBuilder/DbOptions.cs Outdated Show resolved Hide resolved
src/Serilog.Ui.Core/OptionsBuilder/ProvidersOptions.cs Outdated Show resolved Hide resolved
src/Serilog.Ui.Core/OptionsBuilder/ProvidersOptions.cs Outdated Show resolved Hide resolved
src/Serilog.Ui.Core/OptionsBuilder/RelationalDbOptions.cs Outdated Show resolved Hide resolved
src/Serilog.Ui.Core/OptionsBuilder/RelationalDbOptions.cs Outdated Show resolved Hide resolved
src/Serilog.Ui.Core/Serilog.Ui.Core.csproj Show resolved Hide resolved
@followynne
Copy link
Member Author

Thanks @followynne and so sorry for the late review. You can consider my comments optional and ignore them. Later, we will discuss some matters and improve the project. Please update nuget packages to the latest version and comment codes inside code_quality.yml file.

Hi @mo-esmp

sorry for the late answer, had some busy weeks and didn't find the time to check earlier 😿
Thanks a lot for all the comments and the review, I appreciate it a lot!

I'll review them in those days and comment on any conversation, if I have doubts 😄

Then I'll give a check to issue #122, before merging the work.

About the SQL Lite PR, I'll do a review after we merge v3, to release it as a new provider from v3 onwards ;)

(ps just as an info, I have no rights to release RavenDB package, in case I'll ask you help 👍 )

@followynne followynne merged commit 39d8083 into serilog-contrib:master Aug 10, 2024
3 checks passed
@followynne followynne deleted the feat/react-ui-interface branch August 12, 2024 09:29
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