Commit Graph

55 Commits

Author SHA1 Message Date
Bogdan Drutu bb193a24d0
Deprecate New[JSON|Proto][Marshaler|Unmarshale], expose the structs (#6340)
The main motivation is because we want to be able to extend these Marshaler/Unmarshaler implementation with possible options.

Because of that we have 2 options: 1. add Option to each New func, OR 2. expose the structs so that later users can configure different options inside these structs, similar with `jsonpb.Marshaler`.

I implemented the version 2 since it is simpler, and less code, and also common in the industry.

Signed-off-by: Bogdan <bogdandrutu@gmail.com>

Signed-off-by: Bogdan <bogdandrutu@gmail.com>
2022-10-18 15:29:37 -07:00
Dmitrii Anoshin 7740c7b387
Remove usages of deprecated pdata Clone methods (#6170) 2022-09-28 18:25:22 -07:00
Corbin Phelps f0d69d6822
[processor/batch] Removed casts to Sizer interface in batch processor (#5937)
* Removed casts to Sizer interface in batch processor

Signed-off-by: Corbin Phelps <corbin.phelps@bluemedora.com>

* Added changelog entry

Signed-off-by: Corbin Phelps <corbin.phelps@bluemedora.com>

* removed changelog

Signed-off-by: Corbin Phelps <corbin.phelps@bluemedora.com>

Signed-off-by: Corbin Phelps <corbin.phelps@bluemedora.com>
2022-08-19 09:31:09 -07:00
Bogdan Drutu 1a4361c49a
Remove unnecessary and unused testdata (#5599)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2022-06-27 09:43:33 -07:00
Nathan Vērzemnieks 65b7b1be5d
Send correct batch stats when SendBatchMaxSize is set (#5385)
The stat was getting sent before the max batch size was
taken into account.
2022-06-02 14:18:07 -07:00
Dmitrii Anoshin 734e25e8de
Split `model` by signal type and move it to the new `pdata` module (#5168)
Split all `pdata` related code by type and move it from `model` to the new module `pdata`.

- `model/pdata` and `model/otlp` are moved to `pdata/plog`, `pdata/pmetric` and `pdata/ptrace`.
- `model/otlpgrpc` is moved to `pdata/plogotlp`, `pdata/pmetricotlp` and `pdata/ptraceotlp`.

Now all the API in `model` except for `model/semconv` is deprecated.
2022-04-11 16:00:26 -07:00
Alex Boten 1d5fdd1c1f
Deprecation of pdata methods following OTLP v0.15.0 (#5076)
* Deprecation of pdata methods following OTLP v0.15.0

Adding deprecation methods for the following pdata methods:
  - InstrumentationLibrary is now Scope
  - InstrumentationLibrarySpans is now ScopeSpans
  - InstrumentationLibraryLogs is now ScopeLogs
  - InstrumentationLibraryMetrics is now ScopeMetrics

* update changelog

* add deprecated method on resource spans/metrics/logs

* add InstrumentationLibrary deprecation method
2022-03-28 00:32:48 -07:00
Tigran Najaryan 18fb01178b
Remove usage of LogRecord.Name field (#4804)
The LogRecord Name field [is removed](https://github.com/open-telemetry/opentelemetry-specification/pull/2271) from the specification and is [going to be removed](https://github.com/open-telemetry/opentelemetry-proto/pull/357) from the OTLP.
2022-02-08 08:56:16 -08:00
Tigran Najaryan 5ee1fec9fe
Update to OTLP proto 0.12.0 (#4724)
- Removed all deprecated metric messages and corresponding conversion code and tests.
- Removed deprecated_code from span status and corresponding conversions and tests.
- Renamed logs field to log_records in InstrumentationLibraryLogs message.
2022-01-26 10:35:15 -08:00
Pablo Baeyens a8ff2dd98c
Enable `errcheck` linter (#4462)
* Check or explicitly ignore all errors

* Enable errcheck

* Use `t.Cleanup` instead of `defer`

* Point to issue on `Set` ignored error
2021-11-23 12:27:32 -08:00
Alex Boten 9cdb1da1c4
[test] fixing flaky TestBatchMetricsProcessor_Timeout (#4339)
The batch size was 100 and the number of datapoints being generated was also 100 so at times, the batch processor would be sending the data before the timeout was reached, which is what this particular test is trying to test. To fix this, I'm increasing the batch send size to 101.
2021-11-02 09:41:32 -07:00
James 85b8094e26
Rename `config.NewID` to `config.NewComponentID` and `config.NewIDFromString` to `config.NewComponentIDFromString` (#4137)
This PR is to rename `config.NewID` to `config.NewComponentID` and `config.NewIDFromString` to `config.NewComponentIDFromString` for naming consistency.  

**Link to tracking Issue:** 
Fixes #4105
2021-09-29 10:28:07 -04:00
Nathan Dias aa450a0bf2
all: remove OtlpProtoSize in favor of Sizer interface (#3818)
* all: remove OtlpProtoSize in favor of Sizer interface

* add {Metrics|Traces|Logs}Sizer, fix test commenting

* move size tests to pb_test, fix metrics+logs parameter names

* uncommented batch_processor tests + adjusted them to use *Sizer

* I forgot BenchmarkTraceSizeBytes :(

* Add docs for NewProtobof*Sizer + update docs for NewProtobuf*Marshaler

* cast *Marshaler to *Sizer for now

* add casts to batch_processor_test
2021-08-17 11:10:33 -07:00
Bogdan Drutu 5544267e7d
Change MetricsSink to count data points not metrics (#3549)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2021-07-02 09:29:41 -07:00
Bogdan Drutu 32c2d0f131
Change LogRecordsCount to LogRecordCount everywhere (#3551)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2021-07-01 17:07:14 -07:00
Bogdan Drutu 9a7bccea3e
Change SpansCount to SpanCount everywhere (#3550)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2021-07-01 16:57:42 -07:00
Bogdan Drutu c63d0c68cd
Move pdata in the new package (#3483)
The new module go.opentelemetry.io/collector/model will be created later when the internal data will
also be moved.

Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2021-06-25 01:17:31 +03:00
Bogdan Drutu e2929a9b2e
Add componenttest.NewNop*CreateSettings to simplify tests (#3375)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2021-06-08 10:49:35 -04:00
kisieland 6d44f0d303
Make the batch processor limit data points rather than metrics. (#3141)
**Link to tracking Issue:** #2754

This change introduces a BenchmarkBatchMetricProcessor that stress tests batching logic.
Results before:
`BenchmarkBatchMetricProcessor-12           20000             80614 ns/op`
Results after the change:
`BenchmarkBatchMetricProcessor-12           20000             96184 ns/op`
2021-06-02 10:52:24 -04:00
Patryk Matyjasek 017aa1dad7
Standarize Settings, Params and Parameters in Processors (#3181)
* Replace ProcessorCreateParams with ProcessorCreateSettings.
Replace all dependencies in Processors.

Signed-off-by: Patryk Matyjasek <pmatyjasek@sumologic.com>

* Update changelog

Signed-off-by: Patryk Matyjasek <pmatyjasek@sumologic.com>

# Conflicts:
#	CHANGELOG.md

# Conflicts:
#	CHANGELOG.md

Co-authored-by: Bogdan Drutu <bogdandrutu@gmail.com>
2021-06-02 06:49:04 -07:00
Bogdan Drutu 2d48457b64
Rename [Trace|Log]Data to Traces|Logs in internal package testdata (#3205)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2021-05-17 15:01:33 -07:00
Bogdan Drutu 8fed8a6070
Remove testdata GetEmpty for all signals (#3202)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2021-05-17 11:58:50 -07:00
Bogdan Drutu 665e9657ac
Use config.ID for Processors config (#3077)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2021-05-03 14:46:10 -07:00
Bogdan Drutu 9df19a1b45
Fix batchprocessor to avoid reordering and send max size (#3029)
* The reordering could happen if during processing of an item other items were added to the newItems channel. This is fixed by avoiding to re-add the left items to the channel.
* The logic of spliting was wrong by forcing sendBatchSize instead of sendBatchMaxSize when split was called.
* Fix logic if a very large message is received > 2x sendBatchMaxSize to call export multiple times instead of once and reset the timer.

Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2021-04-26 16:01:08 -07:00
Bogdan Drutu 25da8cfb98
Small cleanups in batchprocessor (#3013)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2021-04-26 13:52:33 -07:00
Pablo Baeyens 9b382e6cbf
Error checking on unit tests (#2959)
* Error checking on unit tests

* Add back license text

* Retrigger CI

* Wrap defer calls with `func`
Arguments are evaluated immediately on defer calls

* Update config/configauth/oidc_server_test.go

* Use t.Cleanup

* Change ioutil.ReadAll by resp.Body.Close()

* Retrigger CI (flaky tests)
2021-04-20 10:32:48 -07:00
Bogdan Drutu 1edaf40ced
Add New funcs for extension, exporter, processor config settings (#2872)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2021-03-31 16:50:05 -07:00
Bogdan Drutu 94a6cdde67
Rename pdata Size to OtlpProtoSize, fix some other comments (#2726)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2021-03-19 14:30:25 -04:00
Bogdan Drutu 85804ff257
Rename pdata.Logs.SizeBytes to Size, consistent with metrics/traces (#2694)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2021-03-17 15:21:25 -07:00
Tigran Najaryan 0961efb54f
Fix Shutdown behavior for batchprocessor (#2537)
I added a Shutdown() test that does basic verification of the behavior of the
Shutdown() function. More verifications can be added later.

The test revealed a bug in batchprocessor Shutdown() function which would
not wait until all pending data was drained.
2021-03-02 13:43:58 -05:00
Bogdan Drutu f4f68db25d
Expose non-nullable elements from slices of pointers (#2200)
Currently for slices of pointers, pdata exposes elements that are pointers to the pointer in the slice (double pointers in the internal implementation). Because of this users have to deal with possible nil values, have to initialize elements (in some cases) etc, but in reality the elements in the slice cannot be nil, so this just adds extra unnecessary complexity. This is possible because:

* Gogo proto (and protobuf) will not unmarshal any nil element in a slice;
* Our APIs to add elements/remove elements from the slice will guarantee that we never have a nil element in the slice between [0, len-1];

This is an important change because will allow us to change the internal representation (use slice of pointers or non-pointers) without affecting the public API.

Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2020-12-01 10:50:19 -08:00
Bogdan Drutu cb6014387d
Move testdata up one level, no point in being data/testdata (#2198)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2020-11-24 11:53:36 -08:00
Bogdan Drutu e695e15f94
Remove level from all the MetricViews calls (#2149)
This is a preparation for enabling per component telemetry level:
* Views are global and they must always be installed; they are no-op if nobody records data;
* Views are global and they must always contain all the labels; In case of measurements being recorded without one of the labels (for perfomance reasons)
  the extra label defined does not have impact, because all the timeseries will have that label as "null" (missing).

Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2020-11-16 23:11:27 -05:00
Bogdan Drutu d322a4161b
Remove legacy metrics, they were marked as legacy for ~12 months (#2105)
* Remove legacy metrics, they were marked as legacy for ~12 months

Fixes https://github.com/open-telemetry/opentelemetry-collector/issues/1082

This PR removes:
- Legacy receiver/exporter metrics:
  - otelcol/receiver/received_spans
  - otelcol/receiver/dropped_spans
  - otelcol/receiver/received_timeseries
  - otelcol/receiver/dropped_timeseries
  - otelcol/exporter/received_spans
  - otelcol/exporter/dropped_spans
  - otelcol/exporter/received_timeseries
  - otelcol/exporter/dropped_timeseries
  - otelcol/exporter/received_logs
  - otelcol/exporter/dropped_logs
- For processors remove the legacy metrics (new metrics have the same data, different names):
  - e.g. "spans_dropped" -> "processor/spans_dropped"
  - e.g. "batch_send_size_bytes" -> "processor/batch/batch_send_size_bytes"

All the new metrics were enabled when using the --new-metrics flag. The PR also removes two flags:
- "--new-metrics"
- "--legacy-metrics"
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>

* Update changelog

Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>

* Fix comments from review

Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2020-11-10 13:32:27 -08:00
Bogdan Drutu ba96d13eaa
Deprecate SinkExporter, add SinkConsumer (#1973)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2020-10-19 18:26:53 -07:00
Bogdan Drutu e7e6693926
Expose telemetry level in the configtelemetry (#1796)
Next PR will add a config setting that can be embedded in every component config.

Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2020-09-18 16:11:27 -07:00
Bogdan Drutu d119b89225
Move the metrics definition to pdata. Remove internal/data definition (#1720)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2020-09-03 12:18:32 -07:00
Ben Keith 889948e2fa
Batch Processor: Log Support (#1723)
This mimics the same logic as metrics for logs in the batchprocessor.
2020-09-02 18:33:26 -04:00
Bogdan Drutu e9d67ce381
Change batch processor to use the new internal metrics structs (#1699)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2020-08-31 15:33:52 -07:00
Bogdan Drutu 2a54e941a4
Move more old internal structs to old files, and rename funcs with Old (#1662)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2020-08-27 21:53:55 -07:00
Bogdan Drutu 42ac0eeafc
Move previous internal metrics package to dataold (#1658)
Need to re-generate the new internal metrics, but it is too much code to change,
so will move this to dataold (was internal anyway, so no public breaking change).

Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2020-08-27 20:19:39 -07:00
Jay Camp 1e65674799
Update copyright (#1597)
* Update copyright

* rebase
2020-08-19 18:25:44 -07:00
Pavol Loffay 815e760588
Add batch size bytes metric to batch processor (#1270)
* Add batch size bytes metrics

Signed-off-by: Pavol Loffay <ploffay@redhat.com>

* increase test coverage

Signed-off-by: Pavol Loffay <ploffay@redhat.com>

* Fix metrics

Signed-off-by: Pavol Loffay <ploffay@redhat.com>

* Fix test

Signed-off-by: Pavol Loffay <ploffay@redhat.com>

Co-authored-by: Bogdan Drutu <bogdandrutu@gmail.com>
2020-07-22 11:14:25 -07:00
Pavol Loffay 5c7db8cce7
Fix overflowing batch size (#1310)
* Fix overflowing batch size

Signed-off-by: Pavol Loffay <ploffay@redhat.com>

* Use max size

Signed-off-by: Pavol Loffay <ploffay@redhat.com>
2020-07-14 08:04:37 -07:00
Bogdan Drutu 0c7de066d7
Add helper processor factory to reduce boilerplate (#1339)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2020-07-13 21:50:01 -07:00
Bogdan Drutu 29cd959efc
Set batch processor channel size to num cpus, use exporter sink (#1330)
Fixes #1070

Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2020-07-13 12:36:02 -07:00
Bogdan Drutu f3608576be
Cleanup batch processor, remove duplicate code and logic (#1323)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2020-07-12 08:07:00 -07:00
Bogdan Drutu aa67926c69
Move issuegenerator to cmd so go mod tidy resolves dependencies (#1284)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2020-07-07 20:00:17 -07:00
Pavol Loffay 97d9d86c88
Add batch size metric (#1241)
* Add batch size metric to otel collector

Signed-off-by: Pavol Loffay <ploffay@redhat.com>

* Rename variable

Signed-off-by: Pavol Loffay <ploffay@redhat.com>
2020-07-07 16:30:22 -07:00
Constance Caramanolis ce04b86e91
Unblock prs with modified shutdown test (#1071)
The order in which Consume* and Shutdown get handled for batch processor is inconsistent when called back to back. This results in the number of items getting passed through to be inconsistent. To unblock tests and maintain coverage, the tests only check if some data got through and the batching size is 1. 

Issue #1070 has been opened to properly fix the test and ensure the total number of items sent is accounted for after shutdown has been invoked.

**Link to tracking Issue:** Fixes issue #1066 and #1069 

**Testing:** Run each of the test 100 times and no test failures.
2020-06-03 13:02:32 -04:00