From adb4c0fd45f1989265c72057d8311a444b1ae4b9 Mon Sep 17 00:00:00 2001 From: Seth Silesky <5115498+silesky@users.noreply.github.com> Date: Thu, 29 Aug 2024 12:48:48 -0500 Subject: [PATCH 1/4] normalize signals to send lowercase request/response --- .../src/tests/signals-vanilla/basic.test.ts | 4 ++-- .../src/core/signal-generators/__tests__/network.test.ts | 4 ++-- .../signals/signals/src/core/signal-generators/network-gen.ts | 4 ++-- packages/signals/signals/src/types/signals.ts | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/packages/signals/signals-integration-tests/src/tests/signals-vanilla/basic.test.ts b/packages/signals/signals-integration-tests/src/tests/signals-vanilla/basic.test.ts index ea6d3f6bc..3650c842a 100644 --- a/packages/signals/signals-integration-tests/src/tests/signals-vanilla/basic.test.ts +++ b/packages/signals/signals-integration-tests/src/tests/signals-vanilla/basic.test.ts @@ -31,13 +31,13 @@ test('network signals', async () => { (el: SegmentEvent) => el.properties!.type === 'network' ) const requests = networkEvents.filter( - (el) => el.properties!.data.action === 'Request' + (el) => el.properties!.data.action === 'request' ) expect(requests).toHaveLength(1) expect(requests[0].properties!.data.data).toEqual({ foo: 'bar' }) const responses = networkEvents.filter( - (el) => el.properties!.data.action === 'Response' + (el) => el.properties!.data.action === 'response' ) expect(responses).toHaveLength(1) expect(responses[0].properties!.data.data).toEqual({ someResponse: 'yep' }) diff --git a/packages/signals/signals/src/core/signal-generators/__tests__/network.test.ts b/packages/signals/signals/src/core/signal-generators/__tests__/network.test.ts index 309f5bf48..bd5bc8746 100644 --- a/packages/signals/signals/src/core/signal-generators/__tests__/network.test.ts +++ b/packages/signals/signals/src/core/signal-generators/__tests__/network.test.ts @@ -114,7 +114,7 @@ describe(NetworkGenerator, () => { { type: 'network', data: { - action: 'Request', + action: 'request', url: `http://${window.location.hostname}/test`, method: 'POST', data: { key: 'value' }, @@ -126,7 +126,7 @@ describe(NetworkGenerator, () => { { type: 'network', data: { - action: 'Response', + action: 'response', url: `http://${window.location.hostname}/test`, data: { data: 'test' }, }, diff --git a/packages/signals/signals/src/core/signal-generators/network-gen.ts b/packages/signals/signals/src/core/signal-generators/network-gen.ts index b4c293820..e387e8ca6 100644 --- a/packages/signals/signals/src/core/signal-generators/network-gen.ts +++ b/packages/signals/signals/src/core/signal-generators/network-gen.ts @@ -68,7 +68,7 @@ export class NetworkGenerator implements SignalGenerator { emitter.emit( createNetworkSignal({ - action: 'Request', + action: 'request', url: normalizeUrl(sUrl), method: rq.method || '', data: JSON.parse(rq.body.toString()), @@ -87,7 +87,7 @@ export class NetworkGenerator implements SignalGenerator { const data = await rs.json() emitter.emit( createNetworkSignal({ - action: 'Response', + action: 'response', url: url, data: data, }) diff --git a/packages/signals/signals/src/types/signals.ts b/packages/signals/signals/src/types/signals.ts index b403efc7c..268797922 100644 --- a/packages/signals/signals/src/types/signals.ts +++ b/packages/signals/signals/src/types/signals.ts @@ -64,14 +64,14 @@ export type InstrumentationSignal = AppSignal< > type NetworkRequestData = { - action: 'Request' + action: 'request' url: string method: string data: { [key: string]: unknown } } type NetworkResponseData = { - action: 'Response' + action: 'response' url: string data: { [key: string]: unknown } } From d0d93a2fd03905584dc46cde2d66e78de3cb76d5 Mon Sep 17 00:00:00 2001 From: Seth Silesky <5115498+silesky@users.noreply.github.com> Date: Thu, 29 Aug 2024 12:53:00 -0500 Subject: [PATCH 2/4] update changesets --- .changeset/pink-books-smash.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/pink-books-smash.md diff --git a/.changeset/pink-books-smash.md b/.changeset/pink-books-smash.md new file mode 100644 index 000000000..0b0a6fda6 --- /dev/null +++ b/.changeset/pink-books-smash.md @@ -0,0 +1,5 @@ +--- +'@segment/analytics-signals': major +--- + +Breaking: Update signal request to lowercase network actions \ No newline at end of file From 9b5e7593cad02a21722a0ae717f1e72082ba2b27 Mon Sep 17 00:00:00 2001 From: Seth Silesky <5115498+silesky@users.noreply.github.com> Date: Thu, 29 Aug 2024 13:04:03 -0500 Subject: [PATCH 3/4] add signal requests --- .changeset/pink-books-smash.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.changeset/pink-books-smash.md b/.changeset/pink-books-smash.md index 0b0a6fda6..af1318035 100644 --- a/.changeset/pink-books-smash.md +++ b/.changeset/pink-books-smash.md @@ -2,4 +2,4 @@ '@segment/analytics-signals': major --- -Breaking: Update signal request to lowercase network actions \ No newline at end of file +Update signal request to lowercase network actions \ No newline at end of file From a8300e74a80b7bd23778fdbe943c08df5f7072a0 Mon Sep 17 00:00:00 2001 From: Seth Silesky <5115498+silesky@users.noreply.github.com> Date: Thu, 29 Aug 2024 17:26:48 -0500 Subject: [PATCH 4/4] Update pink-books-smash.md --- .changeset/pink-books-smash.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.changeset/pink-books-smash.md b/.changeset/pink-books-smash.md index af1318035..4b516c5da 100644 --- a/.changeset/pink-books-smash.md +++ b/.changeset/pink-books-smash.md @@ -2,4 +2,4 @@ '@segment/analytics-signals': major --- -Update signal request to lowercase network actions \ No newline at end of file +Update signal request/response to lowercase.