Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
CAP
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
tsai
CAP
Commits
24c41c79
Commit
24c41c79
authored
Apr 21, 2018
by
Liuhaoyang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Provide support for HttpClient
parent
79d58e7d
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
86 additions
and
1 deletion
+86
-1
skywalking-csharp.sln
skywalking-csharp.sln
+7
-0
SkyWalking.AspNetCore.csproj
src/SkyWalking.AspNetCore/SkyWalking.AspNetCore.csproj
+1
-1
HttpClientDiagnosticListener.cs
...ng.Diagnostics.HttpClient/HttpClientDiagnosticListener.cs
+57
-0
SkyWalking.Diagnostics.HttpClient.csproj
...stics.HttpClient/SkyWalking.Diagnostics.HttpClient.csproj
+21
-0
No files found.
skywalking-csharp.sln
View file @
24c41c79
...
@@ -36,6 +36,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SkyWalking.Sample.Backend",
...
@@ -36,6 +36,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SkyWalking.Sample.Backend",
EndProject
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SkyWalking.Sample.Frontend", "sample\SkyWalking.Sample.Frontend\SkyWalking.Sample.Frontend.csproj", "{2B4E350E-A1E5-4B4A-A642-BCA6D3887E5A}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SkyWalking.Sample.Frontend", "sample\SkyWalking.Sample.Frontend\SkyWalking.Sample.Frontend.csproj", "{2B4E350E-A1E5-4B4A-A642-BCA6D3887E5A}"
EndProject
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SkyWalking.Diagnostics.HttpClient", "src\SkyWalking.Diagnostics.HttpClient\SkyWalking.Diagnostics.HttpClient.csproj", "{49DEFCA8-4289-4875-B6A5-35D84B3D2290}"
EndProject
Global
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|Any CPU = Debug|Any CPU
...
@@ -74,6 +76,10 @@ Global
...
@@ -74,6 +76,10 @@ Global
{2B4E350E-A1E5-4B4A-A642-BCA6D3887E5A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2B4E350E-A1E5-4B4A-A642-BCA6D3887E5A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2B4E350E-A1E5-4B4A-A642-BCA6D3887E5A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2B4E350E-A1E5-4B4A-A642-BCA6D3887E5A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2B4E350E-A1E5-4B4A-A642-BCA6D3887E5A}.Release|Any CPU.Build.0 = Release|Any CPU
{2B4E350E-A1E5-4B4A-A642-BCA6D3887E5A}.Release|Any CPU.Build.0 = Release|Any CPU
{49DEFCA8-4289-4875-B6A5-35D84B3D2290}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{49DEFCA8-4289-4875-B6A5-35D84B3D2290}.Debug|Any CPU.Build.0 = Debug|Any CPU
{49DEFCA8-4289-4875-B6A5-35D84B3D2290}.Release|Any CPU.ActiveCfg = Release|Any CPU
{49DEFCA8-4289-4875-B6A5-35D84B3D2290}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
HideSolutionNode = FALSE
...
@@ -89,6 +95,7 @@ Global
...
@@ -89,6 +95,7 @@ Global
{D75B68C5-6788-4871-A63F-F6EB48FB0DC5} = {79ED86A5-E9B9-49B2-9354-C911C079D03E}
{D75B68C5-6788-4871-A63F-F6EB48FB0DC5} = {79ED86A5-E9B9-49B2-9354-C911C079D03E}
{80A67B09-83F2-477F-907F-95FFF5B8FEAF} = {844CEACD-4C85-4B15-9E2B-892B01FDA4BB}
{80A67B09-83F2-477F-907F-95FFF5B8FEAF} = {844CEACD-4C85-4B15-9E2B-892B01FDA4BB}
{2B4E350E-A1E5-4B4A-A642-BCA6D3887E5A} = {844CEACD-4C85-4B15-9E2B-892B01FDA4BB}
{2B4E350E-A1E5-4B4A-A642-BCA6D3887E5A} = {844CEACD-4C85-4B15-9E2B-892B01FDA4BB}
{49DEFCA8-4289-4875-B6A5-35D84B3D2290} = {79ED86A5-E9B9-49B2-9354-C911C079D03E}
EndGlobalSection
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {94C0DA2C-CCCB-4314-93A2-9809B5DD0583}
SolutionGuid = {94C0DA2C-CCCB-4314-93A2-9809B5DD0583}
...
...
src/SkyWalking.AspNetCore/SkyWalking.AspNetCore.csproj
View file @
24c41c79
...
@@ -9,7 +9,7 @@
...
@@ -9,7 +9,7 @@
<PackageTags>SkyWalking;APM</PackageTags>
<PackageTags>SkyWalking;APM</PackageTags>
<PackageReleaseNotes>
<PackageReleaseNotes>
</PackageReleaseNotes>
</PackageReleaseNotes>
<RootNamespace>SkyWalking</RootNamespace>
<RootNamespace>SkyWalking
.AspNetCore
</RootNamespace>
</PropertyGroup>
</PropertyGroup>
<ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Hosting" Version="2.1.0-preview2-final" />
<PackageReference Include="Microsoft.AspNetCore.Hosting" Version="2.1.0-preview2-final" />
...
...
src/SkyWalking.Diagnostics.HttpClient/HttpClientDiagnosticListener.cs
0 → 100644
View file @
24c41c79
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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.
*
*/
using
System.Net.Http
;
using
Microsoft.Extensions.DiagnosticAdapter
;
using
SkyWalking.Context
;
using
SkyWalking.Context.Tag
;
using
SkyWalking.Context.Trace
;
using
SkyWalking.NetworkProtocol.Trace
;
namespace
SkyWalking.Diagnostics.HttpClient
{
public
class
HttpClientDiagnosticListener
:
ITracingDiagnosticListener
{
public
string
ListenerName
{
get
;
}
=
"HttpHandlerDiagnosticListener"
;
[
DiagnosticName
(
"System.Net.Http.Request"
)]
public
void
HttpRequest
(
HttpRequestMessage
request
)
{
var
contextCarrier
=
new
ContextCarrier
();
var
peer
=
$"
{
request
.
RequestUri
.
Host
}
:
{
request
.
RequestUri
.
Port
}
"
;
var
span
=
ContextManager
.
CreateExitSpan
(
request
.
RequestUri
.
ToString
(),
contextCarrier
,
peer
);
Tags
.
Url
.
Set
(
span
,
request
.
RequestUri
.
ToString
());
span
.
AsHttp
();
span
.
SetComponent
(
ComponentsDefine
.
HttpClient
);
Tags
.
HTTP
.
Method
.
Set
(
span
,
request
.
Method
.
ToString
());
foreach
(
var
item
in
contextCarrier
.
Items
)
request
.
Headers
.
Add
(
item
.
HeadKey
,
item
.
HeadValue
);
}
[
DiagnosticName
(
"System.Net.Http.Response"
)]
public
void
HttpResponse
(
HttpResponseMessage
response
)
{
var
span
=
ContextManager
.
ActiveSpan
;
if
(
span
!=
null
&&
span
.
IsExit
)
{
Tags
.
StatusCode
.
Set
(
span
,
response
.
StatusCode
.
ToString
());
ContextManager
.
StopSpan
(
span
);
}
}
}
}
\ No newline at end of file
src/SkyWalking.Diagnostics.HttpClient/SkyWalking.Diagnostics.HttpClient.csproj
0 → 100644
View file @
24c41c79
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\..\build\common.props" />
<PropertyGroup>
<Description>SkyWalking.Diagnostics.HttpClient notifies outgoing Http requests.</Description>
<AssemblyTitle>SkyWalking.Diagnostics.HttpClient</AssemblyTitle>
<TargetFramework>netstandard2.0</TargetFramework>
<AssemblyName>SkyWalking.Diagnostics.HttpClient</AssemblyName>
<PackageId>SkyWalking.Diagnostics.HttpClient</PackageId>
<PackageTags>SkyWalking;APM;Diagnostics;HttpClient</PackageTags>
<PackageReleaseNotes>
</PackageReleaseNotes>
<RootNamespace>SkyWalking.Diagnostics.HttpClient</RootNamespace>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.DiagnosticAdapter" Version="2.1.0-preview2-final" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\SkyWalking.Abstractions\SkyWalking.Abstractions.csproj" />
<ProjectReference Include="..\SkyWalking.Core\SkyWalking.Core.csproj" />
</ItemGroup>
</Project>
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment