@weave-js/core 0.15.2 → 0.15.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/middlewares/tracing/tags.js +15 -24
- package/package.json +1 -1
|
@@ -24,9 +24,11 @@ function addPreHandleTagsFromDefinition (context, tags, globalTracingActionOptio
|
|
|
24
24
|
try {
|
|
25
25
|
acc[current] = dotGet(context.data, current);
|
|
26
26
|
} catch (error) {
|
|
27
|
+
const spanId = context.span ? context.span.id : undefined;
|
|
28
|
+
|
|
27
29
|
context.service.log.warn({
|
|
28
30
|
requestId: context.requestId,
|
|
29
|
-
spanId
|
|
31
|
+
spanId
|
|
30
32
|
}, `Unable to get value for tag "${current}" from data`);
|
|
31
33
|
acc[current] = undefined;
|
|
32
34
|
}
|
|
@@ -41,9 +43,11 @@ function addPreHandleTagsFromDefinition (context, tags, globalTracingActionOptio
|
|
|
41
43
|
try {
|
|
42
44
|
acc[current] = dotGet(context.meta, current);
|
|
43
45
|
} catch (error) {
|
|
46
|
+
const spanId = context.span ? context.span.id : undefined;
|
|
47
|
+
|
|
44
48
|
context.service.log.warn({
|
|
45
49
|
requestId: context.requestId,
|
|
46
|
-
spanId
|
|
50
|
+
spanId
|
|
47
51
|
}, `Unable to get value for tag "${current}" from metadata`);
|
|
48
52
|
acc[current] = undefined;
|
|
49
53
|
}
|
|
@@ -71,20 +75,12 @@ module.exports.buildActionTags = (context, globalTracingOptions, actionTracingOp
|
|
|
71
75
|
|
|
72
76
|
try {
|
|
73
77
|
addPreHandleTagsFromDefinition(context, tags, globalTracingOptions.actions, actionTracingOptions);
|
|
74
|
-
|
|
75
|
-
let globalTags;
|
|
76
|
-
// local action tags take precedence
|
|
77
|
-
if (isFunction(globalTracingOptions.actions.tags)) {
|
|
78
|
-
globalTags = globalTracingOptions.actions.tags.call(context.service, context);
|
|
79
|
-
} else if (isObject(globalTracingOptions.actions.tags)) {
|
|
80
|
-
globalTags = Object.assign({}, globalTracingOptions.actions.tags);
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
Object.assign(tags, globalTags);
|
|
84
78
|
} catch (error) {
|
|
79
|
+
const spanId = context.span ? context.span.id : undefined;
|
|
80
|
+
|
|
85
81
|
context.service.log.warn({
|
|
86
82
|
requestId: context.requestId,
|
|
87
|
-
spanId
|
|
83
|
+
spanId
|
|
88
84
|
}, `Error while building action tags: ${error.message}`);
|
|
89
85
|
}
|
|
90
86
|
|
|
@@ -108,19 +104,12 @@ module.exports.buildEventTags = (context, globalTracingOptions, eventTracingOpti
|
|
|
108
104
|
|
|
109
105
|
try {
|
|
110
106
|
addPreHandleTagsFromDefinition(context, tags, globalTracingOptions.events, eventTracingOptions);
|
|
111
|
-
|
|
112
|
-
let globalTags;
|
|
113
|
-
if (isFunction(globalTracingOptions.events.tags)) {
|
|
114
|
-
globalTags = globalTracingOptions.events.tags.call(context.service, context);
|
|
115
|
-
} else if (isObject(globalTracingOptions.events.tags)) {
|
|
116
|
-
globalTags = Object.assign({}, globalTracingOptions.events.tags);
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
Object.assign(tags, globalTags);
|
|
120
107
|
} catch (error) {
|
|
108
|
+
const spanId = context.span ? context.span.id : undefined;
|
|
109
|
+
|
|
121
110
|
context.service.log.warn({
|
|
122
111
|
requestId: context.requestId,
|
|
123
|
-
spanId
|
|
112
|
+
spanId
|
|
124
113
|
}, `Error while building event tags: ${error.message}`);
|
|
125
114
|
}
|
|
126
115
|
|
|
@@ -138,9 +127,11 @@ module.exports.addResponseTags = (context, tags, result, globalTracingActionOpti
|
|
|
138
127
|
try {
|
|
139
128
|
acc[current] = dotGet(result, current);
|
|
140
129
|
} catch (error) {
|
|
130
|
+
const spanId = context.span ? context.span.id : undefined;
|
|
131
|
+
|
|
141
132
|
context.service.log.warn({
|
|
142
133
|
requestId: context.requestId,
|
|
143
|
-
spanId
|
|
134
|
+
spanId
|
|
144
135
|
}, `Unable to get response tag "${current}" from result`);
|
|
145
136
|
acc[current] = undefined;
|
|
146
137
|
}
|