Skip to content

Commit 1b9ebd9

Browse files
HazATkamilogorek
authored andcommitted
ref: naming
1 parent 206c46b commit 1b9ebd9

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

packages/hub/src/hub.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,7 @@ export class Hub implements HubInterface {
404404
const span = top.scope.getSpan();
405405

406406
if (span) {
407-
return span.makeChild(spanContext);
407+
return span.child(spanContext);
408408
}
409409
}
410410

packages/hub/src/span.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ export class Span implements SpanInterface, SpanContext {
116116
* Creates a new `Span` while setting the current `Span.id` as `parentSpanId`.
117117
* Also the `sampled` decision will be inherited.
118118
*/
119-
public makeChild(spanContext?: Pick<SpanContext, Exclude<keyof SpanContext, 'spanId'>>): Span {
119+
public child(spanContext?: Pick<SpanContext, Exclude<keyof SpanContext, 'spanId'>>): Span {
120120
const span = new Span({
121121
...spanContext,
122122
parentSpanId: this._spanId,

packages/hub/test/span.test.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@ describe('Span', () => {
1212
describe('newSpan', () => {
1313
test('simple', () => {
1414
const span = new Span({ sampled: true });
15-
const span2 = span.makeChild();
15+
const span2 = span.child();
1616
expect((span2 as any)._parentSpanId).toBe((span as any)._spanId);
1717
expect((span2 as any)._traceId).toBe((span as any)._traceId);
1818
expect((span2 as any).sampled).toBe((span as any).sampled);
1919
});
2020

2121
test('gets currentHub', () => {
2222
const span = new Span({});
23-
const span2 = span.makeChild();
23+
const span2 = span.child();
2424
expect((span as any)._hub).toBeInstanceOf(Hub);
2525
expect((span2 as any)._hub).toBeInstanceOf(Hub);
2626
});
@@ -74,15 +74,15 @@ describe('Span', () => {
7474
describe('newSpan', () => {
7575
test('simple', () => {
7676
const span = new Span({ sampled: true });
77-
const span2 = span.makeChild();
77+
const span2 = span.child();
7878
expect((span2 as any)._parentSpanId).toBe((span as any)._spanId);
7979
expect((span2 as any)._traceId).toBe((span as any)._traceId);
8080
expect((span2 as any).sampled).toBe((span as any).sampled);
8181
});
8282

8383
test('gets currentHub', () => {
8484
const span = new Span({});
85-
const span2 = span.makeChild();
85+
const span2 = span.child();
8686
expect((span as any)._hub).toBeInstanceOf(Hub);
8787
expect((span2 as any)._hub).toBeInstanceOf(Hub);
8888
});
@@ -178,7 +178,7 @@ describe('Span', () => {
178178
test('finish a scope span with transaction + child span', () => {
179179
const spy = jest.spyOn(hub as any, 'captureEvent') as any;
180180
const parentSpan = new Span({ transaction: 'test' }, hub);
181-
const childSpan = parentSpan.makeChild();
181+
const childSpan = parentSpan.child();
182182
childSpan.finish();
183183
parentSpan.finish();
184184
expect(spy).toHaveBeenCalled();

0 commit comments

Comments
 (0)