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

Support a limit on the number of logs #46

Closed
yurishkuro opened this issue Sep 27, 2016 · 5 comments · Fixed by #483
Closed

Support a limit on the number of logs #46

yurishkuro opened this issue Sep 27, 2016 · 5 comments · Fixed by #483

Comments

@yurishkuro
Copy link
Member

Cf. opentracing/basictracer-go#39

// MaxLogsPerSpan limits the number of Logs in a span if set to a non-zero
// value. If a span has more logs than this value, logs in the middle of the
// span timeline are dropped as necessary and replaced with a log describing
// how many were dropped.
//
// About half of the MaxLogPerSpan logs kept are the oldest logs, and about
// half are the newest logs.
func (tracerOptions) MaxLogsPerSpan(maxLogsPerSpan int) TracerOption {
    return func(tracer *tracer) {
        tracer.options.maxLogsPerSpan = maxLogsPerSpan
    }
}
@oibe
Copy link

oibe commented Feb 12, 2017

Do you want this implemented exactly as opentracing does it? Second half of the logs used as a circular buffer?

funny-falcon added a commit to funny-falcon/jaeger-client-go that referenced this issue Jan 10, 2020
The MaxLogsPerSpan option limits the number of logs in a Span. Events are
dropped as necessary; a log in the finished span indicates how many were
dropped.

fixes jaegertracing#46

Almost copy of opentracing/basictracer-go@723bb40

Signed-off-by: Sokolov Yura <funny.falcon@gmail.com>
@yurishkuro
Copy link
Member Author

@funny-falcon do you have a specific business reason to want this feature?

@funny-falcon
Copy link
Contributor

funny-falcon commented Jan 11, 2020 via email

@yurishkuro
Copy link
Member Author

Nice. Could you share which logging API you are using to fork logs into both stream and spans?

Also, logs are usually written with log levels, so if you need to truncate them in the span it would make sense to do in the order of severity. Which makes me think that a plain maxLogs parameter is too crude of a mechanism, we probably need to use some strategy pattern and create some LogTruncator interface.

@funny-falcon
Copy link
Contributor

We use custom logging library, therefore it were easy to integrate it with tracing: library has concept of exporters that could be added to logger with specified log level, and there were access to context.Context in a log record.

Some considerations from our workflow:

  • spans with a lot of log records a rare, therefore we need to look at them almost never.
  • if span had some problems, usually log records about a problem will be in among last log records. And setup records goes first. Therefore keeping some of first records and some of last records looks to be a good strategy that satisfies 99% uses.
  • since we duplicate log in logging (that flows to ELK), we always could find truncated records there.

Therefore suggested solutions will satisfy our needs completely. And I doubt complication will pay off.

funny-falcon added a commit to funny-falcon/jaeger-client-go that referenced this issue Jan 13, 2020
The MaxLogsPerSpan option limits the number of logs in a Span. Events are
dropped as necessary; a log in the finished span indicates how many were
dropped.

fixes jaegertracing#46

Almost copy of opentracing/basictracer-go@723bb40

Signed-off-by: Sokolov Yura <funny.falcon@gmail.com>
yurishkuro pushed a commit that referenced this issue Jan 13, 2020
The MaxLogsPerSpan option limits the number of logs in a Span. Events are
dropped as necessary; a log in the finished span indicates how many were
dropped.

fixes #46

Almost copy of opentracing/basictracer-go@723bb40

Signed-off-by: Sokolov Yura <funny.falcon@gmail.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants