diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index cafe478..0b93783 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -22,7 +22,7 @@ jobs: - name: Build run: dotnet build --configuration Release --no-restore - name: Pack - run: dotnet pack src/MiniProfiler.Elasticsearch/MiniProfiler.Elasticsearch.csproj --configuration Release --include-symbols --no-build + run: dotnet pack src/MiniProfiler.OpenSearch/MiniProfiler.OpenSearch.csproj --configuration Release --include-symbols --no-build - name: Test run: dotnet test --configuration Release --no-build /p:CollectCoverage=true /p:CoverletOutputFormat=opencover - name: Coverage diff --git a/LICENSE.md b/LICENSE.md index 6584c29..8ed7e2e 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -1,6 +1,6 @@ -The MIT License (MIT) +The MIT License (MIT) -Copyright (c) 2022 Raman Paulau +Copyright (c) 2022 Paweł Madurski Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/MiniProfiler.Elasticsearch.sln b/MiniProfiler.OpenSearch.sln similarity index 88% rename from MiniProfiler.Elasticsearch.sln rename to MiniProfiler.OpenSearch.sln index 6427229..cfeb8a7 100644 --- a/MiniProfiler.Elasticsearch.sln +++ b/MiniProfiler.OpenSearch.sln @@ -3,7 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 16 VisualStudioVersion = 16.0.31019.35 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MiniProfiler.Elasticsearch", "src\MiniProfiler.Elasticsearch\MiniProfiler.Elasticsearch.csproj", "{618356CB-5D70-48F3-8B1B-6DA56120E3AC}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MiniProfiler.OpenSearch", "src\MiniProfiler.OpenSearch\MiniProfiler.OpenSearch.csproj", "{618356CB-5D70-48F3-8B1B-6DA56120E3AC}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "global", "global", "{8991B302-DBA8-4CF8-88D2-5B276C9B37CB}" ProjectSection(SolutionItems) = preProject @@ -23,11 +23,11 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{16FF3561-A01 EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "samples", "samples", "{F57D62CB-485F-4E7A-9A23-8165941D5F41}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Sample.Elasticsearch.Core", "samples\Sample.Elasticsearch.Core\Sample.Elasticsearch.Core.csproj", "{275500BB-7676-4B66-93E3-422EF42A4678}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Sample.OpenSearch.Core", "samples\Sample.Opensearch.Core\Sample.OpenSearch.Core.csproj", "{275500BB-7676-4B66-93E3-422EF42A4678}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{C0A0C99B-744D-4C56-A53E-E22C51137ADF}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MiniProfiler.Elasticsearch.Tests", "tests\MiniProfiler.Elasticsearch.Tests\MiniProfiler.Elasticsearch.Tests.csproj", "{2CD0A79C-D950-44AE-BBEA-ACCD50BEF00E}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MiniProfiler.OpenSearch.Tests", "tests\MiniProfiler.OpenSearch.Tests\MiniProfiler.OpenSearch.Tests.csproj", "{2CD0A79C-D950-44AE-BBEA-ACCD50BEF00E}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".github", ".github", "{0A8BCF98-DC77-4CE9-B60B-3760D80E2955}" EndProject diff --git a/README.md b/README.md index 972a023..2004fe5 100644 --- a/README.md +++ b/README.md @@ -1,38 +1,41 @@ -# MiniProfiler.Elasticsearch -Put your [Elasticsearch.Net and NEST](https://github.com/elastic/elasticsearch-net) requests timings directly into [MiniProfiler](https://github.com/MiniProfiler/dotnet). +# MiniProfiler.OpenSearch -[![Build status](https://ci.appveyor.com/api/projects/status/m15gemuqkcs1rbv4/branch/main?svg=true)](https://ci.appveyor.com/project/romansp/miniprofiler-elasticsearch/branch/main) [![Nuget feed](https://img.shields.io/nuget/vpre/MiniProfiler.Elasticsearch.svg)](https://www.nuget.org/packages/MiniProfiler.Elasticsearch) +*** This project has been forked from https://github.com/romansp/MiniProfiler.Elasticsearch and compiled against OpenSearch *** -![profiler-popup](https://user-images.githubusercontent.com/3474842/30780873-de83efd8-a11d-11e7-8735-49dea4a1d4f1.png) -![profiler-queries](https://user-images.githubusercontent.com/3474842/30780952-edf8adea-a11e-11e7-8d64-c65331f389bf.png) +Put your [OpenSearch.Net and OpencSearch.Client](https://github.com/opensearch-project/opensearch-net) requests timings directly into [MiniProfiler](https://github.com/MiniProfiler/dotnet). + +[![Build status](https://ci.appveyor.com/api/projects/status/e9axfh54cvn3qqti/branch/main?svg=true)](https://ci.appveyor.com/project/pawel-madurski/miniprofiler-opensearch/branch/main) +![Nuget](https://img.shields.io/nuget/v/DexxLab.MiniProfiler.OpenSearch) + +![image](https://github.com/pawel-madurski/MiniProfiler.OpenSearch/assets/11866857/74293aab-6ad3-4ee1-8014-908d831b9646) ## Usage -You have two options on how to start profiling your Elastic requests. +You have two options on how to start profiling your OpenSearch requests. ### Option 1. Register in services collection -In your `Startup.cs`, call `AddElastic()`: +In your `Startup.cs`, call `AddOpenSearch()`: ```c# public void ConfigureServices(IServiceCollection services) { services.AddMiniProfiler(options => { - options.ExcludeElasticAssemblies(); + options.ExcludeOpenSearchAssemblies(); }) - .AddElastic(); + .AddOpenSearch(); } ``` ### Option 2. Create profiled client manually -Update usages of `ElasticClient` or `ElasticLowLevelClient` with their respected profiled version `ProfiledElasticClient` or `ProfiledElasticLowLevelClient`. +Update usages of `OpenSearchClient` or `OpenSearchLowLevelClient` with their respected profiled version `ProfiledOpenSearchClient` or `ProfiledOpenSearchLowLevelClient`. ```c# -services.AddSingleton(x => +services.AddSingleton(x => { var node = new Uri("http://localhost:9200"); - var connectionSettings = new ConnectionSettings(node).DefaultIndex("elasticsearch-sample"); - return new ProfiledElasticClient(connectionSettings); + var connectionSettings = new ConnectionSettings(node).DefaultIndex("opensearch-sample"); + return new ProfiledOpenSearchClient(connectionSettings); }); ``` ## Sample -See [Sample.Elasticsearch.Core](https://github.com/romansp/MiniProfiler.Elasticsearch/tree/main/samples/Sample.Elasticsearch.Core) for working example. +See [Sample.OpenSearch.Core](https://github.com/pawel-madurski/MiniProfiler.OpenSearch/tree/main/samples/Sample.OpenSearch.Core) for working example. diff --git a/appveyor.yml b/appveyor.yml index c23ead2..6076579 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -10,7 +10,7 @@ nuget: before_build: - cmd: nuget restore build: - project: MiniProfiler.Elasticsearch.sln + project: MiniProfiler.OpenSearch.sln verbosity: minimal publish_nuget: true publish_nuget_symbols: true diff --git a/samples/Sample.Elasticsearch.Core/Controllers/HomeController.cs b/samples/Sample.Opensearch.Core/Controllers/HomeController.cs similarity index 88% rename from samples/Sample.Elasticsearch.Core/Controllers/HomeController.cs rename to samples/Sample.Opensearch.Core/Controllers/HomeController.cs index 12831ac..bef5aba 100644 --- a/samples/Sample.Elasticsearch.Core/Controllers/HomeController.cs +++ b/samples/Sample.Opensearch.Core/Controllers/HomeController.cs @@ -1,15 +1,15 @@ using Microsoft.AspNetCore.Mvc; -using Nest; +using OpenSearch.Client; using StackExchange.Profiling; -namespace Sample.Elasticsearch.Core.Controllers; +namespace Sample.OpenSearch.Core.Controllers; public record Person(string Id, string FirstName, string LastName); public class HomeController : Controller { - private readonly IElasticClient _client; + private readonly IOpenSearchClient _client; - public HomeController(IElasticClient client) { + public HomeController(IOpenSearchClient client) { _client = client; } diff --git a/samples/Sample.Elasticsearch.Core/Program.cs b/samples/Sample.Opensearch.Core/Program.cs similarity index 69% rename from samples/Sample.Elasticsearch.Core/Program.cs rename to samples/Sample.Opensearch.Core/Program.cs index 96b2196..da52745 100644 --- a/samples/Sample.Elasticsearch.Core/Program.cs +++ b/samples/Sample.Opensearch.Core/Program.cs @@ -1,15 +1,15 @@ -using Nest; +using OpenSearch.Client; using StackExchange.Profiling; var builder = WebApplication.CreateBuilder(args); var services = builder.Services; services.AddControllersWithViews(); -services.AddMiniProfiler(options => options.ExcludeElasticAssemblies()).AddElastic(); -services.AddSingleton(_ => { +services.AddMiniProfiler(options => options.ExcludeOpenSearchAssemblies()).AddOpenSearch(); +services.AddSingleton(_ => { var node = new Uri("http://localhost:9200"); - var connectionSettings = new ConnectionSettings(node).DefaultIndex("elasticsearch-sample"); - return new ElasticClient(connectionSettings); + var connectionSettings = new ConnectionSettings(node).DefaultIndex("opensearch-sample"); + return new OpenSearchClient(connectionSettings); }); services.Configure(options => { diff --git a/samples/Sample.Elasticsearch.Core/Properties/launchSettings.json b/samples/Sample.Opensearch.Core/Properties/launchSettings.json similarity index 94% rename from samples/Sample.Elasticsearch.Core/Properties/launchSettings.json rename to samples/Sample.Opensearch.Core/Properties/launchSettings.json index bb092fa..a716df8 100644 --- a/samples/Sample.Elasticsearch.Core/Properties/launchSettings.json +++ b/samples/Sample.Opensearch.Core/Properties/launchSettings.json @@ -8,7 +8,7 @@ } }, "profiles": { - "Sample.Elasticsearch.Core._6": { + "Sample.OpenSearch.Core._6": { "commandName": "Project", "dotnetRunMessages": true, "launchBrowser": true, diff --git a/samples/Sample.Elasticsearch.Core/Sample.Elasticsearch.Core.csproj b/samples/Sample.Opensearch.Core/Sample.OpenSearch.Core.csproj similarity index 60% rename from samples/Sample.Elasticsearch.Core/Sample.Elasticsearch.Core.csproj rename to samples/Sample.Opensearch.Core/Sample.OpenSearch.Core.csproj index f08cd5d..6ebfae1 100644 --- a/samples/Sample.Elasticsearch.Core/Sample.Elasticsearch.Core.csproj +++ b/samples/Sample.Opensearch.Core/Sample.OpenSearch.Core.csproj @@ -4,17 +4,17 @@ net6.0 enable enable - Sample.Elasticsearch.Core + Sample.Opensearch.Core - + - + diff --git a/samples/Sample.Elasticsearch.Core/Views/Home/Index.cshtml b/samples/Sample.Opensearch.Core/Views/Home/Index.cshtml similarity index 100% rename from samples/Sample.Elasticsearch.Core/Views/Home/Index.cshtml rename to samples/Sample.Opensearch.Core/Views/Home/Index.cshtml diff --git a/samples/Sample.Elasticsearch.Core/Views/Shared/_Layout.cshtml b/samples/Sample.Opensearch.Core/Views/Shared/_Layout.cshtml similarity index 94% rename from samples/Sample.Elasticsearch.Core/Views/Shared/_Layout.cshtml rename to samples/Sample.Opensearch.Core/Views/Shared/_Layout.cshtml index a360b7d..8b64b67 100644 --- a/samples/Sample.Elasticsearch.Core/Views/Shared/_Layout.cshtml +++ b/samples/Sample.Opensearch.Core/Views/Shared/_Layout.cshtml @@ -3,7 +3,7 @@ - @ViewData["Title"] - Sample.Elasticsearch.Core + @ViewData["Title"] - Sample.OpenSearch.Core @@ -21,7 +21,7 @@