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

Improve docs on Resources to encourage its usage #5185

Merged
merged 7 commits into from
Dec 18, 2023

Conversation

cijothomas
Copy link
Member

Improving the wording on Resources, modifying example to show adding custom attributes are the main changes. Also refactoring the best practices section to better point to Resource section.

Note: This repo interchangeably uses the word Tag vs Attributes. Need a follow up to ensure consistent usage throughout. Its not entirely feasible as Resource picked the "Attribute" terminology, but Traces/Metrics picked "Tags" terminology :(

@cijothomas cijothomas requested a review from a team December 15, 2023 17:53
Copy link

codecov bot commented Dec 15, 2023

Codecov Report

Merging #5185 (85f165a) into main (af83eb1) will increase coverage by 0.04%.
The diff coverage is n/a.

❗ Current head 85f165a differs from pull request most recent head b1b581f. Consider uploading reports for the commit b1b581f to get more accurate results

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #5185      +/-   ##
==========================================
+ Coverage   83.45%   83.50%   +0.04%     
==========================================
  Files         297      297              
  Lines       12397    12397              
==========================================
+ Hits        10346    10352       +6     
+ Misses       2051     2045       -6     
Flag Coverage Δ
unittests 83.50% <ø> (+0.04%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

see 7 files with indirect coverage changes

docs/metrics/README.md Outdated Show resolved Hide resolved
docs/metrics/README.md Outdated Show resolved Hide resolved
docs/metrics/README.md Outdated Show resolved Hide resolved
.ConfigureResource(res => res.AddService("example-service"))
.ConfigureResource(r => r.AddAttributes(new List<KeyValuePair<string, object>>
{
new KeyValuePair<string, object>("static-attribute1", "v1"),
Copy link
Contributor

Choose a reason for hiding this comment

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

It's probably better to use a meaningful key instead of generic names. Something like MachineId, ProcessId, Region etc.

Copy link
Member Author

Choose a reason for hiding this comment

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

Agree, will steal something from opentelemetry.io example in a subsequent PR.

is built, by calling the `Build()` method on the `MeterProviderBuilder`.
The `ConfigureResource` method on `MeterProviderBuilder` can be used to
configure the resource on the provider. `ConfigureResource` accepts an `Action`
to configure the `ResourceBuilder`. Multiple calls to `ConfigureResource` can be
Copy link
Contributor

@utpilla utpilla Dec 15, 2023

Choose a reason for hiding this comment

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

Multiple calls to ConfigureResource can be made.

Rephrasing suggestion: "It's safe to call ConfigureResource multiple times."

attributes from various sources. For example, `AddService()` adds
[Service](https://github.com/open-telemetry/semantic-conventions/blob/main/docs/resource/README.md#service)
resource. `AddAttributes` can be used to add any additional attribute to the
`Resource`. It also allows adding `ResourceDetector`s.
Copy link
Contributor

Choose a reason for hiding this comment

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

the process as Resources, instead of adding them as attributes(tags) on each
measurement.

Follow [this](../../trace/extending-the-sdk/README.md#resource-detector) document
Copy link
Contributor

Choose a reason for hiding this comment

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

Ahh you already have a link to ResourceDetector information here. This should be moved above right after the text: "It also allows adding ResourceDetectors."

@cijothomas
Copy link
Member Author

#5188 has been submitted since this was opened. We need to merge this in, then do 5188. Few suggestions in this PR need to be ported to 5188 as well.

docs/metrics/README.md Outdated Show resolved Hide resolved
@utpilla utpilla merged commit 65dd83b into open-telemetry:main Dec 18, 2023
78 checks passed
@cijothomas cijothomas deleted the cijothomas/resource-docs branch December 18, 2023 21:41
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.

2 participants