Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/0.23-dev' into brettlangdon/forc…
Browse files Browse the repository at this point in the history
…e.keep
  • Loading branch information
brettlangdon committed Apr 17, 2019
2 parents 69ea4ff + 9a6d0e6 commit 323c004
Show file tree
Hide file tree
Showing 101 changed files with 2,426 additions and 826 deletions.
1 change: 1 addition & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
DD_AGENT_HOST=localhost
DD_METRIC_AGENT_PORT=8125
DD_TRACE_AGENT_PORT=8126
TEST_DDAGENT_API_KEY=invalid_key_but_this_is_fine
TEST_ELASTICSEARCH_HOST=127.0.0.1
Expand Down
8 changes: 4 additions & 4 deletions Appraisals
Original file line number Diff line number Diff line change
Expand Up @@ -401,10 +401,10 @@ elsif Gem::Version.new('2.2.0') <= Gem::Version.new(RUBY_VERSION) \
gem 'elasticsearch-transport'
gem 'excon'
gem 'grape'
gem 'graphql'
gem 'graphql', '< 1.9.4'
gem 'grpc'
gem 'hiredis'
gem 'mongo', '< 2.5'
gem 'mongo', '>= 2.8.0'
gem 'mysql2', '< 0.5', platform: :ruby
gem 'racecar', '>= 0.3.5'
gem 'rack'
Expand Down Expand Up @@ -543,7 +543,7 @@ elsif Gem::Version.new('2.3.0') <= Gem::Version.new(RUBY_VERSION) \
gem 'graphql'
gem 'grpc'
gem 'hiredis'
gem 'mongo', '< 2.5'
gem 'mongo', '>= 2.8.0'
gem 'mysql2', '< 0.5', platform: :ruby
gem 'racecar', '>= 0.3.5'
gem 'rack'
Expand Down Expand Up @@ -576,7 +576,7 @@ elsif Gem::Version.new('2.4.0') <= Gem::Version.new(RUBY_VERSION)
gem 'graphql'
gem 'grpc'
gem 'hiredis'
gem 'mongo', '< 2.5'
gem 'mongo', '>= 2.8.0'
gem 'mysql2', '< 0.5', platform: :ruby
gem 'racecar', '>= 0.3.5'
gem 'rack'
Expand Down
66 changes: 63 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,62 @@

## [Unreleased (beta)]

## [0.22.0] - 2019-04-15

Release notes: https://github.com/DataDog/dd-trace-rb/releases/tag/v0.22.0

Git diff: https://github.com/DataDog/dd-trace-rb/compare/v0.21.2...v0.22.0

