https://www.growthbook.io/ logo
#ask-questions
Title
# ask-questions
f

few-electrician-23747

03/16/2023, 2:01 AM
Hey Hi All! Someone who has done whole DB setup with postgres , kindly help me! I am stuck for 2 days here!
f

fresh-football-47124

03/16/2023, 2:02 AM
Hi Star
if we break the problems down in to a few pieces
Were you able to get the SDK to correctly bucket users?
f

few-electrician-23747

03/16/2023, 2:04 AM
As in passing the exact attributed to the flag in my SDK?
f

fresh-football-47124

03/16/2023, 2:05 AM
like the code you were playing with earlier
were you able to get the feature to turn on and off with the flag?
f

few-electrician-23747

03/16/2023, 2:06 AM
yes
thats working
f

fresh-football-47124

03/16/2023, 2:06 AM
okay cool
so where are you stuck now?
f

few-electrician-23747

03/16/2023, 2:07 AM
1. I have created a A/B experiment for that feature flad. What I expect if my feature flag is on. I should see a metric / graph in my experimentation
Thats not happening
2. I see we have to connect to a database and I am using postgres for that. I have created viewed_experiments with 4 columns.
Nothing is happening on that table!
Acrually I need to complete two complex POC. I can only do that if I am unblocked else we might not go for this product
Copy code
{
  "status": 200,
  "features": {
    "test-feature": {
      "defaultValue": true,
      "rules": [
        {
          "condition": {
            "loggedIn": true
          },
          "variations": [
            true,
            false
          ],
          "coverage": 1,
          "weights": [
            0.5,
            0.5
          ],
          "key": "test-feature-tracking",
          "hashAttribute": "id"
        }
      ]
    }
  },
  "dateUpdated": "2023-03-15T08:43:57.399Z"
}
Screenshot 2023-03-16 at 7.41.36 AM.png
Screenshot 2023-03-16 at 7.42.34 AM.png
f

fresh-football-47124

03/16/2023, 2:15 AM
okay - what do you have for your trackingCallback?
f

few-electrician-23747

03/16/2023, 2:17 AM
Copy code
context := growthbook.NewContext().
		WithFeatures(features).WithTrackingCallback(func(experiment *growthbook.Experiment, result *growthbook.ExperimentResult) {
		log.Println("Viewed Experiment")
		log.Println("Experiment Id", experiment.Key)
		log.Println("Variation Id", result.VariationID)
	})
f

fresh-football-47124

03/16/2023, 2:18 AM
okay
so GrowthBook doesn’t do the event tracking for you
so you’d need to have some way to fire that event to whatever event tracking you’re using
do you have an event tracker now?
f

few-electrician-23747

03/16/2023, 2:19 AM
I am not aware of that
Like how event tracker works?
f

fresh-football-47124

03/16/2023, 2:20 AM
Screen Shot 2023-03-15 at 7.20.10 PM.png
you can use any event tracking you like - RudderStack, Google Analytics, Segment, Jitsu, Snowplow, etc
how do you track events on your product currently?
f

few-electrician-23747

03/16/2023, 2:21 AM
We dont have explicit event tracking mechanism for the product
I was hoping to integrate with postgres some how
f

fresh-football-47124

03/16/2023, 2:22 AM
yes, Rudderstack, Jitsu, or Segment would let you do that
f

few-electrician-23747

03/16/2023, 2:23 AM
so basically what I understand is between postgres and growtbook I need to keep jitsu for event tracking ?
DO you have some sample code etc around that?
f

fresh-football-47124

03/16/2023, 2:23 AM
there isn’t much code to add
just something like jitsu.track(experiment.key, result.VariationID)
You want to use an event tracker as doing that data pipelining is non-trivial and you want to have them batched when writing to your database
f

few-electrician-23747

03/16/2023, 2:26 AM
I am sorry I cannot understand that part.
f

fresh-football-47124

03/16/2023, 2:31 AM
you can typically break data into two parts, application data (like users, states, etc), and analytics data (event tracking, etc) - for application data, having the right data is critical, so you will wait for that data to load. For analytics data, it’s not critical, so you want to have it not disrupt your user’s experience.
So eventually consistency is okay for analytics data
thats where event trackers come into play
f

few-electrician-23747

03/16/2023, 2:33 AM
ok I hope it could have been done with kafka etc. or something integrated with Growthbook
I have one more question. So Growthbook can only be connected through events. Why do we have database connection anyways then?
I was hoping that we can create alternative rules in feature flags based on users in the database. Or we can enable a feature flag for only certain users in that database. So for that, we need to provide some kind of DB connection.
Screenshot 2023-03-16 at 8.13.15 AM.png
f

fresh-football-47124

03/16/2023, 2:53 AM
you can do that, but you have to push that db info down to the SDK level
to make the evaluation very fast, waiting for a DB request would be too slow for most users.
that data source page is for pulling exposure information and generating reports of experiments
f

few-electrician-23747

03/16/2023, 3:41 AM
so correct me if I am wrong. What I understand is 1) TO get userbase info we need to call user from our own database in my golang code, based on that i need to add attributes in the context and make a call to Growthbook. After that I need to update my Database if the experiment ran from my golang code only. The job of Grwothbook there is just to read the updated data and show metrics out of it
f

fresh-football-47124

03/16/2023, 4:14 AM
yes, pretty close
f

few-electrician-23747

03/16/2023, 4:17 AM
is write operation from growthbook to database is possible ?
is the growth book acts as a lister service only?
f

fresh-football-47124

03/16/2023, 4:18 AM
We do all the parts except tracking
f

few-electrician-23747

03/16/2023, 4:31 AM
got it so it does evaluation and acts as a listener service
16 Views