You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by qi...@apache.org on 2021/01/07 13:35:01 UTC
[skywalking-client-js] branch master updated: feat: add tags for
spans (#34)
This is an automated email from the ASF dual-hosted git repository.
qiuxiafan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/skywalking-client-js.git
The following commit(s) were added to refs/heads/master by this push:
new 9798ff9 feat: add tags for spans (#34)
9798ff9 is described below
commit 9798ff9e38534adaeb6078c04695e6ab81a9b974
Author: Qiuxia Fan <fi...@outlook.com>
AuthorDate: Thu Jan 7 21:34:52 2021 +0800
feat: add tags for spans (#34)
* feat: add tags for spans
* feat: add detailMode
---
README.md | 1 +
src/monitor.ts | 1 +
src/trace/segment.ts | 12 ++++++++++++
src/types.d.ts | 5 +++--
4 files changed, 17 insertions(+), 2 deletions(-)
diff --git a/README.md b/README.md
index 2c8eb52..cd55aa9 100644
--- a/README.md
+++ b/README.md
@@ -53,6 +53,7 @@ The register method supports the following parameters.
|autoTracePerf|Boolean|Support sending of performance data automatically.|false|true|
|vue|Boolean|Support vue errors monitoring|false|true|
|traceSDKInternal|Boolean|Support tracing SDK internal RPC.|false|false|
+|detailMode|Boolean|Support tracing http method and url as tags in spans.|false|true|
## Collect Metrics Manually
Use the `setPerformance` method to report metrics at the moment of page loaded or any other moment meaningful.
diff --git a/src/monitor.ts b/src/monitor.ts
index 7c63a4d..560d069 100644
--- a/src/monitor.ts
+++ b/src/monitor.ts
@@ -30,6 +30,7 @@ const ClientMonitor = {
useFmp: false, // use first meaningful paint
enableSPA: false,
traceSDKInternal: false,
+ detailMode: true,
} as CustomOptionsType,
register(configs: CustomOptionsType) {
diff --git a/src/trace/segment.ts b/src/trace/segment.ts
index fbbd564..2787d3c 100644
--- a/src/trace/segment.ts
+++ b/src/trace/segment.ts
@@ -95,6 +95,18 @@ export default function traceSegment(options: CustomOptionsType) {
parentSpanId: segment.spans.length - 1,
componentId: ComponentId,
peer: url.host,
+ tags: options.detailMode
+ ? [
+ {
+ key: 'http.method',
+ value: config[0],
+ },
+ {
+ key: 'url',
+ value: segCollector[i].event.responseURL,
+ },
+ ]
+ : undefined,
};
segment = {
...segment,
diff --git a/src/types.d.ts b/src/types.d.ts
index 7a21889..58f39bb 100644
--- a/src/types.d.ts
+++ b/src/types.d.ts
@@ -16,7 +16,7 @@
*/
export interface CustomOptionsType {
- collector: string;
+ collector?: string;
service: string;
pagePath: string;
serviceVersion: string;
@@ -27,5 +27,6 @@ export interface CustomOptionsType {
useFmp?: boolean;
enableSPA?: boolean;
vue?: any;
- traceSDKInternal: boolean;
+ traceSDKInternal?: boolean;
+ detailMode?: boolean;
}