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

bigquery: missing span #10961

Open
klurpicolo opened this issue Oct 8, 2024 · 0 comments
Open

bigquery: missing span #10961

klurpicolo opened this issue Oct 8, 2024 · 0 comments
Assignees
Labels
api: bigquery Issues related to the BigQuery API. triage me I really want to be triaged.

Comments

@klurpicolo
Copy link

Client

BigQuery table

Environment

go version go1.22.5 darwin/arm64

Code and Dependencies

// table.go

func (t *Table) Create(ctx context.Context, tm *TableMetadata) (err error) {
	ctx = trace.StartSpan(ctx, "cloud.google.com/go/bigquery.Table.Create")
	defer func() { trace.EndSpan(ctx, err) }()

	table, err := tm.toBQ()
	if err != nil {
		return err
	}
	table.TableReference = &bq.TableReference{
		ProjectId: t.ProjectID,
		DatasetId: t.DatasetID,
		TableId:   t.TableID,
	}

	req := t.c.bqs.Tables.Insert(t.ProjectID, t.DatasetID, table).Context(ctx)
	setClientHeader(req.Header())
	return runWithRetry(ctx, func() (err error) {
		ctx = trace.StartSpan(ctx, "bigquery.tables.insert")
		_, err = req.Do()
		trace.EndSpan(ctx, err)
		return err
	})
}

func (t *Table) Update(ctx context.Context, tm TableMetadataToUpdate, etag string, opts ...TableUpdateOption) (md *TableMetadata, err error) {
	ctx = trace.StartSpan(ctx, "cloud.google.com/go/bigquery.Table.Update")
	defer func() { trace.EndSpan(ctx, err) }()

	bqt, err := tm.toBQ()
	if err != nil {
		return nil, err
	}

	tpc := &tablePatchCall{
		call: t.c.bqs.Tables.Patch(t.ProjectID, t.DatasetID, t.TableID, bqt).Context(ctx),
	}

	for _, o := range opts {
		o(tpc)
	}

	setClientHeader(tpc.call.Header())
	if etag != "" {
		tpc.call.Header().Set("If-Match", etag)
	}
	var res *bq.Table
	if err := runWithRetry(ctx, func() (err error) {
		ctx = trace.StartSpan(ctx, "bigquery.tables.patch")
		res, err = tpc.call.Do()
		trace.EndSpan(ctx, err)
		return err
	}); err != nil {
		return nil, err
	}
	return bqToTableMetadata(res, t.c)
}

Expected behavior

Span is not missing

Actual behavior

Span is missing

Screenshots

image

Additional context

ctx is replace in inner function runWithRetry, and then parent span is not end properly.

@klurpicolo klurpicolo added the triage me I really want to be triaged. label Oct 8, 2024
@codyoss codyoss changed the title packagename: short description of bug bigquery: missing span Oct 8, 2024
@codyoss codyoss added the api: bigquery Issues related to the BigQuery API. label Oct 8, 2024
@alvarowolfx alvarowolfx assigned alvarowolfx and unassigned shollyman Oct 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: bigquery Issues related to the BigQuery API. triage me I really want to be triaged.
Projects
None yet
Development

No branches or pull requests

4 participants