-
Notifications
You must be signed in to change notification settings - Fork 252
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'markdownlint-link' of github.com:xuan-cao-swi/opentelem…
…etry-ruby into markdownlint-link
- Loading branch information
Showing
41 changed files
with
210 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
ot | ||
te |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# https://github.com/codespell-project/codespell | ||
[codespell] | ||
builtin = clear,rare,informal | ||
check-filenames = | ||
check-hidden = | ||
ignore-words = .codespellignore | ||
interactive = 1 | ||
skip = .git,venv,coverage,doc,docs | ||
uri-ignore-words-list = * | ||
write = |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,4 +22,7 @@ | |
# rbenv configuration | ||
.ruby-version | ||
|
||
# Python virtual env for codespell | ||
venv | ||
|
||
tags |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# Virtualized python tools via docker | ||
|
||
# The directory where the virtual environment is created. | ||
VENVDIR := venv | ||
|
||
PYTOOLS := $(VENVDIR)/bin | ||
|
||
# The pip executable in the virtual environment. | ||
PIP := $(PYTOOLS)/pip | ||
|
||
# The directory in the docker image where the current directory is mounted. | ||
WORKDIR := /workdir | ||
|
||
# The python image to use for the virtual environment. | ||
PYTHONIMAGE := python:3.11.3-slim-bullseye | ||
|
||
# Run the python image with the current directory mounted. | ||
DOCKERPY := docker run --rm -v "$(CURDIR):$(WORKDIR)" -w $(WORKDIR) $(PYTHONIMAGE) | ||
|
||
# Create a virtual environment for Python tools. | ||
$(PYTOOLS): | ||
# The `--upgrade` flag is needed to ensure that the virtual environment is | ||
# created with the latest pip version. | ||
@$(DOCKERPY) bash -c "python3 -m venv $(VENVDIR) && $(PIP) install --upgrade pip" | ||
|
||
# Install python packages into the virtual environment. | ||
$(PYTOOLS)/%: $(PYTOOLS) | ||
@$(DOCKERPY) $(PIP) install -r requirements.txt | ||
|
||
CODESPELL = $(PYTOOLS)/codespell | ||
$(CODESPELL): PACKAGE=codespell | ||
|
||
.PHONY: codespell | ||
codespell: $(CODESPELL) | ||
@$(DOCKERPY) $(CODESPELL) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 58 additions & 0 deletions
58
logs_sdk/lib/opentelemetry/sdk/logs/export/log_record_exporter.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
# frozen_string_literal: true | ||
|
||
# Copyright The OpenTelemetry Authors | ||
# | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
module OpenTelemetry | ||
module SDK | ||
module Logs | ||
module Export | ||
# LogRecordExporter describes a duck type. It is not required to | ||
# subclass this class to provide an implementation of LogRecordExporter, | ||
# provided the interface is satisfied. LogRecordExporter allows | ||
# different tracing services to export log record data in their own format. | ||
# | ||
# To export data an exporter MUST be registered to the {LoggerProvider} | ||
# using a {LogRecordProcessor} implementation. | ||
class LogRecordExporter | ||
def initialize | ||
@stopped = false | ||
end | ||
|
||
# Called to export {LogRecordData}s. | ||
# | ||
# @param [Enumerable<LogRecordData>] log_record_data the list of | ||
# {LogRecordData} to be exported. | ||
# @param [optional Numeric] timeout An optional timeout in seconds. | ||
# | ||
# @return [Integer] the result of the export. | ||
def export(log_record_data, timeout: nil) | ||
return SUCCESS unless @stopped | ||
|
||
FAILURE | ||
end | ||
|
||
# Called when {LoggerProvider#force_flush} is called, if this exporter is | ||
# registered to a {LoggerProvider} object. | ||
# | ||
# @param [optional Numeric] timeout An optional timeout in seconds. | ||
# @return [Integer] SUCCESS if no error occurred, FAILURE if a | ||
# non-specific failure occurred, TIMEOUT if a timeout occurred. | ||
def force_flush(timeout: nil) | ||
SUCCESS | ||
end | ||
|
||
# Called when {LoggerProvider#shutdown} is called, if this exporter is | ||
# registered to a {LoggerProvider} object. | ||
# | ||
# @param [optional Numeric] timeout An optional timeout in seconds. | ||
def shutdown(timeout: nil) | ||
@stopped = true | ||
SUCCESS | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
logs_sdk/test/opentelemetry/sdk/logs/export/log_record_exporter_test.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# frozen_string_literal: true | ||
|
||
# Copyright The OpenTelemetry Authors | ||
# | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
require 'test_helper' | ||
|
||
describe OpenTelemetry::SDK::Logs::Export::LogRecordExporter do | ||
export = OpenTelemetry::SDK::Logs::Export | ||
|
||
let(:log_record_data1) { OpenTelemetry::SDK::Logs::LogRecordData.new({ name: 'name1' }) } | ||
let(:log_record_data2) { OpenTelemetry::SDK::Logs::LogRecordData.new({ name: 'name2' }) } | ||
let(:log_records) { [log_record_data1, log_record_data2] } | ||
let(:exporter) { export::LogRecordExporter.new } | ||
|
||
it 'accepts an Array of LogRecordData as arg to #export and succeeds' do | ||
_(exporter.export(log_records)).must_equal export::SUCCESS | ||
end | ||
|
||
it 'accepts an Enumerable of LogRecordData as arg to #export and succeeds' do | ||
enumerable = Struct.new(:log_record0, :log_record1).new(log_records[0], log_records[1]) | ||
|
||
_(exporter.export(enumerable)).must_equal export::SUCCESS | ||
end | ||
|
||
it 'accepts calls to #shutdown' do | ||
exporter.shutdown | ||
end | ||
|
||
it 'fails to export after shutdown' do | ||
exporter.shutdown | ||
_(exporter.export(log_records)).must_equal export::FAILURE | ||
end | ||
|
||
it 'returns SUCCESS when #force_flush is called' do | ||
assert(export::SUCCESS, exporter.force_flush) | ||
end | ||
end |
Oops, something went wrong.