Skip to content

Commit b393729

Browse files
committed
test(otel): update root span logs validation
1 parent 7da790f commit b393729

17 files changed

+67
-11
lines changed

packages/otel/src/imports.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// import * as grpc from '@midwayjs/grpc'
1+
import * as grpc from '@midwayjs/grpc'
22
import * as info from '@midwayjs/info'
33
import * as koa from '@midwayjs/koa'
44
import * as swagger from '@midwayjs/swagger'
@@ -17,7 +17,7 @@ if (CI) {
1717
useComponents.push(koa)
1818
useComponents.push(info)
1919
useComponents.push(swagger)
20-
// useComponents.push(grpc)
20+
useComponents.push(grpc)
2121
}
2222

2323
useComponents.push(share)

packages/otel/test/decorator/11.traceid.test.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { SEMATTRS_HTTP_ROUTE, SEMATTRS_HTTP_TARGET } from '@opentelemetry/semant
44
import { fileShortPath } from '@waiting/shared-core'
55

66
import {
7+
AttrNames,
78
assertRootSpan,
89
assertsSpan,
910
retrieveTraceInfoFromRemote, sortSpans,
@@ -14,7 +15,7 @@ import { testConfig } from '#@/root.config.js'
1415

1516

1617
describe(fileShortPath(import.meta.url), function () {
17-
this.retries(3)
18+
this.retries(2)
1819

1920
const path = `${apiBase.TraceDecorator}/${apiMethod.id}`
2021

@@ -50,6 +51,14 @@ describe(fileShortPath(import.meta.url), function () {
5051
[SEMATTRS_HTTP_TARGET]: path,
5152
[SEMATTRS_HTTP_ROUTE]: path,
5253
},
54+
mergeDefaultLogs: false,
55+
logs: [
56+
{ event: AttrNames.RequestBegin },
57+
{ event: AttrNames.PreProcessFinish },
58+
{ event: AttrNames.PostProcessBegin },
59+
{ event: AttrNames.Outgoing_Response_data, [AttrNames.Http_Response_Code]: 200 },
60+
{ event: AttrNames.RequestEnd },
61+
],
5362
})
5463

5564
const opt1: AssertsOptions = {

packages/otel/test/decorator/110.docorator-data.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ describe(fileShortPath(import.meta.url), function () {
6262
},
6363
logs: [
6464
{},
65-
{},
65+
false,
6666
{},
6767
{ event: 'default', rootAttrs: 'rootAttrs' },
6868
false,
@@ -139,7 +139,7 @@ describe(fileShortPath(import.meta.url), function () {
139139
},
140140
logs: [
141141
{},
142-
{},
142+
false,
143143
{},
144144
{ event: 'default', rootAttrs: 'rootAttrs' },
145145
false,

packages/otel/test/decorator/111.docorator-scope.test.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,14 @@ describe(fileShortPath(import.meta.url), function () {
5252
[SEMATTRS_HTTP_TARGET]: `${path}`,
5353
[SEMATTRS_HTTP_ROUTE]: `${path}`,
5454
},
55+
logs: [
56+
{},
57+
false,
58+
{},
59+
{},
60+
{},
61+
{},
62+
],
5563
})
5664

5765
const opt1: AssertsOptions = {

packages/otel/test/decorator/112.docorator-scope.test.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,14 @@ describe(fileShortPath(import.meta.url), function () {
5757
[SEMATTRS_HTTP_TARGET]: `${path}`,
5858
[SEMATTRS_HTTP_ROUTE]: `${path}`,
5959
},
60+
logs: [
61+
{},
62+
false,
63+
{},
64+
{},
65+
{},
66+
{},
67+
],
6068
})
6169

6270
const opt1: AssertsOptions = {

packages/otel/test/decorator/113.docorator-scope-auto.test.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,14 @@ describe(fileShortPath(import.meta.url), function () {
6262
[SEMATTRS_HTTP_TARGET]: `${path}`,
6363
[SEMATTRS_HTTP_ROUTE]: `${path}`,
6464
},
65+
logs: [
66+
{},
67+
false,
68+
{},
69+
{},
70+
{},
71+
{},
72+
],
6573
})
6674

6775
const opt1: AssertsOptions = {

packages/otel/test/decorator/114.docorator-scope-priority.test.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,14 @@ describe(fileShortPath(import.meta.url), function () {
5656
[SEMATTRS_HTTP_TARGET]: `${path}`,
5757
[SEMATTRS_HTTP_ROUTE]: `${path}`,
5858
},
59+
logs: [
60+
{},
61+
false,
62+
{},
63+
{},
64+
{},
65+
{},
66+
],
5967
})
6068

6169
const opt1: AssertsOptions = {

packages/otel/test/decorator/12.traceid2.test.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,14 @@ describe(fileShortPath(import.meta.url), function () {
6060
[SEMATTRS_HTTP_TARGET]: path,
6161
[SEMATTRS_HTTP_ROUTE]: path,
6262
},
63+
logs: [
64+
{},
65+
false,
66+
{},
67+
{},
68+
{},
69+
{},
70+
],
6371
})
6472

6573
const opt1: AssertsOptions = {

packages/otel/test/decorator/120.docorator-data-mix.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ describe(fileShortPath(import.meta.url), function () {
6565
},
6666
logs: [
6767
{},
68-
{},
68+
false,
6969
{},
7070
{ event: 'default', rootAttrs: 'rootAttrs' },
7171
false,
@@ -145,7 +145,7 @@ describe(fileShortPath(import.meta.url), function () {
145145
},
146146
logs: [
147147
{},
148-
{},
148+
false,
149149
{},
150150
false,
151151
{

packages/otel/test/decorator/120.trace-log.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ describe(fileShortPath(import.meta.url), function () {
4545
},
4646
logs: [
4747
{},
48-
{},
48+
false,
4949
{},
5050
{ event: 'default', rootAttrs: 'rootAttrs' },
5151
false,

packages/otel/test/decorator/121.trace-log.error.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ describe(fileShortPath(import.meta.url), function () {
4646
},
4747
logs: [
4848
{},
49-
{},
49+
false,
5050
{},
5151
{ event: 'default', rootAttrs: 'rootAttrs' },
5252
false,

packages/otel/test/decorator/122.trace-singleton.test.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ describe(fileShortPath(import.meta.url), function () {
4343
[SEMATTRS_HTTP_TARGET]: `${path}`,
4444
[SEMATTRS_HTTP_ROUTE]: `${path}`,
4545
},
46+
mergeDefaultLogs: false,
4647
})
4748

4849
const opt1: AssertsOptions = {
@@ -77,6 +78,7 @@ describe(fileShortPath(import.meta.url), function () {
7778
[SEMATTRS_HTTP_TARGET]: `${path}`,
7879
[SEMATTRS_HTTP_ROUTE]: `${path}`,
7980
},
81+
mergeDefaultLogs: false,
8082
})
8183

8284
const opt1: AssertsOptions = {

packages/otel/test/decorator/123.trace-cb-this.test.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ describe(fileShortPath(import.meta.url), function () {
4343
[SEMATTRS_HTTP_TARGET]: `${path}`,
4444
[SEMATTRS_HTTP_ROUTE]: `${path}`,
4545
},
46+
mergeDefaultLogs: false,
4647
})
4748

4849
const opt1: AssertsOptions = {
@@ -77,6 +78,7 @@ describe(fileShortPath(import.meta.url), function () {
7778
[SEMATTRS_HTTP_TARGET]: `${path}`,
7879
[SEMATTRS_HTTP_ROUTE]: `${path}`,
7980
},
81+
mergeDefaultLogs: false,
8082
})
8183

8284
const opt1: AssertsOptions = {

packages/otel/test/decorator/124.trace-log.afterThrow.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ describe(fileShortPath(import.meta.url), function () {
4545
},
4646
logs: [
4747
{},
48-
{},
48+
false,
4949
{},
5050
{ event: 'default', rootAttrs: 'rootAttrs' },
5151
false,

packages/otel/test/decorator/13.decorator_arg.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ describe(fileShortPath(import.meta.url), function () {
6060
[SEMATTRS_HTTP_TARGET]: path,
6161
[SEMATTRS_HTTP_ROUTE]: path,
6262
},
63+
mergeDefaultLogs: false,
6364
})
6465

6566
const opt1: AssertsOptions = {

packages/otel/test/decorator/14.decorator_arg2.test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import { testConfig } from '#@/root.config.js'
1515

1616

1717
describe(fileShortPath(import.meta.url), function () {
18-
this.retries(3)
18+
this.retries(2)
1919

2020
const path = `${apiBase.TraceDecorator}/${apiMethod.decorator_arg2}`
2121

@@ -60,6 +60,7 @@ describe(fileShortPath(import.meta.url), function () {
6060
[SEMATTRS_HTTP_TARGET]: path,
6161
[SEMATTRS_HTTP_ROUTE]: path,
6262
},
63+
mergeDefaultLogs: false,
6364
})
6465

6566
const opt1: AssertsOptions = {

packages/otel/test/decorator/19.singleton.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ describe(fileShortPath(import.meta.url), function () {
5858
[SEMATTRS_HTTP_TARGET]: path,
5959
[SEMATTRS_HTTP_ROUTE]: path,
6060
},
61+
mergeDefaultLogs: false,
6162
})
6263

6364
const opt1: AssertsOptions = {

0 commit comments

Comments
 (0)