Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: jaeger traces not persisted across container restarts #82

Merged
merged 6 commits into from
Oct 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,4 @@ dist/
/starter-game

# Built binary
world
./world
rmrt1n marked this conversation as resolved.
Show resolved Hide resolved
2 changes: 1 addition & 1 deletion common/docker/service/evm.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

faucetEnabled := cfg.DockerEnv["FAUCET_ENABLED"]
if faucetEnabled == "" {
faucetEnabled = "false" //nolint:goconst // default values should be local to the service
faucetEnabled = "false"

Check warning on line 31 in common/docker/service/evm.go

View check run for this annotation

Codecov / codecov/patch

common/docker/service/evm.go#L31

Added line #L31 was not covered by tests
}

faucetAddress := cfg.DockerEnv["FAUCET_ADDRESS"]
Expand Down
21 changes: 21 additions & 0 deletions common/docker/service/jaeger.go
rmrt1n marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"fmt"

"github.com/docker/docker/api/types/container"
"github.com/docker/docker/api/types/mount"

"pkg.world.dev/world-cli/common/config"
)
Expand All @@ -19,10 +20,30 @@ func Jaeger(cfg *config.Config) Service {
Name: getJaegerContainerName(cfg),
Config: container.Config{
Image: "jaegertracing/all-in-one:1.61.0",
// hard-coding this since it won't change much and the defaults work. users most likely
// won't need to change these. note that this storage configuration isn't recommended to
// be used for production environment, but is good enough for local development.
// for more info see: https://www.jaegertracing.io/docs/1.62/deployment/#span-storage-backends
Env: []string{
"SPAN_STORAGE_TYPE=badger",
"BADGER_EPHEMERAL=false",
"BADGER_DIRECTORY_VALUE=/badger/data",
"BADGER_DIRECTORY_KEY=/badger/key",
"QUERY_ADDITIONAL_HEADERS=Access-Control-Allow-Origin:*",
},
// running as the default user (uid 10001) doesn't work on mac because the volume is owned by
// root. A way to get around this is to create another container to change the owner of the
// /badger directory. since we're not able to start services following a dependency graph yet,
// we'll just run as root. world cli is also mainly used for local dev, so the security
// benefits of running as non-root doesn't really apply here.
// src: https://github.com/jaegertracing/jaeger/issues/4906
User: "root",
rmrt1n marked this conversation as resolved.
Show resolved Hide resolved
},
HostConfig: container.HostConfig{
PortBindings: newPortMap(exposedPorts),
NetworkMode: container.NetworkMode(cfg.DockerEnv["CARDINAL_NAMESPACE"]),
Mounts: []mount.Mount{{Type: mount.TypeVolume,
Source: cfg.DockerEnv["CARDINAL_NAMESPACE"], Target: "/badger"}},
rmrt1n marked this conversation as resolved.
Show resolved Hide resolved
},
}
}
4 changes: 2 additions & 2 deletions common/docker/service/nakama.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,15 @@ func Nakama(cfg *config.Config) Service {

traceEnabled := cfg.DockerEnv["NAKAMA_TRACE_ENABLED"]
if traceEnabled == "" || !cfg.Telemetry {
traceEnabled = "false"
traceEnabled = "true"
}

traceSampleRate := cfg.DockerEnv["NAKAMA_TRACE_SAMPLE_RATE"]
if traceSampleRate == "" {
traceSampleRate = "0.6"
}

metricsEnabled := false
metricsEnabled := true
if cfg.Telemetry {
cfgMetricsEnabled, err := strconv.ParseBool(cfg.DockerEnv["NAKAMA_METRICS_ENABLED"])
if err == nil {
Expand Down
Loading