Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Transform values to_s

Oliver Günther59446719c963
diff --git a/config/initializers/opentelemetry.rb b/config/initializers/opentelemetry.rb
index db6b13476f0..7e6fa851c95 100644
--- a/config/initializers/opentelemetry.rb
+++ b/config/initializers/opentelemetry.rb
@@ -27,6 +27,7 @@
#
# See COPYRIGHT and LICENSE files for more details.
#++
+require_relative "../../lib_static/open_project/opentelemetry"
Rails.application.configure do
if OpenProject::Configuration.opentelemetry_enabled?
@@ -34,7 +35,6 @@ Rails.application.configure do
require "opentelemetry/sdk"
require "opentelemetry-exporter-otlp"
require "opentelemetry-instrumentation-all"
- require_relative "../../lib_static/open_project/opentelemetry"
# add log tags for log correlation
config.log_tags += [
@@ -54,7 +54,7 @@ Rails.application.configure do
"deployment.environment" => Rails.env,
"service.namespace" => "openproject",
"service.instance.id" => Socket.gethostname
- }
+ }.transform_values(&:to_s)
)
c.use_all
diff --git a/lib_static/open_project/opentelemetry.rb b/lib_static/open_project/opentelemetry.rb
index b853c33f8dd..d3212e9bf69 100644
--- a/lib_static/open_project/opentelemetry.rb
+++ b/lib_static/open_project/opentelemetry.rb
@@ -88,17 +88,6 @@ module OpenProject
}.compact
end
- ##
- # Create a new span with attributes
- # @param name The span name
- # @param attributes Hash of attributes to set on the span
- def with_span(name, attributes = {}, &)
- return yield unless enabled?
-
- tracer = ::OpenTelemetry.tracer_provider.tracer("openproject")
- tracer.in_span(name, attributes: attributes, &)
- end
-
##
# Add attributes to the current span
# @param attributes Hash of attributes to add
@@ -129,7 +118,7 @@ module OpenProject
# OpenTelemetry uses set_attribute (singular) not set_attributes (plural)
def set_span_attributes(span, attributes)
attributes.each do |key, value|
- span.set_attribute(key, value)
+ span.set_attribute(key.to_s, value.to_s)
end
end
end