Skip to content
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
9 changes: 1 addition & 8 deletions .github/cite/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,7 @@ OUT=${5:-cite-$SCHEME.xml}
# run that silently tested nothing fails instead of passing.
MIN_PASSED=${MIN_PASSED:-15}

# SHIGOLA_PORT, falling back to the pre-rename TEGOLA_PORT so an existing caller
# keeps working. internal/env.Getenv resolves the same way and warns on the
# legacy name; warn here too, or the deprecation is silent in exactly the place
# someone is still using it.
if [ -z "${SHIGOLA_PORT:-}" ] && [ -n "${TEGOLA_PORT:-}" ]; then
echo "warning: TEGOLA_PORT is deprecated, use SHIGOLA_PORT" >&2
fi
SHIGOLA_PORT=${SHIGOLA_PORT:-${TEGOLA_PORT:-8081}}
SHIGOLA_PORT=${SHIGOLA_PORT:-8081}
TE_PORT=${TE_PORT:-8080}
TE_IMAGE=${TE_IMAGE:-ogccite/ets-ogcapi-tiles10}
TE_NAME=${TE_NAME:-cite-teamengine}
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/ogc_cite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,12 +104,12 @@ jobs:
# workflow-level `env:` default would not -- that takes precedence over the
# process environment and would pin the port at its literal.
#
# The TEGOLA_PORT leg must match run.sh exactly. Without it, setting only
# the legacy name binds the server on 8081 while the suite polls 9081, and
# the only symptom is run.sh's readiness poll timing out.
# The default must match run.sh's. Otherwise the server binds one port
# while the suite polls another, and the only symptom is run.sh's
# readiness poll timing out.
- name: Start shigola
run: |
"${{ runner.temp }}/shigola" serve --config .github/cite/config.toml --port ":${SHIGOLA_PORT:-${TEGOLA_PORT:-8081}}" &
"${{ runner.temp }}/shigola" serve --config .github/cite/config.toml --port ":${SHIGOLA_PORT:-8081}" &
echo $! > shigola.pid

# Both declared tiling schemes: the tile differs because the same ground is
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/on_pr_push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,9 @@ jobs:

# AWS S3 tests
RUN_S3_TESTS: yes
# The bucket keeps its pre-rename name: it is an existing S3 bucket,
# and a bucket cannot be renamed, only replaced. Rename it here when
# that happens.
AWS_TEST_BUCKET: tegola-ci
AWS_REGION: us-east-2

Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ yarn-error.log*
*.njsproj
*.sln
*.sw?
cmd/tegola_lambda/tegola_lambda
cmd/shigola_lambda/shigola_lambda

