lib/opentelemetry/sdk/resources/resource.rb in opentelemetry-sdk-1.0.0.rc2 vs lib/opentelemetry/sdk/resources/resource.rb in opentelemetry-sdk-1.0.0.rc3

- old
+ new

@@ -29,18 +29,18 @@ new(frozen_attributes) end def default - @default ||= create(Constants::SERVICE_RESOURCE[:name] => 'unknown_service').merge(process).merge(telemetry_sdk).merge(service_name_from_env) + @default ||= create(SemanticConventions::Resource::SERVICE_NAME => 'unknown_service').merge(process).merge(telemetry_sdk).merge(service_name_from_env) end def telemetry_sdk resource_attributes = { - Constants::TELEMETRY_SDK_RESOURCE[:name] => 'opentelemetry', - Constants::TELEMETRY_SDK_RESOURCE[:language] => 'ruby', - Constants::TELEMETRY_SDK_RESOURCE[:version] => OpenTelemetry::SDK::VERSION + SemanticConventions::Resource::TELEMETRY_SDK_NAME => 'opentelemetry', + SemanticConventions::Resource::TELEMETRY_SDK_LANGUAGE => 'ruby', + SemanticConventions::Resource::TELEMETRY_SDK_VERSION => OpenTelemetry::SDK::VERSION } resource_pairs = ENV['OTEL_RESOURCE_ATTRIBUTES'] return create(resource_attributes) unless resource_pairs.is_a?(String) @@ -53,24 +53,24 @@ create(resource_attributes) end def process resource_attributes = { - Constants::PROCESS_RESOURCE[:pid] => Process.pid, - Constants::PROCESS_RESOURCE[:command] => $PROGRAM_NAME, - Constants::PROCESS_RUNTIME_RESOURCE[:name] => RUBY_ENGINE, - Constants::PROCESS_RUNTIME_RESOURCE[:version] => RUBY_VERSION, - Constants::PROCESS_RUNTIME_RESOURCE[:description] => RUBY_DESCRIPTION + SemanticConventions::Resource::PROCESS_PID => Process.pid, + SemanticConventions::Resource::PROCESS_COMMAND => $PROGRAM_NAME, + SemanticConventions::Resource::PROCESS_RUNTIME_NAME => RUBY_ENGINE, + SemanticConventions::Resource::PROCESS_RUNTIME_VERSION => RUBY_VERSION, + SemanticConventions::Resource::PROCESS_RUNTIME_DESCRIPTION => RUBY_DESCRIPTION } create(resource_attributes) end private def service_name_from_env service_name = ENV['OTEL_SERVICE_NAME'] - create(Constants::SERVICE_RESOURCE[:name] => service_name) unless service_name.nil? + create(SemanticConventions::Resource::SERVICE_NAME => service_name) unless service_name.nil? end end # @api private # The constructor is private and only for use internally by the class.