FIRPerformance.h 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. // Copyright 2020 Google LLC
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. #import <Foundation/Foundation.h>
  15. #import "FIRTrace.h"
  16. /**
  17. * This class allows you to configure the Firebase Performance Reporting SDK. It also provides the
  18. * interfaces to create timers and enable or disable automatic metrics capture.
  19. *
  20. * This SDK uses a Firebase Installations ID to identify the app instance and periodically sends
  21. * data to the Firebase backend. (see `[FIRInstallations installationIDWithCompletion:]`).
  22. * To stop the periodic sync, call `[FIRInstallations deleteWithCompletion:]` and
  23. * either disable this SDK or set FIRPerformance.dataCollectionEnabled to NO.
  24. */
  25. NS_EXTENSION_UNAVAILABLE("FirebasePerformance does not support app extensions at this time.")
  26. NS_SWIFT_NAME(Performance)
  27. @interface FIRPerformance : NSObject
  28. /**
  29. * Controls the capture of performance data. When this value is set to NO, none of the performance
  30. * data will sent to the server. Default is YES.
  31. *
  32. * This setting is persisted, and is applied on future invocations of your application. Once
  33. * explicitly set, it overrides any settings in your Info.plist.
  34. */
  35. @property(nonatomic, assign, getter=isDataCollectionEnabled) BOOL dataCollectionEnabled;
  36. /**
  37. * Controls the instrumentation of the app to capture performance data. Setting this value to NO has
  38. * immediate effect only if it is done so before calling [FIRApp configure]. Otherwise it takes
  39. * effect after the app starts again the next time.
  40. *
  41. * If set to NO, the app will not be instrumented to collect performance
  42. * data (in scenarios like app_start, networking monitoring). Default is YES.
  43. *
  44. * This setting is persisted, and is applied on future invocations of your application. Once
  45. * explicitly set, it overrides any settings in your Info.plist.
  46. */
  47. @property(nonatomic, assign, getter=isInstrumentationEnabled) BOOL instrumentationEnabled;
  48. /** @return The shared instance. */
  49. + (nonnull instancetype)sharedInstance NS_SWIFT_NAME(sharedInstance());
  50. /**
  51. * Creates an instance of FIRTrace after creating the shared instance of FIRPerformance. The trace
  52. * will automatically be started on a successful creation of the instance. The |name| of the trace
  53. * cannot be an empty string.
  54. *
  55. * @param name The name of the Trace.
  56. * @return The FIRTrace object.
  57. */
  58. + (nullable FIRTrace *)startTraceWithName:(nonnull NSString *)name NS_SWIFT_NAME(startTrace(name:));
  59. /**
  60. * Creates an instance of FIRTrace. This API does not start the trace. To start the trace, use the
  61. * -start API on the returned |FIRTrace| object. The |name| cannot be an empty string.
  62. *
  63. * @param name The name of the Trace.
  64. * @return The FIRTrace object.
  65. */
  66. - (nullable FIRTrace *)traceWithName:(nonnull NSString *)name NS_SWIFT_NAME(trace(name:));
  67. @end