return200-ok / sonarqube_prometheus_exporter

sonarqube exporter
GNU General Public License v3.0
5 stars 5 forks source link

Several messages in docker logs and no information for prometheus. #2

Open kad-meedel opened 1 year ago

kad-meedel commented 1 year ago

When I try to run the prometheus exporter with the compose option I get a lot of the following errors: 2023-08-31 09:58:34,430 [MainThread ] [DEBUG] Starting new HTTPS connection (1): 'sonarqubenode':443 2023-08-31 09:58:34,645 [MainThread ] [DEBUG] https://'sonarqubenode':443 "GET /api/system/info HTTP/1.1" 200 None argument of type 'int' is not iterable

And the api/metrics/search has several messages: metrics is not supported 2023-08-31 09:57:29,304 [MainThread ] [DEBUG] https://'sonarqubenode':443 "GET /api/metrics/search HTTP/1.1" 200 None 2023-08-31 09:57:29,335 [MainThread ] [DEBUG] https://'sonarqubenode':443 "GET /api/metrics/search?p=2 HTTP/1.1" 200 None metrics is not supported

Running the requested info within the container with curl the output looks oke.

jadesoturi commented 1 year ago

I have the same issue and no data in grafana. Deployed in k8s without the bundeled grafana and prometheus as we have our own. I see the scrape target in grafana, but it seem that its only reporting data for the sonarqube_exporter it self, and not the actuall analytics data.

SonarQube Developer edition version 9.9.1 - please advise!

//jadesoturi

ganeshcpote commented 1 year ago

I have same the issue. There is no data in the Grafana. I am using SonarQube Community EditionVersion 9.9.2 (build 77730). Please let me know if anyone found the solution on this. @jadesoturi @kad-meedel @return200-ok - any solution you may know to resolve this issue?

sonarqube-exporter_1 | 2023-09-13 16:11:35,514 [MainThread ] [DEBUG] Starting new HTTP connection (1): sonarqube99:9000 sonarqube-exporter_1 | 2023-09-13 16:11:35,531 [MainThread ] [DEBUG] http://sonarqube99:9000 "GET /api/system/info HTTP/1.1" 200 None sonarqube-exporter_1 | argument of type 'int' is not iterable sonarqube-exporter_1 | 2023-09-13 16:11:35,533 [MainThread ] [DEBUG] Starting new HTTP connection (1): sonarqube99:9000 sonarqube-exporter_1 | 2023-09-13 16:11:35,548 [MainThread ] [DEBUG] http://sonarqube99:9000 "GET /api/system/info HTTP/1.1" 200 None sonarqube-exporter_1 | argument of type 'int' is not iterable sonarqube-exporter_1 | 2023-09-13 16:11:35,550 [MainThread ] [DEBUG] Starting new HTTP connection (1): sonarqube99:9000

jadesoturi commented 1 year ago

Looks like the docker image hasn't been updated, even though the code in the repo has changed. The docker image contains a scan_metrics.py file instead of the analysis_metric.py, and there is quite a lot of code missing in the scan_metrics.py when compering the two.

@return200-ok could you update the docker image hosted at dockerhub?

kad-meedel commented 11 months ago

Hello @return200-ok Is it possible for you to spent some time to respond on the request of placing an updated version of your docker image on dockerhub? The present docker image is not working, and we would like to use it in our environment.

jadesoturi commented 11 months ago

I ended up building an images using the files in the repo and hosting it in our local harbor repository. it works, but still have issues with certain metrics giving No data in grafana. AFAICS the prometheus endpoint/target does not get that data. Been troubleshooting to see why its not stored, but haven't yet figured it out.

Here is the list of metrics that are empty in prom:

# HELP stat_rule Frequency of rule
# TYPE stat_rule gauge
# HELP project_analyses_and_events_info Description of project analyses
# TYPE project_analyses_and_events_info gauge
# HELP health_check_info Server health check
# TYPE health_check_info gauge
# HELP low_severity_vulns Low Severity Vulnerabilities
# TYPE low_severity_vulns gauge
# HELP sqale_rating Maintainability Rating
# TYPE sqale_rating gauge
# HELP new_maintainability_rating Maintainability Rating on New Code
# TYPE new_maintainability_rating gauge
# HELP major_violations Major Issues
# TYPE major_violations gauge
# HELP medium_severity_vulns Medium Severity Vulnerabilities
# TYPE medium_severity_vulns gauge
# HELP minor_violations Minor Issues
# TYPE minor_violations gauge
# HELP new_blocker_violations New Blocker Issues
# TYPE new_blocker_violations gauge
# HELP new_bugs New Bugs
# TYPE new_bugs gauge
# HELP new_code_smells New Code Smells
# TYPE new_code_smells gauge
# HELP new_critical_violations New Critical Issues
# TYPE new_critical_violations gauge
# HELP new_info_violations New Info Issues
# TYPE new_info_violations gauge
# HELP new_violations New Issues
# TYPE new_violations gauge
# HELP new_lines New Lines
# TYPE new_lines gauge
# HELP new_major_violations New Major Issues
# TYPE new_major_violations gauge
# HELP new_minor_violations New Minor Issues
# TYPE new_minor_violations gauge
# HELP new_security_hotspots New Security Hotspots
# TYPE new_security_hotspots gauge
# HELP new_vulnerabilities New Vulnerabilities
# TYPE new_vulnerabilities gauge
# HELP unanalyzed_c Number of unanalyzed c files
# TYPE unanalyzed_c gauge
# HELP unanalyzed_cpp Number of unanalyzed c++ files
# TYPE unanalyzed_cpp gauge
# HELP open_issues Open Issues
# TYPE open_issues gauge
# HELP projects Project branches
# TYPE projects gauge
# HELP public_api Public API
# TYPE public_api gauge
# HELP public_documented_api_density Public Documented API (%)
# TYPE public_documented_api_density gauge
# HELP public_undocumented_api Public Undocumented API
# TYPE public_undocumented_api gauge
# HELP alert_status Quality Gate Status
# TYPE alert_status gauge
# HELP releasability_rating Releasability rating
# TYPE releasability_rating gauge
# HELP reliability_rating Reliability Rating
# TYPE reliability_rating gauge
# HELP new_reliability_rating Reliability Rating on New Code
# TYPE new_reliability_rating gauge
# HELP reliability_remediation_effort Reliability Remediation Effort
# TYPE reliability_remediation_effort gauge
# HELP new_reliability_remediation_effort Reliability Remediation Effort on New Code
# TYPE new_reliability_remediation_effort gauge
# HELP reopened_issues Reopened Issues
# TYPE reopened_issues gauge
# HELP security_hotspots Security Hotspots
# TYPE security_hotspots gauge
# HELP security_hotspots_reviewed Security Hotspots Reviewed
# TYPE security_hotspots_reviewed gauge
# HELP new_security_hotspots_reviewed Security Hotspots Reviewed on New Code
# TYPE new_security_hotspots_reviewed gauge
# HELP security_rating Security Rating
# TYPE security_rating gauge
# HELP new_security_rating Security Rating on New Code
# TYPE new_security_rating gauge
# HELP security_remediation_effort Security Remediation Effort
# TYPE security_remediation_effort gauge
# HELP new_security_remediation_effort Security Remediation Effort on New Code
# TYPE new_security_remediation_effort gauge
# HELP security_review_rating Security Review Rating
# TYPE security_review_rating gauge
# HELP new_security_review_rating Security Review Rating on New Code
# TYPE new_security_review_rating gauge
# HELP security_hotspots_reviewed_status Security Review Reviewed Status
# TYPE security_hotspots_reviewed_status gauge
# HELP new_security_hotspots_reviewed_status Security Review Reviewed Status on New Code
# TYPE new_security_hotspots_reviewed_status gauge
# HELP security_hotspots_to_review_status Security Review To Review Status
# TYPE security_hotspots_to_review_status gauge
# HELP new_security_hotspots_to_review_status Security Review To Review Status on New Code
# TYPE new_security_hotspots_to_review_status gauge
# HELP skipped_tests Skipped Unit Tests
# TYPE skipped_tests gauge
# HELP statements Statements
# TYPE statements gauge
# HELP sqale_index Technical Debt
# TYPE sqale_index gauge
# HELP sqale_debt_ratio Technical Debt Ratio
# TYPE sqale_debt_ratio gauge
# HELP new_sqale_debt_ratio Technical Debt Ratio on New Code
# TYPE new_sqale_debt_ratio gauge
# HELP total_dependencies Total Dependencies
# TYPE total_dependencies gauge
# HELP releasability_effort Total number of projects not production ready
# TYPE releasability_effort gauge
# HELP total_vulnerabilities Total Vulnerabilities
# TYPE total_vulnerabilities gauge
# HELP uncovered_conditions Uncovered Conditions
# TYPE uncovered_conditions gauge
# HELP new_uncovered_conditions Uncovered Conditions on New Code
# TYPE new_uncovered_conditions gauge
# HELP uncovered_lines Uncovered Lines
# TYPE uncovered_lines gauge
# HELP new_uncovered_lines Uncovered Lines on New Code
# TYPE new_uncovered_lines gauge
# HELP test_execution_time Unit Test Duration
# TYPE test_execution_time gauge
# HELP test_errors Unit Test Errors
# TYPE test_errors gauge
# HELP test_failures Unit Test Failures
# TYPE test_failures gauge
# HELP tests Unit Tests
# TYPE tests gauge
# HELP test_success_density Unit Test Success (%)
# TYPE test_success_density gauge
# HELP vulnerabilities Vulnerabilities
# TYPE vulnerabilities gauge
# HELP vulnerable_component_ratio Vulnerable Component Ratio
# TYPE vulnerable_component_ratio gauge
# HELP vulnerable_dependencies Vulnerable Dependencies
# TYPE vulnerable_dependencies gauge
# HELP wont_fix_issues Won't Fix Issues
# TYPE wont_fix_issues gauge

@return200-ok would be great if you could reply here and help us all along a bit :)

kad-meedel commented 1 month ago

Anyone any news on this?

jadesoturi commented 1 month ago

It's been a while, but iirc I ended up buying the 5dollar python library he is using(the free version only allows certain metrics). Once you got that sorted the missing metrics appear. Its this one here: https://pypi.org/project/python-sonarqube-api/#description