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: add owner path attribute #276

Merged
merged 2 commits into from
Oct 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
"@commitlint/cli": "^19.4.1",
"@commitlint/config-conventional": "^19.4.1",
"@eslint-community/eslint-plugin-eslint-comments": "^4.4.0",
"@ibm/telemetry-attributes-js": "^3.2.0",
"@ibm/telemetry-attributes-js": "^4.1.1",
"@ibm/telemetry-config-schema": "^1.3.0",
"@opentelemetry/api": "^1.9.0",
"@opentelemetry/exporter-metrics-otlp-http": "^0.53.0",
Expand Down
4 changes: 4 additions & 0 deletions src/main/ibm-telemetry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,9 @@ export class IbmTelemetry {
[CustomResourceAttributes.ANALYZED_PATH]: `${repository.host ?? ''}/${
repository.owner ?? ''
}/${repository.repository ?? ''}`,
[CustomResourceAttributes.ANALYZED_OWNER_PATH]: `${repository.host ?? ''}/${
repository.owner ?? ''
}`,
[CustomResourceAttributes.ANALYZED_REPOSITORY]: repository.repository,
[CustomResourceAttributes.ANALYZED_REFS]: [...commitTags, ...commitBranches],
[CustomResourceAttributes.DATE]: date
Expand All @@ -118,6 +121,7 @@ export class IbmTelemetry {
CustomResourceAttributes.ANALYZED_HOST,
CustomResourceAttributes.ANALYZED_OWNER,
CustomResourceAttributes.ANALYZED_PATH,
CustomResourceAttributes.ANALYZED_OWNER_PATH,
CustomResourceAttributes.ANALYZED_REPOSITORY,
CustomResourceAttributes.ANALYZED_REFS
]
Expand Down
1 change: 1 addition & 0 deletions src/test/__utils/initialize-otel-for-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export function initializeOtelForTest() {
[CustomResourceAttributes.ANALYZED_HOST]: 'host',
[CustomResourceAttributes.ANALYZED_OWNER]: 'owner',
[CustomResourceAttributes.ANALYZED_PATH]: 'host/owner/repository',
[CustomResourceAttributes.ANALYZED_OWNER_PATH]: 'host/owner',
[CustomResourceAttributes.ANALYZED_REPOSITORY]: 'repository',
[CustomResourceAttributes.ANALYZED_COMMIT]: 'commitHash',
[CustomResourceAttributes.ANALYZED_REFS]: [],
Expand Down
6 changes: 6 additions & 0 deletions src/test/scopes/js/__snapshots__/js-scope.e2e.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ exports[`class: JsScope > run > captures metrics for workspace files when instru
"analyzed.commit": "commitHash",
"analyzed.host": "host",
"analyzed.owner": "owner",
"analyzed.owner.path": "host/owner",
"analyzed.path": "host/owner/repository",
"analyzed.refs": [],
"analyzed.repository": "repository",
Expand All @@ -26,6 +27,7 @@ exports[`class: JsScope > run > captures metrics for workspace files when instru
"analyzed.commit": "commitHash",
"analyzed.host": "host",
"analyzed.owner": "owner",
"analyzed.owner.path": "host/owner",
"analyzed.path": "host/owner/repository",
"analyzed.refs": [],
"analyzed.repository": "repository",
Expand Down Expand Up @@ -142,6 +144,7 @@ exports[`class: JsScope > run > captures metrics when instrumented package is in
"analyzed.commit": "commitHash",
"analyzed.host": "host",
"analyzed.owner": "owner",
"analyzed.owner.path": "host/owner",
"analyzed.path": "host/owner/repository",
"analyzed.refs": [],
"analyzed.repository": "repository",
Expand All @@ -158,6 +161,7 @@ exports[`class: JsScope > run > captures metrics when instrumented package is in
"analyzed.commit": "commitHash",
"analyzed.host": "host",
"analyzed.owner": "owner",
"analyzed.owner.path": "host/owner",
"analyzed.path": "host/owner/repository",
"analyzed.refs": [],
"analyzed.repository": "repository",
Expand Down Expand Up @@ -299,6 +303,7 @@ exports[`class: JsScope > run > correctly captures js function and token metric
"analyzed.commit": "commitHash",
"analyzed.host": "host",
"analyzed.owner": "owner",
"analyzed.owner.path": "host/owner",
"analyzed.path": "host/owner/repository",
"analyzed.refs": [],
"analyzed.repository": "repository",
Expand All @@ -315,6 +320,7 @@ exports[`class: JsScope > run > correctly captures js function and token metric
"analyzed.commit": "commitHash",
"analyzed.host": "host",
"analyzed.owner": "owner",
"analyzed.owner.path": "host/owner",
"analyzed.path": "host/owner/repository",
"analyzed.refs": [],
"analyzed.repository": "repository",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ exports[`class: JsxScope > run > captures metrics for workspace files when instr
"analyzed.commit": "commitHash",
"analyzed.host": "host",
"analyzed.owner": "owner",
"analyzed.owner.path": "host/owner",
"analyzed.path": "host/owner/repository",
"analyzed.refs": [],
"analyzed.repository": "repository",
Expand All @@ -26,6 +27,7 @@ exports[`class: JsxScope > run > captures metrics for workspace files when instr
"analyzed.commit": "commitHash",
"analyzed.host": "host",
"analyzed.owner": "owner",
"analyzed.owner.path": "host/owner",
"analyzed.path": "host/owner/repository",
"analyzed.refs": [],
"analyzed.repository": "repository",
Expand Down Expand Up @@ -111,6 +113,7 @@ exports[`class: JsxScope > run > captures metrics when instrumented package is i
"analyzed.commit": "commitHash",
"analyzed.host": "host",
"analyzed.owner": "owner",
"analyzed.owner.path": "host/owner",
"analyzed.path": "host/owner/repository",
"analyzed.refs": [],
"analyzed.repository": "repository",
Expand All @@ -127,6 +130,7 @@ exports[`class: JsxScope > run > captures metrics when instrumented package is i
"analyzed.commit": "commitHash",
"analyzed.host": "host",
"analyzed.owner": "owner",
"analyzed.owner.path": "host/owner",
"analyzed.path": "host/owner/repository",
"analyzed.refs": [],
"analyzed.repository": "repository",
Expand Down Expand Up @@ -212,6 +216,7 @@ exports[`class: JsxScope > run > correctly captures jsx element metric data 1`]
"analyzed.commit": "commitHash",
"analyzed.host": "host",
"analyzed.owner": "owner",
"analyzed.owner.path": "host/owner",
"analyzed.path": "host/owner/repository",
"analyzed.refs": [],
"analyzed.repository": "repository",
Expand All @@ -228,6 +233,7 @@ exports[`class: JsxScope > run > correctly captures jsx element metric data 1`]
"analyzed.commit": "commitHash",
"analyzed.host": "host",
"analyzed.owner": "owner",
"analyzed.owner.path": "host/owner",
"analyzed.path": "host/owner/repository",
"analyzed.refs": [],
"analyzed.repository": "repository",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ exports[`class: NpmScope > run > correctly captures dependency data 1`] = `
"analyzed.commit": "commitHash",
"analyzed.host": "host",
"analyzed.owner": "owner",
"analyzed.owner.path": "host/owner",
"analyzed.path": "host/owner/repository",
"analyzed.refs": [],
"analyzed.repository": "repository",
Expand All @@ -26,6 +27,7 @@ exports[`class: NpmScope > run > correctly captures dependency data 1`] = `
"analyzed.commit": "commitHash",
"analyzed.host": "host",
"analyzed.owner": "owner",
"analyzed.owner.path": "host/owner",
"analyzed.path": "host/owner/repository",
"analyzed.refs": [],
"analyzed.repository": "repository",
Expand Down