惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

月光博客
月光博客
人人都是产品经理
人人都是产品经理
博客园 - 聂微东
WordPress大学
WordPress大学
S
SegmentFault 最新的问题
博客园 - Franky
V
V2EX
Y
Y Combinator Blog
Google DeepMind News
Google DeepMind News
J
Java Code Geeks
T
The Blog of Author Tim Ferriss
罗磊的独立博客
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Jina AI
Jina AI
博客园 - 叶小钗
F
Fortinet All Blogs
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
A
About on SuperTechFans
M
MIT News - Artificial intelligence
云风的 BLOG
云风的 BLOG
Last Week in AI
Last Week in AI
D
Docker
博客园 - 【当耐特】
阮一峰的网络日志
阮一峰的网络日志

Datadog | The Monitor blog

Introducing our open source AI-native SAST Instrument and monitor Boomi integration flows with OpenTelemetry and Datadog Not all index scans are equal: How we cut query latency by over 99% Platform engineering metrics: What to measure and what to ignore Integrate Recorded Future threat intelligence with Datadog Cloud SIEM CI/CD security: threat modeling using a MITRE-style threat matrix CI/CD security: How to secure your GitHub ecosystem Ingress NGINX is EOL: A practical guide for migrating to Kubernetes Gateway API Operating agentic AI with Amazon Bedrock AgentCore and Datadog LLM Observability: Lessons from NTT DATA Introducing the Datadog Code Security MCP Capture and analyze custom heatmaps in Session Replay Understand session replays faster with AI summaries and smart chapters Monitor ClickHouse query performance with Datadog Database Monitoring How we designed empathetic alert sounds for on-call engineers Search and act across Datadog to resolve issues faster with Bits Assistant Measure the business impact of every product change with Datadog Experiments Analyzing round trip query latency Configuring JavaScript caches for better performance Introducing Bits AI Dev Agent for Code Security Datadog achieves ISO 42001 certification for responsible AI Monitor Nutanix clusters, hosts, and VMs with Datadog Monitor Juniper Mist in Datadog A new Host Map for modern infrastructure Annotate traces to improve LLM quality with Datadog LLM Observability What’s new in Cloud SIEM: AI-powered investigations, enhanced threat intelligence, and scalable security operations Explore Kubernetes with native OpenTelemetry data Monitor Oracle Fusion Cloud Applications with Datadog Announcing the Datadog Terraform provider v4.0.0 Scaling Kubernetes workloads on custom metrics How to design cloud environments for AI-powered threat analysis
Monitor code quality in Datadog with SonarQube
Mary Jac Heuman · 2021-03-18 · via Datadog | The Monitor blog
Mary Jac Heuman

Mary Jac Heuman

SonarQube is a tool for static code analysis that integrates with your existing CI pipelines to run quality checks on your codebase as it changes. As you develop and release new code, constant monitoring of code quality is crucial to ensure compliance, stability, and security. SonarQube’s Clean-As-You-Code philosophy helps to avoid technical debt by running regular code checks and alerting you to any problems early on.

Datadog’s SonarQube integration collects key metrics and logs that provide greater visibility into the quality and stability of your code during the development process, as well as the health and performance of your SonarQube server itself, whether it’s on-premise or in a containerized environment.

In this post, we’ll explore how Datadog helps you:

  • visualize and monitor key code metrics

  • collect and analyze SonarQube logs for insight into its status

  • alert on code-level security issues as part of your code checks

To get started right away, you can see our documentation for instructions on how to configure the Datadog Agent and enable log collection to point to your codebase and SonarQube instance.

Monitor code quality over time, in real time

SonarQube uses a scanner to run code checks as part of your CI pipeline. The scanner performs a static code analysis and calculates metrics that measure aspects of your code, such as duplications, maintainability, security, test coverage, and reliability. The scanner sends these metrics to a hosted instance of the SonarQube server. Once you’ve enabled the SonarQube integration, the Datadog Agent collects metrics from both the scanner’s exposed web endpoint that sends the code check results, as well as the JMX endpoint that emits health and performance data about the server itself. The integration auto-detects all the projects analyzed by the scanner, ensuring setup remains trivial even when your organization is maintaining thousands of projects.

You can use Datadog to create dashboards that visualize key SonarQube metrics to give you high-level insights into your code reviews. For example, you may want to see results of the most recent code check, including an up-to-date maintainability rating, along with quality metrics like sonarqube.maintainability.code_smells and sonarqube.complexity to illustrate your codebase’s change over time.

Sonarqube preset dashboard

You can easily add widgets to track specific patterns of code activity over time and provide context around the most recent SonarQube scanner reports. And, with Datadog’s more than 1,000 other integrations, you can correlate SonarQube data with metrics from other parts of your CI pipeline like Jenkins or AWS services.

Collect logs to track the health of your SonarQube server

Datadog collects key SonarQube server metrics, including compute engine errors (sonarqube.server.compute_engine_tasks.error_count) and active database connections (sonarqube.server.database.pool_active_connections), that help administrators monitor the SonarQube instance’s activity and ensure it’s behaving as expected. Ingesting SonarQube logs with Datadog provides even more visibility into your server’s activity to troubleshoot issues. SonarQube produces logs for four separate processes:

  • the main SonarQube process (sonar.log.level.app)

  • the WebServer running the HTTP endpoint for the scanner (sonar.log.level.web)

  • the ComputeEngineServer calculating data about your code (sonar.log.level.ce)

  • the Elasticsearch SearchServer handling search requests (sonar.log.level.es)

Datadog’s log processing pipeline parses your SonarQube logs and extracts key metadata you can use to filter, sort, and search your logs. This makes it easy, for instance, to filter your logs for out-of-memory errors from a background task emitted by the main process, which would indicate you should reallocate more memory for SonarQube. When SonarQube reports an error, Datadog includes the full recorded stack trace to troubleshoot the issue.

Sonarqube logs in the Datadog Log Explorer

Catch code vulnerabilities

SonarQube reports security-related metrics by scanning for vulnerabilities and hotspots against configurable rules based on security standards including OWASP, SANS, and CWE. For instance, the security.new_security_rating metric assigns a score from one to five (indicating an A–F letter grade) based on the results of the scanner’s latest report.

With Datadog, you can alert on these metrics to know right away if a code change exposes your application to security threats. For example, SonarQube will raise a CRITICAL violation when it finds a bug that represents an urgent security issue, such as vulnerability to a SQL injection. In this case, you would define an alert to trigger as soon as sonarqube.issues.new_critical_violations > 0, and send notifications to different members of your team or declare an incident.

## Start monitoring SonarQube today

With Datadog’s SonarQube integration, you can get high-level insights into your codebase’s quality and create alerts to notify on critical vulnerabilities. By visualizing and aggregating metrics and logs, you can monitor your code deployments alongside your entire CI/CD pipeline. Visit our documentation to start collecting data from SonarQube today. Or, if you’re new to to Datadog, start your free trial. today.