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

AzureMonitorTraceExporter exports spans, but drops their events #21747

Closed
ranweiler opened this issue Nov 13, 2021 · 5 comments · Fixed by #23708
Closed

AzureMonitorTraceExporter exports spans, but drops their events #21747

ranweiler opened this issue Nov 13, 2021 · 5 comments · Fixed by #23708
Assignees
Labels
bug This issue requires a change to an existing behavior in the product in order to be resolved. Client This issue points to a problem in the data-plane of the library. Monitor - Exporter Monitor OpenTelemetry Exporter

Comments

@ranweiler
Copy link

  • Package Name: azure-monitor-opentelemetry-exporter
  • Package Version: 1.0.0b5
  • Operating System: Linux
  • Python Version: 3.7.5

Describe the bug
AzureMonitorTraceExporter does not submit events that belong to a span.

To Reproduce
Here is a small script that repros:

from azure.monitor.opentelemetry.exporter import AzureMonitorTraceExporter
from opentelemetry import trace
from opentelemetry.sdk.trace import TracerProvider
from opentelemetry.sdk.trace.export import BatchSpanProcessor

conn_str = "<REDACTED>"
exporter = AzureMonitorTraceExporter.from_connection_string(conn_str=conn_str)
processor = BatchSpanProcessor(exporter)
provider = TracerProvider()
provider.add_span_processor(processor)
trace.set_tracer_provider(provider)
tracer = trace.get_tracer(__name__)

if __name__ == "__main__":
    with tracer.start_as_current_span("my_span"):    
        trace.get_current_span().add_event("my_event_1")
        trace.get_current_span().add_event("my_event_2")        

Expected behavior
Spans should viewable in Application Insights, such as in the Transaction Search.
Events should also be viewable, and linked to their containing span.
In the above example, my_span should contain two events (my_event_1, my_event_2).

Screenshots
The Transaction Timeline View, where I would expect to see a "2 events" near the bottom, and the same events in the list of all telemetry items:
image

Additional context
I can observe that the events are being attached to the span, by using the ConsoleSpanExporter:

{
    "name": "my_span",
    "context": {
        "trace_id": "0xaec2c256b1821094ca71de2041dfb05c",
        "span_id": "0x31c1d7134ba8654b",
        "trace_state": "[]"
    },
    "kind": "SpanKind.INTERNAL",
    "parent_id": null,
    "start_time": "2021-11-13T01:11:55.745691Z",
    "end_time": "2021-11-13T01:11:55.745772Z",
    "status": {
        "status_code": "UNSET"
    },
    "attributes": {},
    "events": [
        {
            "name": "my_event_1",
            "timestamp": "2021-11-13T01:11:55.745747Z",
            "attributes": {}
        },
        {
            "name": "my_event_2",
            "timestamp": "2021-11-13T01:11:55.745761Z",
            "attributes": {}
        }
    ],
    "links": [],
    "resource": {
        "telemetry.sdk.language": "python",
        "telemetry.sdk.name": "opentelemetry",
        "telemetry.sdk.version": "1.7.1",
        "service.name": "unknown_service"
    }
}
@ghost ghost added the needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. label Nov 13, 2021
@xiangyan99 xiangyan99 added bug This issue requires a change to an existing behavior in the product in order to be resolved. Client This issue points to a problem in the data-plane of the library. Monitor - Exporter Monitor OpenTelemetry Exporter labels Nov 16, 2021
@ghost ghost removed the needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. label Nov 16, 2021
@xiangyan99
Copy link
Member

Thanks for the feedback, we’ll investigate asap.

@lzchen
Copy link
Member

lzchen commented Nov 16, 2021

@ranweiler
This feature is not supported yet. Thanks for reporting. We will update this issue once the feature has been implemented.

@ranweiler
Copy link
Author

Thanks @lzchen, that confirms my reading of the exporter code.

  1. Is there a roadmap or timeline for this feature work?
  2. How do you plan on mapping OpenTelemetry Events to the App Insights data model? With this be user-configurable?
  3. Do you plan on supporting OpenTelemetry Logging, once that API has stabilized?

@lzchen
Copy link
Member

lzchen commented Nov 29, 2021

@ranweiler

  1. Not as of today.
  2. This is being discussed here
  3. Yes, there will be an exporter to send log telemetry generated from OpenTelemetry Logging to App Insights sometime in the future. OpenTelemetry Python has already released an experimental logging SDK (https://github.com/open-telemetry/opentelemetry-python/releases/tag/v1.7.1) if you'd like to take a look.

@lzchen
Copy link
Member

lzchen commented Mar 23, 2022

Update on this issue here.

Span events will be mapped to trace telemetry unless if the event is an exception, in which case it will be mapped to exception in app insights.

azure-sdk pushed a commit to azure-sdk/azure-sdk-for-python that referenced this issue Dec 8, 2022
Release app microsoft.app 2022 10 01 (Azure#21683)

* Adds base for updating Microsoft.App from version preview/2022-06-01-preview to version 2022-10-01

* Updates readme

* Updates API version in new specs and examples

* Add AppState and LatestReadyRevisionName (Azure#21034)

* Add new props

* add defaults

* Add swagger for client cert & CORS policy (Azure#21126)

* Fix password format of env domain for 2022-10-01 (Azure#21463)

* fix

* fix

* Remove AppState property as we decided to postpone it (Azure#21483)

* Remove AppState property as we decided to postpone it

* Fix swagger issues

* More swagger fixes

* s360 swagger correctness fixes (Azure#21472)

Co-authored-by: Nan Jiang <[email protected]>

* Add kind for managed environment (Azure#21589)

* add

* fix

* fix (Azure#21730)

* fix (Azure#21747)

Co-authored-by: p-bouchon <[email protected]>
Co-authored-by: Ruslan Yakushev <[email protected]>
Co-authored-by: zhenqxuMSFT <[email protected]>
Co-authored-by: najian <[email protected]>
Co-authored-by: Nan Jiang <[email protected]>
@github-actions github-actions bot locked and limited conversation to collaborators Apr 11, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug This issue requires a change to an existing behavior in the product in order to be resolved. Client This issue points to a problem in the data-plane of the library. Monitor - Exporter Monitor OpenTelemetry Exporter
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants