Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Update docs #1548

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

Merged
merged 4 commits into from
Jan 26, 2021
Merged

Update docs #1548

merged 4 commits into from
Jan 26, 2021

Conversation

srikanthccv
Copy link
Member

@srikanthccv srikanthccv commented Jan 25, 2021

Description

The example mentioned in basic resource needs a dependency opentelemetry-tools-google-cloud to work.

from opentelemetry import trace
from opentelemetry.sdk.resources import get_aggregated_resources
from opentelemetry.sdk.trace import TracerProvider
from opentelemetry.sdk.trace.export import (
ConsoleSpanExporter,
SimpleExportSpanProcessor,
)
from opentelemetry.tools.resource_detector import GoogleCloudResourceDetector
resources = get_aggregated_resources([GoogleCloudResourceDetector()])
trace.set_tracer_provider(TracerProvider(resource=resources))
trace.get_tracer_provider().add_span_processor(
SimpleExportSpanProcessor(ConsoleSpanExporter())
)
tracer = trace.get_tracer(__name__)
with tracer.start_as_current_span("foo"):
print("Hello world!")

Based on discussion #1548 (comment) removed the GCP resource detector and added simple resource creation.

@srikanthccv srikanthccv requested review from a team, toumorokoshi and lzchen and removed request for a team January 25, 2021 08:58
@@ -18,6 +18,7 @@ Installation

pip install opentelemetry-api
pip install opentelemetry-sdk
pip install opentelemetry-tools-google-cloud
Copy link
Member Author

Choose a reason for hiding this comment

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

Alternatively, we could remove the code for GCP resource detection and just have OTEL resource detection from env OTEL_RESOURCE_ATTRIBUTES. We might want to add a note that vendor specific resource detection extensions live outside the open-telemetry and should be installed as a separate dependencies.

Copy link
Contributor

Choose a reason for hiding this comment

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

I would prefer this approach. We don't want to add vendor specific stuff for such a basic example.

Copy link
Member

@toumorokoshi toumorokoshi left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

Copy link
Contributor

@codeboten codeboten left a comment

Choose a reason for hiding this comment

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

LGTM

@codeboten codeboten added the Skip Changelog PRs that do not require a CHANGELOG.md entry label Jan 26, 2021
@codeboten codeboten merged commit a600657 into open-telemetry:master Jan 26, 2021
@srikanthccv srikanthccv deleted the docs-exm-fix branch September 24, 2021 08:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Skip Changelog PRs that do not require a CHANGELOG.md entry
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants