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

Commit

Permalink
Set default project when on GCP (#526)
Browse files Browse the repository at this point in the history
  • Loading branch information
draffensperger authored and songy23 committed Apr 16, 2019
1 parent eef0179 commit 73558e6
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ exporters:
topic: "opencensus-spans"

stackdriver:
project: "your-project-id"
project: "my-project-id" # optional, defaults to agent project if run on GCP
enable_tracing: true

zipkin:
Expand Down
2 changes: 1 addition & 1 deletion cmd/ocagent/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ receivers:

exporters:
stackdriver:
project: "project-id"
project: "project-id" # Optional if on GCP, defaults to agent project
enable_tracing: true

zipkin:
Expand Down
8 changes: 4 additions & 4 deletions exporter/stackdriverexporter/stackdriver.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,12 @@ func StackdriverTraceExportersFromViper(v *viper.Viper) (tps []consumer.TraceCon

// TODO: For each ProjectID, create a different exporter
// or at least a unique Stackdriver client per ProjectID.
if sc.ProjectID == "" {
return nil, nil, nil, fmt.Errorf("Stackdriver config requires a project ID")
}

sde, serr := stackdriver.NewExporter(stackdriver.Options{
ProjectID: sc.ProjectID,
// If the project ID is an empty string, it will be set by default based on
// the project this is running on in GCP.
ProjectID: sc.ProjectID,

MetricPrefix: sc.MetricPrefix,

// Stackdriver Metrics mandates a minimum of 60 seconds for
Expand Down

0 comments on commit 73558e6

Please sign in to comment.