# Coverage profiles. The measured baseline in ci/coverage-baseline.txt is
# committed; the profile it is derived from is a build artifact and is not.
Expand Down
2 changes: 1 addition & 1 deletion atlas/atlas.go
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@ func (a *Atlas) SetObservability(o observability.Interface) {
}
for _, aMap := range a.maps {

collectors, err := aMap.Collectors("tegola", o.CollectorConfig)
collectors, err := aMap.Collectors(metricPrefix, o.CollectorConfig)
if err != nil {
log.Errorf("failed to register collector for map: %v ignoring", aMap.Name)
continue
Expand Down
12 changes: 9 additions & 3 deletions atlas/cache_collectors.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ import (
"github.com/MapColonies/shigola/observability"
)

// metricPrefix names every metric family atlas publishes on behalf of
// something else: the cache's pool and chain counters, and each map's provider
// collectors. It matches the prefix the prometheus observer gives its own
// families, so one product publishes under one name.
const metricPrefix = "shigola"

// cacheStatsCollector publishes the write pool's and the chain's counters.
//
// They cannot publish themselves: observability imports cache, so cache can
Expand Down Expand Up @@ -52,7 +58,7 @@ func newCacheStatsCollector(prefix string, pool *cache.WritePool, chain cache.Ch
slotsInFlight: desc("_write_slots_in_flight",
"Detached cache writes currently in flight. Alert on this approaching capacity: drops only begin once the pool is already exhausted."),
slotsCapacity: desc("_write_slots_capacity",
"Configured detached write slots (TEGOLA_OPTIONS=DetachedWriteSlots)."),
"Configured detached write slots (SHIGOLA_OPTIONS=DetachedWriteSlots)."),

dropped: desc("_writes_dropped_total",
"Detached writes never attempted because the pool was full at admission."),
Expand All @@ -64,7 +70,7 @@ func newCacheStatsCollector(prefix string, pool *cache.WritePool, chain cache.Ch
failed: desc("_writes_failed_total", "Detached writes attempted that returned an error."),
completed: desc("_writes_completed_total", "Detached writes attempted that succeeded."),
writeDuration: desc("_write_duration_seconds_total",
"Cumulative duration of completed detached writes. A mean when divided by writes_completed_total; read the tail from tegola_cache_tier_duration_seconds{sub_command=\"set\"} instead."),
"Cumulative duration of completed detached writes. A mean when divided by writes_completed_total; read the tail from shigola_cache_tier_duration_seconds{sub_command=\"set\"} instead."),

promotions: desc("_promotions_total", "Tiles promoted into an earlier tier after a lower-tier hit."),
promotionsDropped: desc("_promotions_dropped_total", "Promotions the write pool refused at admission."),
Expand Down Expand Up @@ -122,5 +128,5 @@ func cacheCollectors(c cache.Interface) []observability.Collector {
return nil
}

return []observability.Collector{newCacheStatsCollector("shigola_cache", pool, chain)}
return []observability.Collector{newCacheStatsCollector(metricPrefix+"_cache", pool, chain)}
}
2 changes: 1 addition & 1 deletion atlas/cache_multi_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ func TestMultiCacheEndToEnd(t *testing.T) {
t.Fatalf("building the hot-tier lens: unexpected error: %v", err)
}

// Write the durable tier only — what `tegola cache seed` does by default,
// Write the durable tier only — what `shigola cache seed` does by default,
// including its synchronous writes. Without those the write is handed to
// the detached pool and Set returns before anything has been written, which
// is exactly why the CLI path sets the flag.
Expand Down
39 changes: 39 additions & 0 deletions atlas/cache_observability_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
"github.com/MapColonies/shigola/internal/faketier"
"github.com/MapColonies/shigola/observability"
"github.com/MapColonies/shigola/observability/prometheus"
"github.com/MapColonies/shigola/provider"
)

// The prometheus observer registers against prometheus.DefaultRegisterer, so
Expand Down Expand Up @@ -428,3 +429,41 @@ func TestErrorsCounterIsPrefixed(t *testing.T) {
t.Errorf("hot tier errors: got %v, expected 1", got)
}
}

// collectingProvider is an MVT provider that publishes one gauge under
// whatever prefix the atlas hands it, so the test reads the prefix off the
// metric name an operator would actually scrape.
type collectingProvider struct {
provider.MVTTiler
}

func (collectingProvider) Collectors(prefix string, _ func(string) map[string]interface{}) ([]observability.Collector, error) {
return []observability.Collector{
promclient.NewGauge(promclient.GaugeOpts{Name: prefix + "_collecting_provider_up"}),
}, nil
}

// TestProviderCollectorsArePrefixed pins provider metrics to the shigola_
// prefix. They were the last family still published as tegola_*, because the
// prefix was a literal at the call site rather than the one the rest of the
// metrics use.
func TestProviderCollectorsArePrefixed(t *testing.T) {
m := NewWebMercatorMap("collecting")
m.SetMVTProvider("collecting", collectingProvider{})

a := &Atlas{}
a.AddMap(m)
a.SetObservability(newObserver(t))

families, err := promclient.DefaultGatherer.Gather()
if err != nil {
t.Fatalf("gather: %v", err)
}

for _, family := range families {
if family.GetName() == "shigola_collecting_provider_up" {
return
}
}
t.Errorf("shigola_collecting_provider_up is not published")
}
2 changes: 1 addition & 1 deletion atlas/map.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ func NewWebMercatorMap(name string) Map {
}

