Skip to content

Commit 7c7fe85

Browse files
committed
Merge pull request #32 from amco/doc_updates
Updated docs for 1.0.0 release
2 parents dd1159a + 4ffe39c commit 7c7fe85

File tree

3 files changed

+132
-27
lines changed

3 files changed

+132
-27
lines changed

CHANGELOG.md

Lines changed: 92 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,94 @@
1+
### Version 1.0.0
2+
3+
This is a major revision which means **APIs will break**. It is not backwards compatible with 0.1.x releases. Code from 0.1.x branches will no longer be supported. Please update!
4+
5+
#### Demo Project
6+
7+
* Added descriptions and examples on how to use various features to demo project
8+
9+
#### Metrics
10+
11+
* Added `metricNamed:valued:` to `LibratoMetric` (https://github.com/amco/librato-iOS/commit/0e10150892820ab7185bbd7752a2ec564d0cc458)
12+
* Added `metricNamed:valued:source:measureTime:` to `LibratoMetric` (https://github.com/amco/librato-iOS/commit/0e10150892820ab7185bbd7752a2ec564d0cc458)
13+
* Fixed `metricTime` not being set when passed in via `metricNamed:valued:options:` (https://github.com/amco/librato-iOS/commit/0e10150892820ab7185bbd7752a2ec564d0cc458)
14+
* Changed metrics to extend Mantle instead of `NSObject` (https://github.com/amco/librato-iOS/commit/e418ff7c1dd824c55529d0588ae6677a5a4b7062)
15+
* Changed `isValidValue` from instance to class method
16+
* Changed maximum metric age from one year to fifteen minutes (Librato Metric rules) (https://github.com/amco/librato-iOS/commit/53fbe0bee6a22e34b698f212d01a188ea40b9468)
17+
* Added automatic collection of device, OS, app and Librato library metrics when a `Librato` instance is initialized (https://github.com/amco/librato-iOS/commit/5ce4d5d16b49dd5a09e21c5e09eb48881157c0d4)
18+
* Fixed `LibratoClient.metrics` to report queued metrics instead of blank `NSDictionary`
19+
* Fixed queue firing `removeAllObjects` when `clear`ing instead of overwriting with new `NSMutableDictonary` so dictionary children are `release`d. (https://github.com/amco/librato-iOS/commit/704c245a1710ac6989d13d8b54d50d24206d8c53)
20+
21+
#### Collections
22+
23+
* Added `LibratoMetricCollection` which contains metrics based on type and handles conversion of metrics into structured JSON (https://github.com/amco/librato-iOS/commit/704c245a1710ac6989d13d8b54d50d24206d8c53)
24+
25+
#### Initialization
26+
27+
* Added `NSAsserts` in Librato, LibratoMetric and LibratoGaugeMetric `init` to disable use in favor of their custom initialization methods (https://github.com/amco/librato-iOS/commit/ebc4dcd5ed976607f1e13acff5cdaa9fdcf26adb)
28+
29+
#### Submission
30+
31+
* Added `add:` interface which is preferred over `submit:`
32+
* Changed manual submission to an optional command as queues are automatically submitted on a configurable interval (https://github.com/amco/librato-iOS/commit/fda9cbaeaa4525e61bff0c53932d94b2a6c47190)
33+
* Added global block handlers for submission success and failure (https://github.com/amco/librato-iOS/commit/e3e095cb26579446400e9ac61a33fb9e940ef8da)
34+
* Changed queue to clear just before firing submission instead of after successful submission to prevent accidental double submission (https://github.com/amco/librato-iOS/commit/5ce4d5d16b49dd5a09e21c5e09eb48881157c0d4)
35+
* Note: Queue is not cached before clearing, would could be useful if submission fails to re-queue items
36+
37+
#### Offline
38+
39+
* Added prevention of metrics submission if device is offline (https://github.com/amco/librato-iOS/commit/704c245a1710ac6989d13d8b54d50d24206d8c53)
40+
* Added automatic queue submission when internet becomes available
41+
* Added storage of queue in `NSKeyedArchiver` when app is backgrounded
42+
* Added queue hydration via `NSKeyedArchiver` when app is brought to foreground
43+
44+
#### Group metrics
45+
46+
* Added `groupNamed:valued:` to convert an `NSDictionary` into an array of `LibratoMetric`s (https://github.com/amco/librato-iOS/commit/fa4a9a5cf525e6ed04192e41b8bb709e57612a57)
47+
* Added `groupNamed:context:` to automatically prefix any metrics created in the context with the group name
48+
49+
#### Notification subscription
50+
51+
* Added ability of `Librato` to subscribe to notifications with `listenForNotification:context:` and perform given `context` when notification is caught (https://github.com/amco/librato-iOS/commit/4a7b5a974263b596bdaa1e74943c36d586b93f51)
52+
* Added queue specific to Librato subscriptions for `dispatch_async`ing execution of assigned `context`
53+
54+
#### User agent
55+
56+
* Added custom user agent setting available in `Librato` (https://github.com/amco/librato-iOS/commit/24e9edbc8dc03546fb8976239503a4c3ce3aab52)
57+
* Removed `agentIdentifier` from `LibratoClient`
58+
59+
#### Descriptions
60+
61+
* Added custom descriptions for Librato, LibratoClient, LibratoMetric, LibratoMetricCollection and LibratoQueue to aid debugging (https://github.com/amco/librato-iOS/commit/704c245a1710ac6989d13d8b54d50d24206d8c53)
62+
63+
#### Miscellaneous
64+
65+
* Removed numerous `NSLog`s. Sorry about the extra noise. (https://github.com/amco/librato-iOS/commit/474fe9a115ffe308eb2e858a93af0453568e76ad, https://github.com/amco/librato-iOS/commit/7433254602cdc3d3b6d9b755766a929b82d73805)
66+
167
### Version 0.1.0
268

3-
* Initial commit and functionality
69+
Initial commit and functionality
70+
71+
* Code available via CocoaPods
72+
73+
#### Metrics
74+
75+
* Create counter metric
76+
* Create group metric, statistics automatically computed
77+
* Name and source fields automatically cleaned and trimmed
78+
* Custom prefix available to be applied to all metric names
79+
* Values for all fields can be manipulated after initialization
80+
81+
#### Submission
82+
83+
* Metric types offered but `NSDictionary` data automatically parsed into appropriate Metric type and queued
84+
* Metrics only queued until manual submission
85+
* Only available parser is direct JSON parsing
86+
87+
#### Queue
88+
89+
* Add-only, no management
90+
* Manual submission
91+
92+
#### Localization
93+
94+
* Error messages localized for English

README.md

Lines changed: 38 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
librato-iOS
22
===========
33

4-
`librato-iOS` integrates with your iOS application (via [CocoaPods](http://cocoapods.org/)) to make reporting your metrics to [Librato](http://librato.com/) super easy. Reporting is done asynchronously and is designed to stay out of your way while allowing you to dig into each report's details, if you want.
4+
`librato-iOS` integrates with your iOS application (via [CocoaPods](http://cocoapods.org/)) to make reporting your metrics to [Librato](http://librato.com/) super easy. Reporting is done asynchronously and is designed to stay out of your way while allowing you to dig into each metric's details, if you want.
55

66
Metrics are automatically cached while the network is unavailable and saved if the app closes before they're submitted. Don't worry about submitting metrics, we make sure they don't go missing before they can be handed off to Librato's service.
77

@@ -14,16 +14,16 @@ After installing `librato-iOS` into your workspace with CocoaPods just create a
1414
```objective-c
1515
#import "Librato.h"
1616

17-
...
18-
// The prefix is optional but recommended as it helps you organize across your different projects
19-
Librato *librato = [Librato.alloc initWithEmail:@"user@somewhere.com" apiKey:@"abc123..." prefix:@""];
17+
// The prefix is optional but recommended as it
18+
// helps you organize across your different projects
19+
Librato *librato = [Librato.alloc initWithEmail:@"user@somewhere.com"
20+
apiKey:@"abc123..."
21+
prefix:@""];
2022

21-
// You can provide an NSDictionary with values for the optional "source" and "measure_time" fields
22-
LibratoMetric *filesOpened = [LibratoMetric metricNamed:@"files.opened" valued:@42 options:nil];
23-
// Optional values can be set directly on the metric object as well.
24-
// NOTE: The maximum age for any submitted metric is fifteen minutes, as dictated by Librato.
25-
filesOpened.measureTime = [NSDate.date dateByAddingTimeInterval:-10];
23+
// Create a metric with a specific name and value
24+
LibratoMetric *filesOpened = [LibratoMetric metricNamed:@"files.opened" valued:@42];
2625

26+
// Add it to the queue to be automatically submitted
2727
[librato add:filesOpened];
2828
```
2929
@@ -56,7 +56,7 @@ Two types of measurement are currently available: counts and groups. These act a
5656
This is the default metric type and requires only an NSString name and NSNumber value.
5757
5858
```objective-c
59-
LibratoMetric *metric = [LibratoMetric metricNamed:@"downloads" valued:@42 options:nil];
59+
LibratoMetric *metric = [LibratoMetric metricNamed:@"downloads" valued:@42];
6060
```
6161

6262
Additionally, you can provide optional `source` and `measureTime`. The `source` is useful when reviewing data to determine from where measurements with the same name originate. The `measureTime` is automatically generated if not provided but you can set a unique time if you have events that occurred in the past and want to add them to the stack. Metrics must be marked as happening within the last year's time.
@@ -66,34 +66,46 @@ Additionally, you can provide optional `source` and `measureTime`. The `source`
6666
These values can be provided in the `options` NSDictionary or stated explicitly after the object has been instantiated.
6767

6868
```objective-c
69-
LibratoMetric *metric = [LibratoMetric metricNamed:@"downloads" valued:@42 options:@{@"source": @"the internet", @"measureTime": [NSDate.date dateByAddingTimeInterval:-(3600 * 24)]}];
69+
NSDate *previousDay = [NSDate.date dateByAddingTimeInterval:-(3600 * 24)];
70+
LibratoMetric *metric = [LibratoMetric metricNamed:@"downloads"
71+
valued:@42
72+
options:@{
73+
@"source": @"the internet",
74+
@"measureTime": previousDay
75+
}];
7076

7177
// or...
7278

73-
LibratoMetric *metric = [LibratoMetric metricNamed:@"downloads" valued:@42 options:nil];
79+
LibratoMetric *metric = [LibratoMetric metricNamed:@"downloads" valued:@42];
7480
metric.source = @"the internet";
75-
metric.measureTime = [NSDate.date dateByAddingTimeInterval:-(3600 * 24)]
81+
metric.measureTime = previousDay;
7682
```
7783
7884
Optionally, you can create one or more counters inline with an NSDictionary when adding.
7985
8086
```objective-c
81-
[<some librato instance> add:@{@"downloads": @13, @"plutonium": @{@"value": @238, @"source": @"Russia, with love"}}];
87+
[<some librato instance> add:@{
88+
@"downloads": @13,
89+
@"plutonium": @{
90+
@"value": @238,
91+
@"source": @"Russia, with love"
92+
}
93+
}];
8294
```
8395

8496
### Grouping
8597

8698
Groups are aggregated metrics of multiple data points with related, meaningful data. These are created with an array of counter metrics.
8799

88100
```objective-c
89-
LibratoMetric *bagelMetric1 = [LibratoMetric metricNamed:@"bagels" valued:@13 options:nil];
90-
LibratoMetric *bagelMetric2 = [LibratoMetric metricNamed:@"bagels" valued:@10 options:nil];
91-
LibratoMetric *bagelMetric3 = [LibratoMetric metricNamed:@"bagels" valued:@9 options:nil];
92-
LibratoMetric *bagelMetric4 = [LibratoMetric metricNamed:@"bagels" valued:@8 options:nil];
93-
LibratoMetric *bagelMetric5 = [LibratoMetric metricNamed:@"bagels" valued:@2 options:nil];
94-
LibratoMetric *bagelMetric6 = [LibratoMetric metricNamed:@"bagels" valued:@1 options:nil];
95-
LibratoMetric *bagelMetric7 = [LibratoMetric metricNamed:@"bagels" valued:@0 options:nil];
96-
LibratoMetric *bagelMetric8 = [LibratoMetric metricNamed:@"bagels" valued:@0 options:nil];
101+
LibratoMetric *bagelMetric1 = [LibratoMetric metricNamed:@"bagels" valued:@13];
102+
LibratoMetric *bagelMetric2 = [LibratoMetric metricNamed:@"bagels" valued:@10];
103+
LibratoMetric *bagelMetric3 = [LibratoMetric metricNamed:@"bagels" valued:@9];
104+
LibratoMetric *bagelMetric4 = [LibratoMetric metricNamed:@"bagels" valued:@8];
105+
LibratoMetric *bagelMetric5 = [LibratoMetric metricNamed:@"bagels" valued:@2];
106+
LibratoMetric *bagelMetric6 = [LibratoMetric metricNamed:@"bagels" valued:@1];
107+
LibratoMetric *bagelMetric7 = [LibratoMetric metricNamed:@"bagels" valued:@0];
108+
LibratoMetric *bagelMetric8 = [LibratoMetric metricNamed:@"bagels" valued:@0];
97109

98110
NSArray *bagels = @[bagelMetric1, bagelMetric2, bagelMetric3, bagelMetric4, bagelMetric5, bagelMetric6, bagelMetric7, bagelMetric8];
99111
LibratoGaugeMetric *bagelGuage = [LibratoGaugeMetric metricNamed:@"bagel_guage" measurements:bagels];
@@ -125,12 +137,14 @@ If you have a metrics you'd like to add to the queue and trigger an immediate su
125137

126138
There's an optional but highly-recommended prefix you can set which will automatically be added to all metric names. This is a great way to isolate data or quickly filter metrics.
127139

128-
# Monitoring Submission Success or Failure
140+
# Submission Success or Failure
129141

130142
You can set a blocks to handle the success and failure cases for metric submission. These are referenced when the submission calls back so sporadically setting or `nil`-ling the blocks may lead to unexpected results.
131143

132144
```objective-c
133-
Librato *librato = [Librato.alloc initWithEmail:@"user@somewhere.com" apiKey:@"abc123..." prefix:@""];
145+
Librato *librato = [Librato.alloc initWithEmail:@"user@somewhere.com"
146+
apiKey:@"abc123..."
147+
prefix:@""];
134148
[libratoInstance setSubmitSuccessBlock:^(NSDictionary *JSON, NSUInteger code) {
135149
if (code == 200) {
136150
NSLog(@"Successful submission. Response JSON is: %@", JSON);

librato-iOS.podspec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
Pod::Spec.new do |s|
22
s.name = "librato-iOS"
3-
s.version = "0.1.2"
3+
s.version = "1.0.0"
44
s.summary = "Librato library for iOS"
55
s.description = <<-DESC
6-
A simple wrapper for the Librato API with some conveniences for common use cases
6+
A simple, delightful wrapper for the Librato API with conveniences for common use cases
77
DESC
88
s.homepage = "https://github.com/amco/librato-iOS"
99
s.license = { :type => 'MIT', :file => 'LICENSE.md' }

0 commit comments

Comments
 (0)