Skip to content

Commit

Permalink
feat: Update to event schema v4 (#192)
Browse files Browse the repository at this point in the history
  • Loading branch information
keelerm84 authored Jan 22, 2024
1 parent d123492 commit bec5382
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/LaunchDarkly/Impl/Util.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,9 @@ public static function eventHeaders(string $sdkKey, $applicationInfo): array
{
$headers = Util::defaultHeaders($sdkKey, $applicationInfo);
$headers['X-LaunchDarkly-Event-Schema'] = EventPublisher::CURRENT_SCHEMA_VERSION;
// Only the presence of this header is important. We encode a string
// value of 'true' to ensure it isn't dropped along the way.
$headers['X-LaunchDarkly-Unsummarized'] = 'true';

return $headers;
}
Expand Down
2 changes: 1 addition & 1 deletion src/LaunchDarkly/Subsystems/EventPublisher.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ interface EventPublisher
* @var int
* @ignore
*/
const CURRENT_SCHEMA_VERSION = 2;
const CURRENT_SCHEMA_VERSION = 4;

/**
* @param string $sdkKey The SDK key for your account
Expand Down
1 change: 1 addition & 0 deletions tests/Impl/Integrations/EventPublisherTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ public function testSendsCorrectBodyAndHeaders($publisher)
$this->assertEquals('sdk-key', $headers['Authorization']);
$this->assertEquals('PHPClient/' . LDClient::VERSION, $headers['User-Agent']);
$this->assertEquals(EventPublisher::CURRENT_SCHEMA_VERSION, $headers['X-LaunchDarkly-Event-Schema']);
$this->assertArrayHasKey('X-LaunchDarkly-Unsummarized', $headers);
$this->assertEquals('application-id/my-id application-version/my-version', $headers['X-LaunchDarkly-Tags']);
}
}

0 comments on commit bec5382

Please sign in to comment.