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
96554c82
Commit
96554c82
authored
Apr 10, 2019
by
彭伟
Committed by
Lemon
Apr 10, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Feature (#189)
* Add xml comment * fix: LocalSegment relationship error when use Task.WhenAll
parent
f67a8682
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
40 deletions
+21
-40
common.props
build/common.props
+5
-3
SegmentSpan.cs
src/SkyApm.Abstractions/Tracing/Segments/SegmentSpan.cs
+3
-3
LocalSegmentContextAccessor.cs
src/SkyApm.Core/Tracing/LocalSegmentContextAccessor.cs
+13
-34
No files found.
build/common.props
View file @
96554c82
<Project>
<Project>
<Import Project="sign.props" />
<Import Project="sign.props" />
<Import Project="version.props" />
<Import Project="version.props" />
<PropertyGroup>
<PropertyGroup>
...
@@ -16,5 +16,7 @@
...
@@ -16,5 +16,7 @@
<GenerateAssemblyProductAttribute>True</GenerateAssemblyProductAttribute>
<GenerateAssemblyProductAttribute>True</GenerateAssemblyProductAttribute>
<GeneratePackageOnBuild>False</GeneratePackageOnBuild>
<GeneratePackageOnBuild>False</GeneratePackageOnBuild>
<PackageRequireLicenseAcceptance>True</PackageRequireLicenseAcceptance>
<PackageRequireLicenseAcceptance>True</PackageRequireLicenseAcceptance>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<NoWarn>1591</NoWarn>
</PropertyGroup>
</PropertyGroup>
</Project>
</Project>
src/SkyApm.Abstractions/Tracing/Segments/SegmentSpan.cs
View file @
96554c82
/*
/*
* Licensed to the SkyAPM under one or more
* Licensed to the SkyAPM under one or more
* contributor license agreements. See the NOTICE file distributed with
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* this work for additional information regarding copyright ownership.
...
@@ -42,8 +42,8 @@ namespace SkyApm.Tracing.Segments
...
@@ -42,8 +42,8 @@ namespace SkyApm.Tracing.Segments
public
SpanLayer
SpanLayer
{
get
;
set
;
}
public
SpanLayer
SpanLayer
{
get
;
set
;
}
/// <summary>Limiting values. Please see <see cref="Components" /> or see <seealso href="https://github.com/apache/incubator-skywalking/blob/master/oap-server/server-starter/src/main/resources/component-libraries.yml"/></summary>
public
StringOrIntValue
Component
{
get
;
set
;
}
public
StringOrIntValue
Component
{
get
;
set
;
}
public
bool
IsError
{
get
;
set
;
}
public
bool
IsError
{
get
;
set
;
}
public
TagCollection
Tags
{
get
;
}
=
new
TagCollection
();
public
TagCollection
Tags
{
get
;
}
=
new
TagCollection
();
...
...
src/SkyApm.Core/Tracing/LocalSegmentContextAccessor.cs
View file @
96554c82
/*
/*
* Licensed to the SkyAPM under one or more
* Licensed to the SkyAPM under one or more
* contributor license agreements. See the NOTICE file distributed with
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* this work for additional information regarding copyright ownership.
...
@@ -16,53 +16,32 @@
...
@@ -16,53 +16,32 @@
*
*
*/
*/
using
System.Collections.Concurrent
;
using
System.Threading
;
using
SkyApm.Tracing.Segments
;
using
SkyApm.Tracing.Segments
;
using
System.Runtime.CompilerServices
;
using
System.Threading
;
namespace
SkyApm.Tracing
namespace
SkyApm.Tracing
{
{
public
class
LocalSegmentContextAccessor
:
ILocalSegmentContextAccessor
public
class
LocalSegmentContextAccessor
:
ILocalSegmentContextAccessor
{
{
private
readonly
AsyncLocal
<
ConcurrentStack
<
SegmentContext
>>
_segmentContextStack
=
private
readonly
ConditionalWeakTable
<
SegmentContext
,
SegmentContext
>
_parent
=
new
ConditionalWeakTable
<
SegmentContext
,
SegmentContext
>();
new
AsyncLocal
<
ConcurrentStack
<
SegmentContext
>
>();
private
readonly
AsyncLocal
<
SegmentContext
>
_segmentContext
=
new
AsyncLocal
<
SegmentContext
>();
public
SegmentContext
Context
public
SegmentContext
Context
{
{
get
get
=>
_segmentContext
.
Value
;
{
var
stack
=
_segmentContextStack
.
Value
;
if
(
stack
==
null
)
{
return
null
;
}
stack
.
TryPeek
(
out
var
context
);
return
context
;
}
set
set
{
{
var
stack
=
_segmentContextStack
.
Value
;
var
current
=
_segmentContext
.
Value
;
if
(
stack
==
null
)
{
if
(
value
==
null
)
return
;
stack
=
new
ConcurrentStack
<
SegmentContext
>();
stack
.
Push
(
value
);
_segmentContextStack
.
Value
=
stack
;
}
else
{
if
(
value
==
null
)
if
(
value
==
null
)
{
{
stack
.
TryPop
(
out
_
);
if
(
_parent
.
TryGetValue
(
current
,
out
var
parent
))
if
(
stack
.
IsEmpty
)
_segmentContext
.
Value
=
parent
;
{
_segmentContextStack
.
Value
=
null
;
}
}
}
else
else
{
{
stack
.
Push
(
value
);
_parent
.
Add
(
value
,
current
);
}
_segmentContext
.
Value
=
value
;
}
}
}
}
}
}
...
...
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