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

feat: publish OpenTelemetry support to NuGet listed latest version. #422

Merged
merged 22 commits into from
Jun 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
156adfe
chore: bump to OpenTelemetry 1.0.0-rc1.1
guitarrapc Apr 6, 2021
4c03557
chore: experimental pacakge ci build
guitarrapc Jun 1, 2021
28276cd
feat: bump OpenTelemetry & penTelemetry.Extensions.Hosting packages
guitarrapc Jun 1, 2021
07be8d4
feat: remove OpenTelemetry Metrics implementations
guitarrapc Jun 1, 2021
f215254
fix: adapt to new AddOpenTelemetryTracing API
guitarrapc Jun 1, 2021
8fc6c69
feat: move grpc trace key to rpc.grpc. as official do
guitarrapc Jun 1, 2021
a8c0e15
feat: update ChatApp.Telemetry to use latest OpenTelemetry impl.
guitarrapc Jun 1, 2021
07409ea
refactor: simple exception converter
guitarrapc Jun 1, 2021
0721ada
feat: change ActivityName from AppName to PackageName. Support app tags.
guitarrapc Jun 1, 2021
ffeac47
feat: add MagicOnionOpenTelemetryClientFilter
guitarrapc Jun 2, 2021
d8d7bc5
feat: put IRpsScope to ServiceContext Items
guitarrapc Jun 2, 2021
be49b59
feat: add option to handle expose IRpsScope in ServiceContext.Items
guitarrapc Jun 2, 2021
3ed1ee3
chore: change suffix version to match 1.0.0-rc4
guitarrapc Jun 2, 2021
5fee3fd
chore: ChatApp.Telemetry docker refresh
guitarrapc Jun 2, 2021
6ea96a1
feat: null check
guitarrapc Jun 2, 2021
719e664
chore: add memo for known issue
guitarrapc Jun 2, 2021
a77970e
feat: split OpenTelemetry and MagicOnion Instrumentation
guitarrapc Jun 7, 2021
e741005
fix: work on linux
guitarrapc Jun 7, 2021
3d26daa
feat: remove OpenTelemetry.Extensions.Hosting reference
guitarrapc Jun 7, 2021
555b6ca
refactor: Sample App for basic usage
guitarrapc Jun 7, 2021
97d99f9
feat: bump Suffix to 1.1.0-beta2
guitarrapc Jun 7, 2021
7c81522
refactor: back to AddOpenTelemetry
guitarrapc Jun 7, 2021
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
18 changes: 17 additions & 1 deletion .github/workflows/build-canary.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,24 @@ jobs:
name: moc.${{ env.MAGICONION_VERSION }}.zip
path: ./moc.${{ env.MAGICONION_VERSION }}.zip

canary-build-experimental:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v2
- run: echo "MAGICONION_VERSION=ci-$(date '+%Y%m%d-%H%M%S')+${GITHUB_SHA:0:6}" >> $GITHUB_ENV
- run: echo "MAGICONION_VERSION=${MAGICONION_VERSION}"
# build
- run: dotnet build ./src/MagicOnion.Server.OpenTelemetry/ -c Release -p:VersionSuffix=${MAGICONION_VERSION}
# test
- run: dotnet pack ./src/MagicOnion.Server.OpenTelemetry/MagicOnion.Server.OpenTelemetry.csproj -c Release --include-symbols --include-source --no-build -p:VersionSuffix=${MAGICONION_VERSION} -o ./publish
- uses: actions/upload-artifact@v1
with:
name: nuget-experimental
path: ./publish/

canary-push:
needs: [canary-build]
needs: [canary-build, canary-build-experimental]
runs-on: ubuntu-latest
timeout-minutes: 5
env:
Expand Down
11 changes: 11 additions & 0 deletions .github/workflows/build-debug.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,17 @@ jobs:
- run: dotnet test ./tests/MagicOnion.Server.Tests/ -c Debug
- run: dotnet test ./tests/MagicOnion.Generator.Tests/ -c Debug

build-dotnet-experimental:
runs-on: ubuntu-latest
env:
DOTNET_CLI_TELEMETRY_OPTOUT: 1
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1
NUGET_XMLDOC_MODE: skip
timeout-minutes: 10
steps:
- uses: actions/checkout@v2
- run: dotnet build ./src/MagicOnion.Server.OpenTelemetry/ -c Debug

build-unity:
if: "((github.event_name == 'push' && github.repository_owner == 'Cysharp') || startsWith(github.event.pull_request.head.label, 'Cysharp:'))"
strategy:
Expand Down
21 changes: 20 additions & 1 deletion .github/workflows/build-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,23 @@ jobs:
name: moc.${{ env.GIT_TAG }}.zip
path: ./moc.${{ env.GIT_TAG }}.zip

build-dotnet-experimental:
needs: [update-packagejson]
runs-on: ubuntu-latest
timeout-minutes: 10
env:
DOTNET_CLI_TELEMETRY_OPTOUT: 1
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1
NUGET_XMLDOC_MODE: skip
steps:
- run: echo ${{ needs.update-packagejson.outputs.sha }}
- run: dotnet build ./src/MagicOnion.Server.OpenTelemetry/ -c Release
- run: dotnet pack ./src/MagicOnion.Server.OpenTelemetry/MagicOnion.Server.OpenTelemetry.csproj -c Release --no-build -o ./publish
- uses: actions/upload-artifact@v1
with:
name: nuget-experimental
path: ./publish/

build-unity:
needs: [update-packagejson]
strategy:
Expand Down Expand Up @@ -171,7 +188,8 @@ jobs:

create-release:
if: github.event.inputs.dry_run == 'false'
needs: [update-packagejson, build-dotnet, build-unity]
needs:
[update-packagejson, build-dotnet, build-dotnet-experimental, build-unity]
runs-on: ubuntu-latest
env:
DOTNET_CLI_TELEMETRY_OPTOUT: 1
Expand All @@ -192,6 +210,7 @@ jobs:
- uses: actions/download-artifact@v2-preview
# Upload to NuGet
- run: dotnet nuget push "./nuget/*.nupkg" --skip-duplicate -s https://www.nuget.org/api/v2/package -k ${{ secrets.NUGET_KEY }}
- run: dotnet nuget push "./nuget-experimental/*.nupkg" --skip-duplicate -s https://www.nuget.org/api/v2/package -k ${{ secrets.NUGET_KEY }}
# Upload to Releases(generator)
- uses: actions/upload-release-asset@v1
env:
Expand Down
21 changes: 21 additions & 0 deletions MagicOnion.Experimental.sln
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MagicOnion.Server", "src\Ma
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MagicOnion.Abstractions", "src\MagicOnion.Abstractions\MagicOnion.Abstractions.csproj", "{32101781-544B-44AB-8131-31909B438DC9}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MicroServer", "samples\ChatApp.Telemetry\MicroServer\MicroServer.csproj", "{2A6D2D7C-82BE-4CB2-B8C3-2D65BEAAF957}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MagicOnion.Client", "src\MagicOnion.Client\MagicOnion.Client.csproj", "{8CDFC77C-7E42-4D42-8168-5E799EC7AB21}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MicroServer.Shared", "samples\ChatApp.Telemetry\MicroServer.Shared\MicroServer.Shared.csproj", "{B29DEE64-4D65-4CDB-A83E-1C231165BE1E}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -63,6 +69,18 @@ Global
{32101781-544B-44AB-8131-31909B438DC9}.Debug|Any CPU.Build.0 = Debug|Any CPU
{32101781-544B-44AB-8131-31909B438DC9}.Release|Any CPU.ActiveCfg = Release|Any CPU
{32101781-544B-44AB-8131-31909B438DC9}.Release|Any CPU.Build.0 = Release|Any CPU
{2A6D2D7C-82BE-4CB2-B8C3-2D65BEAAF957}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2A6D2D7C-82BE-4CB2-B8C3-2D65BEAAF957}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2A6D2D7C-82BE-4CB2-B8C3-2D65BEAAF957}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2A6D2D7C-82BE-4CB2-B8C3-2D65BEAAF957}.Release|Any CPU.Build.0 = Release|Any CPU
{8CDFC77C-7E42-4D42-8168-5E799EC7AB21}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8CDFC77C-7E42-4D42-8168-5E799EC7AB21}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8CDFC77C-7E42-4D42-8168-5E799EC7AB21}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8CDFC77C-7E42-4D42-8168-5E799EC7AB21}.Release|Any CPU.Build.0 = Release|Any CPU
{B29DEE64-4D65-4CDB-A83E-1C231165BE1E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B29DEE64-4D65-4CDB-A83E-1C231165BE1E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B29DEE64-4D65-4CDB-A83E-1C231165BE1E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B29DEE64-4D65-4CDB-A83E-1C231165BE1E}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -74,6 +92,9 @@ Global
{BD3A9267-EE7C-4D3A-B877-1772DCAD7358} = {1987061F-8970-4018-8D58-6932961C9EB4}
{E6A78679-C7E1-4507-A727-8CD2C0B2C5CB} = {546FFD98-9FA5-48CA-8847-16AF82C3DED0}
{32101781-544B-44AB-8131-31909B438DC9} = {546FFD98-9FA5-48CA-8847-16AF82C3DED0}
{2A6D2D7C-82BE-4CB2-B8C3-2D65BEAAF957} = {134A64BF-3792-44EC-BD32-DD076A6B5643}
{8CDFC77C-7E42-4D42-8168-5E799EC7AB21} = {546FFD98-9FA5-48CA-8847-16AF82C3DED0}
{B29DEE64-4D65-4CDB-A83E-1C231165BE1E} = {134A64BF-3792-44EC-BD32-DD076A6B5643}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {D5B2E7E3-B727-40A1-BE68-7BAC9B9DE2FE}
Expand Down
62 changes: 62 additions & 0 deletions MagicOnion.Experimental.sln.startup.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
/*
This is a configuration file for the SwitchStartupProject Visual Studio Extension
See https://heptapod.host/thirteen/switchstartupproject/blob/branch/current/Configuration.md
*/
{
/* Configuration File Version */
"Version": 3,

/* Create an item in the dropdown list for each project in the solution? */
"ListAllProjects": true,

/*
Dictionary of named configurations with one or multiple startup projects
and optional parameters like command line arguments and working directory.
Example:

"MultiProjectConfigurations": {
"A + B (Ext)": {
"Projects": {
"MyProjectA": {},
"MyProjectB": {
"CommandLineArguments": "1234",
"WorkingDirectory": "%USERPROFILE%\\test",
"StartExternalProgram": "c:\\myprogram.exe"
}
}
},
"A + B": {
"Projects": {
"MyProjectA": {},
"MyProjectB": {
"CommandLineArguments": "",
"WorkingDirectory": "",
"StartProject": true
}
}
},
"D (Debug x86)": {
"Projects": {
"MyProjectD": {}
},
"SolutionConfiguration": "Debug",
"SolutionPlatform": "x86",
},
"D (Release x64)": {
"Projects": {
"MyProjectD": {}
},
"SolutionConfiguration": "Release",
"SolutionPlatform": "x64",
}
}
*/
"MultiProjectConfigurations": {
"ChatApp.Server + MicroServer": {
"Projects": {
"ChatApp.Server": {},
"MicroServer": {}
}
}
}
}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1580,7 +1580,7 @@ I believe that this can be easily and effectively applied to sending a large num

## Experimentals
### OpenTelemetry
MagicOnion.OpenTelemetry is implementation of [open\-telemetry/opentelemetry\-dotnet: OpenTelemetry \.NET SDK](https://github.com/open-telemetry/opentelemetry-dotnet), so you can use any OpenTelemetry exporter, like [Prometheus](https://prometheus.io/), [StackDriver](https://cloud.google.com/stackdriver/pricing), [Zipkin](https://zipkin.io/) and others.
MagicOnion.OpenTelemetry is implementation of [open\-telemetry/opentelemetry\-dotnet: OpenTelemetry \.NET SDK](https://github.com/open-telemetry/opentelemetry-dotnet), so you can use any OpenTelemetry exporter, like [Jaeger](https://www.jaegertracing.io/), [Zipkin](https://zipkin.io/), [StackDriver](https://cloud.google.com/stackdriver) and others.

See details at [MagicOnion.Server.OpenTelemetry](src/MagicOnion.Server.OpenTelemetry)

Expand Down
27 changes: 5 additions & 22 deletions samples/ChatApp.Telemetry/ChatApp.Server/BackendActivitySources.cs
Original file line number Diff line number Diff line change
@@ -1,30 +1,13 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;

namespace ChatApp.Server
{
public class BackendActivitySources
public static class BackendActivitySources
{
private readonly Dictionary<string, ActivitySource> activitySourceCache;
public static readonly string[] ExtraActivitySourceNames = new[] { "Chatapp.Server.S2S", "MySQL", "Redis" };

public BackendActivitySources(ActivitySource[] activitySources)
{
if (activitySources == null)
throw new ArgumentNullException(nameof(activitySources));

activitySourceCache = new Dictionary<string, ActivitySource>();
foreach (var activitySource in activitySources)
{
activitySourceCache.TryAdd(activitySource.Name, activitySource);
}
}

public ActivitySource Get(string name)
{
return activitySourceCache.TryGetValue(name, out var activitySource)
? activitySource
: null;
}
public static readonly ActivitySource S2sActivitySource = new ActivitySource("Chatapp.Server.S2S");
public static readonly ActivitySource MySQLActivitySource = new ActivitySource("MySQL");
public static readonly ActivitySource RedisActivitySource = new ActivitySource("Redis");
}
}
11 changes: 6 additions & 5 deletions samples/ChatApp.Telemetry/ChatApp.Server/ChatApp.Server.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,18 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="OpenTelemetry.Exporter.Console" Version="1.0.0-rc1.1" />
<PackageReference Include="OpenTelemetry.Exporter.Jaeger" Version="1.0.0-rc1.1" />
<PackageReference Include="OpenTelemetry.Exporter.Prometheus" Version="1.0.0-rc1.1" />
<PackageReference Include="OpenTelemetry.Exporter.Zipkin" Version="1.0.0-rc1.1" />
<PackageReference Include="OpenTelemetry.Instrumentation.AspNetCore" Version="1.0.0-rc1.1" />
<PackageReference Include="OpenTelemetry.Exporter.Console" Version="1.1.0-beta2" />
<PackageReference Include="OpenTelemetry.Exporter.Jaeger" Version="1.1.0-beta2" />
<PackageReference Include="OpenTelemetry.Exporter.Zipkin" Version="1.1.0-beta2" />
<PackageReference Include="OpenTelemetry.Extensions.Hosting" Version="1.0.0-rc4" />
<PackageReference Include="OpenTelemetry.Instrumentation.AspNetCore" Version="1.0.0-rc4" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\..\src\MagicOnion.Server\MagicOnion.Server.csproj" />
<ProjectReference Include="..\..\..\src\MagicOnion.Server.OpenTelemetry\MagicOnion.Server.OpenTelemetry.csproj" />
<ProjectReference Include="..\ChatApp.Shared\ChatApp.Shared.csproj" />
<ProjectReference Include="..\MicroServer.Shared\MicroServer.Shared.csproj" />
</ItemGroup>

<!-- FOR SSL/TLS SUPPORT -->
Expand Down
Loading