-
Notifications
You must be signed in to change notification settings - Fork 605
backend: caching: implemented caching for single-cluster #3499
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
Changes from all commits
bfc614f
cea00ed
18fa22a
5e78492
6b3a56b
7c3fc85
7eb605e
f9d6377
ec97252
8170a17
6d0b40d
b5dd9a2
a42f7f6
b5c7a9e
e3b9dc8
573d088
71f8027
ca95ecf
b936819
fc2463a
171857d
c844f31
b56314f
576c7f6
8f26b4f
5f2ec30
b6036d5
20f5fb5
cdd718f
36d0f02
6f56e57
cdb21c9
a93c068
eee4fbc
3f437bb
a536079
075803c
7985faf
ee03263
546e7a8
c726361
520fcbc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -17,15 +17,23 @@ limitations under the License. | |||||
| package main | ||||||
|
|
||||||
| import ( | ||||||
| "context" | ||||||
| "errors" | ||||||
| "net/http" | ||||||
| "os" | ||||||
| "strings" | ||||||
|
|
||||||
| "github.com/gorilla/mux" | ||||||
| "github.com/kubernetes-sigs/headlamp/backend/pkg/cache" | ||||||
| "github.com/kubernetes-sigs/headlamp/backend/pkg/config" | ||||||
| "github.com/kubernetes-sigs/headlamp/backend/pkg/headlampconfig" | ||||||
| "github.com/kubernetes-sigs/headlamp/backend/pkg/k8cache" | ||||||
| "github.com/kubernetes-sigs/headlamp/backend/pkg/kubeconfig" | ||||||
| "github.com/kubernetes-sigs/headlamp/backend/pkg/logger" | ||||||
| "github.com/kubernetes-sigs/headlamp/backend/pkg/plugins" | ||||||
| "github.com/kubernetes-sigs/headlamp/backend/pkg/telemetry" | ||||||
| "go.opentelemetry.io/otel/attribute" | ||||||
| "go.opentelemetry.io/otel/trace" | ||||||
|
Comment on lines
+35
to
+36
|
||||||
| "go.opentelemetry.io/otel/attribute" | |
| "go.opentelemetry.io/otel/trace" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
attribute and trace should be there for creating ctx and span in CacheMiddleware function
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@upsaurav12 can you format the file using gofumpt ? I think that should resolve this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes doing it.
Copilot
AI
Jul 17, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Calling 'defer span.End()' inside this helper ends the trace span immediately when this function returns, which may be before downstream logic executes. Consider ending the span in the caller after the handler completes.
| defer span.End() | |
| // Note: The caller is responsible for ending the span by calling span.End(). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we need this span to be instrumented. @illume wdyt? this function just gets the context key and context.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i have added because i was getting linting error of length of CacheMiddleware function
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AFAIU telemetry doesn't have anything to do with linting issue. Can you share the exact error that you faced?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no, i am talking about funlen linting issue, it was saying that the function length is >60 lines of code, that's why i made a saparate function that will return contextKey , KContext, span and ctx
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
separate function is okay, not every new function needs to have a telemetry span.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
okay understood, should i need to remove telemetry and span for some new functions such as ReturnAuthErrRespone , ReturnAfterAuthError etc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for now, lets remove this.
Uh oh!
There was an error while loading. Please reload this page.