Skip to content

Commit

Permalink
feat(plugin): add http plugin (open-telemetry#161)
Browse files Browse the repository at this point in the history
* feat(plugin): add http plugin

Closes open-telemetry#157

Signed-off-by: Olivier Albertini <[email protected]>

* fix: integrate vmarchaud recommandations

Signed-off-by: Olivier Albertini <[email protected]>

* fix: wip revert - gts fix issue on all packages

Signed-off-by: Olivier Albertini <[email protected]>

* fix: integrate mayurkale22 recommendations

Signed-off-by: Olivier Albertini <[email protected]>

* ci: gts fix for ci build

Signed-off-by: Olivier Albertini <[email protected]>

* refactor: add mayurkale22 recommendations

Signed-off-by: Olivier Albertini <[email protected]>

* fix: integrate bg451 recommendations

test: increase coverage
fix: attributes requirements from the spec.

Signed-off-by: Olivier Albertini <[email protected]>

* fix: add missing header and revert scopeManager to private field

test: rename some tests
fix: copy/paste tests

Signed-off-by: Olivier Albertini <[email protected]>

* fix: add tests and improve attributes from spec

fix parentSpanId instead of parentId from rebase
add workaround with got and node12+ (real http call)
improve args passed to function (url, options, cb)

Signed-off-by: Olivier Albertini <[email protected]>

* fix: add mayurkale22 recommendations

Signed-off-by: Olivier Albertini <[email protected]>

* fix: rebase and remove/replace wrapEmitter to bind

Signed-off-by: Olivier Albertini <[email protected]>

* fix: add Flarna recommendations

fix: add Flarna recommendations
fix: tests
fix: OC bugs in OT only
test: add assertions
Allow options object as second argument

Signed-off-by: Olivier Albertini <[email protected]>

* refactor: simplify propagation usage

Signed-off-by: Olivier Albertini <[email protected]>

* fix: add Flarna recommandations

Signed-off-by: Olivier Albertini <[email protected]>

* refactor(test): use ReadableSpan

Signed-off-by: Olivier Albertini <[email protected]>

* feat: export class/enums for https module

Signed-off-by: Olivier Albertini <[email protected]>

* refactor: plugin.enable has logger param

Signed-off-by: Olivier Albertini <[email protected]>

* fix: add license header, rename enum files and refactoring

refactor: make integration tests mandatory for ci only
remove duplicate tests
remove dead comments

Signed-off-by: Olivier Albertini <[email protected]>
  • Loading branch information
OlivierAlbertini authored and mayurkale22 committed Aug 30, 2019
1 parent b9c9212 commit 3f90bf9
Show file tree
Hide file tree
Showing 19 changed files with 2,027 additions and 3 deletions.
25 changes: 22 additions & 3 deletions packages/opentelemetry-plugin-http/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"types": "build/src/index.d.ts",
"repository": "open-telemetry/opentelemetry-js",
"scripts": {
"test": "nyc ts-mocha -p tsconfig.json test/**/*.ts",
"test": "nyc ts-mocha -p tsconfig.json test/**/*/*.test.ts",
"tdd": "yarn test -- --watch-extensions ts --watch",
"clean": "rimraf build/*",
"check": "gts check",
Expand Down Expand Up @@ -38,19 +38,38 @@
"access": "public"
},
"devDependencies": {
"@types/got": "^9.6.6",
"@types/mocha": "^5.2.7",
"@types/nock": "^10.0.3",
"@types/node": "^12.6.9",
"@types/request-promise-native": "^1.0.16",
"@types/semver": "^6.0.1",
"@types/shimmer": "^1.0.1",
"@types/sinon": "^7.0.13",
"@types/superagent": "^4.1.3",
"@opentelemetry/scope-async-hooks": "^0.0.1",
"@opentelemetry/scope-base": "^0.0.1",
"@opentelemetry/basic-tracer": "^0.0.1",
"axios": "^0.19.0",
"got": "^9.6.0",
"request": "^2.88.0",
"request-promise-native": "^1.0.7",
"superagent": "5.1.0",
"codecov": "^3.5.0",
"gts": "^1.1.0",
"gts": "^1.0.0",
"mocha": "^6.2.0",
"nock": "^10.0.6",
"nyc": "^14.1.1",
"sinon": "^7.3.2",
"ts-mocha": "^6.0.0",
"ts-node": "^8.3.0",
"typescript": "^3.5.3"
},
"dependencies": {
"@opentelemetry/core": "^0.0.1",
"@opentelemetry/node-tracer": "^0.0.1",
"@opentelemetry/types": "^0.0.1"
"@opentelemetry/types": "^0.0.1",
"semver": "^6.3.0",
"shimmer": "^1.2.1"
}
}
34 changes: 34 additions & 0 deletions packages/opentelemetry-plugin-http/src/enums/AttributeNames.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/**
* Copyright 2019, OpenTelemetry Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

/**
* Attributes Names according to Opencensus HTTP Specs since there is no specific OpenTelemetry Attributes
* https://github.com/open-telemetry/opentelemetry-specification/blob/master/work_in_progress/opencensus/HTTP.md#attributes
*/
export enum AttributeNames {
HTTP_HOSTNAME = 'http.hostname',
COMPONENT = 'component',
HTTP_METHOD = 'http.method',
HTTP_PATH = 'http.path',
HTTP_ROUTE = 'http.route',
HTTP_URL = 'http.url',
HTTP_STATUS_CODE = 'http.status_code',
HTTP_STATUS_TEXT = 'http.status_text',
// NOT ON OFFICIAL SPEC
HTTP_ERROR_NAME = 'http.error_name',
HTTP_ERROR_MESSAGE = 'http.error_message',
HTTP_USER_AGENT = 'http.user_agent',
}
19 changes: 19 additions & 0 deletions packages/opentelemetry-plugin-http/src/enums/Format.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/**
* Copyright 2019, OpenTelemetry Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

export enum Format {
HTTP = 'HttpTraceContext',
}
Loading

0 comments on commit 3f90bf9

Please sign in to comment.