Skip to content

Commit 85bd6b8

Browse files
committed
Merge branch 'master' into tonycthsu/crashtracking
2 parents 6f3c5fe + d2498fb commit 85bd6b8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+2107
-2264
lines changed

.git-blame-ignore-revs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,7 @@ f89961150051276ea21bbca3fa00bda9b3cf4f1d
2020
6924556fc9e38c244e2ff3d429d581819f275ee9
2121
aba860197ce4f708e917e27323884d8efe3692ca
2222
464dd7177b72d6fe2c7f6e1aba0e4a6d3826f0d9
23+
acee9c7f3d953551cc0f20ef60e5045432bcf7e6
24+
6e4193c5bf3c2b948c91598c7a70bc34b59872fa
25+
b1481b215d8b1bf33a1d53419d1b95ebd1a70877
26+
01ec575b25bc68edfea7de2046ce3c43bc3ed4af

.standard_todo.yml

Lines changed: 0 additions & 141 deletions
Original file line numberDiff line numberDiff line change
@@ -42,144 +42,3 @@ ignore:
4242
- spec/support/**/**
4343
- tasks/**/**
4444
- yard/**/**
45-
46-
# These profiling ignores are ALL going to be fixed in separate PRs
47-
- lib/datadog/profiling/collectors/code_provenance.rb:
48-
- Style/StringLiterals
49-
- Layout/SpaceInsideHashLiteralBraces
50-
- lib/datadog/profiling/collectors/cpu_and_wall_time_worker.rb:
51-
- Style/StringLiterals
52-
- Style/RedundantBegin
53-
- lib/datadog/profiling/collectors/idle_sampling_helper.rb:
54-
- Style/RedundantBegin
55-
- Style/StringLiterals
56-
- lib/datadog/profiling/collectors/info.rb:
57-
- Style/StringLiterals
58-
- lib/datadog/profiling/component.rb:
59-
- Layout/SpaceInsideHashLiteralBraces
60-
- Style/StringLiterals
61-
- lib/datadog/profiling/crashtracker.rb:
62-
- Style/StringLiterals
63-
- Style/RedundantBegin
64-
- lib/datadog/profiling/exporter.rb:
65-
- Style/StringLiterals
66-
- lib/datadog/profiling/ext.rb:
67-
- Style/StringLiterals
68-
- lib/datadog/profiling/ext/dir_monkey_patches.rb:
69-
- Style/StringLiterals
70-
- lib/datadog/profiling/ext/forking.rb:
71-
- Style/StringLiterals
72-
- lib/datadog/profiling/flush.rb:
73-
- Style/StringLiterals
74-
- lib/datadog/profiling/http_transport.rb:
75-
- Style/StringLiterals
76-
- lib/datadog/profiling/load_native_extension.rb:
77-
- Style/StringLiterals
78-
- lib/datadog/profiling/preload.rb:
79-
- Style/StringLiterals
80-
- lib/datadog/profiling/profiler.rb:
81-
- Style/StringLiterals
82-
- lib/datadog/profiling/scheduler.rb:
83-
- Style/StringLiterals
84-
- Style/RedundantBegin
85-
- lib/datadog/profiling/tag_builder.rb:
86-
- Style/StringLiterals
87-
- lib/datadog/profiling/tasks/exec.rb:
88-
- Style/StringLiterals
89-
- lib/datadog/profiling/tasks/setup.rb:
90-
- Style/StringLiterals
91-
- Style/RedundantBegin
92-
- lib/datadog/profiling.rb:
93-
- Style/StringLiterals
94-
- Style/RedundantBegin
95-
- spec/datadog/profiling/collectors/code_provenance_spec.rb:
96-
- Style/StringLiterals
97-
- spec/datadog/profiling/collectors/cpu_and_wall_time_worker_spec.rb:
98-
- Style/StringLiterals
99-
- Layout/SpaceInsideHashLiteralBraces
100-
- Style/QuotedSymbols
101-
- Style/RedundantBegin
102-
- spec/datadog/profiling/collectors/discrete_dynamic_sampler_spec.rb:
103-
- Style/StringLiterals
104-
- spec/datadog/profiling/collectors/dynamic_sampling_rate_spec.rb:
105-
- Style/StringLiterals
106-
- spec/datadog/profiling/collectors/idle_sampling_helper_spec.rb:
107-
- Style/StringLiterals
108-
- spec/datadog/profiling/collectors/info_spec.rb:
109-
- Style/StringLiterals
110-
- Layout/SpaceInsideHashLiteralBraces
111-
- spec/datadog/profiling/collectors/stack_spec.rb:
112-
- Style/StringLiterals
113-
- Layout/SpaceInsideHashLiteralBraces
114-
- spec/datadog/profiling/collectors/thread_context_spec.rb:
115-
- Style/StringLiterals
116-
- Style/QuotedSymbols
117-
- Style/RedundantBegin
118-
- Layout/SpaceInsideHashLiteralBraces
119-
- spec/datadog/profiling/component_spec.rb:
120-
- Style/StringLiterals
121-
- Layout/SpaceInsideHashLiteralBraces
122-
- spec/datadog/profiling/crashtracker_spec.rb:
123-
- Style/StringLiterals
124-
- Layout/SpaceInsideHashLiteralBraces
125-
- Style/QuotedSymbols
126-
- spec/datadog/profiling/exporter_spec.rb:
127-
- Style/StringLiterals
128-
- Layout/SpaceInsideHashLiteralBraces
129-
- spec/datadog/profiling/ext/dir_monkey_patches_spec.rb:
130-
- Style/StringLiterals
131-
- Style/RedundantBegin
132-
- spec/datadog/profiling/ext/forking_spec.rb:
133-
- Style/StringLiterals
134-
- spec/datadog/profiling/flush_spec.rb:
135-
- Style/StringLiterals
136-
- Layout/SpaceInsideHashLiteralBraces
137-
- spec/datadog/profiling/http_transport_spec.rb:
138-
- Style/StringLiterals
139-
- Layout/SpaceInsideHashLiteralBraces
140-
- Style/RedundantBegin
141-
- spec/datadog/profiling/load_native_extension_spec.rb:
142-
- Style/StringLiterals
143-
- spec/datadog/profiling/native_extension_helpers_spec.rb:
144-
- Style/StringLiterals
145-
- spec/datadog/profiling/native_extension_spec.rb:
146-
- Style/StringLiterals
147-
- spec/datadog/profiling/pprof/pprof_pb.rb:
148-
- Style/StringLiterals
149-
- spec/datadog/profiling/preload_spec.rb:
150-
- Style/StringLiterals
151-
- spec/datadog/profiling/profiler_spec.rb:
152-
- Style/StringLiterals
153-
- spec/datadog/profiling/scheduler_spec.rb:
154-
- Style/StringLiterals
155-
- Layout/SpaceInsideHashLiteralBraces
156-
- spec/datadog/profiling/spec_helper.rb:
157-
- Style/StringLiterals
158-
- Style/QuotedSymbols
159-
- spec/datadog/profiling/stack_recorder_spec.rb:
160-
- Style/StringLiterals
161-
- Layout/SpaceInsideHashLiteralBraces
162-
- Style/QuotedSymbols
163-
- Style/RedundantBegin
164-
- spec/datadog/profiling/tag_builder_spec.rb:
165-
- Style/StringLiterals
166-
- Layout/SpaceInsideHashLiteralBraces
167-
- spec/datadog/profiling/tasks/exec_spec.rb:
168-
- Style/StringLiterals
169-
- spec/datadog/profiling/tasks/help_spec.rb:
170-
- Style/StringLiterals
171-
- spec/datadog/profiling/tasks/setup_spec.rb:
172-
- Style/StringLiterals
173-
- spec/datadog/profiling/validate_benchmarks_spec.rb:
174-
- Style/StringLiterals
175-
- spec/datadog/profiling_spec.rb:
176-
- Style/StringLiterals
177-
- Style/RedundantBegin
178-
- ext/datadog_profiling_loader/extconf.rb:
179-
- Style/StringLiterals
180-
- ext/datadog_profiling_native_extension/extconf.rb:
181-
- Style/StringLiterals
182-
- ext/datadog_profiling_native_extension/native_extension_helpers.rb:
183-
- Style/StringLiterals
184-
- Layout/SpaceInsideHashLiteralBraces
185-
- Style/RedundantBegin

ext/datadog_profiling_loader/extconf.rb

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,64 +1,64 @@
11
# rubocop:disable Style/StderrPuts
22
# rubocop:disable Style/GlobalVars
33

4-
if RUBY_ENGINE != 'ruby' || Gem.win_platform?
4+
if RUBY_ENGINE != "ruby" || Gem.win_platform?
55
$stderr.puts(
6-
'WARN: Skipping build of Datadog profiling loader. See Datadog profiling native extension note for details.'
6+
"WARN: Skipping build of Datadog profiling loader. See Datadog profiling native extension note for details."
77
)
88

9-
File.write('Makefile', 'all install clean: # dummy makefile that does nothing')
9+
File.write("Makefile", "all install clean: # dummy makefile that does nothing")
1010
exit
1111
end
1212

13-
require 'mkmf'
13+
require "mkmf"
1414

1515
# mkmf on modern Rubies actually has an append_cflags that does something similar
1616
# (see https://github.com/ruby/ruby/pull/5760), but as usual we need a bit more boilerplate to deal with legacy Rubies
1717
def add_compiler_flag(flag)
1818
if try_cflags(flag)
19-
$CFLAGS << ' ' << flag
19+
$CFLAGS << " " << flag
2020
else
2121
$stderr.puts("WARNING: '#{flag}' not accepted by compiler, skipping it")
2222
end
2323
end
2424

2525
# Because we can't control what compiler versions our customers use, shipping with -Werror by default is a no-go.
2626
# But we can enable it in CI, so that we quickly spot any new warnings that just got introduced.
27-
add_compiler_flag '-Werror' if ENV['DATADOG_GEM_CI'] == 'true'
27+
add_compiler_flag "-Werror" if ENV["DATADOG_GEM_CI"] == "true"
2828

2929
# Older gcc releases may not default to C99 and we need to ask for this. This is also used:
3030
# * by upstream Ruby -- search for gnu99 in the codebase
3131
# * by msgpack, another datadog gem dependency
3232
# (https://github.com/msgpack/msgpack-ruby/blob/18ce08f6d612fe973843c366ac9a0b74c4e50599/ext/msgpack/extconf.rb#L8)
33-
add_compiler_flag '-std=gnu99'
33+
add_compiler_flag "-std=gnu99"
3434

3535
# Gets really noisy when we include the MJIT header, let's omit it (TODO: Use #pragma GCC diagnostic instead?)
36-
add_compiler_flag '-Wno-unused-function'
36+
add_compiler_flag "-Wno-unused-function"
3737

3838
# Allow defining variables at any point in a function
39-
add_compiler_flag '-Wno-declaration-after-statement'
39+
add_compiler_flag "-Wno-declaration-after-statement"
4040

4141
# If we forget to include a Ruby header, the function call may still appear to work, but then
4242
# cause a segfault later. Let's ensure that never happens.
43-
add_compiler_flag '-Werror-implicit-function-declaration'
43+
add_compiler_flag "-Werror-implicit-function-declaration"
4444

4545
# Warn on unused parameters to functions. Use `DDTRACE_UNUSED` to mark things as known-to-not-be-used.
46-
add_compiler_flag '-Wunused-parameter'
46+
add_compiler_flag "-Wunused-parameter"
4747

4848
# The native extension is not intended to expose any symbols/functions for other native libraries to use;
4949
# the sole exception being `Init_datadog_profiling_loader` which needs to be visible for Ruby to call it when
5050
# it `dlopen`s the library.
5151
#
5252
# By setting this compiler flag, we tell it to assume that everything is private unless explicitly stated.
5353
# For more details see https://gcc.gnu.org/wiki/Visibility
54-
add_compiler_flag '-fvisibility=hidden'
54+
add_compiler_flag "-fvisibility=hidden"
5555

5656
# Avoid legacy C definitions
57-
add_compiler_flag '-Wold-style-definition'
57+
add_compiler_flag "-Wold-style-definition"
5858

5959
# Enable all other compiler warnings
60-
add_compiler_flag '-Wall'
61-
add_compiler_flag '-Wextra'
60+
add_compiler_flag "-Wall"
61+
add_compiler_flag "-Wextra"
6262

6363
# Tag the native extension library with the Ruby version and Ruby platform.
6464
# This makes it easier for development (avoids "oops I forgot to rebuild when I switched my Ruby") and ensures that

ext/datadog_profiling_native_extension/clock_id.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
#include <stdbool.h>
44
#include <time.h>
5+
#include <ruby.h>
56

67
// Contains the operating-system specific identifier needed to fetch CPU-time, and a flag to indicate if we failed to fetch it
78
typedef struct thread_cpu_time_id {

ext/datadog_profiling_native_extension/clock_id_from_pthread.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,10 @@
77
#include <pthread.h>
88
#include <time.h>
99
#include <errno.h>
10-
#include <ruby.h>
1110

11+
#include "clock_id.h"
1212
#include "helpers.h"
1313
#include "private_vm_api_access.h"
14-
#include "clock_id.h"
1514
#include "time_helpers.h"
1615

1716
// Validate that our home-cooked pthread_id_for() matches pthread_self() for the current thread

ext/datadog_profiling_native_extension/clock_id_noop.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,9 @@
44
// is not available.
55
#ifndef HAVE_PTHREAD_GETCPUCLOCKID
66

7-
#include <ruby.h>
8-
97
#include "clock_id.h"
108
#include "helpers.h"
9+
#include "datadog_ruby_common.h"
1110

1211
void self_test_clock_id(void) { } // Nothing to check
1312

0 commit comments

Comments
 (0)