Repository: PostHog/posthog
Pull request: Add helm info to instance status page
## Changes

Closes https://github.com/PostHog/charts-clickhouse/issues/97

if helm info env doesn't exist nothing changes.

if the env exists we see this: 

<img width="1242" alt="Screen Shot 2021-09-08 at 18 18 13" src="https://user-images.githubusercontent.com/890921/132547241-427333e1-90c9-4583-b9a2-687e8b9fb62e.png">

Note that I tested by defining it locally via `export HELM_INSTALL_INFO="{\"chart_version\":\"3.7.1\",\"cloud\":\"na\",\"deployment_type\":\"helm\",\"hostname\":null,\"ingress_type\":\"\",\"operation\":\"install\",\"release_name\":\"posthog\",\"release_revision\":1}"` before running `python manage.py runserver`

## Checklist

- [ ] All querysets/queries filter by Organization, by Team, and by User
- [ ] Django backend tests
- [ ] Jest frontend tests
- [ ] Cypress end-to-end tests
- [ ] Migrations are safe to run at scale (e.g. PostHog Cloud) – present proof if not obvious
- [ ] New/changed UI is decent on smartphones (viewport width around 360px)


Problem statement:
Add chart version to instance status page
## Is your feature request related to a problem?

Having the chart version there in addition to other metrics can help us detect faster that someone's using old version. 

## Describe the solution you'd like

instance/status page has chart version too

## Describe alternatives you've considered

As is, no chart version there

## Additional context

Make sure this works reasonably on cloud.

#### *Thank you* for your feature request – we love each and every one!

Hints from issue discussion:

Commit message: Use helm install info instead

Patch to review:
diff --git a/posthog/api/instance_status.py b/posthog/api/instance_status.py
index f47b7b11c0f8b..d8a221e09dcd8 100644
--- a/posthog/api/instance_status.py
+++ b/posthog/api/instance_status.py
@@ -1,3 +1,5 @@
+import json
+import os
 from typing import Any, Dict, List, Union
 
 from django.db import connection
@@ -44,6 +46,17 @@ def list(self, request: Request) -> Response:
 
         metrics.append({"key": "posthog_git_sha", "metric": "PostHog Git SHA", "value": GIT_SHA})
 
+        helm_info = json.loads(os.getenv("HELM_INSTALL_INFO", "{}"))
+        if len(helm_info) > 0:
+            metrics.append(
+                {
+                    "key": "helm",
+                    "metric": "Helm Info",
+                    "value": "",
+                    "subrows": {"columns": ["key", "value"], "rows": list(helm_info.items())},
+                }
+            )
+
         metrics.append(
             {
                 "key": "analytics_database",


Code review comments:
diff_hunk: @@ -44,6 +46,17 @@ def list(self, request: Request) -> Response:
 
         metrics.append({"key": "posthog_git_sha", "metric": "PostHog Git SHA", "value": GIT_SHA})
 
+        helm_info = json.loads(os.getenv("HELM_INSTALL_INFO", "{}"))
path: posthog/api/instance_status.py
text: @user1:
`get_helm_info_env` function already exists