Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(opentelemetry-resources): add runtime version information #2727

Merged
merged 18 commits into from
Mar 4, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ class ProcessDetector implements Detector {
[SemanticResourceAttributes.PROCESS_COMMAND_LINE]:
process.argv.join(' ') || '',
[SemanticResourceAttributes.PROCESS_RUNTIME_VERSION]: process.versions.node,
[SemanticResourceAttributes.PROCESS_RUNTIME_NAME]: 'nodejs',
vmarchaud marked this conversation as resolved.
Show resolved Hide resolved
[SemanticResourceAttributes.PROCESS_RUNTIME_DESCRIPTION]: 'NodeJS',
cuichenli marked this conversation as resolved.
Show resolved Hide resolved
};
return this._getResourceAttributes(processResource, config);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ describe('processDetector()', () => {
command: '/home/ot/test.js',
commandLine: '/tmp/node /home/ot/test.js arg1 arg2',
version: '1.4.1',
runtimeDescription: 'NodeJS',
runtimeName: 'nodejs',
});
});
it('should return empty resources if title, command and commondLine is missing', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,8 @@ export const assertProcessResource = (
command?: string;
commandLine?: string;
version?: string;
runtimeName?: string;
runtimeDescription?: string;
}
) => {
assert.strictEqual(
Expand Down Expand Up @@ -301,6 +303,18 @@ export const assertProcessResource = (
validations.version
);
}
if (validations.runtimeName) {
assert.strictEqual(
resource.attributes[SemanticResourceAttributes.PROCESS_RUNTIME_NAME],
validations.runtimeName
);
}
if (validations.runtimeDescription) {
assert.strictEqual(
resource.attributes[SemanticResourceAttributes.PROCESS_RUNTIME_DESCRIPTION],
validations.runtimeDescription
);
}
};

/**
Expand Down