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

Add missing logging for metrics at 'debug' level #1108

Merged
merged 1 commit into from Jun 11, 2020
Merged

Add missing logging for metrics at 'debug' level #1108

merged 1 commit into from Jun 11, 2020

Conversation

nilebox
Copy link
Member

@nilebox nilebox commented Jun 11, 2020

Description:
Fixing a bug - enable metrics' debug logging in Logging Exporter

Link to tracking Issue: Fixes #1107

Testing:
Manual testing: simply run a collector with --log-level=DEBUG and the following config:

receivers:
  prometheus:
    config:
      scrape_configs:
      - job_name: "test"
        scrape_interval: 60s
        static_configs:
        - targets: ["localhost:8888"]
exporters:
  logging:
    loglevel: debug
service:
  pipelines:
    metrics:
      receivers: [prometheus]
      exporters: [logging]

The log now includes detailed information at the DEBUG level:

2020-06-11T14:13:08.697+1000	INFO	loggingexporter/logging_exporter.go:169	MetricsExporter	{"#metrics": 4}
2020-06-11T14:13:08.697+1000	DEBUG	loggingexporter/logging_exporter.go:213	ResourceMetrics #0
Resource labels:
     -> port: STRING(8888)
     -> scheme: STRING(http)
     -> service.name: STRING(test)
     -> host.hostname: STRING(localhost)
InstrumentationLibraryMetrics #0
Metric #0
Descriptor:
     -> Name: otelcol_process_cpu_seconds
     -> Description: Total CPU user and system time in seconds
     -> Unit: s
     -> Type: GAUGE_DOUBLE
Metric #1
Descriptor:
     -> Name: otelcol_process_runtime_heap_alloc_bytes
     -> Description: Bytes of allocated heap objects (see 'go doc runtime.MemStats.HeapAlloc')
     -> Unit: By
     -> Type: GAUGE_DOUBLE
Metric #2
Descriptor:
     -> Name: otelcol_process_runtime_total_alloc_bytes
     -> Description: Cumulative bytes allocated for heap objects (see 'go doc runtime.MemStats.TotalAlloc')
     -> Unit: By
     -> Type: GAUGE_DOUBLE
Metric #3
Descriptor:
     -> Name: otelcol_process_runtime_total_sys_memory_bytes
     -> Description: Total bytes of memory obtained from the OS (see 'go doc runtime.MemStats.Sys')
     -> Unit: By
     -> Type: GAUGE_DOUBLE

Documentation: N/A

@codecov
Copy link

codecov bot commented Jun 11, 2020

Codecov Report

Merging #1108 into master will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #1108   +/-   ##
=======================================
  Coverage   86.45%   86.45%           
=======================================
  Files         198      198           
  Lines       14171    14172    +1     
=======================================
+ Hits        12251    12252    +1     
  Misses       1468     1468           
  Partials      452      452           
Impacted Files Coverage Δ
exporter/loggingexporter/logging_exporter.go 80.14% <100.00%> (+0.14%) ⬆️
translator/internaldata/resource_to_oc.go 76.47% <0.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8b9fe07...7ba4c8a. Read the comment docs.

Copy link
Member

@dmitryax dmitryax left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@bogdandrutu bogdandrutu merged commit ccf10f0 into open-telemetry:master Jun 11, 2020
@nilebox nilebox deleted the fix-logging-exporter-debug branch June 12, 2020 02:30
wyTrivail pushed a commit to mxiamxia/opentelemetry-collector that referenced this pull request Jul 13, 2020
MovieStoreGuy pushed a commit to atlassian-forks/opentelemetry-collector that referenced this pull request Nov 11, 2021
* Unify API Span Start/End Options

Replace both with `SpanOption`. Add a unified `SpanConfig` to match and
a `SpanConfigure` function to parse a `SpanConfig` from `SpanOption`s.

Update all the related options to use new `SpanOption`s.

* No non-zero SpanConfig defaults

The SDK uses an internal clock for the current time that cannot be use
if it does not know the time has not been set.

* Append attributes for WithAttributes

This preserves existing behavior.

* Add unit test for SpanConfigure

* Propagate changes

* Update append option documentation

* Update testing comments

* Move comments on guarantees to appropriate function

* Add documentation for SDK methods

Include SDK implementation specific information in the Tracer Start
method and Span End method.

* Add changes to Changelog

* Apply suggestions from code review

Co-authored-by: ET <evantorrie@users.noreply.github.com>

* Update the SpanKind comment in the  SpanConfig

Try for a less tautological comment.

Co-authored-by: ET <evantorrie@users.noreply.github.com>
hughesjj pushed a commit to hughesjj/opentelemetry-collector that referenced this pull request Apr 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Logging Exporter doesn't log metrics details at 'debug' level
4 participants