From b87ad7274921acc88545377faa111ce2281408d5 Mon Sep 17 00:00:00 2001 From: nolouch Date: Tue, 4 Jul 2023 15:06:10 +0800 Subject: [PATCH 1/7] add explicit request source type to label the external request like lightning/br Signed-off-by: nolouch --- tikvrpc/interceptor/interceptor.go | 3 +++ txnkv/transaction/txn.go | 5 +++++ util/request_source.go | 30 ++++++++++++++++++++++++++---- 3 files changed, 34 insertions(+), 4 deletions(-) diff --git a/tikvrpc/interceptor/interceptor.go b/tikvrpc/interceptor/interceptor.go index 3c232fdab..0daf20aee 100644 --- a/tikvrpc/interceptor/interceptor.go +++ b/tikvrpc/interceptor/interceptor.go @@ -205,6 +205,9 @@ var interceptorCtxKey = interceptorCtxKeyType{} // WithRPCInterceptor is a helper function used to bind RPCInterceptor with ctx. func WithRPCInterceptor(ctx context.Context, interceptor RPCInterceptor) context.Context { + if v := ctx.Value(interceptorCtxKey); v != nil { + interceptor = ChainRPCInterceptors(v.(RPCInterceptor), interceptor) + } return context.WithValue(ctx, interceptorCtxKey, interceptor) } diff --git a/txnkv/transaction/txn.go b/txnkv/transaction/txn.go index e5067ce8a..34606981f 100644 --- a/txnkv/transaction/txn.go +++ b/txnkv/transaction/txn.go @@ -1450,3 +1450,8 @@ func (txn *KVTxn) SetRequestSourceInternal(internal bool) { func (txn *KVTxn) SetRequestSourceType(tp string) { txn.RequestSource.SetRequestSourceType(tp) } + +// SetExplicitRequestSoureType sets the explicit type of the request source. +func (txn *KVTxn) SetExplicitRequestSoureType(tp string) { + txn.RequestSource.SetExplicitRequestSourceType(tp) +} diff --git a/util/request_source.go b/util/request_source.go index eba974773..9016f47e7 100644 --- a/util/request_source.go +++ b/util/request_source.go @@ -29,9 +29,9 @@ const ( const ( // InternalRequest is the scope of internal queries - InternalRequest = "internal_" + InternalRequest = "internal" // ExternalRequest is the scope of external queries - ExternalRequest = "external_" + ExternalRequest = "external" // SourceUnknown keeps same with the default value(empty string) SourceUnknown = "unknown" ) @@ -40,6 +40,9 @@ const ( type RequestSource struct { RequestSourceInternal bool RequestSourceType string + // ExplicitRequestSoureType is set from the session variable, it may specified by the client or users. `explicit_request_source_type`. it's a complement of RequestSourceType. + // The value maybe "lightning", "br", "dumpling" etc. + ExplicitRequestSoureType string } // SetRequestSourceInternal sets the scope of the request source. @@ -52,6 +55,11 @@ func (r *RequestSource) SetRequestSourceType(tp string) { r.RequestSourceType = tp } +// SetExplicitRequestSourceType sets the type of the request source. +func (r *RequestSource) SetExplicitRequestSourceType(tp string) { + r.ExplicitRequestSoureType = tp +} + // WithInternalSourceType create context with internal source. func WithInternalSourceType(ctx context.Context, source string) context.Context { return context.WithValue(ctx, RequestSourceKey, RequestSource{ @@ -76,10 +84,24 @@ func (r *RequestSource) GetRequestSource() string { if r == nil || r.RequestSourceType == "" { return SourceUnknown } + appendType := func(list []string) []string { + if len(r.ExplicitRequestSoureType) > 0 { + list = append(list, r.ExplicitRequestSoureType) + return list + } + return list + } if r.RequestSourceInternal { - return InternalRequest + r.RequestSourceType + labels := []string{InternalRequest, r.RequestSourceType} + labels = appendType(labels) + if len(r.ExplicitRequestSoureType) > 0 { + labels = append(labels, r.ExplicitRequestSoureType) + } + return strings.Join(labels, "_") } - return ExternalRequest + r.RequestSourceType + labels := []string{ExternalRequest, r.RequestSourceType} + labels = appendType(labels) + return strings.Join(labels, "_") } // RequestSourceFromCtx extract source from passed context. From 2596ac95a7c0802e219490d9f6d82c143da98380 Mon Sep 17 00:00:00 2001 From: nolouch Date: Wed, 5 Jul 2023 15:47:09 +0800 Subject: [PATCH 2/7] address Signed-off-by: nolouch --- txnkv/transaction/txn.go | 4 ++-- util/request_source.go | 28 ++++++++++++++++++++-------- 2 files changed, 22 insertions(+), 10 deletions(-) diff --git a/txnkv/transaction/txn.go b/txnkv/transaction/txn.go index 34606981f..88552a20c 100644 --- a/txnkv/transaction/txn.go +++ b/txnkv/transaction/txn.go @@ -1451,7 +1451,7 @@ func (txn *KVTxn) SetRequestSourceType(tp string) { txn.RequestSource.SetRequestSourceType(tp) } -// SetExplicitRequestSoureType sets the explicit type of the request source. -func (txn *KVTxn) SetExplicitRequestSoureType(tp string) { +// SetExplicitRequestSourceType sets the explicit type of the request source. +func (txn *KVTxn) SetExplicitRequestSourceType(tp string) { txn.RequestSource.SetExplicitRequestSourceType(tp) } diff --git a/util/request_source.go b/util/request_source.go index 9016f47e7..6bd88ace5 100644 --- a/util/request_source.go +++ b/util/request_source.go @@ -27,6 +27,18 @@ const ( InternalTxnMeta = InternalTxnOthers ) +// explict source types. +const ( + ExplicitTypeDefault = "" + ExplicitTypeLightning = "lightning" + ExplicitTypeBR = "br" + ExplicitTypeDumpling = "dumpling" + ExplicitTypeBackground = "background" +) + +// ExplictTypeList is the list of all explict source types. +var ExplictTypeList = []string{ExplicitTypeDefault, ExplicitTypeLightning, ExplicitTypeBR, ExplicitTypeDumpling, ExplicitTypeBackground} + const ( // InternalRequest is the scope of internal queries InternalRequest = "internal" @@ -40,9 +52,9 @@ const ( type RequestSource struct { RequestSourceInternal bool RequestSourceType string - // ExplicitRequestSoureType is set from the session variable, it may specified by the client or users. `explicit_request_source_type`. it's a complement of RequestSourceType. + // ExplicitRequestSourceType is set from the session variable, it may specified by the client or users. `explicit_request_source_type`. it's a complement of RequestSourceType. // The value maybe "lightning", "br", "dumpling" etc. - ExplicitRequestSoureType string + ExplicitRequestSourceType string } // SetRequestSourceInternal sets the scope of the request source. @@ -57,7 +69,7 @@ func (r *RequestSource) SetRequestSourceType(tp string) { // SetExplicitRequestSourceType sets the type of the request source. func (r *RequestSource) SetExplicitRequestSourceType(tp string) { - r.ExplicitRequestSoureType = tp + r.ExplicitRequestSourceType = tp } // WithInternalSourceType create context with internal source. @@ -81,12 +93,12 @@ func IsRequestSourceInternal(reqSrc *RequestSource) bool { func (r *RequestSource) GetRequestSource() string { // if r.RequestSourceType is not set, it's mostly possible that r.RequestSourceInternal is not set // to avoid internal requests be marked as external(default value), return unknown source here. - if r == nil || r.RequestSourceType == "" { + if r == nil || (len(r.RequestSourceType) == 0 && len(r.ExplicitRequestSourceType) == 0) { return SourceUnknown } appendType := func(list []string) []string { - if len(r.ExplicitRequestSoureType) > 0 { - list = append(list, r.ExplicitRequestSoureType) + if len(r.ExplicitRequestSourceType) > 0 { + list = append(list, r.ExplicitRequestSourceType) return list } return list @@ -94,8 +106,8 @@ func (r *RequestSource) GetRequestSource() string { if r.RequestSourceInternal { labels := []string{InternalRequest, r.RequestSourceType} labels = appendType(labels) - if len(r.ExplicitRequestSoureType) > 0 { - labels = append(labels, r.ExplicitRequestSoureType) + if len(r.ExplicitRequestSourceType) > 0 { + labels = append(labels, r.ExplicitRequestSourceType) } return strings.Join(labels, "_") } From b2b79e4bb084ccbe72d26f8241ff0b8be568479a Mon Sep 17 00:00:00 2001 From: nolouch Date: Wed, 5 Jul 2023 17:49:11 +0800 Subject: [PATCH 3/7] address Signed-off-by: nolouch --- util/request_source.go | 31 ++++++------- util/request_source_test.go | 88 +++++++++++++++++++++++++++++++++++++ 2 files changed, 104 insertions(+), 15 deletions(-) create mode 100644 util/request_source_test.go diff --git a/util/request_source.go b/util/request_source.go index 6bd88ace5..d7691ad8a 100644 --- a/util/request_source.go +++ b/util/request_source.go @@ -27,7 +27,7 @@ const ( InternalTxnMeta = InternalTxnOthers ) -// explict source types. +// explicit source types. const ( ExplicitTypeDefault = "" ExplicitTypeLightning = "lightning" @@ -36,8 +36,8 @@ const ( ExplicitTypeBackground = "background" ) -// ExplictTypeList is the list of all explict source types. -var ExplictTypeList = []string{ExplicitTypeDefault, ExplicitTypeLightning, ExplicitTypeBR, ExplicitTypeDumpling, ExplicitTypeBackground} +// ExplicitTypeList is the list of all explicit source types. +var ExplicitTypeList = []string{ExplicitTypeDefault, ExplicitTypeLightning, ExplicitTypeBR, ExplicitTypeDumpling, ExplicitTypeBackground} const ( // InternalRequest is the scope of internal queries @@ -96,23 +96,24 @@ func (r *RequestSource) GetRequestSource() string { if r == nil || (len(r.RequestSourceType) == 0 && len(r.ExplicitRequestSourceType) == 0) { return SourceUnknown } - appendType := func(list []string) []string { - if len(r.ExplicitRequestSourceType) > 0 { - list = append(list, r.ExplicitRequestSourceType) - return list + clearEmpty := func(list []string) []string { + i := 0 + for _, v := range list { + if len(v) != 0 { + list[i] = v + i++ + } } - return list + return list[:i] } if r.RequestSourceInternal { - labels := []string{InternalRequest, r.RequestSourceType} - labels = appendType(labels) - if len(r.ExplicitRequestSourceType) > 0 { - labels = append(labels, r.ExplicitRequestSourceType) - } + labels := []string{InternalRequest, r.RequestSourceType, r.ExplicitRequestSourceType} + labels = clearEmpty(labels) + return strings.Join(labels, "_") } - labels := []string{ExternalRequest, r.RequestSourceType} - labels = appendType(labels) + labels := []string{ExternalRequest, r.RequestSourceType, r.ExplicitRequestSourceType} + labels = clearEmpty(labels) return strings.Join(labels, "_") } diff --git a/util/request_source_test.go b/util/request_source_test.go new file mode 100644 index 000000000..fe502c77d --- /dev/null +++ b/util/request_source_test.go @@ -0,0 +1,88 @@ +// Copyright 2023 TiKV Authors +// +// Licensed 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. + +// NOTE: The code in this file is based on code from the +// TiDB project, licensed under the Apache License v 2.0 +// +// https://github.com/pingcap/tidb/tree/cc5e161ac06827589c4966674597c137cc9e809c/store/tikv/util/execdetails.go +// + +// Copyright 2023 PingCAP, Inc. +// +// Licensed 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. + +package util + +import ( + "testing" + + "github.com/stretchr/testify/assert" +) + +func TestGetRequestSource(t *testing.T) { + rsi := true + rst := "test" + ers := "explicit_test" + rs := &RequestSource{ + RequestSourceInternal: rsi, + RequestSourceType: rst, + ExplicitRequestSourceType: ers, + } + + // Test internal request + expected := "internal_test_explicit_test" + actual := rs.GetRequestSource() + assert.Equal(t, expected, actual) + + // Test external request + rs.RequestSourceInternal = false + expected = "external_test_explicit_test" + actual = rs.GetRequestSource() + assert.Equal(t, expected, actual) + + // Test nil pointer + rs = nil + expected = "unknown" + actual = rs.GetRequestSource() + assert.Equal(t, expected, actual) + + // Test empty RequestSourceType and ExplicitRequestSourceType + rs = &RequestSource{} + expected = "unknown" + actual = rs.GetRequestSource() + assert.Equal(t, expected, actual) + + // Test empty ExplicitRequestSourceType + rs.RequestSourceType = "test" + expected = "external_test" + actual = rs.GetRequestSource() + assert.Equal(t, expected, actual) + + // Test empty RequestSourceType + rs.RequestSourceType = "" + rs.ExplicitRequestSourceType = "explicit_test" + expected = "external_explicit_test" + actual = rs.GetRequestSource() + assert.Equal(t, expected, actual) +} From 1c12e8065a51c88bdff19c5e44fcd55ca3cfdfbb Mon Sep 17 00:00:00 2001 From: nolouch Date: Thu, 6 Jul 2023 11:13:36 +0800 Subject: [PATCH 4/7] address Signed-off-by: nolouch --- util/request_source_test.go | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/util/request_source_test.go b/util/request_source_test.go index fe502c77d..6b6d219c4 100644 --- a/util/request_source_test.go +++ b/util/request_source_test.go @@ -12,26 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -// NOTE: The code in this file is based on code from the -// TiDB project, licensed under the Apache License v 2.0 -// -// https://github.com/pingcap/tidb/tree/cc5e161ac06827589c4966674597c137cc9e809c/store/tikv/util/execdetails.go -// - -// Copyright 2023 PingCAP, Inc. -// -// Licensed 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. - package util import ( From ba1066b82a71535843ecb293122ee88581306700 Mon Sep 17 00:00:00 2001 From: nolouch Date: Thu, 6 Jul 2023 14:37:13 +0800 Subject: [PATCH 5/7] address comments Signed-off-by: nolouch --- util/request_source.go | 13 +++++++++---- util/request_source_test.go | 2 +- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/util/request_source.go b/util/request_source.go index d7691ad8a..91e3c7e94 100644 --- a/util/request_source.go +++ b/util/request_source.go @@ -29,7 +29,8 @@ const ( // explicit source types. const ( - ExplicitTypeDefault = "" + ExplicitTypeEmpty = "" + ExplicitTypeDB = "db" ExplicitTypeLightning = "lightning" ExplicitTypeBR = "br" ExplicitTypeDumpling = "dumpling" @@ -37,7 +38,7 @@ const ( ) // ExplicitTypeList is the list of all explicit source types. -var ExplicitTypeList = []string{ExplicitTypeDefault, ExplicitTypeLightning, ExplicitTypeBR, ExplicitTypeDumpling, ExplicitTypeBackground} +var ExplicitTypeList = []string{ExplicitTypeDB, ExplicitTypeLightning, ExplicitTypeBR, ExplicitTypeDumpling, ExplicitTypeBackground} const ( // InternalRequest is the scope of internal queries @@ -106,13 +107,17 @@ func (r *RequestSource) GetRequestSource() string { } return list[:i] } + explicitSourceType := r.ExplicitRequestSourceType + if len(explicitSourceType) == 0 { + explicitSourceType = ExplicitTypeDB + } if r.RequestSourceInternal { - labels := []string{InternalRequest, r.RequestSourceType, r.ExplicitRequestSourceType} + labels := []string{InternalRequest, r.RequestSourceType, explicitSourceType} labels = clearEmpty(labels) return strings.Join(labels, "_") } - labels := []string{ExternalRequest, r.RequestSourceType, r.ExplicitRequestSourceType} + labels := []string{ExternalRequest, r.RequestSourceType, explicitSourceType} labels = clearEmpty(labels) return strings.Join(labels, "_") } diff --git a/util/request_source_test.go b/util/request_source_test.go index 6b6d219c4..b79998229 100644 --- a/util/request_source_test.go +++ b/util/request_source_test.go @@ -55,7 +55,7 @@ func TestGetRequestSource(t *testing.T) { // Test empty ExplicitRequestSourceType rs.RequestSourceType = "test" - expected = "external_test" + expected = "external_test_db" actual = rs.GetRequestSource() assert.Equal(t, expected, actual) From bedfadadba3aefe8477de380208d6ea38ac1e8f9 Mon Sep 17 00:00:00 2001 From: nolouch Date: Thu, 6 Jul 2023 16:55:32 +0800 Subject: [PATCH 6/7] use default Signed-off-by: nolouch --- util/request_source.go | 6 +++--- util/request_source_test.go | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/util/request_source.go b/util/request_source.go index 91e3c7e94..727f18984 100644 --- a/util/request_source.go +++ b/util/request_source.go @@ -30,7 +30,7 @@ const ( // explicit source types. const ( ExplicitTypeEmpty = "" - ExplicitTypeDB = "db" + ExplicitTypeDefault = "default" ExplicitTypeLightning = "lightning" ExplicitTypeBR = "br" ExplicitTypeDumpling = "dumpling" @@ -38,7 +38,7 @@ const ( ) // ExplicitTypeList is the list of all explicit source types. -var ExplicitTypeList = []string{ExplicitTypeDB, ExplicitTypeLightning, ExplicitTypeBR, ExplicitTypeDumpling, ExplicitTypeBackground} +var ExplicitTypeList = []string{ExplicitTypeDefault, ExplicitTypeLightning, ExplicitTypeBR, ExplicitTypeDumpling, ExplicitTypeBackground} const ( // InternalRequest is the scope of internal queries @@ -109,7 +109,7 @@ func (r *RequestSource) GetRequestSource() string { } explicitSourceType := r.ExplicitRequestSourceType if len(explicitSourceType) == 0 { - explicitSourceType = ExplicitTypeDB + explicitSourceType = ExplicitTypeDefault } if r.RequestSourceInternal { labels := []string{InternalRequest, r.RequestSourceType, explicitSourceType} diff --git a/util/request_source_test.go b/util/request_source_test.go index b79998229..e49eb2a96 100644 --- a/util/request_source_test.go +++ b/util/request_source_test.go @@ -55,7 +55,7 @@ func TestGetRequestSource(t *testing.T) { // Test empty ExplicitRequestSourceType rs.RequestSourceType = "test" - expected = "external_test_db" + expected = "external_test_default" actual = rs.GetRequestSource() assert.Equal(t, expected, actual) From 3d194d030604c72ae6906fce018e92755a108089 Mon Sep 17 00:00:00 2001 From: nolouch Date: Thu, 6 Jul 2023 17:31:40 +0800 Subject: [PATCH 7/7] address comments Signed-off-by: nolouch --- util/request_source.go | 41 +++++++++++++++---------------------- util/request_source_test.go | 14 ++++++------- 2 files changed, 23 insertions(+), 32 deletions(-) diff --git a/util/request_source.go b/util/request_source.go index 727f18984..2723062d5 100644 --- a/util/request_source.go +++ b/util/request_source.go @@ -38,7 +38,7 @@ const ( ) // ExplicitTypeList is the list of all explicit source types. -var ExplicitTypeList = []string{ExplicitTypeDefault, ExplicitTypeLightning, ExplicitTypeBR, ExplicitTypeDumpling, ExplicitTypeBackground} +var ExplicitTypeList = []string{ExplicitTypeEmpty, ExplicitTypeDefault, ExplicitTypeLightning, ExplicitTypeBR, ExplicitTypeDumpling, ExplicitTypeBackground} const ( // InternalRequest is the scope of internal queries @@ -53,8 +53,8 @@ const ( type RequestSource struct { RequestSourceInternal bool RequestSourceType string - // ExplicitRequestSourceType is set from the session variable, it may specified by the client or users. `explicit_request_source_type`. it's a complement of RequestSourceType. - // The value maybe "lightning", "br", "dumpling" etc. + // ExplicitRequestSourceType is a type that is set from the session variable and may be specified by the client or users. + // It is a complement to the RequestSourceType and provides additional information about how a request was initiated. ExplicitRequestSourceType string } @@ -92,34 +92,25 @@ func IsRequestSourceInternal(reqSrc *RequestSource) bool { // GetRequestSource gets the request_source field of the request. func (r *RequestSource) GetRequestSource() string { - // if r.RequestSourceType is not set, it's mostly possible that r.RequestSourceInternal is not set - // to avoid internal requests be marked as external(default value), return unknown source here. + source := SourceUnknown + explicitSourceType := ExplicitTypeDefault + origin := ExternalRequest if r == nil || (len(r.RequestSourceType) == 0 && len(r.ExplicitRequestSourceType) == 0) { - return SourceUnknown + // if r.RequestSourceType and r.ExplicitRequestSourceType are not set, it's mostly possible that r.RequestSourceInternal is not set + // to avoid internal requests be marked as external(default value), return unknown source here. + return strings.Join([]string{source, explicitSourceType}, "_") } - clearEmpty := func(list []string) []string { - i := 0 - for _, v := range list { - if len(v) != 0 { - list[i] = v - i++ - } - } - return list[:i] + + if len(r.RequestSourceType) > 0 { + source = r.RequestSourceType } - explicitSourceType := r.ExplicitRequestSourceType - if len(explicitSourceType) == 0 { - explicitSourceType = ExplicitTypeDefault + if len(r.ExplicitRequestSourceType) > 0 { + explicitSourceType = r.ExplicitRequestSourceType } if r.RequestSourceInternal { - labels := []string{InternalRequest, r.RequestSourceType, explicitSourceType} - labels = clearEmpty(labels) - - return strings.Join(labels, "_") + origin = InternalRequest } - labels := []string{ExternalRequest, r.RequestSourceType, explicitSourceType} - labels = clearEmpty(labels) - return strings.Join(labels, "_") + return strings.Join([]string{origin, source, explicitSourceType}, "_") } // RequestSourceFromCtx extract source from passed context. diff --git a/util/request_source_test.go b/util/request_source_test.go index e49eb2a96..4f991a9b0 100644 --- a/util/request_source_test.go +++ b/util/request_source_test.go @@ -23,7 +23,7 @@ import ( func TestGetRequestSource(t *testing.T) { rsi := true rst := "test" - ers := "explicit_test" + ers := "lightning" rs := &RequestSource{ RequestSourceInternal: rsi, RequestSourceType: rst, @@ -31,25 +31,25 @@ func TestGetRequestSource(t *testing.T) { } // Test internal request - expected := "internal_test_explicit_test" + expected := "internal_test_lightning" actual := rs.GetRequestSource() assert.Equal(t, expected, actual) // Test external request rs.RequestSourceInternal = false - expected = "external_test_explicit_test" + expected = "external_test_lightning" actual = rs.GetRequestSource() assert.Equal(t, expected, actual) // Test nil pointer rs = nil - expected = "unknown" + expected = "unknown_default" actual = rs.GetRequestSource() assert.Equal(t, expected, actual) // Test empty RequestSourceType and ExplicitRequestSourceType rs = &RequestSource{} - expected = "unknown" + expected = "unknown_default" actual = rs.GetRequestSource() assert.Equal(t, expected, actual) @@ -61,8 +61,8 @@ func TestGetRequestSource(t *testing.T) { // Test empty RequestSourceType rs.RequestSourceType = "" - rs.ExplicitRequestSourceType = "explicit_test" - expected = "external_explicit_test" + rs.ExplicitRequestSourceType = "lightning" + expected = "external_unknown_lightning" actual = rs.GetRequestSource() assert.Equal(t, expected, actual) }