This repository has been archived by the owner on Oct 3, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
options: allow passing in TLS credentials
Allow passing in TLS credentials. This PR is the sister to ocagent's census-instrumentation/opencensus-service#415 We shall have the ability to have a secure ocagent and applications that share the certificate through whatever certificate sharing mechanism e.g. rotation, file etc. For an example ```go func main() { // Please take at look at https://godoc.org/google.golang.org/grpc/credentials#TransportCredentials // for ways on how to initialize gRPC TransportCredentials. creds, err := credentials.NewClientTLSFromFile("my-cert.pem", "") if err != nil { log.Fatalf("Failed to create gRPC client TLS credentials: %v", err) } exp, err := ocagent.NewExporter(ocagent.WithTLSCredentials(creds), ocagent.WithServiceName("engine")) if err != nil { log.Fatalf("Failed to create the agent exporter: %v", err) } defer exp.Stop() // Now register it as a trace exporter. trace.RegisterExporter(exp) // Then use the OpenCensus tracing library, like we normally would. ctx, span := trace.StartSpan(context.Background(), "Securely-Talking-To-Agent-Span") defer span.End() for i := 0; i < 10; i++ { _, iSpan := trace.StartSpan(ctx, fmt.Sprintf("Sample-%d", i)) <-time.After(6 * time.Millisecond) iSpan.End() } } ``` Fixes #44
- Loading branch information
Showing
3 changed files
with
61 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters