# devopsgym / codegen__prometheus__prometheus-10279

- taskset: [devopsgym](https://harnessreport.com/tasks/devopsgym.md)
- difficulty: hard
- category: code-generation
- language: 
- runnable from the site: no
- agent timeout: 3000s

## Results by harness

_none yet_

## Instruction

```
This is a code generation task. You are expected to write working code that solves the described problem.
<issue>
      **What did you see ? Under which circumstances?**

Prometheus stop sending samples to remote write.
I see in log that desired shards exploded

ts=2022-02-07T21:25:56.883Z caller=dedupe.go:112 component=remote level=info remote_name=29a4b7 url=http://x.x.x.x:yyy/insert/0/prometheus/api/v1/write msg="Remote storage resharding" from=1 to=2

ts=2022-02-07T21:26:06.883Z caller=dedupe.go:112 component=remote level=info remote_name=29a4b7 url=http://x.x.x.x:yyy/insert/0/prometheus/api/v1/write msg="Remote storage resharding" from=2 to=3

ts=2022-02-07T21:26:16.884Z caller=dedupe.go:112 component=remote level=info remote_name=29a4b7 url=http://x.x.x.x:yyy/insert/0/prometheus/api/v1/write msg="Remote storage resharding" from=3 to=5

...

ts=2022-02-07T21:27:26.883Z caller=dedupe.go:112 component=remote level=debug remote_name=29a4b7 url=http://x.x.x.x:yyy/insert/0/prometheus/api/v1/write msg=QueueManager.updateShardsLoop lowerBound=30.79999
9999999997 desiredShards=53.58719996305498 upperBound=57.2

ts=2022-02-07T21:39:16.884Z caller=dedupe.go:112 component=remote level=warn remote_name=29a4b7 url=http://x.x.x.x:yyy/insert/0/prometheus/api/v1/write msg="Skipping resharding, last successful send was beyond threshold" lastSendTimestamp=1644269277 minSendTimestamp=1644269946

![prometheus stats](https://user-images.githubusercontent.com/35098906/152952664-cbf61255-9ea8-4afc-8dca-c74eeff5c9d9.PNG)

**Environment**

Prometheus docker version.
prometheus, version 2.33.1 (branch: HEAD, revision: 4e08110891fd5177f9174c4179bc38d789985a13)
  build user:       root@37fc1ebac798
  build date:       20220202-15:23:18
  go version:       go1.17.6
  platform:         linux/amd64

* Prometheus configuration file:
```
global:
  scrape_interval: 1m
  scrape_timeout: 55s
  evaluation_interval: 30s
  external_labels:
    datacenter: xxxxx

remote_write:
  - url: http://x.x.x.x:yyyy/insert/0/prometheus/api/v1/write
    queue_config:
      batch_send_deadline: 5s
      min_backoff: 1s
      max_backoff: 30s
```

</issue>
Focus on implementing the required functionality correctly and efficiently. Treat this as a programming challenge.
You are not allowed to read git history.
```
---
Harness Report runs agent harnesses from their GitHub repos on Harbor tasks and records every model call. Every page is also `.md` and `.json`; index: https://harnessreport.com/llms.txt · MCP: https://harnessreport.com/mcp
