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

refactor: ts conversion of tracing-policy and cls #559

Merged
merged 4 commits into from
Sep 26, 2017
Merged

Conversation

kjin
Copy link
Contributor

@kjin kjin commented Sep 19, 2017

No description provided.

@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Sep 19, 2017
src/constants.ts Outdated
@@ -16,25 +16,23 @@

'use strict';

module.exports = {
export namespace Constants {

This comment was marked as spam.

This comment was marked as spam.

src/span-data.ts Outdated
* @param {string} name The name of the span.
* @param {number} parentSpanId The id of the parent span, 0 for root spans.
* @param {boolean} isRoot Whether this is a root span.
* @param {number} skipFrames the number of frames to remove from the top of the stack.

This comment was marked as spam.

src/span-data.ts Outdated
}

// Auto-incrementing integer
let uid: number = 1;

This comment was marked as spam.

/**
* Sets or updates a label value.
* @param {string} key The label key to set.
* @param {string} value The new value of the label.

This comment was marked as spam.

public readonly labels: TraceSpanLabels = {};
public readonly startTime: string;
public endTime: string = '';
public kind: string = 'RPC_CLIENT';

This comment was marked as spam.

This comment was marked as spam.

src/trace.ts Outdated
* @constructor
*/
constructor(
public projectId: string,

This comment was marked as spam.

src/util.ts Outdated
@@ -61,19 +77,19 @@ var moduleRegex = new RegExp(
* @return {?{traceId: string, spanId: string, options: number}}

This comment was marked as spam.

src/util.ts Outdated
@@ -115,11 +131,11 @@ function packageNameFromPath(path) {
* @param {string} request The name of the module to be loaded.
* @param {object} parent The module into which the requested module will be loaded.

This comment was marked as spam.

projectId: 'fake project',
serviceContext: {},
onUncaughtException: 'ignore',
forceNewAgent_: true
});
} as createTraceWriterOptions);

This comment was marked as spam.

@@ -109,8 +113,8 @@ describe('TraceWriter', function() {
assert.ok(trace && trace.spans && trace.spans[0]);
var span = trace.spans[0];
assert.strictEqual(span.name, 'fake span');
assert.ok(span.closed_);
assert.strictEqual((spanData.labels_ as any).fakeKey, 'value');
assert.ok((span as any).closed_);

This comment was marked as spam.

@kjin
Copy link
Contributor Author

kjin commented Sep 20, 2017

@ofrobots Oops, I removed review requests since the last commit in this PR (which should have been the only unique changes) is dependent on other PRs that have yet to be merged. Sorry, should have been clearer. Will address your comments in the relevant PRs.

@kjin kjin changed the title refactor: ts conversion of tracing-policy refactor: ts conversion of tracing-policy and cls Sep 22, 2017
src/cls-ah.ts Outdated
Namespace.prototype.get = function(k) {
return current[k];
};
class Namespace implements CLSNamespace {

This comment was marked as spam.

This comment was marked as spam.

src/cls.ts Outdated

/** @const {string} */
var TRACE_NAMESPACE = 'com.google.cloud.trace';
const cls: typeof CLS = semver.satisfies(process.version, '>=8') &&

This comment was marked as spam.

This comment was marked as spam.

src/cls.ts Outdated

setRootContext: function setRootContext(rootContext) {
getNamespace().set('root', rootContext);
export function getRootContext(): any {

This comment was marked as spam.

This comment was marked as spam.

src/cls.ts Outdated

export default {};
export function setRootContext(rootContext: any): void {

This comment was marked as spam.

This comment was marked as spam.

/**
* An object that determines whether a request should be traced.
*/
export interface Policy {

This comment was marked as spam.

This comment was marked as spam.

@kjin kjin merged commit 50ad811 into googleapis:master Sep 26, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes This human has signed the Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants