Skip to content

net_http with request headers as span attributes #1998

@isaiahshiner

Description

@isaiahshiner

My actual problem

I have a legacy X-MyCompany-RequestId header that is sent with every request and relayed throughout the backend. I'd like to log this in spans, so that you can connect OTEL spans with our legacy observability stuff. This will be replaced with propagator, but not everything is on OTEL yet.

This affects multiple instrumentations, but net_http is the main one. I'm currently only using standard Rails instrumentation from this repo, I don't have any custom instrumentation/spans. It seems like I could wrap every call to Net::HTTP with a new span, but that seems like a bad approach.

Questions and workflow

  1. How should HTTP Headers be reported? I found semantic docs, but not recommendations. Dumping all headers does seem like a bad idea.
    a. Wait, found it, its under footnote [15] here.

    [15] http.request.header.: Instrumentations SHOULD require an explicit configuration of which headers are to be captured. Including all request headers can be a security risk - explicit configuration helps avoid leaking sensitive information.

    b. Yep, this makes sense. So, my expected workflow would be to add X-MyCompany-RequestId to the expected headers of Net:HTTP during initialization?

  2. Is this just unfinished work? Is it planned? It seems approachable enough that I might be able to pick it up.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions