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
88f766a6
Commit
88f766a6
authored
Apr 14, 2018
by
Liuhaoyang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update ContextManager
parent
b4484e5d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
72 additions
and
3 deletions
+72
-3
ContextManager.cs
src/SkyWalking.Core/Context/ContextManager.cs
+69
-3
IgnoredTracerContext.cs
src/SkyWalking.Core/Context/IgnoredTracerContext.cs
+3
-0
No files found.
src/SkyWalking.Core/Context/ContextManager.cs
View file @
88f766a6
...
...
@@ -98,11 +98,77 @@ namespace SkyWalking.Context
public
static
ISpan
CreateEntrySpan
(
string
operationName
,
IContextCarrier
carrier
)
{
//todo samplingService
return
null
;
var
samplingService
=
ServiceManager
.
Instance
.
GetService
<
SamplingService
>();
if
(
carrier
!=
null
&&
carrier
.
IsValid
)
{
samplingService
.
ForceSampled
();
var
context
=
GetOrCreateContext
(
operationName
,
true
);
var
span
=
context
.
CreateEntrySpan
(
operationName
);
context
.
Extract
(
carrier
);
return
span
;
}
else
{
var
context
=
GetOrCreateContext
(
operationName
,
false
);
return
context
.
CreateEntrySpan
(
operationName
);
}
}
public
static
ISpan
CreateLocalSpan
(
string
operationName
)
{
var
context
=
GetOrCreateContext
(
operationName
,
false
);
return
context
.
CreateLocalSpan
(
operationName
);
}
public
static
ISpan
CreateExitSpan
(
string
operationName
,
IContextCarrier
carrier
,
string
remotePeer
)
{
var
context
=
GetOrCreateContext
(
operationName
,
false
);
var
span
=
context
.
CreateExitSpan
(
operationName
,
remotePeer
);
context
.
Inject
(
carrier
);
return
span
;
}
public
static
ISpan
CreateExitSpan
(
string
operationName
,
string
remotePeer
)
{
var
context
=
GetOrCreateContext
(
operationName
,
false
);
var
span
=
context
.
CreateExitSpan
(
operationName
,
remotePeer
);
return
span
;
}
public
static
void
Inject
(
IContextCarrier
carrier
)
{
Context
?.
Inject
(
carrier
);
}
public
static
void
Extract
(
IContextCarrier
carrier
)
{
Context
?.
Extract
(
carrier
);
}
public
static
void
Continued
(
IContextSnapshot
snapshot
)
{
if
(
snapshot
.
IsValid
&&
!
snapshot
.
IsFromCurrent
)
{
Context
?.
Continued
(
snapshot
);
}
}
public
static
void
StopSpan
()
{
StopSpan
(
ActiveSpan
);
}
public
static
ISpan
ActiveSpan
{
get
{
return
Context
?.
ActiveSpan
;
}
}
public
static
void
StopSpan
(
ISpan
span
)
{
Context
?.
StopSpan
(
span
);
}
public
void
AfterFinished
(
ITraceSegment
traceSegment
)
{
_context
.
Value
=
null
;
...
...
src/SkyWalking.Core/Context/IgnoredTracerContext.cs
View file @
88f766a6
...
...
@@ -72,6 +72,9 @@ namespace SkyWalking.Context
public
void
StopSpan
(
ISpan
span
)
{
_stackDepth
--;
if
(
_stackDepth
==
0
)
{
ListenerManager
.
NotifyFinish
(
this
);
}
}
public
static
class
ListenerManager
...
...
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