Skip to content
This repository has been archived by the owner on May 2, 2022. It is now read-only.

closing and required parameters #6

Merged
merged 2 commits into from Jul 19, 2017
Merged

closing and required parameters #6

merged 2 commits into from Jul 19, 2017

Conversation

SamiHiltunen
Copy link
Contributor

@SamiHiltunen SamiHiltunen commented Jul 14, 2017

Hey,

I propose the following changes:

  1. Add a Close() method for the Recorder. This will allow users to flush the buffers before their application terminates and thus avoid dropping traces.

  2. Make Project ID a required parameter. Recorder throws an error at the moment if WithProjectID("--") is not given which is a bit confusing. Making it a required parameter makes the need for this parameter explicit.

  3. Invert the dependency to Google's protobuf client. This allows for easier testing or alternative implementations. Building the client should not probably be the recorder's responsibility.

* As the GCP project id is required, it is less confusing to have
  it as a required parameter in order to benefit from compile time
  checks.
@SamiHiltunen SamiHiltunen requested a review from tecbot July 14, 2017 08:31
"github.com/golang/protobuf/ptypes/timestamp"
gax "github.com/googleapis/gax-go"

Choose a reason for hiding this comment

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

One concern about gax is : This project is currently experimental and not supported

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's a dependency of the protobuf client we are using, not sure we can do much there. We are using the protobuf client directly here rather than the official StackDriver client.

Choose a reason for hiding this comment

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

ok !

README.md Outdated
if err != nil {
log.Fatalf("error creating a recorder: %v", err)
}

Choose a reason for hiding this comment

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

add defer recorder.Close() here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added 👍

* Adds a close method for the recorder. Calling close flushes the
  buffered traces and closes the underlying client.

* Inverts the dependency of the tracing client. Allows for easier
  testing and alternative implementations.
@tecbot tecbot merged commit 9a3ba70 into master Jul 19, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants