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

ScoutApm.Command does not work in Elixir 1.14 #123

Open
pvthuyen opened this issue Oct 12, 2022 · 8 comments
Open

ScoutApm.Command does not work in Elixir 1.14 #123

pvthuyen opened this issue Oct 12, 2022 · 8 comments

Comments

@pvthuyen
Copy link
Contributor

Implementations for ScoutApm.Command are not recognized by Elixir 1.14. I've included the stack trace and errors below. I'm guessing that it's because we are defining the implementation inside the modules.

** (Protocol.UndefinedError) protocol ScoutApm.Command not implemented for %ScoutApm.Command.Batch{commands: [%ScoutApm.Command.StartRequest{timestamp: ~N[2022-10-12 04:05:26.620713], request_id: "Abv3nnKNCVMm"}, %ScoutApm.Command.StartSpan{timestamp: ~N[2022-10-12 04:05:26.620713], request_id: "Abv3nnKNCVMm", span_id: "rNE42VNUmsI5", parent: nil, operation: "Job/WallChannel.check_access"}, %ScoutApm.Command.StopSpan{timestamp: ~N[2022-10-12 04:05:26.800598], request_id: "Abv3nnKNCVMm", span_id: "rNE42VNUmsI5"}, %ScoutApm.Command.FinishRequest{timestamp: ~N[2022-10-12 04:05:26.800598], request_id: "Abv3nnKNCVMm"}]} of type ScoutApm.Command.Batch (a struct). This protocol is implemented for the following type(s): Kernel
    (scout_apm 1.0.7) lib/scout_apm/commands.ex:1: ScoutApm.Command.impl_for!/1
    (scout_apm 1.0.7) lib/scout_apm/commands.ex:2: ScoutApm.Command.message/1
    (scout_apm 1.0.7) lib/scout_apm/tracked_request.ex:227: anonymous fn/1 in ScoutApm.TrackedRequest.build_collector_fn/1
    (scout_apm 1.0.7) lib/scout_apm/tracked_request.ex:110: ScoutApm.TrackedRequest.stop_layer/2
    (scout_apm 1.0.7) lib/scout_apm/tracked_request.ex:259: ScoutApm.TrackedRequest.with_saved_tracked_request/1
@dlanderson
Copy link
Contributor

Thanks @pvthuyen. @jeregrine is this something RokkinCat can help with?

@pvthuyen
Copy link
Contributor Author

I tried to fix the issue and upgrade Elixir version to 1.14 in this PR. Please give it a review.

#124

@jeregrine
Copy link

Sorry for delay. I will take alook now.

@jeregrine
Copy link

@pvthuyen I need to do some more testing but master branch should be fully functioning now thanks to your PR and some extra stuff I needed to do.

Please confirm by pointing your mix dep to github {:scout_apm, github: "scoutapp/scout_apm_elixir"} and running it.

@pvthuyen
Copy link
Contributor Author

Thanks @jeregrine. I will try it on my project later. I have a small comment on your commit though, 4b9c43f#r87762936.

@pvthuyen
Copy link
Contributor Author

pvthuyen commented Oct 25, 2022

I'm getting this when running my project after updating the dependencies.

** (Mix) Could not start application scout_apm: exited in: ScoutApm.Application.start(:normal, [])
    ** (EXIT) an exception was raised:
        ** (MatchError) no match of right hand side value: {:error, {:shutdown, {:failed_to_start_child, ScoutApm.Core.AgentManager, {:EXIT, {:undef, [{ScoutApm.Core.AgentManager, :start_link, [[]], []}, {:supervisor, :do_start_child_i, 3, [file: 'supervisor.erl', line: 414]}, {:supervisor, :do_start_child, 2, [file: 'supervisor.erl', line: 400]}, {:supervisor, :"-start_children/2-fun-0-", 3, [file: 'supervisor.erl', line: 384]}, {:supervisor, :children_map, 4, [file: 'supervisor.erl', line: 1242]}, {:supervisor, :init_children, 2, [file: 'supervisor.erl', line: 350]}, {:gen_server, :init_it, 2, [file: 'gen_server.erl', line: 423]}, {:gen_server, :init_it, 6, [file: 'gen_server.erl', line: 390]}]}}}}}
            (scout_apm 1.0.7) lib/scout_apm/application.ex:20: ScoutApm.Application.start/2
            (kernel 8.1.2) application_master.erl:293: :application_master.start_it_old/4

@pvthuyen
Copy link
Contributor Author

pvthuyen commented Oct 25, 2022

It's due to ScoutApm.Core.AgentManager does not have the correct start_link definition. Sent a PR for it.

#125

@pvthuyen
Copy link
Contributor Author

@jeregrine master branch seems to work on my project now. Please kindly help me release a new version.

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

No branches or pull requests

3 participants