master f64af79ae582 cached
165 files
272.2 KB
64.0k tokens
397 symbols
1 requests
Download .txt
Showing preview only (315K chars total). Download the full file or copy to clipboard to get everything.
Repository: opentracing-contrib/csharp-netcore
Branch: master
Commit: f64af79ae582
Files: 165
Total size: 272.2 KB

Directory structure:
gitextract_0r5cqphu/

├── .appveyor.yml
├── .editorconfig
├── .gitattributes
├── .gitignore
├── .travis.yml
├── .vscode/
│   ├── extensions.json
│   ├── settings.json
│   └── tasks.json
├── Directory.Build.props
├── LICENSE
├── NuGet.config
├── OpenTracing.Contrib.sln
├── README.md
├── RELEASE.md
├── SignKey.snk
├── benchmarks/
│   └── OpenTracing.Contrib.NetCore.Benchmarks/
│       ├── AspNetCore/
│       │   └── RequestDiagnosticsBenchmark.cs
│       ├── CoreFx/
│       │   └── HttpHandlerDiagnosticsBenchmark.cs
│       ├── InstrumentationMode.cs
│       ├── OpenTracing.Contrib.NetCore.Benchmarks.csproj
│       ├── OpenTracingBuilderExtensions.cs
│       └── Program.cs
├── build.ps1
├── global.json
├── launch-sample.ps1
├── samples/
│   ├── net6.0/
│   │   ├── CustomersApi/
│   │   │   ├── Controllers/
│   │   │   │   └── CustomersController.cs
│   │   │   ├── CustomersApi.csproj
│   │   │   ├── DataStore/
│   │   │   │   └── CustomerDbContext.cs
│   │   │   ├── Program.cs
│   │   │   ├── Properties/
│   │   │   │   └── launchSettings.json
│   │   │   ├── Startup.cs
│   │   │   └── appsettings.json
│   │   ├── FrontendWeb/
│   │   │   ├── Controllers/
│   │   │   │   └── HomeController.cs
│   │   │   ├── FrontendWeb.csproj
│   │   │   ├── Program.cs
│   │   │   ├── Properties/
│   │   │   │   └── launchSettings.json
│   │   │   ├── Startup.cs
│   │   │   ├── Views/
│   │   │   │   ├── Home/
│   │   │   │   │   ├── Index.cshtml
│   │   │   │   │   └── PlaceOrder.cshtml
│   │   │   │   └── _ViewImports.cshtml
│   │   │   └── appsettings.json
│   │   ├── OrdersApi/
│   │   │   ├── Controllers/
│   │   │   │   └── OrdersController.cs
│   │   │   ├── DataStore/
│   │   │   │   ├── Order.cs
│   │   │   │   └── OrdersDbContext.cs
│   │   │   ├── OrdersApi.csproj
│   │   │   ├── Program.cs
│   │   │   ├── Properties/
│   │   │   │   └── launchSettings.json
│   │   │   ├── Startup.cs
│   │   │   └── appsettings.json
│   │   ├── Shared/
│   │   │   ├── Constants.cs
│   │   │   ├── Customer.cs
│   │   │   ├── JaegerServiceCollectionExtensions.cs
│   │   │   ├── PlaceOrderCommand.cs
│   │   │   └── Shared.csproj
│   │   └── TrafficGenerator/
│   │       ├── Program.cs
│   │       ├── TrafficGenerator.csproj
│   │       ├── Worker.cs
│   │       └── appsettings.json
│   ├── net7.0/
│   │   ├── CustomersApi/
│   │   │   ├── CustomersApi.csproj
│   │   │   ├── DataStore/
│   │   │   │   └── CustomerDbContext.cs
│   │   │   ├── Program.cs
│   │   │   ├── Properties/
│   │   │   │   └── launchSettings.json
│   │   │   └── appsettings.json
│   │   ├── FrontendWeb/
│   │   │   ├── Controllers/
│   │   │   │   └── HomeController.cs
│   │   │   ├── FrontendWeb.csproj
│   │   │   ├── Program.cs
│   │   │   ├── Properties/
│   │   │   │   └── launchSettings.json
│   │   │   ├── Views/
│   │   │   │   ├── Home/
│   │   │   │   │   ├── Index.cshtml
│   │   │   │   │   └── PlaceOrder.cshtml
│   │   │   │   └── _ViewImports.cshtml
│   │   │   └── appsettings.json
│   │   ├── OrdersApi/
│   │   │   ├── Controllers/
│   │   │   │   └── OrdersController.cs
│   │   │   ├── DataStore/
│   │   │   │   ├── Order.cs
│   │   │   │   └── OrdersDbContext.cs
│   │   │   ├── OrdersApi.csproj
│   │   │   ├── Program.cs
│   │   │   ├── Properties/
│   │   │   │   └── launchSettings.json
│   │   │   └── appsettings.json
│   │   ├── Shared/
│   │   │   ├── Constants.cs
│   │   │   ├── Customer.cs
│   │   │   ├── JaegerServiceCollectionExtensions.cs
│   │   │   ├── PlaceOrderCommand.cs
│   │   │   └── Shared.csproj
│   │   └── TrafficGenerator/
│   │       ├── Program.cs
│   │       ├── TrafficGenerator.csproj
│   │       ├── Worker.cs
│   │       └── appsettings.json
│   └── netcoreapp3.1/
│       ├── CustomersApi/
│       │   ├── Controllers/
│       │   │   └── CustomersController.cs
│       │   ├── CustomersApi.csproj
│       │   ├── DataStore/
│       │   │   └── CustomerDbContext.cs
│       │   ├── Program.cs
│       │   ├── Properties/
│       │   │   └── launchSettings.json
│       │   ├── Startup.cs
│       │   └── appsettings.json
│       ├── FrontendWeb/
│       │   ├── Controllers/
│       │   │   └── HomeController.cs
│       │   ├── FrontendWeb.csproj
│       │   ├── Program.cs
│       │   ├── Properties/
│       │   │   └── launchSettings.json
│       │   ├── Startup.cs
│       │   ├── Views/
│       │   │   ├── Home/
│       │   │   │   ├── Index.cshtml
│       │   │   │   └── PlaceOrder.cshtml
│       │   │   └── _ViewImports.cshtml
│       │   └── appsettings.json
│       ├── OrdersApi/
│       │   ├── Controllers/
│       │   │   └── OrdersController.cs
│       │   ├── DataStore/
│       │   │   ├── Order.cs
│       │   │   └── OrdersDbContext.cs
│       │   ├── OrdersApi.csproj
│       │   ├── Program.cs
│       │   ├── Properties/
│       │   │   └── launchSettings.json
│       │   ├── Startup.cs
│       │   └── appsettings.json
│       ├── Shared/
│       │   ├── Constants.cs
│       │   ├── Customer.cs
│       │   ├── JaegerServiceCollectionExtensions.cs
│       │   ├── PlaceOrderCommand.cs
│       │   └── Shared.csproj
│       └── TrafficGenerator/
│           ├── Program.cs
│           ├── TrafficGenerator.csproj
│           ├── Worker.cs
│           └── appsettings.json
├── src/
│   ├── Directory.Build.props
│   └── OpenTracing.Contrib.NetCore/
│       ├── AspNetCore/
│       │   ├── AspNetCoreDiagnosticOptions.cs
│       │   ├── AspNetCoreDiagnostics.cs
│       │   ├── HostingOptions.cs
│       │   └── RequestHeadersExtractAdapter.cs
│       ├── Configuration/
│       │   ├── DiagnosticOptions.cs
│       │   ├── IOpenTracingBuilder.cs
│       │   ├── OpenTracingBuilder.cs
│       │   ├── OpenTracingBuilderExtensions.cs
│       │   └── ServiceCollectionExtensions.cs
│       ├── EntityFrameworkCore/
│       │   ├── EntityFrameworkCoreDiagnosticOptions.cs
│       │   └── EntityFrameworkCoreDiagnostics.cs
│       ├── GenericListeners/
│       │   ├── GenericDiagnosticOptions.cs
│       │   └── GenericDiagnostics.cs
│       ├── HttpHandler/
│       │   ├── HttpHandlerDiagnosticOptions.cs
│       │   ├── HttpHandlerDiagnostics.cs
│       │   └── HttpHeadersInjectAdapter.cs
│       ├── InstrumentationService.cs
│       ├── Internal/
│       │   ├── DiagnosticEventObserver.cs
│       │   ├── DiagnosticManager.cs
│       │   ├── DiagnosticManagerOptions.cs
│       │   ├── DiagnosticObserver.cs
│       │   ├── GenericEventProcessor.cs
│       │   ├── GlobalTracerAccessor.cs
│       │   ├── IGlobalTracerAccessor.cs
│       │   ├── PropertyFetcher.cs
│       │   ├── SpanExtensions.cs
│       │   └── TracerExtensions.cs
│       ├── Logging/
│       │   ├── OpenTracingLogger.cs
│       │   └── OpenTracingLoggerProvider.cs
│       ├── MicrosoftSqlClient/
│       │   ├── MicrosoftSqlClientDiagnosticOptions.cs
│       │   └── MicrosoftSqlClientDiagnostics.cs
│       ├── OpenTracing.Contrib.NetCore.csproj
│       ├── Properties/
│       │   └── AssemblyInfo.cs
│       └── SystemSqlClient/
│           ├── SqlClientDiagnosticOptions.cs
│           └── SqlClientDiagnostics.cs
├── test/
│   └── OpenTracing.Contrib.NetCore.Tests/
│       ├── AspNetCore/
│       │   └── HostingTest.cs
│       ├── CoreFx/
│       │   └── HttpHandlerDiagnosticTest.cs
│       ├── Internal/
│       │   ├── DiagnosticManagerTest.cs
│       │   └── PropertyFetcherTest.cs
│       ├── Logging/
│       │   ├── LoggingDependencyInjectionTest.cs
│       │   └── LoggingTest.cs
│       ├── OpenTracing.Contrib.NetCore.Tests.csproj
│       └── XunitLogging/
│           ├── XunitLoggerFactoryExtensions.cs
│           └── XunitLoggerProvider.cs
└── version.props

================================================
FILE CONTENTS
================================================

================================================
FILE: .appveyor.yml
================================================
# AppVeyor Build number is incremental and not related to actual version number of the product
version: '{build}'

image: Visual Studio 2019

init:
  - cmd: git config --global core.autocrlf true

environment:
  global:
    DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
    DOTNET_CLI_TELEMETRY_OPTOUT: 1

build_script:
  - ps: Invoke-WebRequest https://dot.net/v1/dotnet-install.ps1 -OutFile .\dotnet-install.ps1
  - ps: .\dotnet-install.ps1 -Runtime dotnet -Version 3.1.10
  - ps: .\dotnet-install.ps1 -Version 6.0.100
  - ps: .\dotnet-install.ps1 -Version 7.0.100
  - ps: .\build.ps1

test: off

artifacts:
  - path: artifacts\nuget\*.nupkg
    name: NuGet
  - path: artifacts\nuget\*.snupkg
    name: Symbols

# Deploy every successful build (except PRs) to development feed
nuget:
  account_feed: true
  project_feed: true
  disable_publish_on_pr: true


================================================
FILE: .editorconfig
================================================
# editorconfig.org

# top-most EditorConfig file
root = true

# Default settings:
# A newline ending every file
# Use 4 spaces as indentation
[*]
insert_final_newline = true
indent_style = space
indent_size = 4

[project.json]
indent_size = 2

# C# files
[*.cs]
# New line preferences
csharp_new_line_before_open_brace = all
csharp_new_line_before_else = true
csharp_new_line_before_catch = true
csharp_new_line_before_finally = true
csharp_new_line_before_members_in_object_initializers = true
csharp_new_line_before_members_in_anonymous_types = true
csharp_new_line_between_query_expression_clauses = true

# Indentation preferences
csharp_indent_block_contents = true
csharp_indent_braces = false
csharp_indent_case_contents = true
csharp_indent_switch_labels = true
csharp_indent_labels = flush_left

# avoid this. unless absolutely necessary
dotnet_style_qualification_for_field = false:suggestion
dotnet_style_qualification_for_property = false:suggestion
dotnet_style_qualification_for_method = false:suggestion
dotnet_style_qualification_for_event = false:suggestion

# only use var when it's obvious what the variable type is
csharp_style_var_for_built_in_types = false:none
csharp_style_var_when_type_is_apparent = false:none
csharp_style_var_elsewhere = false:suggestion

# use language keywords instead of BCL types
dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion
dotnet_style_predefined_type_for_member_access = true:suggestion

# name all constant fields using PascalCase
dotnet_naming_rule.constant_fields_should_be_pascal_case.severity = suggestion
dotnet_naming_rule.constant_fields_should_be_pascal_case.symbols  = constant_fields
dotnet_naming_rule.constant_fields_should_be_pascal_case.style    = pascal_case_style

dotnet_naming_symbols.constant_fields.applicable_kinds   = field
dotnet_naming_symbols.constant_fields.required_modifiers = const

dotnet_naming_style.pascal_case_style.capitalization = pascal_case

# static fields should have s_ prefix
dotnet_naming_rule.static_fields_should_have_prefix.severity = suggestion
dotnet_naming_rule.static_fields_should_have_prefix.symbols  = static_fields
dotnet_naming_rule.static_fields_should_have_prefix.style    = static_prefix_style

dotnet_naming_symbols.static_fields.applicable_kinds   = field
dotnet_naming_symbols.static_fields.required_modifiers = static

dotnet_naming_style.static_prefix_style.required_prefix = s_
dotnet_naming_style.static_prefix_style.capitalization = camel_case

# internal and private fields should be _camelCase
dotnet_naming_rule.camel_case_for_private_internal_fields.severity = suggestion
dotnet_naming_rule.camel_case_for_private_internal_fields.symbols  = private_internal_fields
dotnet_naming_rule.camel_case_for_private_internal_fields.style    = camel_case_underscore_style

dotnet_naming_symbols.private_internal_fields.applicable_kinds = field
dotnet_naming_symbols.private_internal_fields.applicable_accessibilities = private, internal

dotnet_naming_style.camel_case_underscore_style.required_prefix = _
dotnet_naming_style.camel_case_underscore_style.capitalization = camel_case

# Code style defaults
dotnet_sort_system_directives_first = true
csharp_preserve_single_line_blocks = true
csharp_preserve_single_line_statements = false

# Expression-level preferences
dotnet_style_object_initializer = true:suggestion
dotnet_style_collection_initializer = true:suggestion
dotnet_style_explicit_tuple_names = true:suggestion
dotnet_style_coalesce_expression = true:suggestion
dotnet_style_null_propagation = true:suggestion

# Expression-bodied members
csharp_style_expression_bodied_methods = false:none
csharp_style_expression_bodied_constructors = false:none
csharp_style_expression_bodied_operators = false:none
csharp_style_expression_bodied_properties = true:none
csharp_style_expression_bodied_indexers = true:none
csharp_style_expression_bodied_accessors = true:none

# Pattern matching
csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion
csharp_style_pattern_matching_over_as_with_null_check = true:suggestion
csharp_style_inlined_variable_declaration = true:suggestion

# Null checking preferences
csharp_style_throw_expression = true:suggestion
csharp_style_conditional_delegate_call = true:suggestion

# Space preferences
csharp_space_after_cast = false
csharp_space_after_colon_in_inheritance_clause = true
csharp_space_after_comma = true
csharp_space_after_dot = false
csharp_space_after_keywords_in_control_flow_statements = true
csharp_space_after_semicolon_in_for_statement = true
csharp_space_around_binary_operators = before_and_after
csharp_space_around_declaration_statements = do_not_ignore
csharp_space_before_colon_in_inheritance_clause = true
csharp_space_before_comma = false
csharp_space_before_dot = false
csharp_space_before_open_square_brackets = false
csharp_space_before_semicolon_in_for_statement = false
csharp_space_between_empty_square_brackets = false
csharp_space_between_method_call_empty_parameter_list_parentheses = false
csharp_space_between_method_call_name_and_opening_parenthesis = false
csharp_space_between_method_call_parameter_list_parentheses = false
csharp_space_between_method_declaration_empty_parameter_list_parentheses = false
csharp_space_between_method_declaration_name_and_open_parenthesis = false
csharp_space_between_method_declaration_parameter_list_parentheses = false
csharp_space_between_parentheses = false
csharp_space_between_square_brackets = false

# C++ Files
[*.{cpp,h,in}]
curly_bracket_next_line = true
indent_brace_style = Allman

# Xml project files
[*.{csproj,vcxproj,vcxproj.filters,proj,nativeproj,locproj}]
indent_size = 2

# Xml build files
[*.builds]
indent_size = 2

# Xml files
[*.{xml,stylecop,resx,ruleset}]
indent_size = 2

# Xml config files
[*.{props,targets,config,nuspec}]
indent_size = 2

# Shell scripts
[*.sh]
end_of_line = lf
[*.{cmd, bat}]
end_of_line = crlf


================================================
FILE: .gitattributes
================================================
* text=auto


================================================
FILE: .gitignore
================================================
# Sqlite DBs in samples
*.db

## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.

BenchmarkDotNet.Artifacts/

# User-specific files
*.suo
*.user
*.userosscache
*.sln.docstates

# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs

# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
bld/
[Bb]in/
[Oo]bj/
[Ll]og/

# Visual Studio 2015 cache/options directory
.vs/
# Uncomment if you have tasks that create the project's static files in wwwroot
#wwwroot/

# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*

# NUNIT
*.VisualState.xml
TestResult.xml

# Build Results of an ATL Project
[Dd]ebugPS/
[Rr]eleasePS/
dlldata.c

# DNX
project.lock.json
artifacts/
.build/

*_i.c
*_p.c
*_i.h
*.ilk
*.meta
*.obj
*.pch
*.pdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*.log
*.vspscc
*.vssscc
.builds
*.pidb
*.svclog
*.scc

# Chutzpah Test files
_Chutzpah*

# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opendb
*.opensdf
*.sdf
*.cachefile
*.VC.db
*.VC.VC.opendb

# Visual Studio profiler
*.psess
*.vsp
*.vspx
*.sap

# TFS 2012 Local Workspace
$tf/

# Guidance Automation Toolkit
*.gpState

# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user

# JustCode is a .NET coding add-in
.JustCode

# TeamCity is a build add-in
_TeamCity*

# DotCover is a Code Coverage Tool
*.dotCover

# NCrunch
_NCrunch_*
.*crunch*.local.xml
nCrunchTemp_*

# MightyMoose
*.mm.*
AutoTest.Net/

# Web workbench (sass)
.sass-cache/

# Installshield output folder
[Ee]xpress/

# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html

# Click-Once directory
publish/

# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
# TODO: Comment the next line if you want to checkin your web deploy settings
# but database connection strings (with potential passwords) will be unencrypted
*.pubxml
*.publishproj

# Microsoft Azure Web App publish settings. Comment the next line if you want to
# checkin your Azure Web App publish settings, but sensitive information contained
# in these scripts will be unencrypted
PublishScripts/

# NuGet Packages
*.nupkg
# The packages folder can be ignored because of Package Restore
**/packages/*
# except build/, which is used as an MSBuild target.
!**/packages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/packages/repositories.config
# NuGet v3's project.json files produces more ignoreable files
*.nuget.props
*.nuget.targets

# Microsoft Azure Build Output
csx/
*.build.csdef

# Microsoft Azure Emulator
ecf/
rcf/

# Windows Store app package directories and files
AppPackages/
BundleArtifacts/
Package.StoreAssociation.xml
_pkginfo.txt

# Visual Studio cache files
# files ending in .cache can be ignored
*.[Cc]ache
# but keep track of directories ending in .cache
!*.[Cc]ache/

# Others
ClientBin/
~$*
*~
*.dbmdl
*.dbproj.schemaview
*.pfx
*.publishsettings
node_modules/
orleans.codegen.cs

# Since there are multiple workflows, uncomment next line to ignore bower_components
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
#bower_components/

# RIA/Silverlight projects
Generated_Code/

# Backup & report files from converting an old project file
# to a newer Visual Studio version. Backup files are not needed,
# because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm

# SQL Server files
*.mdf
*.ldf

# Business Intelligence projects
*.rdl.data
*.bim.layout
*.bim_*.settings

# Microsoft Fakes
FakesAssemblies/

# GhostDoc plugin setting file
*.GhostDoc.xml

# Node.js Tools for Visual Studio
.ntvs_analysis.dat

# Visual Studio 6 build log
*.plg

# Visual Studio 6 workspace options file
*.opt

# Visual Studio LightSwitch build output
**/*.HTMLClient/GeneratedArtifacts
**/*.DesktopClient/GeneratedArtifacts
**/*.DesktopClient/ModelManifest.xml
**/*.Server/GeneratedArtifacts
**/*.Server/ModelManifest.xml
_Pvt_Extensions

# Paket dependency manager
.paket/paket.exe
paket-files/

# FAKE - F# Make
.fake/

# JetBrains Rider
.idea/
*.sln.iml


================================================
FILE: .travis.yml
================================================
language: csharp

matrix:
  include:
    - os: linux
      dist: xenial
      sudo: required
      mono: none
      dotnet: 6.0.100
      addons:
        apt:
          sources:
            - sourceline: "deb [arch=amd64] https://packages.microsoft.com/ubuntu/16.04/prod xenial main"
              key_url: "https://packages.microsoft.com/keys/microsoft.asc"
          packages:
            - powershell
            - dotnet-hosting-2.0.7
            - aspnetcore-runtime-2.1
            - aspnetcore-runtime-3.1
            - aspnetcore-runtime-5.0

env:
  global:
    - DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
    - DOTNET_CLI_TELEMETRY_OPTOUT: 1

script:
  - pwsh ./build.ps1


================================================
FILE: .vscode/extensions.json
================================================
{
    "recommendations": [
        "EditorConfig.EditorConfig",
        "formulahendry.dotnet-test-explorer",
        "ms-vscode.csharp",
        "ms-vscode.powershell"
    ]
}


================================================
FILE: .vscode/settings.json
================================================
{
    "dotnet-test-explorer.testProjectPath": "test/OpenTracing.Contrib.NetCore.Tests"
}


================================================
FILE: .vscode/tasks.json
================================================
{
    "version": "2.0.0",
    "tasks": [
        {
            "label": "build",
            "command": "dotnet",
            "type": "process",
            "args": [
                "build",
                "${workspaceFolder}",
                "--no-restore"
            ],
            "problemMatcher": "$msCompile",
            "group": {
                "kind": "build",
                "isDefault": true
            }
        }
    ]
}


================================================
FILE: Directory.Build.props
================================================
<Project>
  <Import Project="version.props" />
  <PropertyGroup>
    <!-- Projects that should generate nupkg files override this -->
    <IsPackable>false</IsPackable>

    <LangVersion>latest</LangVersion>
    <TreatWarningsAsErrors>true</TreatWarningsAsErrors>
    <SignAssembly>true</SignAssembly>
    <AssemblyOriginatorKeyFile>$(MSBuildThisFileDirectory)SignKey.snk</AssemblyOriginatorKeyFile>
    <PublicSign Condition=" '$(OS)' != 'Windows_NT' ">true</PublicSign>
  </PropertyGroup>

</Project>


================================================
FILE: LICENSE
================================================
                                 Apache License
                           Version 2.0, January 2004
                        http://www.apache.org/licenses/

   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION

   1. Definitions.

      "License" shall mean the terms and conditions for use, reproduction,
      and distribution as defined by Sections 1 through 9 of this document.

      "Licensor" shall mean the copyright owner or entity authorized by
      the copyright owner that is granting the License.

      "Legal Entity" shall mean the union of the acting entity and all
      other entities that control, are controlled by, or are under common
      control with that entity. For the purposes of this definition,
      "control" means (i) the power, direct or indirect, to cause the
      direction or management of such entity, whether by contract or
      otherwise, or (ii) ownership of fifty percent (50%) or more of the
      outstanding shares, or (iii) beneficial ownership of such entity.

      "You" (or "Your") shall mean an individual or Legal Entity
      exercising permissions granted by this License.

      "Source" form shall mean the preferred form for making modifications,
      including but not limited to software source code, documentation
      source, and configuration files.

      "Object" form shall mean any form resulting from mechanical
      transformation or translation of a Source form, including but
      not limited to compiled object code, generated documentation,
      and conversions to other media types.

      "Work" shall mean the work of authorship, whether in Source or
      Object form, made available under the License, as indicated by a
      copyright notice that is included in or attached to the work
      (an example is provided in the Appendix below).

      "Derivative Works" shall mean any work, whether in Source or Object
      form, that is based on (or derived from) the Work and for which the
      editorial revisions, annotations, elaborations, or other modifications
      represent, as a whole, an original work of authorship. For the purposes
      of this License, Derivative Works shall not include works that remain
      separable from, or merely link (or bind by name) to the interfaces of,
      the Work and Derivative Works thereof.

      "Contribution" shall mean any work of authorship, including
      the original version of the Work and any modifications or additions
      to that Work or Derivative Works thereof, that is intentionally
      submitted to Licensor for inclusion in the Work by the copyright owner
      or by an individual or Legal Entity authorized to submit on behalf of
      the copyright owner. For the purposes of this definition, "submitted"
      means any form of electronic, verbal, or written communication sent
      to the Licensor or its representatives, including but not limited to
      communication on electronic mailing lists, source code control systems,
      and issue tracking systems that are managed by, or on behalf of, the
      Licensor for the purpose of discussing and improving the Work, but
      excluding communication that is conspicuously marked or otherwise
      designated in writing by the copyright owner as "Not a Contribution."

      "Contributor" shall mean Licensor and any individual or Legal Entity
      on behalf of whom a Contribution has been received by Licensor and
      subsequently incorporated within the Work.

   2. Grant of Copyright License. Subject to the terms and conditions of
      this License, each Contributor hereby grants to You a perpetual,
      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
      copyright license to reproduce, prepare Derivative Works of,
      publicly display, publicly perform, sublicense, and distribute the
      Work and such Derivative Works in Source or Object form.

   3. Grant of Patent License. Subject to the terms and conditions of
      this License, each Contributor hereby grants to You a perpetual,
      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
      (except as stated in this section) patent license to make, have made,
      use, offer to sell, sell, import, and otherwise transfer the Work,
      where such license applies only to those patent claims licensable
      by such Contributor that are necessarily infringed by their
      Contribution(s) alone or by combination of their Contribution(s)
      with the Work to which such Contribution(s) was submitted. If You
      institute patent litigation against any entity (including a
      cross-claim or counterclaim in a lawsuit) alleging that the Work
      or a Contribution incorporated within the Work constitutes direct
      or contributory patent infringement, then any patent licenses
      granted to You under this License for that Work shall terminate
      as of the date such litigation is filed.

   4. Redistribution. You may reproduce and distribute copies of the
      Work or Derivative Works thereof in any medium, with or without
      modifications, and in Source or Object form, provided that You
      meet the following conditions:

      (a) You must give any other recipients of the Work or
          Derivative Works a copy of this License; and

      (b) You must cause any modified files to carry prominent notices
          stating that You changed the files; and

      (c) You must retain, in the Source form of any Derivative Works
          that You distribute, all copyright, patent, trademark, and
          attribution notices from the Source form of the Work,
          excluding those notices that do not pertain to any part of
          the Derivative Works; and

      (d) If the Work includes a "NOTICE" text file as part of its
          distribution, then any Derivative Works that You distribute must
          include a readable copy of the attribution notices contained
          within such NOTICE file, excluding those notices that do not
          pertain to any part of the Derivative Works, in at least one
          of the following places: within a NOTICE text file distributed
          as part of the Derivative Works; within the Source form or
          documentation, if provided along with the Derivative Works; or,
          within a display generated by the Derivative Works, if and
          wherever such third-party notices normally appear. The contents
          of the NOTICE file are for informational purposes only and
          do not modify the License. You may add Your own attribution
          notices within Derivative Works that You distribute, alongside
          or as an addendum to the NOTICE text from the Work, provided
          that such additional attribution notices cannot be construed
          as modifying the License.

      You may add Your own copyright statement to Your modifications and
      may provide additional or different license terms and conditions
      for use, reproduction, or distribution of Your modifications, or
      for any such Derivative Works as a whole, provided Your use,
      reproduction, and distribution of the Work otherwise complies with
      the conditions stated in this License.

   5. Submission of Contributions. Unless You explicitly state otherwise,
      any Contribution intentionally submitted for inclusion in the Work
      by You to the Licensor shall be under the terms and conditions of
      this License, without any additional terms or conditions.
      Notwithstanding the above, nothing herein shall supersede or modify
      the terms of any separate license agreement you may have executed
      with Licensor regarding such Contributions.

   6. Trademarks. This License does not grant permission to use the trade
      names, trademarks, service marks, or product names of the Licensor,
      except as required for reasonable and customary use in describing the
      origin of the Work and reproducing the content of the NOTICE file.

   7. Disclaimer of Warranty. Unless required by applicable law or
      agreed to in writing, Licensor provides the Work (and each
      Contributor provides its Contributions) on an "AS IS" BASIS,
      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
      implied, including, without limitation, any warranties or conditions
      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
      PARTICULAR PURPOSE. You are solely responsible for determining the
      appropriateness of using or redistributing the Work and assume any
      risks associated with Your exercise of permissions under this License.

   8. Limitation of Liability. In no event and under no legal theory,
      whether in tort (including negligence), contract, or otherwise,
      unless required by applicable law (such as deliberate and grossly
      negligent acts) or agreed to in writing, shall any Contributor be
      liable to You for damages, including any direct, indirect, special,
      incidental, or consequential damages of any character arising as a
      result of this License or out of the use or inability to use the
      Work (including but not limited to damages for loss of goodwill,
      work stoppage, computer failure or malfunction, or any and all
      other commercial damages or losses), even if such Contributor
      has been advised of the possibility of such damages.

   9. Accepting Warranty or Additional Liability. While redistributing
      the Work or Derivative Works thereof, You may choose to offer,
      and charge a fee for, acceptance of support, warranty, indemnity,
      or other liability obligations and/or rights consistent with this
      License. However, in accepting such obligations, You may act only
      on Your own behalf and on Your sole responsibility, not on behalf
      of any other Contributor, and only if You agree to indemnify,
      defend, and hold each Contributor harmless for any liability
      incurred by, or claims asserted against, such Contributor by reason
      of your accepting any such warranty or additional liability.

   END OF TERMS AND CONDITIONS

   APPENDIX: How to apply the Apache License to your work.

      To apply the Apache License to your work, attach the following
      boilerplate notice, with the fields enclosed by brackets "[]"
      replaced with your own identifying information. (Don't include
      the brackets!)  The text should be enclosed in the appropriate
      comment syntax for the file format. We also recommend that a
      file or class name and description of purpose be included on the
      same "printed page" as the copyright notice for easier
      identification within third-party archives.

   Copyright [yyyy] [name of copyright owner]

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.


================================================
FILE: NuGet.config
================================================
<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <packageSources>
    <clear />
    <add key="NuGet" value="https://api.nuget.org/v3/index.json" />
  </packageSources>
</configuration>


================================================
FILE: OpenTracing.Contrib.sln
================================================

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.4.33103.184
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{420F640A-E23F-457C-BEC7-1DEAD1C592F1}"
	ProjectSection(SolutionItems) = preProject
		src\Directory.Build.props = src\Directory.Build.props
	EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{F9AD8B6F-1F59-4678-B9CF-9CD87172A111}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "samples", "samples", "{36333C22-54F7-403C-ABC4-BECE4EE3F52D}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenTracing.Contrib.NetCore", "src\OpenTracing.Contrib.NetCore\OpenTracing.Contrib.NetCore.csproj", "{10729E17-3C79-477B-BBEB-B727D7B5B60B}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{A47B38EB-246E-4CD5-9655-539466C71067}"
	ProjectSection(SolutionItems) = preProject
		.appveyor.yml = .appveyor.yml
		.travis.yml = .travis.yml
		build.ps1 = build.ps1
		Directory.Build.props = Directory.Build.props
		global.json = global.json
		launch-sample.ps1 = launch-sample.ps1
		README.md = README.md
	EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenTracing.Contrib.NetCore.Tests", "test\OpenTracing.Contrib.NetCore.Tests\OpenTracing.Contrib.NetCore.Tests.csproj", "{70707714-F09D-48A7-B6BC-3C58B243A753}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "benchmarks", "benchmarks", "{FCB84E77-6B0A-4969-8DF2-7E74197E29BB}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenTracing.Contrib.NetCore.Benchmarks", "benchmarks\OpenTracing.Contrib.NetCore.Benchmarks\OpenTracing.Contrib.NetCore.Benchmarks.csproj", "{E92B106E-1DEF-43D9-B7FF-30132DB6254B}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "netcoreapp3.1", "netcoreapp3.1", "{02A299C4-1D35-4A37-8258-A3DBEB76D9B0}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Shared", "samples\netcoreapp3.1\Shared\Shared.csproj", "{D537C2F7-00F7-4C7B-8F79-95971C0F2019}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CustomersApi", "samples\netcoreapp3.1\CustomersApi\CustomersApi.csproj", "{A3EB1F40-43D4-4917-A1C3-7102D183EFF8}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FrontendWeb", "samples\netcoreapp3.1\FrontendWeb\FrontendWeb.csproj", "{1B474D5E-B041-4EB9-AA16-6980C26965F3}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OrdersApi", "samples\netcoreapp3.1\OrdersApi\OrdersApi.csproj", "{42CB5830-7366-421A-9588-D7B03CF2478E}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TrafficGenerator", "samples\netcoreapp3.1\TrafficGenerator\TrafficGenerator.csproj", "{CE6A1977-11FB-4192-A533-BB31427B6DE2}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "net6.0", "net6.0", "{03935477-E35E-4EEE-9944-8742E0CB5CFD}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CustomersApi", "samples\net6.0\CustomersApi\CustomersApi.csproj", "{872A3B2E-1A28-4B3C-A83D-7C99513B36FB}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FrontendWeb", "samples\net6.0\FrontendWeb\FrontendWeb.csproj", "{4756D99B-BAA2-4B9E-AAE3-F521C38134DD}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OrdersApi", "samples\net6.0\OrdersApi\OrdersApi.csproj", "{73108F76-DAF0-48A1-9FE7-F17395672316}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Shared", "samples\net6.0\Shared\Shared.csproj", "{85F652F4-BF5E-4CBF-BD1F-5BE305DC4589}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TrafficGenerator", "samples\net6.0\TrafficGenerator\TrafficGenerator.csproj", "{AE063835-3A23-4037-900D-9FFCC3234C8F}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "net7.0", "net7.0", "{E46F4333-859A-4CC5-BD2A-7FE8892861BE}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CustomersApi", "samples\net7.0\CustomersApi\CustomersApi.csproj", "{36742677-A185-47FC-A1C6-028BF0C45CEE}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FrontendWeb", "samples\net7.0\FrontendWeb\FrontendWeb.csproj", "{5613E36C-A0B0-4B9B-80D8-A89470CFA7AF}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OrdersApi", "samples\net7.0\OrdersApi\OrdersApi.csproj", "{48CD3687-6EB7-47CD-A611-8D579FBCBB3B}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Shared", "samples\net7.0\Shared\Shared.csproj", "{B4A8B209-AA79-4C34-9A12-F03E3423B330}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TrafficGenerator", "samples\net7.0\TrafficGenerator\TrafficGenerator.csproj", "{69E6E77E-646D-475A-9B6B-C5511C21B11C}"
EndProject
Global
	GlobalSection(SolutionConfigurationPlatforms) = preSolution
		Debug|Any CPU = Debug|Any CPU
		Release|Any CPU = Release|Any CPU
	EndGlobalSection
	GlobalSection(ProjectConfigurationPlatforms) = postSolution
		{10729E17-3C79-477B-BBEB-B727D7B5B60B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{10729E17-3C79-477B-BBEB-B727D7B5B60B}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{10729E17-3C79-477B-BBEB-B727D7B5B60B}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{10729E17-3C79-477B-BBEB-B727D7B5B60B}.Release|Any CPU.Build.0 = Release|Any CPU
		{70707714-F09D-48A7-B6BC-3C58B243A753}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{70707714-F09D-48A7-B6BC-3C58B243A753}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{70707714-F09D-48A7-B6BC-3C58B243A753}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{70707714-F09D-48A7-B6BC-3C58B243A753}.Release|Any CPU.Build.0 = Release|Any CPU
		{E92B106E-1DEF-43D9-B7FF-30132DB6254B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{E92B106E-1DEF-43D9-B7FF-30132DB6254B}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{E92B106E-1DEF-43D9-B7FF-30132DB6254B}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{E92B106E-1DEF-43D9-B7FF-30132DB6254B}.Release|Any CPU.Build.0 = Release|Any CPU
		{D537C2F7-00F7-4C7B-8F79-95971C0F2019}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{D537C2F7-00F7-4C7B-8F79-95971C0F2019}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{D537C2F7-00F7-4C7B-8F79-95971C0F2019}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{D537C2F7-00F7-4C7B-8F79-95971C0F2019}.Release|Any CPU.Build.0 = Release|Any CPU
		{A3EB1F40-43D4-4917-A1C3-7102D183EFF8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{A3EB1F40-43D4-4917-A1C3-7102D183EFF8}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{A3EB1F40-43D4-4917-A1C3-7102D183EFF8}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{A3EB1F40-43D4-4917-A1C3-7102D183EFF8}.Release|Any CPU.Build.0 = Release|Any CPU
		{1B474D5E-B041-4EB9-AA16-6980C26965F3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{1B474D5E-B041-4EB9-AA16-6980C26965F3}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{1B474D5E-B041-4EB9-AA16-6980C26965F3}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{1B474D5E-B041-4EB9-AA16-6980C26965F3}.Release|Any CPU.Build.0 = Release|Any CPU
		{42CB5830-7366-421A-9588-D7B03CF2478E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{42CB5830-7366-421A-9588-D7B03CF2478E}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{42CB5830-7366-421A-9588-D7B03CF2478E}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{42CB5830-7366-421A-9588-D7B03CF2478E}.Release|Any CPU.Build.0 = Release|Any CPU
		{CE6A1977-11FB-4192-A533-BB31427B6DE2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{CE6A1977-11FB-4192-A533-BB31427B6DE2}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{CE6A1977-11FB-4192-A533-BB31427B6DE2}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{CE6A1977-11FB-4192-A533-BB31427B6DE2}.Release|Any CPU.Build.0 = Release|Any CPU
		{872A3B2E-1A28-4B3C-A83D-7C99513B36FB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{872A3B2E-1A28-4B3C-A83D-7C99513B36FB}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{872A3B2E-1A28-4B3C-A83D-7C99513B36FB}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{872A3B2E-1A28-4B3C-A83D-7C99513B36FB}.Release|Any CPU.Build.0 = Release|Any CPU
		{4756D99B-BAA2-4B9E-AAE3-F521C38134DD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{4756D99B-BAA2-4B9E-AAE3-F521C38134DD}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{4756D99B-BAA2-4B9E-AAE3-F521C38134DD}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{4756D99B-BAA2-4B9E-AAE3-F521C38134DD}.Release|Any CPU.Build.0 = Release|Any CPU
		{73108F76-DAF0-48A1-9FE7-F17395672316}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{73108F76-DAF0-48A1-9FE7-F17395672316}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{73108F76-DAF0-48A1-9FE7-F17395672316}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{73108F76-DAF0-48A1-9FE7-F17395672316}.Release|Any CPU.Build.0 = Release|Any CPU
		{85F652F4-BF5E-4CBF-BD1F-5BE305DC4589}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{85F652F4-BF5E-4CBF-BD1F-5BE305DC4589}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{85F652F4-BF5E-4CBF-BD1F-5BE305DC4589}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{85F652F4-BF5E-4CBF-BD1F-5BE305DC4589}.Release|Any CPU.Build.0 = Release|Any CPU
		{AE063835-3A23-4037-900D-9FFCC3234C8F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{AE063835-3A23-4037-900D-9FFCC3234C8F}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{AE063835-3A23-4037-900D-9FFCC3234C8F}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{AE063835-3A23-4037-900D-9FFCC3234C8F}.Release|Any CPU.Build.0 = Release|Any CPU
		{36742677-A185-47FC-A1C6-028BF0C45CEE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{36742677-A185-47FC-A1C6-028BF0C45CEE}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{36742677-A185-47FC-A1C6-028BF0C45CEE}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{36742677-A185-47FC-A1C6-028BF0C45CEE}.Release|Any CPU.Build.0 = Release|Any CPU
		{5613E36C-A0B0-4B9B-80D8-A89470CFA7AF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{5613E36C-A0B0-4B9B-80D8-A89470CFA7AF}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{5613E36C-A0B0-4B9B-80D8-A89470CFA7AF}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{5613E36C-A0B0-4B9B-80D8-A89470CFA7AF}.Release|Any CPU.Build.0 = Release|Any CPU
		{48CD3687-6EB7-47CD-A611-8D579FBCBB3B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{48CD3687-6EB7-47CD-A611-8D579FBCBB3B}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{48CD3687-6EB7-47CD-A611-8D579FBCBB3B}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{48CD3687-6EB7-47CD-A611-8D579FBCBB3B}.Release|Any CPU.Build.0 = Release|Any CPU
		{B4A8B209-AA79-4C34-9A12-F03E3423B330}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{B4A8B209-AA79-4C34-9A12-F03E3423B330}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{B4A8B209-AA79-4C34-9A12-F03E3423B330}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{B4A8B209-AA79-4C34-9A12-F03E3423B330}.Release|Any CPU.Build.0 = Release|Any CPU
		{69E6E77E-646D-475A-9B6B-C5511C21B11C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{69E6E77E-646D-475A-9B6B-C5511C21B11C}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{69E6E77E-646D-475A-9B6B-C5511C21B11C}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{69E6E77E-646D-475A-9B6B-C5511C21B11C}.Release|Any CPU.Build.0 = Release|Any CPU
	EndGlobalSection
	GlobalSection(SolutionProperties) = preSolution
		HideSolutionNode = FALSE
	EndGlobalSection
	GlobalSection(NestedProjects) = preSolution
		{10729E17-3C79-477B-BBEB-B727D7B5B60B} = {420F640A-E23F-457C-BEC7-1DEAD1C592F1}
		{70707714-F09D-48A7-B6BC-3C58B243A753} = {F9AD8B6F-1F59-4678-B9CF-9CD87172A111}
		{E92B106E-1DEF-43D9-B7FF-30132DB6254B} = {FCB84E77-6B0A-4969-8DF2-7E74197E29BB}
		{02A299C4-1D35-4A37-8258-A3DBEB76D9B0} = {36333C22-54F7-403C-ABC4-BECE4EE3F52D}
		{D537C2F7-00F7-4C7B-8F79-95971C0F2019} = {02A299C4-1D35-4A37-8258-A3DBEB76D9B0}
		{A3EB1F40-43D4-4917-A1C3-7102D183EFF8} = {02A299C4-1D35-4A37-8258-A3DBEB76D9B0}
		{1B474D5E-B041-4EB9-AA16-6980C26965F3} = {02A299C4-1D35-4A37-8258-A3DBEB76D9B0}
		{42CB5830-7366-421A-9588-D7B03CF2478E} = {02A299C4-1D35-4A37-8258-A3DBEB76D9B0}
		{CE6A1977-11FB-4192-A533-BB31427B6DE2} = {02A299C4-1D35-4A37-8258-A3DBEB76D9B0}
		{03935477-E35E-4EEE-9944-8742E0CB5CFD} = {36333C22-54F7-403C-ABC4-BECE4EE3F52D}
		{872A3B2E-1A28-4B3C-A83D-7C99513B36FB} = {03935477-E35E-4EEE-9944-8742E0CB5CFD}
		{4756D99B-BAA2-4B9E-AAE3-F521C38134DD} = {03935477-E35E-4EEE-9944-8742E0CB5CFD}
		{73108F76-DAF0-48A1-9FE7-F17395672316} = {03935477-E35E-4EEE-9944-8742E0CB5CFD}
		{85F652F4-BF5E-4CBF-BD1F-5BE305DC4589} = {03935477-E35E-4EEE-9944-8742E0CB5CFD}
		{AE063835-3A23-4037-900D-9FFCC3234C8F} = {03935477-E35E-4EEE-9944-8742E0CB5CFD}
		{E46F4333-859A-4CC5-BD2A-7FE8892861BE} = {36333C22-54F7-403C-ABC4-BECE4EE3F52D}
		{36742677-A185-47FC-A1C6-028BF0C45CEE} = {E46F4333-859A-4CC5-BD2A-7FE8892861BE}
		{5613E36C-A0B0-4B9B-80D8-A89470CFA7AF} = {E46F4333-859A-4CC5-BD2A-7FE8892861BE}
		{48CD3687-6EB7-47CD-A611-8D579FBCBB3B} = {E46F4333-859A-4CC5-BD2A-7FE8892861BE}
		{B4A8B209-AA79-4C34-9A12-F03E3423B330} = {E46F4333-859A-4CC5-BD2A-7FE8892861BE}
		{69E6E77E-646D-475A-9B6B-C5511C21B11C} = {E46F4333-859A-4CC5-BD2A-7FE8892861BE}
	EndGlobalSection
	GlobalSection(ExtensibilityGlobals) = postSolution
		SolutionGuid = {832F86C2-4B74-4259-8073-04EE0C37FBCD}
	EndGlobalSection
EndGlobal


================================================
FILE: README.md
================================================
[![nuget](https://img.shields.io/nuget/v/OpenTracing.Contrib.NetCore.svg?logo=nuget)](https://www.nuget.org/packages/OpenTracing.Contrib.NetCore)

# OpenTracing instrumentation for .NET Core apps

This repository provides OpenTracing instrumentation for .NET Core based applications.
It can be used with any OpenTracing compatible tracer.

_**IMPORTANT:** OpenTracing and OpenCensus have merget to form **[OpenTelemetry](https://opentelemetry.io)**! The OpenTelemetry .NET library can be found at [https://github.com/open-telemetry/opentelemetry-dotnet](https://github.com/open-telemetry/opentelemetry-dotnet)._

## Supported .NET versions

This project currently only supports apps targeting .NET Core 3.1, .NET 6.0, or .NET 7.0!

This project DOES NOT support the full .NET framework as that uses different instrumentation code.

## Supported libraries and frameworks

#### DiagnosticSource based instrumentation

This project supports any library or framework that uses .NET's [`DiagnosticSource`](https://github.com/dotnet/runtime/blob/master/src/libraries/System.Diagnostics.DiagnosticSource/src/DiagnosticSourceUsersGuide.md)
to instrument its code. It will create a span for every [`Activity`](https://github.com/dotnet/runtime/blob/master/src/libraries/System.Diagnostics.DiagnosticSource/src/ActivityUserGuide.md)
and it will create `span.Log` calls for all other diagnostic events.

To further improve the tracing output, the library provides enhanced instrumentation
(Inject/Extract, tags, configuration options) for the following libraries / frameworks:

* ASP.NET Core
* Entity Framework Core
* System.Net.Http (HttpClient)
* System.Data.SqlClient
* Microsoft.Data.SqlClient

#### Microsoft.Extensions.Logging based instrumentation

This project also adds itself as a logger provider for logging events from the `Microsoft.Extensions.Logging` system.
It will create `span.Log` calls for each logging event, however it will only create them if there is an active span (`ITracer.ActiveSpan`).

## Usage

This project depends on several packages from Microsofts `Microsoft.Extensions.*` stack (e.g. Dependency Injection, Logging)
so its main use case is ASP.NET Core apps and any other Microsoft.Extensions-based console apps.

##### 1. Add the NuGet package `OpenTracing.Contrib.NetCore` to your project.

##### 2. Add the OpenTracing services to your `IServiceCollection` via `services.AddOpenTracing()`.

How you do this depends on how you've setup the `Microsoft.Extensions.DependencyInjection` system in your app.

In ASP.NET Core apps you can add the call to your `ConfigureServices` method (of your `Program.cs` file):

```csharp
public static IWebHost BuildWebHost(string[] args)
{
    return WebHost.CreateDefaultBuilder(args)
        .UseStartup<Startup>()
        .ConfigureServices(services =>
        {
            // Enables and automatically starts the instrumentation!
            services.AddOpenTracing();
        })
        .Build();
}
```

##### 3. Make sure `InstrumentationService`, which implements `IHostedService`, is started.

`InstrumentationService` is responsible for starting and stopping the instrumentation.
The service implements `IHostedService` so **it is automatically started in ASP.NET Core**,
however if you have your own console host, you manually have to call `StartAsync` and `StopAsync`.

Note that .NET Core 2.1 greatly simplified this setup by introducing a generic `HostBuilder` that works similar to the existing `WebHostBuilder` from ASP.NET Core. Have a look at the `TrafficGenerator` sample for an example of a `HostBuilder` based console application.


================================================
FILE: RELEASE.md
================================================
# Release Process

The release process consists of these steps:
1. Create a GitHub release with release notes. The tag name must be a semantic version, prefixed with "v" - e.g. `v0.1.0` or `v0.1.0-rc1`
1. Wait for the AppVeyor build to finish the *tag* build: https://ci.appveyor.com/project/opentracing/csharp-netcore
1. As a signed-in AppVeyor user, click "Deploy" on the build details page and select "NuGet (OpenTracing)".
This will upload the packages to NuGet.org


================================================
FILE: benchmarks/OpenTracing.Contrib.NetCore.Benchmarks/AspNetCore/RequestDiagnosticsBenchmark.cs
================================================
using System;
using System.Net.Http;
using System.Threading.Tasks;
using BenchmarkDotNet.Attributes;
using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc.Testing;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;

namespace OpenTracing.Contrib.NetCore.Benchmarks.AspNetCore
{
    public class TestProgramFactory : WebApplicationFactory<TestProgramFactory>
    {
        protected override IWebHostBuilder CreateWebHostBuilder()
        {
            var host = WebHost.CreateDefaultBuilder()
                // https://stackoverflow.com/a/69776251/5214796
                .UseSetting("TEST_CONTENTROOT_OPENTRACING_CONTRIB_NETCORE_TESTS", "")
                .ConfigureServices(services =>
                {
                })
                .Configure(app =>
                {
                    app.UseRouting();
                    app.UseEndpoints(endpoints =>
                    {
                        endpoints.MapGet("/foo", async context =>
                        {
                            await context.Response.WriteAsync("Hello");
                        });

                        endpoints.MapGet("/exception", _ =>
                        {
                            throw new InvalidOperationException("You shall not pass");
                        });
                    });
                });

            return host;
        }
    }

    public class RequestDiagnosticsBenchmark
    {
        private WebApplicationFactory<TestProgramFactory> _factory;
        private HttpClient _client;

        [Params(InstrumentationMode.None, InstrumentationMode.Noop, InstrumentationMode.Mock)]
        public InstrumentationMode Mode { get; set; }

        [GlobalSetup]
        public void GlobalSetup()
        {
            _factory = new TestProgramFactory()
                .WithWebHostBuilder(x =>
                {
                    x.ConfigureLogging(l => l.ClearProviders());

                    x.ConfigureServices(services =>
                    {
                        services.AddOpenTracingCoreServices(builder =>
                        {
                            builder.AddAspNetCore();
                            builder.AddBenchmarkTracer(Mode);
                        });
                    });
                });

            _client = _factory.CreateClient();
        }

        [GlobalCleanup]
        public void GlobalCleanup()
        {
            _factory.Dispose();
        }

        [Benchmark]
        public async Task GetAsync()
        {
            await _client.GetAsync("/foo");
        }
    }
}


================================================
FILE: benchmarks/OpenTracing.Contrib.NetCore.Benchmarks/CoreFx/HttpHandlerDiagnosticsBenchmark.cs
================================================
using System;
using System.Net;
using System.Net.Http;
using System.Reflection;
using System.Threading;
using System.Threading.Tasks;
using BenchmarkDotNet.Attributes;
using Microsoft.Extensions.DependencyInjection;
using OpenTracing.Contrib.NetCore.Internal;

namespace OpenTracing.Contrib.NetCore.Benchmarks.CoreFx
{
    public class HttpHandlerDiagnosticsBenchmark
    {
        private HttpClient _httpClient;
        private ServiceProvider _serviceProvider;

        [Params(InstrumentationMode.None, InstrumentationMode.Noop, InstrumentationMode.Mock)]
        public InstrumentationMode Mode { get; set; }

        [GlobalSetup]
        public void GlobalSetup()
        {
            _httpClient = CreateHttpClient();

            _serviceProvider = new ServiceCollection()
                .AddLogging()
                .AddOpenTracingCoreServices(builder =>
                {
                    builder.AddBenchmarkTracer(Mode);
                    builder.AddHttpHandler();
                })
                .BuildServiceProvider();

            var diagnosticsManager = _serviceProvider.GetRequiredService<DiagnosticManager>();
            diagnosticsManager.Start();
        }

        [GlobalCleanup]
        public void GlobalCleanup()
        {
            (_serviceProvider as IDisposable).Dispose();
        }

        [Benchmark]
        public Task HttpClient_GetAsync()
        {
            return _httpClient.GetAsync("http://www.example.com");
        }

        private static HttpClient CreateHttpClient()
        {
            // Inner handler for mocking the result
            var httpHandler = new MockHttpMessageHandler();

            // Wrap with DiagnosticsHandler (which is internal :( )
            Type type = typeof(HttpClientHandler).Assembly.GetType("System.Net.Http.DiagnosticsHandler");
            ConstructorInfo constructor = type.GetConstructors(BindingFlags.Instance | BindingFlags.Public)[0];
            HttpMessageHandler diagnosticsHandler = (HttpMessageHandler)constructor.Invoke(new object[] { httpHandler });

            return new HttpClient(diagnosticsHandler);
        }

        private class MockHttpMessageHandler : HttpMessageHandler
        {
            protected override async Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
            {
                // HACK: There MUST be an awaiter otherwise exceptions are not caught by the DiagnosticsHandler.
                // https://github.com/dotnet/corefx/pull/27472
                await Task.CompletedTask;

                return new HttpResponseMessage(HttpStatusCode.OK)
                {
                    RequestMessage = request,
                    Content = new StringContent("Response")
                };
            }
        }
    }
}


================================================
FILE: benchmarks/OpenTracing.Contrib.NetCore.Benchmarks/InstrumentationMode.cs
================================================
namespace OpenTracing.Contrib.NetCore.Benchmarks
{
    public enum InstrumentationMode
    {
        None,
        Noop,
        Mock
    }
}


================================================
FILE: benchmarks/OpenTracing.Contrib.NetCore.Benchmarks/OpenTracing.Contrib.NetCore.Benchmarks.csproj
================================================
<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFrameworks>netcoreapp3.1;net6.0;net7.0</TargetFrameworks>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="BenchmarkDotNet" Version="0.13.2" />
    <PackageReference Include="NSubstitute" Version="4.4.0" />
  </ItemGroup>

  <ItemGroup Condition="$(TargetFramework)=='netcoreapp3.1'">
    <PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="[3.1.31,4)" />
  </ItemGroup>

  <ItemGroup Condition="$(TargetFramework)=='net6.0'">
    <PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="[6.0.11,7)" />
  </ItemGroup>

  <ItemGroup Condition="$(TargetFramework)=='net7.0'">
    <PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="[7.0.0,8)" />
  </ItemGroup>

  <ItemGroup>
    <ProjectReference Include="..\..\src\OpenTracing.Contrib.NetCore\OpenTracing.Contrib.NetCore.csproj" />
  </ItemGroup>

</Project>


================================================
FILE: benchmarks/OpenTracing.Contrib.NetCore.Benchmarks/OpenTracingBuilderExtensions.cs
================================================
using System;
using Microsoft.Extensions.DependencyInjection;
using OpenTracing.Contrib.NetCore.Internal;
using OpenTracing.Mock;
using OpenTracing.Noop;

namespace OpenTracing.Contrib.NetCore.Benchmarks
{
    public static class OpenTracingBuilderExtensions
    {
        public static IOpenTracingBuilder AddBenchmarkTracer(this IOpenTracingBuilder builder, InstrumentationMode mode)
        {
            if (builder == null)
                throw new ArgumentNullException(nameof(builder));

            ITracer tracer = mode == InstrumentationMode.Mock
                ? new MockTracer()
                : NoopTracerFactory.Create();

            bool startInstrumentationForNoopTracer = mode == InstrumentationMode.Noop;

            builder.Services.AddSingleton<ITracer>(tracer);
            builder.Services.Configure<DiagnosticManagerOptions>(options => options.StartInstrumentationForNoopTracer = startInstrumentationForNoopTracer);

            return builder;
        }
    }
}


================================================
FILE: benchmarks/OpenTracing.Contrib.NetCore.Benchmarks/Program.cs
================================================
using BenchmarkDotNet.Running;

namespace OpenTracing.Contrib.NetCore.Benchmarks
{
    class Program
    {
        static void Main(string[] args)
        {
            BenchmarkSwitcher.FromAssembly(typeof(Program).Assembly).Run(args);
        }
    }
}


================================================
FILE: build.ps1
================================================
[CmdletBinding(PositionalBinding = $false)]
param(
    [string] $ArtifactsPath = (Join-Path $PWD "artifacts"),
    [string] $BuildConfiguration = "Release",

    [bool] $RunBuild = $true,
    [bool] $RunTests = $true
)

$ErrorActionPreference = "Stop"
$Stopwatch = [System.Diagnostics.Stopwatch]::StartNew()

function Task {
    [CmdletBinding()] param (
        [Parameter(Mandatory = $true)] [string] $name,
        [Parameter(Mandatory = $false)] [bool] $runTask,
        [Parameter(Mandatory = $false)] [scriptblock] $cmd
    )

    if ($cmd -eq $null) {
        throw "Command is missing for task '$name'. Make sure the starting '{' is on the same line as the term 'Task'. E.g. 'Task `"$name`" `$Run$name {'"
    }

    if ($runTask -eq $true) {
        Write-Host "`n------------------------- [$name] -------------------------`n" -ForegroundColor Cyan
        $sw = [System.Diagnostics.Stopwatch]::StartNew()
        & $cmd
        Write-Host "`nTask '$name' finished in $($sw.Elapsed.TotalSeconds) sec."
    }
    else {
        Write-Host "`n------------------ Skipping task '$name' ------------------" -ForegroundColor Yellow
    }
}


Task "Init" $true {

    if ($ArtifactsPath -eq $null) { "Property 'ArtifactsPath' may not be null." }
    if ($BuildConfiguration -eq $null) { throw "Property 'BuildConfiguration' may not be null." }
    if ((Get-Command "dotnet" -ErrorAction SilentlyContinue) -eq $null) { throw "'dotnet' command not found. Is .NET Core SDK installed?" }

    Write-Host "ArtifactsPath: $ArtifactsPath"
    Write-Host "BuildConfiguration: $BuildConfiguration"
    Write-Host ".NET Core SDK: $(dotnet --version)`n"

    Remove-Item -Path $ArtifactsPath -Recurse -Force -ErrorAction Ignore
    New-Item $ArtifactsPath -ItemType Directory -ErrorAction Ignore | Out-Null
    Write-Host "Created artifacts folder '$ArtifactsPath'"
}

Task "Build" $RunBuild {

    dotnet msbuild "/t:Restore;Build;Pack" "/p:CI=true" `
        "/p:Configuration=$BuildConfiguration" `
        "/p:PackageOutputPath=$(Join-Path $ArtifactsPath "nuget")"

    if ($LASTEXITCODE -ne 0) { throw "Build failed." }
}

Task "Tests" $RunTests {

    $testsFailed = $false
    Get-ChildItem -Filter *.csproj -Recurse | ForEach-Object {

        if (Select-Xml -Path $_.FullName -XPath "/Project/ItemGroup/PackageReference[@Include='Microsoft.NET.Test.Sdk']") {
            dotnet test $_.FullName -c $BuildConfiguration --no-build
            if ($LASTEXITCODE -ne 0) { $testsFailed = $true }
        }
    }

    if ($testsFailed) { throw "At least one test failed." }
}

Write-Host "`nBuild finished in $($Stopwatch.Elapsed.TotalSeconds) sec." -ForegroundColor Green


================================================
FILE: global.json
================================================
{
  "sdk": {
    "version": "7.0.100",
     "rollForward": "feature"
  }
}


================================================
FILE: launch-sample.ps1
================================================
[CmdletBinding(PositionalBinding = $false)]
param(
    [ValidateSet("net7.0", "net6.0", "netcoreapp3.1")]
    [string] $Framework = "net6.0"
)

dotnet build
if ($LASTEXITCODE -ne 0) { throw "build error" }

Write-Host "Launching samples with framework $Framework"

Start-Process `
    -FilePath powershell.exe `
    -ArgumentList @( "dotnet run -f $Framework --no-build; Read-Host 'Press enter to exit'" ) `
    -WorkingDirectory "samples\$Framework\CustomersApi"

Start-Sleep -Seconds 2

Start-Process `
    -FilePath powershell.exe `
    -ArgumentList @( "dotnet run -f $Framework --no-build; Read-Host 'Press enter to exit'" ) `
    -WorkingDirectory "samples\$Framework\OrdersApi"

Start-Sleep -Seconds 5

Start-Process `
    -FilePath powershell.exe `
    -ArgumentList @( "dotnet run -f $Framework --no-build; Read-Host 'Press enter to exit'" ) `
    -WorkingDirectory "samples\$Framework\FrontendWeb"

Start-Process `
    -FilePath powershell.exe `
    -ArgumentList @( "dotnet run -f $Framework --no-build; Read-Host 'Press enter to exit'" ) `
    -WorkingDirectory "samples\$Framework\TrafficGenerator"


================================================
FILE: samples/net6.0/CustomersApi/Controllers/CustomersController.cs
================================================
using System.Linq;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using Samples.CustomersApi.DataStore;

namespace Samples.CustomersApi.Controllers
{
    [Route("customers")]
    public class CustomersController : Controller
    {
        private readonly CustomerDbContext _dbContext;
        private readonly ILogger _logger;

        public CustomersController(CustomerDbContext dbContext, ILogger<CustomersController> logger)
        {
            _dbContext = dbContext;
            _logger = logger;
        }

        [HttpGet]
        public IActionResult Index()
        {
            return Json(_dbContext.Customers.ToList());
        }

        [HttpGet("{id:int}")]
        public IActionResult Index(int id)
        {
            var customer = _dbContext.Customers.FirstOrDefault(x => x.CustomerId == id);

            if (customer == null)
                return NotFound();

            // ILogger events are sent to OpenTracing as well!
            _logger.LogInformation("Returning data for customer {CustomerId}", id);

            return Json(customer);
        }
    }
}


================================================
FILE: samples/net6.0/CustomersApi/CustomersApi.csproj
================================================
<Project Sdk="Microsoft.NET.Sdk.Web">

  <PropertyGroup>
    <TargetFrameworks>net6.0</TargetFrameworks>
  </PropertyGroup>

  <ItemGroup>
    <ProjectReference Include="..\Shared\Shared.csproj" />
    <ProjectReference Include="..\..\..\src\OpenTracing.Contrib.NetCore\OpenTracing.Contrib.NetCore.csproj" />
  </ItemGroup>

  <ItemGroup>
    <PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="[6.0.11,7)" />
    <PackageReference Include="Microsoft.Extensions.Diagnostics.HealthChecks.EntityFrameworkCore" Version="[6.0.11,7)" />
  </ItemGroup>

</Project>


================================================
FILE: samples/net6.0/CustomersApi/DataStore/CustomerDbContext.cs
================================================
using Microsoft.EntityFrameworkCore;
using Shared;

namespace Samples.CustomersApi.DataStore
{
    public class CustomerDbContext : DbContext
    {
        public CustomerDbContext(DbContextOptions<CustomerDbContext> options)
            : base(options)
        {
        }

        public DbSet<Customer> Customers { get; set; }

        public void Seed()
        {
            if (Database.EnsureCreated())
            {
                Database.Migrate();

                Customers.Add(new Customer(1, "Marcel Belding"));
                Customers.Add(new Customer(2, "Phyllis Schriver"));
                Customers.Add(new Customer(3, "Estefana Balderrama"));
                Customers.Add(new Customer(4, "Kenyetta Lone"));
                Customers.Add(new Customer(5, "Vernita Fernald"));
                Customers.Add(new Customer(6, "Tessie Storrs"));

                SaveChanges();
            }
        }
    }
}


================================================
FILE: samples/net6.0/CustomersApi/Program.cs
================================================
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Shared;

namespace Samples.CustomersApi
{
    public class Program
    {
        public static void Main(string[] args)
        {
            CreateHostBuilder(args).Build().Run();
        }

        public static IHostBuilder CreateHostBuilder(string[] args)
        {
            return Host.CreateDefaultBuilder(args)
                .ConfigureWebHostDefaults(webBuilder =>
                {
                    webBuilder
                        .UseStartup<Startup>()
                        .UseUrls(Constants.CustomersUrl);
                })
                .ConfigureServices(services =>
                {
                    // Registers and starts Jaeger (see Shared.JaegerServiceCollectionExtensions)
                    services.AddJaeger();

                    // Enables OpenTracing instrumentation for ASP.NET Core, CoreFx, EF Core
                    services.AddOpenTracing(builder =>
                    {
                        builder.ConfigureAspNetCore(options =>
                        {
                            // We don't need any tracing data for our health endpoint.
                            options.Hosting.IgnorePatterns.Add(ctx => ctx.Request.Path == "/health");
                        });

                        builder.ConfigureEntityFrameworkCore(options =>
                        {
                            // This is an example for how certain EF Core commands can be ignored.
                            // As en example, we're ignoring the "PRAGMA foreign_keys=ON;" commands that are executed by Sqlite.
                            // Remove this code to see those statements.
                            options.IgnorePatterns.Add(cmd => cmd.Command.CommandText.StartsWith("PRAGMA"));
                        });
                    });

                });
        }
    }
}


================================================
FILE: samples/net6.0/CustomersApi/Properties/launchSettings.json
================================================
{
  "profiles": {
    "CustomersApi": {
      "commandName": "Project",
      "launchBrowser": false,
      "launchUrl": "http://localhost:5001",
      "environmentVariables": {
        "ASPNETCORE_ENVIRONMENT": "Development"
      }
    }
  }
}


================================================
FILE: samples/net6.0/CustomersApi/Startup.cs
================================================
using System;
using Microsoft.AspNetCore.Builder;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.DependencyInjection;
using Samples.CustomersApi.DataStore;

namespace Samples.CustomersApi
{
    public class Startup
    {
        public void ConfigureServices(IServiceCollection services)
        {
            // Adds a Sqlite DB to show EFCore traces.
            services
                .AddDbContext<CustomerDbContext>(options =>
                {
                    options.UseSqlite("Data Source=DataStore/customers.db");
                });

            services.AddMvc();

            services.AddHealthChecks()
                .AddDbContextCheck<CustomerDbContext>();
        }

        public void Configure(IApplicationBuilder app)
        {
            // Load some dummy data into the db.
            BootstrapDataStore(app.ApplicationServices);

            app.UseDeveloperExceptionPage();

            app.UseRouting();

            app.UseAuthentication();
            app.UseAuthorization();

            app.UseEndpoints(endpoints =>
            {
                endpoints.MapControllers();
                endpoints.MapHealthChecks("/health");
            });
        }

        private void BootstrapDataStore(IServiceProvider serviceProvider)
        {
            using (var scope = serviceProvider.CreateScope())
            {
                var dbContext = scope.ServiceProvider.GetRequiredService<CustomerDbContext>();
                dbContext.Seed();
            }
        }
    }
}


================================================
FILE: samples/net6.0/CustomersApi/appsettings.json
================================================
{
  "Logging": {
    "IncludeScopes": false,
    "LogLevel": {
      "Default": "Debug",
      "System": "Information",
      "Microsoft": "Information"
    }
  }
}


================================================
FILE: samples/net6.0/FrontendWeb/Controllers/HomeController.cs
================================================
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using Shared;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Rendering;
using Newtonsoft.Json;

namespace Samples.FrontendWeb.Controllers
{
    public class HomeController : Controller
    {
        private readonly HttpClient _httpClient;

        public HomeController(HttpClient httpClient)
        {
            _httpClient = httpClient;
        }

        [HttpGet]
        public IActionResult Index()
        {
            return View();
        }

        [HttpGet]
        public async Task<IActionResult> PlaceOrder()
        {
            ViewBag.Customers = await GetCustomers();
            return View(new PlaceOrderCommand { ItemNumber = "ABC11", Quantity = 1 });
        }

        [HttpPost, ValidateAntiForgeryToken]
        public async Task<IActionResult> PlaceOrder(PlaceOrderCommand cmd)
        {
            if (!ModelState.IsValid)
            {
                ViewBag.Customers = await GetCustomers();
                return View(cmd);
            }

            string body = JsonConvert.SerializeObject(cmd);

            var request = new HttpRequestMessage
            {
                Method = HttpMethod.Post,
                RequestUri = new Uri(Constants.OrdersUrl + "orders"),
                Content = new StringContent(body, Encoding.UTF8, "application/json")
            };
            
            await _httpClient.SendAsync(request);

            return RedirectToAction("Index");
        }

        private async Task<IEnumerable<SelectListItem>> GetCustomers()
        {
            var request = new HttpRequestMessage
            {
                Method = HttpMethod.Get,
                RequestUri = new Uri(Constants.CustomersUrl + "customers")
            };

            var response = await _httpClient.SendAsync(request);

            response.EnsureSuccessStatusCode();

            var body = await response.Content.ReadAsStringAsync();

            return JsonConvert.DeserializeObject<List<Customer>>(body)
                .Select(x => new SelectListItem { Value = x.CustomerId.ToString(), Text = x.Name });
        }
    }
}


================================================
FILE: samples/net6.0/FrontendWeb/FrontendWeb.csproj
================================================
<Project Sdk="Microsoft.NET.Sdk.Web">

  <PropertyGroup>
    <TargetFrameworks>net6.0</TargetFrameworks>
  </PropertyGroup>

  <ItemGroup>
    <ProjectReference Include="..\Shared\Shared.csproj" />
    <ProjectReference Include="..\..\..\src\OpenTracing.Contrib.NetCore\OpenTracing.Contrib.NetCore.csproj" />
  </ItemGroup>

</Project>


================================================
FILE: samples/net6.0/FrontendWeb/Program.cs
================================================
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Shared;

namespace Samples.FrontendWeb
{
    public class Program
    {
        public static void Main(string[] args)
        {
            CreateHostBuilder(args).Build().Run();
        }

        public static IHostBuilder CreateHostBuilder(string[] args)
        {
            return Host.CreateDefaultBuilder(args)
                .ConfigureWebHostDefaults(webBuilder =>
                {
                    webBuilder
                        .UseStartup<Startup>()
                        .UseUrls(Constants.FrontendUrl);
                })
                .ConfigureServices(services =>
                {
                    // Registers and starts Jaeger (see Shared.JaegerServiceCollectionExtensions)
                    services.AddJaeger();

                    // Enables OpenTracing instrumentation for ASP.NET Core, CoreFx, EF Core
                    services.AddOpenTracing();
                });
        }
    }
}


================================================
FILE: samples/net6.0/FrontendWeb/Properties/launchSettings.json
================================================
{
  "profiles": {
    "FrontendWeb": {
      "commandName": "Project",
      "launchBrowser": false,
      "launchUrl": "http://localhost:5000",
      "environmentVariables": {
        "ASPNETCORE_ENVIRONMENT": "Development"
      }
    }
  }
}


================================================
FILE: samples/net6.0/FrontendWeb/Startup.cs
================================================
using System.Net.Http;
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.DependencyInjection;

namespace Samples.FrontendWeb
{
    public class Startup
    {
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddSingleton<HttpClient>();

            services.AddMvc();
        }

        public void Configure(IApplicationBuilder app)
        {
            app.UseDeveloperExceptionPage();

            app.UseRouting();

            app.UseAuthentication();
            app.UseAuthorization();

            app.UseEndpoints(endpoints =>
            {
                endpoints.MapDefaultControllerRoute();
            });
        }
    }
}


================================================
FILE: samples/net6.0/FrontendWeb/Views/Home/Index.cshtml
================================================
<!DOCTYPE html>
<meta charset="utf-8">
<title>FrontendWeb</title>
<h1>FrontendWeb</h1>
<p>This is the beautiful web frontend.</p>
<p>Refresh this page a few times and check the Jaeger UI - you should already see traces!</p>

<p><a asp-action="PlaceOrder">Place an order</a></p>


================================================
FILE: samples/net6.0/FrontendWeb/Views/Home/PlaceOrder.cshtml
================================================
@model Shared.PlaceOrderCommand
<!DOCTYPE html>
<meta charset="utf-8">
<title>FrontendWeb</title>
<h1>FrontendWeb</h1>
<p>Place an order</p>

<form asp-action="PlaceOrder" asp-antiforgery="true">
    <div>Customer: @Html.DropDownListFor(x => x.CustomerId, (IEnumerable<SelectListItem>)ViewBag.Customers)</div>
    <div>ItemNumber: @Html.TextBoxFor(x => x.ItemNumber)</div>
    <div>Quantity: @Html.TextBoxFor(x => x.Quantity)</div>
    <input type="submit" value="Place order"/>
</form>


================================================
FILE: samples/net6.0/FrontendWeb/Views/_ViewImports.cshtml
================================================
@using Samples.FrontendWeb
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers

================================================
FILE: samples/net6.0/FrontendWeb/appsettings.json
================================================
{
  "Logging": {
    "IncludeScopes": false,
    "LogLevel": {
      "Default": "Debug",
      "System": "Information",
      "Microsoft": "Information",
      "OpenTracing": "Debug"
    }
  }
}


================================================
FILE: samples/net6.0/OrdersApi/Controllers/OrdersController.cs
================================================
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using Newtonsoft.Json;
using OpenTracing;
using OrdersApi.DataStore;
using Shared;

namespace Samples.OrdersApi.Controllers
{
    [Route("orders")]
    public class OrdersController : Controller
    {
        private readonly OrdersDbContext _dbContext;
        private readonly HttpClient _httpClient;
        private readonly ITracer _tracer;

        public OrdersController(OrdersDbContext dbContext, HttpClient httpClient, ITracer tracer)
        {
            _dbContext = dbContext ?? throw new ArgumentNullException(nameof(dbContext));
            _httpClient = httpClient ?? throw new ArgumentNullException(nameof(httpClient));
            _tracer = tracer ?? throw new ArgumentNullException(nameof(tracer));
        }

        [HttpGet]
        public async Task<IActionResult> Index()
        {
            var orders = await _dbContext.Orders.ToListAsync();

            return Ok(orders.Select(x => new { x.OrderId }).ToList());
        }

        [HttpPost]
        public async Task<IActionResult> Index([FromBody] PlaceOrderCommand cmd)
        {
            var customer = await GetCustomer(cmd.CustomerId.Value);

            var order = new Order
            {
                CustomerId = cmd.CustomerId.Value,
                ItemNumber = cmd.ItemNumber,
                Quantity = cmd.Quantity
            };

            _dbContext.Orders.Add(order);

            await _dbContext.SaveChangesAsync();

            _tracer.ActiveSpan?.Log(new Dictionary<string, object> {
                { "event", "OrderPlaced" },
                { "orderId", order.OrderId },
                { "customer", order.CustomerId },
                { "customer_name", customer.Name },
                { "item_number", order.ItemNumber },
                { "quantity", order.Quantity }
            });

            return Ok();
        }

        private async Task<Customer> GetCustomer(int customerId)
        {
            var request = new HttpRequestMessage
            {
                Method = HttpMethod.Get,
                RequestUri = new Uri(Constants.CustomersUrl + "customers/" + customerId)
            };

            var response = await _httpClient.SendAsync(request);

            response.EnsureSuccessStatusCode();

            var body = await response.Content.ReadAsStringAsync();

            return JsonConvert.DeserializeObject<Customer>(body);
        }
    }
}


================================================
FILE: samples/net6.0/OrdersApi/DataStore/Order.cs
================================================
using System;
using System.ComponentModel.DataAnnotations;

namespace OrdersApi.DataStore
{
    public class Order
    {
        [Key]
        public int OrderId { get; set; }
        
        public int CustomerId { get; set; }

        [Required, StringLength(10)]
        public string ItemNumber { get; set; }

        [Required, Range(1, 100)]
        public int Quantity { get; set; }
    }
}


================================================
FILE: samples/net6.0/OrdersApi/DataStore/OrdersDbContext.cs
================================================
using Microsoft.EntityFrameworkCore;

namespace OrdersApi.DataStore
{
    public class OrdersDbContext : DbContext
    {
        public OrdersDbContext(DbContextOptions<OrdersDbContext> options)
            : base(options)
        {
        }

        public DbSet<Order> Orders { get; set; }

        public void Seed()
        {
            if (Database.EnsureCreated())
            {
                Database.Migrate();

                SaveChanges();
            }
        }
    }
}


================================================
FILE: samples/net6.0/OrdersApi/OrdersApi.csproj
================================================
<Project Sdk="Microsoft.NET.Sdk.Web">

  <PropertyGroup>
    <TargetFrameworks>net6.0</TargetFrameworks>
  </PropertyGroup>

  <ItemGroup>
    <ProjectReference Include="..\Shared\Shared.csproj" />
    <ProjectReference Include="..\..\..\src\OpenTracing.Contrib.NetCore\OpenTracing.Contrib.NetCore.csproj" />
  </ItemGroup>

  <ItemGroup>
    <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="[6.0.11,7)" />
    <PackageReference Include="Microsoft.Extensions.Diagnostics.HealthChecks.EntityFrameworkCore" Version="[6.0.11,7)" />
  </ItemGroup>

</Project>


================================================
FILE: samples/net6.0/OrdersApi/Program.cs
================================================
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Shared;

namespace Samples.OrdersApi
{
    public class Program
    {
        public static void Main(string[] args)
        {
            CreateHostBuilder(args).Build().Run();
        }

        public static IHostBuilder CreateHostBuilder(string[] args)
        {
            return Host.CreateDefaultBuilder(args)
                .ConfigureWebHostDefaults(webBuilder =>
                {
                    webBuilder
                        .UseStartup<Startup>()
                        .UseUrls(Constants.OrdersUrl);
                })
                .ConfigureServices(services =>
                {
                    // Registers and starts Jaeger (see Shared.JaegerServiceCollectionExtensions)
                    services.AddJaeger();

                    // Enables OpenTracing instrumentation for ASP.NET Core, CoreFx, EF Core
                    services.AddOpenTracing(builder =>
                    {
                        builder.ConfigureAspNetCore(options =>
                        {
                            // We don't need any tracing data for our health endpoint.
                            options.Hosting.IgnorePatterns.Add(ctx => ctx.Request.Path == "/health");
                        });
                    });
                });
        }
    }
}


================================================
FILE: samples/net6.0/OrdersApi/Properties/launchSettings.json
================================================
{
  "profiles": {
    "OrdersApi": {
      "commandName": "Project",
      "launchBrowser": false,
      "launchUrl": "http://localhost:5002",
      "environmentVariables": {
        "ASPNETCORE_ENVIRONMENT": "Development"
      }
    }
  }
}


================================================
FILE: samples/net6.0/OrdersApi/Startup.cs
================================================
using System;
using System.Net.Http;
using Microsoft.AspNetCore.Builder;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.DependencyInjection;
using OrdersApi.DataStore;

namespace Samples.OrdersApi
{
    public class Startup
    {
        public void ConfigureServices(IServiceCollection services)
        {
            // Adds a SqlServer DB to show EFCore traces.
            services
                .AddDbContext<OrdersDbContext>(options =>
                {
                    options.UseSqlServer("Server=(localdb)\\mssqllocaldb;Database=Orders-net5;Trusted_Connection=True;MultipleActiveResultSets=true");
                });

            services.AddSingleton<HttpClient>();

            services.AddMvc();

            services.AddHealthChecks()
                .AddDbContextCheck<OrdersDbContext>();
        }

        public void Configure(IApplicationBuilder app)
        {
            // Load some dummy data into the db.
            BootstrapDataStore(app.ApplicationServices);

            app.UseDeveloperExceptionPage();

            app.UseRouting();

            app.UseAuthentication();
            app.UseAuthorization();

            app.UseEndpoints(endpoints =>
            {
                endpoints.MapDefaultControllerRoute();
                endpoints.MapHealthChecks("/health");
            });
        }

        private void BootstrapDataStore(IServiceProvider serviceProvider)
        {
            using (var scope = serviceProvider.CreateScope())
            {
                var dbContext = scope.ServiceProvider.GetRequiredService<OrdersDbContext>();
                dbContext.Seed();
            }
        }
    }
}


================================================
FILE: samples/net6.0/OrdersApi/appsettings.json
================================================
{
  "Logging": {
    "IncludeScopes": false,
    "LogLevel": {
      "Default": "Debug",
      "System": "Information",
      "Microsoft": "Information"
    }
  }
}


================================================
FILE: samples/net6.0/Shared/Constants.cs
================================================
namespace Shared
{
    public class Constants
    {
        public const string FrontendUrl = "http://localhost:5000/";

        public const string CustomersUrl = "http://localhost:5001/";

        public const string OrdersUrl = "http://localhost:5002/";
    }
}


================================================
FILE: samples/net6.0/Shared/Customer.cs
================================================
namespace Shared
{
    public class Customer
    {
        public int CustomerId { get; set; }
        public string Name { get; set; }

        public Customer()
        {
        }

        public Customer(int customerId, string name)
        {
            CustomerId = customerId;
            Name = name;
        }
    }
}


================================================
FILE: samples/net6.0/Shared/JaegerServiceCollectionExtensions.cs
================================================
using System;
using System.Reflection;
using Jaeger;
using Jaeger.Reporters;
using Jaeger.Samplers;
using Jaeger.Senders.Thrift;
using Microsoft.Extensions.Logging;
using OpenTracing;
using OpenTracing.Contrib.NetCore.Configuration;
using OpenTracing.Util;

namespace Microsoft.Extensions.DependencyInjection
{
    public static class JaegerServiceCollectionExtensions
    {
        private static readonly Uri _jaegerUri = new Uri("http://localhost:14268/api/traces");

        public static IServiceCollection AddJaeger(this IServiceCollection services)
        {
            if (services == null)
                throw new ArgumentNullException(nameof(services));

            services.AddSingleton<ITracer>(serviceProvider =>
            {
                string serviceName = Assembly.GetEntryAssembly().GetName().Name;

                ILoggerFactory loggerFactory = serviceProvider.GetRequiredService<ILoggerFactory>();

                ISampler sampler = new ConstSampler(sample: true);

                IReporter reporter = new RemoteReporter.Builder()
                    .WithSender(new HttpSender.Builder(_jaegerUri.ToString()).Build())
                    .Build();

                ITracer tracer = new Tracer.Builder(serviceName)
                    .WithLoggerFactory(loggerFactory)
                    .WithSampler(sampler)
                    .WithReporter(reporter)
                    .Build();

                GlobalTracer.Register(tracer);

                return tracer;
            });

            // Prevent endless loops when OpenTracing is tracking HTTP requests to Jaeger.
            services.Configure<HttpHandlerDiagnosticOptions>(options =>
            {
                options.IgnorePatterns.Add(request => _jaegerUri.IsBaseOf(request.RequestUri));
            });

            return services;
        }
    }
}


================================================
FILE: samples/net6.0/Shared/PlaceOrderCommand.cs
================================================
using System.ComponentModel.DataAnnotations;

namespace Shared
{
    public class PlaceOrderCommand
    {
        [Required]
        public int? CustomerId { get; set; }

        [Required, StringLength(10)]
        public string ItemNumber { get; set; }

        [Required, Range(1, 100)]
        public int Quantity { get; set; }
    }
}


================================================
FILE: samples/net6.0/Shared/Shared.csproj
================================================
<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <TargetFrameworks>net6.0</TargetFrameworks>
  </PropertyGroup>

  <ItemGroup>
    <ProjectReference Include="..\..\..\src\OpenTracing.Contrib.NetCore\OpenTracing.Contrib.NetCore.csproj" />
  </ItemGroup>

  <ItemGroup>
    <PackageReference Include="Jaeger" Version="1.0.3" />
    <PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="[6.0.0,7)" />
    <PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="[6.0.0,7)" />
    <PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="[6.0.3,7)" />
  </ItemGroup>

</Project>


================================================
FILE: samples/net6.0/TrafficGenerator/Program.cs
================================================
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;

namespace TrafficGenerator
{
    class Program
    {
        public static void Main(string[] args)
        {
            CreateHostBuilder(args).Build().Run();
        }

        public static IHostBuilder CreateHostBuilder(string[] args) =>
            Host.CreateDefaultBuilder(args)
                .ConfigureServices(services =>
                {
                    // Registers and starts Jaeger (see Shared.JaegerServiceCollectionExtensions)
                    services.AddJaeger();

                    services.AddOpenTracing();

                    services.AddHostedService<Worker>();
                });
    }
}


================================================
FILE: samples/net6.0/TrafficGenerator/TrafficGenerator.csproj
================================================
<Project Sdk="Microsoft.NET.Sdk.Worker">

  <PropertyGroup>
    <TargetFramework>net6.0</TargetFramework>
  </PropertyGroup>

  <ItemGroup>
    <ProjectReference Include="..\Shared\Shared.csproj" />
    <ProjectReference Include="..\..\..\src\OpenTracing.Contrib.NetCore\OpenTracing.Contrib.NetCore.csproj" />
  </ItemGroup>

</Project>


================================================
FILE: samples/net6.0/TrafficGenerator/Worker.cs
================================================
using System;
using System.Net.Http;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using Shared;

namespace TrafficGenerator
{
    public class Worker : BackgroundService
    {
        private readonly ILogger<Worker> _logger;

        public Worker(ILogger<Worker> logger)
        {
            _logger = logger ?? throw new ArgumentNullException(nameof(logger));
        }

        protected override async Task ExecuteAsync(CancellationToken stoppingToken)
        {
            try
            {
                HttpClient customersHttpClient = new HttpClient();
                customersHttpClient.BaseAddress = new Uri(Constants.CustomersUrl);

                HttpClient ordersHttpClient = new HttpClient();
                ordersHttpClient.BaseAddress = new Uri(Constants.OrdersUrl);


                while (!stoppingToken.IsCancellationRequested)
                {
                    HttpResponseMessage ordershealthResponse = await ordersHttpClient.GetAsync("health");
                    _logger.LogInformation($"Health of 'orders'-endpoint: '{ordershealthResponse.StatusCode}'");

                    HttpResponseMessage customersHealthResponse = await customersHttpClient.GetAsync("health");
                    _logger.LogInformation($"Health of 'customers'-endpoint: '{customersHealthResponse.StatusCode}'");

                    _logger.LogInformation("Requesting customers");

                    HttpResponseMessage response = await customersHttpClient.GetAsync("customers");

                    _logger.LogInformation($"Response was '{response.StatusCode}'");

                    await Task.Delay(TimeSpan.FromSeconds(5), stoppingToken);
                }
            }
            catch (TaskCanceledException)
            {
                /* Application should be stopped -> no-op */
            }
            catch (Exception ex)
            {
                _logger.LogError(ex, "Unhandled exception");
            }
        }
    }
}


================================================
FILE: samples/net6.0/TrafficGenerator/appsettings.json
================================================
{
  "Logging": {
    "LogLevel": {
      "Default": "Debug",
      "System": "Information",
      "Microsoft": "Warning",
      "Microsoft.AspNetCore.Hosting": "Information"
    }
  }
}


================================================
FILE: samples/net7.0/CustomersApi/CustomersApi.csproj
================================================
<Project Sdk="Microsoft.NET.Sdk.Web">

  <PropertyGroup>
    <TargetFramework>net7.0</TargetFramework>
    <Nullable>enable</Nullable>
    <ImplicitUsings>enable</ImplicitUsings>
  </PropertyGroup>

  <ItemGroup>
    <ProjectReference Include="..\Shared\Shared.csproj" />
    <ProjectReference Include="..\..\..\src\OpenTracing.Contrib.NetCore\OpenTracing.Contrib.NetCore.csproj" />
  </ItemGroup>

  <ItemGroup>
    <PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="[7.0.0,8)" />
    <PackageReference Include="Microsoft.Extensions.Diagnostics.HealthChecks.EntityFrameworkCore" Version="[7.0.0,8)" />
  </ItemGroup>

</Project>


================================================
FILE: samples/net7.0/CustomersApi/DataStore/CustomerDbContext.cs
================================================
using Microsoft.EntityFrameworkCore;
using Shared;

namespace CustomersApi.DataStore;

public class CustomerDbContext : DbContext
{
    public CustomerDbContext(DbContextOptions<CustomerDbContext> options)
        : base(options)
    {
    }

    public DbSet<Customer> Customers => Set<Customer>();

    public void Seed()
    {
        if (Database.EnsureCreated())
        {
            Database.Migrate();

            Customers.Add(new Customer(1, "Marcel Belding"));
            Customers.Add(new Customer(2, "Phyllis Schriver"));
            Customers.Add(new Customer(3, "Estefana Balderrama"));
            Customers.Add(new Customer(4, "Kenyetta Lone"));
            Customers.Add(new Customer(5, "Vernita Fernald"));
            Customers.Add(new Customer(6, "Tessie Storrs"));

            SaveChanges();
        }
    }
}


================================================
FILE: samples/net7.0/CustomersApi/Program.cs
================================================
using CustomersApi.DataStore;
using Microsoft.EntityFrameworkCore;
using Shared;

var builder = WebApplication.CreateBuilder(args);

// Add services to the container.

builder.WebHost.UseUrls(Constants.CustomersUrl);

// Registers and starts Jaeger (see Shared.JaegerServiceCollectionExtensions)
builder.Services.AddJaeger();

// Enables OpenTracing instrumentation for ASP.NET Core, CoreFx, EF Core
builder.Services.AddOpenTracing(ot =>
{
    ot.ConfigureAspNetCore(options =>
    {
        // We don't need any tracing data for our health endpoint.
        options.Hosting.IgnorePatterns.Add(ctx => ctx.Request.Path == "/health");
    });

    ot.ConfigureEntityFrameworkCore(options =>
    {
        // This is an example for how certain EF Core commands can be ignored.
        // As en example, we're ignoring the "PRAGMA foreign_keys=ON;" commands that are executed by Sqlite.
        // Remove this code to see those statements.
        options.IgnorePatterns.Add(cmd => cmd.Command.CommandText.StartsWith("PRAGMA"));
    });
});

// Adds a Sqlite DB to show EFCore traces.
builder.Services.AddDbContext<CustomerDbContext>(options =>
{
    options.UseSqlite("Data Source=DataStore/customers.db");
});

builder.Services.AddHealthChecks()
    .AddDbContextCheck<CustomerDbContext>();


var app = builder.Build();


// Load some dummy data into the db.
using (var scope = app.Services.CreateScope())
{
    var dbContext = scope.ServiceProvider.GetRequiredService<CustomerDbContext>();
    dbContext.Seed();
}


// Configure the HTTP request pipeline.

app.MapGet("/", () => "Customers API");

app.MapHealthChecks("/health");

app.MapGet("/customers", async (CustomerDbContext dbContext) => await dbContext.Customers.ToListAsync());

app.MapGet("/customers/{id}", async (int id, CustomerDbContext dbContext, ILogger<Program> logger) =>
{
    var customer = await dbContext.Customers.FirstOrDefaultAsync(x => x.CustomerId == id);

    if (customer == null)
        return Results.NotFound();

    // ILogger events are sent to OpenTracing as well!
    logger.LogInformation("Returning data for customer {CustomerId}", id);

    return Results.Ok(customer);
});

app.Run();


================================================
FILE: samples/net7.0/CustomersApi/Properties/launchSettings.json
================================================
{
  "profiles": {
    "CustomersApi": {
      "commandName": "Project",
      "launchBrowser": false,
      "launchUrl": "http://localhost:5001",
      "environmentVariables": {
        "ASPNETCORE_ENVIRONMENT": "Development"
      }
    }
  }
}


================================================
FILE: samples/net7.0/CustomersApi/appsettings.json
================================================
{
  "Logging": {
    "IncludeScopes": false,
    "LogLevel": {
      "Default": "Debug",
      "System": "Information",
      "Microsoft": "Information"
    }
  }
}


================================================
FILE: samples/net7.0/FrontendWeb/Controllers/HomeController.cs
================================================
using System.Text;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Rendering;
using Newtonsoft.Json;
using Shared;

namespace FrontendWeb.Controllers;

public class HomeController : Controller
{
    private readonly HttpClient _httpClient;

    public HomeController(HttpClient httpClient)
    {
        _httpClient = httpClient;
    }

    [HttpGet]
    public IActionResult Index()
    {
        return View();
    }

    [HttpGet]
    public async Task<IActionResult> PlaceOrder()
    {
        ViewBag.Customers = await GetCustomers();
        return View(new PlaceOrderCommand { ItemNumber = "ABC11", Quantity = 1 });
    }

    [HttpPost, ValidateAntiForgeryToken]
    public async Task<IActionResult> PlaceOrder(PlaceOrderCommand cmd)
    {
        if (!ModelState.IsValid)
        {
            ViewBag.Customers = await GetCustomers();
            return View(cmd);
        }

        string body = JsonConvert.SerializeObject(cmd);

        var request = new HttpRequestMessage
        {
            Method = HttpMethod.Post,
            RequestUri = new Uri(Constants.OrdersUrl + "orders"),
            Content = new StringContent(body, Encoding.UTF8, "application/json")
        };
            
        await _httpClient.SendAsync(request);

        return RedirectToAction("Index");
    }

    private async Task<IEnumerable<SelectListItem>> GetCustomers()
    {
        var request = new HttpRequestMessage
        {
            Method = HttpMethod.Get,
            RequestUri = new Uri(Constants.CustomersUrl + "customers")
        };

        var response = await _httpClient.SendAsync(request);

        response.EnsureSuccessStatusCode();

        var body = await response.Content.ReadAsStringAsync();

        return JsonConvert.DeserializeObject<List<Customer>>(body)
            .Select(x => new SelectListItem { Value = x.CustomerId.ToString(), Text = x.Name });
    }
}


================================================
FILE: samples/net7.0/FrontendWeb/FrontendWeb.csproj
================================================
<Project Sdk="Microsoft.NET.Sdk.Web">

  <PropertyGroup>
    <TargetFramework>net7.0</TargetFramework>
    <Nullable>enable</Nullable>
    <ImplicitUsings>enable</ImplicitUsings>
  </PropertyGroup>

  <ItemGroup>
    <ProjectReference Include="..\Shared\Shared.csproj" />
    <ProjectReference Include="..\..\..\src\OpenTracing.Contrib.NetCore\OpenTracing.Contrib.NetCore.csproj" />
  </ItemGroup>

</Project>


================================================
FILE: samples/net7.0/FrontendWeb/Program.cs
================================================
using Shared;


var builder = WebApplication.CreateBuilder(args);

// Add services to the container.

builder.WebHost.UseUrls(Constants.FrontendUrl);

// Registers and starts Jaeger (see Shared.JaegerServiceCollectionExtensions)
builder.Services.AddJaeger();

// Enables OpenTracing instrumentation for ASP.NET Core, CoreFx, EF Core
builder.Services.AddOpenTracing();

builder.Services.AddSingleton<HttpClient>();

builder.Services.AddMvc();


var app = builder.Build();


// Configure the HTTP request pipeline.

app.MapDefaultControllerRoute();

app.Run();


================================================
FILE: samples/net7.0/FrontendWeb/Properties/launchSettings.json
================================================
{
  "profiles": {
    "FrontendWeb": {
      "commandName": "Project",
      "launchBrowser": false,
      "launchUrl": "http://localhost:5000",
      "environmentVariables": {
        "ASPNETCORE_ENVIRONMENT": "Development"
      }
    }
  }
}


================================================
FILE: samples/net7.0/FrontendWeb/Views/Home/Index.cshtml
================================================
<!DOCTYPE html>
<meta charset="utf-8">
<title>FrontendWeb</title>
<h1>FrontendWeb</h1>
<p>This is the beautiful web frontend.</p>
<p>Refresh this page a few times and check the Jaeger UI - you should already see traces!</p>

<p><a asp-action="PlaceOrder">Place an order</a></p>


================================================
FILE: samples/net7.0/FrontendWeb/Views/Home/PlaceOrder.cshtml
================================================
@model Shared.PlaceOrderCommand
<!DOCTYPE html>
<meta charset="utf-8">
<title>FrontendWeb</title>
<h1>FrontendWeb</h1>
<p>Place an order</p>

<form asp-action="PlaceOrder" asp-antiforgery="true">
    <div>Customer: @Html.DropDownListFor(x => x.CustomerId, (IEnumerable<SelectListItem>)ViewBag.Customers)</div>
    <div>ItemNumber: @Html.TextBoxFor(x => x.ItemNumber)</div>
    <div>Quantity: @Html.TextBoxFor(x => x.Quantity)</div>
    <input type="submit" value="Place order"/>
</form>


================================================
FILE: samples/net7.0/FrontendWeb/Views/_ViewImports.cshtml
================================================
@using FrontendWeb
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers


================================================
FILE: samples/net7.0/FrontendWeb/appsettings.json
================================================
{
  "Logging": {
    "IncludeScopes": false,
    "LogLevel": {
      "Default": "Debug",
      "System": "Information",
      "Microsoft": "Information",
      "OpenTracing": "Debug"
    }
  }
}


================================================
FILE: samples/net7.0/OrdersApi/Controllers/OrdersController.cs
================================================
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using Newtonsoft.Json;
using OpenTracing;
using OrdersApi.DataStore;
using Shared;

namespace OrdersApi.Controllers;

[Route("orders")]
public class OrdersController : Controller
{
    private readonly OrdersDbContext _dbContext;
    private readonly HttpClient _httpClient;
    private readonly ITracer _tracer;

    public OrdersController(OrdersDbContext dbContext, HttpClient httpClient, ITracer tracer)
    {
        _dbContext = dbContext ?? throw new ArgumentNullException(nameof(dbContext));
        _httpClient = httpClient ?? throw new ArgumentNullException(nameof(httpClient));
        _tracer = tracer ?? throw new ArgumentNullException(nameof(tracer));
    }

    [HttpGet]
    public async Task<IActionResult> Index()
    {
        var orders = await _dbContext.Orders.ToListAsync();

        return Ok(orders.Select(x => new { x.OrderId }).ToList());
    }

    [HttpPost]
    public async Task<IActionResult> Index([FromBody] PlaceOrderCommand cmd)
    {
        var customer = await GetCustomer(cmd.CustomerId);

        var order = new Order
        {
            CustomerId = cmd.CustomerId,
            ItemNumber = cmd.ItemNumber,
            Quantity = cmd.Quantity
        };

        _dbContext.Orders.Add(order);

        await _dbContext.SaveChangesAsync();

        _tracer.ActiveSpan?.Log(new Dictionary<string, object> {
            { "event", "OrderPlaced" },
            { "orderId", order.OrderId },
            { "customer", order.CustomerId },
            { "customer_name", customer.Name },
            { "item_number", order.ItemNumber },
            { "quantity", order.Quantity }
        });

        return Ok();
    }

    private async Task<Customer> GetCustomer(int customerId)
    {
        var request = new HttpRequestMessage
        {
            Method = HttpMethod.Get,
            RequestUri = new Uri(Constants.CustomersUrl + "customers/" + customerId)
        };

        var response = await _httpClient.SendAsync(request);

        response.EnsureSuccessStatusCode();

        var body = await response.Content.ReadAsStringAsync();

        return JsonConvert.DeserializeObject<Customer>(body);
    }
}


================================================
FILE: samples/net7.0/OrdersApi/DataStore/Order.cs
================================================
using System.ComponentModel.DataAnnotations;

namespace OrdersApi.DataStore;

public class Order
{
    [Key]
    public int OrderId { get; set; }
        
    public int CustomerId { get; set; }

    [Required, StringLength(10)]
    public string ItemNumber { get; set; } = string.Empty;

    [Required, Range(1, 100)]
    public int Quantity { get; set; }
}


================================================
FILE: samples/net7.0/OrdersApi/DataStore/OrdersDbContext.cs
================================================
using Microsoft.EntityFrameworkCore;

namespace OrdersApi.DataStore;

public class OrdersDbContext : DbContext
{
    public OrdersDbContext(DbContextOptions<OrdersDbContext> options)
        : base(options)
    {
    }

    public DbSet<Order> Orders => Set<Order>();

    public void Seed()
    {
        if (Database.EnsureCreated())
        {
            Database.Migrate();

            SaveChanges();
        }
    }
}


================================================
FILE: samples/net7.0/OrdersApi/OrdersApi.csproj
================================================
<Project Sdk="Microsoft.NET.Sdk.Web">

  <PropertyGroup>
    <TargetFramework>net7.0</TargetFramework>
    <Nullable>enable</Nullable>
    <ImplicitUsings>enable</ImplicitUsings>
  </PropertyGroup>

  <ItemGroup>
    <ProjectReference Include="..\Shared\Shared.csproj" />
    <ProjectReference Include="..\..\..\src\OpenTracing.Contrib.NetCore\OpenTracing.Contrib.NetCore.csproj" />
  </ItemGroup>

  <ItemGroup>
    <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="[7.0.0,8)" />
    <PackageReference Include="Microsoft.Extensions.Diagnostics.HealthChecks.EntityFrameworkCore" Version="[7.0.0,8)" />
  </ItemGroup>

</Project>


================================================
FILE: samples/net7.0/OrdersApi/Program.cs
================================================
using Microsoft.EntityFrameworkCore;
using OrdersApi.DataStore;
using Shared;

var builder = WebApplication.CreateBuilder(args);

// Add services to the container.

builder.WebHost.UseUrls(Constants.OrdersUrl);

// Registers and starts Jaeger (see Shared.JaegerServiceCollectionExtensions)
builder.Services.AddJaeger();

// Enables OpenTracing instrumentation for ASP.NET Core, CoreFx, EF Core
builder.Services.AddOpenTracing(builder =>
{
    builder.ConfigureAspNetCore(options =>
    {
        // We don't need any tracing data for our health endpoint.
        options.Hosting.IgnorePatterns.Add(ctx => ctx.Request.Path == "/health");
    });
});

// Adds a SqlServer DB to show EFCore traces.
builder.Services.AddDbContext<OrdersDbContext>(options =>
{
    options.UseSqlServer("Server=(localdb)\\mssqllocaldb;Database=Orders-net5;Trusted_Connection=True;MultipleActiveResultSets=true");
});

builder.Services.AddSingleton<HttpClient>();

builder.Services.AddMvc();

builder.Services.AddHealthChecks()
    .AddDbContextCheck<OrdersDbContext>();


var app = builder.Build();


// Load some dummy data into the db.
using (var scope = app.Services.CreateScope())
{
    var dbContext = scope.ServiceProvider.GetRequiredService<OrdersDbContext>();
    dbContext.Seed();
}


// Configure the HTTP request pipeline.

app.MapGet("/", () => "Orders API");

app.MapHealthChecks("/health");

app.MapDefaultControllerRoute();

app.Run();


================================================
FILE: samples/net7.0/OrdersApi/Properties/launchSettings.json
================================================
{
  "profiles": {
    "OrdersApi": {
      "commandName": "Project",
      "launchBrowser": false,
      "launchUrl": "http://localhost:5002",
      "environmentVariables": {
        "ASPNETCORE_ENVIRONMENT": "Development"
      }
    }
  }
}


================================================
FILE: samples/net7.0/OrdersApi/appsettings.json
================================================
{
  "Logging": {
    "IncludeScopes": false,
    "LogLevel": {
      "Default": "Debug",
      "System": "Information",
      "Microsoft": "Information"
    }
  }
}


================================================
FILE: samples/net7.0/Shared/Constants.cs
================================================
namespace Shared;

public class Constants
{
    public const string FrontendUrl = "http://localhost:5000/";

    public const string CustomersUrl = "http://localhost:5001/";

    public const string OrdersUrl = "http://localhost:5002/";
}


================================================
FILE: samples/net7.0/Shared/Customer.cs
================================================
namespace Shared;

public class Customer
{
    public int CustomerId { get; set; }
    public string Name { get; set; }

    public Customer()
    {
        CustomerId = 0;
        Name = string.Empty;
    }

    public Customer(int customerId, string name)
    {
        CustomerId = customerId;
        Name = name;
    }
}


================================================
FILE: samples/net7.0/Shared/JaegerServiceCollectionExtensions.cs
================================================
using System.Reflection;
using Jaeger;
using Jaeger.Reporters;
using Jaeger.Samplers;
using Jaeger.Senders.Thrift;
using Microsoft.Extensions.Logging;
using OpenTracing;
using OpenTracing.Contrib.NetCore.Configuration;
using OpenTracing.Util;

namespace Microsoft.Extensions.DependencyInjection;

public static class JaegerServiceCollectionExtensions
{
    private static readonly Uri _jaegerUri = new Uri("http://localhost:14268/api/traces");

    public static IServiceCollection AddJaeger(this IServiceCollection services)
    {
        if (services == null)
            throw new ArgumentNullException(nameof(services));

        services.AddSingleton<ITracer>(serviceProvider =>
        {
            string serviceName = Assembly.GetEntryAssembly()?.GetName().Name ?? "unknown-service";

            ILoggerFactory loggerFactory = serviceProvider.GetRequiredService<ILoggerFactory>();

            ISampler sampler = new ConstSampler(sample: true);

            IReporter reporter = new RemoteReporter.Builder()
                .WithSender(new HttpSender.Builder(_jaegerUri.ToString()).Build())
                .Build();

            ITracer tracer = new Tracer.Builder(serviceName)
                .WithLoggerFactory(loggerFactory)
                .WithSampler(sampler)
                .WithReporter(reporter)
                .Build();

            GlobalTracer.Register(tracer);

            return tracer;
        });

        // Prevent endless loops when OpenTracing is tracking HTTP requests to Jaeger.
        services.Configure<HttpHandlerDiagnosticOptions>(options =>
        {
            options.IgnorePatterns.Add(request => request.RequestUri != null && _jaegerUri.IsBaseOf(request.RequestUri));
        });

        return services;
    }
}


================================================
FILE: samples/net7.0/Shared/PlaceOrderCommand.cs
================================================
using System.ComponentModel.DataAnnotations;

namespace Shared;

public class PlaceOrderCommand
{
    [Required, Range(1, int.MaxValue)]
    public int CustomerId { get; set; }

    [Required, StringLength(10)]
    public string ItemNumber { get; set; } = string.Empty;

    [Required, Range(1, 100)]
    public int Quantity { get; set; }
}


