forked from onyx-dot-app/onyx
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MT Cloud Monitoring (onyx-dot-app#3465)
- Loading branch information
1 parent
bd17ffd
commit d2b441e
Showing
19 changed files
with
413 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
"""Milestone | ||
Revision ID: 91a0a4d62b14 | ||
Revises: dab04867cd88 | ||
Create Date: 2024-12-13 19:03:30.947551 | ||
""" | ||
from alembic import op | ||
import sqlalchemy as sa | ||
import fastapi_users_db_sqlalchemy | ||
from sqlalchemy.dialects import postgresql | ||
|
||
# revision identifiers, used by Alembic. | ||
revision = "91a0a4d62b14" | ||
down_revision = "dab04867cd88" | ||
branch_labels = None | ||
depends_on = None | ||
|
||
|
||
def upgrade() -> None: | ||
op.create_table( | ||
"milestone", | ||
sa.Column("id", sa.UUID(), nullable=False), | ||
sa.Column("tenant_id", sa.String(), nullable=True), | ||
sa.Column( | ||
"user_id", | ||
fastapi_users_db_sqlalchemy.generics.GUID(), | ||
nullable=True, | ||
), | ||
sa.Column("event_type", sa.String(), nullable=False), | ||
sa.Column( | ||
"time_created", | ||
sa.DateTime(timezone=True), | ||
server_default=sa.text("now()"), | ||
nullable=False, | ||
), | ||
sa.Column("event_tracker", postgresql.JSONB(), nullable=True), | ||
sa.ForeignKeyConstraint(["user_id"], ["user.id"], ondelete="CASCADE"), | ||
sa.PrimaryKeyConstraint("id"), | ||
sa.UniqueConstraint("event_type", name="uq_milestone_event_type"), | ||
) | ||
|
||
|
||
def downgrade() -> None: | ||
op.drop_table("milestone") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
from posthog import Posthog | ||
|
||
from ee.onyx.configs.app_configs import POSTHOG_API_KEY | ||
from ee.onyx.configs.app_configs import POSTHOG_HOST | ||
|
||
posthog = Posthog(project_api_key=POSTHOG_API_KEY, host=POSTHOG_HOST) | ||
|
||
|
||
def event_telemetry( | ||
distinct_id: str, | ||
event: str, | ||
properties: dict | None = None, | ||
) -> None: | ||
posthog.capture(distinct_id, event, properties) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.