-
Notifications
You must be signed in to change notification settings - Fork 45
Logging exporter support to output structured json instead of making RPCs #440
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
Merged
Merged
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
81 changes: 81 additions & 0 deletions
81
...ing/tests/__snapshots__/test_cloud_logging/test_convert_gen_ai_body[structured_json].json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,81 @@ | ||
| [ | ||
| { | ||
| "gen_ai.input.messages": [ | ||
| { | ||
| "parts": [ | ||
| { | ||
| "content": "Get weather details in New Delhi and San Francisco?", | ||
| "type": "text" | ||
| } | ||
| ], | ||
| "role": "user" | ||
| }, | ||
| { | ||
| "parts": [ | ||
| { | ||
| "arguments": { | ||
| "location": "New Delhi" | ||
| }, | ||
| "id": "get_current_weather_0", | ||
| "name": "get_current_weather", | ||
| "type": "tool_call" | ||
| }, | ||
| { | ||
| "arguments": { | ||
| "location": "San Francisco" | ||
| }, | ||
| "id": "get_current_weather_1", | ||
| "name": "get_current_weather", | ||
| "type": "tool_call" | ||
| } | ||
| ], | ||
| "role": "model" | ||
| }, | ||
| { | ||
| "parts": [ | ||
| { | ||
| "id": "get_current_weather_0", | ||
| "response": { | ||
| "content": "{\"temperature\": 35, \"unit\": \"C\"}" | ||
| }, | ||
| "type": "tool_call_response" | ||
| }, | ||
| { | ||
| "id": "get_current_weather_1", | ||
| "response": { | ||
| "content": "{\"temperature\": 25, \"unit\": \"C\"}" | ||
| }, | ||
| "type": "tool_call_response" | ||
| } | ||
| ], | ||
| "role": "user" | ||
| } | ||
| ], | ||
| "gen_ai.output.messages": [ | ||
| { | ||
| "finish_reason": "stop", | ||
| "parts": [ | ||
| { | ||
| "content": "The current temperature in New Delhi is 35°C, and in San Francisco, it is 25°C.", | ||
| "type": "text" | ||
| } | ||
| ], | ||
| "role": "model" | ||
| } | ||
| ], | ||
| "gen_ai.system_instructions": [ | ||
| { | ||
| "content": "You are a clever language model", | ||
| "type": "text" | ||
| } | ||
| ], | ||
| "logging.googleapis.com/labels": { | ||
| "event.name": "gen_ai.client.inference.operation.details" | ||
| }, | ||
| "logging.googleapis.com/spanId": "", | ||
| "logging.googleapis.com/trace": "", | ||
| "logging.googleapis.com/trace_sampled": false, | ||
| "severity": "DEFAULT", | ||
| "time": "2025-01-15T21:25:10.997977393Z" | ||
| } | ||
| ] |
File renamed without changes.
11 changes: 11 additions & 0 deletions
11
...s/__snapshots__/test_cloud_logging/test_convert_non_json_dict_bytes[structured_json].json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| [ | ||
| { | ||
| "logging.googleapis.com/labels": {}, | ||
| "logging.googleapis.com/spanId": "", | ||
| "logging.googleapis.com/trace": "", | ||
| "logging.googleapis.com/trace_sampled": false, | ||
| "message": "MTIz", | ||
| "severity": "DEFAULT", | ||
| "time": "2025-01-15T21:25:10.997977393Z" | ||
| } | ||
| ] |
File renamed without changes.
30 changes: 30 additions & 0 deletions
30
.../tests/__snapshots__/test_cloud_logging/test_convert_otlp_dict_body[structured_json].json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| [ | ||
| { | ||
| "kvlistValue": { | ||
| "bytes_field": "Ynl0ZXM=", | ||
| "repeated_bytes_field": [ | ||
| "Ynl0ZXM=", | ||
| "Ynl0ZXM=", | ||
| "Ynl0ZXM=" | ||
| ], | ||
| "values": [ | ||
| { | ||
| "key": "content", | ||
| "value": { | ||
| "stringValue": "You're a helpful assistant." | ||
| } | ||
| } | ||
| ] | ||
| }, | ||
| "logging.googleapis.com/labels": { | ||
| "event.name": "random.genai.event", | ||
| "gen_ai.system": "true", | ||
| "test": "23" | ||
| }, | ||
| "logging.googleapis.com/spanId": "0000000000000016", | ||
| "logging.googleapis.com/trace": "projects/fakeproject/traces/00000000000000000000000000000019", | ||
| "logging.googleapis.com/trace_sampled": false, | ||
| "severity": "ERROR", | ||
| "time": "2025-01-15T21:25:10.997977393Z" | ||
| } | ||
| ] |
File renamed without changes.
24 changes: 24 additions & 0 deletions
24
...g/test_convert_otlp_various_different_types_in_attrs_and_bytes_body[structured_json].json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| [ | ||
| { | ||
| "Classe": [ | ||
| "Email addresses", | ||
| "Passwords" | ||
| ], | ||
| "CreationDate": "2012-05-05", | ||
| "Date": "2016-05-21T21:35:40Z", | ||
| "Link": "http://some_link.com", | ||
| "LogoType": "png", | ||
| "Ref": 164611595.0, | ||
| "logging.googleapis.com/labels": { | ||
| "boolArray": "[true,false,true,true]", | ||
| "float": "25.43231", | ||
| "int": "25", | ||
| "intArray": "[21,18,23,17]" | ||
| }, | ||
| "logging.googleapis.com/spanId": "", | ||
| "logging.googleapis.com/trace": "", | ||
| "logging.googleapis.com/trace_sampled": false, | ||
| "severity": "DEFAULT", | ||
| "time": "2025-01-15T21:25:10.997977393Z" | ||
| } | ||
| ] |
File renamed without changes.
15 changes: 15 additions & 0 deletions
15
...shots__/test_cloud_logging/test_convert_various_types_of_attributes[structured_json].json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| [ | ||
| { | ||
| "logging.googleapis.com/labels": { | ||
| "a": "[{\"key\":\"Ynl0ZXM=\"}]", | ||
| "b": "[true,false,false,true]", | ||
| "c": "{\"a_dict\":\"abcd\",\"akey\":1234}", | ||
| "d": "{\"gen_ai.input.messages\":[{\"role\":\"user\",\"parts\":[{\"type\":\"text\",\"content\":\"Get weather details in New Delhi and San Francisco?\"}]},{\"role\":\"model\",\"parts\":[{\"type\":\"tool_call\",\"arguments\":{\"location\":\"New Delhi\"},\"name\":\"get_current_weather\",\"id\":\"get_current_weather_0\"},{\"type\":\"tool_call\",\"arguments\":{\"location\":\"San Francisco\"},\"name\":\"get_current_weather\",\"id\":\"get_current_weather_1\"}]},{\"role\":\"user\",\"parts\":[{\"type\":\"tool_call_response\",\"response\":{\"content\":\"{\\\"temperature\\\": 35, \\\"unit\\\": \\\"C\\\"}\"},\"id\":\"get_current_weather_0\"},{\"type\":\"tool_call_response\",\"response\":{\"content\":\"{\\\"temperature\\\": 25, \\\"unit\\\": \\\"C\\\"}\"},\"id\":\"get_current_weather_1\"}]}],\"gen_ai.system_instructions\":[{\"type\":\"text\",\"content\":\"You are a clever language model\"}],\"gen_ai.output.messages\":[{\"role\":\"model\",\"parts\":[{\"type\":\"text\",\"content\":\"The current temperature in New Delhi is 35\\u00b0C, and in San Francisco, it is 25\\u00b0C.\"}],\"finish_reason\":\"stop\"}]}" | ||
| }, | ||
| "logging.googleapis.com/spanId": "", | ||
| "logging.googleapis.com/trace": "", | ||
| "logging.googleapis.com/trace_sampled": false, | ||
| "severity": "DEFAULT", | ||
| "time": "2025-01-15T21:25:10.997977393Z" | ||
| } | ||
| ] |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
10 changes: 10 additions & 0 deletions
10
...hots__/test_cloud_logging/test_convert_various_types_of_bodies[structured_json-None].json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| [ | ||
| { | ||
| "logging.googleapis.com/labels": {}, | ||
| "logging.googleapis.com/spanId": "", | ||
| "logging.googleapis.com/trace": "", | ||
| "logging.googleapis.com/trace_sampled": false, | ||
| "severity": "DEFAULT", | ||
| "time": "2025-01-15T21:25:10.997977393Z" | ||
| } | ||
| ] |
11 changes: 11 additions & 0 deletions
11
...hots__/test_cloud_logging/test_convert_various_types_of_bodies[structured_json-bool].json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| [ | ||
| { | ||
| "logging.googleapis.com/labels": {}, | ||
| "logging.googleapis.com/spanId": "", | ||
| "logging.googleapis.com/trace": "", | ||
| "logging.googleapis.com/trace_sampled": false, | ||
| "message": "true", | ||
| "severity": "DEFAULT", | ||
| "time": "2025-01-15T21:25:10.997977393Z" | ||
| } | ||
| ] |
16 changes: 16 additions & 0 deletions
16
...st_cloud_logging/test_convert_various_types_of_bodies[structured_json-list_of_bools].json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| [ | ||
| { | ||
| "logging.googleapis.com/labels": {}, | ||
| "logging.googleapis.com/spanId": "", | ||
| "logging.googleapis.com/trace": "", | ||
| "logging.googleapis.com/trace_sampled": false, | ||
| "my_dict": [ | ||
| true, | ||
| false, | ||
| false, | ||
| true | ||
| ], | ||
| "severity": "DEFAULT", | ||
| "time": "2025-01-15T21:25:10.997977393Z" | ||
| } | ||
| ] |
15 changes: 15 additions & 0 deletions
15
...gging/test_convert_various_types_of_bodies[structured_json-list_of_dicts_with_bytes].json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| [ | ||
| { | ||
| "logging.googleapis.com/labels": {}, | ||
| "logging.googleapis.com/spanId": "", | ||
| "logging.googleapis.com/trace": "", | ||
| "logging.googleapis.com/trace_sampled": false, | ||
| "my_dict": [ | ||
| { | ||
| "key": "Ynl0ZXM=" | ||
| } | ||
| ], | ||
| "severity": "DEFAULT", | ||
| "time": "2025-01-15T21:25:10.997977393Z" | ||
| } | ||
| ] |
16 changes: 16 additions & 0 deletions
16
...logging/test_convert_various_types_of_bodies[structured_json-list_of_mixed_sequence].json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| [ | ||
| { | ||
| "logging.googleapis.com/labels": {}, | ||
| "logging.googleapis.com/spanId": "", | ||
| "logging.googleapis.com/trace": "", | ||
| "logging.googleapis.com/trace_sampled": false, | ||
| "my_dict": [ | ||
| true, | ||
| "str", | ||
| 1.0, | ||
| 0.234 | ||
| ], | ||
| "severity": "DEFAULT", | ||
| "time": "2025-01-15T21:25:10.997977393Z" | ||
| } | ||
| ] |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.