Skip to content

Instantly share code, notes, and snippets.

@MeladKamari
MeladKamari / SlowQueryInterceptor.cs
Created January 11, 2024 22:04
SlowQueryInterceptor
public class SlowQueryInterceptor : IDbCommandInterceptor
{
private const int SlowQueryThreshold = 200; // milliSecond
public DbDataReader ReaderExecuted(
DbCommand command,
CommandExecutedEventData eventData,
DbDataReader result)
{
if (!(eventData.Duration.TotalMilliseconds > SlowQueryThreshold)) return result;
var factory = eventData.Context!.Database.GetService<ILoggerFactory>();
@MeladKamari
MeladKamari / docker-compose.yml
Created August 12, 2022 10:46
Elasticsearch docker compose
version: '3.3'
services:
elasticsearch:
image: elasticsearch:7.14.2
container_name: elasticsearch
environment:
- discovery.type=single-node
ulimits:
memlock:
soft: -1