Skip to content

Commit

Permalink
try again.
Browse files Browse the repository at this point in the history
  • Loading branch information
ehsannas committed Jul 30, 2024
1 parent 209e91d commit ff255b0
Showing 1 changed file with 25 additions and 4 deletions.
29 changes: 25 additions & 4 deletions dev/system-test/tracing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ import {
} from '../src/telemetry/trace-util';
import {AsyncLocalStorageContextManager} from '@opentelemetry/context-async-hooks';
import {deepStrictEqual} from 'assert';
import {cloudtrace_v1, auth as gAuth} from '@googleapis/cloudtrace';
import {cloudtrace_v1, cloudtrace_v2} from '@googleapis/cloudtrace';

Check warning on line 70 in dev/system-test/tracing.ts

View workflow job for this annotation

GitHub Actions / lint

'cloudtrace_v2' is defined but never used
import {GoogleAuth} from 'google-gax';
import Schema$Trace = cloudtrace_v1.Schema$Trace;
import Schema$TraceSpan = cloudtrace_v1.Schema$TraceSpan;
Expand Down Expand Up @@ -325,6 +325,22 @@ describe.only('Tracing Tests', () => {
);
}

async function authenticate() : Promise<any> {

Check failure on line 328 in dev/system-test/tracing.ts

View workflow job for this annotation

GitHub Actions / lint

Delete `·`

Check warning on line 328 in dev/system-test/tracing.ts

View workflow job for this annotation

GitHub Actions / lint

Unexpected any. Specify a different type
try {
const auth = new GoogleAuth({
scopes: ['https://www.googleapis.com/auth/cloud-platform']

Check failure on line 331 in dev/system-test/tracing.ts

View workflow job for this annotation

GitHub Actions / lint

Insert `,`
});

const client = await auth.getClient();
console.log(client); // The authenticated client
console.log(`authenticated for project:${client.projectId}`);
return auth;
} catch (error) {
console.error('Authentication failed:', error);
return null;
}
}

// Returns true on success, and false otherwise.
async function waitForCompletedInMemorySpans(): Promise<boolean> {
await tracerProvider.forceFlush();
Expand All @@ -337,14 +353,17 @@ describe.only('Tracing Tests', () => {
async function waitForCompletedCloudTraceSpans(
numExpectedSpans: number
): Promise<boolean> {
const auth = new gAuth.GoogleAuth({
scopes: ['https://www.googleapis.com/auth/cloud-platform'],
});
// const auth = new gAuth.GoogleAuth({
// scopes: ['https://www.googleapis.com/auth/cloud-platform'],
// });

// const client = new cloudtrace_v1.Cloudtrace({
// auth: new GoogleAuth({
// projectId: firestore.projectId,
// }),
// });

const auth = await authenticate();
const client = new cloudtrace_v1.Cloudtrace({auth});
const projectTraces = new cloudtrace_v1.Resource$Projects$Traces(
client.context
Expand All @@ -360,10 +379,12 @@ describe.only('Tracing Tests', () => {
let receivedFullTrace = false;
do {
try {
console.log('going to get traces');
const getTraceResponse = await projectTraces.get({
projectId: firestore.projectId,
traceId: customSpanContext.traceId,
});
console.log(`got ${getTraceResponse}`);

cloudTraceInfo = getTraceResponse.data;

Expand Down

0 comments on commit ff255b0

Please sign in to comment.