@atlaskit/link-create 1.13.1 → 1.13.2

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/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # @atlaskit/link-create
2
2
 
3
+ ## 1.13.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [#64870](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/64870) [`0f1f6c106355`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/0f1f6c106355) - Adds analytics attribute to help exclude expected errors from SLIs, behind ff
8
+ - Updated dependencies
9
+
3
10
  ## 1.13.1
4
11
 
5
12
  ### Patch Changes
@@ -84,7 +84,6 @@ events:
84
84
  <<: *PackageMetaDataContext
85
85
  <<: *LinkCreateAnalyticContext
86
86
 
87
-
88
87
  - modalDialog opened (linkCreate):
89
88
  type: ui
90
89
  description: fired when a link create modal component is mounted
@@ -122,7 +121,7 @@ events:
122
121
 
123
122
  - object createFailed (linkCreate):
124
123
  type: track
125
- description: "[DEPRECATED] prefer `operation failed (linkCreate)` — fired when the object creation fails"
124
+ description: '[DEPRECATED] prefer `operation failed (linkCreate)` — fired when the object creation fails'
126
125
  attributes:
127
126
  <<: *PackageMetaDataContext
128
127
  failureType:
@@ -158,3 +157,6 @@ events:
158
157
  type: string
159
158
  required: false
160
159
  description: The x-trace-id header associated with the network request if the failure is a Response
160
+ isSLOFailure:
161
+ type: boolean
162
+ description: Whether the failure should be considered for affecting SLO (should we ignore the failure)
@@ -11,7 +11,7 @@ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/sli
11
11
  *
12
12
  * Generates Typescript types for analytics events from analytics.spec.yaml
13
13
  *
14
- * @codegen <<SignedSource::1c67626e82d39af8e93ced7a11389f4f>>
14
+ * @codegen <<SignedSource::7beb355391f6269c701cf87b0c222d69>>
15
15
  * @codegenCommand yarn workspace @atlaskit/link-create run codegen-analytics
16
16
  */
17
17
 
@@ -23,6 +23,27 @@ var ExperienceContext = /*#__PURE__*/(0, _react.createContext)({
23
23
  failure: function failure() {}
24
24
  });
25
25
 
26
+ /**
27
+ * Error message matches to ignore
28
+ * These should not affect our SLOs as there's nothing we can do about them
29
+ */
30
+ var IGNORE_ERROR_MESSAGES = [/failed to fetch/i];
31
+
32
+ /**
33
+ * Returns false for errors that should not be considered failures of our SLO
34
+ * because they are failures only the user can handle.
35
+ */
36
+ var isErrorSLOFailure = function isErrorSLOFailure(error) {
37
+ if (error instanceof Error) {
38
+ if (IGNORE_ERROR_MESSAGES.some(function (msg) {
39
+ return msg.test(error.message);
40
+ })) {
41
+ return false;
42
+ }
43
+ }
44
+ return true;
45
+ };
46
+
26
47
  /**
27
48
  * Experience provider that simply keeps track of the state of the experience.
28
49
  * Fires an operational event when experience state changes to FAILED.
@@ -66,7 +87,11 @@ var Experience = exports.Experience = function Experience(_ref) {
66
87
  * Previous experience status indicates whether the experience
67
88
  * has just failed now, or has already failing
68
89
  */
69
- previousExperienceStatus: experience.current
90
+ previousExperienceStatus: experience.current,
91
+ /**
92
+ * Whether the failure should be involved when considering SLI/SLO
93
+ */
94
+ isSLOFailure: (0, _platformFeatureFlags.getBooleanFF)('platform.linking-platform.link-create.slo-ignore-failed-fetch') ? isErrorSLOFailure(error) : true
70
95
  }, (0, _errors.getNetworkFields)(error)))).fire(_constants.ANALYTICS_CHANNEL);
