The build is green, the release ships, and three weeks later an incident exposes a flaw that static analysis already knew about. The code review tool is not the problem: its results live far from what you observe in production. Bringing SonarQube Dynatrace data into one query space closes that gap. This article starts from one operating decision, what to fix first, and derives the setup and the queries from it.
The facts come from the Dynatrace documentation on ingesting SonarQube data. The vendor’s announcement post was the starting point; it gives no procedure, so every technical detail below comes from the documentation. The queries are my own and were not run on a tenant: test them on a small scope first. This content applies to Dynatrace SaaS; the documentation I read does not cover Dynatrace Managed.
This article is only about SonarQube. For another scanner, see GitHub Advanced Security alerts with runtime context.
SonarQube Dynatrace: why bring the findings in
A list of vulnerabilities without context forces you to treat everything with the same urgency. Yet a flaw in an exposed service called on every request does not weigh like one in a rarely used internal tool. From an SRE angle, this is an error budget trade-off: every urgent fix eats delivery time.
The integration brings three things. Findings land in Grail, so in the same Notebooks as your logs and metrics. They carry normalised fields, such as a risk level. Finally, the documentation says the asset type is CODE_ARTIFACT, which allows linking them to what runs in production. I did not test that link: the steps here stop at the ingested data.
What the extension collects
- vulnerability findings (
VULNERABILITY_FINDING) and scan coverage events (VULNERABILITY_SCAN); - SonarQube audit logs, stored as logs;
- quality metrics: vulnerabilities, hotspots, bugs, coverage, duplication, code smells;
- SDLC events of type
control, which record the assessment of an artifact in the delivery pipeline.
The vendor’s post says both SonarQube Cloud and SonarQube Server are covered. The documentation page itself does not list editions: I only rely on it for the API (the server Web API v1).
Prerequisites to connect SonarQube to Dynatrace
The documentation sets few conditions, but they are strict:
- a SonarQube API token with system administrator rights and the
Browsepermission on the projects to monitor; - an ActiveGate at version 1.313 or later, able to run the Extensions 2.0 framework and reach the SonarQube URL;
- a Dynatrace access token with the
openpipeline.events_securityandopenpipeline.events_sdlcscopes.
If ActiveGate is new to you, read the difference between environment and cluster ActiveGates. For how extensions work, the PostgreSQL extension article shows the same install cycle.
Installing the extension, step by step
- Search for SonarQube in Dynatrace and choose Install.
- Follow the configuration screens: SonarQube server address, token, collection interval.
- Check that data arrives with three queries in a Notebook.
The interval matters. On each run, the extension fetches findings generated during the last n hours, where n is the chosen interval. The first collection fetches those updated during the last m hours, per the first-ingest setting. Pick both values from the cadence of your scans, otherwise you lose findings or receive duplicates.
One point surprises teams: without a recent scan, nothing is ingested, even if a project has open issues in SonarQube. Run a scan before concluding the extension is broken.
How to check that it works
The three queries below follow the documentation. They cover audit logs, scan coverage and SDLC events:
The findings themselves sit in the default_securityevents Grail bucket, and the raw JSON of each issue is kept in dt.raw_data. According to the documentation, billing follows the Events powered by Grail model: estimate the volume before enabling every project.
Prioritising SonarQube findings: three queries
Who carries the risk?
Dynatrace derives dt.security.risk.level from the finding severity. Per the documentation, BLOCKER and CRITICAL map to CRITICAL, while MINOR and LOW map to LOW. This normalisation lets you compare SonarQube with other finding sources in a single query. Group by project:
fetch security.events
| filter dt.system.bucket == "default_securityevents"
| filter event.provider == "SonarQube"
and event.type == "VULNERABILITY_FINDING"
| summarize findings = count(),
by: {sonarqube.project.name, dt.security.risk.level}
| sort findings desc
The top project is not necessarily the most urgent: compare the list with the business criticality of each service. The code.filepath and code.line.number fields then point to the faulty line, which saves a round trip to the SonarQube interface.
Is security debt growing?
Metrics track a trend, not a single case. A graph that climbs sprint after sprint justifies a team discussion:
Mind the naming: the documentation cites sonarqube.bugs, while the Hub release notes mention a rename to sonarqube.code.bugs. I did not settle which one applies: open your tenant’s metric browser before writing alerts.
Can a release go out?
SDLC events answer that question. They feed automated checks, for example in a release Site Reliability Guardian. I did not verify how to wire an objective directly on these events: the documentation I read does not explain it.
Best practices
- Limit the SonarQube token to the projects you need, even though the documentation asks for a system administrator role: store it as a secret.
- Align the collection interval with the frequency of your CI scans.
- Save queries in a shared Notebook, then in a Dashboard once stable.
- Watch Grail billing from the first days.
Frequently asked questions
Does Dynatrace replace SonarQube?
No. SonarQube analyses the code; Dynatrace receives the results and sets them beside production. The analysis itself stays in SonarQube.
Why do no findings appear when SonarQube has issues?
The documentation states that without a scan during the collection window, nothing is ingested. Check the date of the last scan, the configured interval and the scopes of the Dynatrace token.
Does this work on Dynatrace Managed?
I could not verify it: the documentation I read does not say, and the data goes to Grail. This article covers Dynatrace SaaS only.
Conclusion
A useful finding is one you can locate, rank and follow. Connecting SonarQube to Dynatrace takes an ActiveGate, two scopes and a token; the gain then shows up as faster decisions. Start with one project, validate the three verification queries, then widen the scope.
Independent blog, not affiliated with Dynatrace LLC. Dynatrace is a trademark of Dynatrace LLC; SonarQube belongs to its publisher.
Originally published on span.observer. French version: https://span.observer/fr/sonarqube-dynatrace-findings-securite/.



Top comments (0)