chore(otel-node): restore upstream gcp resource detector#1042
chore(otel-node): restore upstream gcp resource detector#1042david-luna wants to merge 10 commits into
Conversation
|
We still get the issue open-telemetry/opentelemetry-js-contrib#2320 the adding back the GCP resource detector. However there is a detail I might missed at the time of writing the issue. The issue happens if using cd examples
OTEL_TRACES_EXPORTER=console node --import ../packages/opentelemetry-node/import.mjs express-app.js
# output
{"name":"elastic-otel-node","level":30,"preamble":true,"distroVersion":"1.4.0","env":{"os":"darwin 24.6.0","arch":"arm64","runtime":"Node.js v18.19.0"},"config":{"logLevel":"info"},"msg":"start EDOT Node.js","time":"2025-10-07T11:06:05.267Z"}
{"name":"elastic-otel-node","level":40,"msg":"Unsupported OTLP metrics protocol: \"undefined\". Using http/protobuf.","time":"2025-10-07T11:06:05.275Z"}
listening at: { address: '127.0.0.1', family: 'IPv4', port: 3000 }but running with require you get the attempt of cd examples
OTEL_TRACES_EXPORTER=console node --require ../packages/opentelemetry-node/require.js express-app.js
# output
{"name":"elastic-otel-node","level":30,"preamble":true,"distroVersion":"1.4.0","env":{"os":"darwin 24.6.0","arch":"arm64","runtime":"Node.js v18.19.0"},"config":{"logLevel":"info"},"msg":"start EDOT Node.js","time":"2025-10-07T11:06:05.267Z"}
{"name":"elastic-otel-node","level":40,"msg":"Unsupported OTLP metrics protocol: \"undefined\". Using http/protobuf.","time":"2025-10-07T11:06:05.275Z"}
listening at: { address: '127.0.0.1', family: 'IPv4', port: 3000 }
{
resource: {
attributes: {
'host.name': 'moonlocal.local',
'host.arch': 'arm64',
'host.id': '7904601F-B9AB-5EB2-A389-E32C06D56851',
'os.type': 'darwin',
'os.version': '24.6.0',
'service.instance.id': '1d01558f-70b7-4faa-8938-937443c8bed2',
'process.pid': 68485,
'process.executable.name': 'node',
'process.executable.path': '/Users/david/.nvm/versions/node/v18.19.0/bin/node',
'process.command_args': [
'/Users/david/.nvm/versions/node/v18.19.0/bin/node',
'--require',
'../packages/opentelemetry-node/require.js',
'/Users/david/Documents/repos/el/elastic-otel-node/examples/express-app.js'
],
'process.runtime.version': '18.19.0',
'process.runtime.name': 'nodejs',
'process.runtime.description': 'Node.js',
'process.command': '/Users/david/Documents/repos/el/elastic-otel-node/examples/express-app.js',
'process.owner': 'david',
'telemetry.distro.name': 'elastic',
'telemetry.distro.version': '1.4.0',
'service.name': 'unknown_service:node',
'telemetry.sdk.language': 'nodejs',
'telemetry.sdk.name': 'opentelemetry',
'telemetry.sdk.version': '2.1.0'
}
},
instrumentationScope: {
name: '@opentelemetry/instrumentation-net',
version: '0.49.0',
schemaUrl: undefined
},
traceId: '82927f3441efd680a379e6c026a9e988',
parentSpanContext: {
traceId: '82927f3441efd680a379e6c026a9e988',
spanId: '9bbf48938364db37',
traceFlags: 1,
traceState: undefined
},
traceState: undefined,
name: 'tcp.connect',
id: 'ce18dc97c85b3e41',
kind: 0,
timestamp: 1759835165373000,
duration: 5556.541,
attributes: {
'net.transport': 'ip_tcp',
'net.peer.name': 'metadata.google.internal.',
'net.peer.port': 80
},
status: {
code: 2,
message: 'getaddrinfo ENOTFOUND metadata.google.internal.'
},
events: [],
links: []
}
{
resource: {
attributes: {
'host.name': 'moonlocal.local',
'host.arch': 'arm64',
'host.id': '7904601F-B9AB-5EB2-A389-E32C06D56851',
'os.type': 'darwin',
'os.version': '24.6.0',
'service.instance.id': '1d01558f-70b7-4faa-8938-937443c8bed2',
'process.pid': 68485,
'process.executable.name': 'node',
'process.executable.path': '/Users/david/.nvm/versions/node/v18.19.0/bin/node',
'process.command_args': [
'/Users/david/.nvm/versions/node/v18.19.0/bin/node',
'--require',
'../packages/opentelemetry-node/require.js',
'/Users/david/Documents/repos/el/elastic-otel-node/examples/express-app.js'
],
'process.runtime.version': '18.19.0',
'process.runtime.name': 'nodejs',
'process.runtime.description': 'Node.js',
'process.command': '/Users/david/Documents/repos/el/elastic-otel-node/examples/express-app.js',
'process.owner': 'david',
'telemetry.distro.name': 'elastic',
'telemetry.distro.version': '1.4.0',
'service.name': 'unknown_service:node',
'telemetry.sdk.language': 'nodejs',
'telemetry.sdk.name': 'opentelemetry',
'telemetry.sdk.version': '2.1.0'
}
},
instrumentationScope: {
name: '@opentelemetry/instrumentation-http',
version: '0.205.0',
schemaUrl: undefined
},
traceId: '82927f3441efd680a379e6c026a9e988',
parentSpanContext: undefined,
traceState: undefined,
name: 'GET',
id: '9bbf48938364db37',
kind: 2,
timestamp: 1759835165373000,
duration: 6252.167,
attributes: {
'http.request.method': 'GET',
'server.address': 'metadata.google.internal.',
'server.port': 80,
'url.full': 'http://metadata.google.internal./computeMetadata/v1/instance',
'error.type': 'Error'
},
status: {
code: 2,
message: 'getaddrinfo ENOTFOUND metadata.google.internal.'
},
events: [
{
name: 'exception',
attributes: {
'exception.type': 'ENOTFOUND',
'exception.message': 'getaddrinfo ENOTFOUND metadata.google.internal.',
'exception.stacktrace': 'Error: getaddrinfo ENOTFOUND metadata.google.internal.\n' +
' at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:107:26)\n' +
' at GetAddrInfoReqWrap.callbackTrampoline (node:internal/async_hooks:128:17)'
},
time: [ 1759835165, 379233834 ],
droppedAttributesCount: 0
}
],
links: []
}
{
resource: {
attributes: {
'host.name': 'moonlocal.local',
'host.arch': 'arm64',
'host.id': '7904601F-B9AB-5EB2-A389-E32C06D56851',
'os.type': 'darwin',
'os.version': '24.6.0',
'service.instance.id': '1d01558f-70b7-4faa-8938-937443c8bed2',
'process.pid': 68485,
'process.executable.name': 'node',
'process.executable.path': '/Users/david/.nvm/versions/node/v18.19.0/bin/node',
'process.command_args': [
'/Users/david/.nvm/versions/node/v18.19.0/bin/node',
'--require',
'../packages/opentelemetry-node/require.js',
'/Users/david/Documents/repos/el/elastic-otel-node/examples/express-app.js'
],
'process.runtime.version': '18.19.0',
'process.runtime.name': 'nodejs',
'process.runtime.description': 'Node.js',
'process.command': '/Users/david/Documents/repos/el/elastic-otel-node/examples/express-app.js',
'process.owner': 'david',
'telemetry.distro.name': 'elastic',
'telemetry.distro.version': '1.4.0',
'service.name': 'unknown_service:node',
'telemetry.sdk.language': 'nodejs',
'telemetry.sdk.name': 'opentelemetry',
'telemetry.sdk.version': '2.1.0'
}
},
instrumentationScope: {
name: '@opentelemetry/instrumentation-net',
version: '0.49.0',
schemaUrl: undefined
},
traceId: 'bc45e41b34285aa01724bb3e97355f68',
parentSpanContext: {
traceId: 'bc45e41b34285aa01724bb3e97355f68',
spanId: '69d51a98d81cb264',
traceFlags: 1,
traceState: undefined
},
traceState: undefined,
name: 'tcp.connect',
id: '5129bfa2833c348a',
kind: 0,
timestamp: 1759835165372000,
duration: 3006779.792,
attributes: {
'net.transport': 'ip_tcp',
'net.peer.name': '169.254.169.254',
'net.peer.port': 80
},
status: { code: 0 },
events: [],
links: []
}
{
resource: {
attributes: {
'host.name': 'moonlocal.local',
'host.arch': 'arm64',
'host.id': '7904601F-B9AB-5EB2-A389-E32C06D56851',
'os.type': 'darwin',
'os.version': '24.6.0',
'service.instance.id': '1d01558f-70b7-4faa-8938-937443c8bed2',
'process.pid': 68485,
'process.executable.name': 'node',
'process.executable.path': '/Users/david/.nvm/versions/node/v18.19.0/bin/node',
'process.command_args': [
'/Users/david/.nvm/versions/node/v18.19.0/bin/node',
'--require',
'../packages/opentelemetry-node/require.js',
'/Users/david/Documents/repos/el/elastic-otel-node/examples/express-app.js'
],
'process.runtime.version': '18.19.0',
'process.runtime.name': 'nodejs',
'process.runtime.description': 'Node.js',
'process.command': '/Users/david/Documents/repos/el/elastic-otel-node/examples/express-app.js',
'process.owner': 'david',
'telemetry.distro.name': 'elastic',
'telemetry.distro.version': '1.4.0',
'service.name': 'unknown_service:node',
'telemetry.sdk.language': 'nodejs',
'telemetry.sdk.name': 'opentelemetry',
'telemetry.sdk.version': '2.1.0'
}
},
instrumentationScope: {
name: '@opentelemetry/instrumentation-http',
version: '0.205.0',
schemaUrl: undefined
},
traceId: 'bc45e41b34285aa01724bb3e97355f68',
parentSpanContext: undefined,
traceState: undefined,
name: 'GET',
id: '69d51a98d81cb264',
kind: 2,
timestamp: 1759835165371000,
duration: 3008505.417,
attributes: {
'http.request.method': 'GET',
'server.address': '169.254.169.254',
'server.port': 80,
'url.full': 'http://169.254.169.254/computeMetadata/v1/instance',
'error.type': 'Error'
},
status: { code: 2, message: 'socket hang up' },
events: [
{
name: 'exception',
attributes: {
'exception.type': 'ECONNRESET',
'exception.message': 'socket hang up',
'exception.stacktrace': 'Error: socket hang up\n' +
' at connResetException (node:internal/errors:720:14)\n' +
' at Socket.socketCloseListener (node:_http_client:474:25)\n' +
' at Socket.emit (node:events:529:35)\n' +
' at TCP.<anonymous> (node:net:350:12)\n' +
' at TCP.callbackTrampoline (node:internal/async_hooks:128:17)'
},
time: [ 1759835168, 379476833 ],
droppedAttributesCount: 0
}
],
links: []
} |
🔍 Preview links for changed docs |
| ## version.next [edot-node-X.X.X-release-notes] | ||
|
|
||
| ### Features and enhancements [edot-node-X.X.X-features-enhancements] | ||
| * | ||
|
|
||
| ### Fixes [edot-node-X.X.X-fixes] |
There was a problem hiding this comment.
Hmm, this will show in the docs if merged to main, I think. We sure about that?
There was a problem hiding this comment.
I think we had used next rather than X.X.X before. The next is better when this is public. I'm guessing it was me that changed the commented out template above to use X.X.X to attempt to remind me/others to put the actual version in there when doing a release.
|
@trentm open-telemetry/opentelemetry-js#5930 is almost done and will fix the issue upstream so maybe it's better to wait and just update the NodeSDK dependency. We can do it in this PR |
I am definitely good with just waiting if we'll get a fix soonish. |
|
superseded by #1104 |
Closes #1017