Closed JohnQ00 closed 1 year ago
https://github.com/shijl0925/python-sonarqube-api/issues/69#issuecomment-1365708373 Is this answer useless for your question?
No, it's useful, but for daily data of the path and their components. For historical data is returning only dates when I use sonarqube.measures.search_measures_history
, when I use sonar.measure.get_component_tree_with_specified_measures
it returns me only the current value of the BaseComponent, which is the component I want to be check the historic of data.
What I want is the status of data in past days and today, not only today, which is working perfectly, for this I'm using the search_measures_history
, this method is returning me the historical data for normal components, but for components with path it doesn't return me the field 'value', only dates.
Using search_measures_history
in component = "my_project"
:
[{'metric': 'code_smells', 'history': [{'date': '2021-10-06T17:29:17+0000', 'value': '4476'}, {'date': '2021-11-19T13:25:36+0000', 'value': '4818'}, {'date': '2021-12-31T21:18:26+0000', 'value': '4459'}, {'date': '2022-01-16T11:45:23+0000', 'value': '4459'}, {'date': '2022-01-19T17:04:46+0000', 'value': '3761'}, {'date': '2022-01-20T05:51:13+0000', 'value': '3761'}, {'date': '2022-01-29T05:50:29+0000', 'value': '3625'}, {'date': '2022-02-02T05:45:34+0000', 'value': '3625'}, {'date': '2022-02-03T08:25:03+0000', 'value': '3625'}, {'date': '2022-02-04T08:49:08+0000', 'value': '3625'}, {'date': '2022-02-04T23:30:25+0000', 'value': '3625'}, {'date': '2022-02-05T08:27:55+0000', 'value': '3625'}, {'date': '2022-02-06T08:19:23+0000', 'value': '3625'}, {'date': '2022-02-07T08:22:38+0000', 'value': '3625'}, {'date': '2022-02-07T14:10:08+0000', 'value': '3625'}}]
Using in component = "my_project:/src/foo/"
:
[{'metric': 'code_smells', 'history': [{'date': '2021-10-06T17:29:17+0000'}, {'date': '2021-11-19T13:25:36+0000'}, {'date': '2021-12-31T21:18:26+0000'}, {'date': '2022-01-04T22:39:37+0000'}, {'date': '2022-01-14T11:32:41+0000'}, {'date': '2022-01-15T11:41:10+0000'}, {'date': '2022-01-16T11:45:23+0000'}, {'date': '2022-01-17T11:43:45+0000'}, {'date': '2022-01-17T22:54:13+0000'}, {'date': '2022-01-18T11:54:03+0000'}, {'date': '2022-01-19T17:04:46+0000'}, {'date': '2022-01-20T05:51:13+0000'}, {'date': '2022-01-21T05:41:53+0000'}, {'date': '2022-01-22T05:44:52+0000'}, {'date': '2022-01-23T05:46:08+0000'}, {'date': '2022-01-24T05:42:13+0000'}, {'date': '2022-01-24T20:50:30+0000'}, {'date': '2022-01-25T05:45:52+0000'}, {'date': '2022-01-26T05:48:10+0000'}, {'date': '2022-01-27T05:44:23+0000'}, {'date': '2022-01-27T19:23:21+0000'}, {'date': '2022-01-28T05:54:39+0000'}, {'date': '2022-01-28T18:17:28+0000'}, {'date': '2022-01-29T05:50:29+0000'}, {'date': '2022-01-30T05:48:26+0000'}, {'date': '2022-01-31T05:51:34+0000'}, {'date': '2022-02-01T05:52:32+0000'}}]
search_measures_history only support search measures history of the 'project type' component.
Hi, after using the answer to my first issue I successfully collected instant data, but when I tried to return the historical data it returned me nothing, except for the dates.
Illustrating what I did:
sonarqube.measures.search_measures_history('key:path', branch = 'master', fields = "metrics", metrics = 'code_smells')
[{'metric': 'code_smells', 'history': [{'date': '2021-10-06T17:29:17+0000'}, {'date': '2021-11-19T13:25:36+0000'}, {'date': '2021-12-31T21:18:26+0000'}, {'date': '2022-01-04T22:39:37+0000'}, {'date': '2022-01-14T11:32:41+0000'}, {'date': '2022-01-15T11:41:10+0000'}, {'date': '2022-01-16T11:45:23+0000'}, {'date': '2022-01-17T11:43:45+0000'}, {'date': '2022-01-17T22:54:13+0000'}, {'date': '2022-01-18T11:54:03+0000'}, {'date': '2022-01-19T17:04:46+0000'}, {'date': '2022-01-20T05:51:13+0000'}, {'date': '2022-01-21T05:41:53+0000'}, {'date': '2022-01-22T05:44:52+0000'}, {'date': '2022-01-23T05:46:08+0000'}, {'date': '2022-01-24T05:42:13+0000'}, {'date': '2022-01-24T20:50:30+0000'}, {'date': '2022-01-25T05:45:52+0000'}, {'date': '2022-01-26T05:48:10+0000'}, {'date': '2022-01-27T05:44:23+0000'}, {'date': '2022-01-27T19:23:21+0000'}, {'date': '2022-01-28T05:54:39+0000'}, {'date': '2022-01-28T18:17:28+0000'}, {'date': '2022-01-29T05:50:29+0000'}, {'date': '2022-01-30T05:48:26+0000'}, {'date': '2022-01-31T05:51:34+0000'}, {'date': '2022-02-01T05:52:32+0000'}}]
Why is this happening? And how to return properly the value of a folder?Thank you in advance.