Elixir 苦艾酒仪器

问题描述

我想检测我的苦艾酒/凤凰服务器。我想知道使用 Jason 将数据编码为 json 需要多长时间。

我的 endpoint.ex 文件如下所示:

defmodule AssessmentApi.Web.Endpoint do
  use Phoenix.Endpoint,otp_app: :assessment_api

  socket "/socket",AssessmentApi.Web.UserSocket

  # Serve at "/" the static files from "priv/static" directory.
  #
  # You should set gzip to true if you are running phoenix.digest
  # when deploying your static files in production.
  plug Plug.Static,at: "/",from: :assessment_api,gzip: false,only: ~w(css fonts images js favicon.ico robots.txt)

  if code_reloading? do
    socket "/phoenix/live_reload/socket",Phoenix.LiveReloader.Socket
    plug Phoenix.LiveReloader
    plug Phoenix.CodeReloader
  end

  plug Plug.RequestId
  plug Plug.Logger

  plug Plug.Parsers,parsers: [:urlencoded,:multipart,:json,Absinthe.Plug.Parser],pass: ["*/*"],json_decoder: Jason

  plug Plug.MethodOverride
  plug Plug.Head

  # The session will be stored in the cookie and signed,# this means its contents can be read but not tampered with.
  # Set :encryption_salt if you would also like to encrypt it.
  plug Plug.Session,store: :cookie,key: "adfadfasdfasdfadsf",signing_salt: "asdsfasdfasdfasdf"

  plug CORSPlug
  plug AssessmentApi.Web.Logger
  plug AssessmentApi.Web.Router
end

我的 router.ex 如下所示:

defmodule AssessmentApi.Web.Router do
  use AssessmentApi.Web,:router

  pipeline :api do
    plug AssessmentApi.Guardian.AuthPipeline

    plug :accepts,["json"]
  end

  scope "/" do
    pipe_through :api

    forward "/api",Absinthe.Plug,schema: AssessmentApi.Web.Schema,json_codec: Jason

    forward "/graphiql",Absinthe.Plug.GraphiQL,json_codec: Jason
  end
end

如何检测应用程序的 json_decoder 部分以找出从响应数据中生成 json 需要多长时间?也许使用遥测?

谢谢

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)