-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
telemetry: track telemetry transactions through conn executor
This change modifies the telemetry transaction sampling process to be simpler. Previously for telemetry transaction sampling the telemetry logging struct managed the tracking of sampled transactions via a map of execution ids. If a transaction was determined to be sampled, we would input an entry in this map and for each statement, we would check the map to see if the statement belongs to a tracked transaction. Instead of using a map, we can mark the transaction as being sampled by telemetry in the conn executor. This removes the need for concurrent data struct access when the transaction is marked as being sampled, since each statement no longer needs to read an entry from the shared map. This also removes the need to track the number of transactions currently being sampled for telemetry, as this was introduced to manage the memory used by the map. We will now determine if the transaction should be logged to telemetry at the start of transaction execution or at the start of a transaction restart. The transaction will be marked for telemetry logging if enough time has elapsed since the last transaction was sampled or if session tracing is on. Transaction statements will be logged according to the following settings: - sql.telemetry.transaction_sampling.frequency controls the frequency at which we sample a transaction. If a transaction is marked to be sampled by telemetry, this means we will log all of its statement execution events to telemetry, up to a maximum of `sql.telemetry.transaction_sampling.statement_events_per_transaction.max` statements. Additional items in this commit: - TelemetryLoggingMetrics to telemetryLoggingMetrics since it is not used in other packages. - Renames `lastEmittedTime` -> `lastSampledTime` in telemetryLogging struct as it is no longer representative of what this timestamp is. With th eintroduction of transaction sampling, the emitted event time is not necessary the time at which we decide to sample an event. - Creates a datadriven test handler for telemetry logging. Datadriven telemetry logging tests should be created in the dir pkg/sql/testdata/telemetry_logging. - `telemetry_logging/logging` contains tests on verifying emitted logs. - `telemetry_logging/logging_decision` contains unit tests for the functions `shouldEmitTransactionLog` and `shouldEmitStatementLog`. Epic: none Release note: None Part of: #108284 Release note (ops change): New cluster settings: - sql.telemetry.transaction_sampling.statement_events_per_transaction.max: controls the maximum number of statement events to emit per sampled transaction for TELEMETRY - sql.telemetry.transaction_sampling.frequency: controls the maximum frequency at which we sample transactions for telemetry
- Loading branch information
Showing
14 changed files
with
1,529 additions
and
759 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.