Skip to content

feat: emit $is_server property on captured events#215

Merged
turnipdabeets merged 6 commits into
mainfrom
feat/add-is-server-property
Jun 3, 2026
Merged

feat: emit $is_server property on captured events#215
turnipdabeets merged 6 commits into
mainfrom
feat/add-is-server-property

Conversation

@turnipdabeets
Copy link
Copy Markdown
Contributor

Adds $is_server: true to every event captured by this SDK so PostHog ingestion can identify server-side events.

@turnipdabeets turnipdabeets requested a review from a team as a code owner June 2, 2026 19:36
@greptile-apps
Copy link
Copy Markdown

greptile-apps Bot commented Jun 2, 2026

Prompt To Fix All With AI
Fix the following 1 code review issue. Work through them one at a time, proposing concise fixes.

---

### Issue 1 of 1
capture_test.go:59-94
**Unnecessary JSON round-trip in test**

The test marshals `apiMsg` to JSON and back into `map[string]interface{}` only to read `properties`. `apiMsg.Properties` is already a `map[string]interface{}` (`Properties` type), so the round-trip adds complexity with no benefit. A direct assertion like `apiMsg.Properties["$is_server"] != true` achieves the same check without superfluous steps.

Reviews (1): Last reviewed commit: "feat: emit $is_server property on captur..." | Re-trigger Greptile

Comment thread capture_test.go
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 2, 2026

posthog-go Compliance Report

Date: 2026-06-03 14:55:28 UTC
Duration: 107308ms

⚠️ Some Tests Failed

39/45 tests passed, 6 failed


Capture Tests

29/29 tests passed

View Details
Test Status Duration
Format Validation.Event Has Required Fields 609ms
Format Validation.Event Has Uuid 608ms
Format Validation.Event Has Lib Properties 608ms
Format Validation.Distinct Id Is String 609ms
Format Validation.Token Is Present 608ms
Format Validation.Custom Properties Preserved 608ms
Format Validation.Event Has Timestamp 608ms
Retry Behavior.Retries On 503 5613ms
Retry Behavior.Does Not Retry On 400 2610ms
Retry Behavior.Does Not Retry On 401 2611ms
Retry Behavior.Respects Retry After Header 5613ms
Retry Behavior.Implements Backoff 15623ms
Retry Behavior.Retries On 500 5613ms
Retry Behavior.Retries On 502 5614ms
Retry Behavior.Retries On 504 5613ms
Retry Behavior.Max Retries Respected 15624ms
Deduplication.Generates Unique Uuids 616ms
Deduplication.Preserves Uuid On Retry 5610ms
Deduplication.Preserves Uuid And Timestamp On Retry 10614ms
Deduplication.Preserves Uuid And Timestamp On Batch Retry 5614ms
Deduplication.No Duplicate Events In Batch 611ms
Deduplication.Different Events Have Different Uuids 611ms
Compression.Sends Gzip When Enabled 608ms
Batch Format.Uses Proper Batch Structure 608ms
Batch Format.Flush With No Events Sends Nothing 605ms
Batch Format.Multiple Events Batched Together 611ms
Error Handling.Does Not Retry On 403 2610ms
Error Handling.Does Not Retry On 413 2611ms
Error Handling.Retries On 408 5613ms

Feature_Flags Tests

⚠️ 10/16 tests passed, 6 failed

View Details
Test Status Duration
Request Payload.Request With Person Properties Device Id 8ms
Request Payload.Flags Request Uses V2 Query Param 7ms
Request Payload.Flags Request Hits Flags Path Not Decide 5ms
Request Payload.Flags Request Omits Authorization Header 7ms
Request Payload.Token In Flags Body Matches Init 5ms
Request Payload.Groups Round Trip 7ms
Request Payload.Groups Default To Empty Object 5ms
Request Payload.Person Properties Distinct Id Auto Populated When Caller Omits It 6ms
Request Payload.Disable Geoip False Propagates As Geoip Disable False 6ms
Request Payload.Disable Geoip Omitted Defaults To False 6ms
Request Payload.Flag Keys To Evaluate Contains Only Requested Key 6ms
Request Lifecycle.No Flags Request On Init Alone 3ms
Request Lifecycle.No Flags Request On Normal Capture 607ms
Request Lifecycle.Two Flag Calls Produce Two Remote Requests 10ms
Request Lifecycle.Mock Response Value Is Returned To Caller 5ms
Side Effect Events.Get Feature Flag Captures Feature Flag Called Event 609ms

Failures

request_payload.request_with_person_properties_device_id

Field 'distinct_id' not found in /flags request body at path 'person_properties.distinct_id'. Available keys: ['$device_id']

request_payload.person_properties_distinct_id_auto_populated_when_caller_omits_it

Field 'distinct_id' not found in /flags request body at path 'person_properties.distinct_id'. Available keys: ['email']

request_payload.disable_geoip_false_propagates_as_geoip_disable_false

Expected geoip_disable=False, got True

request_payload.disable_geoip_omitted_defaults_to_false

Expected geoip_disable=False, got True

request_payload.flag_keys_to_evaluate_contains_only_requested_key

Field 'flag_keys_to_evaluate' not found in /flags request body at path 'flag_keys_to_evaluate'. Available keys: ['api_key', 'distinct_id', 'groups', 'person_properties', 'group_properties', 'geoip_disable']

side_effect_events.get_feature_flag_captures_feature_flag_called_event

Expected 1 events with name '$feature_flag_called', got 2

Comment thread .changeset/is-server-property.md Outdated
@marandaneto
Copy link
Copy Markdown
Member

if we decide to add $is_server to all SDKs, there should be a way to turn it off. Some SDKs can also be used as a client, e.g., the Go SDK could be a CLI and wouldn't be a server-side SDK
same for java, node, etc

@marandaneto marandaneto requested a review from a team June 2, 2026 20:25
@turnipdabeets
Copy link
Copy Markdown
Contributor Author

if we decide to add $is_server to all SDKs, there should be a way to turn it off. Some SDKs can also be used as a client, e.g., the Go SDK could be a CLI and wouldn't be a server-side SDK same for java, node, etc

Made these configurable now, but defaulted to true.

@turnipdabeets turnipdabeets merged commit 554c99a into main Jun 3, 2026
15 checks passed
@turnipdabeets turnipdabeets deleted the feat/add-is-server-property branch June 3, 2026 17:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants