Skip to content

Please add Ray framework integration for sentry/apm. #2400

Closed
@dPeS

Description

@dPeS

Problem Statement

https://www.ray.io/

I want to annotate that kind of code with spans:

import ray
import os
import time
import sentry_sdk
import random
import asyncio
from sentry_sdk.integrations.asyncio import AsyncioIntegration

logging.basicConfig(level=logging.DEBUG)

def step1():
    with sentry_sdk.start_span(description="step1"):
        time.sleep(random.randint(200,500)/1000.)
def step2():
    with sentry_sdk.start_span(description="step2"):
        time.sleep(random.randint(200,500)/1000.)
def step3():
    with sentry_sdk.start_span(description="step3"):
        time.sleep(random.randint(200,500)/1000.)

@ray.remote
def retrieve_task(item):
    step1()
    step2()
    step3()
    return 1

async def main():
    sentry_sdk.init(
        dsn=os.getenv('SENTRY_DSN'),
        traces_sample_rate=1.0,
        integrations=[
            AsyncioIntegration(),
        ],
    )
    #---
    ray.init()
    with sentry_sdk.start_transaction(op="task", name="example ray task transaction"):
        object_references = [
            retrieve_task.remote(item) for item in range(8)
        ]
        data = ray.get(object_references)
        print(data)

if __name__ ==  '__main__':
    asyncio.run(main())

But I only see one big transaction trace without those 3 spans.

Solution Brainstorm

I think new integration needs to be done.

Metadata

Metadata

Assignees

Labels

New IntegrationIntegrating with a new framework or libraryTriagedHas been looked at recently during old issue triage

Type

No type

Projects

Status

No status

Status

Waiting for: Product Owner

Status

No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions