Skip to content
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(telemetry): introduce count for all Gateway API objects #4058

Merged
merged 6 commits into from Jun 1, 2023

Conversation

programmer04
Copy link
Member

@programmer04 programmer04 commented May 23, 2023

What this PR does / why we need it:

We decided to collect telemetry for all Gateway API objects in users' clusters.

Which issue this PR fixes:

closes #3649

Special notes for your reviewer:

It bumps package telemetry to version v0.0.5 that includes Kong/kubernetes-telemetry#143. Exclude directive has to be extended with sigs.k8s.io/gateway-api v0.7.0, because it's been discarded #4019 and pkg telemetry uses that version already

Test

func TestCreateManager(t *testing.T) {

is not extended, because of issue with mocking. For more comprehensive tests in telemetry pkg the issue has been created Kong/kubernetes-telemetry#144

I'm proposing new way for testing it e2e with usage of envtest approach proposed in #4094 and #4101. Maybe it should be extended with mesh discovery too, and the above mentioned TestCreateManager removed entirely - something to consider (and maybe create separate issue). For more standardised approach to envtest check issue #4099.

I've run proposed test locally in a loop and I haven't observed flakiness. Timeouts were adjusted empirically to ensure that test will pass, for weak hardware (like GH managed runners) it was a problem to have TelemetryPeriod set e.g. to 100ms (on local machines it used to pass without any issue).

PR Readiness Checklist:

Complete these before marking the PR as ready to review:

  • the CHANGELOG.md release notes have been updated to reflect any significant (and particularly user-facing) changes introduced by this PR

@programmer04 programmer04 self-assigned this May 23, 2023
@programmer04 programmer04 requested a review from a team as a code owner May 23, 2023 09:36
@programmer04 programmer04 enabled auto-merge (squash) May 23, 2023 09:45
@pmalek
Copy link
Member

pmalek commented May 23, 2023

I believe we're now at the point where we can try to address the issue with the fake objects.

If https://github.com/Kong/kubernetes-ingress-controller/blob/2e5bcc8c8034daeab4bd8558c8768450619f379f/internal/manager/telemetry/manager_test.go cannot be made to work with fake objects then I'd extend it with an envtest based test so that we can actually test the counters end to end. There have been occasions where the telemetry reporting failed after release and we needed to fix with a subsequent release which caused issues with our telemetry data.

@codecov
Copy link

codecov bot commented May 23, 2023

Codecov Report

Patch coverage: 100.0% and project coverage change: +0.4 🎉

Comparison is base (8f34e26) 60.3% compared to head (0be1126) 60.7%.

❗ Current head 0be1126 differs from pull request most recent head a77eb66. Consider uploading reports for the commit a77eb66 to get more accurate results

Additional details and impacted files
@@           Coverage Diff           @@
##            main   #4058     +/-   ##
=======================================
+ Coverage   60.3%   60.7%   +0.4%     
=======================================
  Files        150     150             
  Lines      16745   16747      +2     
=======================================
+ Hits       10099   10175     +76     
+ Misses      6014    5926     -88     
- Partials     632     646     +14     
Impacted Files Coverage Δ
internal/manager/telemetry/manager.go 60.3% <100.0%> (+15.1%) ⬆️

... and 7 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@programmer04 programmer04 marked this pull request as draft May 23, 2023 10:54
auto-merge was automatically disabled May 23, 2023 10:54

Pull request was converted to draft

@programmer04 programmer04 added the work in progress Work In Progress label May 23, 2023
@pull-request-size pull-request-size bot added size/L and removed size/S labels May 30, 2023
@shaneutt shaneutt self-requested a review May 30, 2023 15:03
@programmer04 programmer04 added this to the KIC v2.10.0 milestone May 30, 2023
@programmer04 programmer04 force-pushed the more-telemetry branch 3 times, most recently from 9e3a392 to 95962d4 Compare May 31, 2023 14:57
@programmer04 programmer04 marked this pull request as ready for review May 31, 2023 15:05
@programmer04 programmer04 added area/tests and removed work in progress Work In Progress labels May 31, 2023
@programmer04 programmer04 enabled auto-merge (squash) May 31, 2023 15:08
internal/manager/telemetry/telemetry_test.go Outdated Show resolved Hide resolved
internal/manager/telemetry/telemetry_test.go Outdated Show resolved Hide resolved
internal/manager/telemetry/telemetry_test.go Outdated Show resolved Hide resolved
internal/manager/telemetry/telemetry_test.go Show resolved Hide resolved
internal/manager/telemetry/telemetry_test.go Outdated Show resolved Hide resolved
internal/manager/telemetry/telemetry_test.go Outdated Show resolved Hide resolved
internal/manager/telemetry/telemetry_test.go Show resolved Hide resolved
internal/manager/telemetry/telemetry_test.go Show resolved Hide resolved
CHANGELOG.md Outdated Show resolved Hide resolved
internal/manager/telemetry/telemetry_test.go Show resolved Hide resolved
internal/manager/telemetry/manager.go Show resolved Hide resolved
internal/manager/telemetry/telemetry_test.go Outdated Show resolved Hide resolved
internal/manager/telemetry/telemetry_test.go Outdated Show resolved Hide resolved
internal/manager/telemetry/telemetry_test.go Outdated Show resolved Hide resolved
internal/manager/telemetry/telemetry_test.go Show resolved Hide resolved
programmer04 and others added 2 commits June 1, 2023 10:47
Co-authored-by: Patryk Małek <patryk.malek@konghq.com>
Co-authored-by: Patryk Małek <patryk.malek@konghq.com>
@programmer04 programmer04 requested a review from pmalek June 1, 2023 09:12
czeslavo
czeslavo previously approved these changes Jun 1, 2023
pmalek
pmalek previously approved these changes Jun 1, 2023
internal/manager/telemetry/telemetry_test.go Outdated Show resolved Hide resolved
@programmer04 programmer04 dismissed stale reviews from pmalek and czeslavo via ca6fdd1 June 1, 2023 13:20
@programmer04 programmer04 merged commit 08b162c into main Jun 1, 2023
26 checks passed
@programmer04 programmer04 deleted the more-telemetry branch June 1, 2023 14:20
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.

Telemetry for Gateway API objects
3 participants