-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Handle multiple environments of the same product within one PostHog project #3149
Comments
+1 for this from a user |
The reason we haven't found a need for this while dogfooding is because we deploy to production continuously without staging, and in development we just run the local instance with Probably the best solution would be an intraproject environment switch. Sentry has solved this quite well: |
Pitching in on our use case and hoping it can be helpful, but I don't have a strong opinion on how to go about other than just being able to separate the environments when necessary. For analytics services -- I tend to setup an environment for dev+staging and one separate for production. The reason behind this is that in my experience, we typically use the dev+staging environment to manually make sure events are pushed and received with the correct name and the properties expected. We might play around with a funnel and set that up to verify it works but we wouldn't really make any use of the data or setup actions other than for testing. Production is where we make it important to keep data clean from testing, where either developers or analysts go in and setup actions, dashboards, funnels etc. that we actually use every day. In contrast, for exception tracking (Sentry/AppSignal etc.), I would setup a development, staging and production separately, keeping notifications disabled for dev and enabled for staging + prod. |
Do you know of a way to achieve this without touching every query? |
I would suggest that @Twixes's (2) option is actually sufficient. Wrapping a separate project as a "test" environment would be fine because there would be some unduplicated entities such as actions, feature flags, dashboards but you'll be able to clearly recognize you're on your test environment as @paolodamico has previously mentioned. You'll also be able to clear test data freely. If needed, I think we should add a "sync" option in the test instance that gives the option to sync the test environment with the production environment entities after the fact. This way you can clear your test instance and reload as needed |
Since we already support multiple projects, I'm thinking we could extend this feature by:
|
100% aligned with @EDsCODE's approach (it's what we've been discussing offline). Basically this would only be a frontend change, where we treat a special project as a test project and instead of showing the project in the regular project list, we have a test/live switch that makes it more clear. Let me know if you want some input on the design for this. Also, to avoid confusion with internal users filters and such I would call this very explictly something like "Sandbox" mode. In addition a few nice things that could make the experience better:
|
To your last comment @buwilliams, at first glance I think it would be better to be explicit about a test environment. I think having multiple environments could potentially cause more confusion or dilute the impact of this, but happy to discuss further. |
Should we create a path around multiple projects for self-hosted being a |
I think we already have that, we take them to the pricing page, but if not, makes sense! Though having a test env/project I would not consider a premium feature. I'd still allow users to have the demo project, the test project and the default project. |
Right exactly if I'm understanding you. We should allow people to have access to a default project AND a test project so that they get multiple environment support for free? I don't yet understand how the paywall works. |
You mentioned that this is a frontend change but it seems more like a backend change. Should we automatically create the |
After a chat with @paolodamico where we uncovered some interesting approaches we landed on two:
This means:
|
2c based on the demo from today– I feel like we're giving the test toggle a lot of prominence, but in practice it doesn't strike me as something that would need to be toggled a whole lot. How much do we expect users to be using this and how often do we think teams would need to navigate between test data and production data– When this ships can we do a follow up on how often it's being used? One thing to realize too is that when most things are in production, test environment data is usually filtered out as a side effect of law of large numbers. Generally you will have orders of magnitude less people using a feature in test environments – most teams don't need such a hard distinction and I wonder, for those who do if this would better belong as a separate project than magic functionality on top of current projects. To me it feels a lot cleaner and easier to reason about a complete test environment, rather than a filter being applied ontop of your prod dataset. I realize that not all teams have access to that, but IMO not out of line with our product positioning and could be a good upgrade path. Also just semantically feels like this will get confusing with the test filter. Maybe a way to combine these for the time being would be to just add your prop Though, I think this too would cause issues since a lot of users are probably testing with accounts that have the exact filters that would be filtering them out of this. |
@kpthatsme if you haven't taken a look at the PR some of your concerns were address there. I agree about prominence and large numbers. Using projects for environments is messy to implement and changes the meaning of project. |
Yes, this should replace the current test filters UI in every insights page as it would be quite confusing. What we also need to consider is if we want to keep the existing filtering functionality based on user-defined filters. |
@paolodamico @Twixes doesn't sound like you guys are saying the same thing. I agree with @Twixes that it should be separate. Remember guys, this is all behind a feature flag and a work in-progress. Let's improve the experience on the next round. And... if we all decide we'd rather remove this approach in favor of another that's possible too. |
@paolodamico Hm, well, I still see a point in filtering out internal users, the way I think Buddy was talking about yesterday. We wouldn't really dogfood this feature because of reasons mentioned in my original post up top, but it's been repeatedly brought up by users who do run separate dev/staging/prod environments. |
Hmmm yes I see your point, I think it's worth discussing in a separate issue (let me give it some more thought too). Agreed with the approach @buwilliams ! |
Merged. |
Is your feature request related to a problem?
Currently if you're running your software in separate environments, e.g. the classic: development/staging/production, and are instrumenting analytics within it, you have two options of using PostHog:
environment
(or similar in idea) property.This however has the downside of forcing you to add the appropriate event property everywhere, and may mess up person data.
Describe the solution you'd like
Switching between environments within a project, keeping the setup the same, only with completely separate data.
Or… something else? Ideas welcome!
Additional context
Multiple users have been asking as about this exact same use case and so far our solutions have always been underwhelming due to the above issues.
Thank you for your feature request – we love each and every one!
The text was updated successfully, but these errors were encountered: