googleapis / googleapis/google-cloud-go
spanner: unsupported sampler error occurs while keeping the session alive
- Dominant language
- Go
- Stars
- 4.5k
- Forks
- 1.6k
- Avg merge
- 1d 13h
- Merged PRs (30d)
- 109
Description
## Client
go-spanner
## Environment
GKE
## Go Environment
$ go version
1.22.9
Using https://pkg.go.dev/cloud.google.com/go/spanner v1.73.0
## Code and Dependencies
go library for Spanner suggests that there is no need to handle session on our own and we are not doing any of the thing on our own. It's the HealthCheckWorker which is doing all of the things on it's own.
### Why is this error occurring?
L299 `octrace.WithSampler(octrace.NeverSample())` specifies the sampler.
See: https://github.com/googleapis/google-cloud-go/blob/main/spanner/session.go#L299-L300
However, if you check the opentelemetry-go implementation, it returns an error if sampler is not nil.
See: https://github.com/open-telemetry/opentelemetry-go/blob/main/bridge/opencensus/internal/oc2otel/tracer_start_options.go#L32
Why is it calling `StartSpan` even though it is not sampling?
Also, only this code uses OpenCensus to run `StartSpan`.
How about erasing the L299 to L300 code based on the following two points
- It is not actually sampling.
- `StartSpan` with OpenCeusus is deprecated. See: https://github.com/googleapis/google-cloud-go/blob/main/internal/trace/trace.go#L38
If you have other ideas, I would appreciate your input.
## Expected behavior
There should not be any error while executing Select 1 .
## Actual behavior
Getting Below error
starting span "cloud.google.com/go/spanner.ping": unsupported sampler: 0x158af20
## Additional context
A similar [Issue](https://github.com/googleapis/google-cloud-go/issues/7100) has been created previously, but the problem still persists.
Contributor guide
Assessment
This issue has not been assessed yet.