Skip to content

Commit

Permalink
feat(detector-github)!: change implementation to DetectorSync interfa…
Browse files Browse the repository at this point in the history
…ce (#2336)
  • Loading branch information
david-luna authored Aug 1, 2024
1 parent 80304bc commit d52d421
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
"typescript": "4.4.4"
},
"dependencies": {
"@opentelemetry/resources": "^1.0.0"
"@opentelemetry/resources": "^1.10.0"
},
"homepage": "https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/detectors/node/opentelemetry-resource-detector-github#readme"
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
*/

import {
Detector,
DetectorSync,
IResource,
Resource,
ResourceAttributes,
} from '@opentelemetry/resources';
Expand All @@ -30,7 +31,7 @@ import {
*
* Returns an empty Resource if detection fails.
*/
class GitHubDetector implements Detector {
class GitHubDetector implements DetectorSync {
private _attributes: ResourceAttributes = {};

/**
Expand All @@ -49,12 +50,10 @@ class GitHubDetector implements Detector {
* environment variables:
* https://docs.github.com/en/free-pro-team@latest/actions/reference/environment-variables
*
* If successful it returns a promise containing a {@link Resource}
* populated with GitHub metadata. Returns a promise containing an
* empty {@link Resource} if the connection fails.
*
* If successful it returns a {@link Resource} populated with GitHub metadata.
* Returns an empty {@link Resource} if the env vars are not present.
*/
async detect(): Promise<Resource> {
detect(): IResource {
this._attributes = {};
this.addAttributeIfExists('github.workflow', process.env.GITHUB_WORKFLOW);
this.addAttributeIfExists('github.run_id', process.env.GITHUB_RUN_ID);
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

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

0 comments on commit d52d421

Please sign in to comment.