Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add changelog column to jira_issues #149

Merged
merged 2 commits into from
Feb 20, 2025
Merged

Conversation

mariusgrigaitis
Copy link
Contributor

@mariusgrigaitis mariusgrigaitis commented Feb 17, 2025

Example query results

Results
SELECT LEFT(changelog::text, 21) AS changelog FROM jira_issue WHERE key='JIRA-120'

Returns changelog (JSON)

+-----------------------+
| changelog             |
+-----------------------+
| {"histories": [{"id": |
+-----------------------+

Copy link
Contributor

@misraved misraved left a comment

Choose a reason for hiding this comment

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

Thank you @mariusgrigaitis for raising the PR 👍 !!

Could you please add a sample result in the PR body?

Co-authored-by: Ved misra <47312748+misraved@users.noreply.github.com>
@mariusgrigaitis
Copy link
Contributor Author

Thank you @mariusgrigaitis for raising the PR 👍 !!

Could you please add a sample result in the PR body?

Thanks for review. I have updated sample results as well as added your suggestion.

However due to size of changelogs (JSON), I have truncated the sample output.

@ParthaI
Copy link
Contributor

ParthaI commented Feb 18, 2025

Hello @mariusgrigaitis,

Would it be possible to append changelog to the expand input parameter based on the select statement?

This adjustment could help optimize query execution time when the changelog column is not included in the select statement. Additionally, it may help reduce the likelihood of hitting rate limits while making API calls for the larger environments.

Below is a suggested code change for consideration:

options := jira.SearchOptions{
		StartAt:    0,
		MaxResults: limit,
		Expand:     "names",
	}

	if slices.Contains(d.QueryContext.Columns, "changelog") {
		options.Expand = options.Expand + ", changelog"
	}

Let me know your thoughts on this approach. Thanks! 🚀

@mariusgrigaitis
Copy link
Contributor Author

I wonder if it does have a side-effect on caching? Aka if you fetch a record first without changelog and later - with, I believe you would get the cached version

@ParthaI
Copy link
Contributor

ParthaI commented Feb 18, 2025

I wonder if it does have a side-effect on caching? Aka if you fetch a record first without changelog and later - with, I believe you would get the cached version

That is correct; we might have a cache issue in this case.

@ParthaI
Copy link
Contributor

ParthaI commented Feb 18, 2025

Commenting here for future reference, as we have some alternative approaches:

  1. Adding a separate hydrate call for the changelog column:

    • This method would retrieve the changelog value separately.
    • However, it's not ideal because it would significantly increase the number of API calls, making one call per row, which could impact performance.
  2. Using conditional logic to determine when to fetch changelog:

    • We could modify the API call logic to include changelog only when it is explicitly requested in the SELECT statement.
    • However, this approach introduces a caching issue. Steampipe handles caching at a higher level, meaning the cache check happens before reaching the Steampipe table logic. As a result, the conditional API call logic inside the table would not function as expected.

@ParthaI
Copy link
Contributor

ParthaI commented Feb 19, 2025

Hello @mariusgrigaitis,

Could you please review the discussion and make any necessary changes based on it, if required?

Thank you!

@mariusgrigaitis
Copy link
Contributor Author

@ParthaI as per discussion, I don't believe any changes are required with assumption that adding expand is not expensive (and I don't believe it is)

@misraved misraved merged commit 5526b7c into turbot:main Feb 20, 2025
1 check passed
@mariusgrigaitis mariusgrigaitis deleted the changelog branch February 20, 2025 13:29
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.

3 participants