stackdriver-core-1.7.0/0000755000004100000410000000000015143462016015020 5ustar www-datawww-datastackdriver-core-1.7.0/OVERVIEW.md0000644000004100000410000000032115143462016016604 0ustar www-datawww-data# Stackdriver Core The {Stackdriver::Core} module is a namespace for common types and shared utilities used by the Google Stackdriver libraries. Most applications will not need to use these classes directly. stackdriver-core-1.7.0/CONTRIBUTING.md0000644000004100000410000000764015143462016017260 0ustar www-datawww-data# Contributing to Google Cloud Stackdriver 1. **Sign one of the contributor license agreements below.** 2. Fork the repo, develop and test your code changes. 3. Send a pull request. ## Contributor License Agreements Before we can accept your pull requests you'll need to sign a Contributor License Agreement (CLA): - **If you are an individual writing original source code** and **you own the intellectual property**, then you'll need to sign an [individual CLA](https://developers.google.com/open-source/cla/individual). - **If you work for a company that wants to allow you to contribute your work**, then you'll need to sign a [corporate CLA](https://developers.google.com/open-source/cla/corporate). You can sign these electronically (just scroll to the bottom). After that, we'll be able to accept your pull requests. ## Setup In order to use the stackdriver console and run the project's tests, there is a small amount of setup: 1. Install Ruby. stackdriver requires Ruby 2.5+. You may choose to manage your Ruby and gem installations with [RVM](https://rvm.io/), [rbenv](https://github.com/rbenv/rbenv), or [chruby](https://github.com/postmodern/chruby). 2. Install [Bundler](http://bundler.io/). ```sh $ gem install bundler ``` 3. Install the top-level project dependencies. ```sh $ bundle install ``` 4. Install the Stackdriver dependencies. ```sh $ cd stackdriver-core/ $ bundle install ``` ## Stackdriver Tests Tests are very important part of stackdriver. All contributions should include tests that ensure the contributed code behaves as expected. To run the unit tests, documentation tests, and code style checks together for a package: ``` sh $ cd stackdriver-core/ $ bundle exec rake ci ``` To run the command above, plus all acceptance tests, use `rake ci:acceptance` or its handy alias, `rake ci:a`. ### Stackdriver Unit Tests The project uses the [minitest](https://github.com/seattlerb/minitest) library, including [specs](https://github.com/seattlerb/minitest#specs), [mocks](https://github.com/seattlerb/minitest#mocks) and [minitest-autotest](https://github.com/seattlerb/minitest-autotest). To run the Stackdriver unit tests: ``` sh $ cd stackdriver-core/ $ bundle exec rake test ``` ### Stackdriver Documentation Tests The project tests the code examples in the gem's [YARD](https://github.com/lsegal/yard)-based documentation. The example testing functions in a way that is very similar to unit testing, and in fact the library providing it, [yard-doctest](https://github.com/p0deje/yard-doctest), is based on the project's unit test library, [minitest](https://github.com/seattlerb/minitest). To run the Stackdriver documentation tests: ``` sh $ cd stackdriver-core/ $ bundle exec rake doctest ``` If you add, remove or modify documentation examples when working on a pull request, you may need to update the setup for the tests. The stubs and mocks required to run the tests are located in `support/doctest_helper.rb`. Please note that much of the setup is matched by the title of the [`@example`](http://www.rubydoc.info/gems/yard/file/docs/Tags.md#example) tag. If you alter an example's title, you may encounter breaking tests. ## Coding Style Please follow the established coding style in the library. The style is is largely based on [The Ruby Style Guide](https://github.com/bbatsov/ruby-style-guide) with a few exceptions based on seattle-style: * Avoid parenthesis when possible, including in method definitions. * Always use double quotes strings. ([Option B](https://github.com/bbatsov/ruby-style-guide#strings)) You can check your code against these rules by running Rubocop like so: ```sh $ cd stackdriver-core/ $ bundle exec rake rubocop ``` ## Code of Conduct Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms. See {file:CODE_OF_CONDUCT.md Code of Conduct} for more information. stackdriver-core-1.7.0/lib/0000755000004100000410000000000015143462016015566 5ustar www-datawww-datastackdriver-core-1.7.0/lib/stackdriver-core.rb0000644000004100000410000000113415143462016021361 0ustar www-datawww-data# Copyright 2016 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. require "stackdriver/core" stackdriver-core-1.7.0/lib/stackdriver/0000755000004100000410000000000015143462016020107 5ustar www-datawww-datastackdriver-core-1.7.0/lib/stackdriver/core.rb0000644000004100000410000000173115143462016021366 0ustar www-datawww-data# Copyright 2016 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. require "stackdriver/core/configuration" require "stackdriver/core/async_actor" require "stackdriver/core/trace_context" require "stackdriver/core/version" module Stackdriver ## # The Stackdriver::Core module is a namespace for common types and shared # utilities used by the Google Stackdriver libraries. Most applications will # not need to use these classes directly. # module Core end end stackdriver-core-1.7.0/lib/stackdriver/core/0000755000004100000410000000000015143462016021037 5ustar www-datawww-datastackdriver-core-1.7.0/lib/stackdriver/core/configuration.rb0000644000004100000410000000135015143462016024232 0ustar www-datawww-data# Copyright 2017 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. require "google/cloud/config" module Stackdriver module Core ## # Keep this for backwards compatibility Configuration = Google::Cloud::Config end end stackdriver-core-1.7.0/lib/stackdriver/core/trace_context.rb0000644000004100000410000002553115143462016024234 0ustar www-datawww-data# Copyright 2016 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. module Stackdriver module Core ## # A Stackdriver trace context links the current request into a performance # trace, and communicates tracing options between related requests. This # functionality is used by the Stackdriver diagnostics libraries # (including google-cloud-trace, google-cloud-logging, and other rubygems) # that integrate with the tracing service. # # Most applications will not need to use the TraceContext class directly. # The Stackdriver libraries use it internally to store and propagate # context information. # class TraceContext ## # @private HEADER_RACK_KEY = "HTTP_X_CLOUD_TRACE_CONTEXT".freeze ## # @private MEMO_RACK_KEY = "google.cloud.trace_context".freeze ## # @private THREAD_KEY = :__stackdriver_trace_context__ ## # @private UNCHANGED = ::Object.new ## # Create a new TraceContext instance. # # @param [String] trace_id The trace ID as a hex string. If nil or # omitted, a new random Trace ID will be generated, and this # TraceContext will be marked as new. # @param [Boolean] is_new Whether this trace context should be flagged # as newly created. Optional: if unset, will reflect whether a new # trace_id was generated when this object was created. # @param [Integer] span_id The context parent span ID as a 64-bit int. # If nil or omitted, the context will specify no parent span. # @param [Boolean] sampled Whether the context has decided to sample # this trace or not, or nil if the context does not specify a # sampling decision. # @param [Boolean] capture_stack Whether the the context has decided to # capture stack traces. Ignored if sampled is not true. # # @example # require "stackdriver/core" # # trace_id = "0123456789abcdef0123456789abcdef" # ctx = Stackdriver::Core::TraceContext.new trace_id: trace_id, # sampled: true # def initialize trace_id: nil, is_new: nil, span_id: nil, sampled: nil, capture_stack: false @trace_id = trace_id || new_random_trace_id @is_new = is_new.nil? ? !trace_id : !!is_new @span_id = span_id&.to_i @sampled = sampled if @sampled.nil? @capture_stack = nil else @sampled = !!@sampled @capture_stack = capture_stack && @sampled end end ## # The trace ID, as a hex string. # # @return [String] # attr_reader :trace_id ## # The span ID, as a 64-bit integer, or `nil` if no span ID is present # in the context. # # @return [Integer, nil] # attr_reader :span_id ## # Returns `true` if the context wants to sample, `false` if the context # wants explicitly to disable sampling, or `nil` if the context does # not specify. # # @return [Boolean, nil] # def sampled? @sampled end ## # Returns `true` if the context wants to capture stack traces, `false` if # the context does not, or `nil` if the context does not specify a # sampling decision. # # @return [Boolean, nil] # def capture_stack? @capture_stack end ## # Returns `true` if this trace includes a newly generated trace_id. # # @return [Boolean] # def new? @is_new end ## # Standard value equality check for this object. # # @param [Object] other An object to compare with. # @return [Boolean] # def eql? other other.is_a?(TraceContext) && trace_id == other.trace_id && new? == other.new? && span_id == other.span_id && sampled? == other.sampled? && capture_stack? == other.capture_stack? end alias == eql? ## # Generate standard hash code for this object. # # @return [Integer] # def hash @hash ||= [@trace_id, @is_new, @span_id, @sampled, @capture_stack].hash end ## # Returns a new TraceContext instance that is identical to this instance # except for the given changes. All parameters are optional. See # {TraceContext#initialize} for more details on each parameter. # # @param [String] trace_id New trace ID. # @param [Boolean] is_new New setting for newness indicator. # @param [Integer] span_id New parent span ID. # @param [Boolean] sampled New sampling decision. # @param [Boolean] capture_stack New stack capture decision. # @return [TraceContext] # # @example # require "stackdriver/core" # # trace_id = "0123456789abcdef0123456789abcdef" # orig_ctx = Stackdriver::Core::TraceContext.new trace_id: trace_id, # # sampled_ctx = orig_ctx.with sampled: true # def with trace_id: UNCHANGED, is_new: UNCHANGED, span_id: UNCHANGED, sampled: UNCHANGED, capture_stack: UNCHANGED trace_id = @trace_id if trace_id == UNCHANGED is_new = @is_new if is_new == UNCHANGED span_id = @span_id if span_id == UNCHANGED sampled = @sampled if sampled == UNCHANGED capture_stack = @capture_stack if capture_stack == UNCHANGED TraceContext.new trace_id: trace_id, is_new: is_new, span_id: span_id, sampled: sampled, capture_stack: capture_stack end ## # Returns a string representation of this trace context, in the form # `[/][;o=]`. This form is suitable for # setting the trace context header. # # @return [String] # def to_string str = trace_id str += "/#{span_id}" if span_id unless sampled?.nil? options = 0 options |= 1 if sampled? options |= 2 if capture_stack? str += ";o=#{options}" end str end alias to_s to_string ## # Attempts to parse the given string as a trace context representation. # Expects the form `[/][;o=]`, which is the # form used in the trace context header. Returns either the parsed # trace context, or `nil` if the string was malformed. # # @param [String] str The string to parse. # # @return [TraceContext, nil] # # @example # require "stackdriver/core" # # str = "0123456789abcdef0123456789abcdef/12345;o=1" # ctx = Stackdriver::Core::TraceContext.parse_string str # def self.parse_string str match = %r|^(\w{32})(/(\d+))?(;o=(\d+))?|.match str return unless match trace_id = match[1] span_id = match[3]&.to_i options = match[5]&.to_i if options.nil? sampled = capture_stack = nil else sampled = options & 1 != 0 capture_stack = options & 2 != 0 end new trace_id: trace_id, span_id: span_id, sampled: sampled, capture_stack: capture_stack end ## # Obtains a TraceContext from the given Rack environment. This should # be used by any service that wants to obtain the TraceContext for a # Rack request. If a new trace context is generated in the process, it # is memoized into the Rack environment so subsequent services will get # the same context. # # Specifically, the following steps are attempted in order: # 1. Attempts to use any memoized context previously obtained. # 2. Attempts to parse the trace context header. # 3. Creates a new trace context with a random trace ID. # # Furthermore, if a block is given, it is provided with an opportunity # to modify the trace context. The current trace context and the Rack # environment is passed to the block, and its result is used as the # final trace context. The final context is memoized back into the # Rack environment. # # @param [Hash] env The Rack environment hash # # @return [TraceContext] # # @example # require "stackdriver/core" # # class MyMiddleware # def initialize app # @app = app # end # # def call env # ctx = Stackdriver::Core::TraceContext.parse_rack_env env # do_something_with ctx # @app.call env # end # end # def self.parse_rack_env env trace_context = env[MEMO_RACK_KEY] || parse_string(env[HEADER_RACK_KEY].to_s) || new trace_context = yield trace_context, env if block_given? env[MEMO_RACK_KEY] = trace_context end ## # Set the current thread's trace context, and returns the context. # # @param [TraceContext, nil] trace_context The trace context to # set for the current thread. May be `nil`. # # @return [TraceContext, nil] The context set. # # @example # require "stackdriver/core" # # ctx = Stackdriver::Core::TraceContext.new # Stackdriver::Core::TraceContext.set ctx # same_ctx = Stackdriver::Core::TraceContext.get # def self.set trace_context Thread.current[THREAD_KEY] = trace_context trace_context end ## # Returns the current thread's trace context, or `nil` if no trace # context has been set. # # @return [TraceContext, nil] # # @example # require "stackdriver/core" # # ctx = Stackdriver::Core::TraceContext.new # Stackdriver::Core::TraceContext.set ctx # same_ctx = Stackdriver::Core::TraceContext.get # def self.get Thread.current[THREAD_KEY] end protected ## # Returns a random trace ID (as a random type 4 UUID). # # @private # @return [String] # def new_random_trace_id val = rand 0x100000000000000000000000000000000 val &= 0xffffffffffff0fffcfffffffffffffff val |= 0x00000000000040008000000000000000 format "%032x", val end end end end stackdriver-core-1.7.0/lib/stackdriver/core/version.rb0000644000004100000410000000121115143462016023044 0ustar www-datawww-data# Copyright 2016 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. module Stackdriver module Core VERSION = "1.7.0".freeze end end stackdriver-core-1.7.0/lib/stackdriver/core/async_actor.rb0000644000004100000410000002332315143462016023674 0ustar www-datawww-data# Copyright 2017 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. require "set" module Stackdriver module Core ## # # AsyncActor # # @private An module that provides a class asynchronous capability when # included. It can create a child thread to run background jobs, and # help make sure the child thread terminates properly when process # is interrupted. # # To use AsyncActor, the classes that are including this module need to # define a run_backgrounder method that does the background job. The # classes can then control the child thread job through instance methods # like async_start, async_stop, etc. # # @example # class Foo # include AsyncActor # # def initialize # super() # end # # def run_backgrounder # # run async job # end # end # # foo = Foo.new # foo.async_start # module AsyncActor include MonitorMixin CLEANUP_TIMEOUT = 10.0 WAIT_INTERVAL = 1.0 @cleanup_list = nil @exit_lock = Monitor.new ## # @private The async actor state attr_reader :async_state ## # Starts the child thread and asynchronous job def async_start ensure_thread end ## # Nicely ask the child thread to stop by setting the state to # :stopping if it's not stopped already. # # @return [Boolean] False if child thread is already stopped. Otherwise # true. def async_stop ensure_thread synchronize do if async_state == :stopped false else @async_state = :stopping async_state_change true end end end ## # Set the state to :suspend if the current state is :running. # # @return [Boolean] Returns true if the state has been set to # :suspended. Otherwise return false. # def async_suspend ensure_thread synchronize do if async_state == :running @async_state = :suspended async_state_change true else false end end end ## # Set the state to :running if the current state is :suspended. # # @return [Boolean] True if the state has been set to :running. # Otherwise return false. # def async_resume ensure_thread synchronize do if async_state == :suspended @async_state = :running async_state_change true else false end end end ## # Check if async job is running # # @return [Boolean] True if state equals :running. Otherwise false. def async_running? synchronize do async_state == :running end end ## # Check if async job is suspended # # @return [Boolean] True if state equals :suspended. Otherwise false. def async_suspended? synchronize do async_state == :suspended end end ## # Check if async job is working. # # @return [Boolean] True if state is either :running or :suspended. # Otherwise false. def async_working? synchronize do async_state == :suspended || async_state == :running end end ## # Check if async job has stopped # # @return [Boolean] True if state equals :stopped. Otherwise false. def async_stopped? synchronize do async_state == :stopped end end ## # Check if async job is stopping # # @return [Boolean] True if state equals :stopping. Otherwise false. def async_stopping? synchronize do async_state == :stopping end end ## # Ask async job to stop. Then forcefully kill thread if it doesn't stop # after timeout if needed. # # @return [Symbol] :stopped if async job already stopped. :waited if # async job terminates within timeout range. :timeout if async job # doesn't terminate after timeout. :forced if thread is killed by # force after timeout. def async_stop! ensure_thread timeout = @cleanup_options[:timeout] force = @cleanup_options[:force] return :stopped unless async_stop return :waited if timeout.to_f.positive? && wait_until_async_stopped(timeout) return :timeout unless force @thread.kill @thread.join :forced end ## # Block current thread until the async job is fully stopped. # # @param [Integer] timeout If given, lift the blocking when the time has # exceeded the timeout. If nil, block indefinitely. # # @return [Boolean] True if async job is fully stopped. False if timeout. # def wait_until_async_stopped timeout = nil ensure_thread deadline = timeout ? ::Time.new.to_f + timeout : nil synchronize do until async_state == :stopped cur_time = ::Time.new.to_f return false if deadline && cur_time >= deadline max_interval = @cleanup_options[:wait_interval] interval = deadline ? deadline - cur_time : max_interval interval = max_interval if interval > max_interval @lock_cond.wait interval end end true end ## # Abstract method that the inheriting classes should implement. # # This should be the main task job that will be run asynchronously and # repeatly. def run_backgrounder raise "#{self.class} class should override #run_backgrounder method" end ## # @private Cleanup this async job when process exists # def self.register_for_cleanup actor @exit_lock.synchronize do unless @cleanup_list @cleanup_list = [] at_exit { run_cleanup } end @cleanup_list.push actor end end ## # @private Take this async job off exit cleanup list # def self.unregister_for_cleanup actor @exit_lock.synchronize do @cleanup_list&.delete actor end end ## # @private Cleanup the async job # def self.run_cleanup @exit_lock.synchronize do return unless @cleanup_list @cleanup_list.shift.async_stop! until @cleanup_list.empty? end end private_class_method :run_cleanup private ## # @private Constructor to initialize MonitorMixin # def initialize super() @startup_lock = Mutex.new @cleanup_options = { wait_interval: WAIT_INTERVAL, timeout: CLEANUP_TIMEOUT, force: true } end ## # @private Wrapper method for running the async job. It runs a loop # while the condition allows, and it calls the run_backgrounder method. # This method also ensures the state variable gets set to :stopped when # it exits. def async_run_job until async_stopped? run_backgrounder return if async_stopping? && backgrounder_stoppable? end ensure @async_state = :stopped async_state_change end ## # @private Ensures the child thread is started and kick off the job # to run async_run_job. Also make calls register_for_cleanup on the # async job to make sure it exits properly. def ensure_thread raise "async_actor not initialized" if @startup_lock.nil? @startup_lock.synchronize do if (@thread.nil? || !@thread.alive?) && @async_state != :stopped @lock_cond = new_cond AsyncActor.register_for_cleanup self @async_state = :running async_state_change @thread = Thread.new do async_run_job AsyncActor.unregister_for_cleanup self end end end end ## # @private Set cleanup options. # # @param [Hash] kwargs Hash of cleanup options. `:timeout` is the cleanup # wait timeout. `:wait_interval` is the cleanup wait interval. `:force` # for forcefully terminate actor when all other options fail. def set_cleanup_options **kwargs @cleanup_options.merge! kwargs end ## # @private Default backgrounder stop condition when asked to be stopped # gracefully. Called from #async_run_job when async actor state changes # to :stopping def backgrounder_stoppable? true end ## # @private Handler when the async actor's state changes. Call # the `on_async_state_change` callback function if it's defined. def async_state_change on_async_state_change synchronize do @lock_cond.broadcast end end ## # @private Default abstract definition of this function that's a no-op. # The extending classes can override this method to handle state changing # logic. def on_async_state_change end end end end stackdriver-core-1.7.0/.yardopts0000644000004100000410000000027415143462016016671 0ustar www-datawww-data--no-private --title=Stackdriver Core --markup markdown --markup-provider redcarpet --main OVERVIEW.md ./lib/**/*.rb - OVERVIEW.md CONTRIBUTING.md CHANGELOG.md CODE_OF_CONDUCT.md LICENSE stackdriver-core-1.7.0/CODE_OF_CONDUCT.md0000644000004100000410000000367715143462016017634 0ustar www-datawww-data# Contributor Code of Conduct As contributors and maintainers of this project, and in the interest of fostering an open and welcoming community, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities. We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, religion, or nationality. Examples of unacceptable behavior by participants include: * The use of sexualized language or imagery * Personal attacks * Trolling or insulting/derogatory comments * Public or private harassment * Publishing other's private information, such as physical or electronic addresses, without explicit permission * Other unethical or unprofessional conduct. Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. By adopting this Code of Conduct, project maintainers commit themselves to fairly and consistently applying these principles to every aspect of managing this project. Project maintainers who do not follow or enforce the Code of Conduct may be permanently removed from the project team. This code of conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers. This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.2.0, available at [http://contributor-covenant.org/version/1/2/0/](http://contributor-covenant.org/version/1/2/0/) stackdriver-core-1.7.0/stackdriver-core.gemspec0000644000004100000410000000301415143462016021632 0ustar www-datawww-data######################################################### # This file has been automatically generated by gem2tgz # ######################################################### # -*- encoding: utf-8 -*- # stub: stackdriver-core 1.7.0 ruby lib Gem::Specification.new do |s| s.name = "stackdriver-core".freeze s.version = "1.7.0".freeze s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version= s.require_paths = ["lib".freeze] s.authors = ["Daniel Azuma".freeze] s.date = "2025-03-04" s.description = "stackdriver-core is an internal shared library for the Ruby Stackdriver integration libraries.".freeze s.email = ["dazuma@google.com".freeze] s.files = [".yardopts".freeze, "CHANGELOG.md".freeze, "CODE_OF_CONDUCT.md".freeze, "CONTRIBUTING.md".freeze, "LICENSE".freeze, "OVERVIEW.md".freeze, "lib/stackdriver-core.rb".freeze, "lib/stackdriver/core.rb".freeze, "lib/stackdriver/core/async_actor.rb".freeze, "lib/stackdriver/core/configuration.rb".freeze, "lib/stackdriver/core/trace_context.rb".freeze, "lib/stackdriver/core/version.rb".freeze] s.homepage = "https://github.com/googleapis/google-cloud-ruby/tree/master/stackdriver-core".freeze s.licenses = ["Apache-2.0".freeze] s.required_ruby_version = Gem::Requirement.new(">= 3.0".freeze) s.rubygems_version = "3.6.5".freeze s.summary = "Internal shared library for Ruby Stackdriver integration".freeze s.specification_version = 4 s.add_runtime_dependency(%q.freeze, ["~> 1.2".freeze]) end stackdriver-core-1.7.0/LICENSE0000644000004100000410000002613715143462016016036 0ustar www-datawww-data Apache License Version 2.0, January 2004 https://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at https://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. stackdriver-core-1.7.0/CHANGELOG.md0000644000004100000410000000234215143462016016632 0ustar www-datawww-data# Release History ### 1.7.0 (2025-03-04) #### Features * Update minimum Ruby version to 3.0 ([#29261](https://github.com/googleapis/google-cloud-ruby/issues/29261)) ### 1.6.0 (2024-03-07) #### Features * Update minimum supported Ruby version to 2.7 ([#25298](https://github.com/googleapis/google-cloud-ruby/issues/25298)) ### 1.5.0 / 2021-03-10 #### Features * Drop support for Ruby 2.4 and add support for Ruby 3.0 ### 1.4.0 / 2019-10-23 Now requires Ruby 2.4 or later. ### 1.3.4 / 2019-08-23 #### Documentation * Update documentation ### 1.3.3 / 2018-09-20 * Update documentation. * Change documentation URL to googleapis GitHub org. ### 1.3.2 / 2018-09-12 * Add missing documentation files to package. ### 1.3.1 / 2018-09-10 * Update documentation. ### 1.3.0 / 2018-02-27 * Use Google Cloud Shared Configuration. ### 1.2.0 / 2017-07-11 * Introduce `Stackdriver::Core::AsyncActor` module, used by stackdriver gems to perform asynchronous jobs. ### 1.1.0 / 2017-05-25 * Introduce new Stackdriver instrumentation configuration interface. ### 1.0.0 / 2017-03-31 * Release 1.0 ### 0.21.0 / 2016-12-22 * Initial release of shared code for Stackdriver related client libraries. * Provided trace context management code.