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

Query language transform processor #1

Closed
wants to merge 176 commits into from
Closed

Conversation

anuraaga
Copy link
Owner

No description provided.

* In open-telemetry#6141 we had added the app runner origin, but forgot to add a unit test
* This PR makes such that segment.origin is OriginAppRunner when the correct attrs are set
@anuraaga
Copy link
Owner Author

2021/11/29

goos: darwin
goarch: amd64
pkg: github.com/open-telemetry/opentelemetry-collector-contrib/processor/transformprocessor
cpu: Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
BenchmarkNoProcessing
BenchmarkNoProcessing-12     	 1123015	      1055 ns/op
BenchmarkSetAttribute
BenchmarkSetAttribute-12     	 1000000	      1195 ns/op
BenchmarkKeepAttribute
BenchmarkKeepAttribute-12    	  920430	      1311 ns/op
BenchmarkSetStatusCode
BenchmarkSetStatusCode-12    	 1000000	      1205 ns/op
PASS

Comment on lines 63 to 64
span.Attributes().Clear()
val.(pdata.AttributeMap).CopyTo(span.Attributes())

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably you can make a request to offer a "MoveTo" for AttributeMap.

case int64:
attrs.InsertInt(key, val.(int64))
case string:
attrs.InsertString(key, val.(string))

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably "upsert".


import "go.opentelemetry.io/collector/model/pdata"

func process(td pdata.Traces, statements []statement) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would like to see how we can ensure that match/evaluate (evaluate is probably less important) deals with resource inputs as well. I am trying to avoid multiple evaluation of the resource attributes for spans from the same resource.

E.g. set status if span.name == "/healtz" and resource.attributes["service.name"] == "foo"

}
}

