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

[chore][receivercreator] docs: add data type to endpoints variables #31407

Merged

Conversation

chenlujjj
Copy link
Contributor

@chenlujjj chenlujjj commented Feb 25, 2024

Description:

Adding data type to endpoints(pod/port/node/...) variables in the readme doc.
The reason why I'd like to do this is, I tried to use the receiver creator to scrape metrics with prometheus receiver and the configuration is like:

receiver_creator/1:
    receivers:
      prometheus_simple/app_pods:
        rule: type == "port" && pod.annotations["prometheus.io/scrape"] == "true" && ( port == pod.annotations["prometheus.io/port"] || name == pod.annotations["prometheus.io/port"] )
        config:
          endpoint: '`endpoint`'
          metrics_path: '`"prometheus.io/path" in pod.annotations ? pod.annotations["prometheus.io/path"] : "/metrics"`'
          collection_interval: '`"prometheus.io/collection_interval" in pod.annotations ? pod.annotations["prometheus.io/collection_interval"] : "10s"`'

I made a silly mistake here in port == pod.annotations["prometheus.io/port"], I ignored the data type of port variable and it took me a while to fix it.
So I think it will help others and avoid such kinds of mistakes to add the data types in readme.

Link to tracking Issue:

Testing:

Documentation:

@chenlujjj chenlujjj requested a review from a team as a code owner February 25, 2024 14:14
@andrzej-stencel andrzej-stencel changed the title [receiver creator] add data type to endpoints variables [chore] [receivercreator] add data type to endpoints variables Feb 26, 2024
@andrzej-stencel andrzej-stencel changed the title [chore] [receivercreator] add data type to endpoints variables [chore][receivercreator] docs: add data type to endpoints variables Feb 26, 2024
@andrzej-stencel andrzej-stencel added the Skip Changelog PRs that do not require a CHANGELOG.md entry label Feb 26, 2024
@dmitryax
Copy link
Member

Thanks @chenlujjj!

@dmitryax dmitryax merged commit 9378d9b into open-telemetry:main Feb 27, 2024
147 of 148 checks passed
@github-actions github-actions bot added this to the next release milestone Feb 27, 2024
XinRanZhAWS pushed a commit to XinRanZhAWS/opentelemetry-collector-contrib that referenced this pull request Mar 13, 2024
…pen-telemetry#31407)

**Description:**

Adding data type to endpoints(pod/port/node/...) variables in the readme
doc.
The reason why I'd like to do this is, I tried to use the receiver
creator to scrape metrics with prometheus receiver and the configuration
is like:
```
receiver_creator/1:
    receivers:
      prometheus_simple/app_pods:
        rule: type == "port" && pod.annotations["prometheus.io/scrape"] == "true" && ( port == pod.annotations["prometheus.io/port"] || name == pod.annotations["prometheus.io/port"] )
        config:
          endpoint: '`endpoint`'
          metrics_path: '`"prometheus.io/path" in pod.annotations ? pod.annotations["prometheus.io/path"] : "/metrics"`'
          collection_interval: '`"prometheus.io/collection_interval" in pod.annotations ? pod.annotations["prometheus.io/collection_interval"] : "10s"`'
```
I made a silly mistake here in `port ==
pod.annotations["prometheus.io/port"]`, I ignored the data type of
`port` variable and it took me a while to fix it.
So I think it will help others and avoid such kinds of mistakes to add
the data types in readme.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
receiver/receivercreator Skip Changelog PRs that do not require a CHANGELOG.md entry
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants