Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[logs-branch] Merge from main into main-logs #3809

Merged
merged 52 commits into from
Oct 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
7f71283
[Logs] Fix buffered log scopes being reused (#3731)
CodeBlanch Oct 5, 2022
622583c
clarify that Prometheus HttpListner is not for production at this mom…
reyang Oct 6, 2022
3671e55
[HttpClient] Export spans corresponding to retries (#3732)
vishweshbankwar Oct 7, 2022
419eec3
Minor update to OTLP readme (#3739)
cijothomas Oct 7, 2022
45b63d7
Update workflow (#3741)
cijothomas Oct 7, 2022
a6c3cac
Minor improvement to log message (#3742)
cijothomas Oct 7, 2022
f191e84
[SDK + Jaeger] Support loading environment variables from IConfigurat…
CodeBlanch Oct 12, 2022
e8af2a0
[Zipkin] Support loading envvars from IConfiguration (#3759)
CodeBlanch Oct 12, 2022
ee9b892
SqlClient Instrumentation to leverage native Activity Status. (#3751)
Yun-Ting Oct 12, 2022
73f8d3c
[Metrics] Update default buckets for Explicit Bucket Histogram from s…
schoder-moreno Oct 13, 2022
0d4c5f5
[Logs] Fix: Respect AttributeValueLengthLimit when building otlp LogR…
Oct 13, 2022
7852797
Bump actions/setup-dotnet from 3.0.1 to 3.0.2 (#3764)
dependabot[bot] Oct 13, 2022
af7ab89
[Repo] Attempting to stabilize the API Compatibility CI job (#3766)
CodeBlanch Oct 13, 2022
8db45a3
Adding MinMax to Histograms (#2735)
mic-max Oct 14, 2022
6d5dd37
Logging state during building of TracerProvider (#3746)
ggoel Oct 14, 2022
0feebf3
[HttpClient] Add unit tests for `RecordException` case (#3761)
vishweshbankwar Oct 14, 2022
16d8e22
Add a separate example project for Logs redaction (#3744)
utpilla Oct 17, 2022
727aab0
Update CHANGELOG for 1.4.0-beta.2 release (#3772)
utpilla Oct 17, 2022
1a2103d
[SDK + Otlp] Support loading envvars from IConfiguration (#3760)
CodeBlanch Oct 17, 2022
3f53be6
[SqlClient] Add support for Filter expression (#3743)
Driedas Oct 18, 2022
4239992
[SDK, Jaeger, Zipkin, & Otlp] Support loading envvars for BatchExport…
CodeBlanch Oct 18, 2022
fa950b3
Remove Env from CI `DOTNET_MULTILEVEL_LOOKUP = 1` (#3779)
mic-max Oct 18, 2022
49d1779
Link to .NET docs about different ports (#3704)
aristotelos Oct 18, 2022
5b12f08
Update DS to rc2 (#3781)
cijothomas Oct 18, 2022
f71b404
ConsoleLogExporter to output full exception (#3784)
cijothomas Oct 18, 2022
c2473fd
[ASP.NET Core] Add back netstandard2.0 and 2.1 targets (#3755)
vishweshbankwar Oct 18, 2022
5f962a1
[HttpClient] Add back netstandard2.0 target (#3787)
vishweshbankwar Oct 19, 2022
6d6222f
Bump System.Text.Json version due to CVE-2021-26701 (#3789)
reyang Oct 19, 2022
2377d00
Auto-generated Semantic Conventions (#2069)
joaopgrassi Oct 19, 2022
cedda83
[SDK] Support dependency injection in ResourceBuilder and load envvar…
CodeBlanch Oct 19, 2022
079d411
Add Vishwesh as an Approver (#3783)
utpilla Oct 19, 2022
13ea238
Move more SDK docs to docs folder (#3794)
cijothomas Oct 20, 2022
6fae370
[Prometheus AspNetCore] Support named options in pipeline extensions …
CodeBlanch Oct 20, 2022
f963f9d
[Logs] UnitTest: LogRecord attribute limits (#3758)
Oct 20, 2022
16e0758
Add MinMax to console and doc additions (#3795)
cijothomas Oct 20, 2022
82a3353
Mark private and internal classes as sealed (#3799)
utpilla Oct 21, 2022
f94ccb7
Move more docs to docs folder (#3801)
cijothomas Oct 21, 2022
0c31fb9
[ASP.NET Core] Update enrich callbacks to use specific type. (#3749)
vishweshbankwar Oct 21, 2022
d21e609
[Http] Update enrich callbacks for http (#3792)
vishweshbankwar Oct 21, 2022
3265055
[SDK] Support dependency injection in the GetDefaultResource API (#3798)
CodeBlanch Oct 21, 2022
9b8702e
Fix circular reference issue building up tracer provider. (#3803)
CodeBlanch Oct 21, 2022
d4cbc0c
[SDK] Add some missing nullable annotations (#3796)
CodeBlanch Oct 21, 2022
3c245ef
Guard.Range now uses invariant culture for error message (#3778)
Driedas Oct 21, 2022
0804334
Fix circular reference issue building up meter provider. (#3806)
CodeBlanch Oct 21, 2022
78f8bf8
Add missing end of code block backticks (#3807)
benbhall Oct 22, 2022
7e44089
More doc tweaks (#3805)
cijothomas Oct 22, 2022
732f199
Update grpc client enrich callbacks (#3804)
vishweshbankwar Oct 24, 2022
6ce883b
Port refactor from main-logs branch. (#3808)
CodeBlanch Oct 24, 2022
7f1e399
Merge from main.
CodeBlanch Oct 24, 2022
8c0ac5a
Merge fixes.
CodeBlanch Oct 24, 2022
321e6d3
Merge fixes.
CodeBlanch Oct 24, 2022
45e7e1b
Merge fix.
CodeBlanch Oct 24, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions .github/workflows/apicompatibility.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,12 @@ jobs:
runs-on: windows-latest
env:
CheckAPICompatibility: true
# https://github.com/actions/setup-dotnet/issues/122
DOTNET_MULTILEVEL_LOOKUP: 1

steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # fetching all
- uses: actions/setup-dotnet@v3.0.1
- uses: actions/setup-dotnet@v3.0.2
with:
dotnet-version: '7.0.x'
include-prerelease: true
Expand Down
6 changes: 1 addition & 5 deletions .github/workflows/code-coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,12 @@ jobs:
fail-fast: false
matrix:
os: [windows-latest]
env:
OS: ${{ matrix.os }}
# https://github.com/actions/setup-dotnet/issues/122
DOTNET_MULTILEVEL_LOOKUP: 1

steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # fetching all
- uses: actions/setup-dotnet@v3.0.1
- uses: actions/setup-dotnet@v3.0.2
with:
dotnet-version: '7.0.x'
include-prerelease: true
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/dotnet-format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
uses: actions/checkout@v3

- name: Setup .NET Core 7.0
uses: actions/setup-dotnet@v3.0.1
uses: actions/setup-dotnet@v3.0.2
with:
dotnet-version: '7.0.x'
include-prerelease: true
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/linux-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ jobs:
with:
fetch-depth: 0 # fetching all

- uses: actions/setup-dotnet@v3.0.1
- uses: actions/setup-dotnet@v3.0.2
with:
dotnet-version: '6.0.x'

- uses: actions/setup-dotnet@v3.0.1
- uses: actions/setup-dotnet@v3.0.2
with:
dotnet-version: '7.0.x'
include-prerelease: true
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish-packages-1.0.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
fetch-depth: 0 # fetching all
ref: ${{ github.ref || 'main' }}

- uses: actions/setup-dotnet@v3.0.1
- uses: actions/setup-dotnet@v3.0.2
with:
dotnet-version: '7.0.x'
include-prerelease: true
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/windows-ci-md.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:

strategy:
matrix:
version: [net462,net6.0]
version: [net462,net6.0,net7.0]

steps:
- run: 'echo "No build required"'
5 changes: 1 addition & 4 deletions .github/workflows/windows-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@ on:
jobs:
build-test:
runs-on: windows-latest
env:
# https://github.com/actions/setup-dotnet/issues/122
DOTNET_MULTILEVEL_LOOKUP: 1

strategy:
matrix:
Expand All @@ -26,7 +23,7 @@ jobs:
with:
fetch-depth: 0 # fetching all

- uses: actions/setup-dotnet@v3.0.1
- uses: actions/setup-dotnet@v3.0.2
with:
dotnet-version: '7.0.x'
include-prerelease: true
Expand Down
1 change: 1 addition & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
"tracestate",
"Tracestate",
"triager",
"typeparam",
"umesan",
"unencrypted",
"unvalidated",
Expand Down
7 changes: 7 additions & 0 deletions OpenTelemetry.proj
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@

<PackProjects Include="src\**\*.csproj" />

<!-- Windows specific projects -->
<PackProjects Remove="src\OpenTelemetry.Instrumentation.AspNet\OpenTelemetry.Instrumentation.AspNet.csproj" Condition="'$(OS)' != 'Windows_NT'" />

<!-- Not pack SemanticConventions project for now -->
<SolutionProjects Remove="src\OpenTelemetry.SemanticConventions\OpenTelemetry.SemanticConventions.csproj" />
<PackProjects Remove="src\OpenTelemetry.SemanticConventions\OpenTelemetry.SemanticConventions.csproj" Condition="'$(OS)' != 'Windows_NT'" />

</ItemGroup>

<Target Name="Build">
Expand Down
13 changes: 13 additions & 0 deletions OpenTelemetry.sln
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "source-generation", "docs\l
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "getting-started-prometheus-grafana", "docs\metrics\getting-started-prometheus-grafana\getting-started-prometheus-grafana.csproj", "{41B784AA-3301-4126-AF9F-1D59BD04B0BF}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenTelemetry.SemanticConventions", "src\OpenTelemetry.SemanticConventions\OpenTelemetry.SemanticConventions.csproj", "{D4519DF6-CC72-4AC4-A851-E21383098D11}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "customizing-the-sdk", "docs\logs\customizing-the-sdk\customizing-the-sdk.csproj", "{6C7A1595-36D6-4229-BBB5-5A6B5791791D}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenTelemetry.Extensions.Propagators", "src\OpenTelemetry.Extensions.Propagators\OpenTelemetry.Extensions.Propagators.csproj", "{E91B2E40-E428-43B3-8A43-09709F0E69E4}"
Expand Down Expand Up @@ -244,6 +246,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenTelemetry.Extensions.Ev
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenTelemetry.Extensions.Serilog.Tests", "test\OpenTelemetry.Extensions.Serilog.Tests\OpenTelemetry.Extensions.Serilog.Tests.csproj", "{3B3C3571-6116-49D6-B28F-2A541E003577}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "redaction", "docs\logs\redaction\redaction.csproj", "{A2DF46DE-50D7-4887-8C9D-4BD79CA19FAA}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -442,6 +446,10 @@ Global
{41B784AA-3301-4126-AF9F-1D59BD04B0BF}.Debug|Any CPU.Build.0 = Debug|Any CPU
{41B784AA-3301-4126-AF9F-1D59BD04B0BF}.Release|Any CPU.ActiveCfg = Release|Any CPU
{41B784AA-3301-4126-AF9F-1D59BD04B0BF}.Release|Any CPU.Build.0 = Release|Any CPU
{D4519DF6-CC72-4AC4-A851-E21383098D11}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D4519DF6-CC72-4AC4-A851-E21383098D11}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D4519DF6-CC72-4AC4-A851-E21383098D11}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D4519DF6-CC72-4AC4-A851-E21383098D11}.Release|Any CPU.Build.0 = Release|Any CPU
{6C7A1595-36D6-4229-BBB5-5A6B5791791D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6C7A1595-36D6-4229-BBB5-5A6B5791791D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6C7A1595-36D6-4229-BBB5-5A6B5791791D}.Release|Any CPU.ActiveCfg = Release|Any CPU
Expand Down Expand Up @@ -506,6 +514,10 @@ Global
{3B3C3571-6116-49D6-B28F-2A541E003577}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3B3C3571-6116-49D6-B28F-2A541E003577}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3B3C3571-6116-49D6-B28F-2A541E003577}.Release|Any CPU.Build.0 = Release|Any CPU
{A2DF46DE-50D7-4887-8C9D-4BD79CA19FAA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A2DF46DE-50D7-4887-8C9D-4BD79CA19FAA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A2DF46DE-50D7-4887-8C9D-4BD79CA19FAA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A2DF46DE-50D7-4887-8C9D-4BD79CA19FAA}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down Expand Up @@ -543,6 +555,7 @@ Global
{9A07D215-90AC-4BAF-BCDB-73D74FD3A5C5} = {3862190B-E2C5-418E-AFDC-DB281FB5C705}
{5FDAF679-DE5A-4C73-A49B-8ABCF2399229} = {77C7929A-2EED-4AA6-8705-B5C443C8AA0F}
{7642798D-12D4-403A-BB92-B6BEF67C9D4F} = {E359BB2B-9AEC-497D-B321-7DF2450C3B8E}
{A2DF46DE-50D7-4887-8C9D-4BD79CA19FAA} = {3862190B-E2C5-418E-AFDC-DB281FB5C705}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {55639B5C-0770-4A22-AB56-859604650521}
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ If you have trouble accessing the doc, please get in touch on

* [Reiley Yang](https://github.com/reyang), Microsoft
* [Robert Paj&#x105;k](https://github.com/pellared), Splunk
* [Vishwesh Bankwar](https://github.com/vishweshbankwar), Microsoft

[Emeritus
Maintainer/Approver/Triager](https://github.com/open-telemetry/community/blob/main/community-membership.md#emeritus-maintainerapprovertriager):
Expand Down
12 changes: 9 additions & 3 deletions build/Common.prod.props
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,17 @@

<ItemGroup Condition="'$(MinVerTagPrefix)' == 'core-' AND '$(CheckAPICompatibility)' == 'true'">
<PackageReference Include="Microsoft.DotNet.ApiCompat" Version="6.0.0-beta.21308.1" PrivateAssets="All" />
<ResolvedMatchingContract Include="..\LastMajorVersionBinaries\$(AssemblyName)\$(OTelPreviousStableVer)\lib\$(TargetFramework)\$(AssemblyName).dll" />
<ResolvedMatchingContract Include="$(RepoRoot)\build\LastMajorVersionBinaries\$(AssemblyName)\$(OTelPreviousStableVer)\lib\$(TargetFramework)\$(AssemblyName).dll" />
</ItemGroup>

<Target Name="PreBuild" BeforeTargets="PreBuildEvent" Condition="'$(MinVerTagPrefix)' == 'core-' AND '$(CheckAPICompatibility)' == 'true'">
<Exec Command="powershell -ExecutionPolicy Unrestricted -File &quot;$(RepoRoot)\build\PreBuild.ps1&quot; -package $(AssemblyName) -version &quot;$(OTelPreviousStableVer)&quot;" />
<Target Name="PreBuild" BeforeTargets="DispatchToInnerBuilds;ValidateApiCompatForSrc" Condition="'$(MinVerTagPrefix)' == 'core-' AND '$(CheckAPICompatibility)' == 'true'">
<!-- Note: DispatchToInnerBuilds is called for projects with multiple
targets defined to spawn a build process for each target framework being
compiled. Executing BEFORE that step means this runs once for a project
instead of in parallel for each target framework defined. If we ever have a
project with only a single target, this will NOT run and an alternative
solution will be needed. -->
<Exec Command="powershell -ExecutionPolicy Unrestricted -File &quot;$(RepoRoot)\build\PreBuild.ps1&quot; -package $(AssemblyName) -version &quot;$(OTelPreviousStableVer)&quot; -workDir &quot;$(RepoRoot)\build\LastMajorVersionBinaries&quot;" />
</Target>

<Target Name="FindContractDependencyPaths" BeforeTargets="ValidateApiCompatForSrc" AfterTargets="ResolveAssemblyReferences" Condition="'$(MinVerTagPrefix)' == 'core-' AND '$(CheckAPICompatibility)' == 'true'">
Expand Down
9 changes: 5 additions & 4 deletions build/Common.props
Original file line number Diff line number Diff line change
Expand Up @@ -31,21 +31,22 @@
<MicrosoftAspNetCoreHttpFeaturesPkgVer>[2.1.1,6.0)</MicrosoftAspNetCoreHttpFeaturesPkgVer>
<MicrosoftCodeAnalysisAnalyzersPkgVer>[3.3.3]</MicrosoftCodeAnalysisAnalyzersPkgVer>
<MicrosoftCodeCoveragePkgVer>[17.3.0]</MicrosoftCodeCoveragePkgVer>
<MicrosoftExtensionsConfigurationEnvironmentVariablesPkgVer>[3.1.0,)</MicrosoftExtensionsConfigurationEnvironmentVariablesPkgVer>
<MicrosoftExtensionsHostingAbstractionsPkgVer>[2.1.0,)</MicrosoftExtensionsHostingAbstractionsPkgVer>
<MicrosoftExtensionsLoggingPkgVer>[3.1.0,)</MicrosoftExtensionsLoggingPkgVer>
<MicrosoftExtensionsLoggingConfigurationPkgVer>[3.1.0,)</MicrosoftExtensionsLoggingConfigurationPkgVer>
<MicrosoftExtensionsOptionsPkgVer>[3.1.0,)</MicrosoftExtensionsOptionsPkgVer>
<MicrosoftExtensionsOptionsPkgVer>[5.0.0,)</MicrosoftExtensionsOptionsPkgVer>
<MicrosoftNETFrameworkReferenceAssembliesPkgVer>[1.0.0,2.0)</MicrosoftNETFrameworkReferenceAssembliesPkgVer>
<MicrosoftSourceLinkGitHubPkgVer>[1.0.0,2.0)</MicrosoftSourceLinkGitHubPkgVer>
<OpenTracingPkgVer>[0.12.1,0.13)</OpenTracingPkgVer>
<OTelPreviousStableVer>1.3.1</OTelPreviousStableVer>
<SerilogPkgVer>[2.8.0,3.0)</SerilogPkgVer>
<StyleCopAnalyzersPkgVer>[1.2.0-beta.435,2.0)</StyleCopAnalyzersPkgVer>
<SystemCollectionsImmutablePkgVer>1.4.0</SystemCollectionsImmutablePkgVer>
<SystemDiagnosticSourcePkgVer>7.0.0-rc.1.22426.10</SystemDiagnosticSourcePkgVer>
<SystemDiagnosticSourcePkgVer>7.0.0-rc.2.22472.3</SystemDiagnosticSourcePkgVer>
<SystemReflectionEmitLightweightPkgVer>4.7.0</SystemReflectionEmitLightweightPkgVer>
<SystemTextJsonPkgVer>4.7.0</SystemTextJsonPkgVer>
<SystemThreadingTasksExtensionsPkgVer>4.5.3</SystemThreadingTasksExtensionsPkgVer>
<SystemTextJsonPkgVer>4.7.2</SystemTextJsonPkgVer>
<SystemThreadingTasksExtensionsPkgVer>4.5.4</SystemThreadingTasksExtensionsPkgVer>
</PropertyGroup>

<ItemGroup>
Expand Down
17 changes: 11 additions & 6 deletions build/PreBuild.ps1
Original file line number Diff line number Diff line change
@@ -1,26 +1,31 @@
param([string]$package, [string]$version)
param(
[string]$package,
[string]$version,
[string]$workDir = ".\LastMajorVersionBinaries"
)

$workDir = "..\LastMajorVersionBinaries"
if (-Not (Test-Path $workDir))
{
Write-Host "Working directory for previous package versions not found, creating..."
Write-Host "Working directory for compatibility check packages '$workDir' not found, creating..."
New-Item -Path $workDir -ItemType "directory" | Out-Null
}

if (Test-Path -Path "$workDir\$package.$version.zip")
{
Write-Debug "Previous package version already downloaded"
Write-Debug "Previous package $package@$version already downloaded for compatibility check"
}
else
{
Write-Host "Retrieving $package @$version for compatibility check"
Write-Host "Retrieving package $package@$version for compatibility check"
Invoke-WebRequest -Uri https://www.nuget.org/api/v2/package/$package/$version -Outfile "$workDir\$package.$version.zip"
}

if (Test-Path -Path "$workDir\$package\$version\lib")
{
Write-Debug "Previous package version already extracted"
Write-Debug "Previous package $package@$version already extracted to '$workDir\$package\$version\lib'"
}
else
{
Write-Host "Extracting package $package@$version from '$workDir\$package.$version.zip' to '$workDir\$package\$version' for compatibility check"
Expand-Archive -LiteralPath "$workDir\$package.$version.zip" -DestinationPath "$workDir\$package\$version" -Force
}
1 change: 0 additions & 1 deletion docs/logs/extending-the-sdk/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ public static void Main()
{
using var loggerFactory = LoggerFactory.Create(builder => builder
.AddOpenTelemetry(options => options.IncludeScopes = true)
.AddProcessor(new MyRedactionProcessor())
.AddProcessor(new MyProcessor("ProcessorA"))
.AddProcessor(new MyProcessor("ProcessorB"))
.AddProcessor(new SimpleLogRecordExportProcessor(new MyExporter("ExporterX")))
Expand Down
36 changes: 36 additions & 0 deletions docs/logs/redaction/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
// <copyright file="Program.cs" company="OpenTelemetry Authors">
// Copyright The OpenTelemetry Authors
//
// 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.
// </copyright>

using Microsoft.Extensions.Logging;
using OpenTelemetry.Logs;

namespace Redaction;

public class Program
{
public static void Main()
{
using var loggerFactory = LoggerFactory.Create(builder => builder
.AddOpenTelemetry()
.AddProcessor(new MyRedactionProcessor())
.AddConsoleExporter());

var logger = loggerFactory.CreateLogger<Program>();

// message will be redacted by MyRedactionProcessor
logger.LogInformation("OpenTelemetry {sensitiveString}.", "<secret>");
}
}
6 changes: 6 additions & 0 deletions docs/logs/redaction/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Redaction

This example shows how to redact sensitive information from Logs.
In this example, we attach a custom `Processor` called `MyRedactionProcessor`
which is responsible for replacing any instance of the word "&lt;secret&gt;"
with the value "newRedactedValueHere".
6 changes: 6 additions & 0 deletions docs/logs/redaction/redaction.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Logging" Version="$(MicrosoftExtensionsLoggingPkgVer)" />
<ProjectReference Include="$(RepoRoot)\src\OpenTelemetry.Exporter.Console\OpenTelemetry.Exporter.Console.csproj" />
</ItemGroup>
</Project>
2 changes: 2 additions & 0 deletions docs/metrics/customizing-the-sdk/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
using System.Diagnostics.Metrics;
using OpenTelemetry;
using OpenTelemetry.Metrics;
using OpenTelemetry.Resources;

namespace CustomizingTheSdk;

Expand All @@ -29,6 +30,7 @@ public class Program
public static void Main()
{
using var meterProvider = Sdk.CreateMeterProviderBuilder()
.ConfigureResource(res => res.AddService("example-service"))
.AddMeter(Meter1.Name)
.AddMeter(Meter2.Name)

Expand Down
38 changes: 35 additions & 3 deletions docs/metrics/customizing-the-sdk/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -235,8 +235,7 @@ with the metric are of interest to you.
#### Specify custom boundaries for Histogram

By default, the boundaries used for a Histogram are [`{ 0, 5, 10, 25, 50, 75,
100, 250, 500,
1000}`](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/metrics/sdk.md#explicit-bucket-histogram-aggregation).
100, 250, 500, 750, 1000, 2500, 5000, 7500, 10000}`](https://github.com/open-telemetry/opentelemetry-specification/blob/v1.14.0/specification/metrics/sdk.md#explicit-bucket-histogram-aggregation).
Views can be used to provide custom boundaries for a Histogram. The measurements
are then aggregated using the custom boundaries provided instead of the the
default boundaries. This requires the use of
Expand Down Expand Up @@ -428,4 +427,37 @@ Refer to the individual exporter docs to learn how to use them:

### Resource

// TODO
[Resource](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/resource/sdk.md)
is the immutable representation of the entity producing the telemetry. If no
`Resource` is explicitly configured, the
[default](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/resource/semantic_conventions/README.md#semantic-attributes-with-sdk-provided-default-value)
is to use a resource indicating this
[Service](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/resource/semantic_conventions/README.md#service).
The `ConfigureResource` method on `MeterProviderBuilder` can be used to set a
configure the resource on the provider. When the provider is built, it
automatically builds the final `Resource` from the configured `ResourceBuilder`.
There can only be a single `Resource` associated with a
provider. It is not possible to change the resource builder *after* the provider
is built, by calling the `Build()` method on the `MeterProviderBuilder`.
`ResourceBuilder` offers various methods to construct resource comprising of
multiple attributes from various sources.

The snippet below shows configuring the `Resource` associated with the provider.

```csharp
using OpenTelemetry;
using OpenTelemetry.Metrics;
using OpenTelemetry.Resources;

using var meterProvider = Sdk.CreateMeterProviderBuilder()
.ConfigureResource(r => r.AddService("MyServiceName"))
.Build();
```

It is also possible to configure the `Resource` by using following
environmental variables:

| Environment variable | Description |
| -------------------------- | -------------------------------------------------- |
| `OTEL_RESOURCE_ATTRIBUTES` | Key-value pairs to be used as resource attributes. See the [Resource SDK specification](https://github.com/open-telemetry/opentelemetry-specification/blob/v1.5.0/specification/resource/sdk.md#specifying-resource-information-via-an-environment-variable) for more details. |
| `OTEL_SERVICE_NAME` | Sets the value of the `service.name` resource attribute. If `service.name` is also provided in `OTEL_RESOURCE_ATTRIBUTES`, then `OTEL_SERVICE_NAME` takes precedence. |
Loading