Module: OpenTelemetry::Resource::Detector::Deployment

Extended by:
Deployment
Included in:
Deployment
Defined in:
lib/opentelemetry/resource/detector/deployment.rb,
lib/opentelemetry/resource/detector/deployment/version.rb

Overview

Deployment contains detect class method for determining Deployment resource attributes according to opentelemetry specification

Constant Summary collapse

VERSION =
'0.0.1'

Instance Method Summary collapse

Instance Method Details

#detectObject



13
14
15
16
17
18
# File 'lib/opentelemetry/resource/detector/deployment.rb', line 13

def detect
  resource_attributes = {}
  deployment_environment = rails_env || sinatra_env || rack_env
  resource_attributes[::OpenTelemetry::SemanticConventions::Resource::DEPLOYMENT_ENVIRONMENT] = deployment_environment if deployment_environment
  ::OpenTelemetry::SDK::Resources::Resource.create(resource_attributes)
end