elastic / connectors

Source code for all Elastic connectors, developed by the Search team at Elastic, and home of our Python connector development framework
https://www.elastic.co/guide/en/enterprise-search/master/index.html
Other
58 stars 116 forks source link

JIRA worklogs are limited to 20 #2634

Open salyia opened 2 weeks ago

salyia commented 2 weeks ago

Bug Description

Due to the limitation of the v2 JIRA endpoint used in the Connector program, for any JIRA issues the maximum number of worklogs are limited to 20.

This is a limitation of the REST API endpoint the connector uses: https://community.developer.atlassian.com/t/failed-to-get-more-than-the-maxresults-limit-for-worklogs-for-an-issue-through-rest-api/78720/3

To Reproduce

Check any JIRA tickets with at least 21 worklog entries. Then check the imported JIRA ticket in Elasticsearch.

Expected behavior

Imported JIRA issues contain all the worklogs created.

Environment

This is environment independent.

Additional context

You can use the v3 endpoint (see link), e.g. https://YOUR_JIRA_URL/rest/api/3/issue//worklog to retrieve up to 5000 worklog entries. (So it's still not infinite, but this is again a JIRA limitation) and much greater than 20.

The result is a JSON structure that can be inserted into the ticket, like this

ticket = runSomeJiraAPICall("/rest/api/2/issue/SOMEISSUE")
worklogs_from_v3_issue_endpoint = runSomeJiraApiCall("/rest/api/3/issue/SOMEISSUE/worklog")
# ticket has only 20 worklogs due to v2 REST API endpoint limitation
del ticket['fields']['worklog']
ticket['fields']['worklog'] = worklogs_from_v3_issue_endpoint
seanstory commented 2 weeks ago

Hi @salyia , thanks for filing.

Looking at https://developer.atlassian.com/cloud/jira/platform/rest/v3/intro/#about, it seems that the JIRA V3 API is still in beta. We're not likely to leverage beta APIs in our connectors, though we'll look forward to upgrading when they fully certify the V3 API.

In the mean time, I suggest you engage with Atlassian support, and push for them to make improvements to the V2 API.

Alternatively, you're welcome to fork the connector and make changes to it in your own fork to leverage V3 endpoints. We're unlikely to consider merging them into our remote, though.