Skip to content

Fix #1848 opentracing shim exception reporting - #1878

Merged
lzchen merged 8 commits into
open-telemetry:mainfrom
robertsben:fix-opentracing-shim-exception-reporting
Jun 9, 2021
Merged

lzchen merged 8 commits into
open-telemetry:mainfrom
robertsben:fix-opentracing-shim-exception-reporting

Conversation

@robertsben

@robertsben robertsben commented May 27, 2021 •

Copy link
Copy Markdown
Contributor

Description

This PR looks to address the issue where the opentracing-shim is not reporting errors correctly in the opentelemetry specification format.

Fixes #1848

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

This has been tested by installing the branch as an editable requirement (pip -e) in a minimal working example, exporting traces to jaeger and elastic APM via an opentelemetry-collector and using the opentracing-shim. To reproduce checkout the fix branch of that repo and follow instructions in the README.

Does This PR Require a Contrib Repo Change?

Answer the following question based on these examples of changes that would require a Contrib Repo Change:

  • The OTel specification has changed which prompted this PR to update the method interfaces of opentelemetry-api/ or opentelemetry-sdk/

  • The method interfaces of test/util have changed

  • Scripts in scripts/ that were copied over to the Contrib repo have changed

  • Configuration files that were copied over to the Contrib repo have changed (when consistency between repositories is applicable) such as in

    • pyproject.toml
    • isort.cfg
    • .flake8
  • When a new .github/CODEOWNER is added

  • Major changes to project information, such as in:

    • README.md
    • CONTRIBUTING.md
  • Yes. - Link to PR:

  • No.

Checklist:

  • Followed the style guidelines of this project
  • Changelogs have been updated
  • Unit tests have been added
  • Documentation has been updated

@robertsben
robertsben requested review from a team, codeboten and owais and removed request for a team May 27, 2021 11:53
@linux-foundation-easycla

linux-foundation-easycla Bot commented May 27, 2021 •

Copy link
Copy Markdown

CLA Signed

The committers are authorized under a signed CLA.

@srikanthccv srikanthccv left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Would be nice if you can also include exception.type and exception.stacktrace in test.

@robertsben

robertsben commented Jun 7, 2021 •

Copy link
Copy Markdown
Contributor Author

Thanks @lonewolf3739, I've added a couple, once the CI jobs are approved (and pass) is there anything else needed for merging?

@robertsben
robertsben force-pushed the fix-opentracing-shim-exception-reporting branch from 62f64f1 to 93de441 Compare June 7, 2021 14:16
@robertsben
robertsben force-pushed the fix-opentracing-shim-exception-reporting branch from 93de441 to 4fdc129 Compare June 7, 2021 14:29
@srikanthccv

srikanthccv commented Jun 7, 2021 •

Copy link
Copy Markdown
Member

@robertsben Please take a look at the failing tests. Once they are fixed, one of maintainers will merge this.

@srikanthccv srikanthccv added the Approve Public API check This label shows that the public symbols added or changed in a PR are strictly necessary label Jun 7, 2021
@robertsben

Copy link
Copy Markdown
Contributor Author

@robertsben Please take a look at the failing tests. Once they are fixed, one of maintainers will merge this.

Sorry I'd missed a couple originally. Everything is now passing, except the core-getting-started tests, which as far as I can tell also appear to be failing on main. I'm getting a ModuleNotFoundError for requests, imported in /docs/getting_started/tests/test_flask.py. It's not something I've changed so I'm struggling to see what should/would need fixing. Do you have any ideas?

@lzchen
lzchen merged commit a47a202 into open-telemetry:main Jun 9, 2021
@srikanthccv srikanthccv mentioned this pull request Jun 26, 2021
16 tasks
pull Bot pushed a commit to thompson-tomo/opentelemetry-specification that referenced this pull request Sep 11, 2026
…y#5190)

## Changes

Updated the spec compliance entries for Python. Most of the work of
finding the corresponding PRs/evidence was performed by Codex of which I
checked for correctness.

For non-trivial changes, follow the [change proposal
process](https://github.com/open-telemetry/opentelemetry-specification/blob/main/CONTRIBUTING.md#proposing-a-change).

cc: @open-telemetry/python-maintainers @open-telemetry/python-approvers 

* [ ] Related issues #
* [ ] Related [OTEP(s)](https://github.com/open-telemetry/oteps) #
* [ ] Links to the prototypes (when adding or changing features)
* [ ]
[`CHANGELOG.md`](https://github.com/open-telemetry/opentelemetry-specification/blob/main/CHANGELOG.md)
file updated for non-trivial changes
* For trivial changes, include `[chore]` in the PR title to skip the
changelog check
* [x] [Spec compliance
matrix](https://github.com/open-telemetry/opentelemetry-specification/blob/main/spec-compliance-matrix/template.yaml)
updated if necessary
* [ ] [Declarative config data
model](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/configuration/data-model.md#overview)
is updated if SDK config surface is changed

## Trace

- **W3C Trace Context Level 2 randomness**:
`RandomIdGenerator.is_trace_id_random()` and
`TraceFlags.RANDOM_TRACE_ID` are implemented and tested. PR:
[open-telemetry#4854](open-telemetry/opentelemetry-python#4854).
Issue: none found.

## Metrics

- **Duplicate instrument registration uses first-seen stream name**:
`Meter._register_instrument()` stores first advisory data and reports
conflicts using the existing advisory. PR:
[open-telemetry#4361](open-telemetry/opentelemetry-python#4361).
Issues:
[open-telemetry#3042](open-telemetry/opentelemetry-python#3042),
[open-telemetry#4140](open-telemetry/opentelemetry-python#4140).
- **Advisory ExplicitBucketBoundaries parameter**: histogram advisory
boundaries are accepted, stored, and consumed by explicit bucket
aggregation. PR:
[open-telemetry#4361](open-telemetry/opentelemetry-python#4361).
Issues:
[open-telemetry#3042](open-telemetry/opentelemetry-python#3042),
[open-telemetry#4140](open-telemetry/opentelemetry-python#4140).
- **MeterProvider methods safe for concurrent calls**: locks protect
meter creation, reader registration, and global reader tracking. PRs:
[open-telemetry#4913](open-telemetry/opentelemetry-python#4913),
[open-telemetry#4863](open-telemetry/opentelemetry-python#4863).
Issues:
[open-telemetry#4892](open-telemetry/opentelemetry-python#4892),
[open-telemetry#4818](open-telemetry/opentelemetry-python#4818).
- **Meter methods safe for concurrent calls**:
`_instrument_registration_lock` protects instrument registration;
concurrent instrument creation is tested. PR:
[open-telemetry#4913](open-telemetry/opentelemetry-python#4913).
Issue:
[open-telemetry#4892](open-telemetry/opentelemetry-python#4892).
- **Instrument methods safe for concurrent calls**: aggregation state
and per-attribute aggregation creation are lock-protected. PR:
[open-telemetry#4913](open-telemetry/opentelemetry-python#4913).
Issue:
[open-telemetry#4892](open-telemetry/opentelemetry-python#4892).
- **View configures exemplar reservoir**: `View` accepts
`exemplar_reservoir_factory`; defaults select histogram-aligned or
fixed-size reservoirs. PR:
[#4094](open-telemetry/opentelemetry-python#4094).
Issues:
[open-telemetry#2407](open-telemetry/opentelemetry-python#2407),
[opentelemetry-python-contrib
open-telemetry#2158](open-telemetry/opentelemetry-python-contrib#2158).
- **Metric exporter export is not called concurrently**:
`PeriodicExportingMetricReader` holds `_export_lock` around exporter
calls. PR:
[open-telemetry#2873](open-telemetry/opentelemetry-python#2873).
Issue:
[open-telemetry#2859](open-telemetry/opentelemetry-python#2859).
- **Metric exporter export does not block indefinitely**: export paths
pass timeout/deadline information through reader and exporter calls. PR:
[open-telemetry#2653](open-telemetry/opentelemetry-python#2653).
Issue:
[#2402](open-telemetry/opentelemetry-python#2402).
- **Metric exporter shutdown does not block indefinitely**: shutdown
computes deadlines and passes remaining timeout to readers/exporters.
PR:
[open-telemetry#2653](open-telemetry/opentelemetry-python#2653).
Issue:
[#2402](open-telemetry/opentelemetry-python#2402).
- **SDK samples Exemplars from measurements**: measurement consumers
invoke exemplar filters and aggregations offer measurements to
reservoirs. PR:
[#4094](open-telemetry/opentelemetry-python#4094).
Issue:
[open-telemetry#2407](open-telemetry/opentelemetry-python#2407).
- **Exemplar sampling can be disabled**: `AlwaysOffExemplarFilter` and
`OTEL_METRICS_EXEMPLAR_FILTER=always_off` are implemented and tested.
PR:
[#4094](open-telemetry/opentelemetry-python#4094).
Issue:
[open-telemetry#2407](open-telemetry/opentelemetry-python#2407).
- **SDK-wide exemplar filter configuration**:
`MeterProvider(exemplar_filter=...)` and `OTEL_METRICS_EXEMPLAR_FILTER`
select exemplar filters. PR:
[#4094](open-telemetry/opentelemetry-python#4094).
Issue:
[open-telemetry#2407](open-telemetry/opentelemetry-python#2407).
- **TraceBased, AlwaysOn, and AlwaysOff exemplar filters**: all three
filter classes are publicly exported by the metrics SDK. PR:
[#4094](open-telemetry/opentelemetry-python#4094).
Issue:
[open-telemetry#2407](open-telemetry/opentelemetry-python#2407).
- **Exemplars retain filtered measurement attributes**: exemplar
collection stores measurement attributes not present on the data point.
PR:
[#4094](open-telemetry/opentelemetry-python#4094).
Issue:
[open-telemetry#2407](open-telemetry/opentelemetry-python#2407).
- **Exemplars contain active trace ID and span ID**: exemplar offers
read the current span from context and store IDs. PR:
[#4094](open-telemetry/opentelemetry-python#4094).
Issue:
[open-telemetry#2407](open-telemetry/opentelemetry-python#2407).
- **Exemplars contain measurement timestamp**: `Exemplar.time_unix_nano`
is populated from measurement timestamps. PR:
[#4094](open-telemetry/opentelemetry-python#4094).
Issue:
[open-telemetry#2407](open-telemetry/opentelemetry-python#2407).
- **ExemplarReservoir extension point and offer method**:
`ExemplarReservoir` defines `offer(value, time_unix_nano, attributes,
context)` and `collect()`. PR:
[#4094](open-telemetry/opentelemetry-python#4094).
Issue:
[open-telemetry#2407](open-telemetry/opentelemetry-python#2407).
- **SimpleFixedSizeExemplarReservoir default**: the SDK exposes the
reservoir and uses it for non-explicit-bucket aggregations. PR:
[#4094](open-telemetry/opentelemetry-python#4094).
Issue:
[open-telemetry#2407](open-telemetry/opentelemetry-python#2407).
- **AlignedHistogramBucketExemplarReservoir default for explicit bucket
histograms**: the default factory returns the aligned histogram
reservoir for explicit bucket histograms. PR:
[#4094](open-telemetry/opentelemetry-python#4094).
Issue:
[open-telemetry#2407](open-telemetry/opentelemetry-python#2407).
- **Per-timeseries cumulative start timestamps**: aggregation state
keeps per-series start timestamps and integration tests cover alignment.
PR:
[open-telemetry#2679](open-telemetry/opentelemetry-python#2679).
Issue:
[#2677](open-telemetry/opentelemetry-python#2677).

## Logs

- **Logger.Emit(LogRecord) with Exception parameter**: logs API accepts
`exception`; SDK records exception attributes and tests cover emitted
exceptions. PR:
[open-telemetry#4908](open-telemetry/opentelemetry-python#4908).
Issue:
[open-telemetry#4907](open-telemetry/opentelemetry-python#4907).
- **LogRecord.Set EventName**: API and SDK readable records expose
`event_name`; export and serialization are tested. PR:
[open-telemetry#4652](open-telemetry/opentelemetry-python#4652).
Issue:
[open-telemetry#4644](open-telemetry/opentelemetry-python#4644).
- **OTLP File exporter**: `opentelemetry-exporter-otlp-json-file`
provides trace, metric, and log exporters with tests. PR:
[open-telemetry#5207](open-telemetry/opentelemetry-python#5207).
Issue: none found.

## Environment Variables

- **OTEL_BLRP_***: `BatchLogRecordProcessor` reads BLRP environment
settings and tests cover valid/invalid values. PR:
[open-telemetry#4535](open-telemetry/opentelemetry-python#4535).
Issue: none found.
- **OTEL_METRICS_EXEMPLAR_FILTER**: the env var is defined and selects
`always_on`, `trace_based`, or `always_off` filters in tests. PR:
[#4094](open-telemetry/opentelemetry-python#4094).
Issue:
[open-telemetry#2407](open-telemetry/opentelemetry-python#2407).

## Exporters

- **OTLP honors user-agent spec**: HTTP tests assert `User-Agent`; gRPC
tests assert `grpc.primary_user_agent`. PRs:
[open-telemetry#2959](open-telemetry/opentelemetry-python#2959),
[open-telemetry#3009](open-telemetry/opentelemetry-python#3009),
[open-telemetry#3128](open-telemetry/opentelemetry-python#3128),
[open-telemetry#4658](open-telemetry/opentelemetry-python#4658).
Issue: none found.
- **Zipkin InstrumentationScope mapping**: Zipkin encoding emits
`otel.scope.name` and `otel.scope.version` tags from
`span.instrumentation_scope`. PR:
[open-telemetry#2583](open-telemetry/opentelemetry-python#2583).
Issue: none found.

## Prometheus

- **Metadata Deduplication**: exporter groups metric families by family
ID and tests avoid duplicate HELP/TYPE declarations. PR:
[open-telemetry#4869](open-telemetry/opentelemetry-python#4869).
Issue: none found.
- **Unit Full Words**: unit mapping converts UCUM/SI units to full
Prometheus unit names with tests. PR:
[open-telemetry#3924](open-telemetry/opentelemetry-python#3924).
Issue: none found.
- **otel_scope_name and otel_scope_version labels**: scope labels are
emitted by default and tested in text output. PR:
[open-telemetry#5123](open-telemetry/opentelemetry-python#5123).
Issue:
[open-telemetry#5112](open-telemetry/opentelemetry-python#5112).
- **otel_scope_[attribute] labels**: `_build_scope_attrs()` prefixes
scope attributes with `otel_scope_`; tests cover output. PR:
[open-telemetry#5123](open-telemetry/opentelemetry-python#5123).
Issue:
[open-telemetry#5112](open-telemetry/opentelemetry-python#5112).
- **otel_scope labels can be disabled**:
`PrometheusMetricReader(scope_info_enabled=False)` omits scope labels
and is documented/tested. PR:
[open-telemetry#5123](open-telemetry/opentelemetry-python#5123).
Issue:
[open-telemetry#5112](open-telemetry/opentelemetry-python#5112).

## OpenTracing Compatibility

- **Create OpenTracing Shim**: `opentelemetry-opentracing-shim` exposes
`create_tracer`. PRs:
[#211](open-telemetry/opentelemetry-python#211),
[open-telemetry#1878](open-telemetry/opentelemetry-python#1878).
Issue:
[#1848](open-telemetry/opentelemetry-python#1848).
- **Tracer**: `TracerShim` is implemented and tested. PRs:
[#211](open-telemetry/opentelemetry-python#211),
[open-telemetry#1878](open-telemetry/opentelemetry-python#1878).
Issue:
[#1848](open-telemetry/opentelemetry-python#1848).
- **Span**: `SpanShim` is implemented and tested. PRs:
[#211](open-telemetry/opentelemetry-python#211),
[open-telemetry#1878](open-telemetry/opentelemetry-python#1878).
Issue:
[#1848](open-telemetry/opentelemetry-python#1848).
- **SpanContext**: `SpanContextShim` is implemented and tested. PRs:
[#211](open-telemetry/opentelemetry-python#211),
[open-telemetry#1878](open-telemetry/opentelemetry-python#1878).
Issue:
[#1848](open-telemetry/opentelemetry-python#1848).
- **ScopeManager**: `ScopeManagerShim` is implemented and tested. PRs:
[#211](open-telemetry/opentelemetry-python#211),
[open-telemetry#1878](open-telemetry/opentelemetry-python#1878).
Issue:
[#1848](open-telemetry/opentelemetry-python#1848).
- **Error mapping for attributes/events**: shim tests cover error and
exception mapping. PRs:
[#211](open-telemetry/opentelemetry-python#211),
[open-telemetry#1878](open-telemetry/opentelemetry-python#1878).
Issue:
[#1848](open-telemetry/opentelemetry-python#1848).
- **Migration to OpenTelemetry guide**: package docs frame the shim as
migration support. PRs:
[#211](open-telemetry/opentelemetry-python#211),
[open-telemetry#1878](open-telemetry/opentelemetry-python#1878).
Issue:
[#1848](open-telemetry/opentelemetry-python#1848).

---------

Co-authored-by: Carlos Alberto Cortez <calberto.cortez@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Approve Public API check This label shows that the public symbols added or changed in a PR are strictly necessary

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Update opentracing shim to map errors from logs

4 participants