Skip to content
Draft
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
6 changes: 3 additions & 3 deletions .github/scripts/announce_release_on_slack.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,10 @@ def reformat_github_md_to_slack_markup(msg):
# /c938c67e957345ba6a0015ca3ace1fd779d0979c/lib/Markdown.ts#LL111C1-L116C44

msg = re.sub(r"^(\s*)[-*](\s+)", r"\1•\2", msg, flags=re.MULTILINE)
msg = re.sub(r"(\*|_)\1(\S|\S.*?\S)\1\1(?!\1)", r"<bdmkd>\2</bdmkd>", msg)
msg = re.sub(r"(\*|_)(?!\1)(\S|\S.*?\S)\1(?!\1)", r"<itmkd>\2</itmkd>", msg)
msg = re.sub(r"([*_])\1(\S|\S.*?\S)\1\1(?!\1)", r"<bdmkd>\2</bdmkd>", msg)
msg = re.sub(r"([*_])(?!\1)(\S|\S.*?\S)\1(?!\1)", r"<itmkd>\2</itmkd>", msg)
msg = msg.replace("<bdmkd>", "*").replace("<itmkd>", "_")
msg = re.sub(r"^([#]+)\s+([\S ]+)$", r"*\2*", msg, flags=re.MULTILINE)
msg = re.sub(r"^#+\s+(\S[\S ]*)$", r"*\1*", msg, flags=re.MULTILINE)

# TODO: The message text has to have a partial entity encoding
# https://api.slack.com/reference/surfaces/formatting#escaping
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-notification-on-slack.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
export GITHUB_RELEASE_TAG=$(basename ${GITHUB_REF})
fi
echo "New release published ${GITHUB_RELEASE_TAG}"
pip3 install httpx PyGithub
pip3 install --only-binary :all: httpx==0.28.1 PyGithub==2.10.0
echo $PWD
ls -lah
python ./.github/scripts/announce_release_on_slack.py
Expand Down
8 changes: 4 additions & 4 deletions bin/aws-lambda/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM public.ecr.aws/lambda/ruby:3.4 as ruby_dependencies_34
FROM public.ecr.aws/lambda/ruby:3.4 AS ruby_dependencies_34

# Install system dependencies for native extensions
RUN dnf update -y && \
Expand All @@ -13,7 +13,7 @@ RUN echo "source 'https://rubygems.org'; gem 'instana'; gem 'get_process_mem'" >
RUN mkdir -p ruby/gems/3.4.0 && \
cp -r vendor/bundle/ruby/3.4.0*/* ruby/gems/3.4.0/

FROM public.ecr.aws/lambda/ruby:3.3 as ruby_dependencies_33
FROM public.ecr.aws/lambda/ruby:3.3 AS ruby_dependencies_33

# Install system dependencies for native extensions
RUN dnf update -y && \
Expand All @@ -28,7 +28,7 @@ RUN echo "source 'https://rubygems.org'; gem 'instana'; gem 'get_process_mem'" >
RUN mkdir -p ruby/gems/3.3.0 && \
cp -r vendor/bundle/ruby/3.3.0*/* ruby/gems/3.3.0/

FROM public.ecr.aws/lambda/ruby:3.2 as ruby_dependencies_32
FROM public.ecr.aws/lambda/ruby:3.2 AS ruby_dependencies_32

# Install system dependencies for native extensions
RUN yum update -y && \
Expand All @@ -44,7 +44,7 @@ RUN echo "source 'https://rubygems.org'; gem 'instana'; gem 'get_process_mem'" >
RUN mkdir -p ruby/gems/3.2.0 && \
cp -r vendor/bundle/ruby/3.2.0*/* ruby/gems/3.2.0/

FROM public.ecr.aws/docker/library/alpine:3.22 as final
FROM public.ecr.aws/docker/library/alpine:3.22 AS final

RUN apk add --no-cache zip unzip

Expand Down
8 changes: 4 additions & 4 deletions download.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

if [[ -z ${CIRCLE_TOKEN} ]]
then
echo "ERROR: The CIRCLE_TOKEN variable is missing"
echo "ERROR: The CIRCLE_TOKEN variable is missing" >&2
exit 255
fi

Expand All @@ -27,7 +27,7 @@ fi

if [[ -z ${PIPELINE_ID} ]]
then
echo "ERROR: Could not determine the pipeline ID. Check CIRCLE_TOKEN and CIRCLE_BUILD_NUM (or WORKFLOW_ID)."
echo "ERROR: Could not determine the pipeline ID. Check CIRCLE_TOKEN and CIRCLE_BUILD_NUM (or WORKFLOW_ID)." >&2
exit 253
fi

Expand All @@ -47,7 +47,7 @@ WORKFLOW_IDS=$(curl -s \

if [[ -z ${WORKFLOW_IDS} ]]
then
echo "ERROR: No workflows found for pipeline ${PIPELINE_ID}"
echo "ERROR: No workflows found for pipeline ${PIPELINE_ID}" >&2
exit 252
fi

Expand All @@ -73,7 +73,7 @@ do

if [[ "${STATUS}" != "success" ]]
then
echo "ERROR: Workflow ${workflow_id} did not succeed! Status is: ${STATUS}"
echo "ERROR: Workflow ${workflow_id} did not succeed! Status is: ${STATUS}" >&2
exit 254
else
echo "Workflow ${workflow_id} has finished successfully! Status is: ${STATUS}"
Expand Down
7 changes: 2 additions & 5 deletions lib/instana/exporter/otlp/rpc_converter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -150,11 +150,8 @@ def grpc_status_code(rpc_data)

# Attempt to extract gRPC status string from error message
error_msg = rpc_data[:error].to_s
GRPC_STATUS_CODES.each do |name, code|
return code if error_msg.include?(name)
end

GRPC_STATUS_CODES['UNKNOWN']
_name, code = GRPC_STATUS_CODES.find { |name, _code| error_msg.include?(name) }
code || GRPC_STATUS_CODES['UNKNOWN']
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/instana/frameworks/cuba.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def self.prepended(base)
end

def on(*args, &blk)
wrapper = lambda do |*caputres|
wrapper = lambda do |*_captures|
env['INSTANA_PATH_TEMPLATE_FRAGMENTS'] << args
.select { |a| a.is_a?(String) }
.join('/')
Expand Down
19 changes: 8 additions & 11 deletions lib/instana/instrumentation/action_view.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,7 @@ module Instrumentation
module ActionView
module PartialRenderer
def render_partial(*args)
call_payload = {
render: {
type: :partial,
name: @options.is_a?(Hash) ? @options[:partial].to_s : 'Unknown'
}
}

::Instana.tracer.in_span(:render, attributes: call_payload) { super(*args) }
::Instana.tracer.in_span(:render, attributes: partial_call_payload) { super(*args) }
end

def render_collection(*args)
Expand All @@ -28,14 +21,18 @@ def render_collection(*args)
end

def render_partial_template(*args)
call_payload = {
::Instana.tracer.in_span(:render, attributes: partial_call_payload) { super(*args) }
end

private

def partial_call_payload
{
render: {
type: :partial,
name: @options.is_a?(Hash) ? @options[:partial].to_s : 'Unknown'
}
}

::Instana.tracer.in_span(:render, attributes: call_payload) { super(*args) }
end
end

Expand Down
2 changes: 1 addition & 1 deletion lib/instana/instrumentation/excon.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def error_call(datum)
end

def response_call(datum)
# FIXME: Will connect exceptions call a response?
# Open question: will connect exceptions call a response?
#
return @stack.response_call(datum) unless traceable?

Expand Down
2 changes: 1 addition & 1 deletion lib/instana/instrumentation/graphql.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class GraphqlTracing < GraphQL::Tracing::PlatformTracing
'execute_query_lazy' => 'execute.graphql',
}

def platform_trace(platform_key, key, data)
def platform_trace(_platform_key, key, data)
return yield unless key == 'execute_query'
operation = data[:query].selected_operation

Expand Down
4 changes: 2 additions & 2 deletions lib/instana/instrumentation/resque.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def self.prepended(klass)
klass.send :extend, ::Resque
end

def collect_kvs(op, klass, args)
def collect_kvs(_op, klass, _args)
kvs = {}

begin
Expand Down Expand Up @@ -85,7 +85,7 @@ def perform(job)
end
span = OpenTelemetry::Trace.non_recording_span(trace_context) if trace_context
Trace.with_span(span) do
Instana.tracer.in_span(:'resque-worker', attributes: kvs) do |span|
Instana.tracer.in_span(:'resque-worker', attributes: kvs) do |_span|
super(job)
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/instana/samplers/samplers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def self.trace_id_ratio_based(_)
self
end

def self.should_sample?(trace_id:, parent_context:, links:, name:, kind:, attributes:) # rubocop:disable Metrics/ParameterLists, Lint/UnusedMethodArgument:
def self.should_sample?(parent_context:, **)
parent_span_context = OpenTelemetry::Trace.current_span(parent_context).context
# Parents wrapped in non_recording_span can expose a non-SpanContext
# #context; the new span's SpanContext needs a Tracestate, never nil.
Expand Down
2 changes: 1 addition & 1 deletion lib/instana/snapshot/docker_container.rb
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ def lookup(resource)
path = @metadata_uri.path + resource
response = @client.send_request('GET', path)

raise "Unable to get `#{path}`. Got `#{response.code}`." unless response.ok?
raise StandardError, "Unable to get `#{path}`. Got `#{response.code}`." unless response.ok?

response.json
end
Expand Down
2 changes: 1 addition & 1 deletion lib/instana/snapshot/fargate_container.rb
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def current_conatiner
path = @metadata_uri.path
response = @client.send_request('GET', path)

raise "Unable to get `#{path}`. Got `#{response.code}`." unless response.ok?
raise StandardError, "Unable to get `#{path}`. Got `#{response.code}`." unless response.ok?

response.json
end
Expand Down
2 changes: 1 addition & 1 deletion lib/instana/snapshot/fargate_process.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def lookup(resource = nil)
path = resource ? @metadata_uri.path + resource : @metadata_uri.path
response = @client.send_request('GET', path)

raise "Unable to get `#{path}`. Got `#{response.code}`." unless response.ok?
raise StandardError, "Unable to get `#{path}`. Got `#{response.code}`." unless response.ok?

response.json
end
Expand Down
2 changes: 1 addition & 1 deletion lib/instana/snapshot/fargate_task.rb
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def lookup(resource)
path = @metadata_uri.path + resource
response = @client.send_request('GET', path)

raise "Unable to get `#{path}`. Got `#{response.code}`." unless response.ok?
raise StandardError, "Unable to get `#{path}`. Got `#{response.code}`." unless response.ok?

response.json
end
Expand Down
2 changes: 1 addition & 1 deletion lib/instana/snapshot/google_cloud_run_instance.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def lookup(resource)
path = @metadata_uri.path + resource
response = @client.send_request('GET', path, nil, {'Metadata-Flavor' => 'Google'})

raise "Unable to get `#{path}`. Got `#{response.code}` `#{response['location']}`." unless response.ok?
raise StandardError, "Unable to get `#{path}`. Got `#{response.code}` `#{response['location']}`." unless response.ok?

response.body
end
Expand Down
2 changes: 1 addition & 1 deletion lib/instana/snapshot/google_cloud_run_process.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def lookup(resource)
path = @metadata_uri.path + resource
response = @client.send_request('GET', path, nil, {'Metadata-Flavor' => 'Google'})

raise "Unable to get `#{path}`. Got `#{response.code}` `#{response['location']}`." unless response.ok?
raise StandardError, "Unable to get `#{path}`. Got `#{response.code}` `#{response['location']}`." unless response.ok?

response.body
end
Expand Down
17 changes: 6 additions & 11 deletions lib/instana/span_filtering.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,20 +32,15 @@ def filter_span(span)
return nil unless @configuration

# Check include rules first (whitelist)
if @configuration.include_rules.any?
# If we have include rules, only keep spans that match at least one include rule
unless @configuration.include_rules.any? { |rule| rule.matches?(span) }
return { filtered: true, suppression: false }
end
# If it matches an include rule, continue to exclude rules
# If we have include rules, only keep spans that match at least one include rule
include_rules = @configuration.include_rules
if include_rules.any? && include_rules.none? { |rule| rule.matches?(span) }
return { filtered: true, suppression: false }
end

# Check exclude rules (blacklist)
@configuration.exclude_rules.each do |rule|
if rule.matches?(span)
return { filtered: true, suppression: rule.suppression }
end
end
excluded_by = @configuration.exclude_rules.find { |rule| rule.matches?(span) }
return { filtered: true, suppression: excluded_by.suppression } if excluded_by

nil # Keep the span if no rules match
end
Expand Down
2 changes: 1 addition & 1 deletion lib/instana/trace/processor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def span_metrics
#
# Sends all traces in @queue to the host agent
#
# FIXME: Add limits checking here in regards to:
# Known gaps: limits checking is missing in regards to:
# - Max HTTP Post size
# - Out of control/growing queue
# - Prevent another run of the timer while this is running
Expand Down
2 changes: 1 addition & 1 deletion lib/instana/trace/span.rb
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,7 @@ def add_link(_link)
#
# @return [self] returns itself
# Todo Add the vent logic later
def add_event(_name, attributes: nil, timestamp: nil) # rubocop:disable Lint/UnusedMethodArgument
def add_event(_name, **)
self
end

Expand Down
2 changes: 1 addition & 1 deletion test/backend/host_agent_reporting_observer_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ def test_report_standard_error

processor = Class.new do
def send
raise 'Standard Error'
raise StandardError, 'Standard Error'
end
end.new

Expand Down
2 changes: 1 addition & 1 deletion test/benchmarks/bench_id_generation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
class BenchIDs < Minitest::Benchmark
def bench_generate_id
# TODO: This performs poorly on JRuby.
assert_performance_constant do |input|
assert_performance_constant do |_input|
500_000.times do
::Instana::Util.generate_id
end
Expand Down
2 changes: 1 addition & 1 deletion test/benchmarks/bench_opentracing.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

class BenchOpenTracing < Minitest::Benchmark
def bench_start_finish_span
assert_performance_constant do |input|
assert_performance_constant do |_input|
10_000.times do
span = ::Instana.tracer.start_span(:blah)
span.set_tag(:zero, 0)
Expand Down
3 changes: 2 additions & 1 deletion test/instrumentation/dalli_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,8 @@ def test_get_error_logging
::Instana.tracer.in_span(:dalli_test) do
result = broken_dc.get(:instana)
end
rescue
rescue StandardError
# The error is expected; the resulting spans are asserted below
end

spans = ::Instana.processor.queued_spans
Expand Down
2 changes: 1 addition & 1 deletion test/instrumentation/graphql_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def self.resolve_type(object, _context)
elsif !object.description?
JobType
else
raise("Unexpected object: #{object}")
raise(StandardError, "Unexpected object: #{object}")
end
end
end
Expand Down
9 changes: 6 additions & 3 deletions test/instrumentation/grpc_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,8 @@ def test_request_response_failure
Instana.tracer.in_span(:rpctests) do
begin
client_stub.fail_to_ping( PingPongService::PingRequest.new(message: 'Hello World'))
rescue
rescue StandardError
# The error is expected; the resulting spans are asserted below
end
end

Expand Down Expand Up @@ -299,7 +300,8 @@ def test_client_streamer_failure
PingPongService::PingRequest.new(message: index.to_s)
end
)
rescue
rescue StandardError
# The error is expected; the resulting spans are asserted below
end
end

Expand Down Expand Up @@ -342,7 +344,8 @@ def test_server_streamer_failure
client_stub.fail_to_ping_with_server_stream(
PingPongService::PingRequest.new(message: 'Hello World')
)
rescue
rescue StandardError
# The error is expected; the resulting spans are asserted below
end
end

Expand Down
2 changes: 1 addition & 1 deletion test/instrumentation/rack_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def call(env)

class ErrorApp
def call(_env)
raise 'An Error'
raise StandardError, 'An Error'
end
end

Expand Down
Loading
Loading