func parseTracesTelemetryPath(path string) TracesTelemetryPath {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be good to document the "grammar" to understand better what you are parsing. Also you may want to use the established terminology lexer/parser and split the code accordingly to simplify the understanding of the code.

zenmoto and others added 26 commits November 29, 2021 11:26
* move MongoDB Atlas receiver into components

* added receiver to receivers_test

* add changelog entry
…rocessing on Windows (open-telemetry#6145)

Fixed execution of commands in `prometheusexecreceiver` on Windows

**Link to tracking Issue:** Issue open-telemetry#6142
Bump github.com/DataDog/agent-payload/v5 from 5.0.2 to 5.0.3 in /exporter/datadogexporter
Bump github.com/DataDog/datadog-agent/pkg/quantile from 0.32.0 to 0.32.1 in /exporter/datadogexporter
Bump github.com/aliyun/aliyun-log-go-sdk from 0.1.24 to 0.1.27 in /exporter/alibabacloudlogserviceexporter
Bump github.com/aws/aws-sdk-go from 1.42.9 to 1.42.14 in /exporter/awsemfexporter
Bump github.com/aws/aws-sdk-go from 1.42.9 to 1.42.14 in /exporter/awskinesisexporter
Bump github.com/aws/aws-sdk-go from 1.42.9 to 1.42.14 in /exporter/awsprometheusremotewriteexporter
Bump github.com/aws/aws-sdk-go from 1.42.9 to 1.42.14 in /exporter/awsxrayexporter
Bump github.com/aws/aws-sdk-go from 1.42.9 to 1.42.14 in /exporter/datadogexporter
Bump github.com/aws/aws-sdk-go from 1.42.9 to 1.42.14 in /exporter/kafkaexporter
Bump github.com/aws/aws-sdk-go from 1.42.9 to 1.42.14 in /extension/observer/ecsobserver
Bump github.com/aws/aws-sdk-go from 1.42.9 to 1.42.14 in /internal/aws/awsutil
Bump github.com/aws/aws-sdk-go from 1.42.9 to 1.42.14 in /internal/aws/xray
Bump github.com/aws/aws-sdk-go from 1.42.9 to 1.42.14 in /internal/aws/xray/testdata/sampleapp
Bump github.com/aws/aws-sdk-go from 1.42.9 to 1.42.14 in /processor/resourcedetectionprocessor
Bump github.com/aws/aws-sdk-go from 1.42.9 to 1.42.14 in /receiver/awsxrayreceiver
Bump github.com/hashicorp/go-hclog from 0.16.2 to 1.0.0 in /exporter/logzioexporter
Bump github.com/influxdata/line-protocol/v2 from 2.2.0 to 2.2.1 in /receiver/influxdbreceiver
Bump github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common from 1.0.296 to 1.0.301 in /exporter/tencentcloudlogserviceexporter
Bump go.mongodb.org/atlas from 0.13.0 to 0.14.0 in /receiver/mongodbatlasreceiver
…lemetry#6369)

* refactor existing external labels test

* Add test for label_limit configuration

* shutdown mock prometheus http test server within testHelper

* fix spelling

* fix lint error

* rename testHelper to testMetricsReceiver

* fix: lint issue in metrics_receiver_helper_test.go

* Add Prometheus receiver test for honor_labels configuration

* update TestHonorLabelsFalseConfig to use testComponent
…on (open-telemetry#6430)

* Add Prometheus Receiver test for label_value_length_limit config

* rename target1 to targetLabelLimits1
…emetry#6409)

* Add Prometheus receiver test to run OpenMetrics test cases

* fix: resolved gosec lint issue

* fix error handling in getTestCase

* remove http requests in tests by copying openmetrics data into testdata

* only skip failing openmetrics tests using a deny-list
* Add setStatus operation for spanprocessor

* Change code to have text format instead of numeric and add another example

* Add "Unset" value and tests

* Update README for Unset value

* Apply suggestions from code review

Co-authored-by: Pablo Baeyens <pbaeyens31+github@gmail.com>

* From review: Move statuses names to constants and fix "Err" => "Error"

* Code review: fixing style

* One more "Err" and fixing comment(s) as suggested from review

* Clear status description for cases different than error

Co-authored-by: Pablo Baeyens <pbaeyens31+github@gmail.com>
* processor/spanprocessor: fix attribute assignment in test

Signed-off-by: Anthony J Mirabella <a9@aneurysm9.com>

* receiver/prometheus: fix metric label tests

Signed-off-by: Anthony J Mirabella <a9@aneurysm9.com>

* receiver/prometheus: remove unused parameter from test helper

Signed-off-by: Anthony J Mirabella <a9@aneurysm9.com>

* make porto

Signed-off-by: Anthony J Mirabella <a9@aneurysm9.com>
* Add postgresql receiver config and factory

* Address linter issues

* Fix issues with sample config

* Add makefile and go mods to postgresql

* Add postgresql receiver scraper

* Fix linting issues

* Add licenses

* Add license to receiver

* Update receiver/postgresqlreceiver/README.md

Co-authored-by: Daniel Jaglowski <dan.jaglowski@bluemedora.com>

* Refactor postgres config

* Update codeowners

* Update documentation

* Update receiver/postgresqlreceiver/testdata/config.yaml

Co-authored-by: Daniel Jaglowski <dan.jaglowski@bluemedora.com>

* Default databases config to empty slice rather than nil

* Refactor config tests to utilize default config

* initialize metadata to allow lint task to pass

* Update labels to attributes in metadata

* regenerate generated files

* Resolve missing factory implementation in postgres receiver

* Clean up postgres metadata generation

* Fix multimod verify

* Nest TLS settings under 'tls'

* refactor to use new config format

* Update expected metrics for test to be indented, remove anon function in client

* Resolve PR feedback by changing mocks to use mock.Mock

* Update lib pq dependency

* respond to PR feedback

* PR feedback to support partial errors and a few other points

* Respond to PR feedback

* Fix linter

* Update receiver/postgresqlreceiver/scraper.go

Co-authored-by: Daniel Jaglowski <dan.jaglowski@bluemedora.com>

* More PR feedback

* Simplify use of errors.AddPartial

* Fix linter issue

* Fix fix to linter issues

Co-authored-by: Daniel Jaglowski <dan.jaglowski@bluemedora.com>
…lemetry#6463)

To simplify the logic and make it simpler for users to read what properties are accepted for specific types.
This removes the dependency on the older gopsutil library.
…emetry#6385)

* [tanzuobservability exporter] Add consumer for sum metrics.

* Function headers to be more readable.

pushGaugeSingleNumberDataPoint->pushGaugeNumberDataPoint
pushSingleNumberDataPoint->pushNumberDataPoint

* Break verifySumConsumer into four separate tests.

* Minor changes to tests.
Fix minor inconsistencies and update the schema according to the latest changes
…ccessed (open-telemetry#6103)

* filestorageextension: fix panic when configured directory cannot be accessed

* filestorageextension: move validation to config.Validate()
* fix exemplars support

Signed-off-by: Anne-Elisabeth Lelièvre <anne-elisabeth.lelievre@ubisoft.com>

* switch test logger from zap.Nop to zaptest.

Signed-off-by: Anne-Elisabeth Lelièvre <anne-elisabeth.lelievre@ubisoft.com>

* fix lint error

Signed-off-by: Anne-Elisabeth Lelièvre <anne-elisabeth.lelievre@ubisoft.com>
dmitryax and others added 23 commits December 20, 2021 10:51
"enabled" field is being used in the new scraper metrics builder. Adding this field in all metadata.yaml files to enable validation
This check ensures the label "skip changelog" has been applied or that the changelog has been updated. This follows the same pattern as the opentelemetry-go and opentelemetry-python SIGs.
The new scrapertest package provides a clearer and more traceable
mechanism for defining expected metric results. This refactors the
existing scraper tests into the scrapertest pattern, without
making any other changes.
Need to re-generate metrics builder due to some out of order commits
…#6918)

The mdatagen tool and metrics builder can be used in any other components added to other distributions. It doesn't have to always go with this header
Bump github.com/ReneKroon/ttlcache/v2 from 2.10.0 to 2.11.0 in /receiver/googlecloudspannerreceiver
Bump github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common from 1.0.311 to 1.0.316 in /exporter/tencentcloudlogserviceexporter
Bump github.com/DataDog/agent-payload/v5 from 5.0.5 to 5.0.7 in /exporter/datadogexporter
Bump github.com/DataDog/datadog-agent/pkg/quantile from 0.32.2 to 0.32.3 in /exporter/datadogexporter
…ng (open-telemetry#6718)

* [prometheusremotewriteexporter] Add the possibility to disable queuing

A new configuration key, `remote_write queue.enabled` is added, which
controls the queue enabling.

* [exporter/awsprometheusremotewriteexporter] Fix config unit tests.

Update the expected prometheusremotewriteexporter default config.
* [exporter/parquet] initial implementation

* code review

* Add struct tags
open-telemetry#6670)

* [exporter/datadogexporter] Make hostname empty on AWS ECS Fargate

* Revert "[exporter/datadog] Always add current hostname (open-telemetry#5967)"

This reverts commit 247420a.

We can't always add the current hostname *and* not expose the hostname in Fargate.

* [exporter/datadogexporter] Add `task_arn` instead of a hostname for running metrics

We do this because of two reasons:
1. we don't want to expose the Fargate hostname and
2. users care about identifying where their Collector is running (in this case which task).

* Address review comment

* Add changelog note
Fixes open-telemetry#6927

Signed-off-by: Juraci Paixão Kröhling <juraci@kroehling.de>
* Add integration test

* Update Changelog

* Add to test modules
These changes adopt the new k8s.node endpoint type in the k8s_observer
and provide new config fields `observe_nodes` and `observe_pods` to
toggle desired Endpoint type discovery. The existing `node` config
field is no longer mandatory and missing values will result in all
available nodes and pods in being reported.

They do not include adoption in the receiver creator, as that will be
addressed in a subsequent PR.
* make update-otel

* remove InMemory configmapprovider

* remove interceptors. will implement Authenticate next

* Remove interceptor tests from oidc extension

Co-authored-by: Juraci Paixão Kröhling <juraci@kroehling.de>
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
* Removal of references to default components

* fixed import spacing

* added inline components to main

* fixed import issues

* Rename test_components.go to components.go

* fixed lint for import

Co-authored-by: Bogdan Drutu <lazy@splunk.com>
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
* Ensure all exporters are added to lifecycle test

In order to help test coverage up and ensuring that all components are
tested, I have added what I could to the lifecycle tests for exporters
while adding two additional helps within test util.

* Adding message to check to highlight what needs to be done

* Fixing typo
* feat(http-tracegen): optinal gen traces with http exporter

* fix(resolve-coflicts)

* fix(mod-tidy)

* fix(cr)

* fix(cr2)
@anuraaga anuraaga force-pushed the processor-expressions branch from c567d2e to 215fb1e Compare December 28, 2021 07:34
@anuraaga anuraaga force-pushed the processor-expressions branch from 215fb1e to 8abe72b Compare December 28, 2021 07:37
@anuraaga anuraaga changed the title WIP Query language transform processor Query language transform processor Dec 28, 2021
@anuraaga anuraaga closed this Dec 28, 2021
@anuraaga
Copy link
Owner Author

Continued in #2

anuraaga pushed a commit that referenced this pull request Jun 17, 2022
…y#9224)

* add vcenter vSAN collection

* checkpoint on getting property collection working

* checkpoint before integration test

* dual receivers under root receiver pointer

* checkpoint before updated mdatagen

* use syslog receiver rather than tcplogreceiver

* getting more performance counter refinements

* remove unneccessary component addition

* try to fix go.mod resolution issues

* try to fix go.mod resolution issues pt 2

* addlicense

* fix go.mod by fixing require directive

* add readme for metrics

* update readme

* fix go.mod referring nonexistent version

* add performance manager tests

* more tests

* add more attributes to virtual machines and host systems

* add more attributes to virtual machines and host systems

* spike changelog entry

* fix go.mod in both places

* fix go.mod in configschema

* add // import github.com/open-telemetry/opentelemetry-collector-contrib/receiver/vmwarevcenterreceiver to imports

* add quotations

* add to receiver lifecycle

* remove extra go generate direction

* fix typo of utilizaiton in metric description

* small changes to interval id in performance queries to be more consistent

* PR feedback including omitting company name prefix

* PR feedback to not fail starting the component on potential network failures

* minor grammar correction in vcenter readme

* update expected metrics

* update host_effective attribute value

* remove PerformanceInterval customizability

* add to codeowners

* fix indentation on merge conflict

* fix changelog entry place so its in the new components section

* update to be on 0.49.0 of the collector'

* add PR number to changelog

* regenerate with newer version of mdatagen

* move error log if unable to connect on start to receiver.Start() rather than scraper.Start()

* fix test cases from last commit

* minor update to config with tests

* fix metric description

* use utc for host vsan collection as well

* update comments of public facing methods

* return errors on getting clusters to the scraper errors

* PR feedback #1

* instantiate new client if client is nil

* update all descriptions to have punctuation

* three more descs

* move ensureReceiver up to once we validated as a config

* some more PR feedback

* looking into race conditions

* run go tidy

* fix import order and remove unneccessary mutex

* remove mutex from struct

* refactor client to responsible for knowing if the vsan endpoints are reachable

* fix integration test referencing old var

* change metrics.metrics => metrics.settings, update client pr feedback

* remove vSAN collection temporarily

* remove extra metric attributes for vSAN

* remove vsan specific variables

* clean up host PerfCounter disk latency metrics and fix some descriptions to better reflect interval

* add 20s interval to extended documentation as needed

* mdatagen fixes

* add integration test metric scrape

* fix import order

* go up to 0.49.1

* gotidy

* add replace directive for semconv

* gotidy fixes

* fix component not being on 0.50.0

* update to v0.50.1-0.20220429151328-041f39835df7

* use newer mdatagen

* remove any logging functionality change && update documentation

* fix integration test from flattening of config

* fix scraper start not erroring if connection cannot be established

* make scrapertest less flaky

* format test json

* Apply suggestions from code review

Co-authored-by: Daniel Jaglowski <jaglows3@gmail.com>

* adjust metric definition for vcenter.host.disk.throughput

* remove comment and move pm level 2 metrics to appropriate section

* try to be respective of datacenters

* fix only vCenter server functionality

* try building out a mock server for test coverage

* make goporto

* fix build issues

* use latest mdatagen

* add newlines to ends of xml recordings

* fix integration test

* moved around scrapererrors because now the receiver is datacenter dependent

* try and do an audit of performance metrics and requests/responses

* update testdata with correct units

* make tidy

* make tidy

* update collector version

* fix local testing code including modules

* remove deprecated use of commonponenterror

* pr feedback; add method of collection recording, return poweredOn/poweredOff VMs

* remove content.json

* fix description change in scraper_test.go

* update collector version

* bump replaced module; rebuild load tests

* fix alibaba version auto localizing

Co-authored-by: Daniel Jaglowski <jaglows3@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.