-
Notifications
You must be signed in to change notification settings - Fork 777
feat: include documentation of dapr agents logging under Operations section + ref link from introduction #4978
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
Open
CasperGN
wants to merge
4
commits into
dapr:v1.16
Choose a base branch
from
CasperGN:docs/dapr-agents-logging
base: v1.16
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+57
−2
Open
Changes from 3 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
9909bc7
feat: include documentation of dapr agents logging under Operations s…
CasperGN 9ccf8ef
Merge branch 'v1.16' into docs/dapr-agents-logging
CasperGN f3181ea
Merge branch 'v1.16' into docs/dapr-agents-logging
CasperGN 12e6c80
Merge branch 'v1.16' into docs/dapr-agents-logging
marcduiker File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
daprdocs/content/en/operations/observability/logging/dapr-agents.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| --- | ||
| type: docs | ||
| title: "How-To: Set up logging for Dapr Agents" | ||
| linkTitle: "Dapr Agents" | ||
| weight: 2000 | ||
| description: "How to set up logging for Dapr Agents" | ||
| --- | ||
|
|
||
| ## Prerequisites | ||
|
|
||
| You'll need to make install the required packages: | ||
|
|
||
| ```sh | ||
| openinference-instrumentation>=0.1.42 | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can these be updated to include the tools how to install? In case there are multiple tool options, you could provide some examples to clarify. |
||
| openinference-semantic-conventions>=0.1.25 | ||
| opentelemetry-api>=1.39.0 | ||
| opentelemetry-exporter-otlp>=1.39.0 | ||
| opentelemetry-exporter-zipkin-json>=1.39.0 | ||
| opentelemetry-instrumentation-requests>=0.60b0 | ||
| opentelemetry-instrumentation-grpc>=0.60b0 | ||
| opentelemetry-proto>=1.39.0 | ||
| ``` | ||
|
|
||
| ## Setup | ||
|
|
||
| Dapr Agents has bindings for using OpenTelemetry for instrumentation. This means you can use a common Python logger to set the required log level (`DEBUG`, `INFO`, `WARNING` and `ERROR`): | ||
|
|
||
| ```python | ||
| import logging | ||
|
|
||
| logging.basicConfig(level=logging.WARNING) | ||
| ``` | ||
|
|
||
| This log level will propagate to all third party libraries. | ||
|
|
||
| ### OpenTelemetry integration | ||
|
|
||
| Dapr Agents support OpenTelemetry by setting the appropriate provider and processor: | ||
|
|
||
| ```python | ||
| from opentelemetry import _logs | ||
| from opentelemetry.sdk._logs import LoggerProvider | ||
| from opentelemetry.sdk._logs.export import BatchLogRecordProcessor, ConsoleLogRecordExporter | ||
| from dapr_agents.observability import DaprAgentsInstrumentor | ||
|
|
||
| logger_provider = LoggerProvider() | ||
| log_processor = BatchLogRecordProcessor(ConsoleLogRecordExporter()) | ||
| logger_provider.add_log_record_processor(log_processor) | ||
| _logs.set_logger_provider(logger_provider) | ||
| instrumentor = DaprAgentsInstrumentor() | ||
| instrumentor.instrument(logger_provider=logger_provider, skip_dep_check=True) | ||
| ``` | ||
|
|
||
| Please refer to the current release level for the [Python SDK of OpenTelemetry](https://opentelemetry.io/docs/languages/python/) as the logs API is currently in `development` state. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.