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

Support gcp.source_location being set as other types #794

Merged
merged 10 commits into from
Feb 7, 2024

Conversation

braydonk
Copy link
Contributor

@braydonk braydonk commented Jan 9, 2024

By copying the logic from parsing gcp.http_request, this PR adds support to also parse gcp.source_location from types other than Bytes.

This fixes the basic case of #792 such that the collector does not panic when setting gcp.source_location as something other than bytes.

By copying the logic from parsing gcp.http_request, this PR adds support
to also parse `gcp.source_location` from types other than Bytes.
@braydonk braydonk requested a review from a team as a code owner January 9, 2024 20:43
@braydonk braydonk changed the title Support gcp.source_location being in other types Support gcp.source_location being set as other types Jan 9, 2024
Copy link

codecov bot commented Jan 9, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (7329e68) 70.02% compared to head (992e990) 70.30%.
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #794      +/-   ##
==========================================
+ Coverage   70.02%   70.30%   +0.28%     
==========================================
  Files          42       42              
  Lines        4877     4886       +9     
==========================================
+ Hits         3415     3435      +20     
+ Misses       1311     1303       -8     
+ Partials      151      148       -3     

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

@dashpole
Copy link
Contributor

dashpole commented Jan 9, 2024

/gcbrun

To make codecov EVEN MORE happy :)
@braydonk braydonk requested a review from damemi January 9, 2024 21:26
exporter/collector/logs.go Outdated Show resolved Hide resolved
@@ -396,6 +395,103 @@ func TestLogMapping(t *testing.T) {
},
maxEntrySize: defaultMaxEntrySize,
},
{
name: "log with bad source location (bytes)",
Copy link
Member

Choose a reason for hiding this comment

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

What makes this test "bad"?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's because the value provided for gcp.source_location can't actually be parsed, the json Unmarshal fails due to an invalid type in one of the fields. Is there a nicer way I should say that concisely in the test or should I add a comment?

Copy link
Member

Choose a reason for hiding this comment

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

"log with wrong type in sourceLocation (bytes)", perhaps?

* Renamed `bytes` to `valueBytes` to avoid import shadow
* Moved `expectedError` to top of the test case struct to handle field
  alignment error
@braydonk
Copy link
Contributor Author

/gcbrun

@dashpole
Copy link
Contributor

@quentinmit i'll wait for your approval to merge

Copy link
Member

@quentinmit quentinmit left a comment

Choose a reason for hiding this comment

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

See comment, but otherwise this LGTM

exporter/collector/logs.go Outdated Show resolved Hide resolved
@braydonk
Copy link
Contributor Author

/gcbrun

1 similar comment
@dashpole
Copy link
Contributor

/gcbrun

@braydonk
Copy link
Contributor Author

braydonk commented Feb 1, 2024

Let's see if the e2e tests will work today 🙏

@braydonk
Copy link
Contributor Author

braydonk commented Feb 1, 2024

/gcbrun

@braydonk
Copy link
Contributor Author

braydonk commented Feb 1, 2024

I still don't seem to have permission to run these :(

@punya
Copy link
Contributor

punya commented Feb 1, 2024

/gcbrun

2 similar comments
@quentinmit
Copy link
Member

/gcbrun

@quentinmit
Copy link
Member

/gcbrun

@braydonk braydonk merged commit 266b137 into GoogleCloudPlatform:main Feb 7, 2024
27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants