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

Add Telemetry collector structure with some collected resources #1497

Merged
merged 43 commits into from
Feb 6, 2024

Conversation

bjee19
Copy link
Contributor

@bjee19 bjee19 commented Jan 22, 2024

Proposed changes

Problem: We want to create a starting design to collect telemetry data.

Solution: Implemented design to collect multiple types of telemetry data: Cluster Node Count, Count of NGF Resources (Graph), Project and Version.

Testing: Added unit tests. Did some end to end testing where I deployed NGF alongside some resources and saw the correct data being logged.

{"level":"debug","ts":"2024-02-05T18:32:46Z","logger":"telemetryJob","msg":"Gathering telemetry data"}
{"level":"debug","ts":"2024-02-05T18:32:46Z","logger":"telemetryJob","msg":"Exporting telemetry data"}
{"level":"debug","ts":"2024-02-05T18:32:46Z","logger":"telemetryExporter","msg":"Exporting telemetry","data":{"ProjectMetadata":{"Name":"NGF","Version":"edge"},"NodeCount":1,"NGFResourceCounts":{"Gateways":1,"GatewayClasses":1,"HTTPRoutes":3,"Secrets":1,"Services":2,"Endpoints":2}}}
{"level":"debug","ts":"2024-02-05T18:34:47Z","logger":"telemetryJob","msg":"Gathering telemetry data"}
{"level":"debug","ts":"2024-02-05T18:34:47Z","logger":"telemetryJob","msg":"Exporting telemetry data"}
{"level":"debug","ts":"2024-02-05T18:34:47Z","logger":"telemetryExporter","msg":"Exporting telemetry","data":{"ProjectMetadata":{"Name":"NGF","Version":"edge"},"NodeCount":1,"NGFResourceCounts":{"Gateways":1,"GatewayClasses":1,"HTTPRoutes":3,"Secrets":1,"Services":2,"Endpoints":2}}}
{"level":"debug","ts":"2024-02-05T18:36:47Z","logger":"telemetryJob","msg":"Gathering telemetry data"}
{"level":"debug","ts":"2024-02-05T18:36:47Z","logger":"telemetryJob","msg":"Exporting telemetry data"}
{"level":"debug","ts":"2024-02-05T18:36:47Z","logger":"telemetryExporter","msg":"Exporting telemetry","data":{"ProjectMetadata":{"Name":"NGF","Version":"edge"},"NodeCount":1,"NGFResourceCounts":{"Gateways":1,"GatewayClasses":1,"HTTPRoutes":3,"Secrets":1,"Services":2,"Endpoints":2}}}
{"level":"debug","ts":"2024-02-05T18:38:48Z","logger":"telemetryJob","msg":"Gathering telemetry data"}
{"level":"debug","ts":"2024-02-05T18:38:48Z","logger":"telemetryJob","msg":"Exporting telemetry data"}
{"level":"debug","ts":"2024-02-05T18:38:48Z","logger":"telemetryExporter","msg":"Exporting telemetry","data":{"ProjectMetadata":{"Name":"NGF","Version":"edge"},"NodeCount":1,"NGFResourceCounts":{"Gateways":1,"GatewayClasses":1,"HTTPRoutes":3,"Secrets":1,"Services":2,"Endpoints":2}}}
{"level":"debug","ts":"2024-02-05T18:40:48Z","logger":"telemetryJob","msg":"Gathering telemetry data"}
{"level":"debug","ts":"2024-02-05T18:40:48Z","logger":"telemetryJob","msg":"Exporting telemetry data"}
{"level":"debug","ts":"2024-02-05T18:40:48Z","logger":"telemetryExporter","msg":"Exporting telemetry","data":{"ProjectMetadata":{"Name":"NGF","Version":"edge"},"NodeCount":1,"NGFResourceCounts":{"Gateways":1,"GatewayClasses":1,"HTTPRoutes":3,"Secrets":1,"Services":2,"Endpoints":2}}}

(I tested with the telemetry report period changed to 2 minutes)

Closes #1306 #1312 #1309

Checklist

Before creating a PR, run through this checklist and mark each as complete.

  • I have read the CONTRIBUTING doc
  • I have added tests that prove my fix is effective or that my feature works
  • I have checked that all unit tests pass after adding my changes
  • I have updated necessary documentation
  • [] I have rebased my branch onto main
  • I will ensure my PR is targeting the main branch and pulling from my branch from my own fork

@github-actions github-actions bot added the enhancement New feature or request label Jan 22, 2024
@bjee19
Copy link
Contributor Author

bjee19 commented Jan 22, 2024

If there is anything glaringly wrong and/or things I've added that aren't on the right track, I'm all open for the feedback!

Copy link
Contributor

@pleshakov pleshakov left a comment

Choose a reason for hiding this comment

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

please see my comments.

I'd also include in this PoC some static data like this -- #1309 -- so that we can see how the design will incorporate temetry data that stays the same during the lifetime of the NGF process.

internal/mode/static/telemetry/collector.go Outdated Show resolved Hide resolved
internal/mode/static/telemetry/collector.go Outdated Show resolved Hide resolved
internal/mode/static/telemetry/collector.go Outdated Show resolved Hide resolved
internal/mode/static/telemetry/collector.go Outdated Show resolved Hide resolved
internal/mode/static/telemetry/exporter.go Outdated Show resolved Hide resolved
internal/mode/static/telemetry/collector.go Outdated Show resolved Hide resolved
internal/mode/static/telemetry/collector.go Outdated Show resolved Hide resolved
@bjee19 bjee19 force-pushed the enh/telemetry-collector-base branch from d400651 to 25b0904 Compare January 24, 2024 01:14
internal/mode/static/state/change_processor.go Outdated Show resolved Hide resolved
internal/mode/static/telemetry/collector.go Outdated Show resolved Hide resolved
internal/mode/static/telemetry/collector.go Show resolved Hide resolved
internal/mode/static/telemetry/collector.go Outdated Show resolved Hide resolved
Copy link
Contributor

@kate-osborn kate-osborn left a comment

Choose a reason for hiding this comment

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

The design looks good to me! Just a couple nits and questions.

internal/mode/static/telemetry/collector.go Outdated Show resolved Hide resolved
internal/mode/static/telemetry/collector.go Outdated Show resolved Hide resolved
internal/mode/static/telemetry/collector.go Outdated Show resolved Hide resolved
internal/mode/static/telemetry/collector.go Outdated Show resolved Hide resolved
internal/mode/static/telemetry/collector.go Outdated Show resolved Hide resolved
@bjee19 bjee19 force-pushed the enh/telemetry-collector-base branch from 9d916f4 to 0eb49a0 Compare January 26, 2024 22:20
@bjee19 bjee19 marked this pull request as ready for review January 26, 2024 23:26
@bjee19 bjee19 requested a review from a team as a code owner January 26, 2024 23:26
Copy link
Contributor

@pleshakov pleshakov left a comment

Choose a reason for hiding this comment

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

please see my comments, suggestions and requests.
Note: I haven't reviewed collector_test.go -- need a bit more time for that.

internal/mode/static/handler.go Show resolved Hide resolved
internal/mode/static/handler.go Show resolved Hide resolved
internal/mode/static/handler.go Outdated Show resolved Hide resolved
internal/mode/static/telemetry/collector.go Show resolved Hide resolved
internal/mode/static/telemetry/collector.go Outdated Show resolved Hide resolved
internal/mode/static/handler.go Show resolved Hide resolved
internal/mode/static/telemetry/job.go Outdated Show resolved Hide resolved
internal/mode/static/telemetry/job_test.go Outdated Show resolved Hide resolved
@github-actions github-actions bot added the helm-chart Relates to helm chart label Jan 29, 2024
internal/mode/static/telemetry/job.go Outdated Show resolved Hide resolved
internal/mode/static/telemetry/job.go Outdated Show resolved Hide resolved
deploy/helm-chart/templates/rbac.yaml Show resolved Hide resolved
internal/mode/static/handler.go Show resolved Hide resolved
internal/mode/static/handler.go Outdated Show resolved Hide resolved
internal/mode/static/handler_test.go Outdated Show resolved Hide resolved
internal/mode/static/health.go Outdated Show resolved Hide resolved
internal/mode/static/health.go Outdated Show resolved Hide resolved
internal/mode/static/telemetry/collector_test.go Outdated Show resolved Hide resolved
internal/mode/static/telemetry/job.go Outdated Show resolved Hide resolved
internal/mode/static/telemetry/job.go Outdated Show resolved Hide resolved
internal/mode/static/telemetry/job_test.go Outdated Show resolved Hide resolved
Copy link
Contributor

@pleshakov pleshakov left a comment

Choose a reason for hiding this comment

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

@bjee19
I left a few requests/suggestions
Could you prioritize rebasing and resolving conflicts?
The Job code will be changed so there will be a need for a another review.

internal/mode/static/health.go Outdated Show resolved Hide resolved
internal/mode/static/health.go Outdated Show resolved Hide resolved
internal/mode/static/telemetry/collector.go Outdated Show resolved Hide resolved
internal/mode/static/telemetry/job.go Outdated Show resolved Hide resolved
@bjee19 bjee19 force-pushed the enh/telemetry-collector-base branch from faa010e to 16fe23d Compare February 2, 2024 18:51
@bjee19 bjee19 force-pushed the enh/telemetry-collector-base branch from 62274e4 to 89c41d5 Compare February 6, 2024 16:11
@bjee19 bjee19 merged commit 95c8613 into nginxinc:main Feb 6, 2024
28 checks passed
@bjee19 bjee19 deleted the enh/telemetry-collector-base branch May 7, 2024 16:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request helm-chart Relates to helm chart
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Collect Cluster Node Count (NGF)
7 participants