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

Register featuregate, otherwise does not work #16269

Merged
merged 1 commit into from
Nov 11, 2022

Conversation

bogdandrutu
Copy link
Member

No description provided.

@bogdandrutu bogdandrutu requested a review from a team as a code owner November 11, 2022 16:44
@github-actions github-actions bot added the processor/spanmetrics Span Metrics processor label Nov 11, 2022
@bogdandrutu
Copy link
Member Author

bogdandrutu commented Nov 11, 2022

@Aneurysm9 @mx-psi @codeboten I expect that we enforce correct usages of the featuregate, see #8057. For me this is very worry that 3 leads (who are also on the core leads) missed this.

Update: may mean that the API is not well designed, but we need to investigate a bit this.

@djaglowski
Copy link
Member

may mean that the API is not well designed, but we need to investigate a bit this.

We almost want featuregate.GetRegistry().IsEnabled(id string) to panic if a gate is checked that is not registered, but there is risk that an unregistered gate is checked only in rare circumstances.

A minor improvement could have featuregate.GetRegistry().IsEnabled(id string) return an error as well as enabled.

There might be a solution that requires all feature gates to be resolved during collector startup. That way, we can panic/fail immediately without risk of rare circumstances. This probably means moving featuregate.GetRegistry() into an internal package and finding ways to provide controlled access at specific points in the code. For components, a factory option could act as the point of retrieval. Not sure about non-component packages in contrib though.

// component/processor.go
func WithFeatureGate(gateID string, callback(gateVal bool)) ProcessorFactoryOption {
	return processorFactoryOptionFunc(func(o *processorFactory) {
		enabled, err := featuregateinternal.GetRegistry().IsEnabled(gateID)
		if err != nil {
			o.unresolvedFeatureGateErr = err // fail gracefully later (or just panic now)
			return 
		}
		callback(enabled)
	})
}

// processor/myprocessor
type Config struct {
	myFeatureGate bool
}

func NewFactory() component.ProcessorFactory {
	cfg := createDefaultConfig
	return component.NewProcessorFactory(
		typeStr,
		cfg,
		component.WithTracesProcessor(createTracesProcessor, component.StabilityLevelStable),
		component.WithMetricsProcessor(createMetricsProcessor, component.StabilityLevelStable),
		component.WithLogsProcessor(createLogsProcessor, component.StabilityLevelStable)),
		component.WithFeatureGate("my.feature", func(gateVal bool) {
			cfg.myFeatureGate = gateVal
		})
}

@bogdandrutu
Copy link
Member Author

@djaglowski will post a PR with a proposal soon in core, I do have some ideas, and I like also what you suggested.

@bogdandrutu bogdandrutu merged commit 1750b99 into open-telemetry:main Nov 11, 2022
@bogdandrutu bogdandrutu deleted the fixunregistergate branch November 11, 2022 20:32
@codeboten
Copy link
Contributor

I'd missed that the unit test was not using the featuregate to turn on/off skipSanitizeLabel:

https://github.com/open-telemetry/opentelemetry-collector-contrib/pull/8057/files#diff-5a336e1c1dce702d5f77df0fbfc22adde8470d3521537ab9c38d7e2abc7f0d80R755

This should probably be a requirement of adding featuregates, that they be used in the unit tests.

mdelapenya added a commit to mdelapenya/opentelemetry-collector-contrib that referenced this pull request Nov 15, 2022
* main:
  [chore] dependabot updates Tue Nov 15 00:17:56 UTC 2022 (open-telemetry#16300)
  [receiver/rabbitmq] Fix flaky integration test (open-telemetry#16240)
  [Docker Stats Receiver] Add @jamesmoessis as code owner (open-telemetry#16253)
  [receiver/mongodbatlas] Alerts poll mode check hostname and port (open-telemetry#16286)
  [chore] update jaeger dep (open-telemetry#16287)
  [pkg/stanza] Fix issue where specifying a non-existent storage extension caused panic during shutdown. (open-telemetry#16213)
  [pkg/ottl] Rename ottllogs to ottllog (open-telemetry#16242)
  Register featuregate, otherwise does not work (open-telemetry#16269)
  [receiver/elasticsearch]: add fielddata memory size metrics on index level (open-telemetry#14922)
  [chore] remove what looks to be debugging code from instanaexporter (open-telemetry#16258)
MovieStoreGuy pushed a commit to atlassian-forks/opentelemetry-collector-contrib that referenced this pull request Nov 16, 2022
JaredTan95 pushed a commit to openinsight-proj/opentelemetry-collector-contrib that referenced this pull request Nov 21, 2022
JaredTan95 added a commit to openinsight-proj/opentelemetry-collector-contrib that referenced this pull request Nov 24, 2022
…d. (#7)

* [chore] remove what looks to be debugging code from instanaexporter (open-telemetry#16258)

Signed-off-by: Bogdan Drutu <[email protected]>

Signed-off-by: Bogdan Drutu <[email protected]>

* [receiver/elasticsearch]: add fielddata memory size metrics on index level (open-telemetry#14922)

feat: add fielddata memory size metrics on index level

* Register featuregate, otherwise does not work (open-telemetry#16269)

Signed-off-by: Bogdan Drutu <[email protected]>

Signed-off-by: Bogdan Drutu <[email protected]>

* [pkg/ottl] Rename ottllogs to ottllog (open-telemetry#16242)

* Rename ottllogs to ottllog

* add changelog entry

* fix lint

* [pkg/stanza] Fix issue where specifying a non-existent storage extension caused panic during shutdown. (open-telemetry#16213)

* [chore] update jaeger dep (open-telemetry#16287)

Moving dependency to version in main to move open-telemetry/opentelemetry-collector#6511 in core forward.

* [receiver/mongodbatlas] Alerts poll mode check hostname and port (open-telemetry#16286)

* check hostname and port before converting polled logs

* [Docker Stats Receiver] Add @jamesmoessis as code owner (open-telemetry#16253)

Adding @jamesmoessis as code owner of Docker Stats Receiver

* [receiver/rabbitmq] Fix flaky integration test (open-telemetry#16240)

This test fails periodially with a non-zero exit code returned from
the setup script. The likely cause is that the wait strategy was not
robust enough, in that the rabbitmqadmin command was not ready before
associated commands were run.

This fix incorporates the setup script into a custom wait strategy,
which allows the script to be rerun until it succeeds.

* [chore] dependabot updates Tue Nov 15 00:17:56 UTC 2022 (open-telemetry#16300)

dependabot updates Tue Nov 15 00:17:54 UTC 2022
Bump github.com/aerospike/aerospike-client-go/v6 from 6.4.0 to 6.6.0 in /receiver/aerospikereceiver
Bump github.com/aws/aws-sdk-go-v2/config from 1.17.10 to 1.18.0 in /extension/sigv4authextension
Bump go.mongodb.org/atlas from 0.18.0 to 0.19.0 in /receiver/mongodbatlasreceiver
Bump google.golang.org/api from 0.102.0 to 0.103.0 in /receiver/googlecloudspannerreceiver
Bump k8s.io/api from 0.25.3 to 0.25.4 in /processor/k8sattributesprocessor
Bump k8s.io/apimachinery from 0.25.3 to 0.25.4 in /internal/k8sconfig
Bump k8s.io/apimachinery from 0.25.3 to 0.25.4 in /processor/resourcedetectionprocessor
Bump k8s.io/client-go from 0.25.3 to 0.25.4 in /processor/k8sattributesprocessor

Co-authored-by: codeboten <[email protected]>

* [exporter/splunkhecexporter] close HTTP servers used during testing (open-telemetry#16305)

* [exporter/datadog] Bump Datadog Agent Go modules (open-telemetry#16294)

* fix: decouple mongoDB integration tests (open-telemetry#16306)

The container requests where using same fixed, exposed port, instead of
using the random one. In this commit we are calculating the exposed port
in the getContainer method, returning the endpoint for the container
in order to be used by each test

* [receiver/elasticsearch]: add segment memory metric on node level (open-telemetry#16172)

feat: add segments memory metric on node level

* [chore]: fix port feature gate's description in apachereceiver (open-telemetry#16280)

* fix: fix port feature gate's description

* remove changelog

* [operator/trace_parser] Example corrected - body changed to attributes (open-telemetry#16309)

Example corrected :- body changed to attributes

* chore: use testcontainers-go instead of containertest (open-telemetry#16264)

* chore: use testcontainers-go in zookeper receiver

* chore: use testcontainers-go in memcached receiver

* chore: use testcontainers-go in docker stats receiver

* chore: use testcontainers-go in aerospike receiver

* chore: use testcontainers-go in kafka metrics receiver

* chore: use testcontainers-go in docker observer extension

* [processor/transform] Allow specifying functions per context (open-telemetry#16251)

* Allow specifying functions per context

* [Receiver/redisreceiver] Support redis.cpu.time with more label values for Redis versions >= 6.0 (open-telemetry#14943)

Update Redis Receiver to Support CPU Metrics After 6.0

Add more state values to redis.cpu.time metrics to support sys_main_thread and user_main_thread cpu usage time.

* [chore] Don't use deprecated [Span|Trace]ID.HexString method (open-telemetry#16301)

The methods were deprecated since there is no establish convention on how to decode empty trace or span IDs at this point. The current method behavior is preserved in functions added in internal/coreinternal/traceutil. This commit updates all the usages of HexString where the result is used as identifier to the new internal methods.

* [exporter/tanzuobservability] Don't encode/decode TraceID as string (open-telemetry#16302)

Avoid unnecessary string encoding and decoding of trace ID. Create UUID from bytes directly

* [pkg/ottl] Commonize logic for handling slice and non-slice args (open-telemetry#16298)

* Commonize logic for handling slice and non-slice args

* Add PR number for issue reference

Co-authored-by: Evan Bradley <[email protected]>

* [chore] Delete changelog entry for a test change (open-telemetry#16318)

* [chore] Update collector core dependency (open-telemetry#16317)

1. In adoption to deprecation of [Span|Trace]ID.HexString method, this change includes migration to [Span|Trace]ID implementing fmt.Stringer interface for display purposes.
2. Adopt to service.State enum values renames

* chore: retire containertest (open-telemetry#16316)

It's not used anymore, in favor of testcontainers-go

* [chrony receiver] Fixing flake (open-telemetry#16323)

* [chore] [exporter/splunkhecexporter] make large_batch test less demanding (open-telemetry#16322)

Make flaky test less demanding, and add more checks to make sure the test actually tests a behavior of the exporter

* [exporter/splunkhecexporter] Do not log a warning on mapping empty metrics (open-telemetry#16324)

[exporter/splunkhecexporter] Do not log a warning on mapping empty metrics.

* [examples/demo] fix demo could not stat up (open-telemetry#16169)

* fix demo could not stat up

Signed-off-by: Jared Tan <[email protected]>

* remove unnecessary GOOS=linux

Signed-off-by: Jared Tan <[email protected]>

Signed-off-by: Jared Tan <[email protected]>

* [pkg/stanza] Support to Customize bufio.SplitFunc (open-telemetry#16272)

* add a new method BuildWithSplitFunc, this method can directly pass in a user-defined splitFunc

* [receiver/elasticsearch]: add query cache metrics on index level (open-telemetry#14873)

* feat: add query cache metrics on index level

* feat: add cache.size metric

* fix: remove cache name attribute from size metric

* [chore] Add 'goporto' and 'multimod-verify' to default make target (open-telemetry#16328)

Also adds prerequisite targets to a couple targets so they can be run
independently.

* Propose @evan-bradley as approver (open-telemetry#16329)

cc: @open-telemetry/collector-contrib-approvers

Signed-off-by: Alex Boten <[email protected]>

* [docs] [chore] Update Development stability links in the Readme headers (open-telemetry#16334)

* Propose @MovieStoreGuy as approver (open-telemetry#16330)

Signed-off-by: Bogdan Drutu <[email protected]>
Co-authored-by: Alex Boten <[email protected]>

* [chore] Disable flaky windows file rotation tests (open-telemetry#16332)

* [receiver/vcenter]Fix nil pointer exception when vcenter receiver collectVMs. (open-telemetry#16278)

Fix nil pointer exception when vcenter receiver collectVMs.

* [pkg/stanza] Fix serverity range unmarshaling (open-telemetry#16339)

This functionality was broken during refactoring of the unmarshaling logic.

Previously, various yaml types could be used to represent a severity level.
This was designed to be as open as possible to future implementations. However,
it is now clear that only some keys are valid anyways. Namely, string and ints
that represent OTel's native severity levels. Both strings and ints are now treated
as strings when unmarshaling, which is fully compatible with the sev map lookup code.

* [receiver/elasticsearch]: add document count metrics on index level (open-telemetry#14874)

feat: add document count metrics on index level

* [receiver/elasticsearch]: add cluster health metrics for two more shard types (open-telemetry#14875)

* feat: add cluster health metrics for two more shard types

* Add Cumulative Delta Include All Unit Tests (open-telemetry#16350)

* Upgrade core, fix usage of deprecated Config.Validate (open-telemetry#16362)


Signed-off-by: Bogdan Drutu <[email protected]>

* [kafka Exporter] refactor tests (open-telemetry#16265)

These tests needed a little love to make it easier to contribute to the
component

Co-authored-by: Alex Boten <[email protected]>

* [receiver/mongo] Fix flaky test TestScraperLifecycle (open-telemetry#16364)

by increasing the expected time to start and stop

* [chore] Add new approvers to remaining lists (open-telemetry#16367)

Add new approvers to remaining lists

Co-authored-by: Evan Bradley <[email protected]>

* [chore] Update autoassign.yaml with new approvers (open-telemetry#16360)

Update autoassign.yaml

* [processor/transform] Use proper context name in readme (open-telemetry#16351)

Use proper context name in readme

* [exporter/signalfxexporter] allow user to add their own CA to the cert pool (open-telemetry#16250)

Adding new feature to allow the user to add their own CA to the ingest and api client cert pool.
This is needed when the exporter is pointing to a TLS enabled signalfx receiver or/and TLS enabled http_forwarder
and the CA is not in the system cert pool (ex: agent <--> GW setup)

Signed-off-by: Dani Louca <[email protected]>
Co-authored-by: Dmitrii Anoshin <[email protected]>

* [receiver/elasticsearch]: add missing datapoints for operation count and operation time metrics (open-telemetry#16170)

* feat: add missing operation count datapoints with total aggregation

* feat: add missing operation count datapoints with primary shards aggregation

* feat: add missing operation time datapoints with total shard aggregation

* feat: add missing operation time datapoints with primary shards aggregations

* Update the jmx-metrics version to 1.20.0-alpha (open-telemetry#16356)

* Update the jmx-metrics version to

* Update add-jmx-metrics-gatherer-1.20.0-alpha.yaml

Co-authored-by: Alex Boten <[email protected]>

* [exporter/azuremonitor] Support span and exception events (open-telemetry#16354)

* [exporter/azuremonitor] Support span and exception events

Exception events flow to the AppInsights Exception table
Span events flow to the Traces table, when enabled.

* Add changelog entry

* Exporting span events is off by default

* [receiver/prometheusreceiver]: trim type and unit suffixes from metric name (open-telemetry#16071)

 Trim type's and unit's suffixes from metric name as per otel specs.

There was a lot of changes required to pass down a featuregate.Registry in order to be testable. The important bit in the receiver code path is the metricFamily.appendMetric which trims the suffixes when creating an OTLP metric.

Units suffixes will only take effect when using the OpenMetrics format, since the prometheus parser doesn't support units.

This is being guarded by the gate: --feature-gates=pkg.translator.prometheus.NormalizeName

* [pkg/ottl] Add support for setting maps in Values (open-telemetry#16352)

 Adds support for setting maps in Values. The primary impact is the ability for contexts to set maps as attribute values.

* Remove redundant dependency on Jaeger collector (open-telemetry#16370)

We used only one constant for error message from "github.com/jaegertracing/jaeger/cmd/collector/app/handler"

* [receiver/jaeger] Fix an error message in thrift HTTP message decoder (open-telemetry#16372)

Return full error instead of format string "Unable to process request body: %v"

* [chore] update more tests to bind to 127.0.0.1 (open-telemetry#16341)

Signed-off-by: Alex Boten <[email protected]>

Signed-off-by: Alex Boten <[email protected]>

* [chore]: rename files in filterprocessor, use RemoveIf once (open-telemetry#16376)

Signed-off-by: Bogdan Drutu <[email protected]>

Signed-off-by: Bogdan Drutu <[email protected]>

* enhancement servicegraph processor virtual node winthin edge.

Signed-off-by: Jared Tan <[email protected]>

* update peer virtual node.

Signed-off-by: Jared Tan <[email protected]>

* update the match attributes.

Signed-off-by: Jared Tan <[email protected]>

Signed-off-by: Bogdan Drutu <[email protected]>
Signed-off-by: Jared Tan <[email protected]>
Signed-off-by: Alex Boten <[email protected]>
Signed-off-by: Dani Louca <[email protected]>
Co-authored-by: Bogdan Drutu <[email protected]>
Co-authored-by: Adam Boguszewski <[email protected]>
Co-authored-by: Tyler Helmuth <[email protected]>
Co-authored-by: Daniel Jaglowski <[email protected]>
Co-authored-by: Alex Boten <[email protected]>
Co-authored-by: Keith Schmitt <[email protected]>
Co-authored-by: Sean Marciniak <[email protected]>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: codeboten <[email protected]>
Co-authored-by: Antoine Toulme <[email protected]>
Co-authored-by: Yang Song <[email protected]>
Co-authored-by: Manuel de la Peña <[email protected]>
Co-authored-by: Nityananda Gohain <[email protected]>
Co-authored-by: Andrew Tang <[email protected]>
Co-authored-by: Dmitrii Anoshin <[email protected]>
Co-authored-by: Evan Bradley <[email protected]>
Co-authored-by: Evan Bradley <[email protected]>
Co-authored-by: look <[email protected]>
Co-authored-by: wzy531a <[email protected]>
Co-authored-by: Seth L <[email protected]>
Co-authored-by: Alex Boten <[email protected]>
Co-authored-by: Dani Louca <[email protected]>
Co-authored-by: OpenTelemetry Bot <[email protected]>
Co-authored-by: Peter Wiese <[email protected]>
Co-authored-by: Gustavo Paiva <[email protected]>
shalper2 pushed a commit to shalper2/opentelemetry-collector-contrib that referenced this pull request Dec 6, 2022
@plantfansam plantfansam mentioned this pull request Jul 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
processor/spanmetrics Span Metrics processor
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants