Hi,
while working on an app that connects to our JIRA Server using Atlassian SDK, I noticed a strange thing - when calling GetChangeLogsAsync, I do not get all the change logs, just some of the latests (or it seems so). This seems to be especially true for worklog related items storing changes of timespent and timeestimate, which is what I am interested in.
I need to track how Remaining Time evolves over time and for that I need to track it via records in change logs. However for older issues there are NO change logs with this information returned, even though the value was changed. When I do exactly the same action with a new issue, I can see and fetch these change logs just fine.
GetChangeLogsAsync is using an API call
rest/api/2/issue/{issuekey}?fields=created&expand=changelog
does that works on those issues where yoou can't find the log?
also, you can try to get the values rigtht from the DB:
SELECT p.pname, p.pkey, i.issuenum, cg.ID, cg.issueid, au.lower_user_name, cg.AUTHOR, cg.CREATED, ci.FIELDTYPE, ci.FIELD, ci.OLDVALUE, ci.OLDSTRING, ci.NEWVALUE, ci.NEWSTRING
FROM changegroup cg
inner join jiraissue i on cg.issueid = i.id
inner join project p on i.project = p.id
inner join changeitem ci on ci.groupid = cg.id
inner join app_user au on cg.author = au.user_key
WHERE cg.issueid=(select id from jiraissue where issuenum = 24 and project in (select id from project where pname = 'Peticiones'))
order by 1,3,4;
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I cannot access the DB, I work for a big corporation..
Anyway - I do not believe the API call you mentioned is used there because when I execute it in the browser, the data I am looking for are there. When I use this GetChangeLogsAsync function, they are missing, not returned it seems. Why the heck would be "older" records not returned? And what is "older"? It is quite frustrating, to be honest.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Doen't seems to make sense.
This is the method definition from
public async Task<IEnumerable<IssueChangeLog>> GetChangeLogsAsync(string issueKey, CancellationToken token = default(CancellationToken)) { var resourceUrl = String.Format("rest/api/2/issue/{0}?fields=created&expand=changelog", issueKey); var serializerSettings = _jira.RestClient.Settings.JsonSerializerSettings; var response = await _jira.RestClient.ExecuteRequestAsync(Method.GET, resourceUrl, null, token).ConfigureAwait(false); var result = Enumerable.Empty<IssueChangeLog>(); var changeLogs = response["changelog"]; if (changeLogs != null) { var histories = changeLogs["histories"]; if (histories != null) { result = histories.Select(history => JsonConvert.DeserializeObject<IssueChangeLog>(history.ToString(), serializerSettings)); } } return result; }
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You see, I get ALL logs related to changes of STATUS, RESOLUTION etc. But when it comes to time tracking, I get only "recent" logs. For example, I am getting two logs I created today, but it does not return the one I created on Friday. All are the same - logging work.
EDIT: Funny thing, in the JSON I can see "timespent" and "timeestimate" data with correct values, but they are NOT shown in the resulting object in C#..
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
logging work is a little tricky, Jira stores them in a different table in the DB. Don't know right now if it saves the recent ones with some purpose. Let me check it
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The problem is - if the time tracking change is new, it IS returned as a part of the changelog - I am getting "timespent" from and to. And it is also shown in the JIRA UI.
But for older issues it seems it is neither returned nor shown in the UI.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I have checked the DB, both tables save the info. worklog and changeitem (joined with changegroup)
I can't figure out no reason why you lost that kind of logs
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
It must be some server feature that prevents older time-related logs from returning?
You can try it yourself:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The problem is - if the time tracking change is new, it IS returned as a part of the changelog - I am getting "timespent" from and to. And it is also shown in the JIRA UI.
But for older issues it seems it is neither returned nor shown in the UI.
and do they appear when you send the rest API request?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I noticed that the following record is only visible for recent changes - no older issues have this visible in their activity logs:
And this is obviously related - once this is not shown anymore in the UI, it is also not returned by the API.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.