Skip to content

Conversation

@khanhtc1202
Copy link
Member

@khanhtc1202 khanhtc1202 commented Jul 5, 2021

What this PR does / why we need it:

Introducing k8s cloudprovider metrics and k8s livestatestore metrics package

Which issue(s) this PR fixes:

Fixes #

Does this PR introduce a user-facing change?:

NONE

Copy link
Collaborator

@pipecd-bot pipecd-bot left a comment

Choose a reason for hiding this comment

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

GO_LINTER

Some issues were detected while linting go source files in your changes.

@pipecd-bot
Copy link
Collaborator

COVERAGE

Code coverage for golang is 32.73%. This pull request increases coverage by 0.30%.

File Function Base Head Diff
pkg/app/piped/cloudprovider/kubernetes/diff.go DiffListResult.NoChange -- 0.00% +0.00%
pkg/app/piped/cloudprovider/kubernetes/diff.go Diff -- 100.00% +100.00%
pkg/app/piped/cloudprovider/kubernetes/diff.go DiffList -- 0.00% +0.00%
pkg/app/piped/cloudprovider/kubernetes/diff.go DiffListResult.DiffString -- 0.00% +0.00%
pkg/app/piped/cloudprovider/kubernetes/diff.go groupManifests -- 92.00% +92.00%
pkg/app/piped/cloudprovider/kubernetes/kubernetesmetrics/metrics.go IncKubectlCallsCounter -- 0.00% +0.00%
pkg/app/piped/cloudprovider/kubernetes/kubernetesmetrics/metrics.go Register -- 0.00% +0.00%
pkg/app/piped/livestatestore/kubernetes/kubernetesmetrics/metrics.go Register -- 0.00% +0.00%
pkg/app/piped/livestatestore/kubernetes/kubernetesmetrics/metrics.go requestResultCollector.Increment -- 0.00% +0.00%
pkg/app/piped/livestatestore/kubernetes/kubernetesmetrics/metrics.go IncResourceEventsCounter -- 0.00% +0.00%
pkg/app/piped/cloudprovider/kubernetes/kubernetes.go init 100.00% -- -100.00%
pkg/app/piped/cloudprovider/kubernetes/manifest.go Diff 100.00% -- -100.00%
pkg/app/piped/cloudprovider/kubernetes/metrics.go metricsKubectlCalled 0.00% -- +-0.00%
pkg/app/piped/cloudprovider/kubernetes/metrics.go registerMetrics 100.00% -- -100.00%
pkg/app/piped/driftdetector/kubernetes/detector.go NewDetector 0.00% -- +-0.00%
pkg/app/piped/driftdetector/kubernetes/detector.go detector.Run 0.00% -- +-0.00%
pkg/app/piped/driftdetector/kubernetes/detector.go detector.check 0.00% -- +-0.00%
pkg/app/piped/driftdetector/kubernetes/detector.go detector.checkApplication 0.00% -- +-0.00%
pkg/app/piped/driftdetector/kubernetes/detector.go detector.loadHeadManifests 0.00% -- +-0.00%
pkg/app/piped/driftdetector/kubernetes/detector.go detector.listGroupedApplication 0.00% -- +-0.00%
pkg/app/piped/driftdetector/kubernetes/detector.go detector.loadDeploymentConfiguration 0.00% -- +-0.00%
pkg/app/piped/driftdetector/kubernetes/detector.go detector.ProviderName 0.00% -- +-0.00%
pkg/app/piped/driftdetector/kubernetes/detector.go groupManifests 92.00% -- -92.00%
pkg/app/piped/driftdetector/kubernetes/detector.go makeSyncedState 0.00% -- +-0.00%
pkg/app/piped/driftdetector/kubernetes/detector.go makeOutOfSyncState 0.00% -- +-0.00%
pkg/app/piped/driftdetector/kubernetes/detector.go filterIgnoringManifests 0.00% -- +-0.00%
pkg/app/piped/livestatestore/kubernetes/kubernetes.go init 100.00% -- -100.00%
pkg/app/piped/livestatestore/kubernetes/metrics.go registerMetrics 100.00% -- -100.00%
pkg/app/piped/livestatestore/kubernetes/metrics.go requestResultCollector.Increment 0.00% -- +-0.00%
pkg/app/piped/livestatestore/kubernetes/metrics.go incrementResourceEventCounter 0.00% -- +-0.00%

func init() {
registerMetrics()
}

Copy link
Member

Choose a reason for hiding this comment

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

Nice.

@nghialv
Copy link
Member

nghialv commented Jul 5, 2021

Nice. Thank you.
/lgtm

@pipecd-bot pipecd-bot added the lgtm label Jul 5, 2021
@nakabonne
Copy link
Member

nits: how about:

  • pkg/app/piped/livestatestore/kubernetes/kubernetesmetrics -> pkg/app/piped/livestatestore/kubernetes/metrics
  • pkg/app/piped/cloudprovider/kubernetes/kubernetesmetrics -> pkg/app/piped/cloudprovider/kubernetes/metrics

I feel a bit redundant

@khanhtc1202
Copy link
Member Author

nits: how about:

  • pkg/app/piped/livestatestore/kubernetes/kubernetesmetrics -> pkg/app/piped/livestatestore/kubernetes/metrics
  • pkg/app/piped/cloudprovider/kubernetes/kubernetesmetrics -> pkg/app/piped/cloudprovider/kubernetes/metrics

I feel a bit redundant

I get your point, just felt the same before 😅 But since we have cachemetrics already, I think it's better to have a kind of convention: xxxmetrics package means metrics for xxx (parent package) will be implemented here. How do you think? 🤔

@nghialv
Copy link
Member

nghialv commented Jul 5, 2021

I prefer to keep that convention. The metrics package name will be parent-package-name + metrics.
This is a special case when 2 parent-package-name have the same name. (pkg/app/piped/cloudprovider/kubernetes, pkg/app/piped/livestatestore/kubernetes), but in most cases, this convention helps avoid the need for aliases while importing.

This convention is the same for our test, mock package, redistest, redismock...
and standard go packages are using the same convention for httptest, httputil inside http package.

@nakabonne
Copy link
Member

makes sense. no objection to that 👍
/approve

@pipecd-bot
Copy link
Collaborator

APPROVE

This pull request is APPROVED by nakabonne.

Approvers can cancel the approval by writing /approve cancel in a comment. Any additional commits also will change this pull request to be not-approved.

@pipecd-bot pipecd-bot merged commit d66b743 into master Jul 5, 2021
@pipecd-bot pipecd-bot deleted the refactor-piped-metrics-exporter branch July 5, 2021 07:09
@nghialv
Copy link
Member

nghialv commented Jul 5, 2021

/changelog

@pipecd-bot
Copy link
Collaborator

CHANGELOG

@nghialv: Changelog has been generated in response to this comment.

Details

Changelog since v0.10.2

Notable Changes

  • Fix wrong focus on STAGE_NOT_STARTED_YET stage in deployment detail page (#2150)
  • Fix a bug that can't register multiple events during a single fetch interval (#2144)

Internal Changes

  • Refactor piped metrics exporter (#2177)
  • Make planpreview's builder shows detailed results (#2176)
  • Update ecs examples to make it works with fargate as default (#2178)
  • Refactor deploysource to use fmt.Fprintf directly and add missing newlines (#2175)
  • Move manifest comparison part to provider package to be reusable (#2174)
  • Fix a typo in envoy config (#2173)
  • Fix typo in envoy config (#2172)
  • Add sync-strategy field to output of planner (#2171)
  • Re-enable to track request response size statistics (#2170)
  • Update envoy to v0.18.3 (#2169)
  • Update planpreview's builder to detect which apps should be triggered (#2165)
  • Add inmemory cache metrics (#2166)
  • Add relabel config for kube-state-metrics (#2163)
  • Revert "Enable to track request response size statistics (Enable to track request response size statistics #2160)" (#2162)
  • Make get operation of env-store to be cancelable and single-flight (#2161)
  • Enable to track request response size statistics (#2160)
  • Refactor components to supress unnecessary rendering (#2159)
  • Add Prometheus relabeling config to manipulate metrics from cAdvisor (#2158)
  • Refactor cachemetrics interface and label name (#2157)
  • Introducing cachemetrics package (#2156)
  • Enable Node exporter and Kube state metrics (#2155)
  • Make pipectl plan-preview command renders the results to stdout and file (#2154)
  • Update contributor list (#2153)
  • Fix wrong name of a terraform example application (#2151)
  • Add Prometheus jobs to fetch k8s resource metrics (#2149)
  • Fix: obsolete terraform flags (#2138)
  • Add release panel to ja docs (#2148)
  • Fix cut index on getting versioning information (#2147)
  • Implement planpreview handler (#2143)
  • Update docs cover (#2141)
  • Fix: gnu sed support (#2139)
  • Fix wrong release filetype (#2142)
  • Fix wrong link to secret management in feature status page (#2140)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants