Skip to content
This repository has been archived by the owner on Oct 9, 2023. It is now read-only.

Commit

Permalink
cleaned up
Browse files Browse the repository at this point in the history
Signed-off-by: Daniel Rammer <[email protected]>
  • Loading branch information
hamersaw committed Mar 9, 2023
1 parent 1810069 commit 2568ebc
Show file tree
Hide file tree
Showing 9 changed files with 246 additions and 44 deletions.
1 change: 0 additions & 1 deletion cli/pflags/api/namedtype_enumer.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions storage/cached_rawstore.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func (s *cachedRawStore) Head(ctx context.Context, reference DataReference) (Met

// ReadRaw retrieves a byte array from the Blob store or an error
func (s *cachedRawStore) ReadRaw(ctx context.Context, reference DataReference) (io.ReadCloser, error) {
ctx, span := telemetryutils.NewSpan(ctx, "blobstore-client", "flytestdlib.storage.cachedRawStore/ReadRaw")
ctx, span := telemetryutils.NewSpan(ctx, telemetryutils.BlobstoreClientTracer, "flytestdlib.storage.cachedRawStore/ReadRaw")
defer span.End()

key := []byte(reference)
Expand Down Expand Up @@ -88,7 +88,7 @@ func (s *cachedRawStore) ReadRaw(ctx context.Context, reference DataReference) (

// WriteRaw stores a raw byte array.
func (s *cachedRawStore) WriteRaw(ctx context.Context, reference DataReference, size int64, opts Options, raw io.Reader) error {
ctx, span := telemetryutils.NewSpan(ctx, "blobstore-client", "flytestdlib.storage.cachedRawStore/WriteRaw")
ctx, span := telemetryutils.NewSpan(ctx, telemetryutils.BlobstoreClientTracer, "flytestdlib.storage.cachedRawStore/WriteRaw")
defer span.End()

var buf bytes.Buffer
Expand Down
4 changes: 2 additions & 2 deletions storage/protobuf_store.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ type DefaultProtobufStore struct {
}

func (s DefaultProtobufStore) ReadProtobuf(ctx context.Context, reference DataReference, msg proto.Message) error {
ctx, span := telemetryutils.NewSpan(ctx, "blobstore-client", "flytestdlib.storage.DefaultProtobufStore/ReadProtobuf")
ctx, span := telemetryutils.NewSpan(ctx, telemetryutils.BlobstoreClientTracer, "flytestdlib.storage.DefaultProtobufStore/ReadProtobuf")
defer span.End()

rc, err := s.ReadRaw(ctx, reference)
Expand Down Expand Up @@ -67,7 +67,7 @@ func (s DefaultProtobufStore) ReadProtobuf(ctx context.Context, reference DataRe
}

func (s DefaultProtobufStore) WriteProtobuf(ctx context.Context, reference DataReference, opts Options, msg proto.Message) error {
ctx, span := telemetryutils.NewSpan(ctx, "blobstore-client", "flytestdlib.storage.DefaultProtobufStore/WriteProtobuf")
ctx, span := telemetryutils.NewSpan(ctx, telemetryutils.BlobstoreClientTracer, "flytestdlib.storage.DefaultProtobufStore/WriteProtobuf")
defer span.End()

t := s.metrics.MarshalTime.Start()
Expand Down
12 changes: 6 additions & 6 deletions telemetryutils/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,18 @@ var (
)

type Config struct {
FileConfig FileConfig `json:"file", pflag:",TODO"`
JaegerConfig JaegerConfig `json:"jaeger", pflag:",TODO"`
FileConfig FileConfig `json:"file" pflag:",Configuration for exporting telemetry traces to a file"`
JaegerConfig JaegerConfig `json:"jaeger" pflag:",Configuration for exporting telemetry traces to a jaeger"`
}

type FileConfig struct {
Enabled bool `json:"enabled" pflag:",TODO"`
Filename string `json:"filename" pflag:",TODO"`
Enabled bool `json:"enabled" pflag:",Set to true to enable the file exporter"`
Filename string `json:"filename" pflag:",Filename to store exported telemetry traces"`
}

type JaegerConfig struct {
Enabled bool `json:"enabled" pflag:",TODO"`
Endpoint string `json:"endpoint" pflag:",TODO"`
Enabled bool `json:"enabled" pflag:",Set to true to enable the jaeger exporter"`
Endpoint string `json:"endpoint" pflag:",Endpoint for the jaeger telemtry trace ingestor"`
}

func GetConfig() *Config {
Expand Down
58 changes: 58 additions & 0 deletions telemetryutils/config_flags.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

158 changes: 158 additions & 0 deletions telemetryutils/config_flags_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 8 additions & 3 deletions telemetryutils/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ import (

"github.com/flyteorg/flytestdlib/version"

//"go.opentelemetry.io/otel"
//"go.opentelemetry.io/otel/attribute"
"go.opentelemetry.io/otel/exporters/stdout/stdouttrace"
"go.opentelemetry.io/otel/exporters/jaeger"
"go.opentelemetry.io/otel/sdk/resource"
Expand All @@ -15,6 +13,14 @@ import (
semconv "go.opentelemetry.io/otel/semconv/v1.12.0"
)

const (
AdminClientTracer = "admin-client"
BlobstoreClientTracer = "blobstore-client"
DataCatalogClientTracer = "datacatalog-client"
FlytePropellerTracer = "flytepropeller"
K8sClientTracer = "k8s-client"
)

var tracerProviders = make(map[string]*trace.TracerProvider)
var noopTracerProvider = rawtrace.NewNoopTracerProvider()

Expand Down Expand Up @@ -85,6 +91,5 @@ func GetTracerProvider(serviceName string) rawtrace.TracerProvider {
return t
}

// TODO @hamersaw - add warning "tracerProvider 'foo' not registered"
return noopTracerProvider
}
Loading

0 comments on commit 2568ebc

Please sign in to comment.