Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
74 changes: 74 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
<!--
Hey! Thanks for submitting a pull request. Please use this template for all PRs.

*** Please format the title of your PR using the following style: ***

TEMPLATE TITLE: <type>(<scope>): <subject>
Example title: feat(ui): Add "NEW" button to map screen

<type> can be one of:
feat – new feature
fix – bug fix
docs – documentation only
style – formatting, whitespace, missing semicolons
refactor – code change that neither fixes a bug nor adds a feature
perf – performance improvement
test – adding or correcting tests
chore – maintenance (build scripts, dependencies, CI)
<scope> can be one of:
Flutter side: ui, widget, screen, map, bus, route, notif, firebase
Backend side: api, service, db, ci, or specific module (raptor, docu, notif, etc.)
Shared: auth
<subject> is the subject of your PR, e.g. "Add 'NEW' button to map screen"

For more info, please see the Contribution Guide:
https://github.com/mbusdev/maizebus-markdown-docs/blob/main/contribution-guide.md

-->

## Description
(1-2 sentences: what changed and why — e.g., "Added Firebase push notifications for real-time bus arrivals")

## Type of Change
- [ ] New feature (`feat`)
- [ ] Bug fix (`fix`)
- [ ] Refactor / code improvement
- [ ] Dependency / build update
- [ ] Documentation
- [ ] Other (explain)

## Changed Files
(Please list *all* files you changed, each with a description of what you changed and why.)
*Tip: see a list of everything you changed on the "Files changed" tab*

Example:
* `map_screen.dart`
* Added "New" button to top toolbar
* `bluebus_api.dart`
* Added try/catch statements to `fetchRoutes()` for better reliability

## Related Issues
Closes #XX, Prereq of #XX, etc.

## Does your code rely on another PR
(attach PR number here)

## Testing Done
**Flutter:**
- [ ] Tested on:
- [ ] iOS Simulator
- [ ] Android Emulator
- [ ] Physical device
**Vitest:**
- [ ] existing test(s) with coverage: (which tests?)
- [ ] new tests added: (describe)

## Screenshots / Demo (if UI or notification change)
<!-- Drag & drop images or screen recordings here -->

## Checklist
- [ ] Commit messages follow Conventional Commits
- [ ] PR title follows `<type>(scope): short description`
- [ ] PR target branch is not `main` and is our current working update branch (e.g. `maizebus2.1`, `dev`)
- [ ] No `print()` / `debugPrint()` / `console.log()` left in production code
- [ ] Secrets / keys not committed
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"type": "module",
"main": "src/app.ts",
"scripts": {
"start": "tsx src/app.ts",
"start": "tsx --env-file=.env --experimental-loader=@opentelemetry/instrumentation/hook.mjs --import src/services/observability.ts src/app.ts",
"test": "vitest run test",
"stress-test": "vitest run test/search-stress.test.ts",
"docs": "typedoc --entryPointStrategy expand ./src --exclude \"**/legacy/**\""
Expand All @@ -14,6 +14,8 @@
"license": "ISC",
"dependencies": {
"@datastructures-js/priority-queue": "^6.3.3",
"@hyperdx/node-opentelemetry": "^0.11.0",
"@opentelemetry/host-metrics": "^0.40.0",
"axios": "^1.7.2",
"dotenv": "^16.4.5",
"express": "^4.19.2",
Expand Down
26 changes: 26 additions & 0 deletions src/services/observability.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import * as HyperDX from '@hyperdx/node-opentelemetry';
import { HostMetrics } from '@opentelemetry/host-metrics';
import { metrics } from '@opentelemetry/api'

// dotenv is NOT used because the otlp endpoint var needs to already be set to work properly
const otelKey = process.env.OTEL_KEY;
const otelExporterOtlpEndpoint = process.env.OTEL_EXPORTER_OTLP_ENDPOINT;
const serviceName = process.env.SERVICE_NAME ?? 'local/mbus-backend-dev';

if (otelKey && otelExporterOtlpEndpoint) {
// must be before any meters are created
HyperDX.initSDK({
apiKey: otelKey,
service: serviceName,
experimentalExceptionCapture: true,
});

new HostMetrics({
meterProvider: metrics.getMeterProvider(),
}).start();

console.log('otel initialized as ' + serviceName);
} else {
console.log('otel is off, make sure key and endpoint are set');
}

2 changes: 0 additions & 2 deletions src/services/reminder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ import { applicationDefault, initializeApp } from "firebase-admin/app";
import * as state from "@/state/transitState";
import { BaseEvent, DelayEvent, eventsEqual, toKey, Key, RegistrationToken, ThresholdEvent, fromKey, delayEvent, thresholdEvent } from "./reminderTypes";

export * from "./reminderTypes";

dotenv.config()

// Initialize Firebase
Expand Down
Loading