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

Added create trace pipeline method (Breaking Change: removes implementation of "SpanBatcher") #56

Merged
merged 20 commits into from Jul 8, 2020

Conversation

stevencl1013
Copy link
Contributor

@stevencl1013 stevencl1013 commented Jun 29, 2020

Pipeline method to create exporter and provider in one method. Also updated tests, example, and readme to use pipeline.

This PR also removes the ExportSpans method, so the provider can no longer use the withBatcher option when creating the exporter.
(NOTE: THIS IS A BREAKING CHANGE)

@@ -229,6 +253,44 @@ type Exporter struct {
traceExporter *traceExporter
}

// NewExportPipeline sets up a complete export pipeline with the recommended setup
// for trace provider. Returns provider, flush function, and errors.
func NewExportPipeline(opts ...Option) (apitrace.Provider, func(), error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

This doesn't include an option to set the resource of the trace provider as per WithResource: https://github.com/open-telemetry/opentelemetry-go/blob/master/sdk/trace/provider.go#L211

In general, I think you followed the Jaeger example, but it might be better to look at how a similar function is implemented in the operations metric exporter, see: https://github.com/GoogleCloudPlatform/opentelemetry-operations-go/blob/master/exporter/metric/metric.go#L115

It allows you to pass in sdk push.Options and applies them directly. You could do something similar here, but for traces, meaning you provide a way for users to specify all current and future sdktrace options (you wouldn't need to add SDKConfig, Resource, etc).

i.e. something like:

func NewExportPipeline(opts []Option, topts ...sdktrace.Option) (*apitrace.Provider, func(), error) {
	...

	tp, err := sdktrace.NewProvider(
		append([]sdktrace.Option{
			sdktrace.WithSyncer(&Exporter{traceExporter: te},
		}, topts...)...,
	)

It would also be nice to separate the registration of the trace provider in an InstallNewPipeline function similar to what's done in the metric exporter.

@stevencl1013
Copy link
Contributor Author

I keep running into this issue with the timeout test. It passes on my machine when I run make precommit, but for some reason in Circle it fails because the rpc code is Unknown instead of DeadlineExceeded. Not sure what's causing it

Copy link
Contributor

@james-bebbington james-bebbington left a comment

Choose a reason for hiding this comment

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

LGTM

texporter.WithProjectID(projectID),
_, flush, err := texporter.InstallNewPipeline(
[]texporter.Option {texporter.WithProjectID(projectID)},
// For the demonstration, use sdktrace.AlwaysSample sampler to sample all traces.
Copy link
Contributor

Choose a reason for hiding this comment

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

Should it be

Suggested change
// For the demonstration, use sdktrace.AlwaysSample sampler to sample all traces.
// For this example code we use sdktrace.AlwaysSample sampler to sample all traces.

cloudtrace.WithProjectID(projectID),
_, flush, err := cloudtrace.InstallNewPipeline(
[]cloudtrace.Option {cloudtrace.WithProjectID(projectID)},
// For the demonstration, use sdktrace.AlwaysSample sampler to sample all traces.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
// For the demonstration, use sdktrace.AlwaysSample sampler to sample all traces.
// For this example code we use sdktrace.AlwaysSample sampler to sample all traces.

texporter.WithProjectID(projectID),
// other optional exporter options
},
// For the demonstration, use sdktrace.AlwaysSample sampler to sample all traces.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
// For the demonstration, use sdktrace.AlwaysSample sampler to sample all traces.
// This example code uses sdktrace.AlwaysSample sampler to sample all traces.

@james-bebbington
Copy link
Contributor

I keep running into this issue with the timeout test. It passes on my machine when I run make precommit, but for some reason in Circle it fails because the rpc code is Unknown instead of DeadlineExceeded. Not sure what's causing it

That's weird. I just reran the build and it worked 😕

@james-bebbington james-bebbington changed the title Create pipeline method Added create trace pipeline method (Beaking Change: removes implementation of "SpanBatcher") Jul 8, 2020
@james-bebbington james-bebbington changed the title Added create trace pipeline method (Beaking Change: removes implementation of "SpanBatcher") Added create trace pipeline method (Breaking Change: removes implementation of "SpanBatcher") Jul 8, 2020
@james-bebbington james-bebbington merged commit 4bf57be into GoogleCloudPlatform:master Jul 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants