microsoft / Omex

Shared components used by the Omex team to build scalable and highly available distributed systems
MIT License
71 stars 40 forks source link

Option to disable legacy telemetry #679

Closed Gnol-VN closed 5 months ago

Gnol-VN commented 5 months ago

Why is this breaking change PR?

This PR to disable legacy ActivityEventSender and OmexLogger default.

How to enable legacy ActivityEventSender and OmexLogger?

In your appsettings.json, put this

{
  "Logging": {
    "Omex": {
      "OmexLoggerEnabled": true
    }
  },
  "Monitoring": {
    "ActivityEventSenderEnabled": true
  }
}

You additionally need this to have these below parts to have your service recognize the appsettings.json.

Make sure that build copies this file to the output folder together with the binaries. For services using Microsoft.NET.Sdk.Web this should happen automatically. For services using Microsoft.NET.Sdk, add the following snippet to your project file:

  <ItemGroup>
    <Content Include="appsettings*.json">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </Content>
  </ItemGroup>

If you are using ServiceFabric, Ensure working folder is set to CodePackage in ServiceManifest.xml

  <CodePackage Name="Code" Version="1.0.0">
    <EntryPoint>
      <ExeHost>
        <Program>MyService.exe</Program>
        <WorkingFolder>CodePackage</WorkingFolder>
      </ExeHost>
    </EntryPoint>
  </CodePackage>

Reference:

  1. https://learn.microsoft.com/en-us/dotnet/core/extensions/custom-logging-provider
  2. https://www.codeproject.com/Articles/1556475/How-to-Write-a-Custom-Logging-Provider-in-ASP-NET