From 8e04db0f7780f1a763812806c519a5a4bfa367fb Mon Sep 17 00:00:00 2001 From: Aleksey Myasnikov Date: Tue, 12 Nov 2024 10:04:36 +0300 Subject: [PATCH] rename call.FunctionID() to call.String() --- internal/stack/function_id.go | 4 +- internal/stack/function_id_test.go | 8 ++-- internal/stack/record.go | 2 +- internal/stack/record_test.go | 2 +- retry/retry.go | 2 +- spans/discovery.go | 2 +- spans/driver.go | 40 ++++++++++---------- spans/query.go | 60 +++++++++++++++--------------- spans/retry.go | 2 +- spans/scheme.go | 10 ++--- spans/scripting.go | 8 ++-- spans/sql.go | 28 +++++++------- spans/table.go | 40 ++++++++++---------- trace/call.go | 4 +- 14 files changed, 107 insertions(+), 105 deletions(-) diff --git a/internal/stack/function_id.go b/internal/stack/function_id.go index 646a7f5ea..141b91f50 100644 --- a/internal/stack/function_id.go +++ b/internal/stack/function_id.go @@ -1,14 +1,14 @@ package stack type Caller interface { - FunctionID() string + String() string } var _ Caller = functionID("") type functionID string -func (id functionID) FunctionID() string { +func (id functionID) String() string { return string(id) } diff --git a/internal/stack/function_id_test.go b/internal/stack/function_id_test.go index b7adabee5..1ba408655 100644 --- a/internal/stack/function_id_test.go +++ b/internal/stack/function_id_test.go @@ -13,15 +13,15 @@ type genericType[T any] struct{} type starType struct{} func (t genericType[T]) Call() string { - return FunctionID("").FunctionID() + return FunctionID("").String() } func staticCall() string { - return FunctionID("").FunctionID() + return FunctionID("").String() } func (e *starType) starredCall() string { - return FunctionID("").FunctionID() + return FunctionID("").String() } func anonymousFunctionCall() string { @@ -30,7 +30,7 @@ func anonymousFunctionCall() string { go func() { mu.Lock() defer mu.Unlock() - result = FunctionID("").FunctionID() + result = FunctionID("").String() }() time.Sleep(time.Second) diff --git a/internal/stack/record.go b/internal/stack/record.go index 17c156736..8d3445429 100644 --- a/internal/stack/record.go +++ b/internal/stack/record.go @@ -197,7 +197,7 @@ func buildRecordString( return buffer.String() } -func (c call) FunctionID() string { +func (c call) String() string { return c.Record(Lambda(false), FileName(false)) } diff --git a/internal/stack/record_test.go b/internal/stack/record_test.go index 9f10be303..3dd777fec 100644 --- a/internal/stack/record_test.go +++ b/internal/stack/record_test.go @@ -339,6 +339,6 @@ func BenchmarkCallRecord(b *testing.B) { func BenchmarkCallFuncionID(b *testing.B) { b.ReportAllocs() for i := 0; i < b.N; i++ { - _ = Call(0).FunctionID() + _ = Call(0).String() } } diff --git a/retry/retry.go b/retry/retry.go index 4394b6146..0e22335e7 100644 --- a/retry/retry.go +++ b/retry/retry.go @@ -75,7 +75,7 @@ func (call callOption) ApplyRetryOption(opts *retryOptions) { } type call interface { - FunctionID() string + String() string } func withCaller(call call) callOption { diff --git a/spans/discovery.go b/spans/discovery.go index daec96b0d..2da1b713e 100644 --- a/spans/discovery.go +++ b/spans/discovery.go @@ -13,7 +13,7 @@ func discovery(adapter Adapter) (t trace.Discovery) { start := childSpanWithReplaceCtx( adapter, info.Context, - info.Call.FunctionID(), + info.Call.String(), kv.String("address", info.Address), kv.String("database", info.Database), ) diff --git a/spans/driver.go b/spans/driver.go index f2ed32517..07fb176d1 100644 --- a/spans/driver.go +++ b/spans/driver.go @@ -36,7 +36,7 @@ func driver(adapter Adapter) trace.Driver { //nolint:gocyclo,funlen start := childSpanWithReplaceCtx( adapter, info.Context, - info.Call.FunctionID(), + info.Call.String(), ) return func(info trace.DriverRepeaterWakeUpDoneInfo) { @@ -56,7 +56,7 @@ func driver(adapter Adapter) trace.Driver { //nolint:gocyclo,funlen start := childSpanWithReplaceCtx( adapter, info.Context, - info.Call.FunctionID(), + info.Call.String(), ) return func(info trace.DriverConnDialDoneInfo) { @@ -74,7 +74,7 @@ func driver(adapter Adapter) trace.Driver { //nolint:gocyclo,funlen start := childSpanWithReplaceCtx( adapter, info.Context, - info.Call.FunctionID(), + info.Call.String(), kv.String("address", safeAddress(info.Endpoint)), kv.String("method", string(info.Method)), ) @@ -114,7 +114,7 @@ func driver(adapter Adapter) trace.Driver { //nolint:gocyclo,funlen start := childSpanWithReplaceCtx( adapter, info.Context, - info.Call.FunctionID(), + info.Call.String(), kv.String("address", safeAddress(info.Endpoint)), kv.String("method", string(info.Method)), ) @@ -177,7 +177,7 @@ func driver(adapter Adapter) trace.Driver { //nolint:gocyclo,funlen return func(info trace.DriverConnStreamCloseSendDoneInfo) { if info.Error != nil { - start.Log(call.FunctionID(), kv.Error(info.Error)) + start.Log(call.String(), kv.Error(info.Error)) } } }, @@ -204,7 +204,7 @@ func driver(adapter Adapter) trace.Driver { //nolint:gocyclo,funlen attributes = append(attributes, kv.Error(info.Error)) } - start.Log(call.FunctionID(), attributes...) + start.Log(call.String(), attributes...) }, OnConnPark: func(info trace.DriverConnParkStartInfo) func(trace.DriverConnParkDoneInfo) { if adapter.Details()&trace.DriverConnEvents == 0 { @@ -218,9 +218,9 @@ func driver(adapter Adapter) trace.Driver { //nolint:gocyclo,funlen return func(info trace.DriverConnParkDoneInfo) { if info.Error != nil { - start.Log(call.FunctionID(), kv.Error(info.Error)) + start.Log(call.String(), kv.Error(info.Error)) } else { - start.Log(call.FunctionID()) + start.Log(call.String()) } } }, @@ -236,9 +236,9 @@ func driver(adapter Adapter) trace.Driver { //nolint:gocyclo,funlen return func(info trace.DriverConnCloseDoneInfo) { if info.Error != nil { - start.Log(call.FunctionID(), kv.Error(info.Error)) + start.Log(call.String(), kv.Error(info.Error)) } else { - start.Log(call.FunctionID()) + start.Log(call.String()) } } }, @@ -247,7 +247,7 @@ func driver(adapter Adapter) trace.Driver { //nolint:gocyclo,funlen return nil } s := adapter.SpanFromContext(*info.Context) - s.Log(info.Call.FunctionID(), + s.Log(info.Call.String(), kv.String("cause", safeError(info.Cause)), ) @@ -259,7 +259,7 @@ func driver(adapter Adapter) trace.Driver { //nolint:gocyclo,funlen } s := adapter.SpanFromContext(*info.Context) oldState := safeStringer(info.State) - functionID := info.Call.FunctionID() + functionID := info.Call.String() return func(info trace.DriverConnStateChangeDoneInfo) { s.Log(functionID, @@ -275,7 +275,7 @@ func driver(adapter Adapter) trace.Driver { //nolint:gocyclo,funlen start := childSpanWithReplaceCtx( adapter, info.Context, - info.Call.FunctionID(), + info.Call.String(), kv.String("name", info.Name), ) @@ -292,7 +292,7 @@ func driver(adapter Adapter) trace.Driver { //nolint:gocyclo,funlen start := childSpanWithReplaceCtx( adapter, info.Context, - info.Call.FunctionID(), + info.Call.String(), kv.String("address", info.Address), ) @@ -305,7 +305,7 @@ func driver(adapter Adapter) trace.Driver { //nolint:gocyclo,funlen return nil } start := childSpanWithReplaceCtx(adapter, info.Context, - info.Call.FunctionID(), + info.Call.String(), kv.String("database", info.Database), kv.Bool("need_local_dc", info.NeedLocalDC), ) @@ -342,7 +342,7 @@ func driver(adapter Adapter) trace.Driver { //nolint:gocyclo,funlen return nil } parent := adapter.SpanFromContext(*info.Context) - functionID := info.Call.FunctionID() + functionID := info.Call.String() return func(info trace.DriverBalancerChooseEndpointDoneInfo) { if info.Error != nil { @@ -360,7 +360,7 @@ func driver(adapter Adapter) trace.Driver { //nolint:gocyclo,funlen return nil } parent := adapter.SpanFromContext(*info.Context) - functionID := info.Call.FunctionID() + functionID := info.Call.String() return func(info trace.DriverGetCredentialsDoneInfo) { if info.Error != nil { @@ -388,7 +388,7 @@ func driver(adapter Adapter) trace.Driver { //nolint:gocyclo,funlen start := childSpanWithReplaceCtx( adapter, info.Context, - info.Call.FunctionID(), + info.Call.String(), kv.String("endpoint", info.Endpoint), kv.String("database", info.Database), kv.Bool("secure", info.Secure), @@ -405,7 +405,7 @@ func driver(adapter Adapter) trace.Driver { //nolint:gocyclo,funlen start := childSpanWithReplaceCtx( adapter, info.Context, - info.Call.FunctionID(), + info.Call.String(), ) return func(info trace.DriverCloseDoneInfo) { @@ -419,7 +419,7 @@ func driver(adapter Adapter) trace.Driver { //nolint:gocyclo,funlen start := childSpanWithReplaceCtx( adapter, info.Context, - info.Call.FunctionID(), + info.Call.String(), ) return func(info trace.DriverConnPoolNewDoneInfo) { diff --git a/spans/query.go b/spans/query.go index 2d8daf21b..76965b23b 100644 --- a/spans/query.go +++ b/spans/query.go @@ -27,7 +27,7 @@ func query(adapter Adapter) trace.Query { start := childSpanWithReplaceCtx( adapter, info.Context, - info.Call.FunctionID(), + info.Call.String(), ) return func(info trace.QueryNewDoneInfo) { @@ -41,7 +41,7 @@ func query(adapter Adapter) trace.Query { start := childSpanWithReplaceCtx( adapter, info.Context, - info.Call.FunctionID(), + info.Call.String(), ) return func(info trace.QueryCloseDoneInfo) { @@ -58,7 +58,7 @@ func query(adapter Adapter) trace.Query { start := childSpanWithReplaceCtx( adapter, info.Context, - info.Call.FunctionID(), + info.Call.String(), ) return func(info trace.QueryPoolNewDoneInfo) { @@ -74,7 +74,7 @@ func query(adapter Adapter) trace.Query { start := childSpanWithReplaceCtx( adapter, info.Context, - info.Call.FunctionID(), + info.Call.String(), ) return func(info trace.QueryPoolCloseDoneInfo) { @@ -91,7 +91,7 @@ func query(adapter Adapter) trace.Query { start := childSpanWithReplaceCtx( adapter, info.Context, - info.Call.FunctionID(), + info.Call.String(), ) return func(info trace.QueryPoolTryDoneInfo) { @@ -108,7 +108,7 @@ func query(adapter Adapter) trace.Query { start := childSpanWithReplaceCtx( adapter, info.Context, - info.Call.FunctionID(), + info.Call.String(), ) return func(info trace.QueryPoolWithDoneInfo) { @@ -126,7 +126,7 @@ func query(adapter Adapter) trace.Query { start := childSpanWithReplaceCtx( adapter, info.Context, - info.Call.FunctionID(), + info.Call.String(), ) return func(info trace.QueryPoolPutDoneInfo) { @@ -143,7 +143,7 @@ func query(adapter Adapter) trace.Query { start := childSpanWithReplaceCtx( adapter, info.Context, - info.Call.FunctionID(), + info.Call.String(), ) return func(info trace.QueryPoolGetDoneInfo) { @@ -160,7 +160,7 @@ func query(adapter Adapter) trace.Query { start := childSpanWithReplaceCtx( adapter, info.Context, - info.Call.FunctionID(), + info.Call.String(), ) return func(info trace.QueryDoDoneInfo) { @@ -178,7 +178,7 @@ func query(adapter Adapter) trace.Query { start := childSpanWithReplaceCtx( adapter, info.Context, - info.Call.FunctionID(), + info.Call.String(), ) return func(info trace.QueryDoTxDoneInfo) { @@ -196,7 +196,7 @@ func query(adapter Adapter) trace.Query { start := childSpanWithReplaceCtx( adapter, info.Context, - info.Call.FunctionID(), + info.Call.String(), kv.String("Query", strings.TrimSpace(info.Query)), ) @@ -214,7 +214,7 @@ func query(adapter Adapter) trace.Query { start := childSpanWithReplaceCtx( adapter, info.Context, - info.Call.FunctionID(), + info.Call.String(), kv.String("Query", strings.TrimSpace(info.Query)), ) @@ -232,7 +232,7 @@ func query(adapter Adapter) trace.Query { start := childSpanWithReplaceCtx( adapter, info.Context, - info.Call.FunctionID(), + info.Call.String(), kv.String("Query", strings.TrimSpace(info.Query)), ) @@ -250,7 +250,7 @@ func query(adapter Adapter) trace.Query { start := childSpanWithReplaceCtx( adapter, info.Context, - info.Call.FunctionID(), + info.Call.String(), kv.String("Query", strings.TrimSpace(info.Query)), ) @@ -268,7 +268,7 @@ func query(adapter Adapter) trace.Query { start := childSpanWithReplaceCtx( adapter, info.Context, - info.Call.FunctionID(), + info.Call.String(), ) return func(info trace.QuerySessionCreateDoneInfo) { @@ -287,7 +287,7 @@ func query(adapter Adapter) trace.Query { } ctx := *info.Context - call := info.Call.FunctionID() + call := info.Call.String() return func(info trace.QuerySessionAttachDoneInfo) { if info.Error == nil { @@ -306,7 +306,7 @@ func query(adapter Adapter) trace.Query { start := childSpanWithReplaceCtx( adapter, info.Context, - info.Call.FunctionID(), + info.Call.String(), ) return func(info trace.QuerySessionDeleteDoneInfo) { @@ -323,7 +323,7 @@ func query(adapter Adapter) trace.Query { start := childSpanWithReplaceCtx( adapter, info.Context, - info.Call.FunctionID(), + info.Call.String(), kv.String("Query", strings.TrimSpace(info.Query)), ) @@ -341,7 +341,7 @@ func query(adapter Adapter) trace.Query { start := childSpanWithReplaceCtx( adapter, info.Context, - info.Call.FunctionID(), + info.Call.String(), kv.String("Query", strings.TrimSpace(info.Query)), ) @@ -361,7 +361,7 @@ func query(adapter Adapter) trace.Query { start := childSpanWithReplaceCtx( adapter, info.Context, - info.Call.FunctionID(), + info.Call.String(), kv.String("Query", strings.TrimSpace(info.Query)), ) @@ -379,7 +379,7 @@ func query(adapter Adapter) trace.Query { start := childSpanWithReplaceCtx( adapter, info.Context, - info.Call.FunctionID(), + info.Call.String(), kv.String("Query", strings.TrimSpace(info.Query)), ) @@ -397,7 +397,7 @@ func query(adapter Adapter) trace.Query { start := childSpanWithReplaceCtx( adapter, info.Context, - info.Call.FunctionID(), + info.Call.String(), ) return func(info trace.QuerySessionBeginDoneInfo) { @@ -414,7 +414,7 @@ func query(adapter Adapter) trace.Query { } ctx := *info.Context - call := info.Call.FunctionID() + call := info.Call.String() return func(info trace.QueryResultNewDoneInfo) { if info.Error == nil { @@ -430,7 +430,7 @@ func query(adapter Adapter) trace.Query { } ctx := *info.Context - call := info.Call.FunctionID() + call := info.Call.String() return func(info trace.QueryResultNextPartDoneInfo) { if info.Error == nil { @@ -449,7 +449,7 @@ func query(adapter Adapter) trace.Query { } ctx := *info.Context - call := info.Call.FunctionID() + call := info.Call.String() return func(info trace.QueryResultNextResultSetDoneInfo) { if info.Error == nil { @@ -467,7 +467,7 @@ func query(adapter Adapter) trace.Query { } ctx := *info.Context - call := info.Call.FunctionID() + call := info.Call.String() return func(info trace.QueryResultCloseDoneInfo) { if info.Error == nil { @@ -484,7 +484,7 @@ func query(adapter Adapter) trace.Query { start := childSpanWithReplaceCtx( adapter, info.Context, - info.Call.FunctionID(), + info.Call.String(), kv.String("Query", strings.TrimSpace(info.Query)), ) @@ -502,7 +502,7 @@ func query(adapter Adapter) trace.Query { start := childSpanWithReplaceCtx( adapter, info.Context, - info.Call.FunctionID(), + info.Call.String(), kv.String("Query", strings.TrimSpace(info.Query)), ) @@ -520,7 +520,7 @@ func query(adapter Adapter) trace.Query { start := childSpanWithReplaceCtx( adapter, info.Context, - info.Call.FunctionID(), + info.Call.String(), kv.String("Query", strings.TrimSpace(info.Query)), ) @@ -538,7 +538,7 @@ func query(adapter Adapter) trace.Query { start := childSpanWithReplaceCtx( adapter, info.Context, - info.Call.FunctionID(), + info.Call.String(), kv.String("Query", strings.TrimSpace(info.Query)), ) diff --git a/spans/retry.go b/spans/retry.go index b5155051b..df0dfecbc 100644 --- a/spans/retry.go +++ b/spans/retry.go @@ -63,7 +63,7 @@ func Retry(adapter Adapter) (t trace.Retry) { if adapter.Details()&trace.RetryEvents != 0 && isTraceRetry(*info.Context) { //nolint:nestif operationName := info.Label if operationName == "" { - operationName = info.Call.FunctionID() + operationName = info.Call.String() } if functionID := functionID(*info.Context); functionID != "" { operationName = functionID diff --git a/spans/scheme.go b/spans/scheme.go index cfc059895..384fe5f4e 100644 --- a/spans/scheme.go +++ b/spans/scheme.go @@ -6,27 +6,27 @@ import ( func scheme(_ Adapter) (t trace.Scheme) { t.OnListDirectory = func(info trace.SchemeListDirectoryStartInfo) func(trace.SchemeListDirectoryDoneInfo) { - *info.Context = withFunctionID(*info.Context, info.Call.FunctionID()) + *info.Context = withFunctionID(*info.Context, info.Call.String()) return nil } t.OnDescribePath = func(info trace.SchemeDescribePathStartInfo) func(trace.SchemeDescribePathDoneInfo) { - *info.Context = withFunctionID(*info.Context, info.Call.FunctionID()) + *info.Context = withFunctionID(*info.Context, info.Call.String()) return nil } t.OnModifyPermissions = func(info trace.SchemeModifyPermissionsStartInfo) func(trace.SchemeModifyPermissionsDoneInfo) { - *info.Context = withFunctionID(*info.Context, info.Call.FunctionID()) + *info.Context = withFunctionID(*info.Context, info.Call.String()) return nil } t.OnMakeDirectory = func(info trace.SchemeMakeDirectoryStartInfo) func(trace.SchemeMakeDirectoryDoneInfo) { - *info.Context = withFunctionID(*info.Context, info.Call.FunctionID()) + *info.Context = withFunctionID(*info.Context, info.Call.String()) return nil } t.OnRemoveDirectory = func(info trace.SchemeRemoveDirectoryStartInfo) func(trace.SchemeRemoveDirectoryDoneInfo) { - *info.Context = withFunctionID(*info.Context, info.Call.FunctionID()) + *info.Context = withFunctionID(*info.Context, info.Call.String()) return nil } diff --git a/spans/scripting.go b/spans/scripting.go index 788e3fd95..fc892060c 100644 --- a/spans/scripting.go +++ b/spans/scripting.go @@ -12,7 +12,7 @@ func scripting(adapter Adapter) (t trace.Scripting) { start := childSpanWithReplaceCtx( adapter, info.Context, - info.Call.FunctionID(), + info.Call.String(), kv.String("query", info.Query), ) @@ -44,7 +44,7 @@ func scripting(adapter Adapter) (t trace.Scripting) { start := childSpanWithReplaceCtx( adapter, info.Context, - info.Call.FunctionID(), + info.Call.String(), kv.String("query", info.Query), ) @@ -73,7 +73,7 @@ func scripting(adapter Adapter) (t trace.Scripting) { start := childSpanWithReplaceCtx( adapter, info.Context, - info.Call.FunctionID(), + info.Call.String(), kv.String("query", info.Query), ) @@ -89,7 +89,7 @@ func scripting(adapter Adapter) (t trace.Scripting) { start := childSpanWithReplaceCtx( adapter, info.Context, - info.Call.FunctionID(), + info.Call.String(), ) return func(info trace.ScriptingCloseDoneInfo) { diff --git a/spans/sql.go b/spans/sql.go index 066295598..5135c42a1 100644 --- a/spans/sql.go +++ b/spans/sql.go @@ -39,7 +39,7 @@ func databaseSQL(adapter Adapter) (t trace.DatabaseSQL) { ) { if adapter.Details()&trace.DatabaseSQLConnectorEvents != 0 { start := childSpanWithReplaceCtx(info.Context, - info.Call.FunctionID(), + info.Call.String(), ) return func(info trace.DatabaseSQLConnectorConnectDoneInfo) { @@ -56,7 +56,7 @@ func databaseSQL(adapter Adapter) (t trace.DatabaseSQL) { if adapter.Details()&trace.DatabaseSQLConnEvents != 0 { start := childSpanWithReplaceCtx( info.Context, - info.Call.FunctionID(), + info.Call.String(), ) return func(info trace.DatabaseSQLConnPingDoneInfo) { @@ -73,7 +73,7 @@ func databaseSQL(adapter Adapter) (t trace.DatabaseSQL) { if adapter.Details()&trace.DatabaseSQLConnEvents != 0 { start := childSpanWithReplaceCtx( info.Context, - info.Call.FunctionID(), + info.Call.String(), kv.String("query", info.Query), ) @@ -91,7 +91,7 @@ func databaseSQL(adapter Adapter) (t trace.DatabaseSQL) { if adapter.Details()&trace.DatabaseSQLConnEvents != 0 { start := childSpanWithReplaceCtx( info.Context, - info.Call.FunctionID(), + info.Call.String(), kv.String("query", info.Query), kv.String("query_mode", info.Mode), kv.Bool("idempotent", info.Idempotent), @@ -111,7 +111,7 @@ func databaseSQL(adapter Adapter) (t trace.DatabaseSQL) { if adapter.Details()&trace.DatabaseSQLConnEvents != 0 { start := childSpanWithReplaceCtx( info.Context, - info.Call.FunctionID(), + info.Call.String(), kv.String("query", info.Query), kv.String("query_mode", info.Mode), kv.Bool("idempotent", info.Idempotent), @@ -133,7 +133,7 @@ func databaseSQL(adapter Adapter) (t trace.DatabaseSQL) { if adapter.Details()&trace.DatabaseSQLConnEvents != 0 { start := childSpanWithReplaceCtx( info.Context, - info.Call.FunctionID(), + info.Call.String(), kv.String("table_name", info.TableName), ) @@ -152,7 +152,7 @@ func databaseSQL(adapter Adapter) (t trace.DatabaseSQL) { if adapter.Details()&trace.DatabaseSQLTxEvents != 0 { start := childSpanWithReplaceCtx( info.Context, - info.Call.FunctionID(), + info.Call.String(), ) return func(info trace.DatabaseSQLConnBeginDoneInfo) { @@ -170,7 +170,7 @@ func databaseSQL(adapter Adapter) (t trace.DatabaseSQL) { if adapter.Details()&trace.DatabaseSQLTxEvents != 0 { start := childSpanWithReplaceCtx( info.Context, - info.Call.FunctionID(), + info.Call.String(), kv.String("transaction_id", safeID(info.Tx)), ) @@ -188,7 +188,7 @@ func databaseSQL(adapter Adapter) (t trace.DatabaseSQL) { if adapter.Details()&trace.DatabaseSQLTxEvents != 0 { start := childSpanWithReplaceCtx( info.Context, - info.Call.FunctionID(), + info.Call.String(), kv.String("transaction_id", safeID(info.Tx)), ) @@ -206,7 +206,7 @@ func databaseSQL(adapter Adapter) (t trace.DatabaseSQL) { if adapter.Details()&trace.DatabaseSQLTxEvents != 0 { start := childSpanWithReplaceCtx( info.Context, - info.Call.FunctionID(), + info.Call.String(), kv.String("query", info.Query), kv.String("transaction_id", safeID(info.Tx)), ) @@ -229,7 +229,7 @@ func databaseSQL(adapter Adapter) (t trace.DatabaseSQL) { if adapter.Details()&trace.DatabaseSQLTxEvents != 0 { start := childSpanWithReplaceCtx( info.Context, - info.Call.FunctionID(), + info.Call.String(), kv.String("query", info.Query), kv.String("transaction_id", safeID(info.Tx)), ) @@ -252,7 +252,7 @@ func databaseSQL(adapter Adapter) (t trace.DatabaseSQL) { if adapter.Details()&trace.DatabaseSQLTxEvents != 0 { start := childSpanWithReplaceCtx( info.Context, - info.Call.FunctionID(), + info.Call.String(), kv.String("query", info.Query), kv.String("transaction_id", safeID(info.Tx)), ) @@ -271,7 +271,7 @@ func databaseSQL(adapter Adapter) (t trace.DatabaseSQL) { if adapter.Details()&trace.DatabaseSQLStmtEvents != 0 { start := childSpanWithReplaceCtx( info.Context, - info.Call.FunctionID(), + info.Call.String(), kv.String("query", info.Query), ) @@ -293,7 +293,7 @@ func databaseSQL(adapter Adapter) (t trace.DatabaseSQL) { if adapter.Details()&trace.DatabaseSQLStmtEvents != 0 { start := childSpanWithReplaceCtx( info.Context, - info.Call.FunctionID(), + info.Call.String(), kv.String("query", info.Query), ) diff --git a/spans/table.go b/spans/table.go index 20099a197..36e96d021 100644 --- a/spans/table.go +++ b/spans/table.go @@ -22,7 +22,7 @@ func table(adapter Adapter) (t trace.Table) { //nolint:gocyclo t.OnCreateSession = func(info trace.TableCreateSessionStartInfo) func(trace.TableCreateSessionDoneInfo) { if adapter.Details()&trace.TableEvents != 0 { fieldsStore := fieldsStoreFromContext(info.Context) - *info.Context = withFunctionID(*info.Context, info.Call.FunctionID()) + *info.Context = withFunctionID(*info.Context, info.Call.String()) return func(info trace.TableCreateSessionDoneInfo) { if info.Error == nil { @@ -42,7 +42,7 @@ func table(adapter Adapter) (t trace.Table) { //nolint:gocyclo *info.Context = noTraceRetry(*info.Context) operationName := info.Label if operationName == "" { - operationName = info.Call.FunctionID() + operationName = info.Call.String() } start := childSpanWithReplaceCtx( adapter, @@ -72,7 +72,7 @@ func table(adapter Adapter) (t trace.Table) { //nolint:gocyclo *info.Context = noTraceRetry(*info.Context) operationName := info.Label if operationName == "" { - operationName = info.Call.FunctionID() + operationName = info.Call.String() } start := childSpanWithReplaceCtx( adapter, @@ -102,7 +102,7 @@ func table(adapter Adapter) (t trace.Table) { //nolint:gocyclo start := childSpanWithReplaceCtx( adapter, info.Context, - info.Call.FunctionID(), + info.Call.String(), ) return func(info trace.TableSessionNewDoneInfo) { @@ -123,7 +123,7 @@ func table(adapter Adapter) (t trace.Table) { //nolint:gocyclo start := childSpanWithReplaceCtx( adapter, info.Context, - info.Call.FunctionID(), + info.Call.String(), kv.String("node_id", nodeID(safeID(info.Session))), kv.String("session_id", safeID(info.Session)), ) @@ -140,7 +140,7 @@ func table(adapter Adapter) (t trace.Table) { //nolint:gocyclo start := childSpanWithReplaceCtx( adapter, info.Context, - info.Call.FunctionID(), + info.Call.String(), kv.String("node_id", nodeID(safeID(info.Session))), kv.String("session_id", safeID(info.Session)), ) @@ -157,7 +157,7 @@ func table(adapter Adapter) (t trace.Table) { //nolint:gocyclo start := childSpanWithReplaceCtx( adapter, info.Context, - info.Call.FunctionID(), + info.Call.String(), kv.String("node_id", nodeID(safeID(info.Session))), kv.String("session_id", safeID(info.Session)), ) @@ -178,7 +178,7 @@ func table(adapter Adapter) (t trace.Table) { //nolint:gocyclo start := childSpanWithReplaceCtx( adapter, info.Context, - info.Call.FunctionID(), + info.Call.String(), kv.String("query", info.Query), kv.String("node_id", nodeID(safeID(info.Session))), kv.String("session_id", safeID(info.Session)), @@ -204,7 +204,7 @@ func table(adapter Adapter) (t trace.Table) { //nolint:gocyclo start := childSpanWithReplaceCtx( adapter, info.Context, - info.Call.FunctionID(), + info.Call.String(), kv.String("node_id", nodeID(safeID(info.Session))), kv.String("session_id", safeID(info.Session)), kv.String("query", safeStringer(info.Query)), @@ -239,7 +239,7 @@ func table(adapter Adapter) (t trace.Table) { //nolint:gocyclo start := childSpanWithReplaceCtx( adapter, info.Context, - info.Call.FunctionID(), + info.Call.String(), kv.String("query", safeStringer(info.Query)), kv.String("node_id", nodeID(safeID(info.Session))), kv.String("session_id", safeID(info.Session)), @@ -264,7 +264,7 @@ func table(adapter Adapter) (t trace.Table) { //nolint:gocyclo start := childSpanWithReplaceCtx( adapter, info.Context, - info.Call.FunctionID(), + info.Call.String(), kv.String("node_id", nodeID(safeID(info.Session))), kv.String("session_id", safeID(info.Session)), ) @@ -285,7 +285,7 @@ func table(adapter Adapter) (t trace.Table) { //nolint:gocyclo start := childSpanWithReplaceCtx( adapter, info.Context, - info.Call.FunctionID(), + info.Call.String(), kv.String("node_id", nodeID(safeID(info.Session))), kv.String("session_id", safeID(info.Session)), ) @@ -306,7 +306,7 @@ func table(adapter Adapter) (t trace.Table) { //nolint:gocyclo start := childSpanWithReplaceCtx( adapter, info.Context, - info.Call.FunctionID(), + info.Call.String(), kv.String("node_id", nodeID(safeID(info.Session))), kv.String("session_id", safeID(info.Session)), kv.String("transaction_id", safeID(info.Tx)), @@ -324,7 +324,7 @@ func table(adapter Adapter) (t trace.Table) { //nolint:gocyclo start := childSpanWithReplaceCtx( adapter, info.Context, - info.Call.FunctionID(), + info.Call.String(), kv.String("node_id", nodeID(safeID(info.Session))), kv.String("session_id", safeID(info.Session)), kv.String("transaction_id", safeID(info.Tx)), @@ -342,7 +342,7 @@ func table(adapter Adapter) (t trace.Table) { //nolint:gocyclo start := childSpanWithReplaceCtx( adapter, info.Context, - info.Call.FunctionID(), + info.Call.String(), kv.String("node_id", nodeID(safeID(info.Session))), kv.String("session_id", safeID(info.Session)), kv.String("transaction_id", safeID(info.Tx)), @@ -365,7 +365,7 @@ func table(adapter Adapter) (t trace.Table) { //nolint:gocyclo start := childSpanWithReplaceCtx( adapter, info.Context, - info.Call.FunctionID(), + info.Call.String(), kv.String("node_id", nodeID(safeID(info.Session))), kv.String("session_id", safeID(info.Session)), kv.String("transaction_id", safeID(info.Tx)), @@ -384,7 +384,7 @@ func table(adapter Adapter) (t trace.Table) { //nolint:gocyclo start := childSpanWithReplaceCtx( adapter, info.Context, - info.Call.FunctionID(), + info.Call.String(), ) return func(info trace.TableInitDoneInfo) { @@ -403,7 +403,7 @@ func table(adapter Adapter) (t trace.Table) { //nolint:gocyclo start := childSpanWithReplaceCtx( adapter, info.Context, - info.Call.FunctionID(), + info.Call.String(), ) return func(info trace.TableCloseDoneInfo) { @@ -418,7 +418,7 @@ func table(adapter Adapter) (t trace.Table) { //nolint:gocyclo start := childSpanWithReplaceCtx( adapter, info.Context, - info.Call.FunctionID(), + info.Call.String(), kv.String("node_id", nodeID(safeID(info.Session))), kv.String("session_id", safeID(info.Session)), ) @@ -435,7 +435,7 @@ func table(adapter Adapter) (t trace.Table) { //nolint:gocyclo start := childSpanWithReplaceCtx( adapter, info.Context, - info.Call.FunctionID(), + info.Call.String(), ) return func(info trace.TablePoolGetDoneInfo) { diff --git a/trace/call.go b/trace/call.go index eabd93084..5410a5634 100644 --- a/trace/call.go +++ b/trace/call.go @@ -1,5 +1,7 @@ package trace +import "fmt" + type call interface { - FunctionID() string + fmt.Stringer }