Skip to content
This repository was archived by the owner on May 30, 2024. It is now read-only.

Add prometheus metrics #157

Merged
merged 13 commits into from
Oct 10, 2021
Merged

Add prometheus metrics #157

merged 13 commits into from
Oct 10, 2021

Conversation

noahingh
Copy link
Member

Add the deployment_count table to collect the statistics data, and it expects better performance than producing statistics from the deployment table.

Metrics
gitploy_deployment_count{env="dev",name="jira-537",namespace="hanjunlee"} 2
gitploy_member_count 2
gitploy_member_limit{kind="trial"} 5
...

@noahingh noahingh added the component: server This issue or pull request is related to the feature of the server-side label Oct 10, 2021
@noahingh noahingh added this to the v0.2 milestone Oct 10, 2021
@noahingh noahingh linked an issue Oct 10, 2021 that may be closed by this pull request
Comment on lines +72 to +84
if len(c.cache) == 0 {
c.log.Debug("List all deployment_count.")
if dcs, err = c.i.ListAllDeploymentCounts(ctx); err != nil {
c.log.Error("It has failed to list all deployment_counts.", zap.Error(err))
return
}
} else {
c.log.Debug("List deployment_count from the last time.", zap.Time("last", c.lastTime))
if dcs, err = c.i.ListDeploymentCountsGreaterThanTime(ctx, c.lastTime); err != nil {
c.log.Error("It has failed to list deployment_counts.", zap.Error(err))
return
}
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When it initializes, it lists all deployment_counts and caches them. After the next collection, it only lists updated records.

Comment on lines +125 to +133
name: namespace
required: true
schema:
type: integer
description: The repository id
type: string
- in: path
name: name
required: true
schema:
type: string
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix un-updated fields

@noahingh noahingh merged commit 6660ca6 into main Oct 10, 2021
@noahingh noahingh deleted the prometheus-metrics branch October 10, 2021 04:44
@noahingh noahingh added the schema-migration This pull request has a schema-migration label Oct 13, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
component: server This issue or pull request is related to the feature of the server-side schema-migration This pull request has a schema-migration
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Provide prometheus metrics
1 participant