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 `Installations.installationID(completion:)`).
  22. * To stop this periodic sync, call `Installations.delete(completion:)` and
  23. * either disable this SDK or set Performance.dataCollectionEnabled to false.
  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 true.
  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 false
  38. * has immediate effect only if it is done so before calling FirebaseApp.configure(). Otherwise it
  39. * takes effect on the next app start.
  40. *
  41. * If set to false, the app will not be instrumented to collect performance
  42. * data (in scenarios like `app_start`, networking monitoring). Default is true.
  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 Trace after creating the shared instance of Performance. 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 Trace object.
  57. */
  58. + (nullable FIRTrace *)startTraceWithName:(nonnull NSString *)name NS_SWIFT_NAME(startTrace(name:));
  59. /**
  60. * Creates an instance of Trace. This API does not start the trace. To start the trace, use the
  61. * `start()` method on the returned Trace 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