Skip to content

Byndyusoft/Byndyusoft.AspNetCore.Instrumentation.Tracing

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

56 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Byndyusoft.AspNetCore.Instrumentation.Tracing

ASP.NET Core MVC tracing.

(License) Nuget NuGet downloads

Installing

dotnet add package Byndyusoft.AspNetCore.Instrumentation.Tracing

Usages

public class Startup
{
    public void ConfigureServices(IServiceCollection services)
    {
        services.AddControllers()
            .AddTracing();
        ...
    }
}

Configuring

public class Startup
{
    public void ConfigureServices(IServiceCollection services)
    {
        services.AddControllers()
                .AddTracing(options =>
                {
                    options.TagRequestParamsInTrace = true;
                    options.EnrichLogsWithParams = true;
                    options.EnrichLogsWithHttpInfo = true;
                    options.ValueMaxStringLength = 50;
                    options.Formatter = new SystemTextJsonFormatter
                    {
                        Options = new JsonSerializerOptions(JsonSerializerDefaults.Web)
                        {
                            Converters =
                            {
                                new JsonStringEnumConverter()
                            }
                        }
                    };
                });
        ...
    }
}

There are some default option parameters:

  1. EnrichTraceWithTaggedRequestParams — if true then http request params will be added to trace tags. Default: true. For more detail how params are extracted, refer to page.
  2. EnrichLogsWithParams — if true then every log will be enriched with request params during this request. Default: true. For more detail how params are extracted, refer to page.
  3. EnrichLogsWithHttpInfo — if true then every log will be enriched with request http info during this request. Default: true.
  4. ValueMaxStringLength — maximum number of serialized request and response body string length. This string will be written to trace events and/or logs. The excess will be trimmed. Default: null - unlimited.
  5. Formatter — it is used to serialize request and response body. Default: SystemTextJsonFormatter.

MaskedSerialization

Masked serialization package Byndyusoft.MaskedSerialization is used to hide sensitive data. Is it implemented in NewtonsoftJsonFormatter.cs class.

Contributing

To contribute, you will need to setup your local environment, see prerequisites. For the contribution and workflow guide, see package development lifecycle.

A detailed overview on how to contribute can be found in the contributing guide.

Prerequisites

Make sure you have installed all of the following prerequisites on your development machine:

General folders layout

src

  • source code

tests

  • unit-tests

example

  • example application

Package development lifecycle

  • Implement package logic in src
  • Add or addapt unit-tests (prefer before and simultaneously with coding) in tests
  • Add or change the documentation as needed
  • Open pull request in the correct branch. Target the project's master branch

Maintainers

[email protected]