-
Notifications
You must be signed in to change notification settings - Fork 0
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
Lots of tracing changes to make things easier to understand #1
Changes from all commits
1d6493c
1760122
6cef9d6
b788eec
63ec3fc
dd9ffcb
f6e4ab7
4907e3b
4e713f2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,13 @@ module DegicaDatadog | |
# Configuration for the Datadog agent. | ||
module Config | ||
class << self | ||
def init(service_name: nil, version: nil, environment: nil, repository_url: nil) | ||
@service = service_name | ||
@version = version | ||
@environment = environment | ||
@repository_url = repository_url | ||
end | ||
|
||
def enabled? | ||
%w[production staging].include?(environment) || ENV.fetch("DD_AGENT_URI", nil) | ||
end | ||
|
@@ -17,19 +24,19 @@ def statsd_client | |
end | ||
|
||
def service | ||
ENV.fetch("SERVICE_NAME", nil) | ||
@service || ENV.fetch("SERVICE_NAME", "unknown") | ||
end | ||
|
||
def version | ||
ENV.fetch("_GIT_REVISION", nil) | ||
@version || ENV.fetch("_GIT_REVISION", "unknown") | ||
end | ||
|
||
def environment | ||
ENV.fetch("RAILS_ENV", nil) | ||
@environment || ENV.fetch("RAILS_ENV", "unknown") | ||
end | ||
|
||
def repository_url | ||
"github.com/degica/#{service}" | ||
@repository_url || "github.com/degica/#{service}" | ||
end | ||
|
||
# URI including http:// prefix & port for the tracing endpoint, or nil. | ||
|
@@ -57,6 +64,10 @@ def statsd_port | |
def tracing_port | ||
datadog_agent_uri&.port || 8126 | ||
end | ||
|
||
def inspect | ||
"DegicaDatadog::Config<enabled?=#{!!enabled?} service=#{service} version=#{version} environment=#{environment} repository_url=#{repository_url} datadog_agent_host=#{datadog_agent_host} statsd_port=#{statsd_port} tracing_port=#{tracing_port}>" # rubocop:disable Layout/LineLength | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just out of curiosity, where on DD will we be able to see this? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This won't be on DD, but it's what you get when you open up an |
||
end | ||
end | ||
end | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!