@dynatrace/react-native-plugin 2.327.2 → 2.331.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +419 -164
- package/android/build.gradle +1 -1
- package/android/src/main/java/com/dynatrace/android/agent/DynatraceConfigurationModule.kt +48 -0
- package/android/src/main/java/com/dynatrace/android/agent/DynatraceRNBridgeImpl.kt +41 -8
- package/android/src/main/java/com/dynatrace/android/agent/DynatraceReactPackage.kt +3 -0
- package/android/src/main/java/com/dynatrace/android/agent/DynatraceRuntimeConfigurationStore.kt +14 -0
- package/android/src/main/java/com/dynatrace/android/agent/DynatraceUtils.kt +103 -47
- package/android/src/new/java/com/dynatrace/android/agent/DynatraceRNBridge.kt +12 -4
- package/android/src/old/java/com/dynatrace/android/agent/DynatraceRNBridge.kt +15 -5
- package/files/default.config.js +7 -0
- package/files/plugin-runtime.gradle +7 -17
- package/files/plugin.gradle +1 -1
- package/instrumentation/DynatraceInstrumentation.js +1 -1
- package/instrumentation/libs/react-navigation/ReactNavigation.js +53 -18
- package/ios/ConfigurationSubscriber.h +15 -0
- package/ios/DynatraceRNBridge.h +4 -0
- package/ios/DynatraceRNBridge.mm +125 -29
- package/lib/core/Dynatrace.js +8 -11
- package/lib/core/configuration/ConfigurationHandler.js +3 -0
- package/lib/next/Dynatrace.js +50 -33
- package/lib/next/DynatraceArgValidators.js +10 -0
- package/lib/next/DynatraceEventBus.js +35 -0
- package/lib/next/appstart/AppStartObserver.js +2 -3
- package/lib/next/configuration/INativeRuntimeConfiguration.js +7 -0
- package/lib/next/configuration/RuntimeConfigurationObserver.js +40 -0
- package/lib/next/events/EventBuilderUtil.js +7 -0
- package/lib/next/events/EventData.js +28 -0
- package/lib/next/events/EventPipeline.js +5 -11
- package/lib/next/events/ExceptionEventData.js +26 -0
- package/lib/next/events/HttpRequestEventData.js +174 -0
- package/lib/next/events/SessionPropertyEventData.js +22 -0
- package/lib/next/events/interface/IBaseEvent.js +2 -0
- package/lib/next/events/interface/IEventData.js +2 -0
- package/lib/next/events/interface/IExceptionEventData.js +2 -0
- package/lib/next/events/interface/IHttpRequestEventData.js +2 -0
- package/lib/next/events/interface/ISessionPropertyEventData.js +2 -0
- package/lib/next/events/modifier/BaseDataEventModifier.js +1 -3
- package/lib/next/events/modifier/EventModifierUtil.js +34 -41
- package/lib/next/events/modifier/ModifyEventValidation.js +117 -27
- package/lib/next/events/modifier/SendEventValidation.js +53 -22
- package/lib/next/events/modifier/StringLengthEventModifier.js +53 -0
- package/lib/next/events/spec/EventSpecContstants.js +9 -2
- package/package.json +11 -5
- package/public.js +9 -3
- package/react-native-dynatrace.podspec +1 -1
- package/scripts/Config.js +6 -2
- package/scripts/LineOffsetAnalyze.js +1 -4
- package/scripts/core/LineOffsetAnalyzeCall.js +39 -46
- package/src/lib/core/interface/NativeDynatraceBridge.ts +6 -2
- package/types.d.ts +408 -177
- package/lib/next/events/HttpRequestEventBuilder.js +0 -196
- package/lib/next/events/ViewInfoCreator.js +0 -27
- package/lib/next/events/modifier/EventLimitation.js +0 -69
- /package/lib/next/events/{IHttpRequestEventBuilder.js → interface/EventProperty.js} +0 -0
package/types.d.ts
CHANGED
|
@@ -235,7 +235,7 @@ interface IDynatraceAction {
|
|
|
235
235
|
*
|
|
236
236
|
* @example
|
|
237
237
|
* ```ts
|
|
238
|
-
* import { Dynatrace } from '@dynatrace/react-native-plugin';
|
|
238
|
+
* import { Dynatrace, Platform } from '@dynatrace/react-native-plugin';
|
|
239
239
|
*
|
|
240
240
|
* const action = Dynatrace.enterAutoAction('User Login');
|
|
241
241
|
* action.reportError('Page Not Found', 404);
|
|
@@ -383,7 +383,7 @@ interface IDynatraceAction {
|
|
|
383
383
|
* action.reportEvent('Processing Started');
|
|
384
384
|
*
|
|
385
385
|
* // Cancel if running in development or test mode
|
|
386
|
-
* if (__DEV__
|
|
386
|
+
* if (__DEV__) {
|
|
387
387
|
* action.cancel(); // Don't send test data to production monitoring
|
|
388
388
|
* } else {
|
|
389
389
|
* action.leaveAction(); // Send the action data
|
|
@@ -609,10 +609,20 @@ interface IEventModifier {
|
|
|
609
609
|
/**
|
|
610
610
|
* Event as JSONObject is received and can be modified.
|
|
611
611
|
*
|
|
612
|
-
* Returning null discards
|
|
612
|
+
* Returning null discards the event and prevents future modifier functions from being executed.
|
|
613
|
+
*
|
|
614
|
+
* Certain reserved fields and namespaces cannot be modified in any way (added, removed, or overridden),
|
|
615
|
+
* while others are open for modification.
|
|
616
|
+
*
|
|
617
|
+
* Open for modification:
|
|
618
|
+
* - url.full
|
|
619
|
+
* - exception.stack_trace
|
|
620
|
+
*
|
|
621
|
+
* Open for modification or can be added:
|
|
622
|
+
* - event_properties.*
|
|
623
|
+
* - session_properties.*
|
|
613
624
|
*
|
|
614
|
-
*
|
|
615
|
-
* while others are open for modification. See the public documentation for a detailed list of reserved/open fields.
|
|
625
|
+
* See the public documentation for a detailed list of reserved/open fields.
|
|
616
626
|
* @param event Event as JSONObject
|
|
617
627
|
* @returns Either the modified event or null if you want to cancel the event
|
|
618
628
|
*
|
|
@@ -626,122 +636,145 @@ interface IEventModifier {
|
|
|
626
636
|
* }});
|
|
627
637
|
* ```
|
|
628
638
|
*
|
|
629
|
-
* @see https://docs.dynatrace.com/docs/
|
|
639
|
+
* @see https://docs.dynatrace.com/docs/shortlink/react-native-custom-events#event-modifiers
|
|
630
640
|
*/
|
|
631
641
|
modifyEvent(event: JSONObject): JSONObject | null;
|
|
632
642
|
}
|
|
633
643
|
|
|
634
|
-
|
|
644
|
+
/**
|
|
645
|
+
* Represents the allowed types for event property values.
|
|
646
|
+
*/
|
|
647
|
+
type EventProperty = string | number | boolean;
|
|
648
|
+
|
|
649
|
+
/**
|
|
650
|
+
* Base interface for all events.
|
|
651
|
+
*/
|
|
652
|
+
interface IBaseEvent {
|
|
653
|
+
/**
|
|
654
|
+
* Converts the event into a JSON event object.
|
|
655
|
+
*
|
|
656
|
+
* @returns The built event as a JSONObject.
|
|
657
|
+
*
|
|
658
|
+
* @internal
|
|
659
|
+
*/
|
|
660
|
+
toJSON(): JSONObject | null;
|
|
661
|
+
}
|
|
662
|
+
|
|
663
|
+
interface IHttpRequestEventData extends IBaseEvent {
|
|
635
664
|
/**
|
|
636
665
|
* Sets the duration of the HTTP request in milliseconds.
|
|
637
666
|
*
|
|
638
667
|
* @param duration The request duration in milliseconds. Only positive numbers are valid.
|
|
639
|
-
* @returns The
|
|
668
|
+
* @returns The event instance for method chaining
|
|
640
669
|
*
|
|
641
670
|
* @example
|
|
642
671
|
* ```ts
|
|
643
|
-
* import { Dynatrace,
|
|
672
|
+
* import { Dynatrace, HttpRequestEventData } from '@dynatrace/react-native-plugin';
|
|
644
673
|
*
|
|
645
|
-
* const requestEvent = new
|
|
674
|
+
* const requestEvent = new HttpRequestEventData('https://api.example.com/data', 'GET')
|
|
646
675
|
* .withDuration(250);
|
|
647
676
|
* Dynatrace.sendHttpRequestEvent(requestEvent);
|
|
648
677
|
* ```
|
|
649
678
|
*
|
|
650
|
-
* @see https://docs.dynatrace.com/docs/
|
|
679
|
+
* @see https://docs.dynatrace.com/docs/shortlink/react-native-web-request-performance#manual-http-request-reporting
|
|
651
680
|
*/
|
|
652
681
|
withDuration(duration: number): this;
|
|
653
682
|
/**
|
|
654
683
|
* Sets the HTTP response status code.
|
|
655
684
|
*
|
|
656
685
|
* @param statusCode The HTTP status code (e.g., 200, 404, 500). Only positive numbers are valid.
|
|
657
|
-
* @returns The
|
|
686
|
+
* @returns The event instance for method chaining
|
|
658
687
|
*
|
|
659
688
|
* @example
|
|
660
689
|
* ```ts
|
|
661
|
-
* import { Dynatrace,
|
|
690
|
+
* import { Dynatrace, HttpRequestEventData } from '@dynatrace/react-native-plugin';
|
|
662
691
|
*
|
|
663
|
-
* const requestEvent = new
|
|
692
|
+
* const requestEvent = new HttpRequestEventData('https://api.example.com/data', 'GET')
|
|
664
693
|
* .withStatusCode(200);
|
|
665
694
|
* Dynatrace.sendHttpRequestEvent(requestEvent);
|
|
666
695
|
* ```
|
|
667
696
|
*
|
|
668
|
-
* @see https://docs.dynatrace.com/docs/
|
|
697
|
+
* @see https://docs.dynatrace.com/docs/shortlink/react-native-web-request-performance#manual-http-request-reporting
|
|
669
698
|
*/
|
|
670
699
|
withStatusCode(statusCode: number): this;
|
|
671
700
|
/**
|
|
672
701
|
* Sets the HTTP response reason phrase.
|
|
673
702
|
*
|
|
674
703
|
* @param reasonPhrase The reason phrase (e.g., "OK", "Not Found"). Maximum 5000 characters; longer values will be trimmed.
|
|
675
|
-
* @returns The
|
|
704
|
+
* @returns The event instance for method chaining
|
|
676
705
|
*
|
|
677
706
|
* @example
|
|
678
707
|
* ```ts
|
|
679
|
-
* import { Dynatrace,
|
|
708
|
+
* import { Dynatrace, HttpRequestEventData } from '@dynatrace/react-native-plugin';
|
|
680
709
|
*
|
|
681
|
-
* const requestEvent = new
|
|
710
|
+
* const requestEvent = new HttpRequestEventData('https://api.example.com/data', 'GET')
|
|
682
711
|
* .withReasonPhrase('OK');
|
|
683
712
|
* Dynatrace.sendHttpRequestEvent(requestEvent);
|
|
684
713
|
* ```
|
|
685
714
|
*
|
|
686
|
-
* @see https://docs.dynatrace.com/docs/
|
|
715
|
+
* @see https://docs.dynatrace.com/docs/shortlink/react-native-web-request-performance#manual-http-request-reporting
|
|
687
716
|
*/
|
|
688
717
|
withReasonPhrase(reasonPhrase: string): this;
|
|
689
718
|
/**
|
|
690
719
|
* Associates an error with the HTTP request event.
|
|
691
720
|
*
|
|
692
721
|
* @param error A standard JavaScript Error object representing the request failure
|
|
693
|
-
* @returns The
|
|
722
|
+
* @returns The event instance for method chaining
|
|
694
723
|
*
|
|
695
724
|
* @example
|
|
696
725
|
* ```ts
|
|
697
|
-
* import { Dynatrace,
|
|
726
|
+
* import { Dynatrace, HttpRequestEventData } from '@dynatrace/react-native-plugin';
|
|
698
727
|
*
|
|
699
728
|
* try {
|
|
700
729
|
* // Request code
|
|
701
730
|
* } catch (error) {
|
|
702
|
-
*
|
|
703
|
-
*
|
|
731
|
+
* let requestEvent = new HttpRequestEventData('https://api.example.com/data', 'GET');
|
|
732
|
+
*
|
|
733
|
+
* if (error instanceof Error) {
|
|
734
|
+
* requestEvent.withError(error);
|
|
735
|
+
* }
|
|
736
|
+
*
|
|
704
737
|
* Dynatrace.sendHttpRequestEvent(requestEvent);
|
|
705
738
|
* }
|
|
706
739
|
* ```
|
|
707
740
|
*
|
|
708
|
-
* @see https://docs.dynatrace.com/docs/
|
|
741
|
+
* @see https://docs.dynatrace.com/docs/shortlink/react-native-web-request-performance#manual-http-request-reporting
|
|
709
742
|
*/
|
|
710
743
|
withError(error: Error): this;
|
|
711
744
|
/**
|
|
712
745
|
* Sets the number of bytes sent in the request.
|
|
713
746
|
*
|
|
714
747
|
* @param bytesSent The number of bytes sent in the request payload. Only positive numbers are valid.
|
|
715
|
-
* @returns The
|
|
748
|
+
* @returns The event instance for method chaining
|
|
716
749
|
*
|
|
717
750
|
* @example
|
|
718
751
|
* ```ts
|
|
719
|
-
* import { Dynatrace,
|
|
752
|
+
* import { Dynatrace, HttpRequestEventData } from '@dynatrace/react-native-plugin';
|
|
720
753
|
*
|
|
721
|
-
* const requestEvent = new
|
|
754
|
+
* const requestEvent = new HttpRequestEventData('https://api.example.com/data', 'POST')
|
|
722
755
|
* .withBytesSent(1024);
|
|
723
756
|
* Dynatrace.sendHttpRequestEvent(requestEvent);
|
|
724
757
|
* ```
|
|
725
758
|
*
|
|
726
|
-
* @see https://docs.dynatrace.com/docs/
|
|
759
|
+
* @see https://docs.dynatrace.com/docs/shortlink/react-native-web-request-performance#manual-http-request-reporting
|
|
727
760
|
*/
|
|
728
761
|
withBytesSent(bytesSent: number): this;
|
|
729
762
|
/**
|
|
730
763
|
* Sets the number of bytes received in the response.
|
|
731
764
|
*
|
|
732
765
|
* @param bytesReceived The number of bytes received in the response payload. Only positive numbers are valid.
|
|
733
|
-
* @returns The
|
|
766
|
+
* @returns The event instance for method chaining
|
|
734
767
|
*
|
|
735
768
|
* @example
|
|
736
769
|
* ```ts
|
|
737
|
-
* import { Dynatrace,
|
|
770
|
+
* import { Dynatrace, HttpRequestEventData } from '@dynatrace/react-native-plugin';
|
|
738
771
|
*
|
|
739
|
-
* const requestEvent = new
|
|
772
|
+
* const requestEvent = new HttpRequestEventData('https://api.example.com/data', 'GET')
|
|
740
773
|
* .withBytesReceived(2048);
|
|
741
774
|
* Dynatrace.sendHttpRequestEvent(requestEvent);
|
|
742
775
|
* ```
|
|
743
776
|
*
|
|
744
|
-
* @see https://docs.dynatrace.com/docs/
|
|
777
|
+
* @see https://docs.dynatrace.com/docs/shortlink/react-native-web-request-performance#manual-http-request-reporting
|
|
745
778
|
*/
|
|
746
779
|
withBytesReceived(bytesReceived: number): this;
|
|
747
780
|
/**
|
|
@@ -749,18 +782,18 @@ interface IHttpRequestEventBuilder {
|
|
|
749
782
|
*
|
|
750
783
|
* @param traceparentHeader A valid traceparent header according to the W3C Trace Context specification.
|
|
751
784
|
* Format: `00-<trace-id>-<parent-id>-<trace-flags>` where trace-id is 32 hex digits, parent-id is 16 hex digits.
|
|
752
|
-
* @returns The
|
|
785
|
+
* @returns The event instance for method chaining
|
|
753
786
|
*
|
|
754
787
|
* @example
|
|
755
788
|
* ```ts
|
|
756
|
-
* import { Dynatrace,
|
|
789
|
+
* import { Dynatrace, HttpRequestEventData } from '@dynatrace/react-native-plugin';
|
|
757
790
|
*
|
|
758
|
-
* const requestEvent = new
|
|
791
|
+
* const requestEvent = new HttpRequestEventData('https://api.example.com/data', 'GET')
|
|
759
792
|
* .withTraceparentHeader('00-80e1afed08e019fc1110464cfa66635c-7a085853722dc6d2-01');
|
|
760
793
|
* Dynatrace.sendHttpRequestEvent(requestEvent);
|
|
761
794
|
* ```
|
|
762
795
|
*
|
|
763
|
-
* @see https://docs.dynatrace.com/docs/
|
|
796
|
+
* @see https://docs.dynatrace.com/docs/shortlink/react-native-web-request-performance#manual-http-request-reporting
|
|
764
797
|
*/
|
|
765
798
|
withTraceparentHeader(traceparentHeader: TraceparentHeader): this;
|
|
766
799
|
/**
|
|
@@ -771,36 +804,37 @@ interface IHttpRequestEventBuilder {
|
|
|
771
804
|
* **Property Requirements:**
|
|
772
805
|
* - Only properties prefixed with `event_properties.*` are allowed
|
|
773
806
|
* - Maximum of 50 custom properties per event
|
|
807
|
+
* - If the limit is exceeded, properties are sorted alphabetically by key and excess properties are dropped deterministically
|
|
774
808
|
* - String properties are limited to 5000 characters (exceeding characters are truncated)
|
|
775
809
|
* - Field names must contain only alphabetic characters, numbers, underscores, and dots
|
|
776
810
|
* - Each dot must be followed by an alphabetic character
|
|
777
811
|
* - Each underscore must be followed by an alphabetic character or number
|
|
778
812
|
*
|
|
779
|
-
* @returns The
|
|
813
|
+
* @returns The event instance for method chaining
|
|
780
814
|
*
|
|
781
815
|
* @example
|
|
782
816
|
* ```ts
|
|
783
|
-
* import { Dynatrace,
|
|
817
|
+
* import { Dynatrace, HttpRequestEventData } from '@dynatrace/react-native-plugin';
|
|
784
818
|
*
|
|
785
|
-
* const requestEvent = new
|
|
819
|
+
* const requestEvent = new HttpRequestEventData('https://api.example.com/data', 'GET')
|
|
786
820
|
* .addEventProperty('event_properties.user_id', '12345')
|
|
787
821
|
* .addEventProperty('event_properties.api_version', 'v2');
|
|
788
822
|
* Dynatrace.sendHttpRequestEvent(requestEvent);
|
|
789
823
|
* ```
|
|
790
824
|
*
|
|
791
|
-
* @see https://docs.dynatrace.com/docs/
|
|
825
|
+
* @see https://docs.dynatrace.com/docs/shortlink/react-native-web-request-performance#manual-http-request-reporting
|
|
792
826
|
*/
|
|
793
827
|
addEventProperty(key: `event_properties.${string}`, value: EventProperty): this;
|
|
794
828
|
}
|
|
795
829
|
|
|
796
|
-
type EventProperty = string | number | boolean;
|
|
797
830
|
type TraceparentHeader = `00-${string}-${string}-0${'0' | '1'}`;
|
|
798
831
|
type AllowedRequestMethods = 'GET' | 'HEAD' | 'POST' | 'PUT' | 'DELETE' | 'CONNECT' | 'OPTIONS' | 'TRACE' | 'PATCH' | 'get' | 'head' | 'post' | 'put' | 'delete' | 'connect' | 'options' | 'trace' | 'patch';
|
|
799
|
-
|
|
832
|
+
type Url = `http://${string}` | `https://${string}`;
|
|
833
|
+
type EventPropertyKey = `event_properties.${string}`;
|
|
834
|
+
declare class HttpRequestEventData implements IHttpRequestEventData {
|
|
800
835
|
private url;
|
|
801
836
|
private requestMethod;
|
|
802
837
|
private static readonly allowedRequestMethods;
|
|
803
|
-
private static readonly maxReasonPhraseLength;
|
|
804
838
|
private duration;
|
|
805
839
|
private statusCode?;
|
|
806
840
|
private reasonPhrase?;
|
|
@@ -809,28 +843,27 @@ declare class HttpRequestEventBuilder implements IHttpRequestEventBuilder {
|
|
|
809
843
|
private error?;
|
|
810
844
|
private traceparentHeader?;
|
|
811
845
|
private rawEventProperties;
|
|
812
|
-
private
|
|
813
|
-
private hasDroppedCustomProperties;
|
|
814
|
-
private hasNfnValues;
|
|
846
|
+
private hasDroppedProperties;
|
|
815
847
|
private triedToOverwriteDuration;
|
|
816
848
|
/**
|
|
817
|
-
* Creates a new HTTP request event
|
|
849
|
+
* Creates a new HTTP request event.
|
|
818
850
|
*
|
|
819
|
-
* @param url The request URL. Must be a valid URL according to the WHATWG URL Standard, starting with
|
|
851
|
+
* @param url The request URL. Must be a valid URL according to the WHATWG URL Standard, starting with
|
|
852
|
+
* `http://` or `https://`. Maximum 5000 characters; longer values will be trimmed.
|
|
820
853
|
* @param requestMethod The HTTP request method. Allowed values: GET, HEAD, POST, PUT, DELETE, CONNECT, OPTIONS,
|
|
821
854
|
* TRACE, PATCH (case-insensitive).
|
|
822
855
|
*
|
|
823
856
|
* @example
|
|
824
857
|
* ```ts
|
|
825
|
-
* import { Dynatrace,
|
|
858
|
+
* import { Dynatrace, HttpRequestEventData } from '@dynatrace/react-native-plugin';
|
|
826
859
|
*
|
|
827
|
-
* const requestEvent = new
|
|
860
|
+
* const requestEvent = new HttpRequestEventData('https://api.example.com/data', 'GET');
|
|
828
861
|
* Dynatrace.sendHttpRequestEvent(requestEvent);
|
|
829
862
|
* ```
|
|
830
863
|
*
|
|
831
|
-
* @see https://docs.dynatrace.com/docs/
|
|
864
|
+
* @see https://docs.dynatrace.com/docs/shortlink/react-native-web-request-performance#manual-http-request-reporting
|
|
832
865
|
*/
|
|
833
|
-
constructor(url:
|
|
866
|
+
constructor(url: Url, requestMethod: AllowedRequestMethods);
|
|
834
867
|
withDuration(duration: number): this;
|
|
835
868
|
withStatusCode(statusCode: number): this;
|
|
836
869
|
withReasonPhrase(reasonPhrase: string): this;
|
|
@@ -838,23 +871,201 @@ declare class HttpRequestEventBuilder implements IHttpRequestEventBuilder {
|
|
|
838
871
|
withBytesSent(bytesSent: number): this;
|
|
839
872
|
withBytesReceived(bytesReceived: number): this;
|
|
840
873
|
withTraceparentHeader(traceparentHeader: TraceparentHeader): this;
|
|
841
|
-
addEventProperty(key:
|
|
842
|
-
|
|
843
|
-
private
|
|
874
|
+
addEventProperty(key: EventPropertyKey, value: EventProperty): this;
|
|
875
|
+
toJSON(): JSONObject | null;
|
|
876
|
+
private hasValidMandatoryAttributes;
|
|
844
877
|
private isInvalidUrl;
|
|
845
878
|
private sanitizeStatusCode;
|
|
846
|
-
private sanitizeReasonPhrase;
|
|
847
879
|
private sanitizeDuration;
|
|
848
880
|
private sanitizeBytesSent;
|
|
849
881
|
private sanitizeBytesReceived;
|
|
850
882
|
private isStatusCodeError;
|
|
851
|
-
private isEventPropertyKey;
|
|
852
|
-
private includeIfDefined;
|
|
853
|
-
private includeIfTrue;
|
|
854
883
|
private parseTraceparent;
|
|
855
884
|
private allZeros;
|
|
856
885
|
}
|
|
857
886
|
|
|
887
|
+
/**
|
|
888
|
+
* Interface for building events with event properties and duration.
|
|
889
|
+
*
|
|
890
|
+
* Events can include custom properties and duration information.
|
|
891
|
+
* Use implementations of this interface with `Dynatrace.sendEvent()`.
|
|
892
|
+
*
|
|
893
|
+
* @see https://docs.dynatrace.com/docs/shortlink/react-native-custom-events#send-custom-events
|
|
894
|
+
*/
|
|
895
|
+
interface IEventData extends IBaseEvent {
|
|
896
|
+
/**
|
|
897
|
+
* Sets the duration of the event in milliseconds.
|
|
898
|
+
*
|
|
899
|
+
* @param duration The event duration in milliseconds. Only positive numbers are valid.
|
|
900
|
+
* @returns The event instance for method chaining
|
|
901
|
+
*
|
|
902
|
+
* @example
|
|
903
|
+
* ```typescript
|
|
904
|
+
* import { Dynatrace, EventData } from '@dynatrace/react-native-plugin';
|
|
905
|
+
*
|
|
906
|
+
* const customEvent = new EventData()
|
|
907
|
+
* .addEventProperty('event_properties.operation', 'data_sync')
|
|
908
|
+
* .withDuration(250);
|
|
909
|
+
* Dynatrace.sendEvent(customEvent);
|
|
910
|
+
* ```
|
|
911
|
+
*/
|
|
912
|
+
withDuration(duration: number): this;
|
|
913
|
+
/**
|
|
914
|
+
* Adds a custom event property to the event.
|
|
915
|
+
*
|
|
916
|
+
* Event properties allow you to attach custom key-value pairs to events for better
|
|
917
|
+
* analysis and filtering in Dynatrace.
|
|
918
|
+
*
|
|
919
|
+
* @param key - The property key. Must be prefixed with `event_properties.*`
|
|
920
|
+
* @param value - The property value (string, number, or boolean). Invalid values will be replaced with null.
|
|
921
|
+
* @returns The event instance for method chaining
|
|
922
|
+
*
|
|
923
|
+
* @remarks
|
|
924
|
+
* **Property Requirements:**
|
|
925
|
+
* - Only properties prefixed with `event_properties.*` are allowed
|
|
926
|
+
* - Maximum of 50 custom properties per event
|
|
927
|
+
* - If the limit is exceeded, properties are sorted alphabetically by key and excess properties are dropped deterministically
|
|
928
|
+
* - String properties are limited to 5000 characters (exceeding characters are truncated)
|
|
929
|
+
* - Field names must contain only alphabetic characters, numbers, underscores, and dots
|
|
930
|
+
* - Each dot must be followed by an alphabetic character
|
|
931
|
+
* - Each underscore must be followed by an alphabetic character or number
|
|
932
|
+
*
|
|
933
|
+
* @example
|
|
934
|
+
* ```typescript
|
|
935
|
+
* import { Dynatrace, EventData } from '@dynatrace/react-native-plugin';
|
|
936
|
+
*
|
|
937
|
+
* const customEvent = new EventData()
|
|
938
|
+
* .addEventProperty('event_properties.user_id', '12345')
|
|
939
|
+
* .addEventProperty('event_properties.action_type', 'purchase')
|
|
940
|
+
* .addEventProperty('event_properties.amount', 99.99)
|
|
941
|
+
* .addEventProperty('event_properties.is_premium_user', true);
|
|
942
|
+
* Dynatrace.sendEvent(customEvent);
|
|
943
|
+
* ```
|
|
944
|
+
*/
|
|
945
|
+
addEventProperty(key: `event_properties.${string}`, value: EventProperty): this;
|
|
946
|
+
}
|
|
947
|
+
|
|
948
|
+
declare class EventData implements IEventData {
|
|
949
|
+
private rawEventProperties;
|
|
950
|
+
private duration?;
|
|
951
|
+
addEventProperty(key: `event_properties.${string}`, value: EventProperty): this;
|
|
952
|
+
withDuration(duration: number): this;
|
|
953
|
+
toJSON(): JSONObject | null;
|
|
954
|
+
}
|
|
955
|
+
|
|
956
|
+
/**
|
|
957
|
+
* Interface for building session property events.
|
|
958
|
+
*
|
|
959
|
+
* Session properties are key-value pairs that persist throughout the entire
|
|
960
|
+
* user session and are attached to all subsequent events in that session.
|
|
961
|
+
* Use implementations of this interface with `Dynatrace.sendSessionPropertyEvent()`.
|
|
962
|
+
*
|
|
963
|
+
* @see https://docs.dynatrace.com/docs/shortlink/react-native-custom-events#send-session-property-events
|
|
964
|
+
*/
|
|
965
|
+
interface ISessionPropertyEventData extends IBaseEvent {
|
|
966
|
+
/**
|
|
967
|
+
* Adds a custom session property to the event.
|
|
968
|
+
*
|
|
969
|
+
* Session properties allow you to attach custom key-value pairs that persist throughout
|
|
970
|
+
* the entire user session. These properties will be automatically attached to all
|
|
971
|
+
* subsequent events in the current session.
|
|
972
|
+
*
|
|
973
|
+
* @param key - The property key. Must be prefixed with `session_properties.*`
|
|
974
|
+
* @param value - The property value (string, number, or boolean). Invalid values will be replaced with null.
|
|
975
|
+
* @returns The event instance for method chaining
|
|
976
|
+
*
|
|
977
|
+
* @remarks
|
|
978
|
+
* **Property Requirements:**
|
|
979
|
+
* - Only properties prefixed with `session_properties.*` are allowed
|
|
980
|
+
* - Maximum of 50 custom properties per event
|
|
981
|
+
* - If the limit is exceeded, properties are sorted alphabetically by key and excess properties are dropped deterministically
|
|
982
|
+
* - String properties are limited to 5000 characters (exceeding characters are truncated)
|
|
983
|
+
* - Field names must contain only alphabetic characters, numbers, underscores, and dots
|
|
984
|
+
* - Each dot must be followed by an alphabetic character
|
|
985
|
+
* - Each underscore must be followed by an alphabetic character or number
|
|
986
|
+
*
|
|
987
|
+
* @example
|
|
988
|
+
* ```typescript
|
|
989
|
+
* import { Dynatrace, SessionPropertyEventData } from '@dynatrace/react-native-plugin';
|
|
990
|
+
*
|
|
991
|
+
* const sessionPropertyEvent = new SessionPropertyEventData()
|
|
992
|
+
* .addSessionProperty('session_properties.user_id', 'user_12345')
|
|
993
|
+
* .addSessionProperty('session_properties.user_type', 'premium')
|
|
994
|
+
* .addSessionProperty('session_properties.feature_flags_enabled', true)
|
|
995
|
+
* .addSessionProperty('session_properties.session_score', 95.5);
|
|
996
|
+
* Dynatrace.sendSessionPropertyEvent(sessionPropertyEvent);
|
|
997
|
+
* ```
|
|
998
|
+
*/
|
|
999
|
+
addSessionProperty(key: `session_properties.${string}`, value: EventProperty): this;
|
|
1000
|
+
}
|
|
1001
|
+
|
|
1002
|
+
declare class SessionPropertyEventData implements ISessionPropertyEventData {
|
|
1003
|
+
private rawSessionProperties;
|
|
1004
|
+
addSessionProperty(key: `session_properties.${string}`, value: EventProperty): this;
|
|
1005
|
+
toJSON(): JSONObject | null;
|
|
1006
|
+
}
|
|
1007
|
+
|
|
1008
|
+
/**
|
|
1009
|
+
* Interface for building exception events with event properties.
|
|
1010
|
+
*
|
|
1011
|
+
* This interface defines the contract for creating exception events that can be sent
|
|
1012
|
+
* to Dynatrace. Exception events can include custom properties.
|
|
1013
|
+
* Use implementations of this interface with `Dynatrace.sendExceptionEvent()`.
|
|
1014
|
+
*
|
|
1015
|
+
* @see https://docs.dynatrace.com/docs/shortlink/react-native-error-crash-reporting#send-exception-event
|
|
1016
|
+
*/
|
|
1017
|
+
interface IExceptionEventData extends IBaseEvent {
|
|
1018
|
+
/**
|
|
1019
|
+
* Adds a custom event property to the exception event.
|
|
1020
|
+
*
|
|
1021
|
+
* Event properties allow you to attach additional contextual information to the exception.
|
|
1022
|
+
* Properties must follow the naming convention `event_properties.*` and support string,
|
|
1023
|
+
* number, and boolean values.
|
|
1024
|
+
*
|
|
1025
|
+
* @param key The property key. Must start with "event_properties."
|
|
1026
|
+
* @param value The property value (string, number, or boolean)
|
|
1027
|
+
* @returns The event instance for method chaining
|
|
1028
|
+
*
|
|
1029
|
+
* @remarks
|
|
1030
|
+
* **Property Requirements:**
|
|
1031
|
+
* - Only properties prefixed with `event_properties.*` are allowed
|
|
1032
|
+
* - Maximum of 50 custom properties per event
|
|
1033
|
+
* - If the limit is exceeded, properties are sorted alphabetically by key and excess properties are dropped deterministically
|
|
1034
|
+
* - String properties are limited to 5000 characters (exceeding characters are truncated)
|
|
1035
|
+
* - Field names must contain only alphabetic characters, numbers, underscores, and dots
|
|
1036
|
+
* - Each dot must be followed by an alphabetic character
|
|
1037
|
+
* - Each underscore must be followed by an alphabetic character or number
|
|
1038
|
+
*
|
|
1039
|
+
* @example
|
|
1040
|
+
* ```typescript
|
|
1041
|
+
* import { Dynatrace, ExceptionEventData } from '@dynatrace/react-native-plugin';
|
|
1042
|
+
*
|
|
1043
|
+
* try {
|
|
1044
|
+
* // Some operation that might throw an error
|
|
1045
|
+
* throw new Error('Something went wrong');
|
|
1046
|
+
* } catch (error) {
|
|
1047
|
+
* if (error instanceof Error) {
|
|
1048
|
+
* const exceptionEvent = new ExceptionEventData(error)
|
|
1049
|
+
* .addEventProperty('event_properties.exception_type', 'RuntimeError')
|
|
1050
|
+
* .addEventProperty('event_properties.stack_depth', 15)
|
|
1051
|
+
* .addEventProperty('event_properties.handled', true);
|
|
1052
|
+
*
|
|
1053
|
+
* Dynatrace.sendExceptionEvent(exceptionEvent);
|
|
1054
|
+
* }
|
|
1055
|
+
* }
|
|
1056
|
+
* ```
|
|
1057
|
+
*/
|
|
1058
|
+
addEventProperty(key: string, value: EventProperty): this;
|
|
1059
|
+
}
|
|
1060
|
+
|
|
1061
|
+
declare class ExceptionEventData implements IExceptionEventData {
|
|
1062
|
+
private rawEventProperties;
|
|
1063
|
+
private readonly error;
|
|
1064
|
+
constructor(error: Error);
|
|
1065
|
+
addEventProperty(key: `event_properties.${string}`, value: EventProperty): this;
|
|
1066
|
+
toJSON(): JSONObject | null;
|
|
1067
|
+
}
|
|
1068
|
+
|
|
858
1069
|
interface IDynatrace$1 {
|
|
859
1070
|
/**
|
|
860
1071
|
* Adds an event modifier that is executed just before the event is transferred.
|
|
@@ -865,6 +1076,14 @@ interface IDynatrace$1 {
|
|
|
865
1076
|
* Certain reserved fields and namespaces cannot be modified in any way (added, removed, or overridden),
|
|
866
1077
|
* while others are open for modification.
|
|
867
1078
|
*
|
|
1079
|
+
* Open for modification:
|
|
1080
|
+
* - url.full
|
|
1081
|
+
* - exception.stack_trace
|
|
1082
|
+
*
|
|
1083
|
+
* Open for modification or can be added:
|
|
1084
|
+
* - event_properties.*
|
|
1085
|
+
* - session_properties.*
|
|
1086
|
+
*
|
|
868
1087
|
* See the public documentation for a detailed list of reserved/open fields.
|
|
869
1088
|
*
|
|
870
1089
|
* @param eventModifier The modifier function to modify a given JSONObject
|
|
@@ -882,7 +1101,7 @@ interface IDynatrace$1 {
|
|
|
882
1101
|
* });
|
|
883
1102
|
* ```
|
|
884
1103
|
*
|
|
885
|
-
* @see https://docs.dynatrace.com/docs/
|
|
1104
|
+
* @see https://docs.dynatrace.com/docs/shortlink/react-native-custom-events#event-modifiers
|
|
886
1105
|
*/
|
|
887
1106
|
addEventModifier(eventModifier: IEventModifier): IEventModifier;
|
|
888
1107
|
/**
|
|
@@ -899,71 +1118,59 @@ interface IDynatrace$1 {
|
|
|
899
1118
|
* const removed = Dynatrace.removeEventModifier(modifier);
|
|
900
1119
|
* ```
|
|
901
1120
|
*
|
|
902
|
-
* @see https://docs.dynatrace.com/docs/
|
|
1121
|
+
* @see https://docs.dynatrace.com/docs/shortlink/react-native-custom-events#remove-event-modifiers
|
|
903
1122
|
*/
|
|
904
1123
|
removeEventModifier(eventModifier: IEventModifier): boolean;
|
|
905
1124
|
/**
|
|
906
1125
|
* Sends an exception event for error tracking and monitoring.
|
|
907
1126
|
*
|
|
908
|
-
* @param
|
|
909
|
-
* @param {JSONObject} properties Optional custom properties for the exception event. Must be a valid JSON object
|
|
910
|
-
* and cannot contain functions, undefined, Infinity, or NaN as values (they will be replaced with null).
|
|
911
|
-
*
|
|
912
|
-
* **Property Requirements:**
|
|
913
|
-
* - Only properties prefixed with `event_properties.*` are allowed
|
|
914
|
-
* - Additionally, the `duration` property is allowed
|
|
915
|
-
* - Maximum of 50 custom properties per event
|
|
916
|
-
* - String properties are limited to 5000 characters (exceeding characters are truncated)
|
|
917
|
-
* - Field names must contain only alphabetic characters, numbers, underscores, and dots
|
|
918
|
-
* - Each dot must be followed by an alphabetic character
|
|
919
|
-
* - Each underscore must be followed by an alphabetic character or number
|
|
1127
|
+
* @param exceptionEventData The exception event data built using ExceptionEventData
|
|
920
1128
|
*
|
|
921
1129
|
* @example
|
|
922
1130
|
* ```ts
|
|
923
|
-
* import { Dynatrace } from '@dynatrace/react-native-plugin';
|
|
1131
|
+
* import { Dynatrace, ExceptionEventData } from '@dynatrace/react-native-plugin';
|
|
924
1132
|
*
|
|
925
1133
|
* try {
|
|
926
1134
|
* // Code that may throw an error
|
|
927
1135
|
* throw new Error('Something went wrong');
|
|
928
1136
|
* } catch (error) {
|
|
929
|
-
*
|
|
930
|
-
*
|
|
931
|
-
*
|
|
932
|
-
*
|
|
1137
|
+
* if (error instanceof Error) {
|
|
1138
|
+
* const exceptionEvent = new ExceptionEventData(error)
|
|
1139
|
+
* .addEventProperty('event_properties.custom_key', 'custom_value')
|
|
1140
|
+
* .addEventProperty('event_properties.error_context', 'user_action');
|
|
1141
|
+
*
|
|
1142
|
+
* Dynatrace.sendExceptionEvent(exceptionEvent);
|
|
1143
|
+
* }
|
|
933
1144
|
* }
|
|
934
1145
|
* ```
|
|
935
1146
|
*
|
|
936
|
-
* @see https://docs.dynatrace.com/docs/
|
|
1147
|
+
* @see https://docs.dynatrace.com/docs/shortlink/react-native-error-crash-reporting#send-exception-event
|
|
937
1148
|
*/
|
|
938
|
-
sendExceptionEvent(
|
|
1149
|
+
sendExceptionEvent(exceptionEventData: ExceptionEventData): void;
|
|
939
1150
|
/**
|
|
940
|
-
* Sends a custom event with properties
|
|
941
|
-
*
|
|
942
|
-
* @param {JSONObject} properties Event properties as a valid JSON object. Cannot contain functions, undefined,
|
|
943
|
-
* Infinity, or NaN as values (they will be replaced with null). Empty objects are valid.
|
|
1151
|
+
* Sends a custom event with event properties and optional duration.
|
|
944
1152
|
*
|
|
945
|
-
*
|
|
946
|
-
* - Only properties prefixed with `event_properties.*` are allowed
|
|
947
|
-
* - Additionally, the `duration` property is allowed
|
|
948
|
-
* - Maximum of 50 custom properties per event
|
|
949
|
-
* - String properties are limited to 5000 characters (exceeding characters are truncated)
|
|
950
|
-
* - Field names must contain only alphabetic characters, numbers, underscores, and dots
|
|
951
|
-
* - Each dot must be followed by an alphabetic character
|
|
952
|
-
* - Each underscore must be followed by an alphabetic character or number
|
|
1153
|
+
* @param eventData The event data built using EventData
|
|
953
1154
|
*
|
|
954
1155
|
* @example
|
|
955
1156
|
* ```ts
|
|
956
|
-
* import { Dynatrace } from '@dynatrace/react-native-plugin';
|
|
1157
|
+
* import { Dynatrace, EventData } from '@dynatrace/react-native-plugin';
|
|
1158
|
+
*
|
|
1159
|
+
* const customEvent = new EventData()
|
|
1160
|
+
* .addEventProperty('event_properties.user_action', 'button_click')
|
|
1161
|
+
* .addEventProperty('event_properties.screen_name', 'checkout')
|
|
1162
|
+
* .addEventProperty('event_properties.item_count', 3)
|
|
1163
|
+
* .withDuration(150);
|
|
957
1164
|
*
|
|
958
|
-
* Dynatrace.sendEvent(
|
|
1165
|
+
* Dynatrace.sendEvent(customEvent);
|
|
959
1166
|
* ```
|
|
960
1167
|
*
|
|
961
|
-
* @see https://docs.dynatrace.com/docs/
|
|
1168
|
+
* @see https://docs.dynatrace.com/docs/shortlink/react-native-custom-events#send-custom-events
|
|
962
1169
|
*/
|
|
963
|
-
sendEvent(
|
|
1170
|
+
sendEvent(eventData: EventData): void;
|
|
964
1171
|
/**
|
|
965
1172
|
* Starts a new view context. All events reported after this call will be associated
|
|
966
|
-
* with this view until
|
|
1173
|
+
* with this view until a new view is started.
|
|
967
1174
|
*
|
|
968
1175
|
* **Note:** Only one view context can be active at a time. Starting a new view will
|
|
969
1176
|
* automatically stop any currently active view context.
|
|
@@ -978,81 +1185,56 @@ interface IDynatrace$1 {
|
|
|
978
1185
|
* Dynatrace.startView('HomeScreen');
|
|
979
1186
|
* ```
|
|
980
1187
|
*
|
|
981
|
-
* @see https://docs.dynatrace.com/docs/
|
|
1188
|
+
* @see https://docs.dynatrace.com/docs/shortlink/react-native-app-performance#view-monitoring
|
|
982
1189
|
*/
|
|
983
1190
|
startView(name: string): void;
|
|
984
|
-
/**
|
|
985
|
-
* Stops the current view context. Events reported after this call will not be
|
|
986
|
-
* associated with any view until a new view is started.
|
|
987
|
-
*
|
|
988
|
-
* @example
|
|
989
|
-
* ```ts
|
|
990
|
-
* import { Dynatrace } from '@dynatrace/react-native-plugin';
|
|
991
|
-
*
|
|
992
|
-
* Dynatrace.startView('HomeScreen');
|
|
993
|
-
* // ... user interactions ...
|
|
994
|
-
* Dynatrace.stopView();
|
|
995
|
-
* ```
|
|
996
|
-
*
|
|
997
|
-
* @see https://docs.dynatrace.com/docs/observe/digital-experience/new-rum-experience/api
|
|
998
|
-
*/
|
|
999
|
-
stopView(): void;
|
|
1000
1191
|
/**
|
|
1001
1192
|
* Sends a session properties event. Session properties apply to all events in the current session.
|
|
1002
1193
|
*
|
|
1003
1194
|
* **Note:** While you can send multiple session properties at once, if you report the same
|
|
1004
1195
|
* property multiple times, session aggregation will only use one of the values (first or last).
|
|
1005
1196
|
*
|
|
1006
|
-
* @param
|
|
1007
|
-
* undefined, Infinity, or NaN as values (they will be replaced with null). Empty objects are valid.
|
|
1008
|
-
*
|
|
1009
|
-
* **Property Requirements:**
|
|
1010
|
-
* - Only properties prefixed with `session_properties.*` are allowed
|
|
1011
|
-
* - Additionally, the `duration` property is allowed
|
|
1012
|
-
* - Maximum of 50 custom properties per event
|
|
1013
|
-
* - String properties are limited to 5000 characters (exceeding characters are truncated)
|
|
1014
|
-
* - Field names must contain only alphabetic characters, numbers, underscores, and dots
|
|
1015
|
-
* - Each dot must be followed by an alphabetic character
|
|
1016
|
-
* - Each underscore must be followed by an alphabetic character or number
|
|
1197
|
+
* @param sessionPropertyEventData The session property event data built using SessionPropertyEventData builder
|
|
1017
1198
|
*
|
|
1018
1199
|
* @example
|
|
1019
1200
|
* ```ts
|
|
1020
|
-
* import { Dynatrace } from '@dynatrace/react-native-plugin';
|
|
1201
|
+
* import { Dynatrace, SessionPropertyEventData } from '@dynatrace/react-native-plugin';
|
|
1021
1202
|
*
|
|
1022
1203
|
* // Set session-level properties
|
|
1023
|
-
*
|
|
1024
|
-
* 'session_properties.user_tier'
|
|
1025
|
-
* 'session_properties.app_version'
|
|
1026
|
-
* 'session_properties.device_type'
|
|
1027
|
-
*
|
|
1204
|
+
* const sessionEvent = new SessionPropertyEventData()
|
|
1205
|
+
* .addSessionProperty('session_properties.user_tier', 'premium')
|
|
1206
|
+
* .addSessionProperty('session_properties.app_version', '2.1.0')
|
|
1207
|
+
* .addSessionProperty('session_properties.device_type', 'mobile');
|
|
1208
|
+
*
|
|
1209
|
+
* Dynatrace.sendSessionPropertyEvent(sessionEvent);
|
|
1028
1210
|
* ```
|
|
1029
1211
|
*
|
|
1030
|
-
* @see https://docs.dynatrace.com/docs/
|
|
1212
|
+
* @see https://docs.dynatrace.com/docs/shortlink/react-native-custom-events#send-session-property-events
|
|
1031
1213
|
*/
|
|
1032
|
-
sendSessionPropertyEvent(
|
|
1214
|
+
sendSessionPropertyEvent(sessionPropertyEventData: SessionPropertyEventData): void;
|
|
1033
1215
|
/**
|
|
1034
1216
|
* Sends an HTTP request event for network activity monitoring.
|
|
1035
1217
|
*
|
|
1036
|
-
* @param {
|
|
1218
|
+
* @param {HttpRequestEventData} httpRequestEvent Event object containing the HTTP request details
|
|
1037
1219
|
*
|
|
1038
1220
|
* @example
|
|
1039
1221
|
* ```ts
|
|
1040
|
-
* import { Dynatrace,
|
|
1222
|
+
* import { Dynatrace, HttpRequestEventData } from '@dynatrace/react-native-plugin';
|
|
1041
1223
|
*
|
|
1042
1224
|
* // Basic HTTP request event
|
|
1043
|
-
* const
|
|
1044
|
-
* Dynatrace.sendHttpRequestEvent(
|
|
1225
|
+
* const requestEvent = new HttpRequestEventData('https://api.example.com/users', 'GET');
|
|
1226
|
+
* Dynatrace.sendHttpRequestEvent(requestEvent);
|
|
1045
1227
|
*
|
|
1046
1228
|
* // HTTP request with additional details
|
|
1047
|
-
* const
|
|
1048
|
-
* .
|
|
1049
|
-
* .
|
|
1050
|
-
* Dynatrace.sendHttpRequestEvent(
|
|
1229
|
+
* const detailedRequest = new HttpRequestEventData('https://api.example.com/data', 'POST')
|
|
1230
|
+
* .withStatusCode(200)
|
|
1231
|
+
* .addEventProperty('event_properties.headers.content_type', 'application/json');
|
|
1232
|
+
* Dynatrace.sendHttpRequestEvent(detailedRequest);
|
|
1051
1233
|
* ```
|
|
1052
1234
|
*
|
|
1053
|
-
* @see https://docs.dynatrace.com/docs/
|
|
1235
|
+
* @see https://docs.dynatrace.com/docs/shortlink/react-native-web-request-performance#manual-http-request-reporting
|
|
1054
1236
|
*/
|
|
1055
|
-
sendHttpRequestEvent(
|
|
1237
|
+
sendHttpRequestEvent(httpRequestEvent: HttpRequestEventData): void;
|
|
1056
1238
|
}
|
|
1057
1239
|
|
|
1058
1240
|
/**
|
|
@@ -1130,9 +1312,10 @@ interface IDynatrace extends IDynatrace$1 {
|
|
|
1130
1312
|
* @example
|
|
1131
1313
|
* ```ts
|
|
1132
1314
|
* import { Dynatrace } from '@dynatrace/react-native-plugin';
|
|
1315
|
+
* import { FunctionComponent } from 'react';
|
|
1133
1316
|
*
|
|
1134
|
-
* export
|
|
1135
|
-
*
|
|
1317
|
+
* export const MyFunctionalComponent: FunctionComponent<{}> = () => {
|
|
1318
|
+
* return null;
|
|
1136
1319
|
* }
|
|
1137
1320
|
*
|
|
1138
1321
|
* Dynatrace.withMonitoring(MyFunctionalComponent, "MyFunctionalComponent");
|
|
@@ -1224,54 +1407,87 @@ interface IDynatrace extends IDynatrace$1 {
|
|
|
1224
1407
|
*/
|
|
1225
1408
|
reportErrorWithStacktrace(errorName: string, reason: string, stacktrace: string, platform?: Platform): void;
|
|
1226
1409
|
/**
|
|
1227
|
-
* Reports
|
|
1410
|
+
* Reports an error with its complete stacktrace to Dynatrace for monitoring and analysis.
|
|
1411
|
+
* Use this method to capture and report errors with their full stack traces, typically within
|
|
1412
|
+
* try-catch blocks to handle exceptions gracefully while maintaining observability.
|
|
1228
1413
|
*
|
|
1229
|
-
* @param
|
|
1230
|
-
* @param
|
|
1231
|
-
* @param
|
|
1232
|
-
* @param
|
|
1233
|
-
* @param
|
|
1414
|
+
* @param errorName Name or type of the error (e.g., 'DatabaseError', 'NetworkError'). Limited to 250 characters.
|
|
1415
|
+
* @param errorValue The error message or value describing what went wrong
|
|
1416
|
+
* @param reason Additional context explaining why the error occurred
|
|
1417
|
+
* @param stacktrace The complete stack trace from the error. Use error.stack or provide a custom trace.
|
|
1418
|
+
* @param platform Is optional, which means by default this call will be applied on both platforms (Android & iOS).
|
|
1234
1419
|
*
|
|
1235
1420
|
* @example
|
|
1236
1421
|
* ```ts
|
|
1237
1422
|
* import { Dynatrace } from '@dynatrace/react-native-plugin';
|
|
1238
1423
|
*
|
|
1239
|
-
*
|
|
1424
|
+
* try {
|
|
1425
|
+
* throw new Error('Database connection failed');
|
|
1426
|
+
* } catch (error) {
|
|
1427
|
+
* if (error instanceof Error) {
|
|
1428
|
+
* Dynatrace.reportErrorStacktrace(
|
|
1429
|
+
* 'DatabaseError',
|
|
1430
|
+
* error.message,
|
|
1431
|
+
* 'Failed to connect to remote database',
|
|
1432
|
+
* error.stack || 'No stack trace available'
|
|
1433
|
+
* );
|
|
1434
|
+
* }
|
|
1435
|
+
* }
|
|
1240
1436
|
* ```
|
|
1241
1437
|
*
|
|
1242
1438
|
* @see https://www.npmjs.com/package/@dynatrace/react-native-plugin#report-an-error-stacktrace
|
|
1243
1439
|
*/
|
|
1244
1440
|
reportErrorStacktrace(errorName: string, errorValue: string, reason: string, stacktrace: string, platform?: Platform): void;
|
|
1245
1441
|
/**
|
|
1246
|
-
* Reports a custom crash
|
|
1442
|
+
* Reports a custom crash event to Dynatrace for critical failures that cause app termination.
|
|
1443
|
+
* Use this to manually report crashes with detailed stack traces when automatic crash detection
|
|
1444
|
+
* is insufficient or when you need to report non-fatal errors as crashes for monitoring purposes.
|
|
1247
1445
|
*
|
|
1248
|
-
* @param
|
|
1249
|
-
* @param
|
|
1250
|
-
* @param
|
|
1251
|
-
* @param
|
|
1446
|
+
* @param crashName Descriptive name for the crash (e.g., 'OutOfMemoryError', 'UnhandledException'). Limited to 250 characters.
|
|
1447
|
+
* @param reason Brief explanation of why the crash occurred
|
|
1448
|
+
* @param stacktrace Complete stack trace showing the call sequence leading to the crash
|
|
1449
|
+
* @param platform Is optional, which means by default this call will be applied on both platforms (Android & iOS).
|
|
1252
1450
|
*
|
|
1253
1451
|
* @example
|
|
1254
1452
|
* ```ts
|
|
1255
1453
|
* import { Dynatrace } from '@dynatrace/react-native-plugin';
|
|
1256
1454
|
*
|
|
1257
|
-
*
|
|
1455
|
+
* try {
|
|
1456
|
+
* throw new Error('Fatal memory allocation failure');
|
|
1457
|
+
* } catch (error) {
|
|
1458
|
+
* if (error instanceof Error) {
|
|
1459
|
+
* Dynatrace.reportCrash(
|
|
1460
|
+
* 'MemoryError',
|
|
1461
|
+
* error.message,
|
|
1462
|
+
* error.stack || 'No stack trace available'
|
|
1463
|
+
* );
|
|
1464
|
+
* }
|
|
1465
|
+
* }
|
|
1258
1466
|
* ```
|
|
1259
1467
|
*
|
|
1260
1468
|
* @see https://www.npmjs.com/package/@dynatrace/react-native-plugin#manually-report-a-crash
|
|
1261
1469
|
*/
|
|
1262
1470
|
reportCrash(crashName: string, reason: string, stacktrace: string, platform?: Platform): void;
|
|
1263
1471
|
/**
|
|
1264
|
-
* Reports a crash
|
|
1472
|
+
* Reports a crash using a native JavaScript Error object to Dynatrace.
|
|
1473
|
+
* This is a convenience method that automatically extracts the error message and stack trace
|
|
1474
|
+
* from an Error object, making it easier to report crashes from caught exceptions.
|
|
1265
1475
|
*
|
|
1266
|
-
* @param
|
|
1267
|
-
* @param
|
|
1268
|
-
* @param
|
|
1476
|
+
* @param crashName Descriptive name for the crash (e.g., 'UnhandledPromiseRejection'). Limited to 250 characters.
|
|
1477
|
+
* @param crash The Error object containing the stack trace and error details
|
|
1478
|
+
* @param platform Is optional, which means by default this call will be applied on both platforms (Android & iOS).
|
|
1269
1479
|
*
|
|
1270
1480
|
* @example
|
|
1271
1481
|
* ```ts
|
|
1272
1482
|
* import { Dynatrace } from '@dynatrace/react-native-plugin';
|
|
1273
1483
|
*
|
|
1274
|
-
*
|
|
1484
|
+
* try {
|
|
1485
|
+
* throw new Error('Critical API endpoint unavailable');
|
|
1486
|
+
* } catch (error) {
|
|
1487
|
+
* if (error instanceof Error) {
|
|
1488
|
+
* Dynatrace.reportCrashWithException('APIFailureCrash', error);
|
|
1489
|
+
* }
|
|
1490
|
+
* }
|
|
1275
1491
|
* ```
|
|
1276
1492
|
*
|
|
1277
1493
|
* @see https://www.npmjs.com/package/@dynatrace/react-native-plugin#manually-report-a-crash
|
|
@@ -1720,7 +1936,7 @@ declare class ConfigurationBuilder {
|
|
|
1720
1936
|
*
|
|
1721
1937
|
* @example
|
|
1722
1938
|
* ```ts
|
|
1723
|
-
* import { ConfigurationBuilder, Dynatrace } from '@dynatrace/react-native-plugin';
|
|
1939
|
+
* import { ConfigurationBuilder, Dynatrace, LogLevel } from '@dynatrace/react-native-plugin';
|
|
1724
1940
|
*
|
|
1725
1941
|
* const config = new ConfigurationBuilder('beaconUrl', 'applicationId')
|
|
1726
1942
|
* .withLogLevel(LogLevel.Debug)
|
|
@@ -1753,14 +1969,19 @@ interface IDynatraceWebRequestTiming {
|
|
|
1753
1969
|
*
|
|
1754
1970
|
* try {
|
|
1755
1971
|
* timing.startWebRequestTiming();
|
|
1756
|
-
* const
|
|
1972
|
+
* const response = await fetch(url, {
|
|
1757
1973
|
* headers: {
|
|
1758
1974
|
* [timing.getRequestTagHeader()]: tag
|
|
1759
1975
|
* }
|
|
1760
1976
|
* });
|
|
1761
|
-
*
|
|
1977
|
+
* const data = await response.text();
|
|
1978
|
+
* timing.stopWebRequestTiming(response.status, data);
|
|
1762
1979
|
* } catch (error) {
|
|
1763
|
-
*
|
|
1980
|
+
* if (error instanceof Error) {
|
|
1981
|
+
* timing.stopWebRequestTiming(-1, error.message);
|
|
1982
|
+
* } else {
|
|
1983
|
+
* timing.stopWebRequestTiming(-1, (error as any).toString());
|
|
1984
|
+
* }
|
|
1764
1985
|
* } finally {
|
|
1765
1986
|
* action.leaveAction();
|
|
1766
1987
|
* }
|
|
@@ -1788,14 +2009,18 @@ interface IDynatraceWebRequestTiming {
|
|
|
1788
2009
|
*
|
|
1789
2010
|
* try {
|
|
1790
2011
|
* timing.startWebRequestTiming();
|
|
1791
|
-
* const
|
|
2012
|
+
* const response = await fetch(url, {
|
|
1792
2013
|
* headers: {
|
|
1793
2014
|
* [timing.getRequestTagHeader()]: tag
|
|
1794
2015
|
* }
|
|
1795
2016
|
* });
|
|
1796
|
-
* timing.stopWebRequestTiming(
|
|
2017
|
+
* timing.stopWebRequestTiming(response.status, response.statusText);
|
|
1797
2018
|
* } catch (error) {
|
|
1798
|
-
*
|
|
2019
|
+
* if (error instanceof Error) {
|
|
2020
|
+
* timing.stopWebRequestTiming(-1, error.message);
|
|
2021
|
+
* } else {
|
|
2022
|
+
* timing.stopWebRequestTiming(-1, (error as any).toString());
|
|
2023
|
+
* }
|
|
1799
2024
|
* } finally {
|
|
1800
2025
|
* action.leaveAction();
|
|
1801
2026
|
* }
|
|
@@ -1826,21 +2051,27 @@ interface IDynatraceWebRequestTiming {
|
|
|
1826
2051
|
*
|
|
1827
2052
|
* try {
|
|
1828
2053
|
* timing.startWebRequestTiming();
|
|
1829
|
-
* const
|
|
2054
|
+
* const response = await fetch(url, {
|
|
2055
|
+
* method: 'POST',
|
|
1830
2056
|
* headers: {
|
|
1831
2057
|
* [timing.getRequestTagHeader()]: tag,
|
|
1832
2058
|
* 'Content-Type': 'application/json'
|
|
1833
|
-
* }
|
|
2059
|
+
* },
|
|
2060
|
+
* body: requestData
|
|
1834
2061
|
* });
|
|
1835
|
-
* const responseData =
|
|
2062
|
+
* const responseData = await response.text();
|
|
1836
2063
|
* timing.stopWebRequestTimingWithSize(
|
|
1837
|
-
*
|
|
1838
|
-
*
|
|
2064
|
+
* response.status,
|
|
2065
|
+
* response.statusText,
|
|
1839
2066
|
* requestData.length,
|
|
1840
2067
|
* responseData.length
|
|
1841
2068
|
* );
|
|
1842
2069
|
* } catch (error) {
|
|
1843
|
-
*
|
|
2070
|
+
* if (error instanceof Error) {
|
|
2071
|
+
* timing.stopWebRequestTiming(-1, error.message);
|
|
2072
|
+
* } else {
|
|
2073
|
+
* timing.stopWebRequestTiming(-1, (error as any).toString());
|
|
2074
|
+
* }
|
|
1844
2075
|
* } finally {
|
|
1845
2076
|
* action.leaveAction();
|
|
1846
2077
|
* }
|
|
@@ -1970,5 +2201,5 @@ declare module 'react' {
|
|
|
1970
2201
|
}
|
|
1971
2202
|
}
|
|
1972
2203
|
|
|
1973
|
-
export { ConfigurationBuilder, DataCollectionLevel, Dynatrace, DynatraceWebRequestTiming,
|
|
2204
|
+
export { ConfigurationBuilder, DataCollectionLevel, Dynatrace, DynatraceWebRequestTiming, EventData, ExceptionEventData, HttpRequestEventData, LogLevel, ManualStartupConfiguration, Platform, SessionPropertyEventData, UserPrivacyOptions };
|
|
1974
2205
|
export type { IConfiguration, IDynatraceAction, IDynatraceRootAction, IDynatraceWebRequestTiming, IEventModifier, JSONObject };
|