DependencyTrack / dependency-track

Dependency-Track is an intelligent Component Analysis platform that allows organizations to identify and reduce risk in the software supply chain.
https://dependencytrack.org/
Apache License 2.0
2.45k stars 532 forks source link

Add project info to metrics API for projects #3918

Open 2000rosser opened 4 days ago

2000rosser commented 4 days ago

Description

Adds the project info to the metrics for /metrics/project/{uuid}/current and /metrics/project/{uuid}/since/{date}.

Addressed Issue

3884

Additional Details

The issue suggests having at least the project UUID in the output. I added the full project object which includes name, classifier, uuid, properties, tags, lastBomImport, lastBomImportFormat, lastInheritedRiskScore and active status. I can modify it to return less info if required. Sample output:

{
    "project": {
      "name": "syft",
      "classifier": "CONTAINER",
      "uuid": "db91ad63-7f76-43bf-85b0-e4c9606da398",
      "properties": [],
      "tags": [],
      "lastBomImport": 1719996165121,
      "lastBomImportFormat": "CycloneDX 1.5",
      "lastInheritedRiskScore": 43.0,
      "active": true
    },
    "critical": 0,
    "high": 7,
    "medium": 1,
    "low": 0,
    "unassigned": 1,
    "vulnerabilities": 9,
    "vulnerableComponents": 5,
    "components": 51,
    "suppressed": 0,
    "findingsTotal": 9,
    "findingsAudited": 0,
    "findingsUnaudited": 9,
    "inheritedRiskScore": 43.0,
    "policyViolationsFail": 0,
    "policyViolationsWarn": 0,
    "policyViolationsInfo": 5,
    "policyViolationsTotal": 5,
    "policyViolationsAudited": 0,
    "policyViolationsUnaudited": 5,
    "policyViolationsSecurityTotal": 5,
    "policyViolationsSecurityAudited": 0,
    "policyViolationsSecurityUnaudited": 5,
    "policyViolationsLicenseTotal": 0,
    "policyViolationsLicenseAudited": 0,
    "policyViolationsLicenseUnaudited": 0,
    "policyViolationsOperationalTotal": 0,
    "policyViolationsOperationalAudited": 0,
    "policyViolationsOperationalUnaudited": 0,
    "firstOccurrence": 1719996165264,
    "lastOccurrence": 1720085848907
  }

Checklist

codacy-production[bot] commented 4 days ago

Coverage summary from Codacy

See diff coverage on Codacy

Coverage variation Diff coverage
:white_check_mark: -0.01% (target: -1.00%) :x: 0.00% (target: 70.00%)
Coverage variation details | | Coverable lines | Covered lines | Coverage | | ------------- | ------------- | ------------- | ------------- | | Common ancestor commit (d25e48d2b8ed5f70382356440f582af15d556c4e) | 22076 | 16817 | 76.18% | | | Head commit (53fa76f59c026ecd5d9a2ef85499cf9d19b8f58a) | 22078 (+2) | 16817 (+0) | 76.17% (**-0.01%**) | **Coverage variation** is the difference between the coverage for the head and common ancestor commits of the pull request branch: ` - `
Diff coverage details | | Coverable lines | Covered lines | Diff coverage | | ------------- | ------------- | ------------- | ------------- | | Pull request (#3918) | 2 | 0 | **0.00%** | **Diff coverage** is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: `/ * 100%`

See your quality gate settings    Change summary preferences


:rocket: Don’t miss a bit, follow what’s new on Codacy.

Codacy stopped sending the deprecated coverage status on June 5th, 2024. Learn more