Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Sources/Sentry/Profiling/SentryProfilerSerialization.mm
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,7 @@
const auto header =
[[SentryEnvelopeItemHeader alloc] initWithType:SentryEnvelopeItemTypeProfileChunk
length:JSONData.length];
header.platform = @"cocoa";
const auto envelopeItem = [[SentryEnvelopeItem alloc] initWithHeader:header data:JSONData];

return [[SentryEnvelope alloc] initWithId:chunkID singleItem:envelopeItem];
Expand Down
6 changes: 6 additions & 0 deletions Sources/Sentry/Public/SentryEnvelopeItemHeader.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@ SENTRY_NO_INIT
@property (nonatomic, readonly, copy, nullable) NSString *filename;
@property (nonatomic, readonly, copy, nullable) NSString *contentType;

/**
* Some envelopes need to report the platform name for enhanced rate limiting functionality in
* relay.
*/
@property (nonatomic, copy, nullable) NSString *platform;

@end

NS_ASSUME_NONNULL_END
4 changes: 4 additions & 0 deletions Sources/Sentry/SentryEnvelopeItemHeader.m
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@
[target setValue:self.contentType forKey:@"content_type"];
}

if (self.platform) {
[target setValue:self.contentType forKey:@"platform"];

Check warning on line 52 in Sources/Sentry/SentryEnvelopeItemHeader.m

View check run for this annotation

Codecov / codecov/patch

Sources/Sentry/SentryEnvelopeItemHeader.m#L52

Added line #L52 was not covered by tests
}

[target setValue:[NSNumber numberWithUnsignedInteger:self.length] forKey:@"length"];

return target;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,7 @@ private extension SentryContinuousProfilerTests {
XCTAssertEqual(1, envelope.items.count)
let profileItem = try XCTUnwrap(envelope.items.first)
XCTAssertEqual("profile_chunk", profileItem.header.type)
XCTAssertEqual("cocoa", profileItem.header.platform)
let data = profileItem.data
let profile = try XCTUnwrap(try JSONSerialization.jsonObject(with: data) as? [String: Any])

Expand Down
2 changes: 1 addition & 1 deletion scripts/.clang-format-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
20.1.0
20.1.1
Loading