Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft: Logs SDK, OTLP exporter #6

Draft
wants to merge 106 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
106 commits
Select commit Hold shift + click to select a range
f8dddfe
Implement LoggerProvider#logger
kaylareopelle Aug 9, 2023
0dc0f7c
Associate a Resource with LoggerProvider
kaylareopelle Aug 9, 2023
b917fa9
resource, processors, mutex
kaylareopelle Aug 9, 2023
b618b84
Write test for add_log_record_processor
kaylareopelle Aug 14, 2023
d9609be
Implement LoggerProvider#shutdown
kaylareopelle Aug 14, 2023
e7aa448
LoggerProvider#shutdown with arg on processor
kaylareopelle Aug 15, 2023
8869933
Temp class comment on LogRecordProcessor
kaylareopelle Aug 15, 2023
dcb307a
LogRecordProcessor#force_flush
kaylareopelle Aug 15, 2023
96f89bd
Cleanup
kaylareopelle Aug 16, 2023
44665d3
Bump versions
kaylareopelle Aug 16, 2023
201e517
Address feedback from fallwith
kaylareopelle Aug 18, 2023
6feaf08
Add more tests
kaylareopelle Aug 22, 2023
6a9abd3
Update tests and error handling
kaylareopelle Aug 22, 2023
2c8c3d3
Docs updates
kaylareopelle Aug 22, 2023
6791bc9
Add links
kaylareopelle Aug 22, 2023
7652a59
feat: Create SDK LogRecord
kaylareopelle Aug 16, 2023
78e6008
Update documentation
kaylareopelle Aug 25, 2023
98b5b06
draft log record processors
kaylareopelle Aug 16, 2023
71b6414
More WIP log record processors
kaylareopelle Aug 25, 2023
c943ca9
Initial log_record_processor
kaylareopelle Sep 1, 2023
db1a5a5
Initial simple log record processor
kaylareopelle Sep 1, 2023
81873ac
Initial Batch log record processor
kaylareopelle Sep 1, 2023
44e6d14
Add Logger#emit
kaylareopelle Sep 1, 2023
e53996a
Add LogRecordData
kaylareopelle Sep 1, 2023
d93f7b1
Add LogRecordExporter
kaylareopelle Sep 1, 2023
7845691
Remove processor from logs.rb
kaylareopelle Sep 1, 2023
55cb5d2
Move log record processor out of export
kaylareopelle Sep 1, 2023
b8a8304
Fix module name Log => Logs
kaylareopelle Sep 1, 2023
e0bdfe0
Trace => Logs test definition for log record processor
kaylareopelle Sep 1, 2023
5093d82
Trace => Logs exporter test
kaylareopelle Sep 1, 2023
43afe4d
Add log record processor tests
kaylareopelle Sep 1, 2023
e8cedbc
Move log_record_processor test out of export
kaylareopelle Sep 2, 2023
4e5d312
Sketch out tests for simple processor
kaylareopelle Sep 2, 2023
98ac3c6
Add test for #force_flush return value on exporter
kaylareopelle Sep 2, 2023
fdba25b
Remove hex methods from log_record_data, not used
kaylareopelle Sep 5, 2023
1704f42
Add Logger#emit tests
kaylareopelle Sep 5, 2023
5f7a051
Add tests for simple log record processor
kaylareopelle Sep 6, 2023
133c97a
Define LogRecord#to_log_record_data
kaylareopelle Sep 6, 2023
535af7b
Exclude test files from Simplecov
kaylareopelle Sep 6, 2023
a071638
WIP test
kaylareopelle Sep 13, 2023
b1e3756
initial in memory log record exporter
kaylareopelle Sep 13, 2023
baab58b
Add ExportError
kaylareopelle Sep 13, 2023
354cb85
Update BatchLogRecordProcessor
kaylareopelle Sep 13, 2023
7488f7a
Finish batch_log_record_processor tests
kaylareopelle Sep 13, 2023
0b638af
Add ConsoleLogRecordExporter
kaylareopelle Sep 13, 2023
8a403a8
Finish InMemoryLogRecordExporter
kaylareopelle Sep 13, 2023
b5ace43
Update ConsoleLogRecordExporter tests
kaylareopelle Sep 13, 2023
c5b2194
Add force_flush test for InMemoryLogRecordExporter
kaylareopelle Sep 13, 2023
00ab8df
Initial LogRecordLimits work
kaylareopelle Sep 14, 2023
703f57a
Fix LogRecordLimits
kaylareopelle Sep 14, 2023
e1deddc
Remote limits todo
kaylareopelle Sep 15, 2023
03eb454
Remove log record processor todo
kaylareopelle Sep 15, 2023
2e57f60
Remove simple span processor todo
kaylareopelle Sep 15, 2023
679c222
Implement log record attribute limits
kaylareopelle Sep 15, 2023
b56739b
Fix assert_nil in log record test
kaylareopelle Sep 15, 2023
2b000ee
Remove sampling from simple log record processor
kaylareopelle Sep 15, 2023
bb0d736
LogRecordExporter remove sampled text
kaylareopelle Sep 15, 2023
cf30286
InMemoryLogRecordExporter remove sampled text
kaylareopelle Sep 15, 2023
702502b
BatchLogRecordProcessor remove sampled
kaylareopelle Sep 15, 2023
6c3c252
Make SpanContext optional in LogRecord#to_log_record_data
kaylareopelle Sep 15, 2023
dd9b877
Add @skip_instrumenting to OpenTelemetry.logger
kaylareopelle Sep 25, 2023
46011ab
Initial commit otlp-logs
kaylareopelle Sep 25, 2023
4d8e5f3
Add logger_provider methods to logs_api
kaylareopelle Sep 25, 2023
b964d45
Create proxy_logger and proxy_logger_provider
kaylareopelle Sep 25, 2023
de28615
Add instrument_registry to Logs::Logger
kaylareopelle Sep 25, 2023
7f877d3
Create configuration patch to export logs w/sdk
kaylareopelle Sep 25, 2023
15e1fd8
Add unix_nano methods for LogRecordData timestamps
kaylareopelle Sep 25, 2023
41fe05b
Add instrumentation_regirstry to LoggerProvider
kaylareopelle Sep 25, 2023
63936a4
Logger - span_context by default, remove arg
kaylareopelle Sep 25, 2023
74d7878
Update logger provider tests to account for error message constant an…
kaylareopelle Sep 25, 2023
8e93285
LogRecordProcessor on_emit => emit
kaylareopelle Sep 25, 2023
59d06a9
Fix logger#emit test
kaylareopelle Sep 25, 2023
c0d5507
Add severity_number and dropped attributes logic
kaylareopelle Oct 3, 2023
86fc525
Update copied exporter test for logs exporter
kaylareopelle Oct 3, 2023
04b8144
Add create_log_record_data to test helpers
kaylareopelle Oct 3, 2023
5c85a3d
Create add_log_record_processor method in Configurator
kaylareopelle Oct 3, 2023
9776315
Add stopped and registry tests to logger provider
kaylareopelle Oct 3, 2023
60e7378
Update timestamp default to include :nanosecond in Logger
kaylareopelle Oct 3, 2023
6c93b03
Document log record limits arg on LoggerProvider#initialize
kaylareopelle Oct 3, 2023
7a3c42c
LogRecord updates for attribute counting, nanosecond time
kaylareopelle Oct 3, 2023
23bfc49
Logger update docs to use :nanosecond
kaylareopelle Oct 3, 2023
c74c92b
Create add_log_record_processor method in configuration patch
kaylareopelle Oct 3, 2023
5cf254d
Update timestamp methods to use correct format, add total_recorded_attrs
kaylareopelle Oct 3, 2023
3c03cc9
Merge branch 'main' into log-record-processor3
kaylareopelle Jan 3, 2024
adda555
Log result code
kaylareopelle Jan 10, 2024
f524ee6
Add some logging
kaylareopelle Jan 10, 2024
c0595b7
Remove API Severity Number
kaylareopelle Feb 27, 2024
35d861f
Add changes from LoggerProvider PR, merge main
kaylareopelle Feb 27, 2024
6c1b008
Merge branch 'main' into log-record-processor3
kaylareopelle Apr 4, 2024
55799eb
Merge branch 'main' into log-record-processor3
kaylareopelle Apr 9, 2024
65e13be
Update version of OTLP logs
kaylareopelle Apr 9, 2024
619dd16
Remove error logs with HTTP response
kaylareopelle Apr 19, 2024
9bf5910
feat: Update use of Context/SpanContext
kaylareopelle Apr 26, 2024
ccecc77
Skip failing logger provider registry test
kaylareopelle Apr 26, 2024
3795ae9
chore: Update logger test
kaylareopelle May 14, 2024
0171761
chore: Update condition to match upstream
kaylareopelle May 14, 2024
bd16be2
Merge pull request #8 from kaylareopelle/span_context_to_context
kaylareopelle May 14, 2024
5c01a4c
Merge branch 'main' into log-record-processor-with-emit-updates
kaylareopelle Jul 26, 2024
98580c5
Update log_record_limits
kaylareopelle Jul 26, 2024
c79f528
Merge pull request #9 from kaylareopelle/log-record-processor-with-em…
kaylareopelle Jul 31, 2024
1d7f17e
chore: Refactor log attribute truncation
kaylareopelle Jul 31, 2024
97880fe
chore: Test refactors
kaylareopelle Jul 31, 2024
1f7c92c
chore: Rubocop
kaylareopelle Jul 31, 2024
bcfa2af
Merge branch 'main' into log-record-processor3
kaylareopelle Aug 26, 2024
ea0a49c
Merge branch 'main' into log-record-processor3
kaylareopelle Aug 27, 2024
e5c03c3
Merge branch 'main' into log-record-processor3
kaylareopelle Sep 17, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion api/lib/opentelemetry.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,11 @@ module OpenTelemetry

# @return [Object, Logger] configured Logger or a default STDOUT Logger.
def logger
@logger ||= Logger.new($stdout, level: ENV['OTEL_LOG_LEVEL'] || Logger::INFO)
@logger ||= create_logger
# alternately: Logger.new($stdout, level: ENV['OTEL_LOG_LEVEL'] || Logger::INF, progname: 'OpenTelemetry')
# and clean up the log messages that are prefixed with "OpenTelemetry"
# if we want log records generated for OpenTelemetry logs, I think we can do that, but I imagine this is
# "untraced" territory
end

# @return [Callable] configured error handler or a default that logs the
Expand Down Expand Up @@ -69,4 +73,15 @@ def tracer_provider
def propagation
@propagation ||= Context::Propagation::NoopTextMapPropagator.new
end

private

def create_logger
logger = Logger.new($stdout, level: ENV['OTEL_LOG_LEVEL'] || Logger::INFO)
# @skip_instrumenting prevents Ruby Logger instrumentation from
# triggering a stack overflow. Logs emitted using OpenTelemetry.logger
# will not be turned into OpenTelemetry LogRecords.
logger.instance_variable_set(:@skip_instrumenting, true)
logger
end
end
42 changes: 42 additions & 0 deletions exporter/otlp-logs/.rubocop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
AllCops:
TargetRubyVersion: "3.0"
NewCops: disable
SuggestExtensions: false
Exclude:
- "lib/opentelemetry/proto/**/*"
- "vendor/**/*"

Bundler/OrderedGems:
Exclude:
- gemfiles/**/*
Lint/UnusedMethodArgument:
Enabled: false
Lint/MissingSuper:
Enabled: false
Lint/ConstantDefinitionInBlock:
Exclude:
- "test/**/*"
Style/StringConcatenation:
Exclude:
- "test/**/*"
Metrics/AbcSize:
Enabled: false
Layout/LineLength:
Enabled: false
Metrics/MethodLength:
Max: 20
Metrics/ParameterLists:
Enabled: false
Style/FrozenStringLiteralComment:
Exclude:
- gemfiles/**/*
Style/ModuleFunction:
Enabled: false
Style/StringLiterals:
Exclude:
- gemfiles/**/*
Metrics/BlockLength:
Enabled: false
Naming/FileName:
Exclude:
- "lib/opentelemetry-exporter-otlp.rb"
9 changes: 9 additions & 0 deletions exporter/otlp-logs/.yardopts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
--no-private
--title=OpenTelemetry OTLP Logs Exporter
--markup=markdown
--main=README.md
./lib/opentelemetry/exporter/otlp-logs/**/*.rb
./lib/opentelemetry/exporter/otlp.rb
-
README.md
CHANGELOG.md
12 changes: 12 additions & 0 deletions exporter/otlp-logs/Appraisals
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# frozen_string_literal: true

# Copyright The OpenTelemetry Authors
#
# SPDX-License-Identifier: Apache-2.0

(14..23).each do |i|
version = "3.#{i}"
appraise "google-protobuf-#{version}" do
gem 'google-protobuf', "~> #{version}"
end
end
182 changes: 182 additions & 0 deletions exporter/otlp-logs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,182 @@
# Release History: opentelemetry-exporter-otlp

### v0.26.1 / 2023-07-29

* FIXED: Regenerate v0.20.0 protos
* ADDED: Allow google-protobuf ~> 3.14

### v0.26.0 / 2023-06-13

* ADDED: Use OTLP 0.20.0 protos

### v0.25.0 / 2023-06-01

* BREAKING CHANGE: Remove support for EoL Ruby 2.7

* ADDED: Remove support for EoL Ruby 2.7
* FIXED: Make version available to user agent header #1458

### v0.24.1 / 2023-05-30

* FIXED: Add Ruby 3.2 to CI and do small fix
* FIXED: Adds User-Agent header in OTLP exporter

### v0.24.0 / 2022-09-14

* ADDED: Support InstrumentationScope, and update OTLP proto to 0.18.0
* FIXED: Handle OTLP exporter 404s discretely
* FIXED: `OTEL_EXPORTER_OTLP_ENDPOINT` appends the correct path with a trailing slash
* FIXED: OTLP exporter demo code
* DOCS: Update exporter default compression setting

### v0.23.0 / 2022-06-23

* ADDED: Report bundle size stats in exporter; also don't re-gzip unnecessarily

### v0.22.0 / 2022-06-09

* ADDED: Otlp grpc

### v0.21.3 / 2022-05-12

* (No significant changes)

### v0.21.2 / 2022-01-19

* FIXED: Default scheme for OTLP endpoint
* FIXED: Remove TIMEOUT status from OTLP exporter (#1087)

### v0.21.1 / 2021-12-31

* FIXED: Allow OTLP Exporter compression value of `none`

### v0.21.0 / 2021-12-01

* ADDED: Exporter should use gzip compression by default

### v0.20.6 / 2021-10-29

* FIXED: Add unexpected error handlign in BSP and OTLP exporter (#995)
* FIXED: Handle otlp exporter race condition gzip errors with retry

### v0.20.5 / 2021-09-29

* (No significant changes)

### v0.20.4 / 2021-09-29

* FIXED: OTLP Export Header Format

### v0.20.3 / 2021-08-19

* FIXED: OTLP exporter missing failure metrics

### v0.20.2 / 2021-08-12

* FIXED: Add rescue for OpenSSL errors during export
* DOCS: Update docs to rely more on environment variable configuration

### v0.20.1 / 2021-06-29

* FIXED: Otlp encoding exceptions again

### v0.20.0 / 2021-06-23

* BREAKING CHANGE: Total order constraint on span.status=

* FIXED: Total order constraint on span.status=

### v0.19.0 / 2021-06-03

* ADDED: Add a SSL verify mode option for the OTLP exporter
* FIXED: Handle OTLP exporter encoding exceptions
* DOCS: Remove the OTLP receiver legacy gRPC port(55680) references

### v0.18.0 / 2021-05-21

* BREAKING CHANGE: Replace Time.now with Process.clock_gettime

* FIXED: Replace Time.now with Process.clock_gettime
* FIXED: Rescue missed otlp exporter network errors

### v0.17.0 / 2021-04-22

* ADDED: Add zipkin exporter

### v0.16.0 / 2021-03-17

* BREAKING CHANGE: Implement Exporter#force_flush

* ADDED: Implement Exporter#force_flush
* FIXED: Rescue socket err in otlp exporter to prevent failures unable to connect
* DOCS: Replace Gitter with GitHub Discussions

### v0.15.0 / 2021-02-18

* BREAKING CHANGE: Streamline processor pipeline

* ADDED: Add otlp exporter hooks
* FIXED: Streamline processor pipeline

### v0.14.0 / 2021-02-03

* (No significant changes)

### v0.13.0 / 2021-01-29

* BREAKING CHANGE: Spec compliance for OTLP exporter

* ADDED: Add untraced wrapper to common utils
* FIXED: Spec compliance for OTLP exporter
* FIXED: Conditionally append path to collector endpoint
* FIXED: OTLP path should be /v1/traces
* FIXED: Rename OTLP env vars SPAN -> TRACES

### v0.12.1 / 2021-01-13

* FIXED: Updated protobuf version dependency

### v0.12.0 / 2020-12-24

* (No significant changes)

### v0.11.0 / 2020-12-11

* BREAKING CHANGE: Implement tracestate

* ADDED: Implement tracestate
* ADDED: Metrics reporting from trace export
* FIXED: Copyright comments to not reference year

### v0.10.0 / 2020-12-03

* (No significant changes)

### v0.9.0 / 2020-11-27

* BREAKING CHANGE: Add timeout for force_flush and shutdown

* ADDED: Add timeout for force_flush and shutdown
* FIXED: Remove unused kwarg from otlp exporter retry

### v0.8.0 / 2020-10-27

* BREAKING CHANGE: Move context/span methods to Trace module
* BREAKING CHANGE: Remove 'canonical' from status codes
* BREAKING CHANGE: Assorted SpanContext fixes

* FIXED: Move context/span methods to Trace module
* FIXED: Remove 'canonical' from status codes
* FIXED: Add gzip support to OTLP exporter
* FIXED: Assorted SpanContext fixes

### v0.7.0 / 2020-10-07

* FIXED: OTLP parent_span_id should be nil for root
* DOCS: Fix use of add_event in OTLP doc
* DOCS: Standardize toplevel docs structure and readme
* DOCS: Use BatchSpanProcessor in examples

### v0.6.0 / 2020-09-10

* Initial release.
20 changes: 20 additions & 0 deletions exporter/otlp-logs/Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# frozen_string_literal: true

# Copyright The OpenTelemetry Authors
#
# SPDX-License-Identifier: Apache-2.0

source 'https://rubygems.org'

gemspec

group :test, :development do
gem 'opentelemetry-api', path: '../../api'
gem 'opentelemetry-common', path: '../../common'
gem 'opentelemetry-logs-api', path: '../../logs_api'
gem 'opentelemetry-logs-sdk', path: '../../logs_sdk'
gem 'opentelemetry-registry', path: '../../registry'
gem 'opentelemetry-sdk', path: '../../sdk'
gem 'opentelemetry-semantic_conventions', path: '../../semantic_conventions'
gem 'opentelemetry-test-helpers', path: '../../test_helpers'
end
Loading
Loading