Prometheus.EntityFramework 1.0.0

The owner has unlisted this package. This could mean that the package is deprecated, has security vulnerabilities or shouldn't be used anymore.
dotnet add package Prometheus.EntityFramework --version 1.0.0
NuGet\Install-Package Prometheus.EntityFramework -Version 1.0.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Prometheus.EntityFramework" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Prometheus.EntityFramework --version 1.0.0
#r "nuget: Prometheus.EntityFramework, 1.0.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Prometheus.EntityFramework as a Cake Addin
#addin nuget:?package=Prometheus.EntityFramework&version=1.0.0

// Install Prometheus.EntityFramework as a Cake Tool
#tool nuget:?package=Prometheus.EntityFramework&version=1.0.0

Prometheus Entity Framework

Why Just .NET Framework 4.6.1

Currently this package is only supported for .Net Framework 4.6.1 because of dependencies.

Dependency net40 net461 netcoreapp1.3 netcoreapp2.2
EF Interceptions TRUE TRUE FALSE FALSE
Prometheus.Client FALSE TRUE TRUE TRUE

Usage

  • Install and configure Prometheus.Client.Owin package.
  • Install this project package (Which is not available yet).
  • Create Interceptor options.
public class MyPrometheusInterceptorOptions : PrometheusInterceptorOptions
{
  public override bool ReaderNotLogged => true;

  public class MyPrometheusInterceptorOptions : PrometheusInterceptorOptions
  {
    public override void Executed<T>(DbCommand command,
      DbCommandInterceptionContext<T> interceptionContext,
      Stopwatch stopwatch,
      InterceptedMethod interceptedMethod)
    {
      var labels = new[] {"CommandText", "Database", "DataSource", "ExceptionOccured"};
      var values = new[] {command.CommandText, command.Connection.Database, command.Connection.DataSource, (interceptionContext.Exception != null).ToString() };
      Metrics.CreateGauge("LogName", "Log Help Text", labels)
        .Labels(values)
        .Set(stopwatch.ElapsedMilliseconds);
    }
  }
}
  • Create a DbConfiguration or update existing.
public class MyPrometheusDbConfiguration : DbConfiguration
{
  public MyPrometheusDbConfiguration()
  {
    AddInterceptor(new PrometheusDbCommandInterceptor(new MyPrometheusInterceptorOptions()));
  }
}
  • Use Configuration above DbContext
[DbConfigurationType(typeof(MyPrometheusDbConfiguration))]
public class MyDbContext : DbContext
{
  public MyDbContext(string name) : base(name) {}
  ...
}

Project Plan

  • Support .NET Framework
  • Support Customizable Metrics
  • Create Nuget package
  • Support .NET Core
  • Create Test Projects
  • Source Code Documentation
Product Compatible and additional computed target framework versions.
.NET Framework net461 is compatible.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated

Initialize package.