71
96
  if (error instanceof Error) {
72
97
  if ((0, _platformFeatureFlags.getBooleanFF)('platform.linking-platform.link-create.enable-sentry-client')) {
@@ -74,8 +99,22 @@ var Experience = exports.Experience = function Experience(_ref) {
74
99
  (0, _sentry.captureException)(error, 'link-create');
75
100
  }
76
101
  }
77
- if (experience.current !== experienceStatus) {
78
- experience.current = experienceStatus;
102
+ if ((0, _platformFeatureFlags.getBooleanFF)('platform.linking-platform.link-create.slo-ignore-failed-fetch')) {
103
+ /**
104
+ * Only consider the experience truly failed if the
105
+ * failure is one we haven't correctly handled.
106
+ *
107
+ * In otherwords allow the experience to be "restarted" for the user to try again
108
+ */
109
+ if (isErrorSLOFailure(error)) {
110
+ if (experience.current !== experienceStatus) {
111
+ experience.current = experienceStatus;
112
+ }
113
+ }
114
+ } else {
115
+ if (experience.current !== experienceStatus) {
116
+ experience.current = experienceStatus;
117
+ }
79
118
  }
80
119
  }
81
120
  };
@@ -31,7 +31,7 @@ var LinkCreateWithAnalyticsContext = (0, _analytics.withLinkCreateAnalyticsConte
31
31
  }));
32
32
  var PACKAGE_DATA = exports.PACKAGE_DATA = {
33
33
  packageName: "@atlaskit/link-create" || '',
34
- packageVersion: "1.13.1" || '',
34
+ packageVersion: "1.13.2" || '',
35
35
  component: _constants.COMPONENT_NAME,
36
36
  componentName: _constants.COMPONENT_NAME
37
37
  };
@@ -3,7 +3,7 @@
3
3
  *
4
4
  * Generates Typescript types for analytics events from analytics.spec.yaml
5
5
  *
6
- * @codegen <<SignedSource::1c67626e82d39af8e93ced7a11389f4f>>
6
+ * @codegen <<SignedSource::7beb355391f6269c701cf87b0c222d69>>
7
7
  * @codegenCommand yarn workspace @atlaskit/link-create run codegen-analytics
8
8
  */
9
9
 
@@ -10,6 +10,25 @@ const ExperienceContext = /*#__PURE__*/createContext({
10
10
  failure: () => {}
11
11
  });
12
12
 
13
+ /**
14
+ * Error message matches to ignore
15
+ * These should not affect our SLOs as there's nothing we can do about them
16
+ */
17
+ const IGNORE_ERROR_MESSAGES = [/failed to fetch/i];
18
+
19
+ /**
20
+ * Returns false for errors that should not be considered failures of our SLO
21
+ * because they are failures only the user can handle.
22
+ */
23
+ const isErrorSLOFailure = error => {
24
+ if (error instanceof Error) {
25
+ if (IGNORE_ERROR_MESSAGES.some(msg => msg.test(error.message))) {
26
+ return false;
27
+ }
28
+ }
29
+ return true;
30
+ };
31
+
13
32
  /**
14
33
  * Experience provider that simply keeps track of the state of the experience.
15
34
  * Fires an operational event when experience state changes to FAILED.
@@ -55,6 +74,10 @@ export const Experience = ({
55
74
  * has just failed now, or has already failing
56
75
  */
57
76
  previousExperienceStatus: experience.current,
77
+ /**
78
+ * Whether the failure should be involved when considering SLI/SLO
79
+ */
80
+ isSLOFailure: getBooleanFF('platform.linking-platform.link-create.slo-ignore-failed-fetch') ? isErrorSLOFailure(error) : true,
58
81
  /**
59
82
  * Fields related to `Response` object that can help with debugging
60
83
  * what has gone wrong
@@ -67,8 +90,22 @@ export const Experience = ({
67
90
  captureException(error, 'link-create');
68
91
  }
69
92
  }
70
- if (experience.current !== experienceStatus) {
71
- experience.current = experienceStatus;
93
+ if (getBooleanFF('platform.linking-platform.link-create.slo-ignore-failed-fetch')) {
94
+ /**
95
+ * Only consider the experience truly failed if the
96
+ * failure is one we haven't correctly handled.
97
+ *
98
+ * In otherwords allow the experience to be "restarted" for the user to try again
99
+ */
100
+ if (isErrorSLOFailure(error)) {
101
+ if (experience.current !== experienceStatus) {
102
+ experience.current = experienceStatus;
103
+ }
104
+ }
105
+ } else {
106
+ if (experience.current !== experienceStatus) {
107
+ experience.current = experienceStatus;
108
+ }
72
109
  }
73
110
  }
74
111
  }), [experience, createAnalyticsEvent]);
@@ -23,7 +23,7 @@ const LinkCreateWithAnalyticsContext = withLinkCreateAnalyticsContext( /*#__PURE
23
23
  }));
24
24
  export const PACKAGE_DATA = {
25
25
  packageName: "@atlaskit/link-create" || '',
26
- packageVersion: "1.13.1" || '',
26
+ packageVersion: "1.13.2" || '',
27
27
  component: COMPONENT_NAME,
28
28
  componentName: COMPONENT_NAME
29
29
  };
@@ -4,7 +4,7 @@ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
4
4
  *
5
5
  * Generates Typescript types for analytics events from analytics.spec.yaml
6
6
  *
7
- * @codegen <<SignedSource::1c67626e82d39af8e93ced7a11389f4f>>
7
+ * @codegen <<SignedSource::7beb355391f6269c701cf87b0c222d69>>
8
8
  * @codegenCommand yarn workspace @atlaskit/link-create run codegen-analytics
9
9
  */
10
10
 
@@ -13,6 +13,27 @@ var ExperienceContext = /*#__PURE__*/createContext({
13
13
  failure: function failure() {}
14
14
  });
15
15
 
16
+ /**
17
+ * Error message matches to ignore
18
+ * These should not affect our SLOs as there's nothing we can do about them
19
+ */
20
+ var IGNORE_ERROR_MESSAGES = [/failed to fetch/i];
21
+
22
+ /**
23
+ * Returns false for errors that should not be considered failures of our SLO
24
+ * because they are failures only the user can handle.
25
+ */
26
+ var isErrorSLOFailure = function isErrorSLOFailure(error) {
27
+ if (error instanceof Error) {
28
+ if (IGNORE_ERROR_MESSAGES.some(function (msg) {
29
+ return msg.test(error.message);
30
+ })) {
31
+ return false;
32
+ }
33
+ }
34
+ return true;
35
+ };
36
+
16
37
  /**
17
38
  * Experience provider that simply keeps track of the state of the experience.
18
39
  * Fires an operational event when experience state changes to FAILED.
@@ -56,7 +77,11 @@ export var Experience = function Experience(_ref) {
56
77
  * Previous experience status indicates whether the experience
57
78
  * has just failed now, or has already failing
58
79
  */
59
- previousExperienceStatus: experience.current
80
+ previousExperienceStatus: experience.current,
81
+ /**
82
+ * Whether the failure should be involved when considering SLI/SLO
83
+ */
84
+ isSLOFailure: getBooleanFF('platform.linking-platform.link-create.slo-ignore-failed-fetch') ? isErrorSLOFailure(error) : true
60
85
  }, getNetworkFields(error)))).fire(ANALYTICS_CHANNEL);
61
86
  if (error instanceof Error) {
62
87
  if (getBooleanFF('platform.linking-platform.link-create.enable-sentry-client')) {
@@ -64,8 +89,22 @@ export var Experience = function Experience(_ref) {
64
89
  captureException(error, 'link-create');
65
90
  }
66
91
  }
67
- if (experience.current !== experienceStatus) {
68
- experience.current = experienceStatus;
92
+ if (getBooleanFF('platform.linking-platform.link-create.slo-ignore-failed-fetch')) {
93
+ /**
94
+ * Only consider the experience truly failed if the
95
+ * failure is one we haven't correctly handled.
96
+ *
97
+ * In otherwords allow the experience to be "restarted" for the user to try again
98
+ */
99
+ if (isErrorSLOFailure(error)) {
100
+ if (experience.current !== experienceStatus) {
101
+ experience.current = experienceStatus;
102
+ }
103
+ }
104
+ } else {
105
+ if (experience.current !== experienceStatus) {
106
+ experience.current = experienceStatus;
107
+ }
69
108
  }
70
109
  }
71
110
  };
