This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package version | |
var ( | |
Version = "0.0.1" | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import "log" | |
var ( | |
version = "0.0.1" | |
runner = "client-1.0.0" | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
percy@DESKTOP-3DP516F:~/development/buildflags$ go build -ldflags="-help" | |
# programmingpercy.tech/buildflags | |
usage: link [options] main.o | |
-B note | |
add an ELF NT_GNU_BUILD_ID note when using ELF | |
-E entry | |
set entry symbol name | |
-H type | |
set header type | |
-I linker |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
global: | |
scrape_interval: 5s | |
external_labels: | |
monitor: 'cadence-monitor' | |
scrape_configs: | |
- job_name: 'prometheus' | |
static_configs: | |
- targets: # addresses to scrape | |
- 'localhost:9090' | |
- 'cadence:8000' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// SetupCadenceClient is used to create the client we can use | |
func SetupCadenceClient() (*CadenceClient, error) { | |
// Create a dispatcher used to communicate with server | |
dispatcher := yarpc.NewDispatcher(yarpc.Config{ | |
Name: cadenceClientName, | |
Outbounds: yarpc.Outbounds{ | |
// This shouldnt be hard coded in real app | |
// This is a map, so we store this communication channel on "cadence-frontend" | |
cadenceService: {Unary: grpc.NewTransport().NewSingleOutbound("localhost:7833")}, | |
}, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
localprom "programmingpercy/cadence-tavern/prometheus" | |
_ "programmingpercy/cadence-tavern/workflows/greetings" | |
_ "programmingpercy/cadence-tavern/workflows/orders" | |
_ "go.uber.org/cadence/.gen/go/cadence" | |
"go.uber.org/cadence/.gen/go/cadence/workflowserviceclient" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package prometheus | |
import ( | |
"time" | |
prom "github.com/m3db/prometheus_client_golang/prometheus" | |
"github.com/uber-go/tally" | |
"github.com/uber-go/tally/prometheus" | |
"go.uber.org/zap" | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Start API | |
go run *.go | |
// New Terminal | |
// Send CURL | |
percy@dev:~/development/cadence-demo/app/api$ curl localhost:8080/greetings -d '{"name": "Percy", "age": 22}' | |
// RESPONSE | |
{"name":"Percy","lastVisit":"2022-03-04T07:21:33.1540528+01:00","timesVisited":1,"age":22} | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"context" | |
"log" | |
"net/http" | |
"time" | |
"go.uber.org/cadence/client" | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Order is used to send a signal to the worker | |
func (cc *CadenceClient) Order(w http.ResponseWriter, r *http.Request) { | |
// Grab order info from body | |
var orderInfo orders.Order | |
err := json.NewDecoder(r.Body).Decode(&orderInfo) | |
if err != nil { | |
http.Error(w, err.Error(), http.StatusBadRequest) | |
return | |
} |