Improve docs structure (#983)

* improve docs structure

* revert line ending

* adopt .net5-preview-8

* remove unused using
This commit is contained in:
Reiley Yang 2020-08-03 16:46:48 -07:00 committed by GitHub
parent dfe5f91d1d
commit 90c5b3af11
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 202 additions and 35 deletions

View File

@ -20,9 +20,9 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "build", "build", "{7CB2F02E-03FA-4FFF-89A5-C51F107623FD}"
ProjectSection(SolutionItems) = preProject
build\Common.nonprod.props = build\Common.nonprod.props
build\Common.prod.props = build\Common.prod.props
build\Common.props = build\Common.props
build\Common.test.props = build\Common.test.props
build\debug.snk = build\debug.snk
build\docfx.cmd = build\docfx.cmd
build\opentelemetry-icon-color.png = build\opentelemetry-icon-color.png
@ -154,23 +154,44 @@ EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenTelemetry.Instrumentation.Grpc", "src\OpenTelemetry.Instrumentation.Grpc\OpenTelemetry.Instrumentation.Grpc.csproj", "{0246BFC4-8AAF-45E1-A127-DB43D6E345BB}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "docs", "docs", "{7C87CAF9-79D7-4C26-9FFB-F3F1FB6911F1}"
ProjectSection(SolutionItems) = preProject
docs\logs\building-your-own-exporter.md = docs\logs\building-your-own-exporter.md
docs\trace\building-your-own-exporter.md = docs\trace\building-your-own-exporter.md
docs\metrics\building-your-own-exporter.md = docs\metrics\building-your-own-exporter.md
docs\trace\building-your-own-instrumentation-library.md = docs\trace\building-your-own-instrumentation-library.md
docs\trace\building-your-own-sampler.md = docs\trace\building-your-own-sampler.md
docs\logs\getting-started.md = docs\logs\getting-started.md
docs\metrics\getting-started.md = docs\metrics\getting-started.md
docs\trace\getting-started.md = docs\trace\getting-started.md
docs\logs\logging-correlation.md = docs\logs\logging-correlation.md
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "examples", "examples", "{2C7DD1DA-C229-4D9E-9AF0-BCD5CD3E4948}"
ProjectSection(SolutionItems) = preProject
examples\Directory.Build.props = examples\Directory.Build.props
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "trace", "trace", "{5B7FB835-3FFF-4BC2-99C5-A5B5FAE3C818}"
ProjectSection(SolutionItems) = preProject
docs\trace\building-your-own-exporter.md = docs\trace\building-your-own-exporter.md
docs\trace\building-your-own-instrumentation-library.md = docs\trace\building-your-own-instrumentation-library.md
docs\trace\building-your-own-sampler.md = docs\trace\building-your-own-sampler.md
docs\trace\getting-started.md = docs\trace\getting-started.md
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "building-your-own-processor", "docs\trace\building-your-own-processor\building-your-own-processor.csproj", "{B1891B31-B021-4074-8E42-B4AC170CD208}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "getting-started", "docs\trace\getting-started\getting-started.csproj", "{BE60E3D5-DE30-4BAB-8E7A-63B21D0E80D7}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "metrics", "metrics", "{3277B1C0-BDFE-4460-9B0D-D9A661FB48DB}"
ProjectSection(SolutionItems) = preProject
docs\metrics\building-your-own-exporter.md = docs\metrics\building-your-own-exporter.md
docs\metrics\getting-started.md = docs\metrics\getting-started.md
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "logs", "logs", "{3862190B-E2C5-418E-AFDC-DB281FB5C705}"
ProjectSection(SolutionItems) = preProject
docs\logs\building-your-own-exporter.md = docs\logs\building-your-own-exporter.md
docs\logs\getting-started.md = docs\logs\getting-started.md
docs\logs\logging-correlation.md = docs\logs\logging-correlation.md
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "docs", "docs", "{CB401DF1-FF5C-4055-886E-1183E832B2D6}"
ProjectSection(SolutionItems) = preProject
docs\Directory.Build.props = docs\Directory.Build.props
docs\docfx.json = docs\docfx.json
docs\toc.yml = docs\toc.yml
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -321,6 +342,14 @@ Global
{0246BFC4-8AAF-45E1-A127-DB43D6E345BB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0246BFC4-8AAF-45E1-A127-DB43D6E345BB}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0246BFC4-8AAF-45E1-A127-DB43D6E345BB}.Release|Any CPU.Build.0 = Release|Any CPU
{B1891B31-B021-4074-8E42-B4AC170CD208}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B1891B31-B021-4074-8E42-B4AC170CD208}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B1891B31-B021-4074-8E42-B4AC170CD208}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B1891B31-B021-4074-8E42-B4AC170CD208}.Release|Any CPU.Build.0 = Release|Any CPU
{BE60E3D5-DE30-4BAB-8E7A-63B21D0E80D7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{BE60E3D5-DE30-4BAB-8E7A-63B21D0E80D7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BE60E3D5-DE30-4BAB-8E7A-63B21D0E80D7}.Release|Any CPU.ActiveCfg = Release|Any CPU
{BE60E3D5-DE30-4BAB-8E7A-63B21D0E80D7}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@ -337,6 +366,12 @@ Global
{0935622B-9377-4056-8343-AE6ECDC274CF} = {E359BB2B-9AEC-497D-B321-7DF2450C3B8E}
{DE9130A4-F30A-49D7-8834-41DE3021218B} = {0169B149-FB8B-46F4-9EF7-8A0E69F8FAAF}
{2C7DD1DA-C229-4D9E-9AF0-BCD5CD3E4948} = {7CB2F02E-03FA-4FFF-89A5-C51F107623FD}
{5B7FB835-3FFF-4BC2-99C5-A5B5FAE3C818} = {7C87CAF9-79D7-4C26-9FFB-F3F1FB6911F1}
{B1891B31-B021-4074-8E42-B4AC170CD208} = {5B7FB835-3FFF-4BC2-99C5-A5B5FAE3C818}
{BE60E3D5-DE30-4BAB-8E7A-63B21D0E80D7} = {5B7FB835-3FFF-4BC2-99C5-A5B5FAE3C818}
{3277B1C0-BDFE-4460-9B0D-D9A661FB48DB} = {7C87CAF9-79D7-4C26-9FFB-F3F1FB6911F1}
{3862190B-E2C5-418E-AFDC-DB281FB5C705} = {7C87CAF9-79D7-4C26-9FFB-F3F1FB6911F1}
{CB401DF1-FF5C-4055-886E-1183E832B2D6} = {7CB2F02E-03FA-4FFF-89A5-C51F107623FD}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {55639B5C-0770-4A22-AB56-859604650521}

View File

@ -2,6 +2,7 @@
<PropertyGroup>
<LangVersion>8.0</LangVersion>
<SignAssembly>true</SignAssembly>
<RepoRoot>$([System.IO.Directory]::GetParent($(MSBuildThisFileDirectory)).Parent.FullName)</RepoRoot>
<AssemblyOriginatorKeyFile>$(MSBuildThisFileDirectory)debug.snk</AssemblyOriginatorKeyFile>
<DefineConstants>$(DefineConstants);SIGNED</DefineConstants>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>

View File

@ -0,0 +1,17 @@
<Project>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildProjectDirectory), 'OpenTelemetry.sln'))\build\Common.nonprod.props" />
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
</PropertyGroup>
<PropertyGroup Label="Package versions used in this folder">
<!--
Please sort alphabetically.
Refer to https://docs.microsoft.com/en-us/nuget/concepts/package-versioning for semver syntax.
-->
<OpenTelemetryPkgVer>[0.4.0-beta.2,1.0)</OpenTelemetryPkgVer>
<OpenTelemetryExporterConsolePkgVer>[0.4.0-beta.2,1.0)</OpenTelemetryExporterConsolePkgVer>
</PropertyGroup>
</Project>

View File

@ -0,0 +1,3 @@
# Building your own Processor
Under construction.

View File

@ -0,0 +1,50 @@
// <copyright file="MyActivityProcessor.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 System;
using System.Diagnostics;
using System.Threading;
using System.Threading.Tasks;
using OpenTelemetry.Trace;
internal class MyActivityProcessor : ActivityProcessor
{
public MyActivityProcessor()
{
}
public override void OnStart(Activity activity)
{
Console.WriteLine($"{this.GetType()} OnStart");
}
public override void OnEnd(Activity activity)
{
Console.WriteLine($"{this.GetType()} OnEnd");
}
public override Task ForceFlushAsync(CancellationToken cancellationToken)
{
Console.WriteLine($"{this.GetType()} ForceFlushAsync");
return Task.CompletedTask;
}
public override Task ShutdownAsync(CancellationToken cancellationToken)
{
Console.WriteLine($"{this.GetType()} ShutdownAsync");
return Task.CompletedTask;
}
}

View File

@ -0,0 +1,41 @@
// <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 System.Diagnostics;
using OpenTelemetry;
using OpenTelemetry.Trace;
public class Program
{
private static readonly ActivitySource MyActivitySource = new ActivitySource(
"MyCompany.MyProduct.MyLibrary");
public static void Main()
{
using var otel = Sdk.CreateTracerProvider(b => b
.AddActivitySource("MyCompany.MyProduct.MyLibrary")
.AddProcessorPipeline(pipeline =>
{
pipeline.AddProcessor(current => new MyActivityProcessor());
}));
using (var activity = MyActivitySource.StartActivity("SayHello"))
{
activity?.SetTag("foo", 1);
activity?.SetTag("bar", "Hello, World!");
}
}
}

View File

@ -0,0 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">
<ItemGroup>
<!--
<PackageReference Include="OpenTelemetry" Version="$(OpenTelemetryPkgVer)" />
-->
<ProjectReference Include="$(RepoRoot)\src\OpenTelemetry\OpenTelemetry.csproj" />
</ItemGroup>
</Project>

View File

@ -32,20 +32,20 @@ using System.Diagnostics;
using OpenTelemetry;
using OpenTelemetry.Trace;
class Program
public class Program
{
static readonly ActivitySource activitySource = new ActivitySource(
private static readonly ActivitySource MyActivitySource = new ActivitySource(
"MyCompany.MyProduct.MyLibrary");
static void Main()
public static void Main()
{
using var otel = Sdk.CreateTracerProvider(b => b
.AddActivitySource("MyCompany.MyProduct.MyLibrary")
.UseConsoleExporter());
using (var activity = activitySource.StartActivity("SayHello"))
using (var activity = MyActivitySource.StartActivity("SayHello"))
{
activity?.SetTag("foo", "1");
activity?.SetTag("foo", 1);
activity?.SetTag("bar", "Hello, World!");
}
}

View File

@ -1,22 +1,38 @@
using System.Diagnostics;
// <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 System.Diagnostics;
using OpenTelemetry;
using OpenTelemetry.Trace;
class Program
public class Program
{
static readonly ActivitySource activitySource = new ActivitySource(
private static readonly ActivitySource MyActivitySource = new ActivitySource(
"MyCompany.MyProduct.MyLibrary");
static void Main()
public static void Main()
{
using var otel = Sdk.CreateTracerProvider(b => b
.AddActivitySource("MyCompany.MyProduct.MyLibrary")
.UseConsoleExporter());
using (var activity = activitySource.StartActivity("SayHello"))
using (var activity = MyActivitySource.StartActivity("SayHello"))
{
activity?.AddTag("foo", "1");
activity?.AddTag("bar", "Hello, World!");
activity?.SetTag("foo", 1);
activity?.SetTag("bar", "Hello, World!");
}
}
}

View File

@ -1,12 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="OpenTelemetry.Exporter.Console" Version="[0.4.0-beta, 1.0)" />
<!---
<PackageReference Include="OpenTelemetry.Exporter.Console" Version="$(OpenTelemetryExporterConsolePkgVer)" />
-->
<ProjectReference Include="$(RepoRoot)\src\OpenTelemetry.Exporter.Console\OpenTelemetry.Exporter.Console.csproj" />
</ItemGroup>
</Project>

View File

@ -1,3 +1,3 @@
<Project>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildProjectDirectory), 'OpenTelemetry.sln'))\build\Common.test.props" />
</Project>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildProjectDirectory), 'OpenTelemetry.sln'))\build\Common.nonprod.props" />
</Project>

View File

@ -1,3 +1,3 @@
<Project>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildProjectDirectory), 'OpenTelemetry.sln'))\build\Common.test.props" />
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildProjectDirectory), 'OpenTelemetry.sln'))\build\Common.nonprod.props" />
</Project>