In this release we are adding initial support for the **beta** [Runtime metrics collection](https://docs.datadoghq.com/tracing/advanced/runtime_metrics/?tab=ruby) feature.

### Changed

- Add warning log if an integration is incompatible (#722) (@ericmustin)

### Added

- Initial beta support for Runtime metrics collection (#677)

## [0.21.2] - 2019-04-10

Release notes: https://github.com/DataDog/dd-trace-rb/releases/tag/v0.21.2

Git diff: https://github.com/DataDog/dd-trace-rb/compare/v0.21.1...v0.21.2

### Changed

- Support Mongo gem 2.5+ (#729, #731) (@ricbartm)

## [0.21.1] - 2019-03-26

Release notes: https://github.com/DataDog/dd-trace-rb/releases/tag/v0.21.1

Git diff: https://github.com/DataDog/dd-trace-rb/compare/v0.21.0...v0.21.1

### Changed

- Support `TAG_ENABLED` for custom instrumentation with analytics. (#728)

## [0.21.0] - 2019-03-20

Release notes: https://github.com/DataDog/dd-trace-rb/releases/tag/v0.21.0

Git diff: https://github.com/DataDog/dd-trace-rb/compare/v0.20.0...v0.21.0

### Added

- Trace analytics support (#697, #715)
- HTTP after_request span hook (#716, #724)

### Fixed

- Distributed traces with IDs in 2^64 range being dropped (#719)
- Custom logger level forced to warning (#681, #721) (@blaines, @ericmustin)

### Refactored

- Global configuration for tracing into configuration API (#714)

## [0.20.0] - 2019-03-07

Release notes: https://github.com/DataDog/dd-trace-rb/releases/tag/v0.20.0
Expand All @@ -21,7 +77,7 @@ These changes are backwards compatible, but all integration configuration should

- Enable distributed tracing by default (#701)

### Fixes
### Fixed

- Fix Rack http_server.queue spans missing from distributed traces (#709)

Expand Down Expand Up @@ -711,8 +767,12 @@ Release notes: https://github.com/DataDog/dd-trace-rb/releases/tag/v0.3.1

Git diff: https://github.com/DataDog/dd-trace-rb/compare/v0.3.0...v0.3.1

[Unreleased (stable)]: https://github.com/DataDog/dd-trace-rb/compare/v0.20.0...master
[Unreleased (beta)]: https://github.com/DataDog/dd-trace-rb/compare/v0.20.0...0.21-dev
[Unreleased (stable)]: https://github.com/DataDog/dd-trace-rb/compare/v0.22.0...master
[Unreleased (beta)]: https://github.com/DataDog/dd-trace-rb/compare/v0.22.0...0.23-dev
[0.22.0]: https://github.com/DataDog/dd-trace-rb/compare/v0.21.2...v0.22.0
[0.21.2]: https://github.com/DataDog/dd-trace-rb/compare/v0.21.1...v0.21.2
[0.21.1]: https://github.com/DataDog/dd-trace-rb/compare/v0.21.0...v0.21.1
[0.21.0]: https://github.com/DataDog/dd-trace-rb/compare/v0.20.0...v0.21.0
[0.20.0]: https://github.com/DataDog/dd-trace-rb/compare/v0.19.1...v0.20.0
[0.19.1]: https://github.com/DataDog/dd-trace-rb/compare/v0.19.0...v0.19.1
[0.19.0]: https://github.com/DataDog/dd-trace-rb/compare/v0.18.3...v0.19.0
Expand Down
27 changes: 18 additions & 9 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,39 +15,47 @@ namespace :spec do
:rails, :railsredis, :railssidekiq, :railsactivejob,
:elasticsearch, :http, :redis, :sidekiq, :sinatra]

RSpec::Core::RakeTask.new(:main) do |t|
RSpec::Core::RakeTask.new(:main) do |t, args|
t.pattern = 'spec/**/*_spec.rb'
t.exclude_pattern = 'spec/**/{contrib,benchmark,redis,opentracer}/**/*_spec.rb'
t.rspec_opts = args.to_a.join(' ')
end

RSpec::Core::RakeTask.new(:opentracer) do |t|
RSpec::Core::RakeTask.new(:opentracer) do |t, args|
t.pattern = 'spec/ddtrace/opentracer/**/*_spec.rb'
t.rspec_opts = args.to_a.join(' ')
end

RSpec::Core::RakeTask.new(:rails) do |t|
RSpec::Core::RakeTask.new(:rails) do |t, args|
t.pattern = 'spec/ddtrace/contrib/rails/**/*_spec.rb'
t.exclude_pattern = 'spec/ddtrace/contrib/rails/**/*{sidekiq,active_job,disable_env}*_spec.rb'
t.rspec_opts = args.to_a.join(' ')
end

RSpec::Core::RakeTask.new(:railsredis) do |t|
RSpec::Core::RakeTask.new(:railsredis) do |t, args|
t.pattern = 'spec/ddtrace/contrib/rails/**/*redis*_spec.rb'
t.rspec_opts = args.to_a.join(' ')
end

RSpec::Core::RakeTask.new(:railssidekiq) do |t|
RSpec::Core::RakeTask.new(:railssidekiq) do |t, args|
t.pattern = 'spec/ddtrace/contrib/rails/**/*sidekiq*_spec.rb'
t.rspec_opts = args.to_a.join(' ')
end

RSpec::Core::RakeTask.new(:railsactivejob) do |t|
RSpec::Core::RakeTask.new(:railsactivejob) do |t, args|
t.pattern = 'spec/ddtrace/contrib/rails/**/*active_job*_spec.rb'
t.rspec_opts = args.to_a.join(' ')
end

RSpec::Core::RakeTask.new(:railsdisableenv) do |t|
RSpec::Core::RakeTask.new(:railsdisableenv) do |t, args|
t.pattern = 'spec/ddtrace/contrib/rails/**/*disable_env*_spec.rb'
t.rspec_opts = args.to_a.join(' ')
end

RSpec::Core::RakeTask.new(:contrib) do |t|
RSpec::Core::RakeTask.new(:contrib) do |t, args|
# rubocop:disable Metrics/LineLength
t.pattern = 'spec/**/contrib/{analytics,configurable,integration,patchable,patcher,registerable,registry,configuration/*}_spec.rb'
t.rspec_opts = args.to_a.join(' ')
end

[
Expand Down Expand Up @@ -79,8 +87,9 @@ namespace :spec do
:sucker_punch,
:shoryuken
].each do |contrib|
RSpec::Core::RakeTask.new(contrib) do |t|
RSpec::Core::RakeTask.new(contrib) do |t, args|
t.pattern = "spec/ddtrace/contrib/#{contrib}/**/*_spec.rb"
t.rspec_opts = args.to_a.join(' ')
end
end
end
Expand Down
8 changes: 6 additions & 2 deletions ddtrace.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,13 @@ Gem::Specification.new do |spec|
spec.require_paths = ['lib']

spec.add_dependency 'msgpack'

# Optional extensions
# TODO: Move this to Appraisals?
spec.add_dependency 'opentracing', '>= 0.4.1'
spec.add_development_dependency 'dogstatsd-ruby', '>= 3.3.0'
spec.add_development_dependency 'opentracing', '>= 0.4.1'

spec.add_development_dependency 'climate_control', '~> 0.2.0'
# Development dependencies
spec.add_development_dependency 'rake', '>= 10.5'
spec.add_development_dependency 'rubocop', '= 0.49.1' if RUBY_VERSION >= '2.1.0'
spec.add_development_dependency 'rspec', '~> 3.0'
Expand All @@ -48,6 +51,7 @@ Gem::Specification.new do |spec|
spec.add_development_dependency 'builder'
spec.add_development_dependency 'ruby-prof'
spec.add_development_dependency 'sqlite3', '~> 1.3.6'
spec.add_development_dependency 'climate_control', '~> 0.2.0'

# locking transitive dependency of webmock
spec.add_development_dependency 'addressable', '~> 2.4.0'
Expand Down
26 changes: 8 additions & 18 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
version: '3.2'
services:
tracer-1.9:
build:
context: ./.circleci/images/primary
dockerfile: Dockerfile-1.9.3
image: datadog/docker-library:ddtrace_rb_1_9_3
command: /bin/bash
depends_on:
- ddagent
Expand Down Expand Up @@ -31,9 +29,7 @@ services:
- bundle-1.9:/usr/local/bundle
- gemfiles-1.9:/app/gemfiles
tracer-2.0:
build:
context: ./.circleci/images/primary
dockerfile: Dockerfile-2.0.0
image: datadog/docker-library:ddtrace_rb_2_0_0
command: /bin/bash
depends_on:
- ddagent
Expand Down Expand Up @@ -61,9 +57,7 @@ services:
- bundle-2.0:/usr/local/bundle
- gemfiles-2.0:/app/gemfiles
tracer-2.1:
build:
context: ./.circleci/images/primary
dockerfile: Dockerfile-2.1.10
image: datadog/docker-library:ddtrace_rb_2_1_10
command: /bin/bash
depends_on:
- ddagent
Expand Down Expand Up @@ -91,9 +85,7 @@ services:
- bundle-2.1:/usr/local/bundle
- gemfiles-2.1:/app/gemfiles
tracer-2.2:
build:
context: ./.circleci/images/primary
dockerfile: Dockerfile-2.2.10
image: datadog/docker-library:ddtrace_rb_2_2_10
command: /bin/bash
depends_on:
- ddagent
Expand Down Expand Up @@ -121,9 +113,7 @@ services:
- bundle-2.2:/usr/local/bundle
- gemfiles-2.2:/app/gemfiles
tracer-2.3:
build:
context: ./.circleci/images/primary
dockerfile: Dockerfile-2.3.7
image: datadog/docker-library:ddtrace_rb_2_3_7
command: /bin/bash
depends_on:
- ddagent
Expand Down Expand Up @@ -151,9 +141,7 @@ services:
- bundle-2.3:/usr/local/bundle
- gemfiles-2.3:/app/gemfiles
tracer-2.4:
build:
context: ./.circleci/images/primary
dockerfile: Dockerfile-2.4.4
image: datadog/docker-library:ddtrace_rb_2_4_4
command: /bin/bash
depends_on:
- ddagent
Expand Down Expand Up @@ -187,8 +175,10 @@ services:
- DD_BIND_HOST=0.0.0.0
- DD_API_KEY=invalid_key_but_this_is_fine
expose:
- "8125/udp"
- "8126"
ports:
- "${DD_METRIC_AGENT_PORT}:8125/udp"
- "${DD_TRACE_AGENT_PORT}:8126"
elasticsearch:
# Note: ES 5.0 dies with error:
Expand Down
54 changes: 53 additions & 1 deletion docs/GettingStarted.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ For descriptions of terminology used in APM, take a look at the [official docume
- [Filtering](#filtering)
- [Processing](#processing)
- [Trace correlation](#trace-correlation)
- [Metrics](#metrics)
- [For application runtime](#for-application-runtime)
- [OpenTracing](#opentracing)

## Compatibility
Expand Down Expand Up @@ -321,7 +323,7 @@ For a list of available integrations, and their configuration options, please re
| Grape | `grape` | `>= 1.0` | *[Link](#grape)* | *[Link](https://github.com/ruby-grape/grape)* |
| GraphQL | `graphql` | `>= 1.7.9` | *[Link](#graphql)* | *[Link](https://github.com/rmosolgo/graphql-ruby)* |
| gRPC | `grpc` | `>= 1.10` | *[Link](#grpc)* | *[Link](https://github.com/grpc/grpc/tree/master/src/rubyc)* |
| MongoDB | `mongo` | `>= 2.0, < 2.5` | *[Link](#mongodb)* | *[Link](https://github.com/mongodb/mongo-ruby-driver)* |
| MongoDB | `mongo` | `>= 2.0` | *[Link](#mongodb)* | *[Link](https://github.com/mongodb/mongo-ruby-driver)* |
| MySQL2 | `mysql2` | `>= 0.3.21` | *[Link](#mysql2)* | *[Link](https://github.com/brianmario/mysql2)* |
| Net/HTTP | `http` | *(Any supported Ruby)* | *[Link](#nethttp)* | *[Link](https://ruby-doc.org/stdlib-2.4.0/libdoc/net/http/rdoc/Net/HTTP.html)* |
| Racecar | `racecar` | `>= 0.3.5` | *[Link](#racecar)* | *[Link](https://github.com/zendesk/racecar)* |
Expand Down Expand Up @@ -1725,6 +1727,56 @@ Datadog.tracer.trace('my.operation') { logger.warn('This is a traced operation.'
# [2019-01-16 18:38:41 +0000][my_app][WARN][dd.trace_id=8545847825299552251 dd.span_id=3711755234730770098] This is a traced operation.
```

### Metrics

The tracer and its integrations can produce some additional metrics that can provide useful insight into the performance of your application. These metrics are collected with `dogstatsd-ruby`, and can be sent to the same Datadog agent to which you send your traces.

To configure your application for metrics collection:

1. [Configure your Datadog agent for StatsD](https://docs.datadoghq.com/developers/dogstatsd/#setup)
2. Add `gem 'dogstatsd-ruby'` to your Gemfile

#### For application runtime

If runtime metrics are configured, the trace library will automatically collect and send metrics about the health of your application.

To configure runtime metrics, add the following configuration:

```ruby
# config/initializers/datadog.rb
require 'datadog/statsd'
require 'ddtrace'

Datadog.configure do |c|
# To enable runtime metrics collection, set `true`. Defaults to `false`
# You can also set DD_RUNTIME_METRICS_ENABLED=true to configure this.
c.runtime_metrics_enabled = true

# Optionally, you can configure the Statsd instance used for sending runtime metrics.
# Statsd is automatically configured with default settings if `dogstatsd-ruby` is available.
# You can configure with host and port of Datadog agent; defaults to 'localhost:8125'.
c.runtime_metrics statsd: Datadog::Statsd.new
end
```

See the [Dogstatsd documentation](https://www.rubydoc.info/github/DataDog/dogstatsd-ruby/master/frames) for more details about configuring `Datadog::Statsd`.

The stats sent will include:

| Name | Type | Description |
| -------------------------- | ------- | -------------------------------------------------------- |
| `runtime.ruby.class_count` | `gauge` | Number of classes in memory space. |
| `runtime.ruby.thread_count` | `gauge` | Number of threads. |
| `runtime.ruby.gc.*`. | `gauge` | Garbage collection statistics (one per value in GC.stat) |

In addition, all metrics will include the following tags:

| Name | Description |
| ------------ | ------------------------------------------------------- |
| `language` | Programming language traced. (e.g. `ruby`) |
| `runtime-id` | Unique identifier of runtime environment (i.e. process) |
| `service` | List of services this metric is associated with. |

### OpenTracing

For setting up Datadog with OpenTracing, see out [Quickstart for OpenTracing](#quickstart-for-opentracing) section for details.
Expand Down
1 change: 1 addition & 0 deletions lib/ddtrace.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
require 'ddtrace/configuration'
require 'ddtrace/patcher'
require 'ddtrace/augmentation'
require 'ddtrace/metrics'

# \Datadog global namespace that includes all tracing functionality for Tracer and Span classes.
module Datadog
Expand Down
Loading

0 comments on commit 323c004

Please sign in to comment.