Skip to content

Tracing "validation" fields are always null #448

@favila

Description

@favila

When using the "tracing" extension (e.g. the lacinia-timing header in pedestal), the "validation" field always looks like {:startOffset nil, :duration nil} instead of having an offset and duration.

I believe this is because lacinia execute-query pulls the ::timing/validation entry off the context map instead of the parsed-query map.

Both com.walmartlabs.lacinia.pedestal.internal/on-enter-prepare-query and com.walmartlabs.lacina/execute-parsed-query-async seem to add this to the parsed-query map, not its parent map.

As a workaround in lacinia-pedestal, I insert the following interceptor somewhere in-between l.pedestal2/prepare-query-interceptor and l.pedestal2/query-executor-handler to copy the validation data to the place execute-query expects, although I think execute-query is probably the code that should change here.

(interceptor
     {:enter (fn [pctx]
               (update-in pctx [:request :lacinia-app-context] conj
                          (find (-> pctx :request :parsed-lacinia-query)
                                :com.walmartlabs.lacinia.tracing/validation)))})

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions