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

fix: added support for Opentelemetry 0.18 #1234

Merged
merged 47 commits into from Apr 14, 2021
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
cf0217d
fix: added support for Opentelemetry 0.18
tapico-weyert Mar 17, 2021
c01a210
style: remove unused import declaration
tapico-weyert Mar 17, 2021
0de436e
refactor: removed the `OpenTelemetryTracer`-class and just expose cre…
tapico-weyert Mar 17, 2021
c36c9f5
test: updated the span related tests
tapico-weyert Mar 18, 2021
e790c23
test: updated the tests
tapico-weyert Mar 18, 2021
d96d2d9
test: updated the tests
tapico-weyert Mar 18, 2021
92b1a4c
refactor: move the tracer out of the `createSpan`-function
tapico-weyert Mar 18, 2021
b884b21
Merge branch 'master' into remove-tracing-dependency
feywind Mar 19, 2021
8b8d97e
Merge branch 'master' into remove-tracing-dependency
feywind Mar 19, 2021
560cdb2
Merge branch 'master' into remove-tracing-dependency
feywind Mar 24, 2021
1f6f7e2
fix: get the unit test for publisher opentelemetry working again
feywind Mar 24, 2021
0035983
test: fix the subscriber unit tests for opentelemetry
tapico-weyert Mar 30, 2021
3d33208
chore: remove describe.only
tapico-weyert Mar 30, 2021
364de28
chore: latest changes
tapico-weyert Mar 30, 2021
93eaaa1
test: updated the tests
tapico-weyert Mar 31, 2021
31b8371
test: improve the tests
tapico-weyert Mar 31, 2021
6159fb3
chore: maybe its need to be Google LLC?
tapico-weyert Mar 31, 2021
f26d90e
feat: add messaging attributes to otel spans
tapico-weyert Mar 31, 2021
2cbccb9
fix: include package.json version as instrumentation version
tapico-weyert Mar 31, 2021
93760c3
docs: update the opentelemetry example code
tapico-weyert Mar 31, 2021
54deb7c
style: remove unused code
tapico-weyert Apr 1, 2021
99adf22
fix: remove peer name for now
tapico-weyert Apr 1, 2021
cff5314
style: improve explanation regarding otel trace provider
tapico-weyert Apr 1, 2021
ae3e959
chore: update the opentelemetry versios in the samples `package.json`
tapico-weyert Apr 1, 2021
2e0095b
test: remove extranous logging in the opentelemetry example app
tapico-weyert Apr 3, 2021
78f31e4
test: remove the check for `traceId` that doesn't get outputted
tapico-weyert Apr 3, 2021
a73c74a
fix: change reference to `package.json` one level lower
tapico-weyert Apr 6, 2021
e42ac63
fix: remove unnecessary messaging span attribute and added comments
tapico-weyert Apr 6, 2021
0c54251
style: use shiny new syntax for undefined check in `subscriber`-class
tapico-weyert Apr 6, 2021
d0f0498
fix: match the span name with the operation kind in `subscriber`-class
tapico-weyert Apr 6, 2021
6c0ca40
chore: improved code based on PR feedback
tapico-weyert Apr 6, 2021
818013a
fix:
tapico-weyert Apr 6, 2021
2cbaa28
fix: only include `googclient_OpenTelemetrySpanContext`-attribute
tapico-weyert Apr 6, 2021
0c2c76f
fix: change the way `package.json` is being imported
tapico-weyert Apr 6, 2021
8d600ca
Merge branch 'master' into remove-tracing-dependency
feywind Apr 7, 2021
4b93dd1
fix: revert bad merge that removed tracing on devDependencies
feywind Apr 7, 2021
afe0529
style: remove unnecessary comment
weyert Apr 7, 2021
fa66633
style: remove unused imports
tapico-weyert Apr 7, 2021
7a628e9
build: downgrade @sinonjs/fake-timers to v6
tapico-weyert Apr 8, 2021
c1b66dd
style: cleanup type definition
weyert Apr 8, 2021
c081f6b
build: remove `package.json` after compilation step
tapico-weyert Apr 9, 2021
b42344d
chore: merge from main
feywind Apr 9, 2021
9339baf
build: put back package.json in the build
feywind Apr 9, 2021
14de625
build: explicitly add package.json to the npm pack build
feywind Apr 13, 2021
253b56b
fix: revert "fix: change the way `package.json` is being imported"
feywind Apr 14, 2021
4db9ba5
fix: revert "build: explicitly add package.json to the npm pack build"
feywind Apr 14, 2021
4f360e4
Merge branch 'master' into remove-tracing-dependency
feywind Apr 14, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions package.json
Expand Up @@ -53,8 +53,7 @@
"@google-cloud/precise-date": "^2.0.0",
"@google-cloud/projectify": "^2.0.0",
"@google-cloud/promisify": "^2.0.0",
"@opentelemetry/api": "^0.12.0",
"@opentelemetry/tracing": "^0.12.0",
"@opentelemetry/api": "^0.18.0",
"@types/duplexify": "^3.6.0",
"@types/long": "^4.0.0",
"arrify": "^2.0.0",
Expand All @@ -66,6 +65,7 @@
"p-defer": "^3.0.0"
},
"devDependencies": {
"@opentelemetry/tracing": "^0.18.0",
weyert marked this conversation as resolved.
Show resolved Hide resolved
"@grpc/proto-loader": "^0.5.4",
"@types/execa": "^0.9.0",
"@types/extend": "^3.0.0",
Expand Down
29 changes: 22 additions & 7 deletions src/opentelemetry-tracing.ts
Expand Up @@ -13,8 +13,15 @@
* limitations under the License.
*/

import {Attributes, SpanContext, Span, trace} from '@opentelemetry/api';
import {Tracer} from '@opentelemetry/tracing';
import {
Tracer,
SpanAttributes,
SpanContext,
Span,
context,
trace,
setSpanContext,
} from '@opentelemetry/api';

/**
* Wrapper for creating OpenTelemetry Spans
Expand All @@ -31,13 +38,21 @@ export class OpenTelemetryTracer {
*/
createSpan(
spanName: string,
attributes?: Attributes,
attributes?: SpanAttributes,
parent?: SpanContext
): Span {
const tracerProvider: Tracer = trace.getTracer('default') as Tracer;
return tracerProvider.startSpan(spanName, {
parent: parent,
attributes: attributes,
});

let spanContext = undefined;
if (parent) {
spanContext = setSpanContext(context.active(), parent);
}
weyert marked this conversation as resolved.
Show resolved Hide resolved
return tracerProvider.startSpan(
spanName,
{
attributes: attributes,
},
spanContext
);
}
}
2 changes: 1 addition & 1 deletion test/opentelemetry-tracing.ts
Expand Up @@ -31,7 +31,7 @@ describe('OpenTelemetryTracer', () => {
spanId: '6e0c63257de34c92',
traceFlags: api.TraceFlags.SAMPLED,
};
const spanAttributes: api.Attributes = {
const spanAttributes: api.SpanAttributes = {
foo: 'bar',
};

Expand Down