Skip to content

feat(cli): Add query lifecycle callbacks to Console (#1057)#1057

Open
amitkdutta wants to merge 1 commit intofacebookincubator:mainfrom
amitkdutta:export-D96492425
Open

feat(cli): Add query lifecycle callbacks to Console (#1057)#1057
amitkdutta wants to merge 1 commit intofacebookincubator:mainfrom
amitkdutta:export-D96492425

Conversation

@amitkdutta
Copy link
Contributor

@amitkdutta amitkdutta commented Mar 14, 2026

Summary:

Add optional start and completion callbacks to Console so callers can
hook into the query lifecycle for logging, metrics, or other processing.

  • startCallback: invoked before parse for every query.
  • completionCallback: invoked after execution with query timing, row
    counts, and success/failure status.

Reviewed By: hdikeman

Differential Revision: D96492425

@meta-cla meta-cla bot added the CLA Signed This label is managed by the Meta Open Source bot. label Mar 14, 2026
@meta-codesync
Copy link

meta-codesync bot commented Mar 14, 2026

@amitkdutta has exported this pull request. If you are a Meta employee, you can view the originating Diff in D96492425.

@meta-codesync meta-codesync bot changed the title feat(cli): Add query lifecycle callbacks to Console feat(cli): Add query lifecycle callbacks to Console (#1057) Mar 14, 2026
amitkdutta added a commit to amitkdutta/axiom that referenced this pull request Mar 14, 2026
…r#1057)

Summary:

Add optional start and completion callbacks to Console so callers can
hook into the query lifecycle for logging, metrics, or other processing.

- startCallback: invoked before parse for every query.
- completionCallback: invoked after execution with query timing, row
  counts, and success/failure status.

Differential Revision: D96492425
std::string queryId;
std::string_view query;
bool succeeded{true};
std::string errorMessage;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be an std::optional?

std::string errorMessage;
/// Serialized query plan for downstream logging.
std::string planString;
uint64_t parseMicros{0};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would you document all the fields?

I think we need timing for parsing, optimizing and execution. optimizeMicros is missing.

uint64_t executionMicros{0};
int64_t numOutputRows{0};
std::chrono::system_clock::time_point createTime;
std::chrono::system_clock::time_point endTime;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's change the order of fields to match QueryCompletionInfo.

  • queryId
  • query
  • createTime
  • endTime
  • succeeded
  • optional errorMessage
  • parseMicros
  • optimizeMicros
  • executeMicros
  • numOutputRows
  • planString

Let's discuss whether we want a flat struct or perhaps group related fields into their own structs.

For example, I expect we'll want more execution stats beyond numOutputRows. Similarly, we may want more info about the plan shape. Maybe it doesn't make sense to duplicate QueryStartInfo fields, but rather add a field of type QueryStartInfo. Let's discuss.

amitkdutta added a commit to amitkdutta/axiom that referenced this pull request Mar 17, 2026
…r#1057)

Summary:

Add optional start and completion callbacks to Console so callers can
hook into the query lifecycle for logging, metrics, or other processing.

- startCallback: invoked before parse for every query.
- completionCallback: invoked after execution with query timing, row
  counts, and success/failure status.

Reviewed By: hdikeman

Differential Revision: D96492425
amitkdutta added a commit to amitkdutta/axiom that referenced this pull request Mar 17, 2026
…r#1057)

Summary:
Pull Request resolved: facebookincubator#1057

Add optional start and completion callbacks to Console so callers can
hook into the query lifecycle for logging, metrics, or other processing.

- startCallback: invoked before parse for every query.
- completionCallback: invoked after execution with query timing, row
  counts, and success/failure status.

Reviewed By: hdikeman

Differential Revision: D96492425
amitkdutta added a commit to amitkdutta/axiom that referenced this pull request Mar 17, 2026
…r#1057)

Summary:

Add optional start and completion callbacks to Console so callers can
hook into the query lifecycle for logging, metrics, or other processing.

- startCallback: invoked before parse for every query.
- completionCallback: invoked after execution with query timing, row
  counts, and success/failure status.

Reviewed By: hdikeman

Differential Revision: D96492425
…r#1057)

Summary:

Add optional start and completion callbacks to Console so callers can
hook into the query lifecycle for logging, metrics, or other processing.

- startCallback: invoked before parse for every query.
- completionCallback: invoked after execution with query timing, row
  counts, and success/failure status.

Reviewed By: hdikeman

Differential Revision: D96492425
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot. fb-exported meta-exported

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants