amco / librato-ios Goto Github PK
View Code? Open in Web Editor NEWAn iOS library for Librato metric tracking
License: MIT License
An iOS library for Librato metric tracking
License: MIT License
A basic demo project would be useful to see how things work and for reference for filing issues/bugs.
Librato should have latest available pod versions. This will provide more stability for users.
Right now a configuration NSDictionary
is passed. Validation should at least be done inline. A better choice is a self-validating model.
Not all users may want trackDefaultMetrics
to be fired when initWithEmail:token:prefix:
is called.
I'm looking at you, async Kiwi tests.
At the risk of getting meta would it be useful for notifications to be sent out when standard events happen so any other part of the app that's concerned can listen in?
A simple helper to create subscriptions to notifications and perform metrics based off of notification type or data would be nice.
Currently groupNamed:context:
in Librato.h|m
purports to return an NSArray
but it's a void
function. Interface and implementation files should be updated to reflect this.
Right now everything is dumped out, which isn't too helpful. Build a more succinct description
with just name, value, measureTime and source.
Currently if library imported as pod and builds as static library it produces an error in LibratoMetric.m
.
You should be able to chunk up metric payloads into groups as to not overwhelm the Librato servers.
I need to report data to Librato from Mac applications, would this library work in that case?
Currently nestled away in LibratoProcessor
it needs integration into LibratoQueue
by accepting, queuing and, potentially, auto-submitting the timed metric.
Currently an empty string is hardcoded in.
The librato gem does some automatic tracking of events.
Should the iOS version tap into anything during runtime? Time in app? Device and platform details? Cell/wi-fi usage?
Library should know whether the device is offline and cache any metrics added to queues. When connectivity becomes available it should automatically attempt to send the cached metrics.
Sometimes you want to create a metric with only a name and value. Sometimes you want to have the source and date as well. The dictionary is clumsy. Let's have class methods for common variations but leave the dictionary in for people who like that kind of thing.
Also, make sure they're localized. English is fine for now.
The full metrics gem supports DELETE and PUT operations on metrics.
Is that something that belongs in this library?
The obvious choice is to use OCTest but the syntax is so awful.
Kiwi is nice enough and appears to be ready for XCTest.
Expecta is what I'd really like but Specta still isn't ready for XCText.
Private or protected methods and properties in places like LibratoProcessor
have been defaulted to public. To keep internal state safe these should be locked down as much as possible.
Also, a review of and any possible updates needed in the rest of the rest of library should be considered fair game in this issue.
Would it be better to have metrics automatically submitted instead of pushing them with a [client submit]
call? If so, would submitting happen immediately or in a queue then flush manner?
Do something like the gem's group command where arguments are a namespace string and then a block within which any metric created is automatically namespaced.
EDIT Should this deprecate the existing group API? The existing "add an array of metrics" is a different goal than this one and perhaps that task is better accomplished under a chunking/mass submit method.
The Librato team let us know there are many failing entries due to invalid data in the source field. The example given was:
Response: {"errors":{"params":{"source":["[email protected] is not a valid source name"]}},"request_time":1476916671}, Body: {"counters":[{"value":1,"measure_time":1476916671,"source":"[email protected]","name":"cs.live.larousse-red_larousse-2-g7.open"},{"value":0,"measure_time":1476916671,"source":"[email protected]","name":"cs.live.larousse-red_larousse-2-g7.pageview"}]}
Sources should be text and '-', '_' only so the '@' in the email would cause this to fail.
Will apply down to the persister level, based off of the queue. Gives users a chance to tap into the actual persistence call and get back success JSON/code or error.
This is failing when Mantle is trying to recreate the object from disk. I am unclear on what would be a clean solution. But seeing this very consistently in development. And it doesn't go away on restarting app as its persisted to disk.
I'll remove the assertion locally and continue on, but anyone has any ideas for a proper fix?
In LibratoGuageMetric.m:34, we have
- (instancetype)init
{
NSAssert(false, @"You must use initWithName:valued:options: to initialize a LibratoGagueMetric instance");
self = nil;
return nil;
}
The stack trace:
*** Assertion failure in -[LibratoGaugeMetric init], /Pods/librato-iOS/librato-iOS/Metrics/LibratoGaugeMetric.m:34
2014-09-08 12:31:26.658 Myntra[28953:60b] *** Caught exception decoding value for key "models" on class LibratoMetricCollection: You must use initWithName:valued:options: to initialize a LibratoGagueMetric instance
2014-09-08 12:31:26.661 Myntra[28953:60b] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'You must use initWithName:valued:options: to initialize a LibratoGagueMetric instance'
*** First throw call stack:
(
0 CoreFoundation 0x0000000103cd5495 __exceptionPreprocess + 165
1 libobjc.A.dylib 0x0000000103a3499e objc_exception_throw + 43
2 CoreFoundation 0x0000000103cd531a +[NSException raise:format:arguments:] + 106
3 Foundation 0x0000000101ad4f19 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 189
4 Myntra 0x000000010035ab4e -[LibratoGaugeMetric init] + 174
5 Myntra 0x00000001002f87d0 -[MTLModel initWithDictionary:error:] + 112
6 Myntra 0x00000001002f793a -[MTLModel(NSCoding) initWithCoder:] + 2330
7 Foundation 0x0000000101b01b8d _decodeObjectBinary + 2541
8 Foundation 0x0000000101b02bc0 -[NSKeyedUnarchiver _decodeArrayOfObjectsForKey:] + 1735
9 Foundation 0x0000000101b02db3 -[NSArray(NSArray) initWithCoder:] + 201
10 Foundation 0x0000000101b01b8d _decodeObjectBinary + 2541
11 Foundation 0x0000000101b01042 _decodeObject + 288
12 Myntra 0x00000001002f6e0a -[MTLModel(NSCoding) decodeValueForKey:withCoder:modelVersion:] + 1898
13 Myntra 0x00000001002f779f -[MTLModel(NSCoding) initWithCoder:] + 1919
14 Foundation 0x0000000101b01b8d _decodeObjectBinary + 2541
15 Foundation 0x0000000101b02bc0 -[NSKeyedUnarchiver _decodeArrayOfObjectsForKey:] + 1735
16 Foundation 0x0000000101b0f041 -[NSDictionary(NSDictionary) initWithCoder:] + 202
17 Foundation 0x0000000101b01b8d _decodeObjectBinary + 2541
18 Foundation 0x0000000101b01042 _decodeObject + 288
19 Foundation 0x0000000101ae1ac3 +[NSKeyedUnarchiver unarchiveObjectWithFile:] + 139
20 Myntra 0x0000000100355ee2 -[LibratoClient unarchiveMetrics] + 226
21 Myntra 0x000000010035596a -[LibratoClient handleForegroundNotificaiton:] + 58
22 CoreFoundation 0x0000000103d2ad9c __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 12
23 CoreFoundation 0x0000000103c8d51d _CFXNotificationPost + 2381
24 Foundation 0x0000000101afc7fa -[NSNotificationCenter postNotificationName:object:userInfo:] + 68
25 UIKit 0x00000001029ced06 -[UIApplication _callInitializationDelegatesForURL:payload:suspended:] + 1898
26 UIKit 0x00000001029d2a0c -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 660
27 UIKit 0x00000001029e3d4c -[UIApplication handleEvent:withNewEvent:] + 3189
28 UIKit 0x00000001029e4216 -[UIApplication sendEvent:] + 79
29 UIKit 0x00000001029d4086 _UIApplicationHandleEvent + 578
30 GraphicsServices 0x000000010477271a _PurpleEventCallback + 762
31 GraphicsServices 0x00000001047721e1 PurpleEventCallback + 35
32 CoreFoundation 0x0000000103c57679 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 41
33 CoreFoundation 0x0000000103c5744e __CFRunLoopDoSource1 + 478
34 CoreFoundation 0x0000000103c80903 __CFRunLoopRun + 1939
35 CoreFoundation 0x0000000103c7fd83 CFRunLoopRunSpecific + 467
36 UIKit 0x00000001029d22e1 -[UIApplication _run] + 609
37 UIKit 0x00000001029d3e33 UIApplicationMain + 1010
38 Myntra 0x000000010004aa33 main + 115
39 libdyld.dylib 0x000000010425a5fd start +
40 ??? 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.