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

Added BatchSpanProcessor metrics on drop and export span #635

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

mamunto
Copy link
Contributor

@mamunto mamunto commented Nov 11, 2024

Added BatchSpanProcessor metrics on drop and export span

Copy link
Contributor Author

@mamunto mamunto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm following Java SDK implementation from here

Comment on lines +113 to +124
self.queueSizeGauge = meter.gaugeBuilder(name: "queueSize")
.ofLongs()
.setDescription("The number of items queued")
.setUnit("1")
.buildWithCallback { result in
result.record(
value: maxQueueSize,
attributes: [
BatchSpanProcessor.SPAN_PROCESSOR_TYPE_LABEL: .string(BatchSpanProcessor.SPAN_PROCESSOR_TYPE_VALUE)
]
)
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I followed Java SDK implementation and convention, and here maxQueueSize will be always fixed. Is that a right use case?


func addSpan(span: ReadableSpan) {
cond.lock()
defer { cond.unlock() }

if spanList.count == maxQueueSize {
// TODO: Record a counter for dropped spans.
processedSpansCounter.add(value: 1, attribute: droppedAttrs)
return
}
// TODO: Record a gauge for referenced spans.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not clear on proper use-case here. Please explain the use-case and I can add the functionality @nachoBonafonte @bryce-b

Comment on lines +213 to +215
cond.lock()
processedSpansCounter.add(value: spanList.count, attribute: exportedAttrs)
cond.unlock()
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm using same lock here to modify the counter

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.

1 participant