Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion core/packages/gax/src/gax.ts
Original file line number Diff line number Diff line change
Expand Up @@ -863,7 +863,10 @@ export function constructSettings(
bundleOptions: bundlingConfig
? createBundleOptions(bundlingConfig)
: null,
otherArgs,
otherArgs:
internalTelemetryInfo || enableTelemetryTracing
? {...otherArgs, internalMethodName: methodName}
: otherArgs,
apiName,
enableTelemetryTracing,
});
Expand Down
9 changes: 9 additions & 0 deletions core/packages/gax/test/unit/gax.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ describe('gax construct settings', () => {
assert.strictEqual(settings.otherArgs, otherArgs);
assert.strictEqual(settings.enableTelemetryTracing, undefined);
assert.strictEqual(settings.otherArgs.internalTelemetryInfo, undefined);
assert.strictEqual(settings.otherArgs.internalMethodName, undefined);

settings = defaults.pageStreamingMethod;
assert.strictEqual(settings.timeout, 30000);
Expand All @@ -124,6 +125,7 @@ describe('gax construct settings', () => {
assert.strictEqual(settings.otherArgs, otherArgs);
assert.strictEqual(settings.enableTelemetryTracing, undefined);
assert.strictEqual(settings.otherArgs.internalTelemetryInfo, undefined);
assert.strictEqual(settings.otherArgs.internalMethodName, undefined);
});

it('overrides settings', () => {
Expand Down Expand Up @@ -227,13 +229,18 @@ describe('gax construct settings', () => {
settings.otherArgs.internalTelemetryInfo,
telemetryInfo,
);
assert.strictEqual(settings.otherArgs.internalMethodName, 'BundlingMethod');

const pageSettings = defaults.pageStreamingMethod;
assert.strictEqual(pageSettings.enableTelemetryTracing, true);
assert.deepStrictEqual(
pageSettings.otherArgs.internalTelemetryInfo,
telemetryInfo,
);
assert.strictEqual(
pageSettings.otherArgs.internalMethodName,
'PageStreamingMethod',
);
});

it('creates settings with internalTelemetryInfo when otherArgs is undefined', () => {
Expand All @@ -258,6 +265,7 @@ describe('gax construct settings', () => {
settings.otherArgs.internalTelemetryInfo,
telemetryInfo,
);
assert.strictEqual(settings.otherArgs.internalMethodName, 'BundlingMethod');
});

it('creates settings with enableTelemetryTracing set to false', () => {
Expand All @@ -272,6 +280,7 @@ describe('gax construct settings', () => {
const settings = defaults.bundlingMethod;
assert.strictEqual(settings.enableTelemetryTracing, false);
assert.strictEqual(settings.otherArgs.internalTelemetryInfo, undefined);
assert.strictEqual(settings.otherArgs.internalMethodName, undefined);
});

describe('CallSettings telemetry fields', () => {
Expand Down
2 changes: 2 additions & 0 deletions core/packages/gax/test/unit/grpc-fallback.ts
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,7 @@ describe('grpc-fallback', () => {
const metadataBuilder = settings.echo.otherArgs.metadataBuilder;
const headers = metadataBuilder();
assert(headers['x-goog-api-client'][0].match('grpc-web/'));
assert.strictEqual(settings.echo.otherArgs.internalMethodName, undefined);
});

it('constructSettings should accept enableTelemetryTracing and internalTelemetryInfo', () => {
Expand Down Expand Up @@ -288,6 +289,7 @@ describe('grpc-fallback', () => {
settings.echo.otherArgs.internalTelemetryInfo,
telemetryInfo,
);
assert.strictEqual(settings.echo.otherArgs.internalMethodName, 'Echo');
});

it('should make a request', async () => {
Expand Down
8 changes: 8 additions & 0 deletions core/packages/gax/test/unit/grpc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,10 @@ describe('grpc', () => {
settings.method.otherArgs.internalTelemetryInfo,
undefined,
);
assert.strictEqual(
settings.method.otherArgs.internalMethodName,
undefined,
);
});

it('constructs settings with enableTelemetryTracing and internalTelemetryInfo', () => {
Expand All @@ -178,6 +182,10 @@ describe('grpc', () => {
settings.method.otherArgs.internalTelemetryInfo,
telemetryInfo,
);
assert.strictEqual(
settings.method.otherArgs.internalMethodName,
'method',
);
});
});

Expand Down
Loading