Giter Site home page Giter Site logo

Comments (9)

BrynCooke avatar BrynCooke commented on September 21, 2024 3

Suggest we make the JSON formatter for logging have a section that specifies allowed attributes.

from router.

smyrick avatar smyrick commented on September 21, 2024 1

@BrynCooke That would add the value to all spans, but it does not get included in all text logs from Router. I want all logs, including ones internal to the Router debugging, to have some standard attributes

from router.

BrynCooke avatar BrynCooke commented on September 21, 2024

In theory this should give you what you need:

telemetry:
  instrumentation:
    spans:
      mode: spec_compliant
      router:
        attributes:
          shanes-custom-correlation-id:
            request_header: "x-correlation-id"

Span attributes are included on log events under the span_list key.

Resources are intentionally static and are sent in the envelope of otel payloads rather than on individual events/traces/metrics

from router.

smyrick avatar smyrick commented on September 21, 2024

Oh wait, I think I missed the key part there. There is a setting in the Router log configuration that allows you to include the span information IN the logs meaning that I can add standard attribute if they exist in the spans, correct?

https://www.apollographql.com/docs/router/configuration/telemetry/exporters/logging/stdout#json-configuration-reference

telemetry:
  instrumentation:
    spans:
      mode: spec_compliant
      default_attribute_requirement_level: recommended
       # Set values to add to all the different spans
      router:
        attributes:
          "shanes-custom-id":
            request_header: "x-shane-id"

  exporters:
    logging:
      stdout:
        enabled: true
        format:
          json:
            # Include span info in logs
            display_current_span: true
            display_span_list: true

Does this only get included as part of the standard router, supergraph, and subgraph spans though? What about logs that happen during query planning?

from router.

smyrick avatar smyrick commented on September 21, 2024

One down side to this current configuration option is that is still logs all the span attributes which could be quite large. If I just need one header value to exist in the logs, and ideal configuration as proposed could be a lot smaller and use less resources

from router.

BrynCooke avatar BrynCooke commented on September 21, 2024

Yeah, span list contains all the span data for all nested spans. I could see us adding something to allow more targeted attributes here.

from router.

abernix avatar abernix commented on September 21, 2024

@bnjjj Does this tie into any other work?

from router.

bnjjj avatar bnjjj commented on September 21, 2024

@abernix no I don't think so

from router.

BrynCooke avatar BrynCooke commented on September 21, 2024

It could be solved with this #5387

from router.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.