@platformatic/basic 2.0.0-alpha.16 → 2.0.0-alpha.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/base.js CHANGED
@@ -20,6 +20,7 @@ export class BaseStackable {
20
20
  this.type = type
21
21
  this.version = version
22
22
  this.id = options.context.serviceId
23
+ this.telemetryConfig = options.context.telemetryConfig
23
24
  this.options = options
24
25
  this.root = root
25
26
  this.configManager = configManager
@@ -180,7 +181,6 @@ export class BaseStackable {
180
181
  async startWithCommand (command, loader) {
181
182
  const config = this.configManager.current
182
183
  const basePath = config.application?.basePath ? cleanBasePath(config.application?.basePath) : ''
183
-
184
184
  this.#childManager = new ChildManager({
185
185
  logger: this.logger,
186
186
  loader,
@@ -190,7 +190,8 @@ export class BaseStackable {
190
190
  root: pathToFileURL(this.root).toString(),
191
191
  basePath,
192
192
  logLevel: this.logger.level,
193
- port: (this.isEntrypoint ? this.serverConfig?.port || 0 : undefined) ?? true
193
+ port: (this.isEntrypoint ? this.serverConfig?.port || 0 : undefined) ?? true,
194
+ telemetry: this.telemetryConfig
194
195
  }
195
196
  })
196
197
 
@@ -13,6 +13,7 @@ import { WebSocket } from 'ws'
13
13
  import { exitCodes } from '../errors.js'
14
14
  import { importFile } from '../utils.js'
15
15
  import { getSocketPath, isWindows } from './child-manager.js'
16
+ import { setupNodeHTTPTelemetry } from '@platformatic/telemetry'
16
17
 
17
18
  function createInterceptor (itc) {
18
19
  return function (dispatch) {
@@ -90,6 +91,7 @@ export class ChildProcess extends ITC {
90
91
 
91
92
  this.listen()
92
93
  this.#setupLogger()
94
+ this.#setupTelemetry()
93
95
  this.#setupHandlers()
94
96
  this.#setupServer()
95
97
  this.#setupInterceptors()
@@ -164,6 +166,12 @@ export class ChildProcess extends ITC {
164
166
  }
165
167
  }
166
168
 
169
+ #setupTelemetry () {
170
+ if (globalThis.platformatic.telemetry) {
171
+ setupNodeHTTPTelemetry(globalThis.platformatic.telemetry, this.#logger)
172
+ }
173
+ }
174
+
167
175
  #setupServer () {
168
176
  const subscribers = {
169
177
  asyncStart ({ options }) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@platformatic/basic",
3
- "version": "2.0.0-alpha.16",
3
+ "version": "2.0.0-alpha.18",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -23,9 +23,10 @@
23
23
  "split2": "^4.2.0",
24
24
  "undici": "^6.19.5",
25
25
  "ws": "^8.18.0",
26
- "@platformatic/config": "2.0.0-alpha.16",
27
- "@platformatic/itc": "2.0.0-alpha.16",
28
- "@platformatic/utils": "2.0.0-alpha.16"
26
+ "@platformatic/config": "2.0.0-alpha.18",
27
+ "@platformatic/itc": "2.0.0-alpha.18",
28
+ "@platformatic/telemetry": "2.0.0-alpha.18",
29
+ "@platformatic/utils": "2.0.0-alpha.18"
29
30
  },
30
31
  "devDependencies": {
31
32
  "borp": "^0.17.0",
@@ -39,8 +40,8 @@
39
40
  "react-dom": "^18.3.1",
40
41
  "typescript": "^5.5.4",
41
42
  "vite": "^5.4.0",
42
- "@platformatic/composer": "2.0.0-alpha.16",
43
- "@platformatic/service": "2.0.0-alpha.16"
43
+ "@platformatic/composer": "2.0.0-alpha.18",
44
+ "@platformatic/service": "2.0.0-alpha.18"
44
45
  },
45
46
  "scripts": {
46
47
  "gen-schema": "node lib/schema.js > schema.json",
package/schema.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "$id": "https://schemas.platformatic.dev/@platformatic/basic/2.0.0-alpha.16.json",
2
+ "$id": "https://schemas.platformatic.dev/@platformatic/basic/2.0.0-alpha.18.json",
3
3
  "$schema": "http://json-schema.org/draft-07/schema#",
4
4
  "title": "Platformatic Stackable",
5
5
  "type": "object",