@platformatic/telemetry 1.45.1 → 1.47.0

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.
Files changed (2) hide show
  1. package/lib/telemetry.js +11 -5
  2. package/package.json +2 -2
package/lib/telemetry.js CHANGED
@@ -97,15 +97,15 @@ const setupProvider = (app, opts) => {
97
97
  const exporterObjs = []
98
98
  const spanProcessors = []
99
99
  for (const exporter of exporters) {
100
- // Exporter config:
101
- // https://open-telemetry.github.io/opentelemetry-js/interfaces/_opentelemetry_exporter_zipkin.ExporterConfig.html
100
+ // Exporter config:
101
+ // https://open-telemetry.github.io/opentelemetry-js/interfaces/_opentelemetry_exporter_zipkin.ExporterConfig.html
102
102
  const exporterOptions = { ...exporter.options, serviceName }
103
103
 
104
104
  let exporterObj
105
105
  if (exporter.type === 'console') {
106
106
  exporterObj = new ConsoleSpanExporter(exporterOptions)
107
107
  } else if (exporter.type === 'otlp') {
108
- // We require here because this require (and only the require!) creates some issue with c8 on some mjs tests on other modules. Since we need an assignemet here, we don't use a switch.
108
+ // We require here because this require (and only the require!) creates some issue with c8 on some mjs tests on other modules. Since we need an assignemet here, we don't use a switch.
109
109
  const { OTLPTraceExporter } = require('@opentelemetry/exporter-trace-otlp-proto')
110
110
  exporterObj = new OTLPTraceExporter(exporterOptions)
111
111
  } else if (exporter.type === 'zipkin') {
@@ -229,7 +229,12 @@ async function setupTelemetry (app, opts) {
229
229
 
230
230
  /* istanbul ignore next */
231
231
  method = method || ''
232
- const name = `${method} ${urlObj.scheme}://${urlObj.host}:${urlObj.port}${urlObj.path}`
232
+ let name
233
+ if (urlObj.port) {
234
+ name = `${method} ${urlObj.scheme}://${urlObj.host}:${urlObj.port}${urlObj.path}`
235
+ } else {
236
+ name = `${method} ${urlObj.scheme}://${urlObj.host}${urlObj.path}`
237
+ }
233
238
 
234
239
  const span = tracer.startSpan(name, {}, context)
235
240
  span.kind = SpanKind.CLIENT
@@ -241,7 +246,8 @@ async function setupTelemetry (app, opts) {
241
246
  'server.port': urlObj.port,
242
247
  'http.request.method': method,
243
248
  'url.full': url,
244
- 'url.path': urlObj.path
249
+ 'url.path': urlObj.path,
250
+ 'url.scheme': urlObj.scheme
245
251
  }
246
252
  : {}
247
253
  span.setAttributes(attributes)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@platformatic/telemetry",
3
- "version": "1.45.1",
3
+ "version": "1.47.0",
4
4
  "description": "OpenTelemetry integration for Platformatic",
5
5
  "main": "index.js",
6
6
  "author": "Marco Piraccini <marco.piraccini@gmail.com>",
@@ -10,7 +10,7 @@
10
10
  },
11
11
  "license": "Apache-2.0",
12
12
  "devDependencies": {
13
- "borp": "^0.14.0",
13
+ "borp": "^0.15.0",
14
14
  "fastify": "^4.26.2",
15
15
  "snazzy": "^9.0.0",
16
16
  "standard": "^17.1.0"