Skip to content

Commit

Permalink
chore: simplify logging
Browse files Browse the repository at this point in the history
  • Loading branch information
stakach committed Jan 13, 2025
1 parent efc4674 commit 1401a88
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 67 deletions.
54 changes: 7 additions & 47 deletions shard.lock
Original file line number Diff line number Diff line change
Expand Up @@ -36,22 +36,10 @@ shards:
git: https://github.com/vici37/crystal-kcov.git
version: 0.2.3+git.commit.7e49fe22d7d47040c9de77eb77a6daa76ce0655d

csuuid:
git: https://github.com/wyhaines/csuuid.cr.git
version: 1.0.2

db:
git: https://github.com/crystal-lang/crystal-db.git
version: 0.13.1

debug:
git: https://github.com/sija/debug.cr.git
version: 2.0.4

defined:
git: https://github.com/wyhaines/defined.cr.git
version: 0.3.6

email:
git: https://github.com/arcage/crystal-email.git
version: 0.7.1
Expand Down Expand Up @@ -104,10 +92,6 @@ shards:
git: https://github.com/luckyframework/lucky_router.git
version: 0.6.0

nbchannel:
git: https://github.com/wyhaines/nbchannel.cr.git
version: 0.1.0

neuroplastic:
git: https://github.com/spider-gazelle/neuroplastic.git
version: 1.13.1
Expand All @@ -120,26 +104,10 @@ shards:
git: https://github.com/spider-gazelle/openssl_ext.git
version: 2.4.4

opentelemetry-api:
git: https://github.com/wyhaines/opentelemetry-api.cr.git
version: 0.5.2+git.commit.77c9232ca6ff7de52529f309a0cb20b8459f7b20

opentelemetry-instrumentation:
git: https://github.com/wyhaines/opentelemetry-instrumentation.cr.git
version: 0.6.0+git.commit.6978cfe19aa590fb61fd7fdc0a25eb0c78674309

opentelemetry-sdk:
git: https://github.com/wyhaines/opentelemetry-sdk.cr.git
version: 0.6.4+git.commit.c7237732135f6d0cab84abc6bb6d438c9f8f9d66

pars:
git: https://github.com/spider-gazelle/pars.git
version: 1.1.0

parse_date:
git: https://github.com/wyhaines/parsedate.cr.git
version: 0.1.2

pegmatite:
git: https://github.com/jemc/crystal-pegmatite.git
version: 0.2.3+git.commit.f1b6d99b71774f82b6bd17b825d6d7fdd5de38f9
Expand All @@ -158,7 +126,7 @@ shards:

placeos-log-backend:
git: https://github.com/place-labs/log-backend.git
version: 0.11.4
version: 0.13.0

placeos-models:
git: https://github.com/placeos/models.git
Expand All @@ -176,10 +144,6 @@ shards:
git: https://github.com/spider-gazelle/promise.git
version: 3.2.0

protobuf:
git: https://github.com/jeromegn/protobuf.cr.git
version: 2.3.1

redis:
git: https://github.com/stefanwille/crystal-redis.git
version: 2.9.1
Expand All @@ -192,17 +156,13 @@ shards:
git: https://github.com/place-labs/secrets-env.git
version: 1.3.1

splay_tree_map:
git: https://github.com/wyhaines/splay_tree_map.cr.git
version: 0.3.0

time-ext:
git: https://github.com/wyhaines/time-ext.cr.git
version: 1.0.1
simple_retry:
git: https://github.com/spider-gazelle/simple_retry.git
version: 1.1.1

tracer:
git: https://github.com/wyhaines/tracer.cr.git
version: 0.3.2
tasker:
git: https://github.com/spider-gazelle/tasker.git
version: 2.1.4

ulid:
git: https://github.com/place-labs/ulid.git
Expand Down
3 changes: 3 additions & 0 deletions shard.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ dependencies:
github: place-labs/secrets-env
version: ~> 1.3

simple_retry:
github: spider-gazelle/simple_retry

development_dependencies:
ameba:
github: crystal-ameba/ameba
Expand Down
3 changes: 0 additions & 3 deletions src/config.cr
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,6 @@ require "./api"
require "./constants"
require "action-controller"

# Require telemetry after application code
require "./telemetry"

# Server
require "action-controller/server"

Expand Down
14 changes: 8 additions & 6 deletions src/search-ingest.cr
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
require "log_helper"

require "simple_retry"
require "./constants"
require "./search-ingest/*"

module SearchIngest
def self.wait_for_elasticsearch
Retriable.retry(
max_elapsed_time: 1.minutes,
on_retry: ->(_e : Exception, n : Int32, _t : Time::Span, _i : Time::Span) {
Log.warn { "attempt #{n} connecting to #{SearchIngest::Elastic.settings.host}:#{SearchIngest::Elastic.settings.port}" }
}
attempt = 0
SimpleRetry.try_to(
base_interval: 1.second,
max_elapsed_time: 1.minute
) do
attempt += 1
Log.warn { "attempt #{attempt} connecting to #{SearchIngest::Elastic.settings.host}:#{SearchIngest::Elastic.settings.port}" } if attempt > 1

# Ensure elastic is available
raise "retry" unless SearchIngest::Elastic.healthy?
end
Expand Down
11 changes: 0 additions & 11 deletions src/telemetry.cr

This file was deleted.

0 comments on commit 1401a88

Please sign in to comment.