Skip to content

Commit

Permalink
Add type for observability manager (#131)
Browse files Browse the repository at this point in the history
  • Loading branch information
kibertoad authored May 6, 2024
1 parent 1a3801a commit 18cc793
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 8 deletions.
2 changes: 2 additions & 0 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,3 +97,5 @@ export {
} from './src/errors/publicErrors'

export { waitAndRetry } from './src/utils/waitUtils'

export * from './src/observability/observabilityTypes'
16 changes: 8 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,21 +37,21 @@
"dot-prop": "6.0.1",
"pino": "^9.0.0",
"tslib": "^2.6.2",
"undici": "^6.14.1",
"undici": "^6.15.0",
"undici-retry": "^5.0.3",
"zod": "^3.22.4"
"zod": "^3.23.6"
},
"devDependencies": {
"@types/node": "^20.11.30",
"@typescript-eslint/eslint-plugin": "^7.3.1",
"@typescript-eslint/parser": "^7.3.1",
"@vitest/coverage-v8": "1.5.3",
"@types/node": "^20.12.8",
"@typescript-eslint/eslint-plugin": "^7.8.0",
"@typescript-eslint/parser": "^7.8.0",
"@vitest/coverage-v8": "1.6.0",
"auto-changelog": "^2.4.0",
"eslint": "^8.57.0",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-vitest": "0.4.1",
"prettier": "^3.2.5",
"typescript": "^5.4.3",
"vitest": "1.5.3"
"typescript": "^5.4.5",
"vitest": "1.6.0"
}
}
28 changes: 28 additions & 0 deletions src/observability/observabilityTypes.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
export type TransactionObservabilityManager = {
/**
* Creates and starts a background transaction to record work done
*
* @param transactionName - used for grouping similar transactions together
* @param uniqueTransactionKey - used for identifying specific ongoing transaction. Must be reasonably unique to reduce possibility of collisions
*/
start: (transactionName: string, uniqueTransactionKey: string) => unknown

/**
* Creates and starts a background transaction to record work done, and relates it to a specified group
*
* @param transactionName - used for grouping similar transactions together
* @param uniqueTransactionKey - used for identifying specific ongoing transaction. Must be reasonably unique to reduce possibility of collisions *
* @param transactionGroup - group is used for grouping related transactions with different names
*/
startWithGroup: (
transactionName: string,
uniqueTransactionKey: string,
transactionGroup: string,
) => void

/**
* Ends the transaction
* @param uniqueTransactionKey - used for identifying specific ongoing transaction. Must be reasonably unique to reduce possibility of collisions
*/
stop: (uniqueTransactionKey: string) => unknown
}

0 comments on commit 18cc793

Please sign in to comment.