Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make virtual_node label value configurable? #4506

Open
ShyunnY opened this issue Jan 3, 2025 · 1 comment
Open

Make virtual_node label value configurable? #4506

ShyunnY opened this issue Jan 3, 2025 · 1 comment
Labels
help wanted Extra attention is needed

Comments

@ShyunnY
Copy link

ShyunnY commented Jan 3, 2025

When using service_graph, we usually find that the entry nodes are all virtual_node type (of course, this is expected), and their values ​​are always user/peer values.

Is it possible for us to add a new feature that allows users to step in and configure its value?

Describe the solution you'd like

We always use the user-configured value first, if the user selects empty, we can fall back to the default value.

Can we organize it with the following structure? (Of course, this is just an example, not the final form):

service_graphs:
  virtual_node:
    defaultClientValue: foo
    defaultServerValue: bar

Describe alternatives you've considered

None

Additional context

Related code:

func (p *Processor) onExpire(e *store.Edge) {
p.metricExpiredEdges.Inc()
// If an edge is expired, we check if there are signs that the missing span is belongs to a "virtual node".
// These are nodes that are outside the user's reach (eg. an external service for payment processing),
// or that are not instrumented (eg. a frontend application).
e.ConnectionType = store.VirtualNode
if len(e.ClientService) == 0 {
// If the client service is not set, it means that the span could have been initiated by an external system,
// like a frontend application or an engineer via `curl`.
// We check if the span we have is the root span, and if so, we set the client service to "user".
if _, parentSpan := parseKey(e.Key()); len(parentSpan) == 0 {
e.ClientService = "user"
if p.Cfg.EnableVirtualNodeLabel {
e.Dimensions[virtualNodeLabel] = "client"
}
p.onComplete(e)
}
} else if len(e.ServerService) == 0 && len(e.PeerNode) > 0 {
// If client span does not have its matching server span, but has a peer attribute present,
// we make the assumption that a call was made to an external service, for which Tempo won't receive spans.
e.ServerService = e.PeerNode
if p.Cfg.EnableVirtualNodeLabel {
e.Dimensions[virtualNodeLabel] = "server"
}
p.onComplete(e)
}
}

@joe-elliott
Copy link
Member

Are you saying you'd like a config option to change the hardcoded defaults? I'm good on that.

@joe-elliott joe-elliott added the help wanted Extra attention is needed label Jan 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants