Skip to content

Conversation

@ivantopo
Copy link
Contributor

@ivantopo ivantopo commented Dec 5, 2025

This should fix #1411.

The root of the issue is that in some Play applications there could be controllers that look a bit like this:

def handleRequest(...) = {
  // some code
  Kamon.currentSpan().name("custom-name")

  CustomAction {
    // The actual request handling happens here
  }
}

In these cases the rename happens during the "routing" part of the request handling in Play (see here and we apply the default operation names after that, during the filter handling which effectively overrides any operation name that was set during the routing stage.

It's hard to protect against unusual usage patterns like this (usually all processing would happen inside an Action) but regardless of what's causing the issue we should not overwrite operation names assigned by users. This PR just checks whether the operation name is the default and if so, it generates a new name. We do something similar in the Akka HTTP routing instrumentation as well.

I don't like that we are not reading the default operation name from config but for now I think we can live with that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Play's instrumentation overwrites manually set operation names

1 participant