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

chore(spanner): Add changes in Spanner executor for testing end to end tracing #10450

Open
wants to merge 36 commits into
base: main
Choose a base branch
from

Conversation

nareshz
Copy link

@nareshz nareshz commented Jun 27, 2024

This PR adds changes in spanner executor code required for testing end to end tracing feature.

@nareshz nareshz requested review from a team as code owners June 27, 2024 09:51
@product-auto-label product-auto-label bot added the api: spanner Issues related to the Spanner API. label Jun 27, 2024
Copy link
Contributor

@harshachinta harshachinta left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed couple of files and added comments. Will take a look at the remaining files after these changes are incorporated.

@harshachinta harshachinta changed the title feat(Spanner): Add changes in Spanner executor for testing end to end tracing chore(spanner): Add changes in Spanner executor for testing end to end tracing Jul 4, 2024
@@ -50,7 +50,7 @@ func (h *StartBatchTxnHandler) ExecuteAction(ctx context.Context) error {
return h.OutcomeSender.FinishWithError(spanner.ToSpannerError(status.Error(codes.InvalidArgument, "database path must be set for this action")))
}

client, err := spanner.NewClient(ctx, h.FlowContext.Database, h.Options...)
client, err := spanner.NewClientWithConfig(ctx, h.FlowContext.Database, spanner.ClientConfig{SessionPoolConfig: spanner.DefaultSessionPoolConfig, DisableRouteToLeader: false, EnableServerSideTracing: true}, h.Options...)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to set SessionPoolConfig and DisableRouteToLeader here? They should already have their default values right?

Copy link
Author

@nareshz nareshz Aug 20, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we will need to set it explicitly. Even spanner.NewClient method sets the default values explicitly in its implementation.

@@ -331,6 +335,12 @@ type ClientConfig struct {
DirectedReadOptions *sppb.DirectedReadOptions

OpenTelemetryMeterProvider metric.MeterProvider

// EnableServerSideTracing indicates whether server side tracing is enabled or not.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets add same comment as that in java PR

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense. Updated the opt-in header PR(#10241) as well.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we have same changes in 2 different PRs. If https://github.com/googleapis/google-cloud-go/pull/10241/files is valid, then remove these changes from here and lets have the executor changes alone.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR is created on top of the changes of #10241. Executor changes also includes the usage of EnableServerSideTracing flag which is in #10241. That's why copied the changes from that PR.

Considering this PR will be submitted after #10241 is submitted, When we submit this PR, can't we take a pull from main branch?

@@ -142,6 +209,48 @@ func (h *CloudStreamHandler) startHandlingRequest(ctx context.Context, req *exec
}
}

// verifyCloudTraceExportedTraces fetches the traces exported from client application using
// Cloud Trace API to cross verify if end to end tracing is working or not.
func (h *CloudStreamHandler) verifyCloudTraceExportedTraces(ctx context.Context, traceId string) error {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks like this method is getting called only once after all the actions complete. If that is right, and TraceClient is getting used only at this place then there is no need to create it way before and store it in the execution flow context. You can create the trace client here and close it once the verification completes.
WDYT?
Is the traceclient used somewhere else?

Copy link
Author

@nareshz nareshz Aug 20, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, trace client is only used at the end and doesn't need to be created at the start. thanks for pointing out. Made the change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: spanner Issues related to the Spanner API.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants