-
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
feat: Add dotnet_events
to the usage report
#29206
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR Summary
Added support for tracking events from the posthog-dotnet
library in the usage report, enabling visibility into .NET SDK usage alongside other client libraries.
- Added
dotnet_events_count_in_period
field to theUsageReportCounters
dataclass in/posthog/tasks/usage_report.py
- Added condition to identify events from the
posthog-dotnet
library in the SQL query that categorizes events by source - Added
dotnet_events
to the metrics dictionary that collects SDK usage statistics - Included the new metric in team report generation to ensure it's properly tracked and reported
1 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings | Greptile
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seems reasonable to me, but I'd get an opinion from @zlwaterfield or someone else in growth before merging.
Looks good |
Thanks @zlwaterfield. It looks like the same unit test is consistently failing and I'm not sure why. I tried running it locally, but I get unrelated exceptions such as failure to drop tables in use, etc. I tried recreating the clickhouse container ( # Stop the container
docker stop 917f02afdaa9
# Remove the container
docker rm 917f02afdaa9
# Remove the volume
docker volume rm 0782200f2267f1bf332366ebc20593ff989e84b068175673318d51072a9fe4a3
# Start services again
docker compose -f docker-compose.dev.yml up -d
# 1. Create test database
docker exec -it $(docker ps | grep clickhouse | awk '{print $1}') clickhouse-client --query "CREATE DATABASE IF NOT EXISTS posthog_test"
# 2. Run Django migrations first
DEBUG=1 python manage.py migrate
# 3. Run ClickHouse migrations with test database
DEBUG=1 CLICKHOUSE_DATABASE=posthog_test python manage.py migrate_clickhouse --no-input
# 4. Run the test
DEBUG=1 python manage.py test posthog.tasks.test.test_usage_report.UsageReport.test_unlicensed_usage_report -v 3 And when I run the test, I get:
So I'm at a loss trying to figure out why this test is failing. |
Hopefully this fixes the test.
This adds the tracking of events from the
posthog-dotnet
library to the usage report.Changes
Added
dotnet_events
,teams_with_dotnet_events_count_in_period
,dotnet_events_count_in_period
tousage_report.py
Does this work well for both Cloud and self-hosted?
Yes
How did you test this code?
Tried to run the usage report locally. No errors. Wasn't able to confirm results.