-
Notifications
You must be signed in to change notification settings - Fork 432
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add overview page + push metrics #3292
Conversation
stringQuery = fmt.Sprintf("%s AND application_id:%d", stringQuery, request.ApplicationID) | ||
} | ||
if request.WorkflowID != 0 { | ||
stringQuery = fmt.Sprintf("%s AND workflow_id:%s", stringQuery, request.WorkflowID) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sprintf format %s has arg request.WorkflowID of wrong type int64
"github.com/ovh/cds/sdk" | ||
) | ||
|
||
func (api *API) getApplicationMetricHandler() service.Handler { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
getApplicationOverviewHandler ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let this one for now
engine/api/metrics/elasticsearch.go
Outdated
|
||
var metricsChan chan sdk.Metric | ||
|
||
func Init(c context.Context, db gorp.SqlExecutor) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you should take a dbFunc as an argument
if errS != nil { | ||
log.Error("HandleVulnerabilityReport> Unable to get summary to create metrics: %s", err) | ||
} | ||
if vulnsDBSummary != nil && errS != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
errS == nil ?
sdk/metric.go
Outdated
) | ||
|
||
// Metric represent a CDS metric | ||
type Metric struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about a Overview type ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as above
Severity.DEFCON1 | ||
]; | ||
|
||
static getMetricsColors(s: string) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
getSeveritiesColors ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
getColors will be enough
} | ||
|
||
if result.Valid { | ||
if err := json.Unmarshal([]byte(result.String), &summary); err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
gorpmapping.JSONNullString
engine/api/metrics/elasticsearch.go
Outdated
case e := <-metricsChan: | ||
esServices, errS := services.FindByType(db, services.TypeElasticsearch) | ||
if errS != nil { | ||
log.Error("metrics.send> Unable to get elasticsearch service: %v", errS) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/metrics.send/pushInElasticSearch
engine/api/metrics/elasticsearch.go
Outdated
|
||
code, errD := services.DoJSONRequest(context.Background(), esServices, "POST", "/metrics", e, nil) | ||
if code >= 400 || errD != nil { | ||
log.Error("metrics.send> Unable to send metrics to elasticsearch [%d]: %v", code, errD) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/metrics.send/pushInElasticSearch
|
||
ngOnInit(): void { | ||
this.dashboards = new Array<GraphConfiguration>(); | ||
this._appNoCache.getMetrics(this.project.key, this.application.name, 'Vulnerability').subscribe(d => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
loading ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
let found = false; | ||
metrics.forEach(m => { | ||
if (m.value[s]) { | ||
found = true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use .some
or for ... with a break
CDS Report build-ui#5806.0 ✘
|
CDS Report build-engine-cli-tools#5807.0 ✘
|
CDS Report build-ui#5807.0 ✘
|
CDS Report build-ui#5824.0 ✘
|
ui/src/assets/i18n/fr.json
Outdated
"application_home_repo": "Dépôt GIT", | ||
"application_home_no_repo": "Lier un dépôt GIT", | ||
"application_home_platform": "Liste des platformes liées", | ||
"application_home_no_platform": "Lier une platforme", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/platforme/plateforme
CDS Report build-ui#5830.0 ✘
|
@ovh/cds