Skip to content

Conversation

@Dainerx
Copy link
Contributor

@Dainerx Dainerx commented Feb 17, 2025

Description

I discovered this issue while trying to upgrade the opentelemetry collector from v0.111.0 to v0.119.0 that was released two weeks ago. To reproduce please take a look at the issue below.

Link to tracking issue

Fixes #12402

Testing

Run make generate on a processor or connector component

@Dainerx Dainerx requested review from a team and dmitryax as code owners February 17, 2025 10:29
@Dainerx Dainerx force-pushed the fix/cmd/mdatada-gen-metrics branch from c7f4818 to bb83847 Compare February 17, 2025 10:35
@codecov
Copy link

codecov bot commented Feb 17, 2025

Codecov Report

Attention: Patch coverage is 90.62500% with 45 lines in your changes missing coverage. Please review.

Project coverage is 92.06%. Comparing base (dc4fab3) to head (062c7ef).
Report is 6 commits behind head on main.

Files with missing lines Patch % Lines
...leconnector/internal/metadata/generated_metrics.go 91.83% 27 Missing and 2 partials ⚠️
...pleconnector/internal/metadata/generated_config.go 82.85% 8 Missing and 4 partials ⚠️
...econnector/internal/metadata/generated_resource.go 91.11% 4 Missing ⚠️

❌ Your patch status has failed because the patch coverage (90.62%) is below the target coverage (95.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #12403      +/-   ##
==========================================
- Coverage   92.09%   92.06%   -0.03%     
==========================================
  Files         473      477       +4     
  Lines       25590    26070     +480     
==========================================
+ Hits        23567    24002     +435     
- Misses       1612     1651      +39     
- Partials      411      417       +6     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Dainerx Dainerx force-pushed the fix/cmd/mdatada-gen-metrics branch from bb83847 to 4355c04 Compare February 17, 2025 16:22
@bogdandrutu
Copy link
Member

@Dainerx what other component do you have that emits metrics?

@Dainerx
Copy link
Contributor Author

Dainerx commented Feb 17, 2025

@bogdandrutu in my use case, processors and connectors do emit metrics.

My main concern is the if statement surrounding only the function signature. Also, I expected adding a new class in the metadata schema.

@bogdandrutu
Copy link
Member

My main concern is the if statement surrounding only the function signature. Also, I expected adding a new class in the metadata schema.

That should be fixed.

processors and connectors do emit metrics.

How come? I can see why connectors may do it, but how come the processors?

@Dainerx
Copy link
Contributor Author

Dainerx commented Feb 18, 2025

How come? I can see why connectors may do it, but how come the processors?

Processors can have mutate data capabilities, the metrics generation processor does generate metrics. Although, this is possible, I agree with you it's not a best practice to use a processor to generate metrics.

I am fine with only supporting connector scrapper, and receiver. We should also:

  1. Add a sample connector to be used for testing purposes to check the output of mdatagen against it
  2. Update the README file.

WDYT?

@Dainerx Dainerx changed the title [chore] Remove conditional statement on metrics.go.tmpl NewMetricsBuilder [chore] Support connector in metrics.go.tmpl NewMetricsBuilder Feb 18, 2025
@Dainerx Dainerx force-pushed the fix/cmd/mdatada-gen-metrics branch from 4355c04 to 9dded0f Compare February 18, 2025 12:28
@bogdandrutu
Copy link
Member

I am ok with this proposal.

@Dainerx Dainerx force-pushed the fix/cmd/mdatada-gen-metrics branch 2 times, most recently from 0a0f205 to 7d5fcd2 Compare February 18, 2025 16:57
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.

I am not sure what changed, but this looks very strange that every line is updated.

@Dainerx Dainerx force-pushed the fix/cmd/mdatada-gen-metrics branch 2 times, most recently from 31d7313 to 54a8c7c Compare February 20, 2025 12:14
@Dainerx Dainerx force-pushed the fix/cmd/mdatada-gen-metrics branch from d410125 to 4207422 Compare February 26, 2025 17:51
description: Attribute with a map value.
type: map

metrics:
Copy link
Member

Choose a reason for hiding this comment

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

Why is this added to a connector? The metrics section is supposed to be set on scraping receivers only

Copy link
Member

@dmitryax dmitryax Feb 26, 2025

Choose a reason for hiding this comment

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

Sorry, I missed the discussion above... Do you have a connector emitting metrics open sourced? It's not in contrib, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sorry, I missed the discussion above... Do you have a connector emitting metrics open sourced? It's not in contrib, right?

Right

status:
# Required: The class of the component (For example receiver)
class: <receiver|processor|exporter|connector|extension|cmd|pkg|scraper|converter|provider>
class: <receiver|processor|exporter|connector|extension|scraper|cmd|pkg>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Revert changes here

@Dainerx Dainerx force-pushed the fix/cmd/mdatada-gen-metrics branch from 4207422 to 380f3b1 Compare February 27, 2025 17:09
@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Feb 27, 2025

CLA Signed

The committers listed above are authorized under a signed CLA.

  • ✅ login: Dainerx / name: Oussama Ben Ghorbel (062c7ef)

@Dainerx Dainerx force-pushed the fix/cmd/mdatada-gen-metrics branch 4 times, most recently from 26d7c6d to acdde27 Compare February 28, 2025 14:05
@Dainerx Dainerx force-pushed the fix/cmd/mdatada-gen-metrics branch from acdde27 to c496a2f Compare February 28, 2025 15:10
@bogdandrutu bogdandrutu dismissed their stale review February 28, 2025 18:10

No longer blocking this.

@Dainerx Dainerx force-pushed the fix/cmd/mdatada-gen-metrics branch 8 times, most recently from da2b89b to c391970 Compare March 4, 2025 14:36
@Dainerx Dainerx force-pushed the fix/cmd/mdatada-gen-metrics branch from c391970 to af176e3 Compare March 6, 2025 13:59
@Dainerx
Copy link
Contributor Author

Dainerx commented Mar 6, 2025

Pinging for review @dmitryax @sincejune @bogdandrutu

@Dainerx Dainerx force-pushed the fix/cmd/mdatada-gen-metrics branch from af176e3 to 9330180 Compare March 10, 2025 12:27
@Dainerx Dainerx force-pushed the fix/cmd/mdatada-gen-metrics branch from 9330180 to 062c7ef Compare March 12, 2025 15:35
@bogdandrutu bogdandrutu added this pull request to the merge queue Mar 13, 2025
Merged via the queue into open-telemetry:main with commit 4f9fc6b Mar 13, 2025
54 of 55 checks passed
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.

metadata generated_metrics compilation error (v119.0)

4 participants