Skip to content

Instantly share code, notes, and snippets.

View wttj-tech's full-sized avatar

WTTJ Tech wttj-tech

View GitHub Profile
@wttj-tech
wttj-tech / observability_noise_reduction_sentry_event_filter.ex
Created September 13, 2023 09:04
observability_noise_reduction_sentry_event_filter.ex
defmodule Sentry.DefaultEventFilter do
@behaviour Sentry.EventFilter
@moduledoc false
@ignored_exceptions [
Phoenix.NotAcceptableError,
Phoenix.Router.NoRouteError,
Plug.Conn.InvalidQueryError,
Plug.Parsers.BadEncodingError,
@wttj-tech
wttj-tech / observability_noise_reduction_sentry_config.ex
Created September 13, 2023 09:04
observability_noise_reduction_sentry_config.ex
config :sentry,
filter: MyAppWeb.SentryEventFilter
# other Sentry configuration keys
@wttj-tech
wttj-tech / observability_noise_reduction_crash_report.log
Created September 13, 2023 09:03
observability_noise_reduction_crash_report.log
=CRASH REPORT==== 14-May-2019::10:00:59.621479 ===
crasher:
initial call: erl_eval:'-expr/5-fun-3-'/0
pid: <0.78.0>
registered_name: []
exception error: pang
in function shell:apply_fun/3 (shell.erl, line 907)
ancestors: [<0.76.0>]
message_queue_len: 0
messages: []
Repo.get(User, id)
|> EctoAnon.run(Repo, cascade: true)
{:ok,
%User{
email: "redacted",
firstname: "Emilie",
last_sign_in_at: ~U[2018-01-01 00:00:00Z],
lastname: "redacted",
favorite_quote: %Quote{
defmodule User do
use Ecto.Schema
use EctoAnon.Schema
anon_schema [
:lastname,
:email,
:followers,
:favorite_quote,
:quotes,
user = Repo.get(User, id)
%User{name: "jane", age: 24, email: "[email protected]"}
EctoAnon.run(user, Repo)
{:ok, %User{name: "redacted", age: 24, email: "redacted"}}
defmodule User do
use Ecto.Schema
use EctoAnon.Schema
anon_schema [
:name,
:email
]
schema "users" do
config :module_name, :atom,
host: System.get_env("MODULE_HOST", "localhost"),
port: String.to_integer(System.get_env("MODULE_PORT", "8126")),
defmodule Mix.Tasks.Tmp.BackfillGender do
use Mix.Task
import Ecto.Query
@shortdoc "Backfill gender with title data in users table"
def run(_) do
sql_query = ~S"""
UPDATE users SET
gender = mapping.gender
FROM (VALUES
defmodule WttjApiWeb.Api.UserView do
use WttjApiWeb, :view
def render("user.json", %{user: user}) do
%{
gender: user.gender,
title: user.title
}
end
end