opentelemetry-demo icon indicating copy to clipboard operation
opentelemetry-demo copied to clipboard

Add a new Elixir example service

Open joshleecreates opened this issue 2 months ago • 5 comments

Feature Request

Since the feature flag service was replaced with flagd, we need to provide an example erlang or elixir service, ideally one that is an optional sub component of the demo.

Additional Context

Previous discussion: https://github.com/open-telemetry/opentelemetry-demo/issues/1343#issuecomment-2041293323

joshleecreates avatar Apr 08 '24 22:04 joshleecreates

Based on the latest discussions in this SIG and with the Erlang SIG, there is interest in exploring a chat application to show something Elixir-y with Phoenix Channels / Presence.

I put together a quick proof of concept adding otel instrumentation to this example chat app. This app uses Phoenix liveview to establish and render the initial page view, then uses a socket connection to a Phoenix channel for the chat messages.

The paths on phoenix liveview and ecto are already instrumented with the opentelemetry-erlang-contrib libraries, but the messages passed on the phoenix channel are not traced (automatically). It's easy enough to add traces manually. Adding auto-instrumentation for Phoenix channels to the contrib library may also be worthwhile (I'll open a separate issue to discuss this).

Questions to be answered:

  • Are we good with moving forward with a Phoenix-based chat application similar to this example? If yes:
  • Do we want to use Phoenix Liveview for rendering the chat chrome (maybe embedded with an iframe as suggested by @austinlparker) or support a JS frontend (or both)?
  • Are manual root spans on the socket messages ok for the time-being?
  • Maybe we could use span links to link all spans originating from the same socket connection?

joshleecreates avatar Apr 08 '24 22:04 joshleecreates

You mention iframe. So you are thinking it'd be one of those chats that can popup in the corner of a webpage?

tsloughter avatar Apr 10 '24 12:04 tsloughter

You mention iframe. So you are thinking it'd be one of those chats that can popup in the corner of a webpage?

yep

julianocosta89 avatar Apr 10 '24 12:04 julianocosta89

I'm heading out on vacation for a week today but based on the conversation this week in the SIG meeting, next week I will refactor the example application into a PR. I will use manual instrumentation for now while the Elixir instrumentation issue makes its way through the process. I will use Ecto to store the messages in a Postgres database, but I will use the shell scripts created by @puckpuck for seeding the Postgres database. I think this service should probably also call another downstream service like perhaps ProductCatalogService.

joshleecreates avatar Apr 18 '24 13:04 joshleecreates

@joshleecreates thanks for taking care of this. I miss our Erlang/Elixir service 😅

I think adding a call from the chat app to the ProductCatalogService would be great, because than we can also demonstrate context propagation for Elixir.

julianocosta89 avatar Apr 19 '24 09:04 julianocosta89