From f1535f029add9a3ebf52a28468b0bbcd1997fa6b Mon Sep 17 00:00:00 2001 From: Aleksey Myasnikov Date: Tue, 8 Oct 2024 11:13:38 +0300 Subject: [PATCH] * Added session info into `trace.TableSessionBulkUpsertStartInfo` --- CHANGELOG.md | 2 ++ internal/table/session.go | 5 ++--- trace/table.go | 2 ++ trace/table_gtrace.go | 30 +++++++++++++++++++++++++++++- 4 files changed, 35 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d9d2643a8..58dd0f6f9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,5 @@ +* Added session info into `trace.TableSessionBulkUpsertStartInfo` + ## v3.84.0 * Added `meta.WithTraceParent` context modifier for explicit putting traceparent header into grpc calls diff --git a/internal/table/session.go b/internal/table/session.go index 9acbe5de3..644d1499a 100644 --- a/internal/table/session.go +++ b/internal/table/session.go @@ -1258,9 +1258,8 @@ func (s *session) BulkUpsert(ctx context.Context, table string, rows value.Value var ( a = allocator.New() callOptions []grpc.CallOption - onDone = trace.TableOnSessionBulkUpsert( - s.config.Trace(), &ctx, - stack.FunctionID("github.com/ydb-platform/ydb-go-sdk/v3/internal/table.(*session).BulkUpsert"), + onDone = trace.TableOnSessionBulkUpsert(s.config.Trace(), &ctx, + stack.FunctionID("github.com/ydb-platform/ydb-go-sdk/v3/internal/table.(*session).BulkUpsert"), s, ) ) defer func() { diff --git a/trace/table.go b/trace/table.go index fe0574215..1ae058c2b 100644 --- a/trace/table.go +++ b/trace/table.go @@ -158,6 +158,8 @@ type ( // Safe replacement of context are provided only inside callback function Context *context.Context Call call + + Session sessionInfo } // Internals: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#internals TableSessionBulkUpsertDoneInfo struct { diff --git a/trace/table_gtrace.go b/trace/table_gtrace.go index a9e6127fb..4617231f0 100644 --- a/trace/table_gtrace.go +++ b/trace/table_gtrace.go @@ -1313,6 +1313,7 @@ func (t *Table) onPoolWait(t1 TablePoolWaitStartInfo) func(TablePoolWaitDoneInfo } return res } + // Internals: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#internals func TableOnInit(t *Table, c *context.Context, call call) func(limit int) { var p TableInitStartInfo @@ -1325,6 +1326,7 @@ func TableOnInit(t *Table, c *context.Context, call call) func(limit int) { res(p) } } + // Internals: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#internals func TableOnClose(t *Table, c *context.Context, call call) func(error) { var p TableCloseStartInfo @@ -1337,6 +1339,7 @@ func TableOnClose(t *Table, c *context.Context, call call) func(error) { res(p) } } + // Internals: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#internals func TableOnDo(t *Table, c *context.Context, call call, label string, idempotent bool, nestedCall bool) func(attempts int, _ error) { var p TableDoStartInfo @@ -1353,6 +1356,7 @@ func TableOnDo(t *Table, c *context.Context, call call, label string, idempotent res(p) } } + // Internals: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#internals func TableOnDoTx(t *Table, c *context.Context, call call, label string, idempotent bool, nestedCall bool) func(attempts int, _ error) { var p TableDoTxStartInfo @@ -1369,6 +1373,7 @@ func TableOnDoTx(t *Table, c *context.Context, call call, label string, idempote res(p) } } + // Internals: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#internals func TableOnBulkUpsert(t *Table, c *context.Context, call call) func(_ error, attempts int) { var p TableBulkUpsertStartInfo @@ -1382,6 +1387,7 @@ func TableOnBulkUpsert(t *Table, c *context.Context, call call) func(_ error, at res(p) } } + // Internals: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#internals func TableOnCreateSession(t *Table, c *context.Context, call call) func(session sessionInfo, attempts int, _ error) { var p TableCreateSessionStartInfo @@ -1396,6 +1402,7 @@ func TableOnCreateSession(t *Table, c *context.Context, call call) func(session res(p) } } + // Internals: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#internals func TableOnSessionNew(t *Table, c *context.Context, call call) func(session sessionInfo, _ error) { var p TableSessionNewStartInfo @@ -1409,6 +1416,7 @@ func TableOnSessionNew(t *Table, c *context.Context, call call) func(session ses res(p) } } + // Internals: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#internals func TableOnSessionDelete(t *Table, c *context.Context, call call, session sessionInfo) func(error) { var p TableSessionDeleteStartInfo @@ -1422,6 +1430,7 @@ func TableOnSessionDelete(t *Table, c *context.Context, call call, session sessi res(p) } } + // Internals: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#internals func TableOnSessionKeepAlive(t *Table, c *context.Context, call call, session sessionInfo) func(error) { var p TableKeepAliveStartInfo @@ -1435,11 +1444,13 @@ func TableOnSessionKeepAlive(t *Table, c *context.Context, call call, session se res(p) } } + // Internals: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#internals -func TableOnSessionBulkUpsert(t *Table, c *context.Context, call call) func(error) { +func TableOnSessionBulkUpsert(t *Table, c *context.Context, call call, session sessionInfo) func(error) { var p TableSessionBulkUpsertStartInfo p.Context = c p.Call = call + p.Session = session res := t.onSessionBulkUpsert(p) return func(e error) { var p TableSessionBulkUpsertDoneInfo @@ -1447,6 +1458,7 @@ func TableOnSessionBulkUpsert(t *Table, c *context.Context, call call) func(erro res(p) } } + // Internals: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#internals func TableOnSessionQueryPrepare(t *Table, c *context.Context, call call, session sessionInfo, query string) func(result tableDataQuery, _ error) { var p TablePrepareDataQueryStartInfo @@ -1462,6 +1474,7 @@ func TableOnSessionQueryPrepare(t *Table, c *context.Context, call call, session res(p) } } + // Internals: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#internals func TableOnSessionQueryExecute(t *Table, c *context.Context, call call, session sessionInfo, query tableDataQuery, parameters tableQueryParameters, keepInCache bool) func(tx txInfo, prepared bool, result tableResult, _ error) { var p TableExecuteDataQueryStartInfo @@ -1481,6 +1494,7 @@ func TableOnSessionQueryExecute(t *Table, c *context.Context, call call, session res(p) } } + // Internals: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#internals func TableOnSessionQueryExplain(t *Table, c *context.Context, call call, session sessionInfo, query string) func(aST string, plan string, _ error) { var p TableExplainQueryStartInfo @@ -1497,6 +1511,7 @@ func TableOnSessionQueryExplain(t *Table, c *context.Context, call call, session res(p) } } + // Internals: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#internals func TableOnSessionQueryStreamExecute(t *Table, c *context.Context, call call, session sessionInfo, query tableDataQuery, parameters tableQueryParameters) func(error) { var p TableSessionQueryStreamExecuteStartInfo @@ -1512,6 +1527,7 @@ func TableOnSessionQueryStreamExecute(t *Table, c *context.Context, call call, s res(p) } } + // Internals: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#internals func TableOnSessionQueryStreamRead(t *Table, c *context.Context, call call, session sessionInfo) func(error) { var p TableSessionQueryStreamReadStartInfo @@ -1525,6 +1541,7 @@ func TableOnSessionQueryStreamRead(t *Table, c *context.Context, call call, sess res(p) } } + // Internals: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#internals func TableOnTxBegin(t *Table, c *context.Context, call call, session sessionInfo) func(tx txInfo, _ error) { var p TableTxBeginStartInfo @@ -1539,6 +1556,7 @@ func TableOnTxBegin(t *Table, c *context.Context, call call, session sessionInfo res(p) } } + // Internals: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#internals func TableOnTxExecute(t *Table, c *context.Context, call call, session sessionInfo, tx txInfo, query tableDataQuery, parameters tableQueryParameters) func(result tableResult, _ error) { var p TableTransactionExecuteStartInfo @@ -1556,6 +1574,7 @@ func TableOnTxExecute(t *Table, c *context.Context, call call, session sessionIn res(p) } } + // Internals: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#internals func TableOnTxExecuteStatement(t *Table, c *context.Context, call call, session sessionInfo, tx txInfo, statementQuery tableDataQuery, parameters tableQueryParameters) func(result tableResult, _ error) { var p TableTransactionExecuteStatementStartInfo @@ -1573,6 +1592,7 @@ func TableOnTxExecuteStatement(t *Table, c *context.Context, call call, session res(p) } } + // Internals: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#internals func TableOnTxCommit(t *Table, c *context.Context, call call, session sessionInfo, tx txInfo) func(error) { var p TableTxCommitStartInfo @@ -1587,6 +1607,7 @@ func TableOnTxCommit(t *Table, c *context.Context, call call, session sessionInf res(p) } } + // Internals: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#internals func TableOnTxRollback(t *Table, c *context.Context, call call, session sessionInfo, tx txInfo) func(error) { var p TableTxRollbackStartInfo @@ -1601,6 +1622,7 @@ func TableOnTxRollback(t *Table, c *context.Context, call call, session sessionI res(p) } } + // Internals: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#internals func TableOnPoolPut(t *Table, c *context.Context, call call, session sessionInfo) func(error) { var p TablePoolPutStartInfo @@ -1614,6 +1636,7 @@ func TableOnPoolPut(t *Table, c *context.Context, call call, session sessionInfo res(p) } } + // Internals: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#internals func TableOnPoolGet(t *Table, c *context.Context, call call) func(session sessionInfo, attempts int, _ error) { var p TablePoolGetStartInfo @@ -1628,6 +1651,7 @@ func TableOnPoolGet(t *Table, c *context.Context, call call) func(session sessio res(p) } } + // Internals: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#internals func TableOnPoolWith(t *Table, c *context.Context, call call) func(attempts int, _ error) { var p TablePoolWithStartInfo @@ -1641,6 +1665,7 @@ func TableOnPoolWith(t *Table, c *context.Context, call call) func(attempts int, res(p) } } + // Internals: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#internals func TableOnPoolStateChange(t *Table, limit int, index int, idle int, wait int, createInProgress int, size int) { var p TablePoolStateChangeInfo @@ -1652,18 +1677,21 @@ func TableOnPoolStateChange(t *Table, limit int, index int, idle int, wait int, p.Size = size t.onPoolStateChange(p) } + // Internals: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#internals func TableOnPoolSessionAdd(t *Table, session sessionInfo) { var p TablePoolSessionAddInfo p.Session = session t.onPoolSessionAdd(p) } + // Internals: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#internals func TableOnPoolSessionRemove(t *Table, session sessionInfo) { var p TablePoolSessionRemoveInfo p.Session = session t.onPoolSessionRemove(p) } + // Internals: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#internals func TableOnPoolWait(t *Table, c *context.Context, call call) func(session sessionInfo, _ error) { var p TablePoolWaitStartInfo