From 28b8de2601cf0ce10850a1a0a419c7611d820b09 Mon Sep 17 00:00:00 2001 From: nbhatia823 Date: Fri, 24 Feb 2023 12:50:15 -0800 Subject: [PATCH 1/3] Generate --- gen-go/client/client.go | 270 +++++--------------------- gen-go/client/go.mod | 3 - gen-go/models/outputs.go | 6 + gen-go/models/unknown_response.go | 46 +++++ gen-go/server/db/dynamodb/dynamodb.go | 3 +- gen-go/servertracing/tracing.go | 53 +++-- gen-js/index.d.ts | 5 + gen-js/index.js | 2 +- gen-js/package.json | 2 +- 9 files changed, 151 insertions(+), 239 deletions(-) create mode 100644 gen-go/models/unknown_response.go diff --git a/gen-go/client/client.go b/gen-go/client/client.go index 1cdbd65b..f14960cc 100644 --- a/gen-go/client/client.go +++ b/gen-go/client/client.go @@ -1,14 +1,13 @@ package client -// Using Alpha version of WAG Yay! import ( "bytes" "context" "crypto/md5" "encoding/json" "fmt" + "io/ioutil" "net/http" - "os" "strconv" "strings" "time" @@ -19,13 +18,6 @@ import ( wcl "github.com/Clever/wag/logging/wagclientlogger" "github.com/afex/hystrix-go/hystrix" - - "go.opentelemetry.io/otel" - "go.opentelemetry.io/otel/propagation" - "go.opentelemetry.io/otel/sdk/resource" - sdktrace "go.opentelemetry.io/otel/sdk/trace" - "go.opentelemetry.io/otel/sdk/trace/tracetest" - semconv "go.opentelemetry.io/otel/semconv/v1.10.0" ) var _ = json.Marshal @@ -34,7 +26,7 @@ var _ = strconv.FormatInt var _ = bytes.Compare // Version of the client. -const Version = "0.14.3" +const Version = "0.15.0" // VersionHeader is sent with every request. const VersionHeader = "X-Client-Version" @@ -54,196 +46,23 @@ type WagClient struct { var _ Client = (*WagClient)(nil) -//This pattern is used instead of using closures for greater transparency and the ability to implement additional interfaces. -type options struct { - transport http.RoundTripper - logger wcl.WagClientLogger - instrumentor Instrumentor - exporter sdktrace.SpanExporter -} - -type Option interface { - apply(*options) -} - -//WithLogger sets client logger option. -func WithLogger(log wcl.WagClientLogger) Option { - return loggerOption{Log: log} -} - -type loggerOption struct { - Log wcl.WagClientLogger -} - -func (l loggerOption) apply(opts *options) { - opts.logger = l.Log -} - -type roundTripperOption struct { - rt http.RoundTripper -} - -func (t roundTripperOption) apply(opts *options) { - opts.transport = t.rt -} - -// WithRoundTripper allows you to pass in intrumented/custom roundtrippers which will then wrap the -// transport roundtripper -func WithRoundTripper(t http.RoundTripper) Option { - return roundTripperOption{rt: t} -} - -// Instrumentor is a function that creates an instrumented round tripper -type Instrumentor func(baseTransport http.RoundTripper, spanNameCtxValue interface{}, tp sdktrace.TracerProvider) http.RoundTripper - -// WithInstrumentor sets a instrumenting function that will be used to wrap the roundTripper for tracing. -// For standard instrumentation with tracing use tracing.InstrumentedTransport, default is non-instrumented. - -func WithInstrumentor(fn Instrumentor) Option { - return instrumentorOption{instrumentor: fn} -} - -type instrumentorOption struct { - instrumentor Instrumentor -} - -func (i instrumentorOption) apply(opts *options) { - opts.instrumentor = i.instrumentor -} - -// WithExporter sets client span exporter option. -func WithExporter(se sdktrace.SpanExporter) Option { - return exporterOption{exporter: se} -} - -type exporterOption struct { - exporter sdktrace.SpanExporter -} - -func (se exporterOption) apply(opts *options) { - opts.exporter = se.exporter -} - -//----------------------BEGIN LOGGING RELATED FUNCTIONS---------------------- +// New creates a new client. The base path, logger, and http transport are configurable. +// The logger provided should be specifically created for this wag client. If tracing is required, +// provide an instrumented transport using the wag clientconfig module. If no tracing is required, pass nil to use +// the default transport. +func New(basePath string, logger wcl.WagClientLogger, transport *http.RoundTripper) *WagClient { -//NewLogger creates a logger for id that produces logs at and below the indicated level. -//Level indicated the level at and below which logs are created. -func NewLogger(id string, level wcl.LogLevel) PrintlnLogger { - return PrintlnLogger{id: id, level: level} -} - -type PrintlnLogger struct { - level wcl.LogLevel - id string -} - -func (w PrintlnLogger) Log(level wcl.LogLevel, message string, m map[string]interface{}) { - - if level >= level { - m["id"] = w.id - jsonLog, err := json.Marshal(m) - if err != nil { - jsonLog, err = json.Marshal(map[string]interface{}{"Error Marshalling Log": err}) - } - fmt.Println(string(jsonLog)) + t := http.DefaultTransport + if transport != nil { + t = *transport } -} - -//----------------------END LOGGING RELATED FUNCTIONS------------------------ - -//----------------------BEGIN TRACING RELATED FUNCTIONS---------------------- - -// newResource returns a resource describing this application. -// Used for setting up tracer provider -func newResource() *resource.Resource { - r, _ := resource.Merge( - resource.Default(), - resource.NewWithAttributes( - semconv.SchemaURL, - semconv.ServiceNameKey.String("workflow-manager"), - semconv.ServiceVersionKey.String("0.14.3"), - ), - ) - return r -} - -func newTracerProvider(exporter sdktrace.SpanExporter, samplingProbability float64) *sdktrace.TracerProvider { - - tp := sdktrace.NewTracerProvider( - // We use the default ID generator. In order for sampling to work (at least with this sampler) - // the ID generator must generate trace IDs uniformly at random from the entire space of uint64. - // For example, the default x-ray ID generator does not do this. - sdktrace.WithSampler(sdktrace.AlwaysSample()), - // These maximums are to guard against something going wrong and sending a ton of data unexpectedly - sdktrace.WithSpanLimits(sdktrace.SpanLimits{ - AttributeCountLimit: 100, - EventCountLimit: 100, - LinkCountLimit: 100, - }), - //Batcher is more efficient, switch to it after testing - // sdktrace.WithSyncer(exporter), - sdktrace.WithBatcher(exporter), - sdktrace.WithResource(newResource()), - ) - otel.SetTracerProvider(tp) - otel.SetTextMapPropagator(propagation.NewCompositeTextMapPropagator(propagation.TraceContext{}, propagation.Baggage{})) - return tp -} - -func doNothing(baseTransport http.RoundTripper, spanNameCtxValue interface{}, tp sdktrace.TracerProvider) http.RoundTripper { - return baseTransport -} - -func determineSampling() (samplingProbability float64, err error) { - - // If we're running locally, then turn off sampling. Otherwise sample - // 1% or whatever TRACING_SAMPLING_PROBABILITY specifies. - samplingProbability = 0.01 - isLocal := os.Getenv("_IS_LOCAL") == "true" - if isLocal { - fmt.Println("Set to Local") - samplingProbability = 1.0 - } else if v := os.Getenv("TRACING_SAMPLING_PROBABILITY"); v != "" { - samplingProbabilityFromEnv, err := strconv.ParseFloat(v, 64) - if err != nil { - return 0, fmt.Errorf("could not parse '%s' to float", v) - } - samplingProbability = samplingProbabilityFromEnv - } - return -} - -//----------------------END TRACING RELATEDFUNCTIONS---------------------- - -// New creates a new client. The base path and http transport are configurable. -func New(ctx context.Context, basePath string, opts ...Option) *WagClient { - - defaultTransport := http.DefaultTransport - defaultLogger := NewLogger("workflow-manager-wagclient", wcl.Info) - defaultExporter := tracetest.NewNoopExporter() - defaultInstrumentor := doNothing basePath = strings.TrimSuffix(basePath, "/") base := baseDoer{} + // For the short-term don't use the default retry policy since its 5 retries can 5X // the traffic. Once we've enabled circuit breakers by default we can turn it on. retry := retryDoer{d: base, retryPolicy: SingleRetryPolicy{}} - options := options{ - transport: defaultTransport, - logger: defaultLogger, - exporter: defaultExporter, - instrumentor: defaultInstrumentor, - } - - for _, o := range opts { - o.apply(&options) - } - - samplingProbability := 1.0 // TODO: Put back logic to set this to 1 for local, 0.1 otherwise etc. - // samplingProbability := determineSampling() - - tp := newTracerProvider(options.exporter, samplingProbability) - options.transport = options.instrumentor(options.transport, ctx, *tp) circuit := &circuitBreakerDoer{ d: &retry, @@ -251,19 +70,20 @@ func New(ctx context.Context, basePath string, opts ...Option) *WagClient { debug: true, // one circuit for each service + url pair circuitName: fmt.Sprintf("workflow-manager-%s", shortHash(basePath)), - logger: options.logger, + logger: logger, } circuit.init() + client := &WagClient{ basePath: basePath, requestDoer: circuit, client: &http.Client{ - Transport: options.transport, + Transport: t, }, retryDoer: &retry, circuitDoer: circuit, defaultTimeout: 5 * time.Second, - logger: options.logger, + logger: logger, } client.SetCircuitBreakerSettings(DefaultCircuitBreakerSettings) return client @@ -271,7 +91,10 @@ func New(ctx context.Context, basePath string, opts ...Option) *WagClient { // NewFromDiscovery creates a client from the discovery environment variables. This method requires // the three env vars: SERVICE_WORKFLOW_MANAGER_HTTP_(HOST/PORT/PROTO) to be set. Otherwise it returns an error. -func NewFromDiscovery(opts ...Option) (*WagClient, error) { +// The logger provided should be specifically created for this wag client. If tracing is required, +// provide an instrumented transport using the wag clientconfig module. If no tracing is required, pass nil to use +// the default transport. +func NewFromDiscovery(logger wcl.WagClientLogger, transport *http.RoundTripper) (*WagClient, error) { url, err := discovery.URL("workflow-manager", "default") if err != nil { url, err = discovery.URL("workflow-manager", "http") // Added fallback to maintain reverse compatibility @@ -279,7 +102,7 @@ func NewFromDiscovery(opts ...Option) (*WagClient, error) { return nil, err } } - return New(context.Background(), url, opts...), nil + return New(url, logger, transport), nil } // SetRetryPolicy sets a the given retry policy for all requests. @@ -343,11 +166,6 @@ func (c *WagClient) SetTimeout(timeout time.Duration) { c.defaultTimeout = timeout } -// SetTransport sets the http transport used by the client. -func (c *WagClient) SetTransport(t http.RoundTripper) { - // c.client.Transport = tracing.NewTransport(t, opNameCtx{}) -} - // HealthCheck makes a GET request to /_health // Checks if the service is healthy // 200: nil @@ -436,7 +254,8 @@ func (c *WagClient) doHealthCheckRequest(ctx context.Context, req *http.Request, return &output default: - return &models.InternalError{Message: fmt.Sprintf("Unknown status code %v", resp.StatusCode)} + bs, _ := ioutil.ReadAll(resp.Body) + return models.UnknownResponse{StatusCode: int64(resp.StatusCode), Body: string(bs)} } } @@ -544,7 +363,8 @@ func (c *WagClient) doPostStateResourceRequest(ctx context.Context, req *http.Re return nil, &output default: - return nil, &models.InternalError{Message: fmt.Sprintf("Unknown status code %v", resp.StatusCode)} + bs, _ := ioutil.ReadAll(resp.Body) + return nil, models.UnknownResponse{StatusCode: int64(resp.StatusCode), Body: string(bs)} } } @@ -651,7 +471,8 @@ func (c *WagClient) doDeleteStateResourceRequest(ctx context.Context, req *http. return &output default: - return &models.InternalError{Message: fmt.Sprintf("Unknown status code %v", resp.StatusCode)} + bs, _ := ioutil.ReadAll(resp.Body) + return models.UnknownResponse{StatusCode: int64(resp.StatusCode), Body: string(bs)} } } @@ -763,7 +584,8 @@ func (c *WagClient) doGetStateResourceRequest(ctx context.Context, req *http.Req return nil, &output default: - return nil, &models.InternalError{Message: fmt.Sprintf("Unknown status code %v", resp.StatusCode)} + bs, _ := ioutil.ReadAll(resp.Body) + return nil, models.UnknownResponse{StatusCode: int64(resp.StatusCode), Body: string(bs)} } } @@ -877,7 +699,8 @@ func (c *WagClient) doPutStateResourceRequest(ctx context.Context, req *http.Req return nil, &output default: - return nil, &models.InternalError{Message: fmt.Sprintf("Unknown status code %v", resp.StatusCode)} + bs, _ := ioutil.ReadAll(resp.Body) + return nil, models.UnknownResponse{StatusCode: int64(resp.StatusCode), Body: string(bs)} } } @@ -974,7 +797,8 @@ func (c *WagClient) doGetWorkflowDefinitionsRequest(ctx context.Context, req *ht return nil, &output default: - return nil, &models.InternalError{Message: fmt.Sprintf("Unknown status code %v", resp.StatusCode)} + bs, _ := ioutil.ReadAll(resp.Body) + return nil, models.UnknownResponse{StatusCode: int64(resp.StatusCode), Body: string(bs)} } } @@ -1082,7 +906,8 @@ func (c *WagClient) doNewWorkflowDefinitionRequest(ctx context.Context, req *htt return nil, &output default: - return nil, &models.InternalError{Message: fmt.Sprintf("Unknown status code %v", resp.StatusCode)} + bs, _ := ioutil.ReadAll(resp.Body) + return nil, models.UnknownResponse{StatusCode: int64(resp.StatusCode), Body: string(bs)} } } @@ -1194,7 +1019,8 @@ func (c *WagClient) doGetWorkflowDefinitionVersionsByNameRequest(ctx context.Con return nil, &output default: - return nil, &models.InternalError{Message: fmt.Sprintf("Unknown status code %v", resp.StatusCode)} + bs, _ := ioutil.ReadAll(resp.Body) + return nil, models.UnknownResponse{StatusCode: int64(resp.StatusCode), Body: string(bs)} } } @@ -1317,7 +1143,8 @@ func (c *WagClient) doUpdateWorkflowDefinitionRequest(ctx context.Context, req * return nil, &output default: - return nil, &models.InternalError{Message: fmt.Sprintf("Unknown status code %v", resp.StatusCode)} + bs, _ := ioutil.ReadAll(resp.Body) + return nil, models.UnknownResponse{StatusCode: int64(resp.StatusCode), Body: string(bs)} } } @@ -1429,7 +1256,8 @@ func (c *WagClient) doGetWorkflowDefinitionByNameAndVersionRequest(ctx context.C return nil, &output default: - return nil, &models.InternalError{Message: fmt.Sprintf("Unknown status code %v", resp.StatusCode)} + bs, _ := ioutil.ReadAll(resp.Body) + return nil, models.UnknownResponse{StatusCode: int64(resp.StatusCode), Body: string(bs)} } } @@ -1627,7 +1455,8 @@ func (c *WagClient) doGetWorkflowsRequest(ctx context.Context, req *http.Request return nil, "", &output default: - return nil, "", &models.InternalError{Message: fmt.Sprintf("Unknown status code %v", resp.StatusCode)} + bs, _ := ioutil.ReadAll(resp.Body) + return nil, "", models.UnknownResponse{StatusCode: int64(resp.StatusCode), Body: string(bs)} } } @@ -1744,7 +1573,8 @@ func (c *WagClient) doStartWorkflowRequest(ctx context.Context, req *http.Reques return nil, &output default: - return nil, &models.InternalError{Message: fmt.Sprintf("Unknown status code %v", resp.StatusCode)} + bs, _ := ioutil.ReadAll(resp.Body) + return nil, models.UnknownResponse{StatusCode: int64(resp.StatusCode), Body: string(bs)} } } @@ -1862,7 +1692,8 @@ func (c *WagClient) doCancelWorkflowRequest(ctx context.Context, req *http.Reque return &output default: - return &models.InternalError{Message: fmt.Sprintf("Unknown status code %v", resp.StatusCode)} + bs, _ := ioutil.ReadAll(resp.Body) + return models.UnknownResponse{StatusCode: int64(resp.StatusCode), Body: string(bs)} } } @@ -1974,7 +1805,8 @@ func (c *WagClient) doGetWorkflowByIDRequest(ctx context.Context, req *http.Requ return nil, &output default: - return nil, &models.InternalError{Message: fmt.Sprintf("Unknown status code %v", resp.StatusCode)} + bs, _ := ioutil.ReadAll(resp.Body) + return nil, models.UnknownResponse{StatusCode: int64(resp.StatusCode), Body: string(bs)} } } @@ -2097,7 +1929,8 @@ func (c *WagClient) doResumeWorkflowByIDRequest(ctx context.Context, req *http.R return nil, &output default: - return nil, &models.InternalError{Message: fmt.Sprintf("Unknown status code %v", resp.StatusCode)} + bs, _ := ioutil.ReadAll(resp.Body) + return nil, models.UnknownResponse{StatusCode: int64(resp.StatusCode), Body: string(bs)} } } @@ -2213,7 +2046,8 @@ func (c *WagClient) doResolveWorkflowByIDRequest(ctx context.Context, req *http. return &output default: - return &models.InternalError{Message: fmt.Sprintf("Unknown status code %v", resp.StatusCode)} + bs, _ := ioutil.ReadAll(resp.Body) + return models.UnknownResponse{StatusCode: int64(resp.StatusCode), Body: string(bs)} } } diff --git a/gen-go/client/go.mod b/gen-go/client/go.mod index fcef1c85..8abd5b44 100644 --- a/gen-go/client/go.mod +++ b/gen-go/client/go.mod @@ -9,9 +9,6 @@ require ( github.com/afex/hystrix-go v0.0.0-20180502004556-fa1af6a1f4f5 github.com/donovanhide/eventsource v0.0.0-20171031113327-3ed64d21fb0b github.com/smartystreets/goconvey v1.7.2 // indirect - go.opentelemetry.io/otel v1.9.0 - go.opentelemetry.io/otel/sdk v1.9.0 - ) //Replace directives will work locally but mess up imports. replace github.com/Clever/workflow-manager/gen-go/models => ../models \ No newline at end of file diff --git a/gen-go/models/outputs.go b/gen-go/models/outputs.go index 9ad87cf1..e51f5ba9 100644 --- a/gen-go/models/outputs.go +++ b/gen-go/models/outputs.go @@ -1,5 +1,7 @@ package models +import "fmt" + func (o BadRequest) Error() string { return o.Message } @@ -15,3 +17,7 @@ func (o InternalError) Error() string { func (o NotFound) Error() string { return o.Message } + +func (u UnknownResponse) Error() string { + return fmt.Sprintf("unknown response with status: %d body: %s", u.StatusCode, u.Body) +} diff --git a/gen-go/models/unknown_response.go b/gen-go/models/unknown_response.go new file mode 100644 index 00000000..a1c26fac --- /dev/null +++ b/gen-go/models/unknown_response.go @@ -0,0 +1,46 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// UnknownResponse unknown response +// +// swagger:model UnknownResponse +type UnknownResponse struct { + + // body + Body string `json:"body,omitempty"` + + // status code + StatusCode int64 `json:"statusCode,omitempty"` +} + +// Validate validates this unknown response +func (m *UnknownResponse) Validate(formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *UnknownResponse) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *UnknownResponse) UnmarshalBinary(b []byte) error { + var res UnknownResponse + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/gen-go/server/db/dynamodb/dynamodb.go b/gen-go/server/db/dynamodb/dynamodb.go index eb38353c..d88b11c3 100644 --- a/gen-go/server/db/dynamodb/dynamodb.go +++ b/gen-go/server/db/dynamodb/dynamodb.go @@ -3,11 +3,12 @@ package dynamodb import ( "context" "errors" + "time" + "github.com/Clever/workflow-manager/gen-go/models" "github.com/Clever/workflow-manager/gen-go/server/db" "github.com/aws/aws-sdk-go/service/dynamodb/dynamodbiface" "github.com/go-openapi/strfmt" - "time" ) // Config is used to create a new DB struct. diff --git a/gen-go/servertracing/tracing.go b/gen-go/servertracing/tracing.go index 2caa04b4..d5293049 100644 --- a/gen-go/servertracing/tracing.go +++ b/gen-go/servertracing/tracing.go @@ -12,7 +12,6 @@ import ( "github.com/Clever/kayvee-go/v7/logger" - // "github.com/davecgh/go-spew/spew" "go.opentelemetry.io/contrib/instrumentation/github.com/gorilla/mux/otelmux" "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/attribute" @@ -71,7 +70,6 @@ func newTracerProvider(exporter sdktrace.SpanExporter, resource *resource.Resour } samplingProbability = samplingProbabilityFromEnv } - fmt.Println("samplingProbability:", samplingProbability) tp := sdktrace.NewTracerProvider( // We use the default ID generator. In order for sampling to work (at least with this sampler) @@ -112,38 +110,59 @@ func SetupGlobalTraceProviderAndExporterForTest() (*tracetest.InMemoryExporter, // Right now we only support logging IDs in the format that Datadog expects. func MuxServerMiddleware(serviceName string) func(http.Handler) http.Handler { otlmux := otelmux.Middleware(serviceName, otelmux.WithPropagators(otel.GetTextMapPropagator())) - fmt.Println("Adding mux server middleware") + // fmt.Println("Adding mux server middleware") return func(h http.Handler) http.Handler { return otlmux(http.HandlerFunc(func(rw http.ResponseWriter, r *http.Request) { var rid string - // otelmux has extracted the span. now put it into the ctx-specific logger - // var carrier propagation.HeaderCarrier = propagation.HeaderCarrier{} - - // otelmux has extracted the span. now put it into the ctx-specific logger + var crid string s := trace.SpanFromContext(r.Context()) bag := baggage.FromContext(r.Context()) + + // Prefer to grab values from baggage + crid = bag.Member("clever-request-id").Value() rid = bag.Member("X-Request-ID").Value() + // If the values aren't set in baggage grab the traceid from otel, and the x-request-id + // from the headers (set by envoy) + if crid == "" { + crid = s.SpanContext().TraceID().String() + } + if rid == "" { rid = r.Header.Get("X-Request-ID") - if rid == "" { - rid = s.SpanContext().TraceID().String() - } } + s.SetAttributes(attribute.String("clever-request-id", crid)) + + cridMember, err := baggage.NewMember("clever-request-id", crid) + if err != nil { + s.RecordError(err) + } + + bag, err = bag.SetMember(cridMember) + if err != nil { + s.RecordError(err) + } + + logger.FromContext(r.Context()).AddContext("clever-request-id", crid) + rw.Header().Add("clever-request-id", crid) + if rid != "" { s.SetAttributes(attribute.String("X-Request-ID", rid)) - member, err := baggage.NewMember("X-Request-ID", rid) + ridMember, err := baggage.NewMember("X-Request-ID", rid) + if err != nil { + s.RecordError(err) + } + bag, err = bag.SetMember(ridMember) if err != nil { s.RecordError(err) } - bag, err = bag.SetMember(member) - ctx := baggage.ContextWithBaggage(r.Context(), bag) - r = r.WithContext(ctx) + + // Envoy logs store this as request_id so lets match it for easier filtering. + logger.FromContext(r.Context()).AddContext("request_id", rid) rw.Header().Add("X-Request-ID", rid) - logger.FromContext(r.Context()).AddContext("X-Request-ID", rid) } if sc := s.SpanContext(); sc.HasTraceID() { @@ -159,6 +178,10 @@ func MuxServerMiddleware(serviceName string) func(http.Handler) http.Handler { fmt.Sprintf("%d", binary.BigEndian.Uint64(spanIDBs))) } } + + ctx := baggage.ContextWithBaggage(r.Context(), bag) + r = r.WithContext(ctx) + h.ServeHTTP(rw, r) })) } diff --git a/gen-js/index.d.ts b/gen-js/index.d.ts index 72120a29..75ec1cdf 100644 --- a/gen-js/index.d.ts +++ b/gen-js/index.d.ts @@ -343,6 +343,11 @@ declare namespace WorkflowManager { type StateResourceType = ("JobDefinitionARN" | "ActivityARN" | "LambdaFunctionARN" | "TaskARN"); + type UnknownResponse = { + body?: string; + statusCode?: number; +}; + type UpdateWorkflowDefinitionParams = { NewWorkflowDefinitionRequest?: NewWorkflowDefinitionRequest; name: string; diff --git a/gen-js/index.js b/gen-js/index.js index 60104e6a..bbc51f4a 100644 --- a/gen-js/index.js +++ b/gen-js/index.js @@ -2285,7 +2285,7 @@ module.exports.Errors = Errors; module.exports.DefaultCircuitOptions = defaultCircuitOptions; -const version = "0.14.3"; +const version = "0.15.0"; const versionHeader = "X-Client-Version"; module.exports.Version = version; module.exports.VersionHeader = versionHeader; diff --git a/gen-js/package.json b/gen-js/package.json index af50e4b6..d9e0b6c1 100644 --- a/gen-js/package.json +++ b/gen-js/package.json @@ -1,6 +1,6 @@ { "name": "workflow-manager", - "version": "0.14.3", + "version": "0.15.0", "description": "Orchestrator for AWS Step Functions", "main": "index.js", "dependencies": { From 4ef6f9d5917119ad643ffa00803e950a55b28e45 Mon Sep 17 00:00:00 2001 From: nbhatia823 Date: Fri, 24 Feb 2023 12:50:45 -0800 Subject: [PATCH 2/3] version --- gen-go/client/client.go | 2 +- gen-js/index.js | 2 +- gen-js/package.json | 2 +- swagger.yml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/gen-go/client/client.go b/gen-go/client/client.go index f14960cc..fae5ac40 100644 --- a/gen-go/client/client.go +++ b/gen-go/client/client.go @@ -26,7 +26,7 @@ var _ = strconv.FormatInt var _ = bytes.Compare // Version of the client. -const Version = "0.15.0" +const Version = "0.15.1" // VersionHeader is sent with every request. const VersionHeader = "X-Client-Version" diff --git a/gen-js/index.js b/gen-js/index.js index bbc51f4a..4c0a7201 100644 --- a/gen-js/index.js +++ b/gen-js/index.js @@ -2285,7 +2285,7 @@ module.exports.Errors = Errors; module.exports.DefaultCircuitOptions = defaultCircuitOptions; -const version = "0.15.0"; +const version = "0.15.1"; const versionHeader = "X-Client-Version"; module.exports.Version = version; module.exports.VersionHeader = versionHeader; diff --git a/gen-js/package.json b/gen-js/package.json index d9e0b6c1..fd6bc42a 100644 --- a/gen-js/package.json +++ b/gen-js/package.json @@ -1,6 +1,6 @@ { "name": "workflow-manager", - "version": "0.15.0", + "version": "0.15.1", "description": "Orchestrator for AWS Step Functions", "main": "index.js", "dependencies": { diff --git a/swagger.yml b/swagger.yml index 7b362ff7..05403d16 100644 --- a/swagger.yml +++ b/swagger.yml @@ -4,7 +4,7 @@ info: description: Orchestrator for AWS Step Functions # when changing the version here, make sure to # re-run `make generate` to generate clients and server - version: 0.15.0 + version: 0.15.1 x-npm-package: workflow-manager schemes: - http From 86df8b3ced580558a105eb19080f57668f0d7336 Mon Sep 17 00:00:00 2001 From: nbhatia823 Date: Fri, 24 Feb 2023 12:55:40 -0800 Subject: [PATCH 3/3] Update client creation --- go.mod | 13 +++++++------ go.sum | 18 ++++++++++++++++++ scripts/force_refresh_workflows.go | 4 +++- 3 files changed, 28 insertions(+), 7 deletions(-) diff --git a/go.mod b/go.mod index 08ce24a3..ef6e7e52 100644 --- a/go.mod +++ b/go.mod @@ -7,6 +7,7 @@ require ( github.com/Clever/go-process-metrics v0.4.0 github.com/Clever/kayvee-go/v7 v7.7.0 github.com/Clever/launch-gen v0.0.0-20230222233441-17c275320509 + github.com/Clever/wag/clientconfig/v9 v9.0.0-20230222234634-ddf6a6175e43 github.com/Clever/workflow-manager/gen-go/client v0.0.0-00010101000000-000000000000 github.com/Clever/workflow-manager/gen-go/models v0.0.0-00010101000000-000000000000 github.com/aws/aws-lambda-go v1.34.1 @@ -27,12 +28,12 @@ require ( github.com/satori/go.uuid v1.2.0 github.com/stretchr/testify v1.8.0 go.opentelemetry.io/contrib/instrumentation/github.com/gorilla/mux/otelmux v0.34.0 - go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.34.0 - go.opentelemetry.io/otel v1.9.0 - go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.9.0 - go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.9.0 - go.opentelemetry.io/otel/sdk v1.9.0 - go.opentelemetry.io/otel/trace v1.9.0 + go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.35.0 + go.opentelemetry.io/otel v1.10.0 + go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.10.0 + go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.10.0 + go.opentelemetry.io/otel/sdk v1.10.0 + go.opentelemetry.io/otel/trace v1.10.0 golang.org/x/sync v0.0.0-20220601150217-0de741cfad7f golang.org/x/time v0.0.0-20210220033141-f8bda1e9f3ba golang.org/x/xerrors v0.0.0-20220609144429-65e65417b02f diff --git a/go.sum b/go.sum index 61e0c9d9..15f8594c 100644 --- a/go.sum +++ b/go.sum @@ -69,9 +69,13 @@ github.com/Clever/kayvee-go/v7 v7.7.0 h1:quAQ5s1mcLqXjU3AgLg1A2lOIH102G8zEkasvJd github.com/Clever/kayvee-go/v7 v7.7.0/go.mod h1:B2IcQE7OK8rpYvDotSAvCtfZqZ1UqTs1YacM+YFtxR8= github.com/Clever/launch-gen v0.0.0-20230222233441-17c275320509 h1:MnKINIQc6ZVuNC6IztCq/1JODd+wm6RYKTTKfXpO7Wk= github.com/Clever/launch-gen v0.0.0-20230222233441-17c275320509/go.mod h1:SN5Cf87o/YLSIXOmShxJfVfN6yADVr3S+IlHD2sltXA= +github.com/Clever/wag/clientconfig/v9 v9.0.0-20230222234634-ddf6a6175e43 h1:JkgujK23vEbuWz6875kvmHD1SKH1wTAIU9DICEnePqw= +github.com/Clever/wag/clientconfig/v9 v9.0.0-20230222234634-ddf6a6175e43/go.mod h1:av9GGongId9fOu4KdTTLDcDs6S823riF3iOgb5bB8ZU= github.com/Clever/wag/logging/wagclientlogger v0.0.0-20220916194010-36f974d66e08/go.mod h1:NPerIFemV/7da/vNGALWkky+mit4ulSa24NSalIXgpo= github.com/Clever/wag/logging/wagclientlogger v0.0.0-20221024182247-2bf828ef51be h1:1q4fCi5CfB+ru7uqnwRg4xWKBDwwATDptNxebm2Kx0g= github.com/Clever/wag/logging/wagclientlogger v0.0.0-20221024182247-2bf828ef51be/go.mod h1:NPerIFemV/7da/vNGALWkky+mit4ulSa24NSalIXgpo= +github.com/Clever/wag/logging/wagclientlogger v0.0.0-20230110184825-edb52117e67a h1:IMRK5WZ0kEFhe4tc/7GNQ4M3JaLCudB+1KsuxvSj97o= +github.com/Clever/wag/logging/wagclientlogger v0.0.0-20230110184825-edb52117e67a/go.mod h1:NPerIFemV/7da/vNGALWkky+mit4ulSa24NSalIXgpo= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/PuerkitoBio/purell v1.1.1 h1:WEQqlqaGbrPkxLJWfBwQmfEAE1Z7ONdDLqrN38tNFfI= github.com/PuerkitoBio/purell v1.1.1/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0= @@ -421,14 +425,20 @@ go.opentelemetry.io/contrib/instrumentation/github.com/gorilla/mux/otelmux v0.34 go.opentelemetry.io/contrib/instrumentation/github.com/gorilla/mux/otelmux v0.34.0/go.mod h1:zMu+r6aEorSQi8Ad0Y1fNrznm+VM8F10D2WlZp3HeFw= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.34.0 h1:9NkMW03wwEzPtP/KciZ4Ozu/Uz5ZA7kfqXJIObnrjGU= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.34.0/go.mod h1:548ZsYzmT4PL4zWKRd8q/N4z0Wxzn/ZxUE+lkEpwWQA= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.35.0 h1:Ajldaqhxqw/gNzQA45IKFWLdG7jZuXX/wBW1d5qvbUI= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.35.0/go.mod h1:9NiG9I2aHTKkcxqCILhjtyNA1QEiCjdBACv4IvrFQ+c= go.opentelemetry.io/otel v1.3.0/go.mod h1:PWIKzi6JCp7sM0k9yZ43VX+T345uNbAkDKwHVjb2PTs= go.opentelemetry.io/otel v1.8.0/go.mod h1:2pkj+iMj0o03Y+cW6/m8Y4WkRdYN3AvCXCnzRMp9yvM= go.opentelemetry.io/otel v1.9.0 h1:8WZNQFIB2a71LnANS9JeyidJKKGOOremcUtb/OtHISw= go.opentelemetry.io/otel v1.9.0/go.mod h1:np4EoPGzoPs3O67xUVNoPPcmSvsfOxNlNA4F4AC+0Eo= +go.opentelemetry.io/otel v1.10.0 h1:Y7DTJMR6zs1xkS/upamJYk0SxxN4C9AqRd77jmZnyY4= +go.opentelemetry.io/otel v1.10.0/go.mod h1:NbvWjCthWHKBEUMpf0/v8ZRZlni86PpGFEMA9pnQSnQ= go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.3.0/go.mod h1:VpP4/RMn8bv8gNo9uK7/IMY4mtWLELsS+JIP0inH0h4= go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.8.0/go.mod h1:78XhIg8Ht9vR4tbLNUhXsiOnE2HOuSeKAiAcoVQEpOY= go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.9.0 h1:ggqApEjDKczicksfvZUCxuvoyDmR6Sbm56LwiK8DVR0= go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.9.0/go.mod h1:78XhIg8Ht9vR4tbLNUhXsiOnE2HOuSeKAiAcoVQEpOY= +go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.10.0 h1:TaB+1rQhddO1sF71MpZOZAuSPW1klK2M8XxfrBMfK7Y= +go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.10.0/go.mod h1:78XhIg8Ht9vR4tbLNUhXsiOnE2HOuSeKAiAcoVQEpOY= go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.26.0/go.mod h1:1E0NE+3ywwedkOEl3d7nFjyI/bqRECMhI3xTGh13pxY= go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.31.0 h1:H0+xwv4shKw0gfj/ZqR13qO2N/dBQogB1OcRjJjV39Y= go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.31.0/go.mod h1:nkenGD8vcvs0uN6WhR90ZVHQlgDsRmXicnNadMnk+XQ= @@ -437,8 +447,12 @@ go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v0.31.0 h1:BaQ go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v0.31.0/go.mod h1:VRr8tlXQEsTdesDCh0qBe2iKDWhpi3ZqDYw6VlZ8MhI= go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.9.0 h1:NN90Cuna0CnBg8YNu1Q0V35i2E8LDByFOwHRCq/ZP9I= go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.9.0/go.mod h1:0EsCXjZAiiZGnLdEUXM9YjCKuuLZMYyglh2QDXcYKVA= +go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.10.0 h1:pDDYmo0QadUPal5fwXoY1pmMpFcdyhXOmL5drCrI3vU= +go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.10.0/go.mod h1:Krqnjl22jUJ0HgMzw5eveuCvFDXY4nSYb4F8t5gdrag= go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.9.0 h1:M0/hqGuJBLeIEu20f89H74RGtqV2dn+SFWEz9ATAAwY= go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.9.0/go.mod h1:K5G92gbtCrYJ0mn6zj9Pst7YFsDFuvSYEhYKRMcufnM= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.10.0 h1:KtiUEhQmj/Pa874bVYKGNVdq8NPKiacPbaRRtgXi+t4= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.10.0/go.mod h1:OfUCyyIiDvNXHWpcWgbF+MWvqPZiNa3YDEnivcnYsV0= go.opentelemetry.io/otel/internal/metric v0.26.0/go.mod h1:CbBP6AxKynRs3QCbhklyLUtpfzbqCLiafV9oY2Zj1Jk= go.opentelemetry.io/otel/metric v0.26.0/go.mod h1:c6YL0fhRo4YVoNs6GoByzUgBp36hBL523rECoZA5UWg= go.opentelemetry.io/otel/metric v0.31.0 h1:6SiklT+gfWAwWUR0meEMxQBtihpiEs4c+vL9spDTqUs= @@ -447,6 +461,8 @@ go.opentelemetry.io/otel/sdk v1.3.0/go.mod h1:rIo4suHNhQwBIPg9axF8V9CA72Wz2mKF1t go.opentelemetry.io/otel/sdk v1.8.0/go.mod h1:uPSfc+yfDH2StDM/Rm35WE8gXSNdvCg023J6HeGNO0c= go.opentelemetry.io/otel/sdk v1.9.0 h1:LNXp1vrr83fNXTHgU8eO89mhzxb/bbWAsHG6fNf3qWo= go.opentelemetry.io/otel/sdk v1.9.0/go.mod h1:AEZc8nt5bd2F7BC24J5R0mrjYnpEgYHyTcM/vrSple4= +go.opentelemetry.io/otel/sdk v1.10.0 h1:jZ6K7sVn04kk/3DNUdJ4mqRlGDiXAVuIG+MMENpTNdY= +go.opentelemetry.io/otel/sdk v1.10.0/go.mod h1:vO06iKzD5baltJz1zarxMCNHFpUlUiOy4s65ECtn6kE= go.opentelemetry.io/otel/sdk/export/metric v0.26.0/go.mod h1:UpqzSnUOjFeSIVQLPp3pYIXfB/MiMFyXXzYT/bercxQ= go.opentelemetry.io/otel/sdk/metric v0.26.0/go.mod h1:2VIeK0kS1YvRLFg3J58ptZTXYpiWlkq2n5RQt6w7He8= go.opentelemetry.io/otel/sdk/metric v0.31.0 h1:2sZx4R43ZMhJdteKAlKoHvRgrMp53V1aRxvEf5lCq8Q= @@ -455,6 +471,8 @@ go.opentelemetry.io/otel/trace v1.3.0/go.mod h1:c/VDhno8888bvQYmbYLqe41/Ldmr/KKu go.opentelemetry.io/otel/trace v1.8.0/go.mod h1:0Bt3PXY8w+3pheS3hQUt+wow8b1ojPaTBoTCh2zIFI4= go.opentelemetry.io/otel/trace v1.9.0 h1:oZaCNJUjWcg60VXWee8lJKlqhPbXAPB51URuR47pQYc= go.opentelemetry.io/otel/trace v1.9.0/go.mod h1:2737Q0MuG8q1uILYm2YYVkAyLtOofiTNGg6VODnOiPo= +go.opentelemetry.io/otel/trace v1.10.0 h1:npQMbR8o7mum8uF95yFbOEJffhs1sbCOfDh8zAJiH5E= +go.opentelemetry.io/otel/trace v1.10.0/go.mod h1:Sij3YYczqAdz+EhmGhE6TpTxUO5/F/AzrK+kxfGqySM= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= go.opentelemetry.io/proto/otlp v0.11.0/go.mod h1:QpEjXPrNQzrFDZgoTo49dgHR9RYRSrg3NAKnUGl9YpQ= go.opentelemetry.io/proto/otlp v0.18.0/go.mod h1:H7XAot3MsfNsj7EXtrA2q5xSNQ10UqI405h3+duxN4U= diff --git a/scripts/force_refresh_workflows.go b/scripts/force_refresh_workflows.go index 97a19a7a..e8836367 100644 --- a/scripts/force_refresh_workflows.go +++ b/scripts/force_refresh_workflows.go @@ -7,6 +7,8 @@ import ( "sync/atomic" "time" + "github.com/Clever/wag/clientconfig/v9" + "github.com/Clever/workflow-manager/gen-go/client" "github.com/Clever/workflow-manager/gen-go/models" ) @@ -47,7 +49,7 @@ func main() { os.Setenv("SERVICE_WORKFLOW_MANAGER_HTTP_HOST", "production--workflow-manager--a6127c9c.int.clever.com") os.Setenv("SERVICE_WORKFLOW_MANAGER_HTTP_PORT", "443") os.Setenv("SERVICE_WORKFLOW_MANAGER_HTTP_PROTO", "https") - cl, err := client.NewFromDiscovery() + cl, err := client.NewFromDiscovery(clientconfig.WithoutTracing("workflow-manager")) if err != nil { log.Fatal(err) }