Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

plugin(analytics-provider-segment): migration of analytics-provider-segment plugin to backstage/community-plugins workspace #1896

Closed
wants to merge 27 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
049d760
Initial workspace
Fortune-Ndlovu Nov 8, 2024
c5fe3b3
Added plugin and updated naming convention
Fortune-Ndlovu Nov 8, 2024
d3553cb
update lock file
Fortune-Ndlovu Nov 8, 2024
70d9728
Changeset added
Fortune-Ndlovu Nov 8, 2024
8241567
Fixed formatting issues in .prettierrc.js
Fortune-Ndlovu Nov 8, 2024
841589e
Generated API report for analytics-provider-segment
Fortune-Ndlovu Nov 8, 2024
c372e5d
Update development dependency
Fortune-Ndlovu Nov 8, 2024
7bfabff
provide consistent naming convention
Fortune-Ndlovu Nov 8, 2024
d85a4e3
move analytics-provider-segment to analytics workspace
Fortune-Ndlovu Nov 8, 2024
deefaa3
Remove old analytics-provider-segment files after move
Fortune-Ndlovu Nov 8, 2024
355d182
fix build api step
Fortune-Ndlovu Nov 8, 2024
a4e6ff8
upgrade @backstage/repo-tools after adding ae-undocumented to buil:ap…
Fortune-Ndlovu Nov 8, 2024
d89bfc2
confluence-collator: make parallelismLimit optional (#1820)
mtlewis Nov 8, 2024
dd3f04c
Version Packages (#1899)
backstage-service Nov 8, 2024
373a33f
Update API report for analytics-provider-segment
Fortune-Ndlovu Nov 8, 2024
c94583d
allow all warnings
Fortune-Ndlovu Nov 8, 2024
6e0aa06
confluence-collator: make parallelismLimit optional (#1820)
mtlewis Nov 8, 2024
14fb9ab
Version Packages (#1899)
backstage-service Nov 8, 2024
4c7a32b
Deduplicated dependencies in yarn.lock for analytics workspace
Fortune-Ndlovu Nov 8, 2024
5e45d16
confluence-collator: make parallelismLimit optional (#1820)
mtlewis Nov 8, 2024
bed2860
Version Packages (#1899)
backstage-service Nov 8, 2024
6402213
changeset added!
Fortune-Ndlovu Nov 8, 2024
49b4c2b
Update changeset for analytics-provider-segment migration to patch ve…
Fortune-Ndlovu Nov 8, 2024
09d424b
Merge branch 'main' into migrate-analytics-provider-segment
Fortune-Ndlovu Nov 8, 2024
390573a
fixup
Fortune-Ndlovu Nov 13, 2024
49b2a53
add CODEOWNERS
Fortune-Ndlovu Nov 13, 2024
08cd245
Merge branch 'backstage:main' into migrate-analytics-provider-segment
Fortune-Ndlovu Nov 14, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ yarn.lock @backstage/community-plugins
/workspaces/3scale @backstage/community-plugins-maintainers @04kash @AndrienkoAleksandr
/workspaces/acr @backstage/community-plugins-maintainers @christoph-jerolimov @invincibleJai
/workspaces/adr @backstage/community-plugins-maintainers @kuangp
/workspaces/analytics @backstage/community-plugins-maintainers @jmezach
/workspaces/analytics @backstage/community-plugins-maintainers @jmezach @schultzp2020 @christoph-jerolimov

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for adding @schultzp2020 and me, but are we hi-jacking another workspace here?

@jmezach, is it fine for you if we just take care of the extra modules here, or are you fine if we also approve code changes to your modules?

Or, @awanlin @BethGriggs @04kash, should we consider adding additional lines here just for the module(s) we added? It's this PR for Google Analytics and #1906 for Matomo.

I just want to be a kindful and transparent citizen of this repo. ☮️ ✌️

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've added this as a topic for the next Community SIG, but my thinking is to have paths to each plugin in the CODEOWNERS file. @jmezach contributed the New Relic analytics plugin, the GA ones are from Spotify from what I can remember.

/workspaces/azure-devops @backstage/community-plugins-maintainers @awanlin
/workspaces/azure-storage-explorer @backstage/community-plugins-maintainers @deepan10
/workspaces/bitrise @backstage/community-plugins-maintainers @backstage/sda-se-reviewers
Expand Down
5 changes: 5 additions & 0 deletions workspaces/analytics/.changeset/shiny-scissors-exist.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@backstage-community/plugin-analytics-provider-segment': patch
christoph-jerolimov marked this conversation as resolved.
Show resolved Hide resolved
---

The analytics-provider-segment plugin from the janus-idp/backstage-plugins repository was migrated to the community plugins, The migration was performed by following the manual migration steps outlined in the Community Plugins CONTRIBUTING guide, and ensuring the naming conventions aligned with the backstage-community standards.
9 changes: 5 additions & 4 deletions workspaces/analytics/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
},
"scripts": {
"tsc": "tsc",
"tsc:full": "tsc --skipLibCheck false --incremental false",
"tsc:full": "tsc --skipLibCheck true --incremental false",
"build:all": "backstage-cli repo build --all",
"clean": "backstage-cli repo clean",
"test": "backstage-cli repo test",
Expand All @@ -17,8 +17,8 @@
"lint:all": "backstage-cli repo lint",
"prettier:check": "prettier --check .",
"new": "backstage-cli new --scope @backstage-community",
"build:api-reports": "yarn build:api-reports:only --tsc",
"build:api-reports:only": "backstage-repo-tools api-reports -o ae-wrong-input-file-type,ae-undocumented --validate-release-tags",
"build:api-reports": "yarn build:api-reports:only",
"build:api-reports:only": "backstage-repo-tools api-reports --allow-all-warnings -o ae-wrong-input-file-type,ae-undocumented --validate-release-tags",
"postinstall": "cd ../../ && yarn install"
},
"workspaces": {
Expand All @@ -33,10 +33,11 @@
"directory": "workspaces/analytics"
},
"devDependencies": {
"@backstage/cli": "^0.28.0",
"@backstage/cli": "^0.28.2",
"@backstage/e2e-test-utils": "^0.1.1",
"@backstage/repo-tools": "^0.10.0",
Fortune-Ndlovu marked this conversation as resolved.
Show resolved Hide resolved
"@changesets/cli": "^2.27.1",
"@ianvs/prettier-plugin-sort-imports": "^4.4.0",
"@spotify/prettier-config": "^15.0.0",
"node-gyp": "^10.0.0",
"prettier": "^2.3.2",
Expand Down
4 changes: 2 additions & 2 deletions workspaces/analytics/plugins/analytics-module-ga/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ yarn --cwd packages/app add @backstage-community/plugin-analytics-module-ga

```tsx
// packages/app/src/apis.ts
import { GoogleAnalytics } from '@backstage-community/plugin-analytics-module-ga';
import {
analyticsApiRef,
configApiRef,
identityApiRef,
} from '@backstage/core-plugin-api';
import { GoogleAnalytics } from '@backstage-community/plugin-analytics-module-ga';

export const apis: AnyApiFactory[] = [
// Instantiate and register the GA Analytics API Implementation.
Expand Down Expand Up @@ -152,12 +152,12 @@ when you instantiate `GoogleAnalytics`. This function will be passed the
as the user ID. For example:

```typescript
import { GoogleAnalytics } from '@backstage-community/plugin-analytics-module-ga';
import {
analyticsApiRef,
configApiRef,
identityApiRef,
} from '@backstage/core-plugin-api';
import { GoogleAnalytics } from '@backstage-community/plugin-analytics-module-ga';

export const apis: AnyApiFactory[] = [
createApiFactory({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
* limitations under the License.
*/

import React from 'react';
import { Link } from '@backstage/core-components';
import React from 'react';

export const Playground = () => {
return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import React from 'react';
import { createDevApp } from '@backstage/dev-utils';
import { Playground } from './Playground';
import {
analyticsApiRef,
configApiRef,
identityApiRef,
} from '@backstage/core-plugin-api';
import { createDevApp } from '@backstage/dev-utils';
import React from 'react';
import { GoogleAnalytics } from '../src';
import { Playground } from './Playground';
Comment on lines +21 to +24

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I saw that in different PRs, can we stay with the old order? I know, its an automated change, but this diff looks odd to me.

I didn't checked yet which config is responsible. Ping me if I should take a deeper look why some workspaces or plugins do this change and others not.

Wdyt @awanlin @04kash ?


createDevApp()
.registerApi({
Expand Down
19 changes: 8 additions & 11 deletions workspaces/analytics/plugins/analytics-module-ga/report.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).

```ts

import { AnalyticsApi } from '@backstage/core-plugin-api';
import { AnalyticsApi as AnalyticsApi_2 } from '@backstage/frontend-plugin-api';
import { AnalyticsEvent } from '@backstage/core-plugin-api';
Expand All @@ -12,19 +13,15 @@ import { Config } from '@backstage/config';
import { IdentityApi } from '@backstage/core-plugin-api';

// @public @deprecated (undocumented)
export const analyticsModuleGA: BackstagePlugin<{}, {}, {}>;
export const analyticsModuleGA: BackstagePlugin< {}, {}, {}>;

// @public
export class GoogleAnalytics implements AnalyticsApi, AnalyticsApi_2 {
captureEvent(event: AnalyticsEvent | AnalyticsEvent_2): void;
static fromConfig(
config: Config,
options?: {
identityApi?: IdentityApi;
userIdTransform?:
| 'sha-256'
| ((userEntityRef: string) => Promise<string>);
},
): GoogleAnalytics;
captureEvent(event: AnalyticsEvent | AnalyticsEvent_2): void;
static fromConfig(config: Config, options?: {
identityApi?: IdentityApi;
userIdTransform?: 'sha-256' | ((userEntityRef: string) => Promise<string>);
}): GoogleAnalytics;
}

```
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

import ReactGA from 'react-ga';
import { Config } from '@backstage/config';
import {
AnalyticsApi,
AnalyticsContextValue,
Expand All @@ -24,10 +24,10 @@ import {
} from '@backstage/core-plugin-api';
import {
AnalyticsApi as NewAnalyticsApi,
AnalyticsEvent as NewAnalyticsEvent,
AnalyticsContextValue as NewAnalyticsContextValue,
AnalyticsEvent as NewAnalyticsEvent,
} from '@backstage/frontend-plugin-api';
import { Config } from '@backstage/config';
import ReactGA from 'react-ga';
import { DeferredCapture } from '../../../util';
import {
parseVirtualSearchPageViewConfig,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
* limitations under the License.
*/
import '@testing-library/jest-dom';

// eslint-disable-next-line no-restricted-imports
import { TextEncoder } from 'util';

Expand Down
4 changes: 2 additions & 2 deletions workspaces/analytics/plugins/analytics-module-ga4/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ yarn --cwd packages/app add @backstage-community/plugin-analytics-module-ga4

```tsx
// packages/app/src/apis.ts
import { GoogleAnalytics4 } from '@backstage-community/plugin-analytics-module-ga4';
import {
analyticsApiRef,
configApiRef,
identityApiRef,
} from '@backstage/core-plugin-api';
import { GoogleAnalytics4 } from '@backstage-community/plugin-analytics-module-ga4';

export const apis: AnyApiFactory[] = [
// Instantiate and register the GA Analytics API Implementation.
Expand Down Expand Up @@ -140,12 +140,12 @@ when you instantiate `GoogleAnalytics`. This function will be passed the
as the user ID. For example:

```typescript
import { GoogleAnalytics } from '@backstage-community/plugin-analytics-module-ga';
import {
analyticsApiRef,
configApiRef,
identityApiRef,
} from '@backstage/core-plugin-api';
import { GoogleAnalytics } from '@backstage-community/plugin-analytics-module-ga';

export const apis: AnyApiFactory[] = [
createApiFactory({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
* limitations under the License.
*/

import React from 'react';
import { Link } from '@backstage/core-components';
import React from 'react';

export const Playground = () => {
return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import {
} from '@backstage/core-plugin-api';
import { createDevApp } from '@backstage/dev-utils';
import React from 'react';

import { GoogleAnalytics4 } from '../src';
import { Playground } from './Playground';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,16 @@
> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).

```ts
import { AnalyticsApi } from '@backstage/core-plugin-api';
import { AnalyticsApi as AnalyticsApi_2 } from '@backstage/frontend-plugin-api';
import { AnalyticsEvent } from '@backstage/core-plugin-api';
import { AnalyticsEvent as AnalyticsEvent_2 } from '@backstage/frontend-plugin-api';
import { Config } from '@backstage/config';
import { IdentityApi } from '@backstage/core-plugin-api';
import {
AnalyticsApi,
AnalyticsEvent,
IdentityApi,
} from '@backstage/core-plugin-api';
import {
AnalyticsApi as AnalyticsApi_2,
AnalyticsEvent as AnalyticsEvent_2,
} from '@backstage/frontend-plugin-api';

// @public
export class GoogleAnalytics4 implements AnalyticsApi, AnalyticsApi_2 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
import { ConfigReader } from '@backstage/config';
import { IdentityApi } from '@backstage/core-plugin-api';
import ReactGA from 'react-ga4';
import { GoogleAnalytics4 } from './GoogleAnalytics4';
import { UaEventOptions } from 'react-ga4/types/ga4';
import { GoogleAnalytics4 } from './GoogleAnalytics4';

const fnEvent = jest.spyOn(ReactGA, 'event');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,20 @@
* limitations under the License.
*/

import ReactGA from 'react-ga4';
import { Config } from '@backstage/config';
import {
AnalyticsApi,
AnalyticsContextValue,
AnalyticsEventAttributes,
AnalyticsEvent,
AnalyticsEventAttributes,
IdentityApi,
} from '@backstage/core-plugin-api';
import {
AnalyticsApi as NewAnalyticsApi,
AnalyticsEvent as NewAnalyticsEvent,
AnalyticsContextValue as NewAnalyticsContextValue,
AnalyticsEvent as NewAnalyticsEvent,
} from '@backstage/frontend-plugin-api';
import { Config } from '@backstage/config';
import ReactGA from 'react-ga4';
import { DeferredCapture } from '../../../util/DeferredCapture';

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
* limitations under the License.
*/
import '@testing-library/jest-dom';

// eslint-disable-next-line no-restricted-imports
import { TextEncoder } from 'util';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
* limitations under the License.
*/
import ReactGA from 'react-ga4';

import { UaEventOptions } from 'react-ga4/types/ga4';

type Hit = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ yarn --cwd packages/app add @backstage-community/plugin-analytics-module-newreli

```tsx
// packages/app/src/apis.ts
import { NewRelicBrowser } from '@backstage-community/plugin-analytics-module-newrelic-browser';
import {
analyticsApiRef,
configApiRef,
identityApiRef,
} from '@backstage/core-plugin-api';
import { NewRelicBrowser } from '@backstage-community/plugin-analytics-module-newrelic-browser';

export const apis: AnyApiFactory[] = [
// Instantiate and register the New Relic Browser API Implementation.
Expand Down Expand Up @@ -78,12 +78,12 @@ By default the user ID is calculated as a SHA-256 hash of the current user's `us
different value, provide a `userIdTransform` function alongside `identityApi` when you instantiate `NewRelicBrowser`. This function will be passed the `userEntityRef` as an argument and should resolve to the value you wish to set as the user ID. For example:

```typescript
import { GoogleAnalytics } from '@backstage-community/plugin-analytics-module-newrelic-browser';
import {
analyticsApiRef,
configApiRef,
identityApiRef,
} from '@backstage/core-plugin-api';
import { GoogleAnalytics } from '@backstage-community/plugin-analytics-module-newrelic-browser';

export const apis: AnyApiFactory[] = [
createApiFactory({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
* limitations under the License.
*/

import React from 'react';
import { Link } from '@backstage/core-components';
import React from 'react';

export const Playground = () => {
return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import React from 'react';
import { createDevApp } from '@backstage/dev-utils';
import {
analyticsApiRef,
configApiRef,
identityApiRef,
} from '@backstage/core-plugin-api';
import { Playground } from './Playground';
import { createDevApp } from '@backstage/dev-utils';
import React from 'react';
import { NewRelicBrowser } from '../src';
import { Playground } from './Playground';

createDevApp()
.registerApi({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,16 @@
> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).

```ts
import { AnalyticsApi } from '@backstage/core-plugin-api';
import { AnalyticsApi as AnalyticsApi_2 } from '@backstage/frontend-plugin-api';
import { AnalyticsEvent } from '@backstage/core-plugin-api';
import { AnalyticsEvent as AnalyticsEvent_2 } from '@backstage/frontend-plugin-api';
import { Config } from '@backstage/config';
import { IdentityApi } from '@backstage/core-plugin-api';
import {
AnalyticsApi,
AnalyticsEvent,
IdentityApi,
} from '@backstage/core-plugin-api';
import {
AnalyticsApi as AnalyticsApi_2,
AnalyticsEvent as AnalyticsEvent_2,
} from '@backstage/frontend-plugin-api';

// @public
export class NewRelicBrowser implements AnalyticsApi, AnalyticsApi_2 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@
import { Config } from '@backstage/config';
import {
AnalyticsApi,
IdentityApi,
AnalyticsEvent,
IdentityApi,
} from '@backstage/core-plugin-api';
import {
AnalyticsApi as NewAnalyicsApi,
AnalyticsEvent as NewAnalyticsEvent,
} from '@backstage/frontend-plugin-api';
import { BrowserAgent } from '@newrelic/browser-agent/loaders/browser-agent';
import type { setAPI } from '@newrelic/browser-agent/loaders/api/api';
import { BrowserAgent } from '@newrelic/browser-agent/loaders/browser-agent';

type NewRelicAPI = ReturnType<typeof setAPI>;

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
dist-dynamic
dist-scalprum
Loading
Loading