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

conversion to sketch with too many bins #20619

Open
seankhliao opened this issue Jun 6, 2024 · 2 comments
Open

conversion to sketch with too many bins #20619

seankhliao opened this issue Jun 6, 2024 · 2 comments
Labels
domain: metrics Anything related to Vector's metrics events source: datadog_agent Anything `datadog_agent` source related type: bug A code related bug.

Comments

@seankhliao
Copy link

A note for the community

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Problem

Vector appears to have an issue converting some histograms / sketches.
Here is the first few bytes of a single metric, the full file we captured was 4MB for a single line.

{"name":"apiserver_flowcontrol_read_vs_write_current_requests","tags":{"container":"keda-operator-metrics-apiserver","service.name":"keda/keda-operator-metrics-apiserver"},"timestamp":"2024-06-06T10:33:24Z","kind":"incremental","sketch":{"sketch":{"AgentDDSketch":{"bins":{"k":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,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0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0

Configuration

api:
  enabled: true
sources:
  otelcol:
    type: datadog_agent
    address: 0.0.0.0:8000
    store_api_key: false

sinks:
  debug:
    type: console
    encoding:
      codec: json
    inputs:
      - otelcol

Version

vector 0.38.0 (x86_64-unknown-linux-gnu ea0ec6f 2024-05-07 14:34:39.794027186)

Debug Output

the debug log output approached 1GB...

Example Data

I've included a reproducer here in the following gist. It includes an app which serves metrics as captured from one of our environments, a simplified opentelemetry collector config equivalent to what we run, and a basic vector config to receive the data.

To run it, in 3 separate terminal sessions:

  • go run .
  • otelcol-contrib --config=file:otelcol.yaml --feature-gates=-exporter.datadogexporter.metricexportnativeclient
  • vector --config vector.yaml

After the 2nd / 3rd scrape, vector should start logging a sketch with a lot of 0 bins

https://gist.github.com/seankhliao/954665498b0ad3ca37335d6fbae41758

Additional Context

We run the opentelemetry collector to scrape services with prometheus metrics declared as ServiceMonitor / PodMonitor objects.
The collector then sends the metrics to vector for additional transforms and final submission into datadog.

We identified an issue in our environments where vector stops sending any metrics at all, filling up its buffer. This was isolated to metrics from this service.

References

No response

@seankhliao seankhliao added the type: bug A code related bug. label Jun 6, 2024
@jszwedko jszwedko added sink: datadog_metrics Anything `datadog_metrics` sink related domain: metrics Anything related to Vector's metrics events source: datadog_agent Anything `datadog_agent` source related and removed sink: datadog_metrics Anything `datadog_metrics` sink related labels Jun 6, 2024
@jszwedko
Copy link
Member

jszwedko commented Jun 6, 2024

Thanks for providing the reproduction case! That should make this easier to nail down.

@tobz
Copy link
Contributor

tobz commented Jun 7, 2024

Hmm, seems like there's a good chance this is related to DataDog/saluki#67 and the comment in ddsketch.rs:

// I still don't yet understand how this works, since you'd think bin limit should be the
// overall limit of the number of bins, but we're allowing more than that.. :thinkies:

Certainly, given that the buckets in apiserver_flowcontrol_read_vs_write_current_requests have a count of ~5.7 trillion, they're going to immediately max out every single possible sketch bin on the Agent/OTel Collector side before hitting Vector.

Normally, AgentDDSketch would at least try to enforce a bin limit but since we're directly deserializing the sketches coming into the Datadog Agent source into their AgentDDSketch representation, they just have whatever bins have been given to us... which in this case is a whole hell of a lot of bins.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
domain: metrics Anything related to Vector's metrics events source: datadog_agent Anything `datadog_agent` source related type: bug A code related bug.
Projects
None yet
Development

No branches or pull requests

3 participants