================================================
FILE: samples/net7.0/Shared/Shared.csproj
================================================
<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <TargetFramework>net7.0</TargetFramework>
    <Nullable>enable</Nullable>
    <ImplicitUsings>enable</ImplicitUsings>
  </PropertyGroup>

  <ItemGroup>
    <ProjectReference Include="..\..\..\src\OpenTracing.Contrib.NetCore\OpenTracing.Contrib.NetCore.csproj" />
  </ItemGroup>

  <ItemGroup>
    <PackageReference Include="Jaeger" Version="1.0.3" />
    <PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="[7.0.0,8)" />
    <PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="[7.0.0,8)" />
    <PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="[7.0.0,8)" />
  </ItemGroup>

</Project>


================================================
FILE: samples/net7.0/TrafficGenerator/Program.cs
================================================
using TrafficGenerator;

using var host = Host.CreateDefaultBuilder(args)
    .ConfigureServices((hostContext, services) =>
    {
        // Registers and starts Jaeger (see Shared.JaegerServiceCollectionExtensions)
        services.AddJaeger();

        services.AddOpenTracing();

        services.AddHostedService<Worker>();
    })
    .Build();

await host.RunAsync();


================================================
FILE: samples/net7.0/TrafficGenerator/TrafficGenerator.csproj
================================================
<Project Sdk="Microsoft.NET.Sdk.Worker">

  <PropertyGroup>
    <TargetFramework>net7.0</TargetFramework>
    <Nullable>enable</Nullable>
    <ImplicitUsings>enable</ImplicitUsings>
  </PropertyGroup>

  <ItemGroup>
    <ProjectReference Include="..\Shared\Shared.csproj" />
    <ProjectReference Include="..\..\..\src\OpenTracing.Contrib.NetCore\OpenTracing.Contrib.NetCore.csproj" />
  </ItemGroup>

</Project>


================================================
FILE: samples/net7.0/TrafficGenerator/Worker.cs
================================================
using Shared;

namespace TrafficGenerator;

public class Worker : BackgroundService
{
    private readonly ILogger<Worker> _logger;

    public Worker(ILogger<Worker> logger)
    {
        _logger = logger ?? throw new ArgumentNullException(nameof(logger));
    }

    protected override async Task ExecuteAsync(CancellationToken stoppingToken)
    {
        try
        {
            HttpClient customersHttpClient = new HttpClient();
            customersHttpClient.BaseAddress = new Uri(Constants.CustomersUrl);

            HttpClient ordersHttpClient = new HttpClient();
            ordersHttpClient.BaseAddress = new Uri(Constants.OrdersUrl);


            while (!stoppingToken.IsCancellationRequested)
            {
                HttpResponseMessage ordersHealthResponse = await ordersHttpClient.GetAsync("health");
                _logger.LogInformation($"Health of 'orders'-endpoint: '{ordersHealthResponse.StatusCode}'");

                HttpResponseMessage customersHealthResponse = await customersHttpClient.GetAsync("health");
                _logger.LogInformation($"Health of 'customers'-endpoint: '{customersHealthResponse.StatusCode}'");

                _logger.LogInformation("Requesting customers");

                HttpResponseMessage response = await customersHttpClient.GetAsync("customers");

                _logger.LogInformation($"Response was '{response.StatusCode}'");

                await Task.Delay(TimeSpan.FromSeconds(5), stoppingToken);
            }
        }
        catch (TaskCanceledException)
        {
            /* Application should be stopped -> no-op */
        }
        catch (Exception ex)
        {
            _logger.LogError(ex, "Unhandled exception");
        }
    }
}


================================================
FILE: samples/net7.0/TrafficGenerator/appsettings.json
================================================
{
  "Logging": {
    "LogLevel": {
      "Default": "Debug",
      "System": "Information",
      "Microsoft": "Warning",
      "Microsoft.AspNetCore.Hosting": "Information"
    }
  }
}


================================================
FILE: samples/netcoreapp3.1/CustomersApi/Controllers/CustomersController.cs
================================================
using System.Linq;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using Samples.CustomersApi.DataStore;

namespace Samples.CustomersApi.Controllers
{
    [Route("customers")]
    public class CustomersController : Controller
    {
        private readonly CustomerDbContext _dbContext;
        private readonly ILogger _logger;

        public CustomersController(CustomerDbContext dbContext, ILogger<CustomersController> logger)
        {
            _dbContext = dbContext;
            _logger = logger;
        }

        [HttpGet]
        public IActionResult Index()
        {
            return Json(_dbContext.Customers.ToList());
        }

        [HttpGet("{id:int}")]
        public IActionResult Index(int id)
        {
            var customer = _dbContext.Customers.FirstOrDefault(x => x.CustomerId == id);

            if (customer == null)
                return NotFound();

            // ILogger events are sent to OpenTracing as well!
            _logger.LogInformation("Returning data for customer {CustomerId}", id);

            return Json(customer);
        }
    }
}


================================================
FILE: samples/netcoreapp3.1/CustomersApi/CustomersApi.csproj
================================================
<Project Sdk="Microsoft.NET.Sdk.Web">

  <PropertyGroup>
    <TargetFrameworks>netcoreapp3.1</TargetFrameworks>
  </PropertyGroup>

  <ItemGroup>
    <ProjectReference Include="..\Shared\Shared.csproj" />
    <ProjectReference Include="..\..\..\src\OpenTracing.Contrib.NetCore\OpenTracing.Contrib.NetCore.csproj" />
  </ItemGroup>

  <ItemGroup>
    <PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="[3.1.31,4)" />
    <PackageReference Include="Microsoft.Extensions.Diagnostics.HealthChecks.EntityFrameworkCore" Version="[3.1.31,4)" />
  </ItemGroup>

</Project>


================================================
FILE: samples/netcoreapp3.1/CustomersApi/DataStore/CustomerDbContext.cs
================================================
using Microsoft.EntityFrameworkCore;
using Shared;

namespace Samples.CustomersApi.DataStore
{
    public class CustomerDbContext : DbContext
    {
        public CustomerDbContext(DbContextOptions<CustomerDbContext> options)
            : base(options)
        {
        }

        public DbSet<Customer> Customers { get; set; }

        public void Seed()
        {
            if (Database.EnsureCreated())
            {
                Database.Migrate();

                Customers.Add(new Customer(1, "Marcel Belding"));
                Customers.Add(new Customer(2, "Phyllis Schriver"));
                Customers.Add(new Customer(3, "Estefana Balderrama"));
                Customers.Add(new Customer(4, "Kenyetta Lone"));
                Customers.Add(new Customer(5, "Vernita Fernald"));
                Customers.Add(new Customer(6, "Tessie Storrs"));

                SaveChanges();
            }
        }
    }
}


================================================
FILE: samples/netcoreapp3.1/CustomersApi/Program.cs
================================================
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Shared;

namespace Samples.CustomersApi
{
    public class Program
    {
        public static void Main(string[] args)
        {
            CreateHostBuilder(args).Build().Run();
        }

        public static IHostBuilder CreateHostBuilder(string[] args)
        {
            return Host.CreateDefaultBuilder(args)
                .ConfigureWebHostDefaults(webBuilder =>
                {
                    webBuilder
                        .UseStartup<Startup>()
                        .UseUrls(Constants.CustomersUrl);
                })
                .ConfigureServices(services =>
                {
                    // Registers and starts Jaeger (see Shared.JaegerServiceCollectionExtensions)
                    services.AddJaeger();

                    // Enables OpenTracing instrumentation for ASP.NET Core, CoreFx, EF Core
                    services.AddOpenTracing(builder =>
                    {
                        builder.ConfigureAspNetCore(options =>
                        {
                            // We don't need any tracing data for our health endpoint.
                            options.Hosting.IgnorePatterns.Add(ctx => ctx.Request.Path == "/health");
                        });

                        builder.ConfigureEntityFrameworkCore(options =>
                        {
                            // This is an example for how certain EF Core commands can be ignored.
                            // As en example, we're ignoring the "PRAGMA foreign_keys=ON;" commands that are executed by Sqlite.
                            // Remove this code to see those statements.
                            options.IgnorePatterns.Add(cmd => cmd.Command.CommandText.StartsWith("PRAGMA"));
                        });
                    });

                });
        }
    }
}


================================================
FILE: samples/netcoreapp3.1/CustomersApi/Properties/launchSettings.json
================================================
{
  "profiles": {
    "CustomersApi": {
      "commandName": "Project",
      "launchBrowser": false,
      "launchUrl": "http://localhost:5001",
      "environmentVariables": {
        "ASPNETCORE_ENVIRONMENT": "Development"
      }
    }
  }
}


================================================
FILE: samples/netcoreapp3.1/CustomersApi/Startup.cs
================================================
using System;
using Microsoft.AspNetCore.Builder;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.DependencyInjection;
using Samples.CustomersApi.DataStore;

namespace Samples.CustomersApi
{
    public class Startup
    {
        public void ConfigureServices(IServiceCollection services)
        {
            // Adds a Sqlite DB to show EFCore traces.
            services
                .AddDbContext<CustomerDbContext>(options =>
                {
                    options.UseSqlite("Data Source=DataStore/customers.db");
                });

            services.AddMvc();

            services.AddHealthChecks()
                .AddDbContextCheck<CustomerDbContext>();
        }

        public void Configure(IApplicationBuilder app)
        {
            // Load some dummy data into the InMemory db.
            BootstrapDataStore(app.ApplicationServices);

            app.UseDeveloperExceptionPage();

            app.UseRouting();

            app.UseAuthentication();
            app.UseAuthorization();

            app.UseEndpoints(endpoints =>
            {
                endpoints.MapControllers();
                endpoints.MapHealthChecks("/health");
            });
        }

        public void BootstrapDataStore(IServiceProvider serviceProvider)
        {
            using (var scope = serviceProvider.CreateScope())
            {
                var dbContext = scope.ServiceProvider.GetRequiredService<CustomerDbContext>();
                dbContext.Seed();
            }
        }
    }
}


================================================
FILE: samples/netcoreapp3.1/CustomersApi/appsettings.json
================================================
{
  "Logging": {
    "IncludeScopes": false,
    "LogLevel": {
      "Default": "Debug",
      "System": "Information",
      "Microsoft": "Information"
    }
  }
}


================================================
FILE: samples/netcoreapp3.1/FrontendWeb/Controllers/HomeController.cs
================================================
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using Shared;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Rendering;
using Newtonsoft.Json;

namespace Samples.FrontendWeb.Controllers
{
    public class HomeController : Controller
    {
        private readonly HttpClient _httpClient;

        public HomeController(HttpClient httpClient)
        {
            _httpClient = httpClient;
        }

        [HttpGet]
        public IActionResult Index()
        {
            return View();
        }

        [HttpGet]
        public async Task<IActionResult> PlaceOrder()
        {
            ViewBag.Customers = await GetCustomers();
            return View(new PlaceOrderCommand { ItemNumber = "ABC11", Quantity = 1 });
        }

        [HttpPost, ValidateAntiForgeryToken]
        public async Task<IActionResult> PlaceOrder(PlaceOrderCommand cmd)
        {
            if (!ModelState.IsValid)
            {
                ViewBag.Customers = await GetCustomers();
                return View(cmd);
            }

            string body = JsonConvert.SerializeObject(cmd);

            var request = new HttpRequestMessage
            {
                Method = HttpMethod.Post,
                RequestUri = new Uri(Constants.OrdersUrl + "orders"),
                Content = new StringContent(body, Encoding.UTF8, "application/json")
            };
            
            await _httpClient.SendAsync(request);

            return RedirectToAction("Index");
        }

        private async Task<IEnumerable<SelectListItem>> GetCustomers()
        {
            var request = new HttpRequestMessage
            {
                Method = HttpMethod.Get,
                RequestUri = new Uri(Constants.CustomersUrl + "customers")
            };

            var response = await _httpClient.SendAsync(request);

            response.EnsureSuccessStatusCode();

            var body = await response.Content.ReadAsStringAsync();

            return JsonConvert.DeserializeObject<List<Customer>>(body)
                .Select(x => new SelectListItem { Value = x.CustomerId.ToString(), Text = x.Name });
        }
    }
}


================================================
FILE: samples/netcoreapp3.1/FrontendWeb/FrontendWeb.csproj
================================================
<Project Sdk="Microsoft.NET.Sdk.Web">

  <PropertyGroup>
    <TargetFrameworks>netcoreapp3.1</TargetFrameworks>
  </PropertyGroup>

  <ItemGroup>
    <ProjectReference Include="..\Shared\Shared.csproj" />
    <ProjectReference Include="..\..\..\src\OpenTracing.Contrib.NetCore\OpenTracing.Contrib.NetCore.csproj" />
  </ItemGroup>

</Project>


================================================
FILE: samples/netcoreapp3.1/FrontendWeb/Program.cs
================================================
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Shared;

namespace Samples.FrontendWeb
{
    public class Program
    {
        public static void Main(string[] args)
        {
            CreateHostBuilder(args).Build().Run();
        }

        public static IHostBuilder CreateHostBuilder(string[] args)
        {
            return Host.CreateDefaultBuilder(args)
                .ConfigureWebHostDefaults(webBuilder =>
                {
                    webBuilder
                        .UseStartup<Startup>()
                        .UseUrls(Constants.FrontendUrl);
                })
                .ConfigureServices(services =>
                {
                    // Registers and starts Jaeger (see Shared.JaegerServiceCollectionExtensions)
                    services.AddJaeger();

                    // Enables OpenTracing instrumentation for ASP.NET Core, CoreFx, EF Core
                    services.AddOpenTracing();
                });
        }
    }
}


================================================
FILE: samples/netcoreapp3.1/FrontendWeb/Properties/launchSettings.json
================================================
{
  "profiles": {
    "FrontendWeb": {
      "commandName": "Project",
      "launchBrowser": false,
      "launchUrl": "http://localhost:5000",
      "environmentVariables": {
        "ASPNETCORE_ENVIRONMENT": "Development"
      }
    }
  }
}


================================================
FILE: samples/netcoreapp3.1/FrontendWeb/Startup.cs
================================================
using System.Net.Http;
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.DependencyInjection;

namespace Samples.FrontendWeb
{
    public class Startup
    {
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddSingleton<HttpClient>();

            services.AddMvc();
        }

        public void Configure(IApplicationBuilder app)
        {
            app.UseDeveloperExceptionPage();

            app.UseRouting();

            app.UseAuthentication();
            app.UseAuthorization();

            app.UseEndpoints(endpoints =>
            {
                endpoints.MapDefaultControllerRoute();
            });
        }
    }
}


================================================
FILE: samples/netcoreapp3.1/FrontendWeb/Views/Home/Index.cshtml
================================================
<!DOCTYPE html>
<meta charset="utf-8">
<title>FrontendWeb</title>
<h1>FrontendWeb</h1>
<p>This is the beautiful web frontend.</p>
<p>Refresh this page a few times and check the Jaeger UI - you should already see traces!</p>

<p><a asp-action="PlaceOrder">Place an order</a></p>


================================================
FILE: samples/netcoreapp3.1/FrontendWeb/Views/Home/PlaceOrder.cshtml
================================================
@model Shared.PlaceOrderCommand
<!DOCTYPE html>
<meta charset="utf-8">
<title>FrontendWeb</title>
<h1>FrontendWeb</h1>
<p>Place an order</p>

<form asp-action="PlaceOrder" asp-antiforgery="true">
    <div>Customer: @Html.DropDownListFor(x => x.CustomerId, (IEnumerable<SelectListItem>)ViewBag.Customers)</div>
    <div>ItemNumber: @Html.TextBoxFor(x => x.ItemNumber)</div>
    <div>Quantity: @Html.TextBoxFor(x => x.Quantity)</div>
    <input type="submit" value="Place order"/>
</form>


================================================
FILE: samples/netcoreapp3.1/FrontendWeb/Views/_ViewImports.cshtml
================================================
@using Samples.FrontendWeb
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers

================================================
FILE: samples/netcoreapp3.1/FrontendWeb/appsettings.json
================================================
{
  "Logging": {
    "IncludeScopes": false,
    "LogLevel": {
      "Default": "Debug",
      "System": "Information",
      "Microsoft": "Information",
      "OpenTracing": "Debug"
    }
  }
}


================================================
FILE: samples/netcoreapp3.1/OrdersApi/Controllers/OrdersController.cs
================================================
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using Newtonsoft.Json;
using OpenTracing;
using OrdersApi.DataStore;
using Shared;

namespace Samples.OrdersApi.Controllers
{
    [Route("orders")]
    public class OrdersController : Controller
    {
        private readonly OrdersDbContext _dbContext;
        private readonly HttpClient _httpClient;
        private readonly ITracer _tracer;

        public OrdersController(OrdersDbContext dbContext, HttpClient httpClient, ITracer tracer)
        {
            _dbContext = dbContext ?? throw new ArgumentNullException(nameof(dbContext));
            _httpClient = httpClient ?? throw new ArgumentNullException(nameof(httpClient));
            _tracer = tracer ?? throw new ArgumentNullException(nameof(tracer));
        }

        [HttpGet]
        public async Task<IActionResult> Index()
        {
            var orders = await _dbContext.Orders.ToListAsync();

            return Ok(orders.Select(x => new { x.OrderId }).ToList());
        }

        [HttpPost]
        public async Task<IActionResult> Index([FromBody] PlaceOrderCommand cmd)
        {
            var customer = await GetCustomer(cmd.CustomerId.Value);

            var order = new Order
            {
                CustomerId = cmd.CustomerId.Value,
                ItemNumber = cmd.ItemNumber,
                Quantity = cmd.Quantity
            };

            _dbContext.Orders.Add(order);

            await _dbContext.SaveChangesAsync();

            _tracer.ActiveSpan?.Log(new Dictionary<string, object> {
                { "event", "OrderPlaced" },
                { "orderId", order.OrderId },
                { "customer", order.CustomerId },
                { "customer_name", customer.Name },
                { "item_number", order.ItemNumber },
                { "quantity", order.Quantity }
            });

            return Ok();
        }

        private async Task<Customer> GetCustomer(int customerId)
        {
            var request = new HttpRequestMessage
            {
                Method = HttpMethod.Get,
                RequestUri = new Uri(Constants.CustomersUrl + "customers/" + customerId)
            };

            var response = await _httpClient.SendAsync(request);

            response.EnsureSuccessStatusCode();

            var body = await response.Content.ReadAsStringAsync();

            return JsonConvert.DeserializeObject<Customer>(body);
        }
    }
}


================================================
FILE: samples/netcoreapp3.1/OrdersApi/DataStore/Order.cs
================================================
using System;
using System.ComponentModel.DataAnnotations;

namespace OrdersApi.DataStore
{
    public class Order
    {
        [Key]
        public int OrderId { get; set; }
        
        public int CustomerId { get; set; }

        [Required, StringLength(10)]
        public string ItemNumber { get; set; }

        [Required, Range(1, 100)]
        public int Quantity { get; set; }
    }
}


================================================
FILE: samples/netcoreapp3.1/OrdersApi/DataStore/OrdersDbContext.cs
================================================
using Microsoft.EntityFrameworkCore;

namespace OrdersApi.DataStore
{
    public class OrdersDbContext : DbContext
    {
        public OrdersDbContext(DbContextOptions<OrdersDbContext> options)
            : base(options)
        {
        }

        public DbSet<Order> Orders { get; set; }

        public void Seed()
        {
            if (Database.EnsureCreated())
            {
                Database.Migrate();

                SaveChanges();
            }
        }
    }
}


================================================
FILE: samples/netcoreapp3.1/OrdersApi/OrdersApi.csproj
================================================
<Project Sdk="Microsoft.NET.Sdk.Web">

  <PropertyGroup>
    <TargetFrameworks>netcoreapp3.1</TargetFrameworks>
  </PropertyGroup>

  <ItemGroup>
    <ProjectReference Include="..\Shared\Shared.csproj" />
    <ProjectReference Include="..\..\..\src\OpenTracing.Contrib.NetCore\OpenTracing.Contrib.NetCore.csproj" />
  </ItemGroup>

  <ItemGroup>
    <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="[3.1.31,4)" />
    <PackageReference Include="Microsoft.Extensions.Diagnostics.HealthChecks.EntityFrameworkCore" Version="[3.1.31,4)" />
  </ItemGroup>

</Project>


================================================
FILE: samples/netcoreapp3.1/OrdersApi/Program.cs
================================================
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Shared;

namespace Samples.OrdersApi
{
    public class Program
    {
        public static void Main(string[] args)
        {
            CreateHostBuilder(args).Build().Run();
        }

        public static IHostBuilder CreateHostBuilder(string[] args)
        {
            return Host.CreateDefaultBuilder(args)
                .ConfigureWebHostDefaults(webBuilder =>
                {
                    webBuilder
                        .UseStartup<Startup>()
                        .UseUrls(Constants.OrdersUrl);
                })
                .ConfigureServices(services =>
                {
                    // Registers and starts Jaeger (see Shared.JaegerServiceCollectionExtensions)
                    services.AddJaeger();

                    // Enables OpenTracing instrumentation for ASP.NET Core, CoreFx, EF Core
                    services.AddOpenTracing(builder =>
                    {
                        builder.ConfigureAspNetCore(options =>
                        {
                            // We don't need any tracing data for our health endpoint.
                            options.Hosting.IgnorePatterns.Add(ctx => ctx.Request.Path == "/health");
                        });
                    });
                });
        }
    }
}


================================================
FILE: samples/netcoreapp3.1/OrdersApi/Properties/launchSettings.json
================================================
{
  "profiles": {
    "OrdersApi": {
      "commandName": "Project",
      "launchBrowser": false,
      "launchUrl": "http://localhost:5002",
      "environmentVariables": {
        "ASPNETCORE_ENVIRONMENT": "Development"
      }
    }
  }
}


================================================
FILE: samples/netcoreapp3.1/OrdersApi/Startup.cs
================================================
using System;
using System.Net.Http;
using Microsoft.AspNetCore.Builder;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.DependencyInjection;
using OrdersApi.DataStore;

namespace Samples.OrdersApi
{
    public class Startup
    {
        public void ConfigureServices(IServiceCollection services)
        {
            // Adds a SqlServer DB to show EFCore traces.
            services
                .AddDbContext<OrdersDbContext>(options =>
                {
                    options.UseSqlServer("Server=(localdb)\\mssqllocaldb;Database=Orders-netcoreapp31;Trusted_Connection=True;MultipleActiveResultSets=true");
                });

            services.AddSingleton<HttpClient>();

            services.AddMvc();

            services.AddHealthChecks()
                .AddDbContextCheck<OrdersDbContext>();
        }

        public void Configure(IApplicationBuilder app)
        {
            // Load some dummy data into the db.
            BootstrapDataStore(app.ApplicationServices);

            app.UseDeveloperExceptionPage();

            app.UseRouting();

            app.UseAuthentication();
            app.UseAuthorization();

            app.UseEndpoints(endpoints =>
            {
                endpoints.MapDefaultControllerRoute();
                endpoints.MapHealthChecks("/health");
            });
        }

        private void BootstrapDataStore(IServiceProvider serviceProvider)
        {
            using (var scope = serviceProvider.CreateScope())
            {
                var dbContext = scope.ServiceProvider.GetRequiredService<OrdersDbContext>();
                dbContext.Seed();
            }
        }
    }
}


================================================
FILE: samples/netcoreapp3.1/OrdersApi/appsettings.json
================================================
{
  "Logging": {
    "IncludeScopes": false,
    "LogLevel": {
      "Default": "Debug",
      "System": "Information",
      "Microsoft": "Information"
    }
  }
}


================================================
FILE: samples/netcoreapp3.1/Shared/Constants.cs
================================================
namespace Shared
{
    public class Constants
    {
        public const string FrontendUrl = "http://localhost:5000/";

        public const string CustomersUrl = "http://localhost:5001/";

        public const string OrdersUrl = "http://localhost:5002/";
    }
}


================================================
FILE: samples/netcoreapp3.1/Shared/Customer.cs
================================================
namespace Shared
{
    public class Customer
    {
        public int CustomerId { get; set; }
        public string Name { get; set; }

        public Customer()
        {
        }

        public Customer(int customerId, string name)
        {
            CustomerId = customerId;
            Name = name;
        }
    }
}


================================================
FILE: samples/netcoreapp3.1/Shared/JaegerServiceCollectionExtensions.cs
================================================
using System;
using System.Reflection;
using Jaeger;
using Jaeger.Reporters;
using Jaeger.Samplers;
using Jaeger.Senders.Thrift;
using Microsoft.Extensions.Logging;
using OpenTracing;
using OpenTracing.Contrib.NetCore.Configuration;
using OpenTracing.Util;

namespace Microsoft.Extensions.DependencyInjection
{
    public static class JaegerServiceCollectionExtensions
    {
        private static readonly Uri _jaegerUri = new Uri("http://localhost:14268/api/traces");

        public static IServiceCollection AddJaeger(this IServiceCollection services)
        {
            if (services == null)
                throw new ArgumentNullException(nameof(services));

            services.AddSingleton<ITracer>(serviceProvider =>
            {
                string serviceName = Assembly.GetEntryAssembly().GetName().Name;

                ILoggerFactory loggerFactory = serviceProvider.GetRequiredService<ILoggerFactory>();

                ISampler sampler = new ConstSampler(sample: true);

                IReporter reporter = new RemoteReporter.Builder()
                    .WithSender(new HttpSender.Builder(_jaegerUri.ToString()).Build())
                    .Build();

                ITracer tracer = new Tracer.Builder(serviceName)
                    .WithLoggerFactory(loggerFactory)
                    .WithSampler(sampler)
                    .WithReporter(reporter)
                    .Build();

                GlobalTracer.Register(tracer);

                return tracer;
            });

            // Prevent endless loops when OpenTracing is tracking HTTP requests to Jaeger.
            services.Configure<HttpHandlerDiagnosticOptions>(options =>
            {
                options.IgnorePatterns.Add(request => _jaegerUri.IsBaseOf(request.RequestUri));
            });

            return services;
        }
    }
}


================================================
FILE: samples/netcoreapp3.1/Shared/PlaceOrderCommand.cs
================================================
using System.ComponentModel.DataAnnotations;

namespace Shared
{
    public class PlaceOrderCommand
    {
        [Required]
        public int? CustomerId { get; set; }

        [Required, StringLength(10)]
        public string ItemNumber { get; set; }

        [Required, Range(1, 100)]
        public int Quantity { get; set; }
    }
}


================================================
FILE: samples/netcoreapp3.1/Shared/Shared.csproj
================================================
<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <TargetFrameworks>netcoreapp3.1</TargetFrameworks>
  </PropertyGroup>

  <ItemGroup>
    <ProjectReference Include="..\..\..\src\OpenTracing.Contrib.NetCore\OpenTracing.Contrib.NetCore.csproj" />
  </ItemGroup>

  <ItemGroup>
    <PackageReference Include="Jaeger" Version="1.0.3" />
    <PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="[3.1.31,4)" />
    <PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="[3.1.31,4)" />
    <PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="[3.1.31,4)" />
    <PackageReference Include="System.ComponentModel.Annotations" Version="5.0.0" />
  </ItemGroup>

</Project>


================================================
FILE: samples/netcoreapp3.1/TrafficGenerator/Program.cs
================================================
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;

namespace TrafficGenerator
{
    class Program
    {
        public static void Main(string[] args)
        {
            CreateHostBuilder(args).Build().Run();
        }

        public static IHostBuilder CreateHostBuilder(string[] args) =>
            Host.CreateDefaultBuilder(args)
                .ConfigureServices(services =>
                {
                    // Registers and starts Jaeger (see Shared.JaegerServiceCollectionExtensions)
                    services.AddJaeger();

                    services.AddOpenTracing();

                    services.AddHostedService<Worker>();
                });
    }
}


================================================
FILE: samples/netcoreapp3.1/TrafficGenerator/TrafficGenerator.csproj
================================================
<Project Sdk="Microsoft.NET.Sdk.Worker">

  <PropertyGroup>
    <TargetFramework>netcoreapp3.1</TargetFramework>
  </PropertyGroup>

  <ItemGroup>
    <ProjectReference Include="..\Shared\Shared.csproj" />
    <ProjectReference Include="..\..\..\src\OpenTracing.Contrib.NetCore\OpenTracing.Contrib.NetCore.csproj" />
  </ItemGroup>

</Project>


================================================
FILE: samples/netcoreapp3.1/TrafficGenerator/Worker.cs
================================================
using System;
using System.Net.Http;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using Shared;

namespace TrafficGenerator
{
    public class Worker : BackgroundService
    {
        private readonly ILogger<Worker> _logger;

        public Worker(ILogger<Worker> logger)
        {
            _logger = logger ?? throw new ArgumentNullException(nameof(logger));
        }

        protected override async Task ExecuteAsync(CancellationToken stoppingToken)
        {
            try
            {
                HttpClient customersHttpClient = new HttpClient();
                customersHttpClient.BaseAddress = new Uri(Constants.CustomersUrl);

                HttpClient ordersHttpClient = new HttpClient();
                ordersHttpClient.BaseAddress = new Uri(Constants.OrdersUrl);


                while (!stoppingToken.IsCancellationRequested)
                {
                    HttpResponseMessage ordershealthResponse = await ordersHttpClient.GetAsync("health");
                    _logger.LogInformation($"Health of 'orders'-endpoint: '{ordershealthResponse.StatusCode}'");

                    HttpResponseMessage customersHealthResponse = await customersHttpClient.GetAsync("health");
                    _logger.LogInformation($"Health of 'customers'-endpoint: '{customersHealthResponse.StatusCode}'");

                    _logger.LogInformation("Requesting customers");

                    HttpResponseMessage response = await customersHttpClient.GetAsync("customers");

                    _logger.LogInformation($"Response was '{response.StatusCode}'");

                    await Task.Delay(TimeSpan.FromSeconds(5), stoppingToken);
                }
            }
            catch (TaskCanceledException)
            {
                /* Application should be stopped -> no-op */
            }
            catch (Exception ex)
            {
                _logger.LogError(ex, "Unhandled exception");
            }
        }
    }
}


================================================
FILE: samples/netcoreapp3.1/TrafficGenerator/appsettings.json
================================================
{
  "Logging": {
    "LogLevel": {
      "Default": "Debug",
      "System": "Information",
      "Microsoft": "Warning",
      "Microsoft.AspNetCore.Hosting": "Information"
    }
  }
}


================================================
FILE: src/Directory.Build.props
================================================
<Project>
  <Import Project="..\Directory.Build.props" />

  <PropertyGroup>
    <IsPackable>true</IsPackable>
    <Authors>Christian Weiss</Authors>
    <PackageIcon>package-icon.png</PackageIcon>
    <PackageIconUrl>https://avatars0.githubusercontent.com/u/15482765</PackageIconUrl>
    <PackageProjectUrl>https://github.com/opentracing-contrib/csharp-netcore</PackageProjectUrl>
    <PackageLicenseExpression>Apache-2.0</PackageLicenseExpression>
    <PackageReleaseNotes Condition="'$(Version)' != ''">https://github.com/opentracing-contrib/csharp-netcore/releases/tag/v$(Version)</PackageReleaseNotes>

    <NoWarn>$(NoWarn);CS1591</NoWarn>
    <GenerateDocumentationFile>true</GenerateDocumentationFile>

    <!-- SourceLink support -->
    <PublishRepositoryUrl>true</PublishRepositoryUrl>
    <IncludeSymbols>true</IncludeSymbols>
    <SymbolPackageFormat>snupkg</SymbolPackageFormat>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" PrivateAssets="All"/>
  </ItemGroup>

  <ItemGroup>
    <None Include="$(SolutionDir)/package-icon.png" Pack="true" PackagePath="" />
  </ItemGroup>

</Project>


================================================
FILE: src/OpenTracing.Contrib.NetCore/AspNetCore/AspNetCoreDiagnosticOptions.cs
================================================
using OpenTracing.Contrib.NetCore.AspNetCore;

namespace OpenTracing.Contrib.NetCore.Configuration
{
    public class AspNetCoreDiagnosticOptions : DiagnosticOptions
    {
        public HostingOptions Hosting { get; } = new HostingOptions();

        public AspNetCoreDiagnosticOptions()
        {
            // We create separate spans for MVC actions & results so we don't need these additional events by default.
            IgnoredEvents.Add("Microsoft.AspNetCore.Mvc.BeforeOnResourceExecuting");
            IgnoredEvents.Add("Microsoft.AspNetCore.Mvc.BeforeOnActionExecution");
            IgnoredEvents.Add("Microsoft.AspNetCore.Mvc.BeforeOnActionExecuting");
            IgnoredEvents.Add("Microsoft.AspNetCore.Mvc.AfterOnActionExecuting");
            IgnoredEvents.Add("Microsoft.AspNetCore.Mvc.BeforeActionMethod");
            IgnoredEvents.Add("Microsoft.AspNetCore.Mvc.BeforeControllerActionMethod");
            IgnoredEvents.Add("Microsoft.AspNetCore.Mvc.AfterControllerActionMethod");
            IgnoredEvents.Add("Microsoft.AspNetCore.Mvc.AfterActionMethod");
            IgnoredEvents.Add("Microsoft.AspNetCore.Mvc.BeforeOnActionExecuted");
            IgnoredEvents.Add("Microsoft.AspNetCore.Mvc.AfterOnActionExecuted");
            IgnoredEvents.Add("Microsoft.AspNetCore.Mvc.AfterOnActionExecution");
            IgnoredEvents.Add("Microsoft.AspNetCore.Mvc.BeforeOnActionExecuted");
            IgnoredEvents.Add("Microsoft.AspNetCore.Mvc.AfterOnActionExecuted");
            IgnoredEvents.Add("Microsoft.AspNetCore.Mvc.AfterOnActionExecution");
            IgnoredEvents.Add("Microsoft.AspNetCore.Mvc.BeforeOnResultExecuting");
            IgnoredEvents.Add("Microsoft.AspNetCore.Mvc.AfterOnResultExecuting");
            IgnoredEvents.Add("Microsoft.AspNetCore.Mvc.BeforeOnResultExecuted");
            IgnoredEvents.Add("Microsoft.AspNetCore.Mvc.AfterOnResultExecuted");
            IgnoredEvents.Add("Microsoft.AspNetCore.Mvc.BeforeOnResourceExecuted");
            IgnoredEvents.Add("Microsoft.AspNetCore.Mvc.AfterOnResourceExecuted");
            IgnoredEvents.Add("Microsoft.AspNetCore.Mvc.AfterOnResourceExecuting");

            IgnoredEvents.Add("Microsoft.AspNetCore.Mvc.Razor.BeginInstrumentationContext");
            IgnoredEvents.Add("Microsoft.AspNetCore.Mvc.Razor.EndInstrumentationContext");
        }
    }
}


================================================
FILE: src/OpenTracing.Contrib.NetCore/AspNetCore/AspNetCoreDiagnostics.cs
================================================
using System;
using System.Collections.Generic;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Http.Extensions;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Abstractions;
using Microsoft.AspNetCore.Mvc.Controllers;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using OpenTracing.Contrib.NetCore.Configuration;
using OpenTracing.Contrib.NetCore.Internal;
using OpenTracing.Propagation;
using OpenTracing.Tag;

namespace OpenTracing.Contrib.NetCore.AspNetCore
{
    /// <summary>
    /// Instruments ASP.NET Core.
    /// <para/>
    /// Unfortunately, ASP.NET Core only uses one <see cref="System.Diagnostics.DiagnosticListener"/> instance
    /// for everything so we also only create one observer to ensure best performance.
    /// <para/>Hosting events: https://github.com/aspnet/Hosting/blob/dev/src/Microsoft.AspNetCore.Hosting/Internal/HostingApplicationDiagnostics.cs
    /// </summary>
    internal sealed class AspNetCoreDiagnostics : DiagnosticEventObserver
    {
        public const string DiagnosticListenerName = "Microsoft.AspNetCore";

        private const string HostingScopeItemsKey = "ot-HttpRequestIn";
        private const string ActionScopeItemsKey = "ot-MvcAction";
        private const string ActionResultScopeItemsKey = "ot-MvcActionResult";

        private const string ActionComponent = "AspNetCore.MvcAction";
        private const string ActionTagActionName = "action";
        private const string ActionTagControllerName = "controller";

        private const string ResultComponent = "AspNetCore.MvcResult";
        private const string ResultTagType = "result.type";

        private static readonly PropertyFetcher _httpRequestIn_start_HttpContextFetcher = new PropertyFetcher("HttpContext");
        private static readonly PropertyFetcher _httpRequestIn_stop_HttpContextFetcher = new PropertyFetcher("HttpContext");
        private static readonly PropertyFetcher _unhandledException_HttpContextFetcher = new PropertyFetcher("httpContext");
        private static readonly PropertyFetcher _unhandledException_ExceptionFetcher = new PropertyFetcher("exception");
        private static readonly PropertyFetcher _beforeAction_httpContextFetcher = new PropertyFetcher("httpContext");
        private static readonly PropertyFetcher _beforeAction_ActionDescriptorFetcher = new PropertyFetcher("actionDescriptor");
        private static readonly PropertyFetcher _afterAction_httpContextFetcher = new PropertyFetcher("httpContext");
        private static readonly PropertyFetcher _beforeActionResult_actionContextFetcher = new PropertyFetcher("actionContext");
        private static readonly PropertyFetcher _beforeActionResult_ResultFetcher = new PropertyFetcher("result");
        private static readonly PropertyFetcher _afterActionResult_actionContextFetcher = new PropertyFetcher("actionContext");

        internal static readonly string NoHostSpecified = string.Empty;

        private readonly AspNetCoreDiagnosticOptions _options;

        public AspNetCoreDiagnostics(ILoggerFactory loggerFactory, ITracer tracer, IOptions<AspNetCoreDiagnosticOptions> options)
            : base(loggerFactory, tracer, options?.Value)
        {
            _options = options?.Value ?? throw new ArgumentNullException(nameof(options));
        }

        protected override string GetListenerName() => DiagnosticListenerName;

        protected override bool IsSupportedEvent(string eventName)
        {
            return eventName switch
            {
                // We don't want to get the old deprecated Hosting events.
                "Microsoft.AspNetCore.Hosting.BeginRequest" => false,
                "Microsoft.AspNetCore.Hosting.EndRequest" => false,
                _ => true,
            };
        }

        protected override IEnumerable<string> HandledEventNames()
        {
            yield return "Microsoft.AspNetCore.Hosting.HttpRequestIn.Start";
            yield return "Microsoft.AspNetCore.Hosting.UnhandledException";
            yield return "Microsoft.AspNetCore.Hosting.HttpRequestIn.Stop";
            yield return "Microsoft.AspNetCore.Mvc.BeforeAction";
            yield return "Microsoft.AspNetCore.Mvc.AfterAction";
            yield return "Microsoft.AspNetCore.Mvc.BeforeActionResult";
            yield return "Microsoft.AspNetCore.Mvc.AfterActionResult";
        }

        protected override void HandleEvent(string eventName, object untypedArg)
        {
            switch (eventName)
            {
                case "Microsoft.AspNetCore.Hosting.HttpRequestIn.Start":
                    {
                        var httpContext = (HttpContext)_httpRequestIn_start_HttpContextFetcher.Fetch(untypedArg);

                        if (Tracer.ActiveSpan == null && !_options.StartRootSpans)
                        {
                            if (IsLogLevelTraceEnabled)
                            {
                                Logger.LogTrace("Ignoring request due to missing parent span");
                            }
                            return;
                        }

                        if (ShouldIgnore(httpContext))
                        {
                            if (IsLogLevelTraceEnabled)
                            {
                                Logger.LogTrace("Ignoring request");
                            }
                        }
                        else
                        {
                            var request = httpContext.Request;

                            ISpanContext extractedSpanContext = null;

                            if (_options.Hosting.ExtractEnabled?.Invoke(httpContext) ?? true)
                            {
                                extractedSpanContext = Tracer.Extract(BuiltinFormats.HttpHeaders, new RequestHeadersExtractAdapter(request.Headers));
                            }

                            string operationName = _options.Hosting.OperationNameResolver(httpContext);

                            IScope scope = Tracer.BuildSpan(operationName)
                                .AsChildOf(extractedSpanContext)
                                .WithTag(Tags.Component, _options.Hosting.ComponentName)
                                .WithTag(Tags.SpanKind, Tags.SpanKindServer)
                                .WithTag(Tags.HttpMethod, request.Method)
                                .WithTag(Tags.HttpUrl, GetDisplayUrl(request))
                                .StartActive();

                            _options.Hosting.OnRequest?.Invoke(scope.Span, httpContext);

                            httpContext.Items[HostingScopeItemsKey] = scope;
                        }
                    }
                    break;

                case "Microsoft.AspNetCore.Hosting.UnhandledException":
                    {
                        var httpContext = (HttpContext)_unhandledException_HttpContextFetcher.Fetch(untypedArg);
                        var exception = (Exception)_unhandledException_ExceptionFetcher.Fetch(untypedArg);

                        var scope = httpContext.Items[HostingScopeItemsKey] as IScope;
                        if (scope != null)
                        {
                            var span = scope.Span;

                            span.SetException(exception);

                            _options.Hosting.OnError?.Invoke(span, exception, httpContext);
                        }
                    }
                    break;

                case "Microsoft.AspNetCore.Hosting.HttpRequestIn.Stop":
                    {
                        var httpContext = (HttpContext)_httpRequestIn_stop_HttpContextFetcher.Fetch(untypedArg);

                        var scope = httpContext.Items[HostingScopeItemsKey] as IScope;
                        if (scope != null)
                        {
                            httpContext.Items.Remove(HostingScopeItemsKey);

                            scope.Span.SetTag(Tags.HttpStatus, httpContext.Response.StatusCode);
                            scope.Dispose();
                        }

                        httpContext.Items.Remove(ActionResultScopeItemsKey);
                        httpContext.Items.Remove(ActionScopeItemsKey);
                    }
                    break;

                case "Microsoft.AspNetCore.Mvc.BeforeAction":
                    {
                        var httpContext = (HttpContext)_beforeAction_httpContextFetcher.Fetch(untypedArg);

                        // We only create this span if the entire request should be traced.
                        var scope = httpContext.Items[HostingScopeItemsKey] as IScope;
                        if (scope != null)
                        {
                            // NOTE: This event is the start of the action pipeline. The action has been selected, the route
                            //       has been selected but no filters have run and model binding hasn't occured.

                            var actionDescriptor = (ActionDescriptor)_beforeAction_ActionDescriptorFetcher.Fetch(untypedArg);
                            var controllerActionDescriptor = actionDescriptor as ControllerActionDescriptor;

                            string operationName = controllerActionDescriptor != null
                                ? $"Action {controllerActionDescriptor.ControllerTypeInfo.FullName}/{controllerActionDescriptor.ActionName}"
                                : $"Action {actionDescriptor.DisplayName}";

                            var actionScope = Tracer.BuildSpan(operationName)
                                .AsChildOf(scope.Span)
                                .WithTag(Tags.Component, ActionComponent)
                                .WithTag(ActionTagControllerName, controllerActionDescriptor?.ControllerTypeInfo.FullName)
                                .WithTag(ActionTagActionName, controllerActionDescriptor?.ActionName)
                                .StartActive();

                            httpContext.Items[ActionScopeItemsKey] = actionScope;
                        }
                    }
                    break;

                case "Microsoft.AspNetCore.Mvc.AfterAction":
                    {
                        var httpContext = (HttpContext)_afterAction_httpContextFetcher.Fetch(untypedArg);
                        var scope = httpContext.Items[ActionScopeItemsKey] as IScope;
                        if (scope != null)
                        {
                            httpContext.Items.Remove(ActionScopeItemsKey);
                            scope.Dispose();
                        } 
                    }
                    break;

                case "Microsoft.AspNetCore.Mvc.BeforeActionResult":
                    {
                        var httpContext = ((ActionContext)_beforeActionResult_actionContextFetcher.Fetch(untypedArg)).HttpContext;

                        // We only create this span if the entire request should be traced.
                        var scope = httpContext.Items[HostingScopeItemsKey] as IScope;
                        if (scope != null)
                        {
                            // NOTE: This event is the start of the result pipeline. The action has been executed, but
                            //       we haven't yet determined which view (if any) will handle the request

                            object result = _beforeActionResult_ResultFetcher.Fetch(untypedArg);

                            string resultType = result.GetType().Name;
                            string operationName = $"Result {resultType}";

                            var actionResultScope = Tracer.BuildSpan(operationName)
                                .AsChildOf(scope.Span)
                                .WithTag(Tags.Component, ResultComponent)
                                .WithTag(ResultTagType, resultType)
                                .StartActive();

                            httpContext.Items[ActionResultScopeItemsKey] = actionResultScope;
                        }
                    }
                    break;

                case "Microsoft.AspNetCore.Mvc.AfterActionResult":
                    {
                        var httpContext = ((ActionContext)_afterActionResult_actionContextFetcher.Fetch(untypedArg)).HttpContext;
                        var scope = httpContext.Items[ActionResultScopeItemsKey] as IScope;
                        if (scope != null)
                        {
                            httpContext.Items.Remove(ActionResultScopeItemsKey);
                            scope.Dispose();
                        }

                    }
                    break;

                default:
                    HandleUnknownEvent(eventName, untypedArg);
                    break;
            }
        }

        private static string GetDisplayUrl(HttpRequest request)
        {
            if (request.Host.HasValue)
            {
                return request.GetDisplayUrl();
            }

            // HTTP 1.0 requests are not required to provide a Host to be valid
            // Since this is just for display, we can provide a string that is
            // not an actual Uri with only the fields that are specified.
            // request.GetDisplayUrl(), used above, will throw an exception
            // if request.Host is null.
            return $"{request.Scheme}://{NoHostSpecified}{request.PathBase.Value}{request.Path.Value}{request.QueryString.Value}";
        }

        private bool ShouldIgnore(HttpContext httpContext)
        {
            foreach (Func<HttpContext, bool> ignore in _options.Hosting.IgnorePatterns)
            {
                if (ignore(httpContext))
                    return true;
            }

            return false;
        }
    }
}


================================================
FILE: src/OpenTracing.Contrib.NetCore/AspNetCore/HostingOptions.cs
================================================
using System;
using System.Collections.Generic;
using Microsoft.AspNetCore.Http;

namespace OpenTracing.Contrib.NetCore.AspNetCore
{
    public class HostingOptions
    {
        public const string DefaultComponent = "HttpIn";

        // Variables are lazily instantiated to prevent the app from crashing if the required assemblies are not referenced.

        private string _componentName = DefaultComponent;
        private List<Func<HttpContext, bool>> _ignorePatterns;
        private Func<HttpContext, string> _operationNameResolver;


        /// <summary>
        /// Allows changing the "component" tag of created spans.
        /// </summary>
        public string ComponentName
        {
            get => _componentName;
            set => _componentName = value ?? throw new ArgumentNullException(nameof(ComponentName));
        }

        /// <summary>
        /// A list of delegates that define whether or not a given request should be ignored.
        /// <para/>
        /// If any delegate in the list returns <c>true</c>, the request will be ignored.
        /// </summary>
        public List<Func<HttpContext, bool>> IgnorePatterns
        {
            get
            {
                if (_ignorePatterns == null)
                {
                    _ignorePatterns = new List<Func<HttpContext, bool>>();
                }
                return _ignorePatterns;
            }
        }

        /// <summary>
        /// A delegates that defines from which requests tracing headers are extracted.
        /// </summary>
        public Func<HttpContext, bool> ExtractEnabled { get; set; }

        /// <summary>
        /// A delegate that returns the OpenTracing "operation name" for the given request.
        /// </summary>
        public Func<HttpContext, string> OperationNameResolver
        {
            get
            {
                if (_operationNameResolver == null)
                {
                    _operationNameResolver = (httpContext) => "HTTP " + httpContext.Request.Method;
                }
                return _operationNameResolver;
            }
            set => _operationNameResolver = value ?? throw new ArgumentNullException(nameof(OperationNameResolver));
        }

        /// <summary>
        /// Allows the modification of the created span to e.g. add further tags.
        /// </summary>
        public Action<ISpan, HttpContext> OnRequest { get; set; }

        /// <summary>
        /// Allows the modification of the created span when error occured to e.g. add further tags.
        /// </summary>
        public Action<ISpan, Exception, HttpContext> OnError { get; set; }
    }
}


================================================
FILE: src/OpenTracing.Contrib.NetCore/AspNetCore/RequestHeadersExtractAdapter.cs
================================================
using System;
using System.Collections;
using System.Collections.Generic;
using Microsoft.AspNetCore.Http;
using OpenTracing.Propagation;

namespace OpenTracing.Contrib.NetCore.AspNetCore
{
    internal sealed class RequestHeadersExtractAdapter : ITextMap
    {
        private readonly IHeaderDictionary _headers;

        public RequestHeadersExtractAdapter(IHeaderDictionary headers)
        {
            _headers = headers ?? throw new ArgumentNullException(nameof(headers));
        }

        public void Set(string key, string value)
        {
            throw new NotSupportedException("This class should only be used with ITracer.Extract");
        }

        public IEnumerator<KeyValuePair<string, string>> GetEnumerator()
        {
            foreach (var kvp in _headers)
            {
                yield return new KeyValuePair<string, string>(kvp.Key, kvp.Value);
            }
        }

        IEnumerator IEnumerable.GetEnumerator()
        {
            return GetEnumerator();
        }
    }
}


================================================
FILE: src/OpenTracing.Contrib.NetCore/Configuration/DiagnosticOptions.cs
================================================
using System.Collections.Generic;

namespace OpenTracing.Contrib.NetCore.Configuration
{
    public abstract class DiagnosticOptions
    {
        /// <summary>
        /// Defines whether or not generic events from this DiagnostSource should be logged as events.
        /// </summary>
        public bool LogEvents { get; set; } = true;

        /// <summary>
        /// Defines specific event names that should NOT be logged as events. Set <see cref="LogEvents"/> to `false` if you don't want any events to be logged.
        /// </summary>
        public HashSet<string> IgnoredEvents { get; } = new HashSet<string>();

        /// <summary>
        /// Defines whether or not a span should be created if there is no parent span.
        /// </summary>
        public bool StartRootSpans { get; set; } = true;
    }
}


================================================
FILE: src/OpenTracing.Contrib.NetCore/Configuration/IOpenTracingBuilder.cs
================================================
namespace Microsoft.Extensions.DependencyInjection
{
    /// <summary>
    /// An interface for configuring OpenTracing services.
    /// </summary>
    public interface IOpenTracingBuilder
    {
        /// <summary>
        /// Gets the <see cref="IServiceCollection"/> where OpenTracing services are configured.
        /// </summary>
        IServiceCollection Services { get; }
    }
}


================================================
FILE: src/OpenTracing.Contrib.NetCore/Configuration/OpenTracingBuilder.cs
================================================
using System;
using Microsoft.Extensions.DependencyInjection;

namespace OpenTracing.Contrib.NetCore.Configuration
{
    internal class OpenTracingBuilder : IOpenTracingBuilder
    {
        public IServiceCollection Services { get; }

        public OpenTracingBuilder(IServiceCollection services)
        {
            Services = services ?? throw new ArgumentNullException(nameof(services));
        }
    }
}


================================================
FILE: src/OpenTracing.Contrib.NetCore/Configuration/OpenTracingBuilderExtensions.cs
================================================
using System;
using Microsoft.Extensions.DependencyInjection.Extensions;
using Microsoft.Extensions.Logging;
using OpenTracing.Contrib.NetCore.AspNetCore;
using OpenTracing.Contrib.NetCore.Configuration;
using OpenTracing.Contrib.NetCore.EntityFrameworkCore;
using OpenTracing.Contrib.NetCore.GenericListeners;
using OpenTracing.Contrib.NetCore.HttpHandler;
using OpenTracing.Contrib.NetCore.Internal;
using OpenTracing.Contrib.NetCore.Logging;
using OpenTracing.Contrib.NetCore.MicrosoftSqlClient;
using OpenTracing.Contrib.NetCore.SystemSqlClient;

namespace Microsoft.Extensions.DependencyInjection
{
    public static class OpenTracingBuilderExtensions
    {
        internal static IOpenTracingBuilder AddDiagnosticSubscriber<TDiagnosticSubscriber>(this IOpenTracingBuilder builder)
            where TDiagnosticSubscriber : DiagnosticObserver
        {
            if (builder == null)
                throw new ArgumentNullException(nameof(builder));

            builder.Services.TryAddEnumerable(ServiceDescriptor.Singleton<DiagnosticObserver, TDiagnosticSubscriber>());

            return builder;
        }

        /// <summary>
        /// Adds instrumentation for ASP.NET Core.
        /// </summary>
        public static IOpenTracingBuilder AddAspNetCore(this IOpenTracingBuilder builder, Action<AspNetCoreDiagnosticOptions> options = null)
        {
            if (builder == null)
                throw new ArgumentNullException(nameof(builder));

            builder.AddDiagnosticSubscriber<AspNetCoreDiagnostics>();
            builder.ConfigureGenericDiagnostics(genericOptions => genericOptions.IgnoredListenerNames.Add(AspNetCoreDiagnostics.DiagnosticListenerName));

            // Our default behavior for ASP.NET is that we only want spans if the request itself is traced
            builder.ConfigureEntityFrameworkCore(opt => opt.StartRootSpans = false);
            builder.ConfigureHttpHandler(opt => opt.StartRootSpans = false);
            builder.ConfigureMicrosoftSqlClient(opt => opt.StartRootSpans = false);
            builder.ConfigureSystemSqlClient(opt => opt.StartRootSpans = false);

            return ConfigureAspNetCore(builder, options);
        }

        public static IOpenTracingBuilder ConfigureAspNetCore(this IOpenTracingBuilder builder, Action<AspNetCoreDiagnosticOptions> options)
        {
            if (builder == null)
                throw new ArgumentNullException(nameof(builder));

            if (options != null)
            {
                builder.Services.Configure(options);
            }

            return builder;
        }

        /// <summary>
        /// Adds instrumentation for System.Net.Http.
        /// </summary>
        public static IOpenTracingBuilder AddHttpHandler(this IOpenTracingBuilder builder, Action<HttpHandlerDiagnosticOptions> options = null)
        {
            if (builder == null)
                throw new ArgumentNullException(nameof(builder));

            builder.AddDiagnosticSubscriber<HttpHandlerDiagnostics>();
            builder.ConfigureGenericDiagnostics(options => options.IgnoredListenerNames.Add(HttpHandlerDiagnostics.DiagnosticListenerName));

            return ConfigureHttpHandler(builder, options);
        }

        public static IOpenTracingBuilder ConfigureHttpHandler(this IOpenTracingBuilder builder, Action<HttpHandlerDiagnosticOptions> options)
        {
            if (builder == null)
                throw new ArgumentNullException(nameof(builder));

            if (options != null)
            {
                builder.Services.Configure(options);
            }

            return builder;
        }

        /// <summary>
        /// Adds instrumentation for Entity Framework Core.
        /// </summary>
        public static IOpenTracingBuilder AddEntityFrameworkCore(this IOpenTracingBuilder builder, Action<EntityFrameworkCoreDiagnosticOptions> options = null)
        {
            if (builder == null)
                throw new ArgumentNullException(nameof(builder));

            builder.AddDiagnosticSubscriber<EntityFrameworkCoreDiagnostics>();
            builder.ConfigureGenericDiagnostics(genericOptions => genericOptions.IgnoredListenerNames.Add(EntityFrameworkCoreDiagnostics.DiagnosticListenerName));

            return ConfigureEntityFrameworkCore(builder, options);
        }

        /// <summary>
        /// Configuration options for the instrumentation of Entity Framework Core.
        /// </summary>
        public static IOpenTracingBuilder ConfigureEntityFrameworkCore(this IOpenTracingBuilder builder, Action<EntityFrameworkCoreDiagnosticOptions> options)
        {
            if (builder == null)
                throw new ArgumentNullException(nameof(builder));

            if (options != null)
            {
                builder.Services.Configure(options);
            }

            return builder;
        }


        /// <summary>
        /// Adds instrumentation for generic DiagnosticListeners.
        /// </summary>
        public static IOpenTracingBuilder AddGenericDiagnostics(this IOpenTracingBuilder builder, Action<GenericDiagnosticOptions> options = null)
        {
            builder.AddDiagnosticSubscriber<GenericDiagnostics>();

            return ConfigureGenericDiagnostics(builder, options);
        }

        public static IOpenTracingBuilder ConfigureGenericDiagnostics(this IOpenTracingBuilder builder, Action<GenericDiagnosticOptions> options)
        {
            if (builder == null)
                throw new ArgumentNullException(nameof(builder));

            if (options != null)
            {
                builder.Services.Configure(options);
            }

            return builder;
        }

        /// <summary>
        /// Disables tracing for all diagnostic listeners that don't have an explicit implementation.
        /// </summary>
        public static IOpenTracingBuilder RemoveGenericDiagnostics(this IOpenTracingBuilder builder)
        {
            if (builder == null)
                throw new ArgumentNullException(nameof(builder));

            builder.Services.RemoveAll<GenericDiagnostics>();

            return builder;
        }

        /// <summary>
        /// Adds instrumentation for Microsoft.Data.SqlClient.
        /// </summary>
        public static IOpenTracingBuilder AddMicrosoftSqlClient(this IOpenTracingBuilder builder, Action<MicrosoftSqlClientDiagnosticOptions> options = null)
        {
            if (builder == null)
                throw new ArgumentNullException(nameof(builder));

            builder.AddDiagnosticSubscriber<MicrosoftSqlClientDiagnostics>();
            builder.ConfigureGenericDiagnostics(genericOptions => genericOptions.IgnoredListenerNames.Add(MicrosoftSqlClientDiagnostics.DiagnosticListenerName));

            return ConfigureMicrosoftSqlClient(builder, options);
        }

        /// <summary>
        /// Configuration options for the instrumentation of Microsoft.Data.SqlClient.
        /// </summary>
        public static IOpenTracingBuilder ConfigureMicrosoftSqlClient(this IOpenTracingBuilder builder, Action<MicrosoftSqlClientDiagnosticOptions> options)
        {
            if (builder == null)
                throw new ArgumentNullException(nameof(builder));

            if (options != null)
            {
                builder.Services.Configure(options);
            }

            return builder;
        }

        /// <summary>
        /// Adds instrumentation for System.Data.SqlClient.
        /// </summary>
        public static IOpenTracingBuilder AddSystemSqlClient(this IOpenTracingBuilder builder, Action<SqlClientDiagnosticOptions> options = null)
        {
            if (builder == null)
                throw new ArgumentNullException(nameof(builder));

            builder.AddDiagnosticSubscriber<SqlClientDiagnostics>();
            builder.ConfigureGenericDiagnostics(options => options.IgnoredListenerNames.Add(SqlClientDiagnostics.DiagnosticListenerName));

            return ConfigureSystemSqlClient(builder, options);
        }

        public static IOpenTracingBuilder ConfigureSystemSqlClient(this IOpenTracingBuilder builder, Action<SqlClientDiagnosticOptions> options)
        {
            if (builder == null)
                throw new ArgumentNullException(nameof(builder));

            if (options != null)
            {
                builder.Services.Configure(options);
            }

            return builder;
        }

        public static IOpenTracingBuilder AddLoggerProvider(this IOpenTracingBuilder builder)
        {
            if (builder == null)
                throw new ArgumentNullException(nameof(builder));

            builder.Services.TryAddEnumerable(ServiceDescriptor.Singleton<ILoggerProvider, OpenTracingLoggerProvider>());
            builder.Services.Configure<LoggerFilterOptions>(options =>
            {
                // All interesting request-specific logs are instrumented via DiagnosticSource.
                options.AddFilter<OpenTracingLoggerProvider>("Microsoft.AspNetCore.Hosting", LogLevel.None);

                // The "Information"-level in ASP.NET Core is too verbose.
                options.AddFilter<OpenTracingLoggerProvider>("Microsoft.AspNetCore", LogLevel.Warning);

                // EF Core is sending everything to DiagnosticSource AND ILogger so we completely disable the category.
                options.AddFilter<OpenTracingLoggerProvider>("Microsoft.EntityFrameworkCore", LogLevel.None);
            });

            return builder;
        }
    }
}


================================================
FILE: src/OpenTracing.Contrib.NetCore/Configuration/ServiceCollectionExtensions.cs
================================================
using System;
using Microsoft.Extensions.DependencyInjection.Extensions;
using Microsoft.Extensions.Hosting;
using OpenTracing;
using OpenTracing.Contrib.NetCore;
using OpenTracing.Contrib.NetCore.Configuration;
using OpenTracing.Contrib.NetCore.Internal;
using OpenTracing.Util;

namespace Microsoft.Extensions.DependencyInjection
{
    public static class ServiceCollectionExtensions
    {
        /// <summary>
        /// Adds OpenTracing instrumentation for ASP.NET Core, CoreFx (BCL), Entity Framework Core.
        /// </summary>
        public static IServiceCollection AddOpenTracing(this IServiceCollection services, Action<IOpenTracingBuilder> builder = null)
        {
            if (services == null)
                throw new ArgumentNullException(nameof(services));

            return services.AddOpenTracingCoreServices(otBuilder =>
            {
                otBuilder.AddLoggerProvider();
                otBuilder.AddEntityFrameworkCore();
                otBuilder.AddGenericDiagnostics();
                otBuilder.AddHttpHandler();
                otBuilder.AddMicrosoftSqlClient();
                otBuilder.AddSystemSqlClient();

                if (AssemblyExists("Microsoft.AspNetCore.Hosting"))
                {
                    otBuilder.AddAspNetCore();
                }

                builder?.Invoke(otBuilder);
            });
        }

        /// <summary>
        /// Adds the core services required for OpenTracing without any actual instrumentations.
        /// </summary>
        public static IServiceCollection AddOpenTracingCoreServices(this IServiceCollection services, Action<IOpenTracingBuilder> builder = null)
        {
            if (services == null)
                throw new ArgumentNullException(nameof(services));

            services.TryAddSingleton<ITracer>(GlobalTracer.Instance);
            services.TryAddSingleton<IGlobalTracerAccessor, GlobalTracerAccessor>();

            services.TryAddSingleton<DiagnosticManager>();
            services.TryAddEnumerable(ServiceDescriptor.Singleton<IHostedService, InstrumentationService>());

            var builderInstance = new OpenTracingBuilder(services);

            builder?.Invoke(builderInstance);

            return services;
        }

        private static bool AssemblyExists(string assemblyName)
        {
            var assemblies = AppDomain.CurrentDomain.GetAssemblies();
            foreach (var assembly in assemblies)
            {
                if (assembly.FullName.StartsWith(assemblyName))
                    return true;
            }
            return false;
        }
    }
}


================================================
FILE: src/OpenTracing.Contrib.NetCore/EntityFrameworkCore/EntityFrameworkCoreDiagnosticOptions.cs
================================================
using System;
using System.Collections.Generic;
using Microsoft.EntityFrameworkCore.Diagnostics;

namespace OpenTracing.Contrib.NetCore.Configuration
{
    public class EntityFrameworkCoreDiagnosticOptions : DiagnosticOptions
    {
        // NOTE: Everything here that references any EFCore types MUST NOT be initialized in the constructor as that would throw on applications that don't reference EFCore.

        public const string DefaultComponent = "EFCore";

        private string _componentName = DefaultComponent;
        private List<Func<CommandEventData, bool>> _ignorePatterns;
        private Func<CommandEventData, string> _operationNameResolver;

        public EntityFrameworkCoreDiagnosticOptions()
        {
            IgnoredEvents.Add("Microsoft.EntityFrameworkCore.ChangeTracking.StartedTracking");
            IgnoredEvents.Add("Microsoft.EntityFrameworkCore.ChangeTracking.DetectChangesStarting");
            IgnoredEvents.Add("Microsoft.EntityFrameworkCore.ChangeTracking.DetectChangesCompleted");
            IgnoredEvents.Add("Microsoft.EntityFrameworkCore.ChangeTracking.ForeignKeyChangeDetected");
            IgnoredEvents.Add("Microsoft.EntityFrameworkCore.ChangeTracking.StateChanged");
            IgnoredEvents.Add("Microsoft.EntityFrameworkCore.ChangeTracking.ValueGenerated");
            IgnoredEvents.Add("Microsoft.EntityFrameworkCore.Database.Command.CommandCreating");
            IgnoredEvents.Add("Microsoft.EntityFrameworkCore.Database.Command.CommandCreated");
            IgnoredEvents.Add("Microsoft.EntityFrameworkCore.Database.Command.DataReaderDisposing");
            IgnoredEvents.Add("Microsoft.EntityFrameworkCore.Database.Connection.ConnectionOpening");
            IgnoredEvents.Add("Microsoft.EntityFrameworkCore.Database.Connection.ConnectionOpened");
            IgnoredEvents.Add("Microsoft.EntityFrameworkCore.Database.Connection.ConnectionClosing");
            IgnoredEvents.Add("Microsoft.EntityFrameworkCore.Database.Connection.ConnectionClosed");
            IgnoredEvents.Add("Microsoft.EntityFrameworkCore.Database.Transaction.TransactionStarting");
            IgnoredEvents.Add("Microsoft.EntityFrameworkCore.Database.Transaction.TransactionStarted");
            IgnoredEvents.Add("Microsoft.EntityFrameworkCore.Database.Transaction.TransactionCommitting");
            IgnoredEvents.Add("Microsoft.EntityFrameworkCore.Database.Transaction.TransactionCommitted");
            IgnoredEvents.Add("Microsoft.EntityFrameworkCore.Database.Transaction.TransactionDisposed");
            IgnoredEvents.Add("Microsoft.EntityFrameworkCore.Infrastructure.ContextDisposed");
        }

        /// <summary>
        /// A list of delegates that define whether or not a given EF Core command should be ignored.
        /// <para/>
        /// If any delegate in the list returns <c>true</c>, the EF Core command will be ignored.
        /// </summary>
        public List<Func<CommandEventData, bool>> IgnorePatterns => _ignorePatterns ??= new List<Func<CommandEventData, bool>>();

        /// <summary>
        /// Allows changing the "component" tag of created spans.
        /// </summary>
        public string ComponentName
        {
            get => _componentName;
            set => _componentName = value ?? throw new ArgumentNullException(nameof(ComponentName));
        }

        /// <summary>
        /// A delegate that returns the OpenTracing "operation name" for the given command.
        /// </summary>
        public Func<CommandEventData, string> OperationNameResolver
        {
            get
            {
                if (_operationNameResolver == null)
                {
                    // Default value may not be set in the constructor because this would fail
                    // if the target application does not reference EFCore.
                    _operationNameResolver = (data) => "DB " + data.ExecuteMethod.ToString();
                }
                return _operationNameResolver;
            }
            set => _operationNameResolver = value ?? throw new ArgumentNullException(nameof(OperationNameResolver));
        }
    }
}


================================================
FILE: src/OpenTracing.Contrib.NetCore/EntityFrameworkCore/EntityFrameworkCoreDiagnostics.cs
================================================
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using Microsoft.EntityFrameworkCore.Diagnostics;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using OpenTracing.Contrib.NetCore.Configuration;
using OpenTracing.Contrib.NetCore.Internal;
using OpenTracing.Tag;

namespace OpenTracing.Contrib.NetCore.EntityFrameworkCore
{
    internal sealed class EntityFrameworkCoreDiagnostics : DiagnosticEventObserver
    {
        // https://github.com/aspnet/EntityFrameworkCore/blob/dev/src/EFCore/DbLoggerCategory.cs
        public const string DiagnosticListenerName = "Microsoft.EntityFrameworkCore";

        private const string TagMethod = "db.method";
        private const string TagIsAsync = "db.async";

        private readonly EntityFrameworkCoreDiagnosticOptions _options;
        private readonly ConcurrentDictionary<object, IScope> _scopeStorage;

        public EntityFrameworkCoreDiagnostics(ILoggerFactory loggerFactory, ITracer tracer,
            IOptions<EntityFrameworkCoreDiagnosticOptions> options)
            : base(loggerFactory, tracer, options?.Value)
        {
            _options = options?.Value ?? throw new ArgumentNullException(nameof(options));
            _scopeStorage = new ConcurrentDictionary<object, IScope>();
        }

        protected override string GetListenerName() => DiagnosticListenerName;

        protected override IEnumerable<string> HandledEventNames()
        {
            yield return "Microsoft.EntityFrameworkCore.Database.Command.CommandExecuting";
            yield return "Microsoft.EntityFrameworkCore.Database.Command.CommandExecuted";
            yield return "Microsoft.EntityFrameworkCore.Database.Command.CommandError";
        }

        protected override void HandleEvent(string eventName, object untypedArg)
        {
            switch (eventName)
            {
                case "Microsoft.EntityFrameworkCore.Database.Command.CommandExecuting":
                    {
                        CommandEventData args = (CommandEventData)untypedArg;

                        var activeSpan = Tracer.ActiveSpan;

                        if (activeSpan == null && !_options.StartRootSpans)
                        {
                            if (IsLogLevelTraceEnabled)
                            {
                                Logger.LogTrace("Ignoring EF command due to missing parent span");
                            }
                            return;
                        }

                        if (IgnoreEvent(args))
                        {
                            if (IsLogLevelTraceEnabled)
                            {
                                Logger.LogTrace("Ignoring EF command due to IgnorePatterns");
                            }
                            return;
                        }

                        string operationName = _options.OperationNameResolver(args);

                        var scope = Tracer.BuildSpan(operationName)
                            .AsChildOf(activeSpan)
                            .WithTag(Tags.SpanKind, Tags.SpanKindClient)
                            .WithTag(Tags.Component, _options.ComponentName)
                            .WithTag(Tags.DbInstance, args.Command.Connection.Database)
                            .WithTag(Tags.DbStatement, args.Command.CommandText)
                            .WithTag(TagMethod, args.ExecuteMethod.ToString())
                            .WithTag(TagIsAsync, args.IsAsync)
                            .StartActive();

                        _scopeStorage.TryAdd(args.CommandId, scope);
                    }
                    break;

                case "Microsoft.EntityFrameworkCore.Database.Command.CommandExecuted":
                    {
                        CommandExecutedEventData args = (CommandExecutedEventData)untypedArg;

                        if (_scopeStorage.TryRemove(args.CommandId, out var scope))
                        {
                            scope.Dispose();
                        }
                    }
                    break;

                case "Microsoft.EntityFrameworkCore.Database.Command.CommandError":
                    {
                        CommandErrorEventData args = (CommandErrorEventData)untypedArg;

                        // The "CommandExecuted" event is NOT called in case of an exception,
                        // so we have to dispose the scope here as well!
                        if (_scopeStorage.TryRemove(args.CommandId, out var scope))
                        {
                            scope.Span.SetException(args.Exception);
                            scope.Dispose();
                        }
                    }
                    break;

                default:
                    {
                        Dictionary<string, string> tags = null;
                        if (untypedArg is EventData eventArgs)
                        {
                            tags = new Dictionary<string, string>
                            {
                                { "level", eventArgs.LogLevel.ToString() },
                            };
                        }

                        HandleUnknownEvent(eventName, untypedArg, tags);
                        break;
                    }
                    
            }
        }

        private bool IgnoreEvent(CommandEventData eventData)
        {
            foreach (Func<CommandEventData, bool> ignore in _options.IgnorePatterns)
            {
                if (ignore(eventData))
                    return true;
            }

            return false;
        }
    }
}


================================================
FILE: src/OpenTracing.Contrib.NetCore/GenericListeners/GenericDiagnosticOptions.cs
================================================
using System.Collections.Generic;

namespace OpenTracing.Contrib.NetCore.Configuration
{
    public sealed class GenericDiagnosticOptions
    {
        public HashSet<string> IgnoredListenerNames { get; } = new HashSet<string>();

        public Dictionary<string, HashSet<string>> IgnoredEvents { get; } = new Dictionary<string, HashSet<string>>();

        public void IgnoreEvent(string diagnosticListenerName, string eventName)
        {
            if (diagnosticListenerName == null || eventName == null)
                return;

            HashSet<string> ignoredListenerEvents;

            if (!IgnoredEvents.TryGetValue(diagnosticListenerName, out ignoredListenerEvents))
            {
                ignoredListenerEvents = new HashSet<string>();
                IgnoredEvents.Add(diagnosticListenerName, ignoredListenerEvents);
            }

            ignoredListenerEvents.Add(eventName);
        }
    }
}


================================================
FILE: src/OpenTracing.Contrib.NetCore/GenericListeners/GenericDiagnostics.cs
================================================
using System;
using System.Collections.Generic;
using System.Diagnostics;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using OpenTracing.Contrib.NetCore.Configuration;
using OpenTracing.Contrib.NetCore.Internal;

namespace OpenTracing.Contrib.NetCore.GenericListeners
{
    /// <summary>
    /// A <see cref="DiagnosticListener"/> subscriber that logs ALL events to <see cref="ITracer.ActiveSpan"/>.
    /// </summary>
    internal sealed class GenericDiagnostics : DiagnosticObserver
    {
        private readonly GenericDiagnosticOptions _options;

        public GenericDiagnostics(ILoggerFactory loggerFactory, ITracer tracer, IOptions<GenericDiagnosticOptions> options)
            : base(loggerFactory, tracer)
        {
            _options = options?.Value ?? throw new ArgumentNullException(nameof(options));
        }

        public override IDisposable SubscribeIfMatch(DiagnosticListener diagnosticListener)
        {
            if (_options.IgnoredListenerNames.Contains(diagnosticListener.Name))
            {
                return null;
            }

            _options.IgnoredEvents.TryGetValue(diagnosticListener.Name, out var ignoredListenerEvents);

            return new GenericDiagnosticsSubscription(this, diagnosticListener, ignoredListenerEvents);
        }

        private class GenericDiagnosticsSubscription : IObserver<KeyValuePair<string, object>>, IDisposable
        {
            private readonly GenericDiagnostics _subscriber;
            private readonly string _listenerName;
            private readonly HashSet<string> _ignoredEvents;
            private readonly GenericEventProcessor _genericEventProcessor;

            private readonly IDisposable _subscription;


            public GenericDiagnosticsSubscription(GenericDiagnostics subscriber, DiagnosticListener diagnosticListener,
                 HashSet<string> ignoredEvents)
            {
                _subscriber = subscriber;
                _ignoredEvents = ignoredEvents;
                _listenerName = diagnosticListener.Name;

                _genericEventProcessor = new GenericEventProcessor(_listenerName, _subscriber.Tracer, subscriber.Logger);

                _subscription = diagnosticListener.Subscribe(this, IsEnabled);
            }

            public void Dispose()
            {
                _subscription.Dispose();
            }

            private bool IsEnabled(string eventName)
            {
                if (_ignoredEvents != null && _ignoredEvents.Contains(eventName))
                {
                    if (_subscriber.IsLogLevelTraceEnabled)
                    {
                        _subscriber.Logger.LogTrace("Ignoring event '{ListenerName}/{Event}'", _listenerName, eventName);
                    }

                    return false;
                }

                return true;
            }

            public void OnCompleted()
            {
            }

            public void OnError(Exception error)
            {
            }

            public void OnNext(KeyValuePair<string, object> value)
            {
                string eventName = value.Key;
                object untypedArg = value.Value;

                try
                {
                    // We have to check this twice because EVERY subscriber is called
                    // if ANY subscriber returns IsEnabled=true.
                    if (!IsEnabled(eventName))
                        return;

                    _genericEventProcessor?.ProcessEvent(eventName, untypedArg);
                }
                catch (Exception ex)
                {
                    _subscriber.Logger.LogWarning(ex, "Event-Exception: {ListenerName}/{Event}", _listenerName, value.Key);
                }
            }
        }
    }
}


================================================
FILE: src/OpenTracing.Contrib.NetCore/HttpHandler/HttpHandlerDiagnosticOptions.cs
================================================
using System;
using System.Collections.Generic;
using System.Net.Http;

namespace OpenTracing.Contrib.NetCore.Configuration
{
    public class HttpHandlerDiagnosticOptions : DiagnosticOptions
    {
        public const string PropertyIgnore = "ot-ignore";

        public const string DefaultComponent = "HttpOut";

        private string _componentName;
        private Func<HttpRequestMessage, string> _operationNameResolver;

        /// <summary>
        /// Allows changing the "component" tag of created spans.
        /// </summary>
        public string ComponentName
        {
            get => _componentName;
            set => _componentName = value ?? throw new ArgumentNullException(nameof(ComponentName));
        }

        /// <summary>
        /// A list of delegates that define whether or not a given request should be ignored.
        /// <para/>
        /// If any delegate in the list returns <c>true</c>, the request will be ignored.
        /// </summary>
        public List<Func<HttpRequestMessage, bool>> IgnorePatterns { get; } = new List<Func<HttpRequestMessage, bool>>();

        /// <summary>
        /// A delegates that defines on what requests tracing headers are propagated.
        /// </summary>
        public Func<HttpRequestMessage, bool> InjectEnabled { get; set; }

        /// <summary>
        /// A delegate that returns the OpenTracing "operation name" for the given request.
        /// </summary>
        public Func<HttpRequestMessage, string> OperationNameResolver
        {
            get => _operationNameResolver;
            set => _operationNameResolver = value ?? throw new ArgumentNullException(nameof(OperationNameResolver));
        }

        /// <summary>
        /// Allows the modification of the created span to e.g. add further tags.
        /// </summary>
        public Action<ISpan, HttpRequestMessage> OnRequest { get; set; }

        /// <summary>
        /// Allows the modification of the created span when error occured to e.g. add further tags.
        /// </summary>
        public Action<ISpan, Exception, HttpRequestMessage> OnError { get; set; }

        public HttpHandlerDiagnosticOptions()
        {
            // Default settings

            ComponentName = DefaultComponent;

            IgnorePatterns.Add((request) =>
            {
                IDictionary<string, object> requestOptions;

#if NETCOREAPP3_1
                requestOptions = request.Properties;
#else 
                requestOptions = request.Options;
#endif

                return requestOptions.ContainsKey(PropertyIgnore);
            });

            OperationNameResolver = (request) =>
            {
                return "HTTP " + request.Method.Method;
            };
        }
    }
}


================================================
FILE: src/OpenTracing.Contrib.NetCore/HttpHandler/HttpHandlerDiagnostics.cs
================================================
using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Threading.Tasks;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using OpenTracing.Contrib.NetCore.Configuration;
using OpenTracing.Contrib.NetCore.Internal;
using OpenTracing.Propagation;
using OpenTracing.Tag;

namespace OpenTracing.Contrib.NetCore.HttpHandler
{
    /// <summary>
    /// Instruments outgoing HTTP calls that use <see cref="HttpClientHandler"/>.
    /// <para/>See https://github.com/dotnet/corefx/blob/master/src/System.Net.Http/src/System/Net/Http/DiagnosticsHandler.cs
    /// <para/>and https://github.com/dotnet/corefx/blob/master/src/System.Net.Http/src/System/Net/Http/DiagnosticsHandlerLoggingStrings.cs
    /// </summary>
    internal sealed class HttpHandlerDiagnostics : DiagnosticEventObser
Download .txt
gitextract_0r5cqphu/

├── .appveyor.yml
├── .editorconfig
├── .gitattributes
├── .gitignore
├── .travis.yml
├── .vscode/
│   ├── extensions.json
│   ├── settings.json
│   └── tasks.json
├── Directory.Build.props
├── LICENSE
├── NuGet.config
├── OpenTracing.Contrib.sln
├── README.md
├── RELEASE.md
├── SignKey.snk
├── benchmarks/
│   └── OpenTracing.Contrib.NetCore.Benchmarks/
│       ├── AspNetCore/
│       │   └── RequestDiagnosticsBenchmark.cs
│       ├── CoreFx/
│       │   └── HttpHandlerDiagnosticsBenchmark.cs
│       ├── InstrumentationMode.cs
│       ├── OpenTracing.Contrib.NetCore.Benchmarks.csproj
│       ├── OpenTracingBuilderExtensions.cs
│       └── Program.cs
├── build.ps1
├── global.json
├── launch-sample.ps1
├── samples/
│   ├── net6.0/
│   │   ├── CustomersApi/
│   │   │   ├── Controllers/
│   │   │   │   └── CustomersController.cs
│   │   │   ├── CustomersApi.csproj
│   │   │   ├── DataStore/
│   │   │   │   └── CustomerDbContext.cs
│   │   │   ├── Program.cs
│   │   │   ├── Properties/
│   │   │   │   └── launchSettings.json
│   │   │   ├── Startup.cs
│   │   │   └── appsettings.json
│   │   ├── FrontendWeb/
│   │   │   ├── Controllers/
│   │   │   │   └── HomeController.cs
│   │   │   ├── FrontendWeb.csproj
│   │   │   ├── Program.cs
│   │   │   ├── Properties/
│   │   │   │   └── launchSettings.json
│   │   │   ├── Startup.cs
│   │   │   ├── Views/
│   │   │   │   ├── Home/
│   │   │   │   │   ├── Index.cshtml
│   │   │   │   │   └── PlaceOrder.cshtml
│   │   │   │   └── _ViewImports.cshtml
│   │   │   └── appsettings.json
│   │   ├── OrdersApi/
│   │   │   ├── Controllers/
│   │   │   │   └── OrdersController.cs
│   │   │   ├── DataStore/
│   │   │   │   ├── Order.cs
│   │   │   │   └── OrdersDbContext.cs
│   │   │   ├── OrdersApi.csproj
│   │   │   ├── Program.cs
│   │   │   ├── Properties/
│   │   │   │   └── launchSettings.json
│   │   │   ├── Startup.cs
│   │   │   └── appsettings.json
│   │   ├── Shared/
│   │   │   ├── Constants.cs
│   │   │   ├── Customer.cs
│   │   │   ├── JaegerServiceCollectionExtensions.cs
│   │   │   ├── PlaceOrderCommand.cs
│   │   │   └── Shared.csproj
│   │   └── TrafficGenerator/
│   │       ├── Program.cs
│   │       ├── TrafficGenerator.csproj
│   │       ├── Worker.cs
│   │       └── appsettings.json
│   ├── net7.0/
│   │   ├── CustomersApi/
│   │   │   ├── CustomersApi.csproj
│   │   │   ├── DataStore/
│   │   │   │   └── CustomerDbContext.cs
│   │   │   ├── Program.cs
│   │   │   ├── Properties/
│   │   │   │   └── launchSettings.json
│   │   │   └── appsettings.json
│   │   ├── FrontendWeb/
│   │   │   ├── Controllers/
│   │   │   │   └── HomeController.cs
│   │   │   ├── FrontendWeb.csproj
│   │   │   ├── Program.cs
│   │   │   ├── Properties/
│   │   │   │   └── launchSettings.json
│   │   │   ├── Views/
│   │   │   │   ├── Home/
│   │   │   │   │   ├── Index.cshtml
│   │   │   │   │   └── PlaceOrder.cshtml
│   │   │   │   └── _ViewImports.cshtml
│   │   │   └── appsettings.json
│   │   ├── OrdersApi/
│   │   │   ├── Controllers/
│   │   │   │   └── OrdersController.cs
│   │   │   ├── DataStore/
│   │   │   │   ├── Order.cs
│   │   │   │   └── OrdersDbContext.cs
│   │   │   ├── OrdersApi.csproj
│   │   │   ├── Program.cs
│   │   │   ├── Properties/
│   │   │   │   └── launchSettings.json
│   │   │   └── appsettings.json
│   │   ├── Shared/
│   │   │   ├── Constants.cs
│   │   │   ├── Customer.cs
│   │   │   ├── JaegerServiceCollectionExtensions.cs
│   │   │   ├── PlaceOrderCommand.cs
│   │   │   └── Shared.csproj
│   │   └── TrafficGenerator/
│   │       ├── Program.cs
│   │       ├── TrafficGenerator.csproj
│   │       ├── Worker.cs
│   │       └── appsettings.json
│   └── netcoreapp3.1/
│       ├── CustomersApi/
│       │   ├── Controllers/
│       │   │   └── CustomersController.cs
│       │   ├── CustomersApi.csproj
│       │   ├── DataStore/
│       │   │   └── CustomerDbContext.cs
│       │   ├── Program.cs
│       │   ├── Properties/
│       │   │   └── launchSettings.json
│       │   ├── Startup.cs
│       │   └── appsettings.json
│       ├── FrontendWeb/
│       │   ├── Controllers/
│       │   │   └── HomeController.cs
│       │   ├── FrontendWeb.csproj
│       │   ├── Program.cs
│       │   ├── Properties/
│       │   │   └── launchSettings.json
│       │   ├── Startup.cs
│       │   ├── Views/
│       │   │   ├── Home/
│       │   │   │   ├── Index.cshtml
│       │   │   │   └── PlaceOrder.cshtml
│       │   │   └── _ViewImports.cshtml
│       │   └── appsettings.json
│       ├── OrdersApi/
│       │   ├── Controllers/
│       │   │   └── OrdersController.cs
│       │   ├── DataStore/
│       │   │   ├── Order.cs
│       │   │   └── OrdersDbContext.cs
│       │   ├── OrdersApi.csproj
│       │   ├── Program.cs
│       │   ├── Properties/
│       │   │   └── launchSettings.json
│       │   ├── Startup.cs
│       │   └── appsettings.json
│       ├── Shared/
│       │   ├── Constants.cs
│       │   ├── Customer.cs
│       │   ├── JaegerServiceCollectionExtensions.cs
│       │   ├── PlaceOrderCommand.cs
│       │   └── Shared.csproj
│       └── TrafficGenerator/
│           ├── Program.cs
│           ├── TrafficGenerator.csproj
│           ├── Worker.cs
│           └── appsettings.json
├── src/
│   ├── Directory.Build.props
│   └── OpenTracing.Contrib.NetCore/
│       ├── AspNetCore/
│       │   ├── AspNetCoreDiagnosticOptions.cs
│       │   ├── AspNetCoreDiagnostics.cs
│       │   ├── HostingOptions.cs
│       │   └── RequestHeadersExtractAdapter.cs
│       ├── Configuration/
│       │   ├── DiagnosticOptions.cs
│       │   ├── IOpenTracingBuilder.cs
│       │   ├── OpenTracingBuilder.cs
│       │   ├── OpenTracingBuilderExtensions.cs
│       │   └── ServiceCollectionExtensions.cs
│       ├── EntityFrameworkCore/
│       │   ├── EntityFrameworkCoreDiagnosticOptions.cs
│       │   └── EntityFrameworkCoreDiagnostics.cs
│       ├── GenericListeners/
│       │   ├── GenericDiagnosticOptions.cs
│       │   └── GenericDiagnostics.cs
│       ├── HttpHandler/
│       │   ├── HttpHandlerDiagnosticOptions.cs
│       │   ├── HttpHandlerDiagnostics.cs
│       │   └── HttpHeadersInjectAdapter.cs
│       ├── InstrumentationService.cs
│       ├── Internal/
│       │   ├── DiagnosticEventObserver.cs
│       │   ├── DiagnosticManager.cs
│       │   ├── DiagnosticManagerOptions.cs
│       │   ├── DiagnosticObserver.cs
│       │   ├── GenericEventProcessor.cs
│       │   ├── GlobalTracerAccessor.cs
│       │   ├── IGlobalTracerAccessor.cs
│       │   ├── PropertyFetcher.cs
│       │   ├── SpanExtensions.cs
│       │   └── TracerExtensions.cs
│       ├── Logging/
│       │   ├── OpenTracingLogger.cs
│       │   └── OpenTracingLoggerProvider.cs
│       ├── MicrosoftSqlClient/
│       │   ├── MicrosoftSqlClientDiagnosticOptions.cs
│       │   └── MicrosoftSqlClientDiagnostics.cs
│       ├── OpenTracing.Contrib.NetCore.csproj
│       ├── Properties/
│       │   └── AssemblyInfo.cs
│       └── SystemSqlClient/
│           ├── SqlClientDiagnosticOptions.cs
│           └── SqlClientDiagnostics.cs
├── test/
│   └── OpenTracing.Contrib.NetCore.Tests/
│       ├── AspNetCore/
│       │   └── HostingTest.cs
│       ├── CoreFx/
│       │   └── HttpHandlerDiagnosticTest.cs
│       ├── Internal/
│       │   ├── DiagnosticManagerTest.cs
│       │   └── PropertyFetcherTest.cs
│       ├── Logging/
│       │   ├── LoggingDependencyInjectionTest.cs
│       │   └── LoggingTest.cs
│       ├── OpenTracing.Contrib.NetCore.Tests.csproj
│       └── XunitLogging/
│           ├── XunitLoggerFactoryExtensions.cs
│           └── XunitLoggerProvider.cs
└── version.props
Download .txt
SYMBOL INDEX (397 symbols across 92 files)

FILE: benchmarks/OpenTracing.Contrib.NetCore.Benchmarks/AspNetCore/RequestDiagnosticsBenchmark.cs
  class TestProgramFactory (line 15) | public class TestProgramFactory : WebApplicationFactory<TestProgramFactory>
    method CreateWebHostBuilder (line 17) | protected override IWebHostBuilder CreateWebHostBuilder()
  class RequestDiagnosticsBenchmark (line 46) | public class RequestDiagnosticsBenchmark
    method GlobalSetup (line 54) | [GlobalSetup]
    method GlobalCleanup (line 75) | [GlobalCleanup]
    method GetAsync (line 81) | [Benchmark]

FILE: benchmarks/OpenTracing.Contrib.NetCore.Benchmarks/CoreFx/HttpHandlerDiagnosticsBenchmark.cs
  class HttpHandlerDiagnosticsBenchmark (line 13) | public class HttpHandlerDiagnosticsBenchmark
    method GlobalSetup (line 21) | [GlobalSetup]
    method GlobalCleanup (line 39) | [GlobalCleanup]
    method HttpClient_GetAsync (line 45) | [Benchmark]
    method CreateHttpClient (line 51) | private static HttpClient CreateHttpClient()
    class MockHttpMessageHandler (line 64) | private class MockHttpMessageHandler : HttpMessageHandler
      method SendAsync (line 66) | protected override async Task<HttpResponseMessage> SendAsync(HttpReq...

FILE: benchmarks/OpenTracing.Contrib.NetCore.Benchmarks/InstrumentationMode.cs
  type InstrumentationMode (line 3) | public enum InstrumentationMode

FILE: benchmarks/OpenTracing.Contrib.NetCore.Benchmarks/OpenTracingBuilderExtensions.cs
  class OpenTracingBuilderExtensions (line 9) | public static class OpenTracingBuilderExtensions
    method AddBenchmarkTracer (line 11) | public static IOpenTracingBuilder AddBenchmarkTracer(this IOpenTracing...

FILE: benchmarks/OpenTracing.Contrib.NetCore.Benchmarks/Program.cs
  class Program (line 5) | class Program
    method Main (line 7) | static void Main(string[] args)

FILE: samples/net6.0/CustomersApi/Controllers/CustomersController.cs
  class CustomersController (line 8) | [Route("customers")]
    method CustomersController (line 14) | public CustomersController(CustomerDbContext dbContext, ILogger<Custom...
    method Index (line 20) | [HttpGet]
    method Index (line 26) | [HttpGet("{id:int}")]

FILE: samples/net6.0/CustomersApi/DataStore/CustomerDbContext.cs
  class CustomerDbContext (line 6) | public class CustomerDbContext : DbContext
    method CustomerDbContext (line 8) | public CustomerDbContext(DbContextOptions<CustomerDbContext> options)
    method Seed (line 15) | public void Seed()

FILE: samples/net6.0/CustomersApi/Program.cs
  class Program (line 8) | public class Program
    method Main (line 10) | public static void Main(string[] args)
    method CreateHostBuilder (line 15) | public static IHostBuilder CreateHostBuilder(string[] args)

FILE: samples/net6.0/CustomersApi/Startup.cs
  class Startup (line 9) | public class Startup
    method ConfigureServices (line 11) | public void ConfigureServices(IServiceCollection services)
    method Configure (line 26) | public void Configure(IApplicationBuilder app)
    method BootstrapDataStore (line 45) | private void BootstrapDataStore(IServiceProvider serviceProvider)

FILE: samples/net6.0/FrontendWeb/Controllers/HomeController.cs
  class HomeController (line 14) | public class HomeController : Controller
    method HomeController (line 18) | public HomeController(HttpClient httpClient)
    method Index (line 23) | [HttpGet]
    method PlaceOrder (line 29) | [HttpGet]
    method PlaceOrder (line 36) | [HttpPost, ValidateAntiForgeryToken]
    method GetCustomers (line 59) | private async Task<IEnumerable<SelectListItem>> GetCustomers()

FILE: samples/net6.0/FrontendWeb/Program.cs
  class Program (line 8) | public class Program
    method Main (line 10) | public static void Main(string[] args)
    method CreateHostBuilder (line 15) | public static IHostBuilder CreateHostBuilder(string[] args)

FILE: samples/net6.0/FrontendWeb/Startup.cs
  class Startup (line 7) | public class Startup
    method ConfigureServices (line 9) | public void ConfigureServices(IServiceCollection services)
    method Configure (line 16) | public void Configure(IApplicationBuilder app)

FILE: samples/net6.0/OrdersApi/Controllers/OrdersController.cs
  class OrdersController (line 15) | [Route("orders")]
    method OrdersController (line 22) | public OrdersController(OrdersDbContext dbContext, HttpClient httpClie...
    method Index (line 29) | [HttpGet]
    method Index (line 37) | [HttpPost]
    method GetCustomer (line 65) | private async Task<Customer> GetCustomer(int customerId)

FILE: samples/net6.0/OrdersApi/DataStore/Order.cs
  class Order (line 6) | public class Order

FILE: samples/net6.0/OrdersApi/DataStore/OrdersDbContext.cs
  class OrdersDbContext (line 5) | public class OrdersDbContext : DbContext
    method OrdersDbContext (line 7) | public OrdersDbContext(DbContextOptions<OrdersDbContext> options)
    method Seed (line 14) | public void Seed()

FILE: samples/net6.0/OrdersApi/Program.cs
  class Program (line 8) | public class Program
    method Main (line 10) | public static void Main(string[] args)
    method CreateHostBuilder (line 15) | public static IHostBuilder CreateHostBuilder(string[] args)

FILE: samples/net6.0/OrdersApi/Startup.cs
  class Startup (line 10) | public class Startup
    method ConfigureServices (line 12) | public void ConfigureServices(IServiceCollection services)
    method Configure (line 29) | public void Configure(IApplicationBuilder app)
    method BootstrapDataStore (line 48) | private void BootstrapDataStore(IServiceProvider serviceProvider)

FILE: samples/net6.0/Shared/Constants.cs
  class Constants (line 3) | public class Constants

FILE: samples/net6.0/Shared/Customer.cs
  class Customer (line 3) | public class Customer
    method Customer (line 8) | public Customer()
    method Customer (line 12) | public Customer(int customerId, string name)

FILE: samples/net6.0/Shared/JaegerServiceCollectionExtensions.cs
  class JaegerServiceCollectionExtensions (line 14) | public static class JaegerServiceCollectionExtensions
    method AddJaeger (line 18) | public static IServiceCollection AddJaeger(this IServiceCollection ser...

FILE: samples/net6.0/Shared/PlaceOrderCommand.cs
  class PlaceOrderCommand (line 5) | public class PlaceOrderCommand

FILE: samples/net6.0/TrafficGenerator/Program.cs
  class Program (line 6) | class Program
    method Main (line 8) | public static void Main(string[] args)
    method CreateHostBuilder (line 13) | public static IHostBuilder CreateHostBuilder(string[] args) =>

FILE: samples/net6.0/TrafficGenerator/Worker.cs
  class Worker (line 11) | public class Worker : BackgroundService
    method Worker (line 15) | public Worker(ILogger<Worker> logger)
    method ExecuteAsync (line 20) | protected override async Task ExecuteAsync(CancellationToken stoppingT...

FILE: samples/net7.0/CustomersApi/DataStore/CustomerDbContext.cs
  class CustomerDbContext (line 6) | public class CustomerDbContext : DbContext
    method CustomerDbContext (line 8) | public CustomerDbContext(DbContextOptions<CustomerDbContext> options)
    method Seed (line 15) | public void Seed()

FILE: samples/net7.0/FrontendWeb/Controllers/HomeController.cs
  class HomeController (line 9) | public class HomeController : Controller
    method HomeController (line 13) | public HomeController(HttpClient httpClient)
    method Index (line 18) | [HttpGet]
    method PlaceOrder (line 24) | [HttpGet]
    method PlaceOrder (line 31) | [HttpPost, ValidateAntiForgeryToken]
    method GetCustomers (line 54) | private async Task<IEnumerable<SelectListItem>> GetCustomers()

FILE: samples/net7.0/OrdersApi/Controllers/OrdersController.cs
  class OrdersController (line 10) | [Route("orders")]
    method OrdersController (line 17) | public OrdersController(OrdersDbContext dbContext, HttpClient httpClie...
    method Index (line 24) | [HttpGet]
    method Index (line 32) | [HttpPost]
    method GetCustomer (line 60) | private async Task<Customer> GetCustomer(int customerId)

FILE: samples/net7.0/OrdersApi/DataStore/Order.cs
  class Order (line 5) | public class Order

FILE: samples/net7.0/OrdersApi/DataStore/OrdersDbContext.cs
  class OrdersDbContext (line 5) | public class OrdersDbContext : DbContext
    method OrdersDbContext (line 7) | public OrdersDbContext(DbContextOptions<OrdersDbContext> options)
    method Seed (line 14) | public void Seed()

FILE: samples/net7.0/Shared/Constants.cs
  class Constants (line 3) | public class Constants

FILE: samples/net7.0/Shared/Customer.cs
  class Customer (line 3) | public class Customer
    method Customer (line 8) | public Customer()
    method Customer (line 14) | public Customer(int customerId, string name)

FILE: samples/net7.0/Shared/JaegerServiceCollectionExtensions.cs
  class JaegerServiceCollectionExtensions (line 13) | public static class JaegerServiceCollectionExtensions
    method AddJaeger (line 17) | public static IServiceCollection AddJaeger(this IServiceCollection ser...

FILE: samples/net7.0/Shared/PlaceOrderCommand.cs
  class PlaceOrderCommand (line 5) | public class PlaceOrderCommand

FILE: samples/net7.0/TrafficGenerator/Worker.cs
  class Worker (line 5) | public class Worker : BackgroundService
    method Worker (line 9) | public Worker(ILogger<Worker> logger)
    method ExecuteAsync (line 14) | protected override async Task ExecuteAsync(CancellationToken stoppingT...

FILE: samples/netcoreapp3.1/CustomersApi/Controllers/CustomersController.cs
  class CustomersController (line 8) | [Route("customers")]
    method CustomersController (line 14) | public CustomersController(CustomerDbContext dbContext, ILogger<Custom...
    method Index (line 20) | [HttpGet]
    method Index (line 26) | [HttpGet("{id:int}")]

FILE: samples/netcoreapp3.1/CustomersApi/DataStore/CustomerDbContext.cs
  class CustomerDbContext (line 6) | public class CustomerDbContext : DbContext
    method CustomerDbContext (line 8) | public CustomerDbContext(DbContextOptions<CustomerDbContext> options)
    method Seed (line 15) | public void Seed()

FILE: samples/netcoreapp3.1/CustomersApi/Program.cs
  class Program (line 8) | public class Program
    method Main (line 10) | public static void Main(string[] args)
    method CreateHostBuilder (line 15) | public static IHostBuilder CreateHostBuilder(string[] args)

FILE: samples/netcoreapp3.1/CustomersApi/Startup.cs
  class Startup (line 9) | public class Startup
    method ConfigureServices (line 11) | public void ConfigureServices(IServiceCollection services)
    method Configure (line 26) | public void Configure(IApplicationBuilder app)
    method BootstrapDataStore (line 45) | public void BootstrapDataStore(IServiceProvider serviceProvider)

FILE: samples/netcoreapp3.1/FrontendWeb/Controllers/HomeController.cs
  class HomeController (line 14) | public class HomeController : Controller
    method HomeController (line 18) | public HomeController(HttpClient httpClient)
    method Index (line 23) | [HttpGet]
    method PlaceOrder (line 29) | [HttpGet]
    method PlaceOrder (line 36) | [HttpPost, ValidateAntiForgeryToken]
    method GetCustomers (line 59) | private async Task<IEnumerable<SelectListItem>> GetCustomers()

FILE: samples/netcoreapp3.1/FrontendWeb/Program.cs
  class Program (line 8) | public class Program
    method Main (line 10) | public static void Main(string[] args)
    method CreateHostBuilder (line 15) | public static IHostBuilder CreateHostBuilder(string[] args)

FILE: samples/netcoreapp3.1/FrontendWeb/Startup.cs
  class Startup (line 7) | public class Startup
    method ConfigureServices (line 9) | public void ConfigureServices(IServiceCollection services)
    method Configure (line 16) | public void Configure(IApplicationBuilder app)

FILE: samples/netcoreapp3.1/OrdersApi/Controllers/OrdersController.cs
  class OrdersController (line 15) | [Route("orders")]
    method OrdersController (line 22) | public OrdersController(OrdersDbContext dbContext, HttpClient httpClie...
    method Index (line 29) | [HttpGet]
    method Index (line 37) | [HttpPost]
    method GetCustomer (line 65) | private async Task<Customer> GetCustomer(int customerId)

FILE: samples/netcoreapp3.1/OrdersApi/DataStore/Order.cs
  class Order (line 6) | public class Order

FILE: samples/netcoreapp3.1/OrdersApi/DataStore/OrdersDbContext.cs
  class OrdersDbContext (line 5) | public class OrdersDbContext : DbContext
    method OrdersDbContext (line 7) | public OrdersDbContext(DbContextOptions<OrdersDbContext> options)
    method Seed (line 14) | public void Seed()

FILE: samples/netcoreapp3.1/OrdersApi/Program.cs
  class Program (line 8) | public class Program
    method Main (line 10) | public static void Main(string[] args)
    method CreateHostBuilder (line 15) | public static IHostBuilder CreateHostBuilder(string[] args)

FILE: samples/netcoreapp3.1/OrdersApi/Startup.cs
  class Startup (line 10) | public class Startup
    method ConfigureServices (line 12) | public void ConfigureServices(IServiceCollection services)
    method Configure (line 29) | public void Configure(IApplicationBuilder app)
    method BootstrapDataStore (line 48) | private void BootstrapDataStore(IServiceProvider serviceProvider)

FILE: samples/netcoreapp3.1/Shared/Constants.cs
  class Constants (line 3) | public class Constants

FILE: samples/netcoreapp3.1/Shared/Customer.cs
  class Customer (line 3) | public class Customer
    method Customer (line 8) | public Customer()
    method Customer (line 12) | public Customer(int customerId, string name)

FILE: samples/netcoreapp3.1/Shared/JaegerServiceCollectionExtensions.cs
  class JaegerServiceCollectionExtensions (line 14) | public static class JaegerServiceCollectionExtensions
    method AddJaeger (line 18) | public static IServiceCollection AddJaeger(this IServiceCollection ser...

FILE: samples/netcoreapp3.1/Shared/PlaceOrderCommand.cs
  class PlaceOrderCommand (line 5) | public class PlaceOrderCommand

FILE: samples/netcoreapp3.1/TrafficGenerator/Program.cs
  class Program (line 6) | class Program
    method Main (line 8) | public static void Main(string[] args)
    method CreateHostBuilder (line 13) | public static IHostBuilder CreateHostBuilder(string[] args) =>

FILE: samples/netcoreapp3.1/TrafficGenerator/Worker.cs
  class Worker (line 11) | public class Worker : BackgroundService
    method Worker (line 15) | public Worker(ILogger<Worker> logger)
    method ExecuteAsync (line 20) | protected override async Task ExecuteAsync(CancellationToken stoppingT...

FILE: src/OpenTracing.Contrib.NetCore/AspNetCore/AspNetCoreDiagnosticOptions.cs
  class AspNetCoreDiagnosticOptions (line 5) | public class AspNetCoreDiagnosticOptions : DiagnosticOptions
    method AspNetCoreDiagnosticOptions (line 9) | public AspNetCoreDiagnosticOptions()

FILE: src/OpenTracing.Contrib.NetCore/AspNetCore/AspNetCoreDiagnostics.cs
  class AspNetCoreDiagnostics (line 24) | internal sealed class AspNetCoreDiagnostics : DiagnosticEventObserver
    method AspNetCoreDiagnostics (line 54) | public AspNetCoreDiagnostics(ILoggerFactory loggerFactory, ITracer tra...
    method GetListenerName (line 60) | protected override string GetListenerName() => DiagnosticListenerName;
    method IsSupportedEvent (line 62) | protected override bool IsSupportedEvent(string eventName)
    method HandledEventNames (line 73) | protected override IEnumerable<string> HandledEventNames()
    method HandleEvent (line 84) | protected override void HandleEvent(string eventName, object untypedArg)
    method GetDisplayUrl (line 259) | private static string GetDisplayUrl(HttpRequest request)
    method ShouldIgnore (line 274) | private bool ShouldIgnore(HttpContext httpContext)

FILE: src/OpenTracing.Contrib.NetCore/AspNetCore/HostingOptions.cs
  class HostingOptions (line 7) | public class HostingOptions

FILE: src/OpenTracing.Contrib.NetCore/AspNetCore/RequestHeadersExtractAdapter.cs
  class RequestHeadersExtractAdapter (line 9) | internal sealed class RequestHeadersExtractAdapter : ITextMap
    method RequestHeadersExtractAdapter (line 13) | public RequestHeadersExtractAdapter(IHeaderDictionary headers)
    method Set (line 18) | public void Set(string key, string value)
    method GetEnumerator (line 23) | public IEnumerator<KeyValuePair<string, string>> GetEnumerator()
    method GetEnumerator (line 31) | IEnumerator IEnumerable.GetEnumerator()

FILE: src/OpenTracing.Contrib.NetCore/Configuration/DiagnosticOptions.cs
  class DiagnosticOptions (line 5) | public abstract class DiagnosticOptions

FILE: src/OpenTracing.Contrib.NetCore/Configuration/IOpenTracingBuilder.cs
  type IOpenTracingBuilder (line 6) | public interface IOpenTracingBuilder

FILE: src/OpenTracing.Contrib.NetCore/Configuration/OpenTracingBuilder.cs
  class OpenTracingBuilder (line 6) | internal class OpenTracingBuilder : IOpenTracingBuilder
    method OpenTracingBuilder (line 10) | public OpenTracingBuilder(IServiceCollection services)

FILE: src/OpenTracing.Contrib.NetCore/Configuration/OpenTracingBuilderExtensions.cs
  class OpenTracingBuilderExtensions (line 16) | public static class OpenTracingBuilderExtensions
    method AddDiagnosticSubscriber (line 18) | internal static IOpenTracingBuilder AddDiagnosticSubscriber<TDiagnosti...
    method AddAspNetCore (line 32) | public static IOpenTracingBuilder AddAspNetCore(this IOpenTracingBuild...
    method ConfigureAspNetCore (line 49) | public static IOpenTracingBuilder ConfigureAspNetCore(this IOpenTracin...
    method AddHttpHandler (line 65) | public static IOpenTracingBuilder AddHttpHandler(this IOpenTracingBuil...
    method ConfigureHttpHandler (line 76) | public static IOpenTracingBuilder ConfigureHttpHandler(this IOpenTraci...
    method AddEntityFrameworkCore (line 92) | public static IOpenTracingBuilder AddEntityFrameworkCore(this IOpenTra...
    method ConfigureEntityFrameworkCore (line 106) | public static IOpenTracingBuilder ConfigureEntityFrameworkCore(this IO...
    method AddGenericDiagnostics (line 123) | public static IOpenTracingBuilder AddGenericDiagnostics(this IOpenTrac...
    method ConfigureGenericDiagnostics (line 130) | public static IOpenTracingBuilder ConfigureGenericDiagnostics(this IOp...
    method RemoveGenericDiagnostics (line 146) | public static IOpenTracingBuilder RemoveGenericDiagnostics(this IOpenT...
    method AddMicrosoftSqlClient (line 159) | public static IOpenTracingBuilder AddMicrosoftSqlClient(this IOpenTrac...
    method ConfigureMicrosoftSqlClient (line 173) | public static IOpenTracingBuilder ConfigureMicrosoftSqlClient(this IOp...
    method AddSystemSqlClient (line 189) | public static IOpenTracingBuilder AddSystemSqlClient(this IOpenTracing...
    method ConfigureSystemSqlClient (line 200) | public static IOpenTracingBuilder ConfigureSystemSqlClient(this IOpenT...
    method AddLoggerProvider (line 213) | public static IOpenTracingBuilder AddLoggerProvider(this IOpenTracingB...

FILE: src/OpenTracing.Contrib.NetCore/Configuration/ServiceCollectionExtensions.cs
  class ServiceCollectionExtensions (line 12) | public static class ServiceCollectionExtensions
    method AddOpenTracing (line 17) | public static IServiceCollection AddOpenTracing(this IServiceCollectio...
    method AddOpenTracingCoreServices (line 43) | public static IServiceCollection AddOpenTracingCoreServices(this IServ...
    method AssemblyExists (line 61) | private static bool AssemblyExists(string assemblyName)

FILE: src/OpenTracing.Contrib.NetCore/EntityFrameworkCore/EntityFrameworkCoreDiagnosticOptions.cs
  class EntityFrameworkCoreDiagnosticOptions (line 7) | public class EntityFrameworkCoreDiagnosticOptions : DiagnosticOptions
    method EntityFrameworkCoreDiagnosticOptions (line 17) | public EntityFrameworkCoreDiagnosticOptions()

FILE: src/OpenTracing.Contrib.NetCore/EntityFrameworkCore/EntityFrameworkCoreDiagnostics.cs
  class EntityFrameworkCoreDiagnostics (line 13) | internal sealed class EntityFrameworkCoreDiagnostics : DiagnosticEventOb...
    method EntityFrameworkCoreDiagnostics (line 24) | public EntityFrameworkCoreDiagnostics(ILoggerFactory loggerFactory, IT...
    method GetListenerName (line 32) | protected override string GetListenerName() => DiagnosticListenerName;
    method HandledEventNames (line 34) | protected override IEnumerable<string> HandledEventNames()
    method HandleEvent (line 41) | protected override void HandleEvent(string eventName, object untypedArg)
    method IgnoreEvent (line 128) | private bool IgnoreEvent(CommandEventData eventData)

FILE: src/OpenTracing.Contrib.NetCore/GenericListeners/GenericDiagnosticOptions.cs
  class GenericDiagnosticOptions (line 5) | public sealed class GenericDiagnosticOptions
    method IgnoreEvent (line 11) | public void IgnoreEvent(string diagnosticListenerName, string eventName)

FILE: src/OpenTracing.Contrib.NetCore/GenericListeners/GenericDiagnostics.cs
  class GenericDiagnostics (line 14) | internal sealed class GenericDiagnostics : DiagnosticObserver
    method GenericDiagnostics (line 18) | public GenericDiagnostics(ILoggerFactory loggerFactory, ITracer tracer...
    method SubscribeIfMatch (line 24) | public override IDisposable SubscribeIfMatch(DiagnosticListener diagno...
    class GenericDiagnosticsSubscription (line 36) | private class GenericDiagnosticsSubscription : IObserver<KeyValuePair<...
      method GenericDiagnosticsSubscription (line 46) | public GenericDiagnosticsSubscription(GenericDiagnostics subscriber,...
      method Dispose (line 58) | public void Dispose()
      method IsEnabled (line 63) | private bool IsEnabled(string eventName)
      method OnCompleted (line 78) | public void OnCompleted()
      method OnError (line 82) | public void OnError(Exception error)
      method OnNext (line 86) | public void OnNext(KeyValuePair<string, object> value)

FILE: src/OpenTracing.Contrib.NetCore/HttpHandler/HttpHandlerDiagnosticOptions.cs
  class HttpHandlerDiagnosticOptions (line 7) | public class HttpHandlerDiagnosticOptions : DiagnosticOptions
    method HttpHandlerDiagnosticOptions (line 56) | public HttpHandlerDiagnosticOptions()

FILE: src/OpenTracing.Contrib.NetCore/HttpHandler/HttpHandlerDiagnostics.cs
  class HttpHandlerDiagnostics (line 19) | internal sealed class HttpHandlerDiagnostics : DiagnosticEventObserver
    method HttpHandlerDiagnostics (line 34) | public HttpHandlerDiagnostics(ILoggerFactory loggerFactory, ITracer tr...
    method GetListenerName (line 41) | protected override string GetListenerName() => DiagnosticListenerName;
    method IsSupportedEvent (line 43) | protected override bool IsSupportedEvent(string eventName)
    method HandledEventNames (line 55) | protected override IEnumerable<string> HandledEventNames()
    method HandleEvent (line 62) | protected override void HandleEvent(string eventName, object untypedArg)
    method IgnoreRequest (line 163) | private bool IgnoreRequest(HttpRequestMessage request)
    method GetRequestOptions (line 174) | private IDictionary<string, object> GetRequestOptions(HttpRequestMessa...

FILE: src/OpenTracing.Contrib.NetCore/HttpHandler/HttpHeadersInjectAdapter.cs
  class HttpHeadersInjectAdapter (line 9) | internal sealed class HttpHeadersInjectAdapter : ITextMap
    method HttpHeadersInjectAdapter (line 13) | public HttpHeadersInjectAdapter(HttpHeaders headers)
    method Set (line 18) | public void Set(string key, string value)
    method GetEnumerator (line 28) | public IEnumerator<KeyValuePair<string, string>> GetEnumerator()
    method GetEnumerator (line 33) | IEnumerator IEnumerable.GetEnumerator()

FILE: src/OpenTracing.Contrib.NetCore/InstrumentationService.cs
  class InstrumentationService (line 12) | internal class InstrumentationService : IHostedService
    method InstrumentationService (line 16) | public InstrumentationService(DiagnosticManager diagnosticManager)
    method StartAsync (line 21) | public Task StartAsync(CancellationToken cancellationToken)
    method StopAsync (line 28) | public Task StopAsync(CancellationToken cancellationToken)

FILE: src/OpenTracing.Contrib.NetCore/Internal/DiagnosticEventObserver.cs
  class DiagnosticEventObserver (line 12) | internal abstract class DiagnosticEventObserver
    method DiagnosticEventObserver (line 18) | protected DiagnosticEventObserver(ILoggerFactory loggerFactory, ITrace...
    method SubscribeIfMatch (line 29) | public override IDisposable SubscribeIfMatch(DiagnosticListener diagno...
    method OnCompleted (line 39) | void IObserver<KeyValuePair<string, object>>.OnCompleted()
    method OnError (line 43) | void IObserver<KeyValuePair<string, object>>.OnError(Exception error)
    method OnNext (line 47) | void IObserver<KeyValuePair<string, object>>.OnNext(KeyValuePair<strin...
    method GetListenerName (line 65) | protected abstract string GetListenerName();
    method IsSupportedEvent (line 67) | protected virtual bool IsSupportedEvent(string eventName) => true;
    method HandledEventNames (line 69) | protected abstract IEnumerable<string> HandledEventNames();
    method IsEnabled (line 71) | private bool IsEnabled(string eventName)
    method HandleEvent (line 88) | protected abstract void HandleEvent(string eventName, object untypedArg);
    method HandleUnknownEvent (line 90) | protected void HandleUnknownEvent(string eventName, object untypedArg,...
    method DisposeActiveScope (line 95) | protected void DisposeActiveScope(bool isScopeRequired, Exception exce...

FILE: src/OpenTracing.Contrib.NetCore/Internal/DiagnosticManager.cs
  class DiagnosticManager (line 13) | internal sealed class DiagnosticManager : IObserver<DiagnosticListener>,...
    method DiagnosticManager (line 25) | public DiagnosticManager(
    method Start (line 45) | public void Start()
    method OnCompleted (line 61) | void IObserver<DiagnosticListener>.OnCompleted()
    method OnError (line 65) | void IObserver<DiagnosticListener>.OnError(Exception error)
    method OnNext (line 69) | void IObserver<DiagnosticListener>.OnNext(DiagnosticListener listener)
    method Stop (line 82) | public void Stop()
    method Dispose (line 100) | public void Dispose()

FILE: src/OpenTracing.Contrib.NetCore/Internal/DiagnosticManagerOptions.cs
  class DiagnosticManagerOptions (line 3) | public class DiagnosticManagerOptions

FILE: src/OpenTracing.Contrib.NetCore/Internal/DiagnosticObserver.cs
  class DiagnosticObserver (line 7) | internal abstract class DiagnosticObserver
    method DiagnosticObserver (line 15) | protected DiagnosticObserver(ILoggerFactory loggerFactory, ITracer tra...
    method SubscribeIfMatch (line 29) | public abstract IDisposable SubscribeIfMatch(DiagnosticListener diagno...

FILE: src/OpenTracing.Contrib.NetCore/Internal/GenericEventProcessor.cs
  class GenericEventProcessor (line 9) | internal class GenericEventProcessor
    method GenericEventProcessor (line 16) | public GenericEventProcessor(string listenerName, ITracer tracer, ILog...
    method ProcessEvent (line 25) | public void ProcessEvent(string eventName, object untypedArg, IEnumera...
    method HandleActivityStart (line 43) | private void HandleActivityStart(string eventName, Activity activity, ...
    method HandleActivityStop (line 64) | private void HandleActivityStop(string eventName, Activity activity)
    method HandleRegularEvent (line 77) | private void HandleRegularEvent(string eventName, object untypedArg, I...
    method GetLogFields (line 91) | private Dictionary<string, object> GetLogFields(string eventName, obje...

FILE: src/OpenTracing.Contrib.NetCore/Internal/GlobalTracerAccessor.cs
  class GlobalTracerAccessor (line 5) | public class GlobalTracerAccessor : IGlobalTracerAccessor
    method GetGlobalTracer (line 7) | public ITracer GetGlobalTracer()

FILE: src/OpenTracing.Contrib.NetCore/Internal/IGlobalTracerAccessor.cs
  type IGlobalTracerAccessor (line 6) | public interface IGlobalTracerAccessor
    method GetGlobalTracer (line 8) | ITracer GetGlobalTracer();

FILE: src/OpenTracing.Contrib.NetCore/Internal/PropertyFetcher.cs
  class PropertyFetcher (line 9) | internal class PropertyFetcher
    method PropertyFetcher (line 18) | public PropertyFetcher(string propertyName)
    method Fetch (line 26) | public object Fetch(object obj)
    class PropertyFetch (line 45) | private class PropertyFetch
      method FetcherForProperty (line 51) | public static PropertyFetch FetcherForProperty(PropertyInfo property...
      method Fetch (line 66) | public virtual object Fetch(object obj)
      class TypedFetchProperty (line 71) | private class TypedFetchProperty<TObject, TProperty> : PropertyFetch
        method TypedFetchProperty (line 73) | public TypedFetchProperty(PropertyInfo property)
        method Fetch (line 77) | public override object Fetch(object obj)

FILE: src/OpenTracing.Contrib.NetCore/Internal/SpanExtensions.cs
  class SpanExtensions (line 7) | internal static class SpanExtensions
    method SetException (line 13) | public static void SetException(this ISpan span, Exception exception)

FILE: src/OpenTracing.Contrib.NetCore/Internal/TracerExtensions.cs
  class TracerExtensions (line 6) | internal static class TracerExtensions
    method IsNoopTracer (line 8) | public static bool IsNoopTracer(this ITracer tracer)

FILE: src/OpenTracing.Contrib.NetCore/Logging/OpenTracingLogger.cs
  class OpenTracingLogger (line 10) | internal class OpenTracingLogger : ILogger
    method OpenTracingLogger (line 17) | public OpenTracingLogger(IGlobalTracerAccessor globalTracerAccessor, s...
    method BeginScope (line 23) | public IDisposable BeginScope<TState>(TState state)
    method IsEnabled (line 28) | public bool IsEnabled(LogLevel logLevel)
    method Log (line 37) | public void Log<TState>(LogLevel logLevel, EventId eventId, TState sta...
    class NoopDisposable (line 134) | private class NoopDisposable : IDisposable
      method Dispose (line 138) | public void Dispose()

FILE: src/OpenTracing.Contrib.NetCore/Logging/OpenTracingLoggerProvider.cs
  class OpenTracingLoggerProvider (line 10) | [ProviderAlias("OpenTracing")]
    method OpenTracingLoggerProvider (line 15) | public OpenTracingLoggerProvider(IGlobalTracerAccessor globalTracerAcc...
    method CreateLogger (line 21) | public ILogger CreateLogger(string categoryName)
    method Dispose (line 26) | public void Dispose()

FILE: src/OpenTracing.Contrib.NetCore/MicrosoftSqlClient/MicrosoftSqlClientDiagnosticOptions.cs
  class MicrosoftSqlClientDiagnosticOptions (line 8) | public class MicrosoftSqlClientDiagnosticOptions : DiagnosticOptions
    class EventNames (line 10) | public static class EventNames

FILE: src/OpenTracing.Contrib.NetCore/MicrosoftSqlClient/MicrosoftSqlClientDiagnostics.cs
  class MicrosoftSqlClientDiagnostics (line 13) | internal sealed class MicrosoftSqlClientDiagnostics : DiagnosticEventObs...
    method MicrosoftSqlClientDiagnostics (line 23) | public MicrosoftSqlClientDiagnostics(ILoggerFactory loggerFactory, ITr...
    method GetListenerName (line 30) | protected override string GetListenerName() => DiagnosticListenerName;
    method IsSupportedEvent (line 36) | protected override bool IsSupportedEvent(string eventName) => eventNam...
    method HandledEventNames (line 38) | protected override IEnumerable<string> HandledEventNames()
    method HandleEvent (line 45) | protected override void HandleEvent(string eventName, object untypedArg)
    method IgnoreEvent (line 117) | private bool IgnoreEvent(SqlCommand sqlCommand)

FILE: src/OpenTracing.Contrib.NetCore/SystemSqlClient/SqlClientDiagnosticOptions.cs
  class SqlClientDiagnosticOptions (line 8) | public class SqlClientDiagnosticOptions : DiagnosticOptions

FILE: src/OpenTracing.Contrib.NetCore/SystemSqlClient/SqlClientDiagnostics.cs
  class SqlClientDiagnostics (line 13) | internal sealed class SqlClientDiagnostics : DiagnosticEventObserver
    method SqlClientDiagnostics (line 25) | public SqlClientDiagnostics(ILoggerFactory loggerFactory, ITracer trac...
    method GetListenerName (line 32) | protected override string GetListenerName() => DiagnosticListenerName;
    method IsSupportedEvent (line 38) | protected override bool IsSupportedEvent(string eventName) => eventNam...
    method HandledEventNames (line 40) | protected override IEnumerable<string> HandledEventNames()
    method HandleEvent (line 47) | protected override void HandleEvent(string eventName, object untypedArg)
    method IgnoreEvent (line 119) | private bool IgnoreEvent(SqlCommand sqlCommand)

FILE: test/OpenTracing.Contrib.NetCore.Tests/AspNetCore/HostingTest.cs
  class TestProgramFactory (line 22) | public class TestProgramFactory : WebApplicationFactory<TestProgramFactory>
    method CreateWebHostBuilder (line 24) | protected override IWebHostBuilder CreateWebHostBuilder()
  class HostingTest (line 53) | [Collection("DiagnosticSource") /* All DiagnosticSource tests must be in...
    method HostingTest (line 60) | public HostingTest(TestProgramFactory factory, ITestOutputHelper output)
    method Dispose (line 88) | public void Dispose()
    method CreateClient (line 93) | private HttpClient CreateClient()
    method Request_creates_span (line 99) | [Fact]
    method Span_has_correct_properties (line 111) | [Fact]
    method Span_has_status_404 (line 139) | [Fact]
    method Extracts_trace_headers (line 153) | [Fact]
    method Does_not_Extract_trace_headers_if_disabled_in_options (line 180) | [Fact]
    method Ignores_requests_with_custom_rule (line 202) | [Fact]
    method Calls_Options_OperationNameResolver (line 220) | [Fact]
    method Calls_Options_OnRequest (line 235) | [Fact]
    method Calls_Options_OnError (line 247) | [Fact]
    method Creates_error_span_if_request_throws_exception (line 268) | [Fact]

FILE: test/OpenTracing.Contrib.NetCore.Tests/CoreFx/HttpHandlerDiagnosticTest.cs
  class HttpHandlerDiagnosticTest (line 21) | [Collection("DiagnosticSource") /* All DiagnosticSource tests must be in...
    class MockHttpMessageHandler (line 30) | private class MockHttpMessageHandler : HttpMessageHandler
      method SendAsync (line 41) | protected override async Task<HttpResponseMessage> SendAsync(HttpReq...
    method HttpHandlerDiagnosticTest (line 51) | public HttpHandlerDiagnosticTest(ITestOutputHelper output)
    method Dispose (line 91) | public void Dispose()
    method Creates_span (line 96) | [Fact]
    method Span_is_child_of_parent (line 104) | [Fact]
    method Span_has_correct_properties (line 126) | [Fact]
    method Injects_trace_headers (line 151) | [Fact]
    method Does_not_inject_trace_headers_if_disabled_in_options (line 161) | [Fact]
    method Ignores_requests_with_Ignore_property (line 178) | [Fact]
    method Ignores_requests_with_custom_rule (line 189) | [Fact]
    method Calls_Options_OperationNameResolver (line 206) | [Fact]
    method Calls_Options_OnRequest (line 220) | [Fact]
    method Calls_Options_OnError (line 232) | [Fact]
    method Creates_error_span_if_request_times_out (line 248) | [Fact]
    method Creates_error_span_if_request_fails (line 264) | [Fact]
    method SetRequestOption (line 280) | private void SetRequestOption<TValue>(HttpRequestMessage request, stri...

FILE: test/OpenTracing.Contrib.NetCore.Tests/Internal/DiagnosticManagerTest.cs
  class DiagnosticManagerTest (line 12) | public class DiagnosticManagerTest
    method Does_not_Start_if_Tracer_is_NoopTracer (line 14) | [Fact]
    method Does_not_Start_if_Tracer_is_GlobalTracer_with_NoopTracer (line 32) | [Fact]
    method Start_if_valid_Tracer (line 50) | [Fact]

FILE: test/OpenTracing.Contrib.NetCore.Tests/Internal/PropertyFetcherTest.cs
  class PropertyFetcherTest (line 6) | public class PropertyFetcherTest
    class TestClass (line 8) | public class TestClass
    method Fetch_NameNotFound_NullReturned (line 13) | [Fact]
    method Fetch_NameFound_ValueReturned (line 25) | [Fact]
    method Fetch_NameFoundDifferentCasing_ValueReturned (line 37) | [Fact]

FILE: test/OpenTracing.Contrib.NetCore.Tests/Logging/LoggingDependencyInjectionTest.cs
  class LoggingDependencyInjectionTest (line 9) | public class LoggingDependencyInjectionTest
    method Resolving_tracer_that_needs_ILoggerFactory_succeeds (line 11) | [Fact]
    class TracerWithLoggerFactory (line 29) | private class TracerWithLoggerFactory : ITracer
      method TracerWithLoggerFactory (line 31) | public TracerWithLoggerFactory(ILoggerFactory loggerFactory)
      method BuildSpan (line 39) | public ISpanBuilder BuildSpan(string operationName)
      method Extract (line 44) | public ISpanContext Extract<TCarrier>(IFormat<TCarrier> format, TCar...
      method Inject (line 49) | public void Inject<TCarrier>(ISpanContext spanContext, IFormat<TCarr...

FILE: test/OpenTracing.Contrib.NetCore.Tests/Logging/LoggingTest.cs
  class LoggingTest (line 13) | public class LoggingTest
    method LoggingTest (line 19) | public LoggingTest()
    method StartScope (line 42) | private IScope StartScope(string operationName = "FooOperation")
    method Log (line 48) | private MockSpan.LogEntry Log(Action actionUnderScope)
    method Logger_does_not_create_span_if_no_ActiveSpan (line 65) | [Fact]
    method Logger_adds_Log_to_ActiveSpan (line 73) | [Fact]
    method Logger_adds_multiple_Log_to_ActiveSpan (line 89) | [Fact]
    method Correct_fields_for_LogInformation_with_null_message (line 106) | [Fact]
    method Correct_fields_for_LogInformation_with_message (line 120) | [Fact]
    method Args_are_NOT_propagated_if_they_are_not_used_in_messageTemplate (line 134) | [Fact]
    method Correct_fields_for_LogInformation_with_messageTemplate_without_args (line 150) | [Fact]
    method Correct_fields_for_LogInformation_with_messageTemplate_and_not_enough_args (line 162) | [Fact]
    method Correct_fields_for_LogInformation_with_messageTemplate_with_one_arg (line 177) | [Fact]
    method Correct_fields_for_LogInformation_with_messageTemplate_with_two_arg (line 191) | [Fact]
    method Arg_overwrites_builtin_fields (line 207) | [Fact]
    method Correct_fields_for_LogInformation_with_eventId (line 222) | [Fact]
    method Correct_fields_for_LogInformation_with_exception (line 235) | [Fact]
    method Correct_fields_for_LogInformation_with_exception_and_args (line 250) | [Fact]

FILE: test/OpenTracing.Contrib.NetCore.Tests/XunitLogging/XunitLoggerFactoryExtensions.cs
  class XunitLoggerFactoryExtensions (line 9) | public static class XunitLoggerFactoryExtensions
    method AddXunit (line 11) | public static ILoggingBuilder AddXunit(this ILoggingBuilder builder, I...
    method AddXunit (line 17) | public static ILoggingBuilder AddXunit(this ILoggingBuilder builder, I...
    method AddXunit (line 23) | public static ILoggerFactory AddXunit(this ILoggerFactory loggerFactor...
    method AddXunit (line 29) | public static ILoggerFactory AddXunit(this ILoggerFactory loggerFactor...

FILE: test/OpenTracing.Contrib.NetCore.Tests/XunitLogging/XunitLoggerProvider.cs
  class XunitLoggerProvider (line 11) | public class XunitLoggerProvider : ILoggerProvider
    method XunitLoggerProvider (line 16) | public XunitLoggerProvider(ITestOutputHelper output)
    method XunitLoggerProvider (line 21) | public XunitLoggerProvider(ITestOutputHelper output, LogLevel minLevel)
    method CreateLogger (line 27) | public ILogger CreateLogger(string categoryName)
    method Dispose (line 32) | public void Dispose()
  class XunitLogger (line 37) | public class XunitLogger : ILogger
    method XunitLogger (line 44) | public XunitLogger(ITestOutputHelper output, string category, LogLevel...
    method Log (line 51) | public void Log<TState>(
    method IsEnabled (line 102) | public bool IsEnabled(LogLevel logLevel)
    method BeginScope (line 105) | public IDisposable BeginScope<TState>(TState state)
    class NullScope (line 108) | private class NullScope : IDisposable
      method Dispose (line 110) | public void Dispose()
Condensed preview — 165 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (303K chars).
[
  {
    "path": ".appveyor.yml",
    "chars": 852,
    "preview": "# AppVeyor Build number is incremental and not related to actual version number of the product\nversion: '{build}'\n\nimage"
  },
  {
    "path": ".editorconfig",
    "chars": 5918,
    "preview": "# editorconfig.org\n\n# top-most EditorConfig file\nroot = true\n\n# Default settings:\n# A newline ending every file\n# Use 4 "
  },
  {
    "path": ".gitattributes",
    "chars": 12,
    "preview": "* text=auto\n"
  },
  {
    "path": ".gitignore",
    "chars": 4261,
    "preview": "# Sqlite DBs in samples\n*.db\n\n## Ignore Visual Studio temporary files, build results, and\n## files generated by popular "
  },
  {
    "path": ".travis.yml",
    "chars": 679,
    "preview": "language: csharp\n\nmatrix:\n  include:\n    - os: linux\n      dist: xenial\n      sudo: required\n      mono: none\n      dotn"
  },
  {
    "path": ".vscode/extensions.json",
    "chars": 177,
    "preview": "{\n    \"recommendations\": [\n        \"EditorConfig.EditorConfig\",\n        \"formulahendry.dotnet-test-explorer\",\n        \"m"
  },
  {
    "path": ".vscode/settings.json",
    "chars": 89,
    "preview": "{\n    \"dotnet-test-explorer.testProjectPath\": \"test/OpenTracing.Contrib.NetCore.Tests\"\n}\n"
  },
  {
    "path": ".vscode/tasks.json",
    "chars": 442,
    "preview": "{\n    \"version\": \"2.0.0\",\n    \"tasks\": [\n        {\n            \"label\": \"build\",\n            \"command\": \"dotnet\",\n      "
  },
  {
    "path": "Directory.Build.props",
    "chars": 503,
    "preview": "<Project>\n  <Import Project=\"version.props\" />\n  <PropertyGroup>\n    <!-- Projects that should generate nupkg files over"
  },
  {
    "path": "LICENSE",
    "chars": 11357,
    "preview": "                                 Apache License\n                           Version 2.0, January 2004\n                   "
  },
  {
    "path": "NuGet.config",
    "chars": 193,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<configuration>\n  <packageSources>\n    <clear />\n    <add key=\"NuGet\" value=\"http"
  },
  {
    "path": "OpenTracing.Contrib.sln",
    "chars": 12968,
    "preview": "\nMicrosoft Visual Studio Solution File, Format Version 12.00\n# Visual Studio Version 17\nVisualStudioVersion = 17.4.3310"
  },
  {
    "path": "README.md",
    "chars": 3612,
    "preview": "[![nuget](https://img.shields.io/nuget/v/OpenTracing.Contrib.NetCore.svg?logo=nuget)](https://www.nuget.org/packages/Ope"
  },
  {
    "path": "RELEASE.md",
    "chars": 470,
    "preview": "# Release Process\n\nThe release process consists of these steps:\n1. Create a GitHub release with release notes. The tag n"
  },
  {
    "path": "benchmarks/OpenTracing.Contrib.NetCore.Benchmarks/AspNetCore/RequestDiagnosticsBenchmark.cs",
    "chars": 2719,
    "preview": "using System;\nusing System.Net.Http;\nusing System.Threading.Tasks;\nusing BenchmarkDotNet.Attributes;\nusing Microsoft.As"
  },
  {
    "path": "benchmarks/OpenTracing.Contrib.NetCore.Benchmarks/CoreFx/HttpHandlerDiagnosticsBenchmark.cs",
    "chars": 2821,
    "preview": "using System;\nusing System.Net;\nusing System.Net.Http;\nusing System.Reflection;\nusing System.Threading;\nusing System.Th"
  },
  {
    "path": "benchmarks/OpenTracing.Contrib.NetCore.Benchmarks/InstrumentationMode.cs",
    "chars": 143,
    "preview": "namespace OpenTracing.Contrib.NetCore.Benchmarks\n{\n    public enum InstrumentationMode\n    {\n        None,\n        Noop"
  },
  {
    "path": "benchmarks/OpenTracing.Contrib.NetCore.Benchmarks/OpenTracing.Contrib.NetCore.Benchmarks.csproj",
    "chars": 972,
    "preview": "<Project Sdk=\"Microsoft.NET.Sdk\">\n\n  <PropertyGroup>\n    <OutputType>Exe</OutputType>\n    <TargetFrameworks>netcoreapp3"
  },
  {
    "path": "benchmarks/OpenTracing.Contrib.NetCore.Benchmarks/OpenTracingBuilderExtensions.cs",
    "chars": 992,
    "preview": "using System;\nusing Microsoft.Extensions.DependencyInjection;\nusing OpenTracing.Contrib.NetCore.Internal;\nusing OpenTra"
  },
  {
    "path": "benchmarks/OpenTracing.Contrib.NetCore.Benchmarks/Program.cs",
    "chars": 256,
    "preview": "using BenchmarkDotNet.Running;\n\nnamespace OpenTracing.Contrib.NetCore.Benchmarks\n{\n    class Program\n    {\n        stat"
  },
  {
    "path": "build.ps1",
    "chars": 2668,
    "preview": "[CmdletBinding(PositionalBinding = $false)]\nparam(\n    [string] $ArtifactsPath = (Join-Path $PWD \"artifacts\"),\n    [str"
  },
  {
    "path": "global.json",
    "chars": 75,
    "preview": "{\n  \"sdk\": {\n    \"version\": \"7.0.100\",\n     \"rollForward\": \"feature\"\n  }\n}\n"
  },
  {
    "path": "launch-sample.ps1",
    "chars": 1112,
    "preview": "[CmdletBinding(PositionalBinding = $false)]\nparam(\n    [ValidateSet(\"net7.0\", \"net6.0\", \"netcoreapp3.1\")]\n    [string] $"
  },
  {
    "path": "samples/net6.0/CustomersApi/Controllers/CustomersController.cs",
    "chars": 1114,
    "preview": "using System.Linq;\nusing Microsoft.AspNetCore.Mvc;\nusing Microsoft.Extensions.Logging;\nusing Samples.CustomersApi.DataSt"
  },
  {
    "path": "samples/net6.0/CustomersApi/CustomersApi.csproj",
    "chars": 582,
    "preview": "<Project Sdk=\"Microsoft.NET.Sdk.Web\">\n\n  <PropertyGroup>\n    <TargetFrameworks>net6.0</TargetFrameworks>\n  </PropertyGr"
  },
  {
    "path": "samples/net6.0/CustomersApi/DataStore/CustomerDbContext.cs",
    "chars": 927,
    "preview": "using Microsoft.EntityFrameworkCore;\nusing Shared;\n\nnamespace Samples.CustomersApi.DataStore\n{\n    public class Customer"
  },
  {
    "path": "samples/net6.0/CustomersApi/Program.cs",
    "chars": 1958,
    "preview": "using Microsoft.AspNetCore.Hosting;\nusing Microsoft.Extensions.DependencyInjection;\nusing Microsoft.Extensions.Hosting;\n"
  },
  {
    "path": "samples/net6.0/CustomersApi/Properties/launchSettings.json",
    "chars": 246,
    "preview": "{\n  \"profiles\": {\n    \"CustomersApi\": {\n      \"commandName\": \"Project\",\n      \"launchBrowser\": false,\n      \"launchUrl\":"
  },
  {
    "path": "samples/net6.0/CustomersApi/Startup.cs",
    "chars": 1531,
    "preview": "using System;\nusing Microsoft.AspNetCore.Builder;\nusing Microsoft.EntityFrameworkCore;\nusing Microsoft.Extensions.Depend"
  },
  {
    "path": "samples/net6.0/CustomersApi/appsettings.json",
    "chars": 165,
    "preview": "{\n  \"Logging\": {\n    \"IncludeScopes\": false,\n    \"LogLevel\": {\n      \"Default\": \"Debug\",\n      \"System\": \"Information\",\n"
  },
  {
    "path": "samples/net6.0/FrontendWeb/Controllers/HomeController.cs",
    "chars": 2239,
    "preview": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Net.Http;\nusing System.Text;\nusing Syste"
  },
  {
    "path": "samples/net6.0/FrontendWeb/FrontendWeb.csproj",
    "chars": 337,
    "preview": "<Project Sdk=\"Microsoft.NET.Sdk.Web\">\n\n  <PropertyGroup>\n    <TargetFrameworks>net6.0</TargetFrameworks>\n  </PropertyGr"
  },
  {
    "path": "samples/net6.0/FrontendWeb/Program.cs",
    "chars": 1058,
    "preview": "using Microsoft.AspNetCore.Hosting;\nusing Microsoft.Extensions.DependencyInjection;\nusing Microsoft.Extensions.Hosting;\n"
  },
  {
    "path": "samples/net6.0/FrontendWeb/Properties/launchSettings.json",
    "chars": 245,
    "preview": "{\n  \"profiles\": {\n    \"FrontendWeb\": {\n      \"commandName\": \"Project\",\n      \"launchBrowser\": false,\n      \"launchUrl\": "
  },
  {
    "path": "samples/net6.0/FrontendWeb/Startup.cs",
    "chars": 701,
    "preview": "using System.Net.Http;\nusing Microsoft.AspNetCore.Builder;\nusing Microsoft.Extensions.DependencyInjection;\n\nnamespace Sa"
  },
  {
    "path": "samples/net6.0/FrontendWeb/Views/Home/Index.cshtml",
    "chars": 279,
    "preview": "<!DOCTYPE html>\n<meta charset=\"utf-8\">\n<title>FrontendWeb</title>\n<h1>FrontendWeb</h1>\n<p>This is the beautiful web fro"
  },
  {
    "path": "samples/net6.0/FrontendWeb/Views/Home/PlaceOrder.cshtml",
    "chars": 488,
    "preview": "@model Shared.PlaceOrderCommand\n<!DOCTYPE html>\n<meta charset=\"utf-8\">\n<title>FrontendWeb</title>\n<h1>FrontendWeb</h1>\n"
  },
  {
    "path": "samples/net6.0/FrontendWeb/Views/_ViewImports.cshtml",
    "chars": 79,
    "preview": "@using Samples.FrontendWeb\n@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers"
  },
  {
    "path": "samples/net6.0/FrontendWeb/appsettings.json",
    "chars": 195,
    "preview": "{\n  \"Logging\": {\n    \"IncludeScopes\": false,\n    \"LogLevel\": {\n      \"Default\": \"Debug\",\n      \"System\": \"Information\",\n"
  },
  {
    "path": "samples/net6.0/OrdersApi/Controllers/OrdersController.cs",
    "chars": 2579,
    "preview": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Net.Http;\nusing System.Threading.Tasks;\n"
  },
  {
    "path": "samples/net6.0/OrdersApi/DataStore/Order.cs",
    "chars": 400,
    "preview": "using System;\nusing System.ComponentModel.DataAnnotations;\n\nnamespace OrdersApi.DataStore\n{\n    public class Order\n    "
  },
  {
    "path": "samples/net6.0/OrdersApi/DataStore/OrdersDbContext.cs",
    "chars": 488,
    "preview": "using Microsoft.EntityFrameworkCore;\n\nnamespace OrdersApi.DataStore\n{\n    public class OrdersDbContext : DbContext\n    "
  },
  {
    "path": "samples/net6.0/OrdersApi/OrdersApi.csproj",
    "chars": 585,
    "preview": "<Project Sdk=\"Microsoft.NET.Sdk.Web\">\n\n  <PropertyGroup>\n    <TargetFrameworks>net6.0</TargetFrameworks>\n  </PropertyGr"
  },
  {
    "path": "samples/net6.0/OrdersApi/Program.cs",
    "chars": 1414,
    "preview": "using Microsoft.AspNetCore.Hosting;\nusing Microsoft.Extensions.DependencyInjection;\nusing Microsoft.Extensions.Hosting;\n"
  },
  {
    "path": "samples/net6.0/OrdersApi/Properties/launchSettings.json",
    "chars": 243,
    "preview": "{\n  \"profiles\": {\n    \"OrdersApi\": {\n      \"commandName\": \"Project\",\n      \"launchBrowser\": false,\n      \"launchUrl\": \"h"
  },
  {
    "path": "samples/net6.0/OrdersApi/Startup.cs",
    "chars": 1672,
    "preview": "using System;\nusing System.Net.Http;\nusing Microsoft.AspNetCore.Builder;\nusing Microsoft.EntityFrameworkCore;\nusing Micr"
  },
  {
    "path": "samples/net6.0/OrdersApi/appsettings.json",
    "chars": 165,
    "preview": "{\n  \"Logging\": {\n    \"IncludeScopes\": false,\n    \"LogLevel\": {\n      \"Default\": \"Debug\",\n      \"System\": \"Information\",\n"
  },
  {
    "path": "samples/net6.0/Shared/Constants.cs",
    "chars": 266,
    "preview": "namespace Shared\n{\n    public class Constants\n    {\n        public const string FrontendUrl = \"http://localhost:5000/\";"
  },
  {
    "path": "samples/net6.0/Shared/Customer.cs",
    "chars": 328,
    "preview": "namespace Shared\n{\n    public class Customer\n    {\n        public int CustomerId { get; set; }\n        public string Na"
  },
  {
    "path": "samples/net6.0/Shared/JaegerServiceCollectionExtensions.cs",
    "chars": 1850,
    "preview": "using System;\nusing System.Reflection;\nusing Jaeger;\nusing Jaeger.Reporters;\nusing Jaeger.Samplers;\nusing Jaeger.Sender"
  },
  {
    "path": "samples/net6.0/Shared/PlaceOrderCommand.cs",
    "chars": 341,
    "preview": "using System.ComponentModel.DataAnnotations;\n\nnamespace Shared\n{\n    public class PlaceOrderCommand\n    {\n        [Requ"
  },
  {
    "path": "samples/net6.0/Shared/Shared.csproj",
    "chars": 665,
    "preview": "<Project Sdk=\"Microsoft.NET.Sdk\">\n\n  <PropertyGroup>\n    <TargetFrameworks>net6.0</TargetFrameworks>\n  </PropertyGroup>"
  },
  {
    "path": "samples/net6.0/TrafficGenerator/Program.cs",
    "chars": 712,
    "preview": "using Microsoft.Extensions.DependencyInjection;\nusing Microsoft.Extensions.Hosting;\n\nnamespace TrafficGenerator\n{\n    c"
  },
  {
    "path": "samples/net6.0/TrafficGenerator/TrafficGenerator.csproj",
    "chars": 337,
    "preview": "<Project Sdk=\"Microsoft.NET.Sdk.Worker\">\n\n  <PropertyGroup>\n    <TargetFramework>net6.0</TargetFramework>\n  </PropertyGr"
  },
  {
    "path": "samples/net6.0/TrafficGenerator/Worker.cs",
    "chars": 2045,
    "preview": "using System;\nusing System.Net.Http;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing Microsoft.Extensions.H"
  },
  {
    "path": "samples/net6.0/TrafficGenerator/appsettings.json",
    "chars": 186,
    "preview": "{\n  \"Logging\": {\n    \"LogLevel\": {\n      \"Default\": \"Debug\",\n      \"System\": \"Information\",\n      \"Microsoft\": \"Warning\""
  },
  {
    "path": "samples/net7.0/CustomersApi/CustomersApi.csproj",
    "chars": 654,
    "preview": "<Project Sdk=\"Microsoft.NET.Sdk.Web\">\n\n  <PropertyGroup>\n    <TargetFramework>net7.0</TargetFramework>\n    <Nullable>en"
  },
  {
    "path": "samples/net7.0/CustomersApi/DataStore/CustomerDbContext.cs",
    "chars": 835,
    "preview": "using Microsoft.EntityFrameworkCore;\nusing Shared;\n\nnamespace CustomersApi.DataStore;\n\npublic class CustomerDbContext : "
  },
  {
    "path": "samples/net7.0/CustomersApi/Program.cs",
    "chars": 2175,
    "preview": "using CustomersApi.DataStore;\nusing Microsoft.EntityFrameworkCore;\nusing Shared;\n\nvar builder = WebApplication.CreateBui"
  },
  {
    "path": "samples/net7.0/CustomersApi/Properties/launchSettings.json",
    "chars": 246,
    "preview": "{\n  \"profiles\": {\n    \"CustomersApi\": {\n      \"commandName\": \"Project\",\n      \"launchBrowser\": false,\n      \"launchUrl\":"
  },
  {
    "path": "samples/net7.0/CustomersApi/appsettings.json",
    "chars": 165,
    "preview": "{\n  \"Logging\": {\n    \"IncludeScopes\": false,\n    \"LogLevel\": {\n      \"Default\": \"Debug\",\n      \"System\": \"Information\",\n"
  },
  {
    "path": "samples/net7.0/FrontendWeb/Controllers/HomeController.cs",
    "chars": 1909,
    "preview": "using System.Text;\nusing Microsoft.AspNetCore.Mvc;\nusing Microsoft.AspNetCore.Mvc.Rendering;\nusing Newtonsoft.Json;\nusin"
  },
  {
    "path": "samples/net7.0/FrontendWeb/FrontendWeb.csproj",
    "chars": 411,
    "preview": "<Project Sdk=\"Microsoft.NET.Sdk.Web\">\n\n  <PropertyGroup>\n    <TargetFramework>net7.0</TargetFramework>\n    <Nullable>en"
  },
  {
    "path": "samples/net7.0/FrontendWeb/Program.cs",
    "chars": 559,
    "preview": "using Shared;\n\n\nvar builder = WebApplication.CreateBuilder(args);\n\n// Add services to the container.\n\nbuilder.WebHost.Us"
  },
  {
    "path": "samples/net7.0/FrontendWeb/Properties/launchSettings.json",
    "chars": 245,
    "preview": "{\n  \"profiles\": {\n    \"FrontendWeb\": {\n      \"commandName\": \"Project\",\n      \"launchBrowser\": false,\n      \"launchUrl\": "
  },
  {
    "path": "samples/net7.0/FrontendWeb/Views/Home/Index.cshtml",
    "chars": 279,
    "preview": "<!DOCTYPE html>\n<meta charset=\"utf-8\">\n<title>FrontendWeb</title>\n<h1>FrontendWeb</h1>\n<p>This is the beautiful web fro"
  },
  {
    "path": "samples/net7.0/FrontendWeb/Views/Home/PlaceOrder.cshtml",
    "chars": 488,
    "preview": "@model Shared.PlaceOrderCommand\n<!DOCTYPE html>\n<meta charset=\"utf-8\">\n<title>FrontendWeb</title>\n<h1>FrontendWeb</h1>\n"
  },
  {
    "path": "samples/net7.0/FrontendWeb/Views/_ViewImports.cshtml",
    "chars": 72,
    "preview": "@using FrontendWeb\n@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers\n"
  },
  {
    "path": "samples/net7.0/FrontendWeb/appsettings.json",
    "chars": 195,
    "preview": "{\n  \"Logging\": {\n    \"IncludeScopes\": false,\n    \"LogLevel\": {\n      \"Default\": \"Debug\",\n      \"System\": \"Information\",\n"
  },
  {
    "path": "samples/net7.0/OrdersApi/Controllers/OrdersController.cs",
    "chars": 2225,
    "preview": "using Microsoft.AspNetCore.Mvc;\nusing Microsoft.EntityFrameworkCore;\nusing Newtonsoft.Json;\nusing OpenTracing;\nusing Ord"
  },
  {
    "path": "samples/net7.0/OrdersApi/DataStore/Order.cs",
    "chars": 360,
    "preview": "using System.ComponentModel.DataAnnotations;\n\nnamespace OrdersApi.DataStore;\n\npublic class Order\n{\n    [Key]\n    public"
  },
  {
    "path": "samples/net7.0/OrdersApi/DataStore/OrdersDbContext.cs",
    "chars": 425,
    "preview": "using Microsoft.EntityFrameworkCore;\n\nnamespace OrdersApi.DataStore;\n\npublic class OrdersDbContext : DbContext\n{\n    pu"
  },
  {
    "path": "samples/net7.0/OrdersApi/OrdersApi.csproj",
    "chars": 657,
    "preview": "<Project Sdk=\"Microsoft.NET.Sdk.Web\">\n\n  <PropertyGroup>\n    <TargetFramework>net7.0</TargetFramework>\n    <Nullable>en"
  },
  {
    "path": "samples/net7.0/OrdersApi/Program.cs",
    "chars": 1429,
    "preview": "using Microsoft.EntityFrameworkCore;\nusing OrdersApi.DataStore;\nusing Shared;\n\nvar builder = WebApplication.CreateBuilde"
  },
  {
    "path": "samples/net7.0/OrdersApi/Properties/launchSettings.json",
    "chars": 243,
    "preview": "{\n  \"profiles\": {\n    \"OrdersApi\": {\n      \"commandName\": \"Project\",\n      \"launchBrowser\": false,\n      \"launchUrl\": \"h"
  },
  {
    "path": "samples/net7.0/OrdersApi/appsettings.json",
    "chars": 165,
    "preview": "{\n  \"Logging\": {\n    \"IncludeScopes\": false,\n    \"LogLevel\": {\n      \"Default\": \"Debug\",\n      \"System\": \"Information\",\n"
  },
  {
    "path": "samples/net7.0/Shared/Constants.cs",
    "chars": 240,
    "preview": "namespace Shared;\n\npublic class Constants\n{\n    public const string FrontendUrl = \"http://localhost:5000/\";\n\n    public"
  },
  {
    "path": "samples/net7.0/Shared/Customer.cs",
    "chars": 327,
    "preview": "namespace Shared;\n\npublic class Customer\n{\n    public int CustomerId { get; set; }\n    public string Name { get; set; }"
  },
  {
    "path": "samples/net7.0/Shared/JaegerServiceCollectionExtensions.cs",
    "chars": 1762,
    "preview": "using System.Reflection;\nusing Jaeger;\nusing Jaeger.Reporters;\nusing Jaeger.Samplers;\nusing Jaeger.Senders.Thrift;\nusin"
  },
  {
    "path": "samples/net7.0/Shared/PlaceOrderCommand.cs",
    "chars": 342,
    "preview": "using System.ComponentModel.DataAnnotations;\n\nnamespace Shared;\n\npublic class PlaceOrderCommand\n{\n    [Required, Range("
  },
  {
    "path": "samples/net7.0/Shared/Shared.csproj",
    "chars": 739,
    "preview": "<Project Sdk=\"Microsoft.NET.Sdk\">\n\n  <PropertyGroup>\n    <TargetFramework>net7.0</TargetFramework>\n    <Nullable>enable"
  },
  {
    "path": "samples/net7.0/TrafficGenerator/Program.cs",
    "chars": 374,
    "preview": "using TrafficGenerator;\n\nusing var host = Host.CreateDefaultBuilder(args)\n    .ConfigureServices((hostContext, services"
  },
  {
    "path": "samples/net7.0/TrafficGenerator/TrafficGenerator.csproj",
    "chars": 413,
    "preview": "<Project Sdk=\"Microsoft.NET.Sdk.Worker\">\n\n  <PropertyGroup>\n    <TargetFramework>net7.0</TargetFramework>\n    <Nullable>"
  },
  {
    "path": "samples/net7.0/TrafficGenerator/Worker.cs",
    "chars": 1732,
    "preview": "using Shared;\n\nnamespace TrafficGenerator;\n\npublic class Worker : BackgroundService\n{\n    private readonly ILogger<Work"
  },
  {
    "path": "samples/net7.0/TrafficGenerator/appsettings.json",
    "chars": 186,
    "preview": "{\n  \"Logging\": {\n    \"LogLevel\": {\n      \"Default\": \"Debug\",\n      \"System\": \"Information\",\n      \"Microsoft\": \"Warning\""
  },
  {
    "path": "samples/netcoreapp3.1/CustomersApi/Controllers/CustomersController.cs",
    "chars": 1114,
    "preview": "using System.Linq;\nusing Microsoft.AspNetCore.Mvc;\nusing Microsoft.Extensions.Logging;\nusing Samples.CustomersApi.DataSt"
  },
  {
    "path": "samples/netcoreapp3.1/CustomersApi/CustomersApi.csproj",
    "chars": 589,
    "preview": "<Project Sdk=\"Microsoft.NET.Sdk.Web\">\n\n  <PropertyGroup>\n    <TargetFrameworks>netcoreapp3.1</TargetFrameworks>\n  </Pro"
  },
  {
    "path": "samples/netcoreapp3.1/CustomersApi/DataStore/CustomerDbContext.cs",
    "chars": 927,
    "preview": "using Microsoft.EntityFrameworkCore;\nusing Shared;\n\nnamespace Samples.CustomersApi.DataStore\n{\n    public class Customer"
  },
  {
    "path": "samples/netcoreapp3.1/CustomersApi/Program.cs",
    "chars": 1958,
    "preview": "using Microsoft.AspNetCore.Hosting;\nusing Microsoft.Extensions.DependencyInjection;\nusing Microsoft.Extensions.Hosting;\n"
  },
  {
    "path": "samples/netcoreapp3.1/CustomersApi/Properties/launchSettings.json",
    "chars": 246,
    "preview": "{\n  \"profiles\": {\n    \"CustomersApi\": {\n      \"commandName\": \"Project\",\n      \"launchBrowser\": false,\n      \"launchUrl\":"
  },
  {
    "path": "samples/netcoreapp3.1/CustomersApi/Startup.cs",
    "chars": 1539,
    "preview": "using System;\nusing Microsoft.AspNetCore.Builder;\nusing Microsoft.EntityFrameworkCore;\nusing Microsoft.Extensions.Depend"
  },
  {
    "path": "samples/netcoreapp3.1/CustomersApi/appsettings.json",
    "chars": 165,
    "preview": "{\n  \"Logging\": {\n    \"IncludeScopes\": false,\n    \"LogLevel\": {\n      \"Default\": \"Debug\",\n      \"System\": \"Information\",\n"
  },
  {
    "path": "samples/netcoreapp3.1/FrontendWeb/Controllers/HomeController.cs",
    "chars": 2239,
    "preview": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Net.Http;\nusing System.Text;\nusing Syste"
  },
  {
    "path": "samples/netcoreapp3.1/FrontendWeb/FrontendWeb.csproj",
    "chars": 344,
    "preview": "<Project Sdk=\"Microsoft.NET.Sdk.Web\">\n\n  <PropertyGroup>\n    <TargetFrameworks>netcoreapp3.1</TargetFrameworks>\n  </Pro"
  },
  {
    "path": "samples/netcoreapp3.1/FrontendWeb/Program.cs",
    "chars": 1058,
    "preview": "using Microsoft.AspNetCore.Hosting;\nusing Microsoft.Extensions.DependencyInjection;\nusing Microsoft.Extensions.Hosting;\n"
  },
  {
    "path": "samples/netcoreapp3.1/FrontendWeb/Properties/launchSettings.json",
    "chars": 245,
    "preview": "{\n  \"profiles\": {\n    \"FrontendWeb\": {\n      \"commandName\": \"Project\",\n      \"launchBrowser\": false,\n      \"launchUrl\": "
  },
  {
    "path": "samples/netcoreapp3.1/FrontendWeb/Startup.cs",
    "chars": 701,
    "preview": "using System.Net.Http;\nusing Microsoft.AspNetCore.Builder;\nusing Microsoft.Extensions.DependencyInjection;\n\nnamespace Sa"
  },
  {
    "path": "samples/netcoreapp3.1/FrontendWeb/Views/Home/Index.cshtml",
    "chars": 279,
    "preview": "<!DOCTYPE html>\n<meta charset=\"utf-8\">\n<title>FrontendWeb</title>\n<h1>FrontendWeb</h1>\n<p>This is the beautiful web fro"
  },
  {
    "path": "samples/netcoreapp3.1/FrontendWeb/Views/Home/PlaceOrder.cshtml",
    "chars": 488,
    "preview": "@model Shared.PlaceOrderCommand\n<!DOCTYPE html>\n<meta charset=\"utf-8\">\n<title>FrontendWeb</title>\n<h1>FrontendWeb</h1>\n"
  },
  {
    "path": "samples/netcoreapp3.1/FrontendWeb/Views/_ViewImports.cshtml",
    "chars": 79,
    "preview": "@using Samples.FrontendWeb\n@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers"
  },
  {
    "path": "samples/netcoreapp3.1/FrontendWeb/appsettings.json",
    "chars": 195,
    "preview": "{\n  \"Logging\": {\n    \"IncludeScopes\": false,\n    \"LogLevel\": {\n      \"Default\": \"Debug\",\n      \"System\": \"Information\",\n"
  },
  {
    "path": "samples/netcoreapp3.1/OrdersApi/Controllers/OrdersController.cs",
    "chars": 2579,
    "preview": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Net.Http;\nusing System.Threading.Tasks;\n"
  },
  {
    "path": "samples/netcoreapp3.1/OrdersApi/DataStore/Order.cs",
    "chars": 400,
    "preview": "using System;\nusing System.ComponentModel.DataAnnotations;\n\nnamespace OrdersApi.DataStore\n{\n    public class Order\n    "
  },
  {
    "path": "samples/netcoreapp3.1/OrdersApi/DataStore/OrdersDbContext.cs",
    "chars": 488,
    "preview": "using Microsoft.EntityFrameworkCore;\n\nnamespace OrdersApi.DataStore\n{\n    public class OrdersDbContext : DbContext\n    "
  },
  {
    "path": "samples/netcoreapp3.1/OrdersApi/OrdersApi.csproj",
    "chars": 592,
    "preview": "<Project Sdk=\"Microsoft.NET.Sdk.Web\">\n\n  <PropertyGroup>\n    <TargetFrameworks>netcoreapp3.1</TargetFrameworks>\n  </Pro"
  },
  {
    "path": "samples/netcoreapp3.1/OrdersApi/Program.cs",
    "chars": 1414,
    "preview": "using Microsoft.AspNetCore.Hosting;\nusing Microsoft.Extensions.DependencyInjection;\nusing Microsoft.Extensions.Hosting;\n"
  },
  {
    "path": "samples/netcoreapp3.1/OrdersApi/Properties/launchSettings.json",
    "chars": 243,
    "preview": "{\n  \"profiles\": {\n    \"OrdersApi\": {\n      \"commandName\": \"Project\",\n      \"launchBrowser\": false,\n      \"launchUrl\": \"h"
  },
  {
    "path": "samples/netcoreapp3.1/OrdersApi/Startup.cs",
    "chars": 1680,
    "preview": "using System;\nusing System.Net.Http;\nusing Microsoft.AspNetCore.Builder;\nusing Microsoft.EntityFrameworkCore;\nusing Micr"
  },
  {
    "path": "samples/netcoreapp3.1/OrdersApi/appsettings.json",
    "chars": 165,
    "preview": "{\n  \"Logging\": {\n    \"IncludeScopes\": false,\n    \"LogLevel\": {\n      \"Default\": \"Debug\",\n      \"System\": \"Information\",\n"
  },
  {
    "path": "samples/netcoreapp3.1/Shared/Constants.cs",
    "chars": 266,
    "preview": "namespace Shared\n{\n    public class Constants\n    {\n        public const string FrontendUrl = \"http://localhost:5000/\";"
  },
  {
    "path": "samples/netcoreapp3.1/Shared/Customer.cs",
    "chars": 328,
    "preview": "namespace Shared\n{\n    public class Customer\n    {\n        public int CustomerId { get; set; }\n        public string Na"
  },
  {
    "path": "samples/netcoreapp3.1/Shared/JaegerServiceCollectionExtensions.cs",
    "chars": 1850,
    "preview": "using System;\nusing System.Reflection;\nusing Jaeger;\nusing Jaeger.Reporters;\nusing Jaeger.Samplers;\nusing Jaeger.Sender"
  },
  {
    "path": "samples/netcoreapp3.1/Shared/PlaceOrderCommand.cs",
    "chars": 341,
    "preview": "using System.ComponentModel.DataAnnotations;\n\nnamespace Shared\n{\n    public class PlaceOrderCommand\n    {\n        [Requ"
  },
  {
    "path": "samples/netcoreapp3.1/Shared/Shared.csproj",
    "chars": 760,
    "preview": "<Project Sdk=\"Microsoft.NET.Sdk\">\n\n  <PropertyGroup>\n    <TargetFrameworks>netcoreapp3.1</TargetFrameworks>\n  </Propert"
  },
  {
    "path": "samples/netcoreapp3.1/TrafficGenerator/Program.cs",
    "chars": 712,
    "preview": "using Microsoft.Extensions.DependencyInjection;\nusing Microsoft.Extensions.Hosting;\n\nnamespace TrafficGenerator\n{\n    c"
  },
  {
    "path": "samples/netcoreapp3.1/TrafficGenerator/TrafficGenerator.csproj",
    "chars": 344,
    "preview": "<Project Sdk=\"Microsoft.NET.Sdk.Worker\">\n\n  <PropertyGroup>\n    <TargetFramework>netcoreapp3.1</TargetFramework>\n  </Pro"
  },
  {
    "path": "samples/netcoreapp3.1/TrafficGenerator/Worker.cs",
    "chars": 2045,
    "preview": "using System;\nusing System.Net.Http;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing Microsoft.Extensions.H"
  },
  {
    "path": "samples/netcoreapp3.1/TrafficGenerator/appsettings.json",
    "chars": 186,
    "preview": "{\n  \"Logging\": {\n    \"LogLevel\": {\n      \"Default\": \"Debug\",\n      \"System\": \"Information\",\n      \"Microsoft\": \"Warning\""
  },
  {
    "path": "src/Directory.Build.props",
    "chars": 1164,
    "preview": "<Project>\n  <Import Project=\"..\\Directory.Build.props\" />\n\n  <PropertyGroup>\n    <IsPackable>true</IsPackable>\n    <Auth"
  },
  {
    "path": "src/OpenTracing.Contrib.NetCore/AspNetCore/AspNetCoreDiagnosticOptions.cs",
    "chars": 2354,
    "preview": "using OpenTracing.Contrib.NetCore.AspNetCore;\n\nnamespace OpenTracing.Contrib.NetCore.Configuration\n{\n    public class A"
  },
  {
    "path": "src/OpenTracing.Contrib.NetCore/AspNetCore/AspNetCoreDiagnostics.cs",
    "chars": 13880,
    "preview": "using System;\nusing System.Collections.Generic;\nusing Microsoft.AspNetCore.Http;\nusing Microsoft.AspNetCore.Http.Extensi"
  },
  {
    "path": "src/OpenTracing.Contrib.NetCore/AspNetCore/HostingOptions.cs",
    "chars": 2661,
    "preview": "using System;\nusing System.Collections.Generic;\nusing Microsoft.AspNetCore.Http;\n\nnamespace OpenTracing.Contrib.NetCore"
  },
  {
    "path": "src/OpenTracing.Contrib.NetCore/AspNetCore/RequestHeadersExtractAdapter.cs",
    "chars": 1022,
    "preview": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing Microsoft.AspNetCore.Http;\nusing OpenTra"
  },
  {
    "path": "src/OpenTracing.Contrib.NetCore/Configuration/DiagnosticOptions.cs",
    "chars": 824,
    "preview": "using System.Collections.Generic;\n\nnamespace OpenTracing.Contrib.NetCore.Configuration\n{\n    public abstract class Diag"
  },
  {
    "path": "src/OpenTracing.Contrib.NetCore/Configuration/IOpenTracingBuilder.cs",
    "chars": 391,
    "preview": "namespace Microsoft.Extensions.DependencyInjection\n{\n    /// <summary>\n    /// An interface for configuring OpenTracing "
  },
  {
    "path": "src/OpenTracing.Contrib.NetCore/Configuration/OpenTracingBuilder.cs",
    "chars": 413,
    "preview": "using System;\nusing Microsoft.Extensions.DependencyInjection;\n\nnamespace OpenTracing.Contrib.NetCore.Configuration\n{\n   "
  },
  {
    "path": "src/OpenTracing.Contrib.NetCore/Configuration/OpenTracingBuilderExtensions.cs",
    "chars": 9567,
    "preview": "using System;\nusing Microsoft.Extensions.DependencyInjection.Extensions;\nusing Microsoft.Extensions.Logging;\nusing OpenT"
  },
  {
    "path": "src/OpenTracing.Contrib.NetCore/Configuration/ServiceCollectionExtensions.cs",
    "chars": 2626,
    "preview": "using System;\nusing Microsoft.Extensions.DependencyInjection.Extensions;\nusing Microsoft.Extensions.Hosting;\nusing OpenT"
  },
  {
    "path": "src/OpenTracing.Contrib.NetCore/EntityFrameworkCore/EntityFrameworkCoreDiagnosticOptions.cs",
    "chars": 4143,
    "preview": "using System;\nusing System.Collections.Generic;\nusing Microsoft.EntityFrameworkCore.Diagnostics;\n\nnamespace OpenTracing"
  },
  {
    "path": "src/OpenTracing.Contrib.NetCore/EntityFrameworkCore/EntityFrameworkCoreDiagnostics.cs",
    "chars": 5698,
    "preview": "using System;\nusing System.Collections.Concurrent;\nusing System.Collections.Generic;\nusing Microsoft.EntityFrameworkCore"
  },
  {
    "path": "src/OpenTracing.Contrib.NetCore/GenericListeners/GenericDiagnosticOptions.cs",
    "chars": 926,
    "preview": "using System.Collections.Generic;\n\nnamespace OpenTracing.Contrib.NetCore.Configuration\n{\n    public sealed class Generi"
  },
  {
    "path": "src/OpenTracing.Contrib.NetCore/GenericListeners/GenericDiagnostics.cs",
    "chars": 3805,
    "preview": "using System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing Microsoft.Extensions.Logging;\nusing Mic"
  },
  {
    "path": "src/OpenTracing.Contrib.NetCore/HttpHandler/HttpHandlerDiagnosticOptions.cs",
    "chars": 2757,
    "preview": "using System;\nusing System.Collections.Generic;\nusing System.Net.Http;\n\nnamespace OpenTracing.Contrib.NetCore.Configura"
  },
  {
    "path": "src/OpenTracing.Contrib.NetCore/HttpHandler/HttpHandlerDiagnostics.cs",
    "chars": 8011,
    "preview": "using System;\nusing System.Collections.Generic;\nusing System.Net.Http;\nusing System.Threading.Tasks;\nusing Microsoft.Ext"
  },
  {
    "path": "src/OpenTracing.Contrib.NetCore/HttpHandler/HttpHeadersInjectAdapter.cs",
    "chars": 992,
    "preview": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Net.Http.Headers;\nusing OpenTraci"
  },
  {
    "path": "src/OpenTracing.Contrib.NetCore/InstrumentationService.cs",
    "chars": 981,
    "preview": "using System;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing Microsoft.Extensions.Hosting;\nusing OpenTracin"
  },
  {
    "path": "src/OpenTracing.Contrib.NetCore/Internal/DiagnosticEventObserver.cs",
    "chars": 3541,
    "preview": "using System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing Microsoft.Extensions.Logging;\nusing Ope"
  },
  {
    "path": "src/OpenTracing.Contrib.NetCore/Internal/DiagnosticManager.cs",
    "chars": 3584,
    "preview": "using System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.Linq;\nusing Microsoft.Extensions."
  },
  {
    "path": "src/OpenTracing.Contrib.NetCore/Internal/DiagnosticManagerOptions.cs",
    "chars": 174,
    "preview": "namespace OpenTracing.Contrib.NetCore.Internal\n{\n    public class DiagnosticManagerOptions\n    {\n        public bool St"
  },
  {
    "path": "src/OpenTracing.Contrib.NetCore/Internal/DiagnosticObserver.cs",
    "chars": 898,
    "preview": "using System;\nusing System.Diagnostics;\nusing Microsoft.Extensions.Logging;\n\nnamespace OpenTracing.Contrib.NetCore.Inte"
  },
  {
    "path": "src/OpenTracing.Contrib.NetCore/Internal/GenericEventProcessor.cs",
    "chars": 4556,
    "preview": "using System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing Microsoft.Extensions.Logging;\nusing Ope"
  },
  {
    "path": "src/OpenTracing.Contrib.NetCore/Internal/GlobalTracerAccessor.cs",
    "chars": 253,
    "preview": "using OpenTracing.Util;\n\nnamespace OpenTracing.Contrib.NetCore.Internal\n{\n    public class GlobalTracerAccessor : IGloba"
  },
  {
    "path": "src/OpenTracing.Contrib.NetCore/Internal/IGlobalTracerAccessor.cs",
    "chars": 284,
    "preview": "namespace OpenTracing.Contrib.NetCore.Internal\n{\n    /// <summary>\n    /// Helper interface which allows unit tests to m"
  },
  {
    "path": "src/OpenTracing.Contrib.NetCore/Internal/PropertyFetcher.cs",
    "chars": 3352,
    "preview": "// From https://github.com/dotnet/corefx/blob/master/src/System.Diagnostics.DiagnosticSource/src/System/Diagnostics/Dia"
  },
  {
    "path": "src/OpenTracing.Contrib.NetCore/Internal/SpanExtensions.cs",
    "chars": 857,
    "preview": "using System;\nusing System.Collections.Generic;\nusing OpenTracing.Tag;\n\nnamespace OpenTracing.Contrib.NetCore.Internal\n{"
  },
  {
    "path": "src/OpenTracing.Contrib.NetCore/Internal/TracerExtensions.cs",
    "chars": 549,
    "preview": "using OpenTracing.Noop;\nusing OpenTracing.Util;\n\nnamespace OpenTracing.Contrib.NetCore.Internal\n{\n    internal static c"
  },
  {
    "path": "src/OpenTracing.Contrib.NetCore/Logging/OpenTracingLogger.cs",
    "chars": 5076,
    "preview": "using System;\nusing System.Collections.Generic;\nusing Microsoft.Extensions.Logging;\nusing OpenTracing.Contrib.NetCore.I"
  },
  {
    "path": "src/OpenTracing.Contrib.NetCore/Logging/OpenTracingLoggerProvider.cs",
    "chars": 888,
    "preview": "using System;\nusing Microsoft.Extensions.Logging;\nusing OpenTracing.Contrib.NetCore.Internal;\n\nnamespace OpenTracing.Co"
  },
  {
    "path": "src/OpenTracing.Contrib.NetCore/MicrosoftSqlClient/MicrosoftSqlClientDiagnosticOptions.cs",
    "chars": 4175,
    "preview": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing Microsoft.Data.SqlClient;\n\nnamespace OpenTraci"
  },
  {
    "path": "src/OpenTracing.Contrib.NetCore/MicrosoftSqlClient/MicrosoftSqlClientDiagnostics.cs",
    "chars": 5290,
    "preview": "using System;\nusing System.Collections.Concurrent;\nusing System.Collections.Generic;\nusing Microsoft.Data.SqlClient;\nus"
  },
  {
    "path": "src/OpenTracing.Contrib.NetCore/OpenTracing.Contrib.NetCore.csproj",
    "chars": 4174,
    "preview": "<Project Sdk=\"Microsoft.NET.Sdk\">\n\n  <PropertyGroup>\n    <TargetFrameworks>netcoreapp3.1;net6.0;net7.0</TargetFramework"
  },
  {
    "path": "src/OpenTracing.Contrib.NetCore/Properties/AssemblyInfo.cs",
    "chars": 896,
    "preview": "using System.Runtime.CompilerServices;\n\n[assembly: InternalsVisibleTo(\"OpenTracing.Contrib.NetCore.Tests, PublicKey=\" +\n"
  },
  {
    "path": "src/OpenTracing.Contrib.NetCore/SystemSqlClient/SqlClientDiagnosticOptions.cs",
    "chars": 2160,
    "preview": "using System;\nusing System.Collections.Generic;\nusing System.Data.SqlClient;\nusing System.Linq;\n\nnamespace OpenTracing."
  },
  {
    "path": "src/OpenTracing.Contrib.NetCore/SystemSqlClient/SqlClientDiagnostics.cs",
    "chars": 5348,
    "preview": "using System;\nusing System.Collections.Concurrent;\nusing System.Collections.Generic;\nusing System.Data.SqlClient;\nusing"
  },
  {
    "path": "test/OpenTracing.Contrib.NetCore.Tests/AspNetCore/HostingTest.cs",
    "chars": 9491,
    "preview": "using System;\nusing System.Linq;\nusing System.Net.Http;\nusing System.Threading.Tasks;\nusing Microsoft.AspNetCore;\nusing "
  },
  {
    "path": "test/OpenTracing.Contrib.NetCore.Tests/CoreFx/HttpHandlerDiagnosticTest.cs",
    "chars": 10967,
    "preview": "using System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.Net;\nusing System.Net.Http;\nusing"
  },
  {
    "path": "test/OpenTracing.Contrib.NetCore.Tests/Internal/DiagnosticManagerTest.cs",
    "chars": 2382,
    "preview": "using System.Collections.Generic;\nusing Microsoft.Extensions.Logging.Abstractions;\nusing Microsoft.Extensions.Options;\n"
  },
  {
    "path": "test/OpenTracing.Contrib.NetCore.Tests/Internal/PropertyFetcherTest.cs",
    "chars": 1195,
    "preview": "using OpenTracing.Contrib.NetCore.Internal;\nusing Xunit;\n\nnamespace OpenTracing.Contrib.NetCore.Tests.Internal\n{\n    pu"
  },
  {
    "path": "test/OpenTracing.Contrib.NetCore.Tests/Logging/LoggingDependencyInjectionTest.cs",
    "chars": 1770,
    "preview": "using System;\nusing Microsoft.Extensions.DependencyInjection;\nusing Microsoft.Extensions.Logging;\nusing OpenTracing.Prop"
  },
  {
    "path": "test/OpenTracing.Contrib.NetCore.Tests/Logging/LoggingTest.cs",
    "chars": 10777,
    "preview": "#pragma warning disable CA2017\n\nusing System;\nusing Microsoft.Extensions.DependencyInjection;\nusing Microsoft.Extensions"
  },
  {
    "path": "test/OpenTracing.Contrib.NetCore.Tests/OpenTracing.Contrib.NetCore.Tests.csproj",
    "chars": 1174,
    "preview": "<Project Sdk=\"Microsoft.NET.Sdk\">\n\n  <PropertyGroup>\n    <TargetFrameworks>netcoreapp3.1;net6.0;net7.0</TargetFramework"
  },
  {
    "path": "test/OpenTracing.Contrib.NetCore.Tests/XunitLogging/XunitLoggerFactoryExtensions.cs",
    "chars": 1378,
    "preview": "// From https://github.com/aspnet/Logging/blob/dev/src/Microsoft.Extensions.Logging.Testing/XunitLoggerFactoryExtension"
  },
  {
    "path": "test/OpenTracing.Contrib.NetCore.Tests/XunitLogging/XunitLoggerProvider.cs",
    "chars": 3883,
    "preview": "// From https://github.com/aspnet/Logging/blob/dev/src/Microsoft.Extensions.Logging.Testing/XunitLoggerProvider.cs\n\nusi"
  },
  {
    "path": "version.props",
    "chars": 1361,
    "preview": "<Project>\n  <PropertyGroup>\n    <!--\n      These settings ensure that we don't have to manually increment version number"
  }
]

// ... and 1 more files (download for full content)

About this extraction

This page contains the full source code of the opentracing-contrib/csharp-netcore GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 165 files (272.2 KB), approximately 64.0k tokens, and a symbol index with 397 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.

Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.

Copied to clipboard!