Skip to content

Commit

Permalink
feat: update url to the metrics reporter sdk (#535)
Browse files Browse the repository at this point in the history
* chore: upgrade metrics sdk version to latest(v2.0.0) in package.swift file

* chore: upgrade metrics sdk version to latest(v2.0.0) in podspec file

* chore: update podfile.lock

* chore: update metrics sdk initialization as per latest version

* chore: update sonar cloud issue for nullable data plane url

* chore: update sonar cloud issue for nullable data plane url
  • Loading branch information
SKannaniOS authored Sep 5, 2024
1 parent bac2c04 commit b6cb20e
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 13 deletions.
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ let package = Package(
)
],
dependencies: [
.package(name: "MetricsReporter", url: "https://github.com/rudderlabs/metrics-reporter-ios", .exact("1.2.1")),
.package(name: "MetricsReporter", url: "https://github.com/rudderlabs/metrics-reporter-ios", .exact("2.0.0")),
],
targets: [
.target(
Expand Down
10 changes: 5 additions & 5 deletions Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
PODS:
- MetricsReporter (1.2.1):
- MetricsReporter (2.0.0):
- RSCrashReporter (= 1.0.1)
- RudderKit (= 1.4.0)
- RSCrashReporter (1.0.1)
- Rudder (1.27.0):
- MetricsReporter (= 1.2.1)
- Rudder (1.28.1):
- MetricsReporter (= 2.0.0)
- RudderKit (1.4.0)
- SQLCipher (4.5.4):
- SQLCipher/standard (= 4.5.4)
Expand All @@ -31,9 +31,9 @@ EXTERNAL SOURCES:
:path: "."

SPEC CHECKSUMS:
MetricsReporter: 99596ee5003c69949ed2f50acc34aee83c42f843
MetricsReporter: 364b98791e868b10e9d512eb50af28d8c11e5cdb
RSCrashReporter: 6b8376ac729b0289ebe0908553e5f56d8171f313
Rudder: 3cfcd9e6c5359cd6d49f411101ed9b894e3b64bd
Rudder: 07c2c7f8f02a91a3c8343d7284d3b3b49f8da969
RudderKit: d9d6997696e1642b753d8bdf94e57af643a68f03
SQLCipher: 905b145f65f349f26da9e60a19901ad24adcd381

Expand Down
2 changes: 1 addition & 1 deletion Rudder.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,5 @@ Pod::Spec.new do |s|

s.source_files = 'Sources/**/*.{h,m}'

s.dependency 'MetricsReporter', '1.2.1'
s.dependency 'MetricsReporter', '2.0.0'
end
17 changes: 11 additions & 6 deletions Sources/Classes/RSMetricsReporter.m
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,18 @@ - (instancetype)initWithWriteKey:(NSString *)writeKey preferenceManager:(RSPrefe
self = [super init];
if (self) {
if (preferenceManager.isMetricsCollectionEnabled || preferenceManager.isErrorsCollectionEnabled) {
RSMetricConfiguration *configuration = [[RSMetricConfiguration alloc] initWithLogLevel:config.logLevel writeKey:writeKey sdkVersion:RS_VERSION];
[configuration dbCountThreshold:config.dbCountThreshold];
_metricsClient = [[RSMetricsClient alloc] initWithConfiguration:configuration];
_metricsClient.isMetricsCollectionEnabled = preferenceManager.isMetricsCollectionEnabled;
_metricsClient.isErrorsCollectionEnabled = preferenceManager.isErrorsCollectionEnabled;
NSString *dataPlaneUrl = config.dataPlaneUrl ?: @"";
if (dataPlaneUrl.length > 0) {
RSMetricConfiguration *configuration = [[RSMetricConfiguration alloc] initWithLogLevel:config.logLevel writeKey:writeKey sdkVersion:RS_VERSION sdkMetricsUrl:dataPlaneUrl];
[configuration dbCountThreshold:config.dbCountThreshold];
_metricsClient = [[RSMetricsClient alloc] initWithConfiguration:configuration];
_metricsClient.isMetricsCollectionEnabled = preferenceManager.isMetricsCollectionEnabled;
_metricsClient.isErrorsCollectionEnabled = preferenceManager.isErrorsCollectionEnabled;
} else {
[RSLogger logWarn:@"RSMetricsReporter: Data plane url cannot be nil or empty."];
}
} else {
[RSLogger logWarn:@"RSMetricsReporter: Metrics and Errors collection is disabled."];
[RSLogger logWarn:@"RSMetricsReporter: Metrics and Errors collection is disabled."];
}
}
return self;
Expand Down

0 comments on commit b6cb20e

Please sign in to comment.