Skip to content

Commit 6ec01ea

Browse files
committed
fix instructions
Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
1 parent ff07dbb commit 6ec01ea

File tree

4 files changed

+42
-155
lines changed

4 files changed

+42
-155
lines changed

CLAUDE.md

Lines changed: 32 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,19 +69,46 @@ Pre-built instrumentations: `prometheus-metrics-instrumentation-jvm`, `-caffeine
6969
## Code Style
7070

7171
- **Formatter**: Google Java Format (enforced via Spotless)
72-
- **Line length**: 100 characters
72+
- **Line length**: 100 characters (enforced for ALL files including Markdown, Java, YAML, etc.)
7373
- **Indentation**: 2 spaces
7474
- **Static analysis**: Error Prone with NullAway (`io.prometheus.metrics` package)
7575
- **Logger naming**: Logger fields must be named `logger` (not `log`, `LOG`, or `LOGGER`)
7676
- **Assertions in tests**: Use static imports from AssertJ (`import static org.assertj.core.api.Assertions.assertThat`)
7777
- **Empty catch blocks**: Use `ignored` as the exception variable name
78+
- **Markdown code blocks**: Always specify language (e.g., ` ```java`, ` ```bash`, ` ```text`)
7879

7980
## Linting and Validation
8081

81-
- **IMPORTANT**: Always run `mise run build` after modifying Java files to ensure all lints, code formatting (Spotless), static analysis (Error Prone), and checkstyle checks pass
82-
- **IMPORTANT**: Always run `mise run lint:super-linter` after modifying non-Java files (YAML, Markdown, shell scripts, JSON, etc.)
83-
- Super-linter is configured to only show ERROR-level messages via `LOG_LEVEL=ERROR` in `.github/super-linter.env`
84-
- Local super-linter version is pinned to match CI (see `.mise/tasks/lint/super-linter.sh`)
82+
**CRITICAL**: These checks MUST be run before creating any commits. CI will fail if these checks fail.
83+
84+
### Java Files
85+
86+
- **ALWAYS** run `mise run build` after modifying Java files to ensure:
87+
- Code formatting (Spotless with Google Java Format)
88+
- Static analysis (Error Prone with NullAway)
89+
- Checkstyle validation
90+
- All tests pass
91+
92+
### Non-Java Files (Markdown, YAML, JSON, shell scripts, etc.)
93+
94+
- **ALWAYS** run `mise run lint:super-linter` after modifying non-Java files
95+
- Super-linter will **auto-fix** many issues (formatting, trailing whitespace, etc.)
96+
- It only reports ERROR-level issues (configured via `LOG_LEVEL=ERROR` in `.github/super-linter.env`)
97+
- Common issues caught:
98+
- Lines exceeding 100 characters in Markdown files
99+
- Missing language tags in fenced code blocks
100+
- Table formatting issues
101+
- YAML/JSON syntax errors
102+
103+
### Running Linters
104+
105+
```bash
106+
# After modifying Java files (run BEFORE committing)
107+
mise run build
108+
109+
# After modifying non-Java files (run BEFORE committing)
110+
mise run lint:super-linter
111+
```
85112

86113
## Testing
87114

CUSTOM_BUCKETS_VERIFICATION.md

Lines changed: 0 additions & 142 deletions
This file was deleted.

examples/example-custom-buckets/README.md

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ Prometheus converts them to native histograms with schema -53.
77
## What are Native Histograms with Custom Buckets?
88

99
Native Histograms with Custom Buckets (NHCB) is a Prometheus feature that combines the benefits of:
10+
1011
- **Custom bucket boundaries**: Precisely defined buckets optimized for your specific use case
1112
- **Native histograms**: Efficient storage and querying capabilities of native histograms
1213

@@ -88,7 +89,7 @@ The Prometheus configuration enables NHCB conversion:
8889
```yaml
8990
scrape_configs:
9091
- job_name: "custom-buckets-demo"
91-
scrape_protocols: ['PrometheusProto']
92+
scrape_protocols: ["PrometheusProto"]
9293
convert_classic_histograms_to_nhcb: true
9394
scrape_classic_histograms: true
9495
```
@@ -111,6 +112,7 @@ api_request_duration_seconds
111112
### 3. View in Grafana
112113

113114
The Grafana dashboard at [http://localhost:3000](http://localhost:3000) shows:
115+
114116
- p95 and p50 latencies for API endpoints (arbitrary custom buckets)
115117
- Queue size distribution (linear buckets)
116118
- Response size distribution (exponential buckets)
@@ -143,12 +145,12 @@ Consider using custom buckets (and NHCB) when:
143145

144146
## Differences from Standard Native Histograms
145147

146-
| Feature | Standard Native Histograms | NHCB (Schema -53) |
147-
|---------|---------------------------|-------------------|
148-
| Bucket boundaries | Exponential (base 2^(2^-scale)) | Custom boundaries |
149-
| Use case | General-purpose | Specific distributions |
150-
| Mergeability | Can merge histograms with same schema | Cannot merge with different boundaries |
151-
| Configuration | Schema level (0-8) | Explicit boundary list |
148+
| Feature | Standard Native Histograms | NHCB (Schema -53) |
149+
| ----------------- | ------------------------------------- | -------------------------------------- |
150+
| Bucket boundaries | Exponential (base 2^(2^-scale)) | Custom boundaries |
151+
| Use case | General-purpose | Specific distributions |
152+
| Mergeability | Can merge histograms with same schema | Cannot merge with different boundaries |
153+
| Configuration | Schema level (0-8) | Explicit boundary list |
152154

153155
## Cleanup
154156

examples/example-custom-buckets/docker-compose/prometheus.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ global:
55
scrape_configs:
66
- job_name: "custom-buckets-demo"
77
# Use protobuf format to receive native histogram data
8-
scrape_protocols: ['PrometheusProto']
8+
scrape_protocols: ["PrometheusProto"]
99
# Convert classic histograms with custom buckets to NHCB (schema -53)
1010
convert_classic_histograms_to_nhcb: true
1111
# Also scrape classic histograms for comparison

0 commit comments

Comments
 (0)