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
9e072620
Commit
9e072620
authored
Apr 01, 2018
by
Liuhaoyang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor
parent
6fcdeb8f
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
135 additions
and
10 deletions
+135
-10
LogDataEntity.cs
src/SkyWalking.Abstractions/Context/Trace/LogDataEntity.cs
+7
-9
ExceptionExtensions.cs
...Walking.Abstractions/Context/Utils/ExceptionExtensions.cs
+56
-0
KeyValuePair.cs
src/SkyWalking.Abstractions/Context/Utils/KeyValuePair.cs
+46
-0
SpanLayerExtensions.cs
...Walking.Abstractions/Context/Utils/SpanLayerExtensions.cs
+0
-0
ContextCarrier.cs
src/SkyWalking.Core/Context/ContextCarrier.cs
+19
-1
TracingContext.cs
src/SkyWalking.Core/Context/TracingContext.cs
+7
-0
No files found.
src/SkyWalking.Abstractions/Context/Trace/LogDataEntity.cs
View file @
9e072620
...
@@ -27,18 +27,15 @@ namespace SkyWalking.Context.Trace
...
@@ -27,18 +27,15 @@ namespace SkyWalking.Context.Trace
private
long
_timestamp
=
0
;
private
long
_timestamp
=
0
;
private
Dictionary
<
string
,
string
>
_logs
;
private
Dictionary
<
string
,
string
>
_logs
;
private
LogDataEntity
(
long
timestamp
,
Dictionary
<
string
,
string
>
logs
)
private
LogDataEntity
(
long
timestamp
,
Dictionary
<
string
,
string
>
logs
)
{
{
_timestamp
=
timestamp
;
_timestamp
=
timestamp
;
_logs
=
logs
;
_logs
=
logs
;
}
}
public
IReadOnlyDictionary
<
string
,
string
>
Logs
public
IReadOnlyDictionary
<
string
,
string
>
Logs
{
{
get
get
{
return
new
ReadOnlyDictionary
<
string
,
string
>(
_logs
);
}
{
return
new
ReadOnlyDictionary
<
string
,
string
>(
_logs
);
}
}
}
public
class
Builder
public
class
Builder
...
@@ -57,7 +54,7 @@ namespace SkyWalking.Context.Trace
...
@@ -57,7 +54,7 @@ namespace SkyWalking.Context.Trace
return
this
;
return
this
;
}
}
public
Builder
Add
(
string
key
,
string
value
)
public
Builder
Add
(
string
key
,
string
value
)
{
{
_logs
.
Add
(
key
,
value
);
_logs
.
Add
(
key
,
value
);
return
this
;
return
this
;
...
@@ -73,10 +70,11 @@ namespace SkyWalking.Context.Trace
...
@@ -73,10 +70,11 @@ namespace SkyWalking.Context.Trace
{
{
LogMessage
logMessage
=
new
LogMessage
();
LogMessage
logMessage
=
new
LogMessage
();
logMessage
.
Time
=
_timestamp
;
logMessage
.
Time
=
_timestamp
;
foreach
(
var
log
in
_logs
)
foreach
(
var
log
in
_logs
)
{
{
logMessage
.
Data
.
Add
(
new
KeyWithStringValue
{
Key
=
log
.
Key
,
Value
=
log
.
Value
});
logMessage
.
Data
.
Add
(
new
KeyWithStringValue
{
Key
=
log
.
Key
,
Value
=
log
.
Value
});
}
}
return
logMessage
;
return
logMessage
;
}
}
}
}
...
...
src/SkyWalking.Abstractions/Context/Utils/ExceptionExtensions.cs
0 → 100644
View file @
9e072620
/*
* 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
;
using
System.ComponentModel
;
using
System.Diagnostics
;
using
System.Text
;
namespace
SkyWalking.Context
{
public
static
class
ExceptionExtensions
{
public
static
string
ConvertToString
(
Exception
exception
,
int
maxLength
)
{
var
message
=
new
StringBuilder
();
while
(
exception
!=
null
)
{
message
.
Append
(
exception
.
Message
);
PrintStackFrame
(
message
,
exception
.
StackTrace
,
maxLength
,
out
var
overMaxLength
);
if
(
overMaxLength
)
{
break
;
}
exception
=
exception
.
InnerException
;
}
return
message
.
ToString
();
}
private
static
void
PrintStackFrame
(
StringBuilder
message
,
string
stackTrace
,
int
maxLength
,
out
bool
overMaxLength
)
{
message
.
AppendLine
(
stackTrace
);
overMaxLength
=
message
.
Length
>
maxLength
;
}
}
}
src/SkyWalking.Abstractions/Context/Utils/KeyValuePair.cs
0 → 100644
View file @
9e072620
/*
* 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
SkyWalking.NetworkProtocol
;
namespace
SkyWalking.Context
{
public
class
KeyValuePair
{
public
string
Key
{
get
;
}
public
string
Value
{
get
;
}
public
KeyValuePair
(
string
key
,
string
value
)
{
Key
=
key
;
Value
=
value
;
}
public
KeyWithStringValue
Transform
()
{
var
keyWithStringValue
=
new
KeyWithStringValue
{
Key
=
Key
,
Value
=
Value
};
return
keyWithStringValue
;
}
}
}
src/SkyWalking.Abstractions/Context/
Trace
/SpanLayerExtensions.cs
→
src/SkyWalking.Abstractions/Context/
Utils
/SpanLayerExtensions.cs
View file @
9e072620
File moved
src/SkyWalking.Core/Context/ContextCarrier.cs
View file @
9e072620
using
System.Collections.Generic
;
/*
* 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.Collections.Generic
;
using
System.Linq
;
using
System.Linq
;
using
SkyWalking.Context.Ids
;
using
SkyWalking.Context.Ids
;
using
SkyWalking.Dictionarys
;
using
SkyWalking.Dictionarys
;
...
...
src/SkyWalking.Core/Context/TracingContext.cs
0 → 100644
View file @
9e072620
namespace
SkyWalking.Context
{
public
class
TracingContext
{
}
}
\ 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