Skip to content

Commit

Permalink
Fix GCP examples
Browse files Browse the repository at this point in the history
  • Loading branch information
AndrewDryga committed Apr 12, 2024
1 parent f4496b4 commit dcaf8e6
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 44 deletions.
46 changes: 23 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,8 @@ for more details see [special fields in structured payloads](https://cloud.googl

```json
{
"logging.googleapis.com/trace": "projects/my-projectid/traces/0679686673a",
"logging.googleapis.com/spanId": "000000000000004a",
"logging.googleapis.com/operation": {
"pid": "#PID<0.228.0>"
},
Expand Down Expand Up @@ -139,31 +141,29 @@ Exception that can be sent to Google Cloud Error Reporter:
"function": "Elixir.LoggerJSON.Formatters.GoogleCloudTest.test logs exception http context/1",
"line": 301
},
"message": {
"@type": "type.googleapis.com/google.devtools.clouderrorreporting.v1beta1.ReportedErrorEvent",
"context": {
"httpRequest": {
"protocol": "HTTP/1.1",
"referer": "http://www.example.com/",
"remoteIp": "",
"requestMethod": "PATCH",
"requestUrl": "http://www.example.com/",
"status": 503,
"userAgent": "Mozilla/5.0"
},
"reportLocation": {
"filePath": "/Users/andrew/Projects/os/logger_json/test/formatters/google_cloud_test.exs",
"functionName": "Elixir.LoggerJSON.Formatters.GoogleCloudTest.test logs exception http context/1",
"lineNumber": 301
}
},
"domain": ["elixir"],
"message": "Hello",
"serviceContext": {
"service": "nonode@nohost"
"@type": "type.googleapis.com/google.devtools.clouderrorreporting.v1beta1.ReportedErrorEvent",
"context": {
"httpRequest": {
"protocol": "HTTP/1.1",
"referer": "http://www.example.com/",
"remoteIp": "",
"requestMethod": "PATCH",
"requestUrl": "http://www.example.com/",
"status": 503,
"userAgent": "Mozilla/5.0"
},
"stack_trace": "** (EXIT from #PID<0.250.0>) :foo"
"reportLocation": {
"filePath": "/Users/andrew/Projects/os/logger_json/test/formatters/google_cloud_test.exs",
"functionName": "Elixir.LoggerJSON.Formatters.GoogleCloudTest.test logs exception http context/1",
"lineNumber": 301
}
},
"domain": ["elixir"],
"message": "Hello",
"serviceContext": {
"service": "nonode@nohost"
},
"stack_trace": "** (EXIT from #PID<0.250.0>) :foo",
"severity": "DEBUG",
"time": "2024-04-11T21:34:53.503Z"
}
Expand Down
40 changes: 19 additions & 21 deletions lib/logger_json/formatters/google_cloud.ex
Original file line number Diff line number Diff line change
Expand Up @@ -63,29 +63,27 @@ defmodule LoggerJSON.Formatters.GoogleCloud do
"function" => "Elixir.LoggerJSON.Formatters.GoogleCloudTest.test logs exception http context/1",
"line" => 301
},
"message" => %{
"@type" => "type.googleapis.com/google.devtools.clouderrorreporting.v1beta1.ReportedErrorEvent",
"context" => %{
"httpRequest" => %{
"protocol" => "HTTP/1.1",
"referer" => "http://www.example.com/",
"remoteIp" => "",
"requestMethod" => "PATCH",
"requestUrl" => "http://www.example.com/",
"status" => 503,
"userAgent" => "Mozilla/5.0"
},
"reportLocation" => %{
"filePath" => "/Users/andrew/Projects/os/logger_json/test/formatters/google_cloud_test.exs",
"functionName" => "Elixir.LoggerJSON.Formatters.GoogleCloudTest.test logs exception http context/1",
"lineNumber" => 301
}
"@type" => "type.googleapis.com/google.devtools.clouderrorreporting.v1beta1.ReportedErrorEvent",
"context" => %{
"httpRequest" => %{
"protocol" => "HTTP/1.1",
"referer" => "http://www.example.com/",
"remoteIp" => "",
"requestMethod" => "PATCH",
"requestUrl" => "http://www.example.com/",
"status" => 503,
"userAgent" => "Mozilla/5.0"
},
"domain" => ["elixir"],
"message" => "Hello",
"serviceContext" => %{"service" => "nonode@nohost"},
"stack_trace" => "** (EXIT from #PID<0.250.0>) :foo"
"reportLocation" => %{
"filePath" => "/Users/andrew/Projects/os/logger_json/test/formatters/google_cloud_test.exs",
"functionName" => "Elixir.LoggerJSON.Formatters.GoogleCloudTest.test logs exception http context/1",
"lineNumber" => 301
}
},
"domain" => ["elixir"],
"message" => "Hello",
"serviceContext" => %{"service" => "nonode@nohost"},
"stack_trace" => "** (EXIT from #PID<0.250.0>) :foo",
"severity" => "DEBUG",
"time" => "2024-04-11T21:34:53.503Z"
}
Expand Down

0 comments on commit dcaf8e6

Please sign in to comment.