diff --git a/.github/workflows/cd-aspnetcore-abstractions.yml b/.github/workflows/cd-aspnetcore-abstractions.yml
new file mode 100644
index 0000000..323c00d
--- /dev/null
+++ b/.github/workflows/cd-aspnetcore-abstractions.yml
@@ -0,0 +1,43 @@
+name: Lib.AspNetCore.ServerTiming.Abstractions - CD
+on:
+ push:
+ tags:
+ - "aspnetcore-abstractions-v[0-9]+.[0-9]+.[0-9]+"
+jobs:
+ deployment:
+ runs-on: windows-latest
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v2
+ - name: Extract VERSION
+ run: echo "VERSION=${GITHUB_REF/refs\/tags\/aspnetcore-abstractions-v/}" >> $GITHUB_ENV
+ shell: bash
+ - name: Setup .NET Core 2.1 SDK
+ uses: actions/setup-dotnet@v1
+ with:
+ dotnet-version: '2.1.x'
+ - name: Setup .NET Core 3.1 SDK
+ uses: actions/setup-dotnet@v1
+ with:
+ dotnet-version: '3.1.x'
+ - name: Setup .NET 5.0 SDK
+ uses: actions/setup-dotnet@v1
+ with:
+ dotnet-version: '5.0.x'
+ - name: Setup .NET 6.0 SDK
+ uses: actions/setup-dotnet@v1
+ with:
+ dotnet-version: '6.0.x'
+ - name: Restore
+ run: dotnet restore
+ - name: Build
+ run: dotnet build --configuration Release --no-restore
+ - name: Test
+ run: dotnet test --configuration Release --no-build
+ - name: Pack
+ run: dotnet pack --configuration Release --no-build
+ - name: NuGet Push Lib.AspNetCore.ServerTiming.Abstractions
+ run: dotnet nuget push Lib.AspNetCore.ServerTiming.Abstractions/bin/Release/Lib.AspNetCore.ServerTiming.Abstractions.${VERSION}.nupkg --source https://api.nuget.org/v3/index.json --api-key ${NUGET_API_KEY}
+ shell: bash
+ env:
+ NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
\ No newline at end of file
diff --git a/.github/workflows/cd.yml b/.github/workflows/cd-aspnetcore.yml
similarity index 88%
rename from .github/workflows/cd.yml
rename to .github/workflows/cd-aspnetcore.yml
index 841e6ed..8c71912 100644
--- a/.github/workflows/cd.yml
+++ b/.github/workflows/cd-aspnetcore.yml
@@ -1,8 +1,8 @@
-name: CD
+name: Lib.AspNetCore.ServerTiming - CD
on:
push:
tags:
- - "v[0-9]+.[0-9]+.[0-9]+"
+ - "aspnetcore-v[0-9]+.[0-9]+.[0-9]+"
jobs:
deployment:
runs-on: windows-latest
@@ -10,7 +10,7 @@ jobs:
- name: Checkout
uses: actions/checkout@v2
- name: Extract VERSION
- run: echo "VERSION=${GITHUB_REF/refs\/tags\/v/}" >> $GITHUB_ENV
+ run: echo "VERSION=${GITHUB_REF/refs\/tags\/aspnetcore-v/}" >> $GITHUB_ENV
shell: bash
- name: Setup .NET Core 2.1 SDK
uses: actions/setup-dotnet@v1
diff --git a/DocFx.AspNetCore.ServerTiming/docfx.json b/DocFx.AspNetCore.ServerTiming/docfx.json
index 792ce7a..e339301 100644
--- a/DocFx.AspNetCore.ServerTiming/docfx.json
+++ b/DocFx.AspNetCore.ServerTiming/docfx.json
@@ -4,6 +4,7 @@
"src": [
{
"files": [
+ "Lib.AspNetCore.ServerTiming.Abstractions/Lib.AspNetCore.ServerTiming.Abstractions.csproj",
"Lib.AspNetCore.ServerTiming/Lib.AspNetCore.ServerTiming.csproj"
],
"exclude": [ "**/bin/**", "**/obj/**" ],
diff --git a/Lib.AspNetCore.ServerTiming/Filters/IServerTimingMetricFilter.cs b/Lib.AspNetCore.ServerTiming.Abstractions/Filters/IServerTimingMetricFilter.cs
similarity index 100%
rename from Lib.AspNetCore.ServerTiming/Filters/IServerTimingMetricFilter.cs
rename to Lib.AspNetCore.ServerTiming.Abstractions/Filters/IServerTimingMetricFilter.cs
diff --git a/Lib.AspNetCore.ServerTiming/Http/Headers/ServerTimingMetric.cs b/Lib.AspNetCore.ServerTiming.Abstractions/Http/Headers/ServerTimingMetric.cs
similarity index 100%
rename from Lib.AspNetCore.ServerTiming/Http/Headers/ServerTimingMetric.cs
rename to Lib.AspNetCore.ServerTiming.Abstractions/Http/Headers/ServerTimingMetric.cs
diff --git a/Lib.AspNetCore.ServerTiming/IServerTiming.cs b/Lib.AspNetCore.ServerTiming.Abstractions/IServerTiming.cs
similarity index 100%
rename from Lib.AspNetCore.ServerTiming/IServerTiming.cs
rename to Lib.AspNetCore.ServerTiming.Abstractions/IServerTiming.cs
diff --git a/Lib.AspNetCore.ServerTiming.Abstractions/Lib.AspNetCore.ServerTiming.Abstractions.csproj b/Lib.AspNetCore.ServerTiming.Abstractions/Lib.AspNetCore.ServerTiming.Abstractions.csproj
new file mode 100644
index 0000000..eee9849
--- /dev/null
+++ b/Lib.AspNetCore.ServerTiming.Abstractions/Lib.AspNetCore.ServerTiming.Abstractions.csproj
@@ -0,0 +1,37 @@
+
+
+ Lib.AspNetCore.ServerTiming.Abstractions provides abstractions for Lib.AspNetCore.ServerTiming, a library which provides Server Timing API support for ASP.NET Core.
+ Copyright © 2022 Tomasz Pęczek
+ 1.0.0
+ Tomasz Pęczek
+ netcoreapp2.1;netcoreapp3.1;net5.0;net6.0;net461
+ Lib.AspNetCore.ServerTiming.Abstractions
+ Lib.AspNetCore.ServerTiming.Abstractions
+ Lib.AspNetCore.ServerTiming.Abstractions
+ aspnetcore;servertiming;performance
+ https://github.com/tpeczek/Lib.AspNetCore.ServerTiming
+ MIT
+ README.md
+ git
+ git://github.com/tpeczek/Lib.AspNetCore.ServerTiming
+ true
+ true
+ true
+ true
+ true
+ true
+ latest
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Lib.AspNetCore.ServerTiming/ServerTimingDeliveryMode.cs b/Lib.AspNetCore.ServerTiming.Abstractions/ServerTimingDeliveryMode.cs
similarity index 100%
rename from Lib.AspNetCore.ServerTiming/ServerTimingDeliveryMode.cs
rename to Lib.AspNetCore.ServerTiming.Abstractions/ServerTimingDeliveryMode.cs
diff --git a/Lib.AspNetCore.ServerTiming.sln b/Lib.AspNetCore.ServerTiming.sln
index 4ff2fa9..30da484 100644
--- a/Lib.AspNetCore.ServerTiming.sln
+++ b/Lib.AspNetCore.ServerTiming.sln
@@ -9,7 +9,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Test.AspNetCore.ServerTimin
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Demo.AspNetCore.ServerTiming", "Demo.AspNetCore.ServerTiming\Demo.AspNetCore.ServerTiming.csproj", "{C7A47113-CBA9-486C-8F95-50B2E12D71B3}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DocFx.AspNetCore.ServerTiming", "DocFx.AspNetCore.ServerTiming\DocFx.AspNetCore.ServerTiming.csproj", "{E7DC599F-40C9-4651-97B9-6B47CD05BA0D}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DocFx.AspNetCore.ServerTiming", "DocFx.AspNetCore.ServerTiming\DocFx.AspNetCore.ServerTiming.csproj", "{E7DC599F-40C9-4651-97B9-6B47CD05BA0D}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{0AE38B1E-B1A7-4CB7-8F17-54AED3982407}"
ProjectSection(SolutionItems) = preProject
@@ -18,6 +18,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
README.md = README.md
EndProjectSection
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Lib.AspNetCore.ServerTiming.Abstractions", "Lib.AspNetCore.ServerTiming.Abstractions\Lib.AspNetCore.ServerTiming.Abstractions.csproj", "{B7DECE31-F8E4-4503-BF5B-1A8D5671F4FD}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -40,6 +42,10 @@ Global
{E7DC599F-40C9-4651-97B9-6B47CD05BA0D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E7DC599F-40C9-4651-97B9-6B47CD05BA0D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E7DC599F-40C9-4651-97B9-6B47CD05BA0D}.Release|Any CPU.Build.0 = Release|Any CPU
+ {B7DECE31-F8E4-4503-BF5B-1A8D5671F4FD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {B7DECE31-F8E4-4503-BF5B-1A8D5671F4FD}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {B7DECE31-F8E4-4503-BF5B-1A8D5671F4FD}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {B7DECE31-F8E4-4503-BF5B-1A8D5671F4FD}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/Lib.AspNetCore.ServerTiming/Filters/RestrictDescriptionsToDevelopmentMetricFilter.cs b/Lib.AspNetCore.ServerTiming/Filters/RestrictDescriptionsToDevelopmentMetricFilter.cs
index 26916e3..53d4716 100644
--- a/Lib.AspNetCore.ServerTiming/Filters/RestrictDescriptionsToDevelopmentMetricFilter.cs
+++ b/Lib.AspNetCore.ServerTiming/Filters/RestrictDescriptionsToDevelopmentMetricFilter.cs
@@ -36,7 +36,7 @@ public override bool OnServerTimingHeaderPreparation(HttpContext context, IColle
{
if (!IsDevelopment)
{
- List newMetrics = metrics .Select(m => new ServerTimingMetric(m.Name,m.Value,null)).ToList();
+ List newMetrics = metrics .Select(m => m.Value.HasValue ? new ServerTimingMetric(m.Name, m.Value.Value, null) : new ServerTimingMetric(m.Name, null)).ToList();
metrics.Clear();
newMetrics.ForEach(m => metrics.Add(m));
}
diff --git a/Lib.AspNetCore.ServerTiming/Lib.AspNetCore.ServerTiming.csproj b/Lib.AspNetCore.ServerTiming/Lib.AspNetCore.ServerTiming.csproj
index 65e8986..aa7ff4a 100644
--- a/Lib.AspNetCore.ServerTiming/Lib.AspNetCore.ServerTiming.csproj
+++ b/Lib.AspNetCore.ServerTiming/Lib.AspNetCore.ServerTiming.csproj
@@ -25,6 +25,9 @@
+
+
+
diff --git a/Lib.AspNetCore.ServerTiming/ServerTimingUtility.cs b/Lib.AspNetCore.ServerTiming/ServerTimingUtility.cs
index 3ab08c2..df875f4 100644
--- a/Lib.AspNetCore.ServerTiming/ServerTimingUtility.cs
+++ b/Lib.AspNetCore.ServerTiming/ServerTimingUtility.cs
@@ -145,8 +145,7 @@ internal static void SetServerTimingDeliveryMode(this IServerTiming serverTiming
}
// Format a metric name from caller params --> "{fileName}.{function}+{lineNumber}
- private static string FormatCallerName(string functionName, string filePath, int lineNumber) =>
- String.Concat(Path.GetFileNameWithoutExtension(filePath), ".", functionName, "+", lineNumber);
+ private static string FormatCallerName(string functionName, string filePath, int lineNumber) => String.Concat(Path.GetFileNameWithoutExtension(filePath), ".", functionName, "+", lineNumber);
// On dispose, add server timing performance metric.
private sealed class ServerTimingInstance : IDisposable
diff --git a/Test.AspNetCore.ServerTiming/Filters/IPRangeMetricFilterTests.cs b/Test.AspNetCore.ServerTiming/Filters/IPRangeMetricFilterTests.cs
index 7f93a09..434eeb8 100644
--- a/Test.AspNetCore.ServerTiming/Filters/IPRangeMetricFilterTests.cs
+++ b/Test.AspNetCore.ServerTiming/Filters/IPRangeMetricFilterTests.cs
@@ -1,8 +1,8 @@
using System.Net;
using System.Collections.Generic;
using Microsoft.AspNetCore.Http;
-using Lib.AspNetCore.ServerTiming.Http.Headers;
using Lib.AspNetCore.ServerTiming.Filters;
+using Lib.AspNetCore.ServerTiming.Http.Headers;
using Xunit;
diff --git a/Test.AspNetCore.ServerTiming/Filters/RestrictDescriptionsToDevelopmentMetricFilterTests.cs b/Test.AspNetCore.ServerTiming/Filters/RestrictDescriptionsToDevelopmentMetricFilterTests.cs
index c6a6fb3..6c87625 100644
--- a/Test.AspNetCore.ServerTiming/Filters/RestrictDescriptionsToDevelopmentMetricFilterTests.cs
+++ b/Test.AspNetCore.ServerTiming/Filters/RestrictDescriptionsToDevelopmentMetricFilterTests.cs
@@ -1,7 +1,7 @@
using System.Collections.Generic;
using Microsoft.AspNetCore.Http;
-using Lib.AspNetCore.ServerTiming.Http.Headers;
using Lib.AspNetCore.ServerTiming.Filters;
+using Lib.AspNetCore.ServerTiming.Http.Headers;
using Moq;
using Xunit;
diff --git a/Test.AspNetCore.ServerTiming/Filters/RestrictToDevelopmentMetricFilterTests.cs b/Test.AspNetCore.ServerTiming/Filters/RestrictToDevelopmentMetricFilterTests.cs
index 3693dff..d2cc56d 100644
--- a/Test.AspNetCore.ServerTiming/Filters/RestrictToDevelopmentMetricFilterTests.cs
+++ b/Test.AspNetCore.ServerTiming/Filters/RestrictToDevelopmentMetricFilterTests.cs
@@ -1,7 +1,7 @@
using System.Collections.Generic;
using Microsoft.AspNetCore.Http;
-using Lib.AspNetCore.ServerTiming.Http.Headers;
using Lib.AspNetCore.ServerTiming.Filters;
+using Lib.AspNetCore.ServerTiming.Http.Headers;
using Moq;
using Xunit;