Skip to content

Commit

Permalink
feat: add owner path attribute (#276)
Browse files Browse the repository at this point in the history
* feat: add owner path attribute

* fix: update telemetry attribute js
  • Loading branch information
IgnacioBecerra authored Oct 18, 2024
1 parent dfca575 commit 8104803
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 5 deletions.
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
6 changes: 6 additions & 0 deletions src/test/scopes/jsx/__snapshots__/jsx-scope.e2e.test.ts.snap
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
2 changes: 2 additions & 0 deletions src/test/scopes/npm/__snapshots__/npm-scope.e2e.test.ts.snap
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

0 comments on commit 8104803

Please sign in to comment.