// DefaultTileGrid is the TileMatrixSet a Map carries when nothing else names
// one: WebMercatorQuad, the grid tegola has always served.
// one: WebMercatorQuad, the only grid Tegola ever served.
//
// WebMercatorQuad is bundled and active in every build, so a failure to resolve
// it means the tms package's embedded definitions are broken — the same
Expand Down
12 changes: 6 additions & 6 deletions cache/cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ type Wrapped interface {
// NamedTier pairs one tier of a composite cache with its name.
//
// Names are public API. They appear in the tier metric label and in
// `tegola cache seed --cache-tiers`, which means they end up in dashboards,
// `shigola cache seed --cache-tiers`, which means they end up in dashboards,
// alerts and cron jobs — renaming a tier, or reordering layers such that a
// derived collision suffix shifts, silently breaks both.
type NamedTier struct {
Expand Down Expand Up @@ -156,7 +156,7 @@ func WritePoolOf(c Interface) *WritePool {
//
// The decorators forward Tiered, but the observability wrapper does not — so a
// caller that wants the tier list has to reach through it. Which callers do:
// `tegola cache seed` resolves --cache-tiers against the tree, and by then the
// `shigola cache seed` resolves --cache-tiers against the tree, and by then the
// configured cache has already been instrumented.
func TieredOf(c Interface) (Tiered, bool) {
for c != nil {
Expand Down Expand Up @@ -216,7 +216,7 @@ func InjectWritePool(c Interface, pool *WritePool) {
// ParseKey will parse a string in the format /:map/:layer/:z/:x/:y into a Key struct. The :layer value is optional
// ParseKey also supports other OS delimiters (i.e. Windows - "\")
//
// The path carries no tileMatrixSetID — tegola's native routes do not name a
// The path carries no tileMatrixSetID — the z/x/y path form does not name a
// grid — so the tile is read as a WebMercatorQuad one. Use ParseKeyForGrid when
// the grid is known.
func ParseKey(str string) (*Key, error) {
Expand All @@ -232,7 +232,7 @@ func ParseKey(str string) (*Key, error) {
// zoom, and record the grid on the returned Key.
//
// What it parses is a *request path* — ":map/:layer/:z/:x/:y", the map and layer
// optional — which names no grid, because tegola's native routes do not. The
// optional — which names no grid, because the z/x/y path form does not. The
// grid comes from the caller, which knows it from the map being served.
//
// It deliberately does not parse what Key.String writes. That form leads with
Expand Down Expand Up @@ -357,8 +357,8 @@ type Key struct {
// path or redis key from String() — partitions by grid, and so that a purge
// can address one grid's tiles as a subtree.
//
// An unset value means WebMercatorQuad, the grid tegola served before this
// field existed.
// An unset value means WebMercatorQuad, the only grid Tegola served, and so
// the grid of every key written before this field existed.
TileMatrixSetID string
MapName string
LayerName string
Expand Down
2 changes: 1 addition & 1 deletion cache/cache_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ func TestKeyStringPartitionsByGrid(t *testing.T) {
t.Fatalf("keys collide across grids: %v", webMercator.String())
}

// An unset grid means the grid tegola served before the field existed.
// An unset grid means the grid every key had before the field existed.
var legacy cache.Key = webMercator
legacy.TileMatrixSetID = ""

Expand Down
2 changes: 1 addition & 1 deletion cache/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const (
// WithoutPromotion suppresses read-through promotion for reads made with the
// returned context.
//
// `tegola cache seed` without --overwrite reads every tile through the cache
// `shigola cache seed` without --overwrite reads every tile through the cache
// before deciding whether to generate it. With promotion on, a seed over a
// large area would promote every durable-tier tile into the hot tier, in seed
// order, at seeding throughput — overwriting the live working set with cold
Expand Down
4 changes: 2 additions & 2 deletions cache/detached.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import "context"
//
// Applied once, at the top, and this is load-bearing. Detaching per tier would
// make a composite Set return before any tier write, so its fan-out would have
// no errors to join and `tegola cache seed` would report success for writes it
// no errors to join and `shigola cache seed` would report success for writes it
// never waited on. That is why a composite cache builds its children through
// ForTier, which applies the deadline and never this.
//
Expand Down Expand Up @@ -66,7 +66,7 @@ func (d *detachedCache) Get(ctx context.Context, key *Key) ([]byte, bool, error)
// written, attempted-and-failed, and dropped — where nothing was attempted and
// nil is still returned. A caller that needs the write to have actually
// happened sets WithSynchronousWrites; a caller that needs to know drops
// happened watches tegola_cache_writes_dropped_total.
// happened watches shigola_cache_writes_dropped_total.
//
// val is not copied. The write outlives this call, so a caller must not reuse
// or mutate the buffer it passes — which is already true of every backend, all
Expand Down
2 changes: 1 addition & 1 deletion cache/export_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ var (
ParseOptions = parseOptions
)

// WriteOptions returns the parsed TEGOLA_OPTIONS write-path switches.
// WriteOptions returns the parsed SHIGOLA_OPTIONS write-path switches.
func WriteOptions() (slots int, timeout, drain time.Duration) {
return detachedWriteSlots, detachedWriteTimeout, detachedWriteDrain
}
Expand Down
26 changes: 13 additions & 13 deletions cache/file/file_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,33 +46,33 @@ func TestNew(t *testing.T) {
tests := map[string]tcase{
"valid basepath": {
config: map[string]any{
"basepath": "testfiles/tegola-cache",
"basepath": "testfiles/shigola-cache",
},
expected: &file.Cache{
Basepath: "testfiles/tegola-cache",
Basepath: "testfiles/shigola-cache",
MaxZoom: shigola.MaxZ,
},
err: nil,
},
"valid basepath and max zoom": {
config: map[string]any{
"basepath": "testfiles/tegola-cache",
"basepath": "testfiles/shigola-cache",
"max_zoom": uint(9),
},
expected: &file.Cache{
Basepath: "testfiles/tegola-cache",
Basepath: "testfiles/shigola-cache",
MaxZoom: 9,
},
err: nil,
},
"valid basepath, max zoom and ttl": {
config: map[string]any{
"basepath": "testfiles/tegola-cache",
"basepath": "testfiles/shigola-cache",
"max_zoom": uint(9),
"ttl": 9,
},
expected: &file.Cache{
Basepath: "testfiles/tegola-cache",
Basepath: "testfiles/shigola-cache",
MaxZoom: 9,
Expiration: time.Duration(9) * time.Second,
},
Expand All @@ -85,7 +85,7 @@ func TestNew(t *testing.T) {
},
"invalid zoom": {
config: map[string]any{
"basepath": "testfiles/tegola-cache",
"basepath": "testfiles/shigola-cache",
"max_zoom": "foo",
},
expected: nil,
Expand Down Expand Up @@ -148,7 +148,7 @@ func TestSetGetPurge(t *testing.T) {
tests := map[string]tcase{
"get set purge": {
config: map[string]any{
"basepath": "testfiles/tegola-cache",
"basepath": "testfiles/shigola-cache",
},
key: cache.Key{
Z: 0,
Expand Down Expand Up @@ -223,7 +223,7 @@ func TestSetOverwrite(t *testing.T) {
tests := map[string]tcase{
"set overwrite": {
config: map[string]any{
"basepath": "testfiles/tegola-cache",
"basepath": "testfiles/shigola-cache",
},
key: cache.Key{
Z: 0,
Expand Down Expand Up @@ -290,7 +290,7 @@ func TestMaxZoom(t *testing.T) {
tests := map[string]tcase{
"over max zoom": {
config: map[string]any{
"basepath": "testfiles/tegola-cache",
"basepath": "testfiles/shigola-cache",
"max_zoom": uint(10),
},
key: cache.Key{
Expand All @@ -303,7 +303,7 @@ func TestMaxZoom(t *testing.T) {
},
"under max zoom": {
config: map[string]any{
"basepath": "testfiles/tegola-cache",
"basepath": "testfiles/shigola-cache",
"max_zoom": uint(10),
},
key: cache.Key{
Expand All @@ -316,7 +316,7 @@ func TestMaxZoom(t *testing.T) {
},
"equals max zoom": {
config: map[string]any{
"basepath": "testfiles/tegola-cache",
"basepath": "testfiles/shigola-cache",
"max_zoom": uint(10),
},
key: cache.Key{
Expand Down Expand Up @@ -398,7 +398,7 @@ func TestExpiration(t *testing.T) {
tests := map[string]tcase{
"get set purge": {
config: map[string]any{
"basepath": "testfiles/tegola-cache",
"basepath": "testfiles/shigola-cache",
"ttl": 1,
},
key: cache.Key{
Expand Down
2 changes: 1 addition & 1 deletion cache/multi/multi.go
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,7 @@ func TierNames(c cache.Interface) []string {

// LastTierName returns the name of the last tier in read order — the durable
// one by construction — recursing into a nested chain so the rule is "the last
// tier of the last tier". It is what `tegola cache seed` targets by default.
// tier of the last tier". It is what `shigola cache seed` targets by default.
func LastTierName(c cache.Interface) (string, bool) {
tiered, ok := cache.TieredOf(c)
if !ok {
Expand Down
Loading
Loading