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

[telemetry example] initial import #6116

Merged
merged 7 commits into from
Sep 14, 2023
Merged

[telemetry example] initial import #6116

merged 7 commits into from
Sep 14, 2023

Conversation

kneth
Copy link
Contributor

@kneth kneth commented Sep 1, 2023

What, How & Why?

This closes #5823

☑️ ToDos

  • 📝 Changelog entry
  • 📝 Compatibility label is updated or copied from previous entry
  • 📝 Update COMPATIBILITY.md
  • 🚦 Tests
  • 📦 Updated internal package version in consuming package.jsons (if updating internal packages)
  • 📱 Check the React Native/other sample apps work if necessary
  • 💥 Breaking label has been applied or is not necessary

@cla-bot cla-bot bot added the cla: yes label Sep 1, 2023
@kneth kneth self-assigned this Sep 1, 2023
Copy link
Contributor

@otso otso left a comment

Choose a reason for hiding this comment

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

LGTM!

@otso
Copy link
Contributor

otso commented Sep 7, 2023

@kneth one comment - having an exported Analytics.charts file as in the .NET example would be great as you would be able to visualise the data immediately.

Copy link
Contributor

@takameyer takameyer left a comment

Choose a reason for hiding this comment

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

Just a few considerations

examples/example-node-telemetry/README.md Outdated Show resolved Hide resolved
examples/example-node-telemetry/README.md Outdated Show resolved Hide resolved
examples/example-node-telemetry/src/app.ts Outdated Show resolved Hide resolved
examples/example-node-telemetry/README.md Outdated Show resolved Hide resolved
examples/example-node-telemetry/README.md Outdated Show resolved Hide resolved
examples/example-node-telemetry/README.md Outdated Show resolved Hide resolved
Copy link
Contributor

@elle-j elle-j left a comment

Choose a reason for hiding this comment

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

Here comes the first batch of comments (only got the README left to review). Looks good!

P.S. could we remove the example- prefix from the directory? (So that it aligns with the updated examples discussed on Slack.) So instead of examples/example-node-telemetry we could go with examples/node-telemetry.

examples/example-node-telemetry/package.json Outdated Show resolved Hide resolved
examples/example-node-telemetry/src/app.ts Outdated Show resolved Hide resolved
examples/example-node-telemetry/src/app.ts Outdated Show resolved Hide resolved
examples/example-node-telemetry/src/app.ts Outdated Show resolved Hide resolved
examples/example-node-telemetry/src/app.ts Outdated Show resolved Hide resolved
examples/example-node-telemetry/tsconfig.build.json Outdated Show resolved Hide resolved
examples/example-node-telemetry/tsconfig.json Outdated Show resolved Hide resolved
examples/example-node-telemetry/src/app.ts Outdated Show resolved Hide resolved
examples/example-node-telemetry/package.json Outdated Show resolved Hide resolved
examples/example-node-telemetry/package.json Outdated Show resolved Hide resolved
Copy link
Contributor

@elle-j elle-j left a comment

Choose a reason for hiding this comment

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

Here's the remainder of the review. Provided some updates and suggestions for the README 🙂

examples/example-node-telemetry/README.md Outdated Show resolved Hide resolved
examples/example-node-telemetry/README.md Outdated Show resolved Hide resolved
examples/example-node-telemetry/README.md Outdated Show resolved Hide resolved
examples/example-node-telemetry/README.md Outdated Show resolved Hide resolved
examples/example-node-telemetry/README.md Outdated Show resolved Hide resolved
examples/example-node-telemetry/README.md Outdated Show resolved Hide resolved
examples/example-node-telemetry/README.md Outdated Show resolved Hide resolved
Comment on lines 82 to 133
## How to build and run

You need to clone Realm JavaScript's git repository:

```sh
git clone https://github.com/realm/realm-js
cd realm-js
git submodule update --init --recursive
```

Moreover, you need to install the dependencies for this app:

```sh
cd examples/example-node-telemetry
npm install
```

Before building the app, you need to add your app id to `src/config.ts`. After that, you can build and run the app:

```sh
npm run build
node dist/app.js
```
Copy link
Contributor

@elle-j elle-j Sep 12, 2023

Choose a reason for hiding this comment

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

One improvement I think we could do here to provide a better DX is to let the example be independent of our repo. So e.g. having the README speak from the perspective of this example directory as the root. (Since realm is defined in the package.json, they shouldn't need our repo.)

I think the lines I marked here could be replaced with the following if you agree (ps. temporarily placing \ in front of code blocks otherwise I can't show it in one code block here):

### Install Dependencies

\```sh
npm install
\```

### Run the App

1. [Copy your Atlas App ID](https://www.mongodb.com/docs/atlas/app-services/reference/find-your-project-or-app-id/#std-label-find-your-app-id) from the App Services UI.
2. Paste the copied ID as the value of the existing variable `ATLAS_APP_ID` in [src/atlas-app-services/config.ts](./src/atlas-app-services/config.ts):
\```ts
export const ATLAS_APP_ID = "YOUR_APP_ID";
\```

3. Start the app

\```sh
npm run build
npm start
\```

Notes:

  • The mention of ATLAS_APP_ID assumes a refactor of the code, but you can always change it along with the link if you decide not to refactor 👍
  • The code shown under Start the app assumes that a start script has been added in package.json (I left a previous alternative where the start script also calls the build script. If so, you could just show npm start).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah seems related 🙂 I believe the example runs fine without the git submodule update. Also if you e.g. copy the example directory to outside the js repo, it should run fine.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

True. And as @takameyer is saying, we should find a way to make the example easily accessible.

Copy link
Contributor

Choose a reason for hiding this comment

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

If we just don't add this to the workspaces, then it will treat itself like a separate project within realm-js. Currently it is not in workspaces, so I guess the git submodule update isn't even a necessary step here. It would just download the realm package into the local node_modules

Copy link
Contributor

Choose a reason for hiding this comment

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

Also, we should know as a team that if we want to test these examples against the local version of realm, this could be done by adding the example to the workspaces. The only issue would be with the React Native projects, as these require a bit of configuration changes to work within the mono-repo.

Comment on lines 12 to 13
│ │ ├── machine_info.ts
│ │ └── sensor_reading.ts
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
│ │ ├── machine_info.ts
│ │ └── sensor_reading.ts
│ │ ├── MachineInfo.ts
│ │ └── SensorReading.ts

@kneth kneth merged commit c63f804 into main Sep 14, 2023
23 of 27 checks passed
@kneth kneth deleted the kneth/example/telemetry branch September 14, 2023 11:40
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 15, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Example in Node: Analytics/Telemetrics data
4 participants