@@ -23,7 +23,7 @@ var LinkCreateWithAnalyticsContext = withLinkCreateAnalyticsContext( /*#__PURE__
23
23
  }));
24
24
  export var PACKAGE_DATA = {
25
25
  packageName: "@atlaskit/link-create" || '',
26
- packageVersion: "1.13.1" || '',
26
+ packageVersion: "1.13.2" || '',
27
27
  component: COMPONENT_NAME,
28
28
  componentName: COMPONENT_NAME
29
29
  };
@@ -3,7 +3,7 @@
3
3
  *
4
4
  * Generates Typescript types for analytics events from analytics.spec.yaml
5
5
  *
6
- * @codegen <<SignedSource::1c67626e82d39af8e93ced7a11389f4f>>
6
+ * @codegen <<SignedSource::7beb355391f6269c701cf87b0c222d69>>
7
7
  * @codegenCommand yarn workspace @atlaskit/link-create run codegen-analytics
8
8
  */
9
9
  export type PackageMetaDataType = {
@@ -46,6 +46,7 @@ export type LinkCreateExperienceFailedAttributesType = {
46
46
  path: string | null;
47
47
  status: number | null;
48
48
  traceId: string | null;
49
+ isSLOFailure: boolean;
49
50
  };
50
51
  export type AnalyticsEventAttributes = {
51
52
  'screen.linkCreateScreen.viewed': LinkCreateScreenViewedAttributesType;
@@ -3,7 +3,7 @@
3
3
  *
4
4
  * Generates Typescript types for analytics events from analytics.spec.yaml
5
5
  *
6
- * @codegen <<SignedSource::1c67626e82d39af8e93ced7a11389f4f>>
6
+ * @codegen <<SignedSource::7beb355391f6269c701cf87b0c222d69>>
7
7
  * @codegenCommand yarn workspace @atlaskit/link-create run codegen-analytics
8
8
  */
9
9
  export type PackageMetaDataType = {
@@ -46,6 +46,7 @@ export type LinkCreateExperienceFailedAttributesType = {
46
46
  path: string | null;
47
47
  status: number | null;
48
48
  traceId: string | null;
49
+ isSLOFailure: boolean;
49
50
  };
50
51
  export type AnalyticsEventAttributes = {
51
52
  'screen.linkCreateScreen.viewed': LinkCreateScreenViewedAttributesType;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/link-create",
3
- "version": "1.13.1",
3
+ "version": "1.13.2",
4
4
  "description": "The driver component of meta creation flow",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -43,14 +43,14 @@
43
43
  "@atlaskit/form": "^9.0.3",
44
44
  "@atlaskit/icon": "^22.0.0",
45
45
  "@atlaskit/intl-messages-provider": "^1.0.2",
46
- "@atlaskit/linking-common": "^5.1.0",
46
+ "@atlaskit/linking-common": "^5.3.0",
47
47
  "@atlaskit/modal-dialog": "^12.10.0",
48
48
  "@atlaskit/platform-feature-flags": "^0.2.1",
49
- "@atlaskit/primitives": "^1.15.0",
49
+ "@atlaskit/primitives": "^1.16.0",
50
50
  "@atlaskit/select": "^17.0.3",
51
51
  "@atlaskit/spinner": "^16.0.0",
52
52
  "@atlaskit/textfield": "^6.0.0",
53
- "@atlaskit/tokens": "^1.32.0",
53
+ "@atlaskit/tokens": "^1.33.0",
54
54
  "@babel/runtime": "^7.0.0",
55
55
  "@emotion/react": "^11.7.1",
56
56
  "debounce-promise": "^3.1.2",
@@ -128,6 +128,9 @@
128
128
  },
129
129
  "platform.linking-platform.link-create.tmp-fix-translations": {
130
130
  "type": "boolean"
131
+ },
132
+ "platform.linking-platform.link-create.slo-ignore-failed-fetch": {
133
+ "type": "boolean"
131
134
  }
132
135
  }
133
136
  }