Skip to content

Commit 9187726

Browse files
committed
feat: exposed api initial draft
1 parent 015785e commit 9187726

File tree

2 files changed

+30
-1
lines changed

2 files changed

+30
-1
lines changed

src/apm-base.js

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,34 @@ class ApmBase {
7676
}
7777
}
7878

79+
startTransaction (name, type) {
80+
if (this.isEnabled()) {
81+
var transactionService = this.serviceFactory.getService('TransactionService')
82+
return transactionService.startTransaction(name, type)
83+
}
84+
}
85+
86+
startSpan (name, type) {
87+
if (this.isEnabled()) {
88+
var transactionService = this.serviceFactory.getService('TransactionService')
89+
return transactionService.startSpan(name, type)
90+
}
91+
}
92+
93+
getCurrentTransaction () {
94+
if (this.isEnabled()) {
95+
var transactionService = this.serviceFactory.getService('TransactionService')
96+
return transactionService.getCurrentTransaction()
97+
}
98+
}
99+
100+
getTransactionService () {
101+
if (this.isEnabled()) {
102+
var transactionService = this.serviceFactory.getService('TransactionService')
103+
return transactionService
104+
}
105+
}
106+
79107
captureError (error) {
80108
if (this.isEnabled()) {
81109
var errorLogging = this.serviceFactory.getService('ErrorLogging')

src/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ var exports = {
1717
default: apmBase.init.bind(apmBase),
1818
init: apmBase.init.bind(apmBase),
1919
ApmBase: ApmBase,
20-
apmBase: apmBase
20+
apmBase: apmBase,
21+
apm: apmBase
2122
}
2223

2324
module.exports = exports

0 commit comments

Comments
 (0)