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

add featureflag service (Erlang/Elixir) #142

Merged
merged 5 commits into from
Jun 17, 2022

Conversation

tsloughter
Copy link
Member

HTTP interface is on port FEATURE_FLAG_SERVICE_PORT and
the grpc service is run on FEATURE_FLAG_GRPC_SERVICE_PORT.

Creating and updating flags is done through the web interface.
The GRPC service only provides fetching of a flag by name.

Fixes #40

Changes

Please provide a brief description of the changes here.

For significant contributions please make sure you have completed the following items:

  • Appropriate CHANGELOG.md updated for non-trivial changes
  • Design discussion issue #

@tsloughter tsloughter requested a review from a team June 15, 2022 20:06
@tsloughter
Copy link
Member Author

I was going to remove the create, update, list and delete flag rpc's from the service but I wanted to first check if there was any reason a service that uses feature flags might need to do something besides fetching the flag status? For now those rpc's just return "unimplemented" but could be implemented easy enough, and the creation and updating of the flags must be done through the web interface.

The web pages are just the default generated CRUD pages for a Phoenix project and should be re-styled to match the rest of the demo. I'm going to see if anyone in the Erlang/Elixir SIG wants to help, otherwise I'll get around to it at some point. It took a while to find time to do this much and the majority of it is generated :)

@tsloughter tsloughter force-pushed the featureflagservice branch 2 times, most recently from f759a30 to be6ec3b Compare June 15, 2022 20:19
HTTP interface is on port FEATURE_FLAG_SERVICE_PORT and
the grpc service is run on FEATURE_FLAG_GRPC_SERVICE_PORT.

Creating and updating flags is done through the web interface.
The GRPC service only provides fetching of a flag by name.
@tsloughter tsloughter force-pushed the featureflagservice branch from be6ec3b to 7e9b57d Compare June 15, 2022 20:20
@austinlparker
Copy link
Member

I was going to remove the create, update, list and delete flag rpc's from the service but I wanted to first check if there was any reason a service that uses feature flags might need to do something besides fetching the flag status? For now those rpc's just return "unimplemented" but could be implemented easy enough, and the creation and updating of the flags must be done through the web interface.

I can't think of a reason that an existing application might want to modify via RPC. That said, I can see a world where we want to provision flags at runtime/build time... although, in that case it'd make more sense to do so via the DB init script.

@julianocosta89
Copy link
Member

@tsloughter I can't build the image to test locally.
1st it failed on step: COPY rel rel complaining that rel didn't exist.

I've played a bit just to try to see if the rel folder was being created, but then the docker build started to fail at the step: mix assets.deploy.
This one was failing because app.js couldn't find import topbar from "../vendor/topbar".

I've stopped the docker build at this step and exec into it to do some digging, and it seems that the vendor folder is not being created in the assets folder.

Do we need any extra steps in the Dockerfile?

@tsloughter
Copy link
Member Author

@julianocosta89 ok, I'll try blowing away everything not committed to git and see if it fails for me and will debug from there.

@tsloughter
Copy link
Member Author

Woops, yup, rel was not committed, hehe.

@tsloughter
Copy link
Member Author

I don't understand why it doesn't show up in git's list of untracked files... That is why I missed it. I recreated it and still doesn't show up.

@tsloughter
Copy link
Member Author

Ah. the top level .gitignore has bin/, which is the only dir with files under rel.

@tsloughter
Copy link
Member Author

It should work now.

docker-compose.yml Outdated Show resolved Hide resolved
Copy link
Member

@austinlparker austinlparker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm! builds + runs in codespaces. I went ahead and added an external port binding to the web UI for the flag service to make it more easily accessible -- we should consider putting this behind auth once that's available.

@austinlparker austinlparker merged commit 5ec9223 into open-telemetry:main Jun 17, 2022
Copy link
Contributor

@mic-max mic-max left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good and thanks!!

It does feel like this service is quite a lot of files and maybe has some extra complexity that we can see about simplifying in the future.

@@ -55,7 +55,7 @@ def sanitycheck(pattern, allow_utf8 = False, allow_eol = (CRLF, LF), indent = 1)
if c != 32:
break
spc_count += 1
if not indent or spc_count % indent:
if not indent or (spc_count % indent and os.path.basename(filename) != 'rebar.config'):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a better way to ignore files for the sanitycheck.py script?

@@ -0,0 +1,45 @@
# This file excludes paths from the Docker build context.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note to self: Review this

@@ -0,0 +1,37 @@
# The directory Mix will write compiled artifacts to.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add to top-level .gitignore file instead

src/featureflagservice/Dockerfile Show resolved Hide resolved
Then start Postgres with `docker compose`

``` shell
docker compose up
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

docker compose up ffs_postgres ?

Comment on lines +1 to +3
defmodule Featureflagservice.Mailer do
use Swoosh.Mailer, otp_app: :featureflagservice
end
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Necessity?

@@ -0,0 +1,70 @@
// Licensed under the Apache License, Version 2.0 (the "License");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally this file will not be copied/duplicated.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup. Issue is simply that the tool used to generate the proto modules has no option for only generating certain services or messages. I plan to remove this and use the top level demo.proto once that is resolved.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The tool used to generate is the normal protocol buffer compiler protoc from Google right?
Are they adding that functionality?! That's cool and we'd likely make use in other services here too!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, na. Though I assumed protoc already supported that, haha, I've run into this enough I'm surprised. It uses https://github.com/tomas-abrahamsson/gpb/ through the plugin for grpc generation, https://github.com/tsloughter/grpcbox_plugin/

Ideally I could get gpb to also only create the encode/decode for the messages the services I need depend on, but I can at least pretty quickly have the grpc plugin only generate the service modules for the featureflag service.

@@ -0,0 +1,3 @@
#!/bin/sh
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What are these scripts in the rel/overlays directory?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These scripts are what are used to start the Release. See the command at the end of the dockerfile. Which I now see uses CMD instead of ENTRYPOINT for some reason... may change that.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, nm, I bet they use CMD because the wrapper script always runs start, so no use doing a separate entrypoint and cmd like I am used to in Erlang Releases.

%% @end
%%%-------------------------------------------------------------------

%% this module was generated and should not be modified manually
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

^

@tsloughter
Copy link
Member Author

@mic-max yup, there is a lot of extra stuff. I'm hoping to get someone who actually works with the Phoenix framework to take on removing what is unncessary (like the swoosh mail module you point out, the topbar.js, etc). I can certainly do it, but I'll miss stuff, or be spending time on trial and error removal :). I'll try again to get someone to work on this and if I don't get anyone this week I'll start whittling away.

I'll comment individually on the other questions you raised.

GaryPWhite pushed a commit to wayfair-contribs/opentelemetry-demo that referenced this pull request Jun 30, 2022
* add featureflag service (Erlang/Elixir)

HTTP interface is on port FEATURE_FLAG_SERVICE_PORT and
the grpc service is run on FEATURE_FLAG_GRPC_SERVICE_PORT.

Creating and updating flags is done through the web interface.
The GRPC service only provides fetching of a flag by name.

* ignore space indent count if file is rebar.config

* featureflagservice: add release directory to git

* featureflagservice: include vendored js in git repo

* Update docker-compose.yml

Co-authored-by: Austin Parker <[email protected]>
jmichalak9 pushed a commit to jmichalak9/opentelemetry-demo that referenced this pull request Mar 22, 2024
* add featureflag service (Erlang/Elixir)

HTTP interface is on port FEATURE_FLAG_SERVICE_PORT and
the grpc service is run on FEATURE_FLAG_GRPC_SERVICE_PORT.

Creating and updating flags is done through the web interface.
The GRPC service only provides fetching of a flag by name.

* ignore space indent count if file is rebar.config

* featureflagservice: add release directory to git

* featureflagservice: include vendored js in git repo

* Update docker-compose.yml

Co-authored-by: Austin Parker <[email protected]>
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

Successfully merging this pull request may close these issues.

Create a feature flag service
5 participants