opencensus-python icon indicating copy to clipboard operation
opencensus-python copied to clipboard

Application Insights dependency types

Open victoraugustolls opened this issue 6 years ago • 5 comments

Is your feature request related to a problem? Not a problem.

Describe the solution you'd like. Azure Tracing exporter currently only accepts HTTP dependency type, while there are many others. Would like to make all of them possible.

Describe alternatives you've considered. None.

Additional context. I already made some changes locally to show SQL dependency type, but I don't think is the better option and would like to discuss it here.

victoraugustolls avatar Jul 26 '19 20:07 victoraugustolls

Locally I changed the AzureExporter like this:

if sd.span_kind == SpanKind.CLIENT:
    data.type = "HTTP"  # TODO
    if "http.url" in sd.attributes:
        url = sd.attributes["http.url"]
        # TODO: error handling, probably put scheme as well
        data.name = utils.url_to_dependency_name(url)
        if "http.status_code" in sd.attributes:
            data.resultCode = str(sd.attributes["http.status_code"])
elif "dependency.type" in sd.attributes:
    data.type = sd.attributes["dependency.type"]
    sd.attributes.pop("dependency.type")
    if "database.query" in sd.attributes:
        data.data = sd.attributes["database.query"]
        sd.attributes.pop("database.query")
    if "database.error" in sd.attributes:
        data.success = False
        data.properties["error"] = sd.attributes["database.error"]
        sd.attributes.pop("database.error")

victoraugustolls avatar Jul 26 '19 20:07 victoraugustolls

If we update psycopg, pymongo... ext to follow the guidelines from here we can easily show more dependency types.

victoraugustolls avatar Jul 31 '19 13:07 victoraugustolls

@victoraugustolls you're right, we're trying to make a better semantic convention in OpenTelemetry. Current plan is migrate the most important extensions to OpenTelemetry in Sep, we will do refactor there. It'll be great if you wish to explore how to adopt OpenTelemetry semantic in OpenCensus, once we got the work done in OpenCensus, it makes things a lot easier when we move forward to OpenTelemetry.

reyang avatar Jul 31 '19 16:07 reyang

@reyang if possible, would like to help you guys. Already published a PR today, hope to do a new one soon about the requests extension.

victoraugustolls avatar Jul 31 '19 17:07 victoraugustolls

bumped in this one while looking for a solution to add telemetry for my pyodbc queries. Is there something already available to do this? @victoraugustolls I saw you mentioned to add a dependency.type query, is it merged in opencensus-python?

peppeweb avatar May 27 '21 09:05 peppeweb