Commit Graph

649 Commits

Author SHA1 Message Date
György Krajcsovits dc8e9a4d8a fix: native histogram: Simplify and fix addExemplar
mdIdx was redundant when len(exemplars)>1, so got rid of it, rIdx
is enough.

Don't compare timestamp of incoming exemplar to timestamp of
minimal distance exemplar. Most of the time the incoming exemplar
will be newer. And if not, the previous code just replaced an
exemplar one index after the minimal distance exemplar. Which had
an index out of range bug, plus is essentially random.

Signed-off-by: György Krajcsovits <gyorgy.krajcsovits@grafana.com>
2024-09-04 21:10:22 +02:00
György Krajcsovits dc819ceb1b Use a trivial solution to #1605
Signed-off-by: György Krajcsovits <gyorgy.krajcsovits@grafana.com>
2024-09-04 21:10:22 +02:00
György Krajcsovits e061dfae88 native histogram: use exemplars in concurrency test
Signed-off-by: György Krajcsovits <gyorgy.krajcsovits@grafana.com>
2024-09-04 21:10:22 +02:00
Manuel Rüger f7f8f3a1e2 fix: Unset Content-Encoding header when uncompressed
Fixes: #1595
Signed-off-by: Manuel Rüger <manuel@rueg.eu>
2024-08-23 18:53:42 +02:00
bwplotka f2dd7b35fd Use pedantic registry in other places too, to double check.
Signed-off-by: bwplotka <bwplotka@gmail.com>
2024-08-20 11:44:35 +01:00
Arthur Silva Sens 261fe84cd4 bugfix: Pass network metrics to processCollector's Describe() function
Signed-off-by: Arthur Silva Sens <arthursens2005@gmail.com>
2024-08-20 11:44:35 +01:00
Arthur Silva Sens 5bf3341b66 Use NewPedanticRegistry in Process' Collector tests
Signed-off-by: Arthur Silva Sens <arthursens2005@gmail.com>
2024-08-20 11:44:35 +01:00
Bartlomiej Plotka 7ce508988a
gocollector: Attach original runtime/metrics metric name to help. (#1578)
This helps in filtering capabilities and generally in discovery/knowledge sharing.

Signed-off-by: bwplotka <bwplotka@gmail.com>
2024-08-14 12:25:55 +00:00
Bartlomiej Plotka 062300ede9
Remove go_memstat_lookups_total; added runtime/metrics calculation to memstat metric's help. (#1577)
* Removeed go_memstat_lookups_total which was always set to 0; added runtime/metrics info to memstat metric helps.

I know we ideally should not remove any metric from default list, but
this one is always zero, so let's save everyone's money.

Signed-off-by: bwplotka <bwplotka@gmail.com>

* Update prometheus/go_collector.go

Co-authored-by: Arthur Silva Sens <arthursens2005@gmail.com>
Signed-off-by: Bartlomiej Plotka <bwplotka@gmail.com>

---------

Signed-off-by: bwplotka <bwplotka@gmail.com>
Signed-off-by: Bartlomiej Plotka <bwplotka@gmail.com>
Co-authored-by: Arthur Silva Sens <arthursens2005@gmail.com>
2024-08-14 12:11:51 +00:00
Arianna Vespri 3ad272204b
Add default Go runtime metrics for /gc/gogc:percent, /gc/gomemlimit:bytes, /sched/gomaxprocs:threads (#1559)
* Add go_gomaxprocs, go_gogc_percent and go_gomemlimit to the default Go runtime metrics

Signed-off-by: Arianna Vespri <arianna.vespri@yahoo.it>

* Move newly added metrics out of base metrics and into goCollector

Signed-off-by: Arianna Vespri <arianna.vespri@yahoo.it>

* Rethink struct for newly added metrics, adapt and add tests

Signed-off-by: Arianna Vespri <arianna.vespri@yahoo.it>

* Simplify new metrics reading

Signed-off-by: Arianna Vespri <arianna.vespri@yahoo.it>

* Correct loop, add debugging lines

Signed-off-by: Arianna Vespri <arianna.vespri@yahoo.it>

* Make goRuntimeEnvVarsMetrics function Go version dependent

Signed-off-by: Arianna Vespri <arianna.vespri@yahoo.it>

* Fix go mod

Signed-off-by: Arianna Vespri <arianna.vespri@yahoo.it>

* Remove debuggin line

Signed-off-by: Arianna Vespri <arianna.vespri@yahoo.it>

* Move default runtime metrics into the runtime metrics flow, change tests accordingly

Signed-off-by: Arianna Vespri <arianna.vespri@yahoo.it>

* Go version expected default runtime metrics map for tests

Signed-off-by: Arianna Vespri <arianna.vespri@yahoo.it>

* 1.21 update.

Signed-off-by: bwplotka <bwplotka@gmail.com>

* Addressed comments on Arianna's PR.

Signed-off-by: bwplotka <bwplotka@gmail.com>

* Use default GoCollector func in test

Signed-off-by: Arianna Vespri <arianna.vespri@yahoo.it>

---------

Signed-off-by: Arianna Vespri <arianna.vespri@yahoo.it>
Signed-off-by: bwplotka <bwplotka@gmail.com>
Co-authored-by: bwplotka <bwplotka@gmail.com>
2024-08-09 20:27:25 +01:00
Bartlomiej Plotka 0ce6d719bc
go collector: add default metrics acceptance tests; adding more context to HELP (#1568)
* go collector: add default metrics acceptance tests; adding more context to HELP

The context and details for help were possible thanks to @vesari research, thanks for that!

Signed-off-by: bwplotka <bwplotka@gmail.com>

* Update prometheus/go_collector.go

Co-authored-by: Arianna Vespri <36129782+vesari@users.noreply.github.com>
Signed-off-by: Bartlomiej Plotka <bwplotka@gmail.com>

---------

Signed-off-by: bwplotka <bwplotka@gmail.com>
Signed-off-by: Bartlomiej Plotka <bwplotka@gmail.com>
Co-authored-by: Arianna Vespri <36129782+vesari@users.noreply.github.com>
2024-08-01 09:24:31 +01:00
Huw Jones 10f4161c7d
process_collector: collect received/transmitted bytes (#1555)
Signed-off-by: Huw Jones <huw@pexip.com>
2024-07-17 12:19:40 +02:00
Ben Kochie fec6b222d9
Update Go tests (#1562)
Add new metric that appeared in 1.22.5 and 1.21.12.
* Improve test output with `cmp.Diff`.

Signed-off-by: SuperQ <superq@gmail.com>
2024-07-15 19:28:14 +02:00
Steven Swartz 1a5f005c91
Allow creating constant histogram and summary metrics with a created timestamp (#1537) 2024-07-01 17:35:47 -03:00
Ben Kochie bccd68204b
Remove inlined upstream code (#1539)
Avoid having to maintain inlined code by using Go modules for
`github.com/kylelemons/godebug`.

Signed-off-by: SuperQ <superq@gmail.com>
2024-06-20 13:05:41 +02:00
Manuel Rüger f08b10c5bc
feat: Support zstd compression (#1496)
* feat: Support zstd encoding

This allows endpoints to respond with zstd compressed metric data, if
the requester supports it.

I have imported a content-encoding parser from
https://github.com/golang/gddo which is an archived repository to
support different content-encoding headers.

Signed-off-by: Manuel Rüger <manuel@rueg.eu>

* Update prometheus/promhttp/http.go

Co-authored-by: Bartlomiej Plotka <bwplotka@gmail.com>
Signed-off-by: Manuel Rüger <manuel@rueg.eu>

* Update prometheus/promhttp/http.go

Co-authored-by: Bartlomiej Plotka <bwplotka@gmail.com>
Signed-off-by: Manuel Rüger <manuel@rueg.eu>

* Update prometheus/promhttp/http.go

Co-authored-by: Bartlomiej Plotka <bwplotka@gmail.com>
Signed-off-by: Manuel Rüger <manuel@rueg.eu>

* Integrate review comments

* String typed enum

Signed-off-by: Manuel Rüger <manuel@rueg.eu>

* Test with gzip compression

Signed-off-by: Manuel Rüger <manuel@rueg.eu>

* Update prometheus/promhttp/http.go

Co-authored-by: Bartlomiej Plotka <bwplotka@gmail.com>
Signed-off-by: Manuel Rüger <manuel@rueg.eu>

* Reorder error handling

Signed-off-by: Manuel Rüger <manuel@rueg.eu>

* Apply suggestions from code review

Co-authored-by: Bartlomiej Plotka <bwplotka@gmail.com>
Signed-off-by: Manuel Rüger <manuel@rueg.eu>

* Include review suggestions

Signed-off-by: Manuel Rüger <manuel@rueg.eu>

---------

Signed-off-by: Manuel Rüger <manuel@rueg.eu>
Co-authored-by: Bartlomiej Plotka <bwplotka@gmail.com>
2024-06-07 15:56:19 +01:00
Björn Rabenstein 542f7e6c6e
Merge pull request #1471 from fatsheep9146/native-histogram-exemplar
add native histogram exemplar support
2024-05-16 12:22:21 +02:00
Ziqi Zhao 2754a4c204 fix for comments
Signed-off-by: Ziqi Zhao <zhaoziqi9146@gmail.com>
2024-05-16 18:16:36 +08:00
Arthur Silva Sens cb57abb57d
Merge pull request #1515 from lilijreey/use_time_IsZero
improved code more clean use time.IsZero() replace t = time.Time{}
2024-05-15 11:17:22 -03:00
chuanshuo 47b807e0d7 clean code use time.IsZero() replace t = time.Time{}, make code more readable
Signed-off-by: chuanshuo <lilijreey@126.com>
2024-05-15 22:05:50 +08:00
leonnicolas c7c7509669
testutil compareMetricFamilies: make less error-prone (#1424)
* testutil compareMetricFamilies: make less error-prone

The functions `GatherAndCompare`, `ScrapeAndCompare` and others that use
`compareMetricFamilies` under the hood can return no error if
`metricNames` includes none of the names found in the scraped/gathered
results. To avoid false Positves (an error being the negative case), we
can return an error if there is is at least one name in `metricNames`
that is not in the filtered results.

Fixes: https://github.com/prometheus/client_golang/issues/1351

Signed-off-by: leonnicolas <leonloechner@gmx.de>

* Add missing metricNames to error

In to see which metric names are missing, we can add them to the error
message.

Signed-off-by: leonnicolas <leonloechner@gmx.de>

* Apply suggestions from code review

- remove if nil check
- use two nested loops instead of map
- use new function `hasMetricByName` for readability

Co-authored-by: Bartlomiej Plotka <bwplotka@gmail.com>
Signed-off-by: leonnicolas <60091705+leonnicolas@users.noreply.github.com>

* prometheus/testutil/testutil_test.go: compare complete error

Before we would only compare the error prefix in `TestScrapeAndCompare`.

Signed-off-by: leonnicolas <leonloechner@gmx.de>

---------

Signed-off-by: leonnicolas <leonloechner@gmx.de>
Signed-off-by: leonnicolas <60091705+leonnicolas@users.noreply.github.com>
Co-authored-by: Bartlomiej Plotka <bwplotka@gmail.com>
2024-05-15 10:50:24 +01:00
Jack Cassidy 36b9f46811
add: CollectAndFormat to testutil (#1503)
CollectAndFormat is a helper function that returns the formatted metrics
to the caller, allowing them to use it how they want. This is different
to CollectAndCompare where the comparison is done strictly on behalf of
the caller. Often it is more convenient to perform a simple substring
match on the formatted metric.

Signed-off-by: Jack Cassidy <j.cassidy45@gmail.com>
2024-05-09 15:08:21 +00:00
Ziqi Zhao d8c7074b1c refract the implementation
Signed-off-by: Ziqi Zhao <zhaoziqi9146@gmail.com>
2024-05-09 22:11:15 +08:00
chuanshuo ccf82b1854
improved code more clean (#1511)
* improved code more clean

Signed-off-by: chuanshuo <lilijreey@126.com>

* improved code more clean

Signed-off-by: chuanshuo <lilijreey@126.com>

---------

Signed-off-by: chuanshuo <lilijreey@126.com>
2024-05-09 10:34:07 +01:00
Ziqi Zhao 494ccce4f1 add native histogram exemplar support
Signed-off-by: Ziqi Zhao <zhaoziqi9146@gmail.com>
2024-05-09 07:14:46 +08:00
dongjiang 2f59eb2687
feat(dependency): replace go-spew package (#1499)
* remove go-spew package

Signed-off-by: dongjiang1989 <dongjiang1989@126.com>

* fix gofumpt lint

Signed-off-by: dongjiang1989 <dongjiang1989@126.com>

* fix unittest unicode

Signed-off-by: dongjiang1989 <dongjiang1989@126.com>

* dongjiang, change go-cmp to reflect

Signed-off-by: dongjiang1989 <dongjiang1989@126.com>

* fix lint

Signed-off-by: dongjiang1989 <dongjiang1989@126.com>

* Revert "dongjiang, change go-cmp to reflect"

This reverts commit bfbe25e926.

Signed-off-by: dongjiang1989 <dongjiang1989@126.com>

* change diff func

Signed-off-by: dongjiang1989 <dongjiang1989@126.com>

* dongjiang, update diff package

Signed-off-by: dongjiang1989 <dongjiang1989@126.com>

* update testutil

Signed-off-by: dongjiang1989 <dongjiang1989@126.com>

* Fix imports, goimports friendly

Signed-off-by: Kemal Akkoyun <kakkoyun@gmail.com>

---------

Signed-off-by: dongjiang1989 <dongjiang1989@126.com>
Signed-off-by: Kemal Akkoyun <kakkoyun@gmail.com>
Co-authored-by: Kemal Akkoyun <kakkoyun@gmail.com>
2024-04-22 06:49:49 +00:00
oftenoccur d038ab96c0
chore: fix function name in comment (#1497)
Signed-off-by: oftenoccur <ezc5@sina.com>
2024-04-11 14:53:09 +02:00
Arthur Silva Sens 0f500036fc
gocollector: Add regex option to allow collection of debug runtime metrics
Signed-off-by: Arthur Silva Sens <arthur.sens@coralogix.com>
2024-04-08 11:42:03 -03:00
Arthur Silva Sens ec6ba13cc3
chore: Refactor how base metrics are added to Sched metrics
Signed-off-by: Arthur Silva Sens <arthur.sens@coralogix.com>
2024-03-30 17:17:09 -03:00
Igor Drozdov 93cf5d4f5f
Implement Unwrap() for responseWriterDelegator (#1480)
If the ResponseWriter implements any of the following methods,
the ResponseController will call them as appropriate:

Flush()
FlushError() error // alternative Flush returning an error
Hijack() (net.Conn, *bufio.ReadWriter, error)
SetReadDeadline(deadline time.Time) error
SetWriteDeadline(deadline time.Time) error
EnableFullDuplex() error

If the ResponseWriter doesn't implement the methods,
the ResponseController will call Unwrap() method until it
finds a ResponseWriter in the chain

This commit implements Unwrap() method to simply return the
wrapped ResponseWriter

Signed-off-by: Igor Drozdov <ihardrozdov@gmail.com>
2024-03-28 14:42:34 +01:00
Sachin Sahu 50ab457fb7
Auto-update Go Collector Metrics for new Go versions (#1476)
* Autogenerate go_collector_<version>_test.go files

Signed-off-by: Sachin Sahu <75629410+SachinSahu431@users.noreply.github.com>

* Add latest Go version

Signed-off-by: Sachin Sahu <75629410+SachinSahu431@users.noreply.github.com>

* nit: Script to check new Go version

Signed-off-by: Sachin Sahu <75629410+SachinSahu431@users.noreply.github.com>

* Rename file, fix linting issue

Signed-off-by: Sachin Sahu <75629410+SachinSahu431@users.noreply.github.com>

---------

Signed-off-by: Sachin Sahu <75629410+SachinSahu431@users.noreply.github.com>
2024-03-26 12:42:34 +00:00
Hrishikesh Barman 25074625b7 Add LintDuplicateMetric to promlint
Signed-off-by: Hrishikesh Barman <hrishikeshbman@gmail.com>
2024-03-16 12:12:08 +00:00
foehammer127 cead7c3bb2
feat(prometheus/testutil/promlint/validations): refine lintMetricTypeInName
Change the lintMetricTypeInName linter inside promlint to only trigger an error when the metric name matches the type of the metric.

Signed-off-by: foehammer127 <foehammer@disroot.org>
2024-02-29 11:10:22 -06:00
Owen Williams 6d039205b8 deps: bump prometheus/common version
Fixes https://github.com/prometheus/client_golang/issues/1446

Signed-off-by: Owen Williams <owen.williams@grafana.com>
2024-02-23 13:28:17 -05:00
Arthur Silva Sens 353395b3b6
Remove support for go 1.19 (#1449)
* Remove support for go 1.19

Signed-off-by: Arthur Silva Sens <arthur.sens@coralogix.com>

* Replace rand.Seed, deprecated in go 1.20

Signed-off-by: Arthur Silva Sens <arthur.sens@coralogix.com>

---------

Signed-off-by: Arthur Silva Sens <arthur.sens@coralogix.com>
2024-02-23 18:59:23 +01:00
Max Riveiro c906a5e91a Add support for Go 1.22
Signed-off-by: Max Riveiro <kavu13@gmail.com>
2024-02-15 20:47:39 +03:00
Arthur Silva Sens 38631c665b
chore: Move VersionCollector to collectors directory (#1427)
* collectors/version: Move to collectors directory and remove unrelated code.

Signed-off-by: Arthur Silva Sens <arthur.sens@coralogix.com>

* examples: Add Version Collector example

Signed-off-by: Arthur Silva Sens <arthur.sens@coralogix.com>

---------

Signed-off-by: Arthur Silva Sens <arthur.sens@coralogix.com>
2024-01-15 10:07:52 +01:00
Billy Keyes 80d3f0b5b3
Normalize empty help values in CollectAndCompare (#1378)
Due to an inconsistency in the text protocol between encoding and
decoding, it was not possible to use the testutil.CollectAndCompare
function to test metrics with empty help values. To fix this, normalize
empty help values from the expected/want side of the test so that they
compare correctly with empty values on the actual/got side of the test.

Signed-off-by: Billy Keyes <bluekeyes@gmail.com>
2023-11-20 09:57:30 +00:00
Arthur Silva Sens 3f80cd1055
Add example of NewConstMetricWithCreatedTimestamp (#1375)
Signed-off-by: Arthur Silva Sens <arthur.sens@coralogix.com>
2023-11-20 09:56:35 +00:00
王卿 38794570f4
This way the import is more readable (#1383)
Signed-off-by: wangqing <wangqing@uniontech.com>
Co-authored-by: wangqing <wangqing@uniontech.com>
2023-11-20 09:55:08 +00:00
Björn Rabenstein cd8cba2ceb
histograms: Add timer to reset ASAP after bucket limiting has happened (#1367)
Fixes #1248. See issue description for all the details.

Signed-off-by: beorn7 <beorn@grafana.com>
2023-10-19 14:22:02 +01:00
João Vilaça 60a85133ed
Add support for custom validations in promlint (#1311)
* Refactor promlint validation structure

Signed-off-by: João Vilaça <jvilaca@redhat.com>

* Add support for custom validations in promlint

Signed-off-by: João Vilaça <jvilaca@redhat.com>

* Keep backwards compatibility

Signed-off-by: João Vilaça <jvilaca@redhat.com>

---------

Signed-off-by: João Vilaça <jvilaca@redhat.com>
2023-10-10 10:38:10 +01:00
Stephan Renatus 64e51f50df
proccess_collector: add wasip1 stub (#1350)
* proccess_collector: add wasip1 stub

This resolves build failures like this when using the wasip1 support:

    # github.com/prometheus/procfs
    ../../../go/pkg/mod/github.com/prometheus/procfs@v0.11.1/fs_statfs_type.go:25:18: undefined: syscall.Statfs_t
    ../../../go/pkg/mod/github.com/prometheus/procfs@v0.11.1/fs_statfs_type.go:26:17: undefined: syscall.Statfs

See https://go.dev/blog/wasi.

Signed-off-by: Stephan Renatus <stephan@styra.com>

* add build tags

Signed-off-by: Stephan Renatus <stephan@styra.com>

---------

Signed-off-by: Stephan Renatus <stephan@styra.com>
2023-10-10 09:46:36 +01:00
Oleg Zaytsev 005d8de006
Improve performance of WithLabelValues(...)
The slice with variadic arguments passed to MetricVec.WithLabelValues()
was escaping to heap. This change fixes that by performing a copy of the
slice before passing it to fmt.Errorf(), which is where the slice was
escaping. This keeps the hot path without that allocation.

Meaningful benchmark results (skipping ~0 CPU and 0 alloc ones):

                                                               │    old.txt    │               new.txt                │
                                                               │    sec/op     │    sec/op     vs base                │
Counter/With_Label_Values-16                                     108.00n ±  6%   58.06n ±  1%  -46.24% (p=0.000 n=10)
Counter/With_Label_Values_and_Constraint-16                       174.5n ± 15%   136.8n ±  6%  -21.63% (p=0.000 n=10)
Counter/With_triple_Label_Values-16                               309.3n ± 12%   172.9n ±  1%  -44.08% (p=0.000 n=10)
Counter/With_triple_Label_Values_and_Constraint-16                591.5n ± 11%   418.9n ±  3%  -29.17% (p=0.000 n=10)
Counter/With_repeated_Label_Values-16                             212.9n ± 10%   116.8n ± 23%  -45.16% (p=0.000 n=10)
Counter/With_repeated_Label_Values_and_Constraint-16              406.2n ± 14%   275.1n ±  4%  -32.30% (p=0.000 n=10)
CounterWithLabelValuesConcurrent-16                               85.45n ±  2%   89.09n ±  2%   +4.26% (p=0.003 n=10)

                                                               │    old.txt     │                  new.txt                  │
                                                               │      B/op      │     B/op      vs base                     │
Counter/With_Label_Values-16                                       48.00 ± 0%        0.00 ± 0%  -100.00% (p=0.000 n=10)
Counter/With_Label_Values_and_Constraint-16                        96.00 ± 0%       48.00 ± 0%   -50.00% (p=0.000 n=10)
Counter/With_triple_Label_Values-16                                144.0 ± 0%         0.0 ± 0%  -100.00% (p=0.000 n=10)
Counter/With_triple_Label_Values_and_Constraint-16                 288.0 ± 0%       144.0 ± 0%   -50.00% (p=0.000 n=10)
Counter/With_repeated_Label_Values-16                              96.00 ± 0%        0.00 ± 0%  -100.00% (p=0.000 n=10)
Counter/With_repeated_Label_Values_and_Constraint-16              192.00 ± 0%       96.00 ± 0%   -50.00% (p=0.000 n=10)
CounterWithLabelValuesConcurrent-16                                48.00 ± 0%        0.00 ± 0%  -100.00% (p=0.000 n=10)

                                                               │   old.txt    │                 new.txt                 │
                                                               │  allocs/op   │ allocs/op   vs base                     │
Counter/With_Label_Values-16                                     1.000 ± 0%     0.000 ± 0%  -100.00% (p=0.000 n=10)
Counter/With_Label_Values_and_Constraint-16                      2.000 ± 0%     1.000 ± 0%   -50.00% (p=0.000 n=10)
Counter/With_triple_Label_Values-16                              3.000 ± 0%     0.000 ± 0%  -100.00% (p=0.000 n=10)
Counter/With_triple_Label_Values_and_Constraint-16               6.000 ± 0%     3.000 ± 0%   -50.00% (p=0.000 n=10)
Counter/With_repeated_Label_Values-16                            2.000 ± 0%     0.000 ± 0%  -100.00% (p=0.000 n=10)
Counter/With_repeated_Label_Values_and_Constraint-16             4.000 ± 0%     2.000 ± 0%   -50.00% (p=0.000 n=10)
CounterWithLabelValuesConcurrent-16                              1.000 ± 0%     0.000 ± 0%  -100.00% (p=0.000 n=10)

Signed-off-by: Oleg Zaytsev <mail@olegzaytsev.com>
2023-10-04 18:09:15 +02:00
Oleksandr Redko 1bae6c1e63
Deprecated comment should begin with "Deprecated:" (#1347)
See https://go.dev/blog/godoc

Signed-off-by: Oleksandr Redko <Oleksandr_Redko@epam.com>
2023-09-21 12:31:45 +01:00
Oleksandr Redko bbab8fe770
Fix typos in comments, tests, and errors (#1346)
Signed-off-by: Oleksandr Redko <Oleksandr_Redko@epam.com>
2023-09-21 12:31:08 +01:00
Arthur Silva Sens df7fa49417
Extend Counters, Summaries and Histograms with creation timestamp (#1313)
* Extend Counters, Summaries and Histograms with creation timestamp

Signed-off-by: Arthur Silva Sens <arthur.sens@coralogix.com>

* Backport created timestamp to existing tests

Signed-off-by: Arthur Silva Sens <arthur.sens@coralogix.com>

* Last touches (readability and consistency)

Changes:

* Comments for "now" are more explicit and not inlined.
* populateMetrics is simpler and bit more efficient without timestamp to time to timestamp conversionts for more common code.
* Test consistency and simplicity - the fewer variables the better.
* Fixed inconsistency for v2 and MetricVec - let's pass opt.now consistently.
* We don't need TestCounterXXXTimestamp - we test CT in many other places already.
* Added more involved test for counter vectors with created timestamp.
* Refactored normalization for simplicity.
* Make histogram, summaries now consistent.
* Simplified histograms CT flow and implemented proper CT on reset.

TODO for next PRs:
* NewConstSummary and NewConstHistogram - ability to specify CTs there.

Signed-off-by: bwplotka <bwplotka@gmail.com>

* Update prometheus/counter_test.go

Co-authored-by: Arthur Silva Sens <arthursens2005@gmail.com>
Signed-off-by: Bartlomiej Plotka <bwplotka@gmail.com>

---------

Signed-off-by: Arthur Silva Sens <arthur.sens@coralogix.com>
Signed-off-by: bwplotka <bwplotka@gmail.com>
Signed-off-by: Bartlomiej Plotka <bwplotka@gmail.com>
Co-authored-by: bwplotka <bwplotka@gmail.com>
2023-09-21 10:46:54 +01:00
Oleksandr Redko 74cc26257c
Add go_godebug_non_default_behavior_tlsmaxrsasize_events_total (#1348)
Signed-off-by: Oleksandr Redko <Oleksandr_Redko@epam.com>
2023-09-21 10:46:14 +01:00
Bartlomiej Plotka 6f576e2c6f
histogram docs: Fixed minor nit. (#1324)
Signed-off-by: bwplotka <bwplotka@gmail.com>
2023-08-13 14:11:06 +01:00
Arthur Silva Sens 1a88780343
Bump prometheus/client_model (#1323)
By upgrading prometheus/client_model, several test functions had to be re-written due to 2 breaking changes made in protobuf when parsing messages to text:
1. '<' and '>' characters were replaced with '{' and '}' respectively.
2. The text format is non-deterministic. More information in https://github.com/golang/protobuf/issues/1121

Signed-off-by: Arthur Silva Sens <arthur.sens@coralogix.com>
2023-08-11 20:17:55 +01:00