Commit 664bb4aa by huangzhihong

fix AspnetCore 路由忽略上报

parent cb271e4c
{
"SkyWalking": {
"ServiceName": "simpleconsole",
"Namespace": "",
"HeaderVersions": [
"sw6"
],
"Sampling": {
"SamplePer3Secs": -1,
"Percentage": -1.0
},
"Logging": {
"Level": "Information",
"FilePath": "logs\\skyapm-{Date}.log"
},
"Transport": {
"Interval": 3000,
"ProtocolVersion": "v6",
"QueueSize": 30000,
"BatchSize": 3000,
"gRPC": {
"Servers": "118.24.155.252:11800",
"Timeout": 10000,
"ConnectTimeout": 10000,
"ReportTimeout": 600000
}
}
}
}
\ No newline at end of file
using Microsoft.AspNetCore.Http;
using Bailun.ServiceFabric.Trace;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Http.Extensions;
using Microsoft.AspNetCore.Http.Internal;
using Microsoft.AspNetCore.Mvc.Abstractions;
......@@ -32,6 +33,11 @@ namespace Bailun.Diagnostics.AspNetCore
[DiagnosticName("Microsoft.AspNetCore.Hosting.BeginRequest")]
public void BeginRequest([Property] HttpContext httpContext)
{
if (TracePathFilter.IsIgnore(httpContext.Request.Path.ToString()))
{
return;
}
var requestBody = httpContext.Request.GetBodyString();
_segmentContext = _tracingContext.CreateEntrySegmentContext(httpContext.Request.Path,
......
using System;
using System.Collections.Generic;
using System.Text;
using Xunit;
namespace Bailun.ServiceFabric.Trace.Test
{
public class TraceFilterTest
{
public TraceFilterTest()
{
}
[Fact]
public void Filter_ConsulDNS_Test()
{
Assert.True(TracePathFilter.IsIgnore("/v1/kv/Publish/Amazon/Common/?recurse=true&index=3875080"));
}
[Fact]
public void Filter_Healthy_Test()
{
Assert.True(TracePathFilter.IsIgnore("/status"));
Assert.True(!TracePathFilter.IsIgnore("/statusa"));
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment