Skip to content

Commit

Permalink
[ADD] Cleanup old stats cron
Browse files Browse the repository at this point in the history
[ADD] create_stats to easily create stats using the external API
  • Loading branch information
tarteo committed Aug 27, 2024
1 parent dca13ad commit 0a8a43c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion argocd_deployer/models/application_stat.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ class ApplicationStat(models.Model):
comodel_name="argocd.application.stat.type", required=True
)
date = fields.Datetime(help="The date when the measurement was done", required=True)
message = fields.Char()
value = fields.Float()

@api.model
Expand Down Expand Up @@ -44,7 +45,8 @@ def create_stats(self, application_name, stats):
"application_id": application,
"type_id": stat["type_id"],
"date": stat["date"],
"value": float(stat["value"]),
"value": float(stat.get("value", "0")),
"message": stat.get("message"),
}
to_create.append(values)

Expand Down

0 comments on commit 0a8a43c

Please sign in to comment.