feat: As a user, I want to be able to choose "root span name", so that I can better distringuish traces

Aperta
#13,748 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 2 giorni

Nessuno ha ancora preso questa issue.

  • #13749 di @UnoYakshi — chiusa senza merge

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
35/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
lua

Direzione di ricerca

Inizia leggendo la logica di denominazione del root span intorno alla riga 417 di apisix/plugins/opentelemetry.lua e rivedi la WIP PR #13749 collegata. Traccia il modo in cui il plugin opentelemetry distingue tra root span e child span, quindi verifica la configurazione della strategia richiesta, il suo comportamento predefinito e che la modifica del nome risultante riguardi solo il root span.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

feature-request

Clarification/Context

I have Tempo+Grafana setup, traces are correctly sent to the OTLP endpoint. However, I'd like the "Name" column (in Grafana) to show "http.target" / "url.uri" (of span attributes) and not "http.route". Because, for multiple endpoints, I'd get the same "Name", e.g., /api/admin/*. But it's currently hardcoded in opentelemetry.lua#L417.
As mentioned here, frontend application should own/be the parent span. However, when no there is no frontend application, it's not the case. And I'd like to be able to better distinguish one request from another.

Suggestion

What if we add another parameter to opentelemetry plug-in, span_name_strategy?

{
  "span_name_strategy": "path|target"
}

(pseudocode)

-- Either `metadata_schema` or `schema`...
local schema = {
    type = "object",
    properties = {

        -- ...

        span_name_strategy = {
            type = "string",
            enum = {"path", "target"},
            default = "path",
        },

        -- ...
}

-- ...

local function resolve_span_name(conf, api_ctx)
    local span_name_strategy = conf.span_name_strategy or "route"

    if strategy == "target" then
        return api_ctx.var.uri
    end

    return api_ctx.curr_req_matched._path
end

-- ...

-- Closer to line 417...
local span_name_suffix = resolve_span_name_suffix(plugin_info, api_ctx)
span_name = span_name .. " " .. span_name_suffix

WIP PR

https://github.com/apache/apisix/pull/13749

I'm not really sure how to affect only root span, and not children.

Lingua principale
Lua
Stelle
17.3k
Fork
3k
Merge medio
4g 16h
PR unite (30g)
69

Preparare l'ambiente

Apri in Codespaces

Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di apache/apisix

Tutte le issue di apache/apisix

Issue simili

Altre issue su Lua

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.