liuhaoyang / butterfly-csharp

A .NET client for Butterfly.
MIT License
29 stars 7 forks source link

Using trace in API controller #36

Open Phelecks opened 4 years ago

Phelecks commented 4 years ago

I used butterfly in my API gateway (using Ocelot) and everything is going well. But I want to use it in my back-end micro services to enjoy your beautiful project more. I am already implemented many controllers that need to use butterfly trace log on top of it. In your sample, you used interface to put [Trace] on top of its method. Is there any more simple way to use [Trace] in my controller or action that dose not need to change my codes?

Phelecks commented 4 years ago

I found the problem, in my project asp.net core 3.1 TraceAttribute => excepts.Any(x => serviceType.Namespace.Matches(x)) is always true so the await serviceTracer?.ChildTraceAsync(...) will never run.

Can you help me through?