mirror of
https://github.com/zitadel/zitadel.git
synced 2025-11-14 09:43:39 +00:00
add tracing and refactor some api pkgs
This commit is contained in:
25
internal/tracing/google/config.go
Normal file
25
internal/tracing/google/config.go
Normal file
@@ -0,0 +1,25 @@
|
||||
package google
|
||||
|
||||
import (
|
||||
"go.opencensus.io/trace"
|
||||
"google.golang.org/grpc/codes"
|
||||
"google.golang.org/grpc/status"
|
||||
|
||||
"github.com/caos/zitadel/internal/tracing"
|
||||
)
|
||||
|
||||
type Config struct {
|
||||
ProjectID string
|
||||
MetricPrefix string
|
||||
Fraction float64
|
||||
}
|
||||
|
||||
func (c *Config) NewTracer() error {
|
||||
if !envIsSet() {
|
||||
return status.Error(codes.InvalidArgument, "env not properly set, GOOGLE_APPLICATION_CREDENTIALS is misconfigured or missing")
|
||||
}
|
||||
|
||||
tracing.T = &Tracer{projectID: c.ProjectID, metricPrefix: c.MetricPrefix, sampler: trace.ProbabilitySampler(c.Fraction)}
|
||||
|
||||
return tracing.T.Start()
|
||||
}
|
||||
Reference in New Issue
Block a user