Skip to content

Commit

Permalink
Merge pull request #346 from Clever/wag-9.1.0
Browse files Browse the repository at this point in the history
Bump version and generate
  • Loading branch information
Nikhil Bhatia authored Feb 24, 2023
2 parents 936d1e0 + 86df8b3 commit 3ad19c5
Show file tree
Hide file tree
Showing 13 changed files with 180 additions and 247 deletions.
270 changes: 52 additions & 218 deletions gen-go/client/client.go

Large diffs are not rendered by default.

3 changes: 0 additions & 3 deletions gen-go/client/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
6 changes: 6 additions & 0 deletions gen-go/models/outputs.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package models

import "fmt"

func (o BadRequest) Error() string {
return o.Message
}
Expand All @@ -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)
}
46 changes: 46 additions & 0 deletions gen-go/models/unknown_response.go

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

3 changes: 2 additions & 1 deletion gen-go/server/db/dynamodb/dynamodb.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
53 changes: 38 additions & 15 deletions gen-go/servertracing/tracing.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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() {
Expand All @@ -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)
}))
}
Expand Down
5 changes: 5 additions & 0 deletions gen-js/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion gen-js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2285,7 +2285,7 @@ module.exports.Errors = Errors;

module.exports.DefaultCircuitOptions = defaultCircuitOptions;

const version = "0.14.3";
const version = "0.15.1";
const versionHeader = "X-Client-Version";
module.exports.Version = version;
module.exports.VersionHeader = versionHeader;
2 changes: 1 addition & 1 deletion gen-js/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "workflow-manager",
"version": "0.14.3",
"version": "0.15.1",
"description": "Orchestrator for AWS Step Functions",
"main": "index.js",
"dependencies": {
Expand Down
13 changes: 7 additions & 6 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
18 changes: 18 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down Expand Up @@ -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=
Expand All @@ -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=
Expand All @@ -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=
Expand All @@ -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=
Expand Down
4 changes: 3 additions & 1 deletion scripts/force_refresh_workflows.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand Down Expand Up @@ -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)
}
Expand Down
2 changes: 1 addition & 1 deletion swagger.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 3ad19c5

Please sign in to comment.