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

feat: More detailed tracing for distributors #14504

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

Conversation

benclive
Copy link
Contributor

What this PR does / why we need it:

Improves the tracing in the distributor. Currently we just get a single span for the whole request.

  • Adds subspan for parseRequest, as this can be overridden by adaptive logs, for example.
  • Splits the tracker for Kafka & Ingester pushes and creates separate spans for each of them.
  • Instruments the kafka write client's ProduceSync.
  • Adds a metric to track record sizes in bytes.

def buckets

Swap metrics for subspans in Distributor.push
@benclive benclive requested a review from a team as a code owner October 16, 2024 15:48
@benclive benclive changed the title More details tracing for distributors feat: More detailed tracing for distributors Oct 16, 2024
@@ -304,6 +305,12 @@ func New(
Help: "The number of records a single per-partition write request has been split into.",
Buckets: prometheus.ExponentialBuckets(1, 2, 8),
}),
kafkaBytesPerRecord: promauto.With(registerer).NewHistogram(prometheus.HistogramOpts{
Namespace: constants.Loki,
Name: "distributor_kafka_bytes_per_record",
Copy link
Contributor

Choose a reason for hiding this comment

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

Perhaps I misunderstood, but it seems like either Name or Help is incorrect. Name suggests this is record size, but Help suggests this is the number of records, not the record size.

@@ -594,36 +601,40 @@ func (d *Distributor) Push(ctx context.Context, req *logproto.PushRequest) (*log
const maxExpectedReplicationSet = 5 // typical replication factor 3 plus one for inactive plus one for luck
var descs [maxExpectedReplicationSet]ring.InstanceDesc

tracker := pushTracker{
kafkaTracker := pushTracker{
Copy link
Contributor

Choose a reason for hiding this comment

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

Something that is unclear to me is what was the behavior before when sharing a common tracker, and what is the behavior now having separate trackers?

@grobinson-grafana
Copy link
Contributor

In general LGTM, but a couple questions before I ✅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants