Skip to content

Conversation

misraved
Copy link
Contributor

Example query results

Results
Add example SQL query results here (please include the input queries as well)

@misraved misraved requested review from ParthaI and Copilot May 27, 2025 13:22
@misraved misraved self-assigned this May 27, 2025
Copilot

This comment was marked as outdated.

@cbruno10
Copy link
Contributor

A few questions after reviewing the PR:

  • Are the issue APIs the only ones we can make parallel page requests for?
  • Is workers the correct config arg name? I'm confused by the name, as it seems like it's a Steampipe configuration, not a plugin or table configuration.
  • Should the parallel page retrieval functionality be integrated into the plugin SDK instead of being handled on a per table basis? This is probably something we should discuss with @kaidaguerre.

return nil, nil
}

var starts []int

Choose a reason for hiding this comment

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

why is this needed? can't we just use these loop params on line 288?

Copy link

@kaidaguerre kaidaguerre Jun 2, 2025

Choose a reason for hiding this comment

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

Should the parallel page retrieval functionality be integrated into the plugin SDK instead of being handled on a per table basis?

Possibly - but I would tend to wait until we establish a need/use case across multiple tables/plugins before making an API change

"epic": getFieldKey(ctx, d, names, "Epic Link"),
"sprint": getFieldKey(ctx, d, names, "Sprint"),
}
d.StreamListItem(ctx, IssueInfo{issue, keys})

Choose a reason for hiding this comment

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

The SDK is not expecting concurrent calls to this function, so locking is recommended

Choose a reason for hiding this comment

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

ON the whole I think this PR seems OK however as mentioned, StreamListItem was not intended to be called in parallel so there is potential for race conditions within the state management code.

SImplest way to fix would probably be to put a mutex lock around the call to StreamListItem

Copy link

github-actions bot commented Aug 1, 2025

This PR is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 30 days.

@github-actions github-actions bot added the stale No recent activity has been detected on this issue/PR and it will be closed label Aug 1, 2025
@misraved misraved requested a review from Copilot August 6, 2025 06:29
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR enhances the Jira plugin by adding configurable worker concurrency, optimizing issue listing with dynamic field selection, and improving connection handling with better variable naming and error management.

  • Adds configurable workers parameter to enable parallel API requests for better performance
  • Optimizes issue listing by implementing dynamic field selection and parallel processing with goroutines
  • Improves code quality with better variable naming (snake_case to camelCase) and cleaner connection handling

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
jira/utils.go Adds worker management functions, dynamic field selection, and improves variable naming in connection handling
jira/table_jira_issue.go Implements parallel processing for issue listing with worker pools and optimizes API requests
jira/table_jira_issue_worklog.go Fixes variable reference bug in worklog streaming
jira/connection_config.go Adds workers configuration field to connection config
docs/index.md Documents the new workers configuration parameter
config/jira.spc Updates sample configuration with workers parameter


d.ConnectionManager.Cache.Set(cacheKey, maxWorkers)

plugin.Logger(ctx).Warn("getMaxWorkers", "found_workers", maxWorkers)
Copy link
Preview

Copilot AI Aug 6, 2025

Choose a reason for hiding this comment

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

Using Warn level logging for normal configuration information is inappropriate. This should use Debug or Info level instead, as finding workers configuration is not a warning condition.

Suggested change
plugin.Logger(ctx).Warn("getMaxWorkers", "found_workers", maxWorkers)
plugin.Logger(ctx).Info("getMaxWorkers", "found_workers", maxWorkers)

Copilot uses AI. Check for mistakes.

@@ -244,75 +245,92 @@ func tableIssue(_ context.Context) *plugin.Table {

//// LIST FUNCTION

// The listIssues function first makes an initial request to determine the total number of issues without expanding any fields for efficiency. Subsequent paginated requests use the 'names' expansion to retrieve batches of issues with field names resolved.
Copy link
Preview

Copilot AI Aug 6, 2025

Choose a reason for hiding this comment

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

The comment describes using 'names' expansion in subsequent requests, but the code actually uses 'names' expansion for all paginated requests, not just subsequent ones. The comment should be updated to accurately reflect the implementation.

Suggested change
// The listIssues function first makes an initial request to determine the total number of issues without expanding any fields for efficiency. Subsequent paginated requests use the 'names' expansion to retrieve batches of issues with field names resolved.
// The listIssues function first makes an initial request to determine the total number of issues without expanding any fields for efficiency. All subsequent paginated requests use the 'names' expansion to retrieve batches of issues with field names resolved.

Copilot uses AI. Check for mistakes.

}
mu.Lock()
d.StreamListItem(ctx, IssueInfo{issue, keys})
mu.Unlock()
Copy link
Preview

Copilot AI Aug 6, 2025

Choose a reason for hiding this comment

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

The mutex is held while calling d.StreamListItem() which could be a blocking operation. This reduces the benefits of parallel processing. Consider using a channel to collect results and stream them from the main goroutine instead.

Copilot uses AI. Check for mistakes.

d.StreamListItem(ctx, IssueInfo{issue, keys})
mu.Unlock()

if d.RowsRemaining(ctx) == 0 {
Copy link
Preview

Copilot AI Aug 6, 2025

Choose a reason for hiding this comment

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

Checking d.RowsRemaining() inside the goroutine while holding a mutex may not accurately reflect the global state across all workers. This could lead to race conditions where multiple workers continue processing after the limit is reached.

Copilot uses AI. Check for mistakes.

@github-actions github-actions bot removed the stale No recent activity has been detected on this issue/PR and it will be closed label Aug 6, 2025
@misraved misraved marked this pull request as draft September 8, 2025 06:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support for parallelized pagination to improve large Jira query performance
3 participants