Skip to content
This repository was archived by the owner on May 23, 2023. It is now read-only.
This repository was archived by the owner on May 23, 2023. It is now read-only.

Correct way how to not report fast spans #363

@rugpanov

Description

@rugpanov

I would like to trace slow operations only.
There is a manually chosen threshold to determine whether operation slow or not.
I haven't found any description about the correct way to implement it in your documentation, but what came to my mind is:

    final long startTime = System.nanoTime();
    Scope scope = tracer.buildSpan(operationName).startActive(true);
    try {
      //do some work
    } finally {
      long durationInMillis = (System.nanoTime() - startTime) / 1000000;
      if (durationInMillis < THE_THRESHOLD_IN_MILLS) {
        scope = null;
      } else {
        scope.close();
      }
    }

Is it the correct way to drop the spans? If not, what is the correct one?

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