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

Instrument proctelemetry.ProcessMetrics #6886

Conversation

moh-osman3
Copy link
Contributor

@moh-osman3 moh-osman3 commented Jan 4, 2023

Description:

This PR instruments proctelemetry.ProcessMetrics with otel go. This is a followup PR that is based on similar changes made for obsreport.Receiver: #6222

Link to tracking Issue: Part of #816

Testing:
Built otelcorecol binary and checked metrics endpoint. Tested with and without featuregate.

% curl localhost:8888/metrics
# HELP otelcol_process_cpu_seconds_total Total CPU user and system time in seconds
# TYPE otelcol_process_cpu_seconds_total counter
otelcol_process_cpu_seconds_total 0.19
# HELP otelcol_process_memory_rss Total physical memory (resident set size)
# TYPE otelcol_process_memory_rss gauge
otelcol_process_memory_rss 3.467264e+07
# HELP otelcol_process_runtime_heap_alloc_bytes Bytes of allocated heap objects (see 'go doc runtime.MemStats.HeapAlloc')
# TYPE otelcol_process_runtime_heap_alloc_bytes gauge
otelcol_process_runtime_heap_alloc_bytes 5.4080584e+08
# HELP otelcol_process_runtime_total_alloc_bytes_total Cumulative bytes allocated for heap objects (see 'go doc runtime.MemStats.TotalAlloc')
# TYPE otelcol_process_runtime_total_alloc_bytes_total counter
otelcol_process_runtime_total_alloc_bytes_total 5.43115264e+08
# HELP otelcol_process_runtime_total_sys_memory_bytes Total bytes of memory obtained from the OS (see 'go doc runtime.MemStats.Sys')
# TYPE otelcol_process_runtime_total_sys_memory_bytes gauge
otelcol_process_runtime_total_sys_memory_bytes 5.78296976e+08
# HELP otelcol_process_uptime_total Uptime of the process
# TYPE otelcol_process_uptime_total counter
otelcol_process_uptime_total 104.306318
# HELP otelcol_target_info Target metadata
# TYPE otelcol_target_info gauge
otelcol_target_info{service_instance_id="26829589-afdd-4f5a-b201-b9339e01ff80",service_name="otelcorecol",service_version="0.68.0-dev"} 1

@codecov
Copy link

codecov bot commented Jan 4, 2023

Codecov Report

Base: 89.37% // Head: 89.28% // Decreases project coverage by -0.10% ⚠️

Coverage data is based on head (cff7f30) compared to base (272ebe6).
Patch coverage: 78.40% of modified lines in pull request are covered.

❗ Current head cff7f30 differs from pull request most recent head 8eab800. Consider uploading reports for the commit 8eab800 to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6886      +/-   ##
==========================================
- Coverage   89.37%   89.28%   -0.10%     
==========================================
  Files         286      283       -3     
  Lines       14017    14093      +76     
==========================================
+ Hits        12528    12583      +55     
- Misses       1219     1233      +14     
- Partials      270      277       +7     
Impacted Files Coverage Δ
service/service.go 66.14% <0.00%> (ø)
...ervice/internal/proctelemetry/process_telemetry.go 73.97% <79.31%> (+2.18%) ⬆️
exporter/loggingexporter/config.go 64.51% <0.00%> (-9.68%) ⬇️
confmap/confmap.go 89.93% <0.00%> (-0.19%) ⬇️
pdata/internal/wrapper_tracestate.go
pdata/internal/wrapper_value.go
pdata/internal/wrapper_map.go
pdata/internal/wrapper_slice.go
pdata/internal/wrapper_common.go 100.00% <0.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@moh-osman3 moh-osman3 marked this pull request as ready for review January 4, 2023 20:02
@moh-osman3 moh-osman3 requested a review from a team as a code owner January 4, 2023 20:02
@moh-osman3
Copy link
Contributor Author

@jpkrohling @bogdandrutu @paivagustavo This is my latest instrumentation PR. It should be ready for review if y'all have any feedback! Thank you!

@jmacd
Copy link
Contributor

jmacd commented Jan 17, 2023

Looks good to me. FWIW eventually I would like to see this stuff replaced with an otel-go metrics instrumentation library, for example here https://github.com/lightstep/otel-launcher-go/tree/main/lightstep/instrumentation/runtime.

service/service_test.go Outdated Show resolved Hide resolved
service/internal/proctelemetry/process_telemetry.go Outdated Show resolved Hide resolved
@moh-osman3 moh-osman3 force-pushed the mohosman/instrument-proctelemetry-with-otel branch from e105849 to fc77a3b Compare January 22, 2023 18:46
@moh-osman3 moh-osman3 requested review from codeboten and removed request for djaglowski January 23, 2023 17:03
@moh-osman3 moh-osman3 force-pushed the mohosman/instrument-proctelemetry-with-otel branch from 72aa2ba to 81186dc Compare January 24, 2023 22:50
Copy link
Member

@bogdandrutu bogdandrutu left a comment

Choose a reason for hiding this comment

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

This needs updates because of API update in otel.

Copy link
Member

@bogdandrutu bogdandrutu left a comment

Choose a reason for hiding this comment

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

Please rebase, will need API fixes.

@moh-osman3 moh-osman3 force-pushed the mohosman/instrument-proctelemetry-with-otel branch 2 times, most recently from d6e6442 to ec5824c Compare January 30, 2023 21:09
@moh-osman3
Copy link
Contributor Author

moh-osman3 commented Jan 30, 2023

Please rebase, will need API fixes.

@bogdandrutu Thanks for pointing this out! I just updated based on the otel api changes. Can you please take another look?

@moh-osman3 moh-osman3 force-pushed the mohosman/instrument-proctelemetry-with-otel branch from ec5824c to 6a3b6e3 Compare January 31, 2023 06:25
@moh-osman3 moh-osman3 force-pushed the mohosman/instrument-proctelemetry-with-otel branch from f9d294f to cff7f30 Compare January 31, 2023 18:09
@moh-osman3 moh-osman3 force-pushed the mohosman/instrument-proctelemetry-with-otel branch from cff7f30 to 95b539f Compare February 1, 2023 06:37
@moh-osman3
Copy link
Contributor Author

@bogdandrutu @codeboten I rebased my change but noticed the contrib tests are now failing. Does the contrib repo need to be updated or is there a recent commit in the last 15 hours that is causing this failure? I don't see any references to proctelemetry in the contrib repo at all, so I'm a little confused here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants