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

[chore] Even more one-off fixes for component.Type changes #31135

Merged
merged 1 commit into from
Feb 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions connector/servicegraphconnector/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ import (
)

const (
// The value of "type" key in configuration.
typeStr = "servicegraph"
// The stability level of the processor.
connectorStability = component.StabilityLevelDevelopment
virtualNodeFeatureGateID = "connector.servicegraph.virtualNode"
Expand Down Expand Up @@ -54,7 +52,7 @@ func init() {
// NewFactory returns a ConnectorFactory.
func NewFactory() connector.Factory {
return connector.NewFactory(
typeStr,
metadata.Type,
createDefaultConfig,
connector.WithTracesToMetrics(createTracesToMetricsConnector, metadata.TracesToMetricsStability),
)
Expand Down
2 changes: 1 addition & 1 deletion exporter/awsxrayexporter/awsxray.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func newTracesExporter(
cn awsutil.ConnAttr,
registry telemetry.Registry,
) (exporter.Traces, error) {
typeLog := zap.String("type", string(set.ID.Type()))
typeLog := zap.String("type", set.ID.Type().String())
nameLog := zap.String("name", set.ID.String())
logger := set.Logger
awsConfig, session, err := awsutil.GetAWSConfigSession(logger, cn, &cfg.AWSSessionSettings)
Expand Down
16 changes: 8 additions & 8 deletions processor/groupbytraceprocessor/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,50 +27,50 @@ var (
func metricViews() []*view.View {
return []*view.View{
{
Name: processorhelper.BuildCustomMetricName(string(metadata.Type), mNumTracesConf.Name()),
Name: processorhelper.BuildCustomMetricName(metadata.Type.String(), mNumTracesConf.Name()),
Measure: mNumTracesConf,
Description: mNumTracesConf.Description(),
Aggregation: view.LastValue(),
},
{
Name: processorhelper.BuildCustomMetricName(string(metadata.Type), mNumEventsInQueue.Name()),
Name: processorhelper.BuildCustomMetricName(metadata.Type.String(), mNumEventsInQueue.Name()),
Measure: mNumEventsInQueue,
Description: mNumEventsInQueue.Description(),
Aggregation: view.LastValue(),
},
{
Name: processorhelper.BuildCustomMetricName(string(metadata.Type), mNumTracesInMemory.Name()),
Name: processorhelper.BuildCustomMetricName(metadata.Type.String(), mNumTracesInMemory.Name()),
Measure: mNumTracesInMemory,
Description: mNumTracesInMemory.Description(),
Aggregation: view.LastValue(),
},
{
Name: processorhelper.BuildCustomMetricName(string(metadata.Type), mTracesEvicted.Name()),
Name: processorhelper.BuildCustomMetricName(metadata.Type.String(), mTracesEvicted.Name()),
Measure: mTracesEvicted,
Description: mTracesEvicted.Description(),
// sum allows us to start from 0, count will only show up if there's at least one eviction, which might take a while to happen (if ever!)
Aggregation: view.Sum(),
},
{
Name: processorhelper.BuildCustomMetricName(string(metadata.Type), mReleasedSpans.Name()),
Name: processorhelper.BuildCustomMetricName(metadata.Type.String(), mReleasedSpans.Name()),
Measure: mReleasedSpans,
Description: mReleasedSpans.Description(),
Aggregation: view.Sum(),
},
{
Name: processorhelper.BuildCustomMetricName(string(metadata.Type), mReleasedTraces.Name()),
Name: processorhelper.BuildCustomMetricName(metadata.Type.String(), mReleasedTraces.Name()),
Measure: mReleasedTraces,
Description: mReleasedTraces.Description(),
Aggregation: view.Sum(),
},
{
Name: processorhelper.BuildCustomMetricName(string(metadata.Type), mIncompleteReleases.Name()),
Name: processorhelper.BuildCustomMetricName(metadata.Type.String(), mIncompleteReleases.Name()),
Measure: mIncompleteReleases,
Description: mIncompleteReleases.Description(),
Aggregation: view.Sum(),
},
{
Name: processorhelper.BuildCustomMetricName(string(metadata.Type), mEventLatency.Name()),
Name: processorhelper.BuildCustomMetricName(metadata.Type.String(), mEventLatency.Name()),
Measure: mEventLatency,
Description: mEventLatency.Description(),
TagKeys: []tag.Key{
Expand Down
4 changes: 2 additions & 2 deletions receiver/receivercreator/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ func TestInvalidResourceAttributeEndpointType(t *testing.T) {
factories, err := otelcoltest.NopFactories()
require.NoError(t, err)

factories.Receivers[("nop")] = &nopWithEndpointFactory{Factory: receivertest.NewNopFactory()}
factories.Receivers[component.MustNewType("nop")] = &nopWithEndpointFactory{Factory: receivertest.NewNopFactory()}

factory := NewFactory()
factories.Receivers[metadata.Type] = factory
Expand All @@ -152,7 +152,7 @@ func TestInvalidReceiverResourceAttributeValueType(t *testing.T) {
factories, err := otelcoltest.NopFactories()
require.NoError(t, err)

factories.Receivers[("nop")] = &nopWithEndpointFactory{Factory: receivertest.NewNopFactory()}
factories.Receivers[component.MustNewType("nop")] = &nopWithEndpointFactory{Factory: receivertest.NewNopFactory()}

factory := NewFactory()
factories.Receivers[metadata.Type] = factory
Expand Down
2 changes: 1 addition & 1 deletion receiver/receivercreator/receiver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func TestMockedEndToEnd(t *testing.T) {
require.NoError(t, err)

factories, _ := otelcoltest.NopFactories()
factories.Receivers[("nop")] = &nopWithEndpointFactory{Factory: receivertest.NewNopFactory()}
factories.Receivers[component.MustNewType("nop")] = &nopWithEndpointFactory{Factory: receivertest.NewNopFactory()}
factory := NewFactory()
factories.Receivers[metadata.Type] = factory

Expand Down
2 changes: 1 addition & 1 deletion receiver/solacereceiver/observability.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ func fromMeasure(measure stats.Measure, agg *view.Aggregation) *view.View {
}

func buildReceiverCustomMetricName(metric string) string {
return receiverKey + nameSep + string(metadata.Type) + nameSep + metric
return receiverKey + nameSep + metadata.Type.String() + nameSep + metric
}

// recordFailedReconnection increments the metric that records failed reconnection event.
Expand Down
6 changes: 3 additions & 3 deletions testbed/mockdatasenders/mockdatadogagentexporter/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ import (

// This file implements factory for awsxray receiver.

const (
var (
// The value of "type" key in configuration.
typeStr = "datadog"
compType = component.MustNewType("datadog")
)

func NewFactory() exporter.Factory {
return exporter.NewFactory(typeStr,
return exporter.NewFactory(compType,
createDefaultConfig,
exporter.WithTraces(CreateTracesExporter, component.StabilityLevelAlpha))
}
Expand Down
Loading