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

Adding support to RavenDB 4.1 storage for MiniProfiler #483

Merged
merged 20 commits into from
May 25, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,14 @@ jobs:
POSTGRES_PASSWORD: postgres
POSTGRES_DB: test
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
ravendb:
image: ravendb/ravendb
ports:
- 8080/tcp
env:
RAVEN_ARGS: '--Setup.Mode=None'
RAVEN_License_Eula_Accepted: 'true'
RAVEN_Security_UnsecuredAccessAllowed: 'PrivateNetwork'
sqlserver:
image: mcr.microsoft.com/mssql/server:2017-latest-ubuntu
ports:
Expand Down Expand Up @@ -61,6 +69,8 @@ jobs:
MongoDbConnectionString: mongodb://localhost:${{ job.services.mongo.ports[27017] }}/test
MySQLConnectionString: server=localhost;Port=${{ job.services.mysql.ports[3306] }};Uid=root;Pwd=root;Database=test;Allow User Variables=true
PostgreSqlConnectionString: Server=localhost;Port=${{ job.services.postgres.ports[5432] }};Database=test;User Id=postgres;Password=postgres;
RavenDbUrls: http://localhost:${{ job.services.ravendb.ports[8080] }}
RavenDatabase: test
SQLServerConnectionString: Server=tcp:127.0.0.1,${{ job.services.sqlserver.ports[1433] }};Database=tempdb;User Id=sa;Password=g0d4mm!tSQLServer;
- name: .NET Lib Pack
run: dotnet pack Build.csproj --no-build -c Release /p:PackageOutputPath=%CD%\.nupkgs /p:CI=true
3 changes: 2 additions & 1 deletion MiniProfiler.sln
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{33644D67-D9BB-4989-9B7A-98D51967059B}"
ProjectSection(SolutionItems) = preProject
tests\Directory.Build.props = tests\Directory.Build.props
tests\docker-compose.yml = tests\docker-compose.yml
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "samples", "samples", "{E0DA4035-4D64-4BB8-8EA1-42197DE62519}"
Expand Down Expand Up @@ -244,8 +245,8 @@ Global
{A14EA029-60E2-485A-B757-3626511CF2C4} = {5C8ED0C0-7DBB-4660-836E-A760E25160A0}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
LessCompiler = 6a2b5b70-1c32-482f-b5c6-0597e2d4e376
SolutionGuid = {9373F37A-A996-4545-A251-1902C8886E3F}
LessCompiler = 6a2b5b70-1c32-482f-b5c6-0597e2d4e376
EndGlobalSection
GlobalSection(TestCaseManagementSettings) = postSolution
CategoryFile = StackExchange.Profiling.vsmdi
Expand Down
5 changes: 3 additions & 2 deletions docs/Releases.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@ This page tracks major changes included in any update starting with version 4.0.

#### Version 4.2.0 (In preview)
- **New**:
- Added RavenDB Storage provider ([#483](https://github.com/MiniProfiler/dotnet/pull/483) - thanks [@lillo42](https://github.com/lillo42)!)
- Added `<script nonce="..." />` to rendering for CSP support ([#465](https://github.com/MiniProfiler/dotnet/pull/465))
- Added dark and "auto" (system preference decides) color themes, total is "Light", "Dark", and "Auto" ([#451](https://github.com/MiniProfiler/dotnet/pull/451))
- Generally moves to CSS 3 variables, for easier custom themes as well ([#451](https://github.com/MiniProfiler/dotnet/pull/451))
- Added `SqlServerFormatter.IncludeParameterValues` for excluding actual values in output if desired ([#463](https://github.com/MiniProfiler/dotnet/pull/463))
- New "debug" mode (via `.EnableDebugMode`) that outputs stack dumps for every timing (expensive/heavy, and not intended for normal operation - [#482](https://github.com/MiniProfiler/dotnet/pull/482))
- Added "debug" mode (via `.EnableDebugMode`) that outputs stack dumps for every timing (expensive/heavy, and not intended for normal operation - [#482](https://github.com/MiniProfiler/dotnet/pull/482))
- (**.NET Core only**) Added `MiniProfilerOptions.ResultsAuthorizeAsync` and `MiniProfiler.ResultsAuthorizeListAsync` ([#472](https://github.com/MiniProfiler/dotnet/pull/472))
- (**.NET Core only**) Added profiling to all diagnostic events (views, filters, etc. - [#475](https://github.com/MiniProfiler/dotnet/pull/475) & [#482](https://github.com/MiniProfiler/dotnet/pull/482))
- New options around this are in the ASP.NET Core docs on the left.
Expand All @@ -21,7 +22,7 @@ This page tracks major changes included in any update starting with version 4.0.
- (**Major**) Drops IE 11 support
- Fix for missing `IMemoryCache` depending on config ([#440](https://github.com/MiniProfiler/dotnet/pull/440))
- MySQL Storage:
- Updates `MySqlConnector` to 0.60.1 for misc fixes ([#432](https://github.com/MiniProfiler/dotnet/pull/432)) (thanks [@bgrainger](https://github.com/bgrainger)!)
- Updates `MySqlConnector` to 0.60.1 for misc fixes ([#432](https://github.com/MiniProfiler/dotnet/pull/432) - thanks [@bgrainger](https://github.com/bgrainger)!)
- Redis Storage
- Moves from `StackExchange.Redis.StrongName` to `StackExchange.Redis` 2.1.30 ([#473](https://github.com/MiniProfiler/dotnet/pull/473))

Expand Down
32 changes: 32 additions & 0 deletions src/MiniProfiler.Providers.RavenDB/Internal/Indexes.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
using System.Linq;
using Raven.Client.Documents.Indexes;

namespace StackExchange.Profiling.Storage.Internal
{
/// <summary>
/// The MiniProfiler index by user for has viewed
/// </summary>
internal class Index_ByHasUserViewedAndUser : AbstractIndexCreationTask<MiniProfilerDoc>
{
public Index_ByHasUserViewedAndUser() =>
Map = docs => from profiler in docs select new { profiler.HasUserViewed, profiler.User };
}

/// <summary>
/// The MiniProfiler index by profiler Id
/// </summary>
internal class Index_ByProfilerId : AbstractIndexCreationTask<MiniProfilerDoc>
{
public Index_ByProfilerId() =>
Map = docs => from profiler in docs select new { profiler.ProfilerId };
}

/// <summary>
/// The MiniProfiler index by start time
/// </summary>
internal class Index_ByStarted : AbstractIndexCreationTask<MiniProfilerDoc>
{
public Index_ByStarted() =>
Map = docs => from profiler in docs select new { profiler.Started };
}
}
55 changes: 55 additions & 0 deletions src/MiniProfiler.Providers.RavenDB/Internal/MiniProfilerDoc.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
using System;
using System.Collections.Generic;

namespace StackExchange.Profiling.Storage.Internal
{
internal class MiniProfilerDoc
{
public string Id { get; set; }
public Guid ProfilerId { get; set; }
public string Name { get; set; }
public DateTime Started { get; set; }
public decimal DurationMilliseconds { get; set; }
public string MachineName { get; set; }
public Dictionary<string, string> CustomLinks { get; set; }
public string CustomLinksJson { get; set; }
public Timing Root { get; set; }
public ClientTimings ClientTimings { get; set; }
public string User { get; set; }
public bool HasUserViewed { get; set; }

public MiniProfilerDoc() { }

public MiniProfilerDoc(MiniProfiler profiler)
{
ProfilerId = profiler.Id;
Name = profiler.Name;
Started = profiler.Started;
DurationMilliseconds = profiler.DurationMilliseconds;
MachineName = profiler.MachineName;
CustomLinks = profiler.CustomLinks;
CustomLinksJson = profiler.CustomLinksJson;
Root = profiler.Root;
ClientTimings = profiler.ClientTimings;
User = profiler.User;
HasUserViewed = profiler.HasUserViewed;
}

#pragma warning disable CS0618 // Type or member is obsolete (MiniProfiler serialization constructor)
public MiniProfiler ToMiniProfiler() => new MiniProfiler
{
Id = ProfilerId,
Name = Name,
Started = Started,
DurationMilliseconds = DurationMilliseconds,
MachineName = MachineName,
CustomLinks = CustomLinks,
CustomLinksJson = CustomLinksJson,
Root = Root,
ClientTimings = ClientTimings,
User = User,
HasUserViewed = HasUserViewed
};
#pragma warning restore CS0618 // Type or member is obsolete (MiniProfiler serialization constructor)
}
}
80 changes: 0 additions & 80 deletions src/MiniProfiler.Providers.RavenDB/JsonFormatter.cs

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
<PropertyGroup>
<AssemblyName>MiniProfiler.Providers.RavenDB</AssemblyName>
<Title>MiniProfiler for RavenDB</Title>
<Description>MiniProfiler: Profilers for RavenDB</Description>
<Authors>Marc Gravell, Jarrod Dixon, Yaakov Ellis, Nick Craver</Authors>
<Description>MiniProfiler: Profiler storage for RavenDB</Description>
<Authors>Rafael Lillo, Nick Craver</Authors>
<PackageTags>Raven;RavenDB;$(PackageBaseTags)</PackageTags>
<SignAssembly>false</SignAssembly>
<TargetFrameworks>net461;netstandard2.0</TargetFrameworks>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\MiniProfiler.Shared\MiniProfiler.Shared.csproj" />
<PackageReference Include="RavenDB.Client" Version="3.5.4" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
<PackageReference Include="RavenDB.Client" Version="4.2.102" />
</ItemGroup>
</Project>
18 changes: 0 additions & 18 deletions src/MiniProfiler.Providers.RavenDB/README.md

This file was deleted.

Loading