Skip to content

Add a timeout param to all OTLP grpc / http export calls #4560

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

Closed
wants to merge 22 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
b15f8c8
Add a timeout to export calls
DylanRussell Apr 22, 2025
e0cf233
feat: Updated and added examples (logs and metrics) (#4559)
Jayclifford345 Apr 23, 2025
1b1e8d8
opentelemetry-sdk: use stable code attributes (#4508)
xrmx Apr 23, 2025
adbec50
bugfix(exporter): ensure response is closed (#4477)
codeboten Apr 23, 2025
00329e0
Refactor BatchLogRecordProcessor and associated tests (#4535)
DylanRussell Apr 24, 2025
e46db88
infra: Automate SHA procedure during releases (#4547)
emdneto Apr 28, 2025
561f347
Add timeout millis param to export.
DylanRussell Apr 28, 2025
8269f54
Refactor BatchLogRecordProcessor
DylanRussell Apr 9, 2025
072c6bc
build(deps): bump jinja2 (#4534)
dependabot[bot] Apr 11, 2025
ea17936
logs: fix serialization of Extended attributes (#4342)
xrmx Apr 18, 2025
dae1288
feat: Updated and added examples (logs and metrics) (#4559)
Jayclifford345 Apr 23, 2025
4def4ac
opentelemetry-sdk: use stable code attributes (#4508)
xrmx Apr 23, 2025
211c49e
bugfix(exporter): ensure response is closed (#4477)
codeboten Apr 23, 2025
9ee6872
Refactor BatchLogRecordProcessor and associated tests (#4535)
DylanRussell Apr 24, 2025
e6ac352
infra: Automate SHA procedure during releases (#4547)
emdneto Apr 28, 2025
9f9c3b1
Refactor BatchLogRecordProcessor
DylanRussell Apr 9, 2025
c40c9bf
Add a timeout to export calls
DylanRussell Apr 22, 2025
b299c7b
Add timeout millis param to export.
DylanRussell Apr 28, 2025
1233e24
Refactor BatchLogRecordProcessor
DylanRussell Apr 9, 2025
ed344a9
Refactor BatchLogRecordProcessor and associated tests (#4535)
DylanRussell Apr 24, 2025
953ad93
Refactor BatchLogRecordProcessor
DylanRussell Apr 9, 2025
0e1be3a
Merge remote-tracking branch 'origin/retry' into retry
DylanRussell Apr 30, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion .github/workflows/contrib.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,8 @@ jobs:
uses: open-telemetry/opentelemetry-python-contrib/.github/workflows/core_contrib_test_0.yml@main
with:
CORE_REPO_SHA: ${{ github.sha }}
CONTRIB_REPO_SHA: main
CONTRIB_REPO_SHA: ${{ github.event_name == 'pull_request' && (
contains(github.event.pull_request.labels.*.name, 'prepare-release') && github.event.pull_request.head.ref ||
contains(github.event.pull_request.labels.*.name, 'backport') && github.event.pull_request.base.ref ||
'main'
) || 'main' }}
10 changes: 9 additions & 1 deletion .github/workflows/lint_0.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,15 @@ concurrency:

env:
CORE_REPO_SHA: main
CONTRIB_REPO_SHA: main
# Set the SHA to the branch name if the PR has a label 'prepare-release' or 'backport' otherwise, set it to 'main'
# For PRs you can change the inner fallback ('main')
# For pushes you change the outer fallback ('main')
# The logic below is used during releases and depends on having an equivalent branch name in the contrib repo.
CONTRIB_REPO_SHA: ${{ github.event_name == 'pull_request' && (
contains(github.event.pull_request.labels.*.name, 'prepare-release') && github.event.pull_request.head.ref ||
contains(github.event.pull_request.labels.*.name, 'backport') && github.event.pull_request.base.ref ||
'main'
) || 'main' }}
PIP_EXISTS_ACTION: w

jobs:
Expand Down
10 changes: 9 additions & 1 deletion .github/workflows/misc_0.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,15 @@ concurrency:

env:
CORE_REPO_SHA: main
CONTRIB_REPO_SHA: main
# Set the SHA to the branch name if the PR has a label 'prepare-release' or 'backport' otherwise, set it to 'main'
# For PRs you can change the inner fallback ('main')
# For pushes you change the outer fallback ('main')
# The logic below is used during releases and depends on having an equivalent branch name in the contrib repo.
CONTRIB_REPO_SHA: ${{ github.event_name == 'pull_request' && (
contains(github.event.pull_request.labels.*.name, 'prepare-release') && github.event.pull_request.head.ref ||
contains(github.event.pull_request.labels.*.name, 'backport') && github.event.pull_request.base.ref ||
'main'
) || 'main' }}
PIP_EXISTS_ACTION: w

jobs:
Expand Down
13 changes: 11 additions & 2 deletions .github/workflows/prepare-patch-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ jobs:
run: .github/scripts/use-cla-approved-github-bot.sh

- name: Create pull request
id: create_pr
env:
# not using secrets.GITHUB_TOKEN since pull requests from that token do not run workflows
GITHUB_TOKEN: ${{ secrets.OPENTELEMETRYBOT_GITHUB_TOKEN }}
Expand All @@ -74,7 +75,15 @@ jobs:

git commit -a -m "$message"
git push origin HEAD:$branch
gh pr create --title "[$GITHUB_REF_NAME] $message" \
pr_url=$(gh pr create --title "[$GITHUB_REF_NAME] $message" \
--body "$message." \
--head $branch \
--base $GITHUB_REF_NAME
--base $GITHUB_REF_NAME)

echo "pr_url=$pr_url" >> $GITHUB_OUTPUT
- name: Add prepare-release label to PR
if: steps.create_pr.outputs.pr_url != ''
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh pr edit ${{ steps.create_pr.outputs.pr_url }} --add-label "prepare-release"
26 changes: 22 additions & 4 deletions .github/workflows/prepare-release-branch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ jobs:
run: .github/scripts/use-cla-approved-github-bot.sh

- name: Create pull request against the release branch
id: create_release_branch_pr
env:
# not using secrets.GITHUB_TOKEN since pull requests from that token do not run workflows
GITHUB_TOKEN: ${{ secrets.OPENTELEMETRYBOT_GITHUB_TOKEN }}
Expand All @@ -100,10 +101,18 @@ jobs:

git commit -a -m "$message"
git push origin HEAD:$branch
gh pr create --title "[$RELEASE_BRANCH_NAME] $message" \
pr_url=$(gh pr create --title "[$RELEASE_BRANCH_NAME] $message" \
--body "$message." \
--head $branch \
--base $RELEASE_BRANCH_NAME
--base $RELEASE_BRANCH_NAME)
echo "pr_url=$pr_url" >> $GITHUB_OUTPUT

- name: Add prepare-release label to PR
if: steps.create_release_branch_pr.outputs.pr_url != ''
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh pr edit ${{ steps.create_release_branch_pr.outputs.pr_url }} --add-label "prepare-release"

create-pull-request-against-main:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -170,6 +179,7 @@ jobs:
run: .github/scripts/use-cla-approved-github-bot.sh

- name: Create pull request against main
id: create_main_pr
env:
# not using secrets.GITHUB_TOKEN since pull requests from that token do not run workflows
GITHUB_TOKEN: ${{ secrets.OPENTELEMETRYBOT_GITHUB_TOKEN }}
Expand All @@ -180,7 +190,15 @@ jobs:

git commit -a -m "$message"
git push origin HEAD:$branch
gh pr create --title "$message" \
pr_url=$(gh pr create --title "$message" \
--body "$body" \
--head $branch \
--base main
--base main)
echo "pr_url=$pr_url" >> $GITHUB_OUTPUT

- name: Add prepare-release label to PR
if: steps.create_main_pr.outputs.pr_url != ''
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh pr edit ${{ steps.create_main_pr.outputs.pr_url }} --add-label "prepare-release"
10 changes: 9 additions & 1 deletion .github/workflows/templates/lint.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,15 @@ concurrency:

env:
CORE_REPO_SHA: main
CONTRIB_REPO_SHA: main
# Set the SHA to the branch name if the PR has a label 'prepare-release' or 'backport' otherwise, set it to 'main'
# For PRs you can change the inner fallback ('main')
# For pushes you change the outer fallback ('main')
# The logic below is used during releases and depends on having an equivalent branch name in the contrib repo.
CONTRIB_REPO_SHA: {% raw %}${{ github.event_name == 'pull_request' && (
contains(github.event.pull_request.labels.*.name, 'prepare-release') && github.event.pull_request.head.ref ||
contains(github.event.pull_request.labels.*.name, 'backport') && github.event.pull_request.base.ref ||
'main'
) || 'main' }}{% endraw %}
PIP_EXISTS_ACTION: w

jobs:
Expand Down
10 changes: 9 additions & 1 deletion .github/workflows/templates/misc.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,15 @@ concurrency:

env:
CORE_REPO_SHA: main
CONTRIB_REPO_SHA: main
# Set the SHA to the branch name if the PR has a label 'prepare-release' or 'backport' otherwise, set it to 'main'
# For PRs you can change the inner fallback ('main')
# For pushes you change the outer fallback ('main')
# The logic below is used during releases and depends on having an equivalent branch name in the contrib repo.
CONTRIB_REPO_SHA: {% raw %}${{ github.event_name == 'pull_request' && (
contains(github.event.pull_request.labels.*.name, 'prepare-release') && github.event.pull_request.head.ref ||
contains(github.event.pull_request.labels.*.name, 'backport') && github.event.pull_request.base.ref ||
'main'
) || 'main' }}{% endraw %}
PIP_EXISTS_ACTION: w

jobs:
Expand Down
10 changes: 9 additions & 1 deletion .github/workflows/templates/test.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,15 @@ concurrency:

env:
CORE_REPO_SHA: main
CONTRIB_REPO_SHA: main
# Set the SHA to the branch name if the PR has a label 'prepare-release' or 'backport' otherwise, set it to 'main'
# For PRs you can change the inner fallback ('main')
# For pushes you change the outer fallback ('main')
# The logic below is used during releases and depends on having an equivalent branch name in the contrib repo.
CONTRIB_REPO_SHA: {% raw %}${{ github.event_name == 'pull_request' && (
contains(github.event.pull_request.labels.*.name, 'prepare-release') && github.event.pull_request.head.ref ||
contains(github.event.pull_request.labels.*.name, 'backport') && github.event.pull_request.base.ref ||
'main'
) || 'main' }}{% endraw %}
PIP_EXISTS_ACTION: w

jobs:
Expand Down
10 changes: 9 additions & 1 deletion .github/workflows/test_0.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,15 @@ concurrency:

env:
CORE_REPO_SHA: main
CONTRIB_REPO_SHA: main
# Set the SHA to the branch name if the PR has a label 'prepare-release' or 'backport' otherwise, set it to 'main'
# For PRs you can change the inner fallback ('main')
# For pushes you change the outer fallback ('main')
# The logic below is used during releases and depends on having an equivalent branch name in the contrib repo.
CONTRIB_REPO_SHA: ${{ github.event_name == 'pull_request' && (
contains(github.event.pull_request.labels.*.name, 'prepare-release') && github.event.pull_request.head.ref ||
contains(github.event.pull_request.labels.*.name, 'backport') && github.event.pull_request.base.ref ||
'main'
) || 'main' }}
PIP_EXISTS_ACTION: w

jobs:
Expand Down
10 changes: 9 additions & 1 deletion .github/workflows/test_1.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,15 @@ concurrency:

env:
CORE_REPO_SHA: main
CONTRIB_REPO_SHA: main
# Set the SHA to the branch name if the PR has a label 'prepare-release' or 'backport' otherwise, set it to 'main'
# For PRs you can change the inner fallback ('main')
# For pushes you change the outer fallback ('main')
# The logic below is used during releases and depends on having an equivalent branch name in the contrib repo.
CONTRIB_REPO_SHA: ${{ github.event_name == 'pull_request' && (
contains(github.event.pull_request.labels.*.name, 'prepare-release') && github.event.pull_request.head.ref ||
contains(github.event.pull_request.labels.*.name, 'backport') && github.event.pull_request.base.ref ||
'main'
) || 'main' }}
PIP_EXISTS_ACTION: w

jobs:
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## Unreleased

- Fix intermittent `Connection aborted` error when using otlp/http exporters
([#4477](https://github.com/open-telemetry/opentelemetry-python/pull/4477))
- opentelemetry-sdk: use stable code attributes: `code.function` -> `code.function.name`, `code.lineno` -> `code.line.number`, `code.filepath` -> `code.file.path`
([#4508](https://github.com/open-telemetry/opentelemetry-python/pull/4508))
- Fix serialization of extended attributes for logs signal
([#4342](https://github.com/open-telemetry/opentelemetry-python/pull/4342))
- docs: updated and added to the metrics and log examples
([#4559](https://github.com/open-telemetry/opentelemetry-python/pull/4559))

## Version 1.32.0/0.53b0 (2025-04-10)

Expand Down
101 changes: 67 additions & 34 deletions docs/examples/logs/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -52,37 +52,70 @@ The resulting logs will appear in the output from the collector and look similar

.. code-block:: sh

Resource SchemaURL:
Resource labels:
-> telemetry.sdk.language: STRING(python)
-> telemetry.sdk.name: STRING(opentelemetry)
-> telemetry.sdk.version: STRING(1.8.0)
-> service.name: STRING(shoppingcart)
-> service.instance.id: STRING(instance-12)
InstrumentationLibraryLogs #0
InstrumentationLibraryMetrics SchemaURL:
InstrumentationLibrary __main__ 0.1
LogRecord #0
Timestamp: 2022-01-13 20:37:03.998733056 +0000 UTC
Severity: WARNING
ShortName:
Body: Jail zesty vixen who grabbed pay from quack.
Trace ID:
Span ID:
Flags: 0
LogRecord #1
Timestamp: 2022-01-13 20:37:04.082757888 +0000 UTC
Severity: ERROR
ShortName:
Body: The five boxing wizards jump quickly.
Trace ID:
Span ID:
Flags: 0
LogRecord #2
Timestamp: 2022-01-13 20:37:04.082979072 +0000 UTC
Severity: ERROR
ShortName:
Body: Hyderabad, we have a major problem.
Trace ID: 63491217958f126f727622e41d4460f3
Span ID: d90c57d6e1ca4f6c
Flags: 1
ResourceLog #0
Resource SchemaURL:
Resource attributes:
-> telemetry.sdk.language: Str(python)
-> telemetry.sdk.name: Str(opentelemetry)
-> telemetry.sdk.version: Str(1.33.0.dev0)
-> service.name: Str(shoppingcart)
-> service.instance.id: Str(instance-12)
ScopeLogs #0
ScopeLogs SchemaURL:
InstrumentationScope myapp.area2
LogRecord #0
ObservedTimestamp: 2025-04-22 12:16:57.315179 +0000 UTC
Timestamp: 2025-04-22 12:16:57.315152896 +0000 UTC
SeverityText: WARN
SeverityNumber: Warn(13)
Body: Str(Jail zesty vixen who grabbed pay from quack.)
Attributes:
-> code.filepath: Str(/Users/jayclifford/Repos/opentelemetry-python/docs/examples/logs/example.py)
-> code.function: Str(<module>)
-> code.lineno: Int(47)
Trace ID:
Span ID:
Flags: 0
LogRecord #1
ObservedTimestamp: 2025-04-22 12:16:57.31522 +0000 UTC
Timestamp: 2025-04-22 12:16:57.315213056 +0000 UTC
SeverityText: ERROR
SeverityNumber: Error(17)
Body: Str(The five boxing wizards jump quickly.)
Attributes:
-> code.filepath: Str(/Users/jayclifford/Repos/opentelemetry-python/docs/examples/logs/example.py)
-> code.function: Str(<module>)
-> code.lineno: Int(48)
Trace ID:
Span ID:
Flags: 0
LogRecord #2
ObservedTimestamp: 2025-04-22 12:16:57.315445 +0000 UTC
Timestamp: 2025-04-22 12:16:57.31543808 +0000 UTC
SeverityText: ERROR
SeverityNumber: Error(17)
Body: Str(Hyderabad, we have a major problem.)
Attributes:
-> code.filepath: Str(/Users/jayclifford/Repos/opentelemetry-python/docs/examples/logs/example.py)
-> code.function: Str(<module>)
-> code.lineno: Int(61)
Trace ID: 8a6739fffce895e694700944e2faf23e
Span ID: a45337020100cb63
Flags: 1
ScopeLogs #1
ScopeLogs SchemaURL:
InstrumentationScope myapp.area1
LogRecord #0
ObservedTimestamp: 2025-04-22 12:16:57.315242 +0000 UTC
Timestamp: 2025-04-22 12:16:57.315234048 +0000 UTC
SeverityText: ERROR
SeverityNumber: Error(17)
Body: Str(I have custom attributes.)
Attributes:
-> user_id: Str(user-123)
-> code.filepath: Str(/Users/jayclifford/Repos/opentelemetry-python/docs/examples/logs/example.py)
-> code.function: Str(<module>)
-> code.lineno: Int(53)
Trace ID:
Span ID:
Flags: 0
4 changes: 4 additions & 0 deletions docs/examples/logs/example.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@
logger2.warning("Jail zesty vixen who grabbed pay from quack.")
logger2.error("The five boxing wizards jump quickly.")

# Log custom attributes
# Custom attributes are added on a per event basis
user_id = "user-123"
logger1.error("I have custom attributes.", extra={"user_id": user_id})

# Trace context correlation
tracer = trace.get_tracer(__name__)
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/logs/otel-collector-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ receivers:

exporters:
debug:
verbosity: debug
verbosity: detailed

processors:
batch:
Expand Down
1 change: 1 addition & 0 deletions docs/examples/metrics/reader/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ These examples show how to customize the metrics that are output by the SDK usin
* preferred_aggregation.py: Shows how to configure the preferred aggregation for metric instrument types.
* preferred_temporality.py: Shows how to configure the preferred temporality for metric instrument types.
* preferred_exemplarfilter.py: Shows how to configure the exemplar filter.
* synchronous_gauge_read.py: Shows how to use `PeriodicExportingMetricReader` in a synchronous manner to explicitly control the collection of metrics.

The source files of these examples are available :scm_web:`here <docs/examples/metrics/reader/>`.

Expand Down
Loading
Loading