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

Publicize required methods to allow for custom implementations of resource detectors. #2949

Merged
merged 20 commits into from
Mar 3, 2022

Conversation

Yun-Ting
Copy link
Contributor

@Yun-Ting Yun-Ting commented Feb 25, 2022

Changes

Addressed #2897 (comment)
#2897 alone itself was not sufficient for the users to implement their own resource detector. And this PR bridge this gap.

For significant contributions please make sure you have completed the following items:

  • Appropriate CHANGELOG.md updated for non-trivial changes
  • Design discussion issue #
  • Changes in public API reviewed

@Yun-Ting Yun-Ting requested a review from a team February 25, 2022 19:53
@codecov
Copy link

codecov bot commented Feb 25, 2022

Codecov Report

Merging #2949 (2edd942) into main (1afbb7c) will increase coverage by 0.03%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #2949      +/-   ##
==========================================
+ Coverage   83.99%   84.02%   +0.03%     
==========================================
  Files         254      254              
  Lines        8946     8946              
==========================================
+ Hits         7514     7517       +3     
+ Misses       1432     1429       -3     
Impacted Files Coverage Δ
src/OpenTelemetry/Resources/ResourceBuilder.cs 100.00% <ø> (ø)
src/OpenTelemetry/Resources/Resource.cs 95.34% <100.00%> (ø)
...Telemetry/Internal/SelfDiagnosticsEventListener.cs 97.65% <0.00%> (+0.78%) ⬆️
...tation/OpenTelemetryProtocolExporterEventSource.cs 85.00% <0.00%> (+10.00%) ⬆️

Copy link
Member

@cijothomas cijothomas left a comment

Choose a reason for hiding this comment

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

@Yun-Ting Yun-Ting changed the title Make Resource ctor public and add an example for IResourceDetector. Publicize required methods to allow for custom implementations of resource detectors. Feb 28, 2022
@cijothomas cijothomas closed this Mar 1, 2022
@cijothomas cijothomas reopened this Mar 1, 2022
Copy link
Member

@cijothomas cijothomas left a comment

Choose a reason for hiding this comment

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

LGTM.
Will wait to get one more approval before merge, as this is adding new public API very close to a stable release, and want to get one more review.

@@ -27,6 +28,7 @@ public static void Main()
using var tracerProvider = Sdk.CreateTracerProviderBuilder()
.SetSampler(new MySampler())
.AddSource("OTel.Demo")
.SetResourceBuilder(ResourceBuilder.CreateEmpty().AddDetector(new MyResourceDetector()))
Copy link
Member

@reyang reyang Mar 1, 2022

Choose a reason for hiding this comment

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

Not directly related to this PR, this line seems complex, maybe it could be simplified to ResourceBuilder.AddDetector(new MyResourceDetector())? (by tweaking the static method)

Copy link
Member

@reyang reyang left a comment

Choose a reason for hiding this comment

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

LGTM.

Co-authored-by: Reiley Yang <reyang@microsoft.com>
Copy link
Member

@alanwest alanwest left a comment

Choose a reason for hiding this comment

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

LGTM

@cijothomas cijothomas merged commit b538b9b into open-telemetry:main Mar 3, 2022
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.

5 participants