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

chore: add more logs data when unparsable Gateway API error is received #6673

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

pmalek
Copy link
Member

@pmalek pmalek commented Nov 14, 2024

What this PR does / why we need it:

This makes the Entity tags missing fields {"name": "", "error": "no name"} errors, have a bit more context so that they are actually helpful in debugging:

2024-11-14T16:37:44+01:00	error	Entity tags returned in error API error from gateway is missing fields, Kubernetes Event cannot be created without them	{"name": "", "id": "c021ae7d-f985-40ad-9908-6c517a1d49d8", "tags": [], "type": "certificate", "raw_error": {"entity_id":"c021ae7d-f985-40ad-9908-6c517a1d49d8","entity_type":"certificate","errors":[{"message":"required field missing","type":"entity"}]}, "error": "resource error has no name tag"}

Related to #6660

@pmalek pmalek added the area/maintenance Cleanup, refactoring, and other maintenance improvements that don't change functionality. label Nov 14, 2024
@pmalek pmalek added this to the KIC v3.4.x milestone Nov 14, 2024
@pmalek pmalek self-assigned this Nov 14, 2024
@pmalek pmalek force-pushed the logs-add-more-metadata-when-unparsable-gateway-error-occurs branch from 8094f6e to 26427b1 Compare November 14, 2024 15:40
Copy link

codecov bot commented Nov 14, 2024

Codecov Report

Attention: Patch coverage is 90.56604% with 5 lines in your changes missing coverage. Please review.

Project coverage is 80.1%. Comparing base (c89a406) to head (174a92a).
Report is 4 commits behind head on main.

Files with missing lines Patch % Lines
...al/dataplane/sendconfig/inmemory_error_handling.go 90.0% 4 Missing and 1 partial ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##            main   #6673     +/-   ##
=======================================
+ Coverage   77.7%   80.1%   +2.3%     
=======================================
  Files        202     203      +1     
  Lines      23798   23836     +38     
=======================================
+ Hits       18497   19096    +599     
+ Misses      4362    3775    -587     
- Partials     939     965     +26     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@pmalek pmalek marked this pull request as ready for review November 14, 2024 16:06
@pmalek pmalek requested a review from a team as a code owner November 14, 2024 16:06
Copy link
Contributor

@czeslavo czeslavo left a comment

Choose a reason for hiding this comment

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

👍

Comment on lines 174 to 198
if strings.HasPrefix(tag, util.K8sNameTagPrefix) {
re.Name = strings.TrimPrefix(tag, util.K8sNameTagPrefix)
continue
}
if strings.HasPrefix(tag, util.K8sNamespaceTagPrefix) {
re.Namespace = strings.TrimPrefix(tag, util.K8sNamespaceTagPrefix)
continue
}
if strings.HasPrefix(tag, util.K8sKindTagPrefix) {
gvk.Kind = strings.TrimPrefix(tag, util.K8sKindTagPrefix)
continue
}
if strings.HasPrefix(tag, util.K8sVersionTagPrefix) {
gvk.Version = strings.TrimPrefix(tag, util.K8sVersionTagPrefix)
continue
}
// this will not set anything for core resources
if strings.HasPrefix(tag, util.K8sGroupTagPrefix) {
gvk.Group = strings.TrimPrefix(tag, util.K8sGroupTagPrefix)
continue
}
if strings.HasPrefix(tag, util.K8sUIDTagPrefix) {
re.UID = strings.TrimPrefix(tag, util.K8sUIDTagPrefix)
continue
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe turning this into a switch would make sense, WDYT?

Copy link
Member Author

Choose a reason for hiding this comment

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

👍 PTAL 174a92a

internal/dataplane/sendconfig/inmemory_error_handling.go Outdated Show resolved Hide resolved
@pmalek pmalek force-pushed the logs-add-more-metadata-when-unparsable-gateway-error-occurs branch from 658281b to 51b0ee4 Compare November 14, 2024 16:23
@pmalek pmalek requested a review from czeslavo November 14, 2024 16:26
@pmalek pmalek enabled auto-merge (squash) November 14, 2024 16:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/maintenance Cleanup, refactoring, and other maintenance improvements that don't change functionality. size/L
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants