Repository: open-telemetry/opentelemetry-collector

Issue:
[Service] Improve assertMetrics test function in service_test.go
This issue is to track [feedback](https://github.com/open-telemetry/opentelemetry-collector/pull/6886#discussion_r1089418162) provided about improving the `assertMetrics()` test function in service_test.go . This improvement is needed after adding instrumentation for `proctelemetry.ProcessMetrics` using otel-go, which breaks assertMetrics() when the featuregate is enabled.  Otel metrics do not include the `service*` resource attributes with every metric and instead only records these attributes once in the `otel_target_info`.

The suggested improvement is to validate the metric values as well (since checking labels won't be helpful in the Otel case) and have two versions of `assertMetrics`. These functions should be named something like `assertOCMetrics` and `asserOtelMetrics`

Discussion:

Solution patch:
diff --git a/.chloggen/ldflags.yaml b/.chloggen/ldflags.yaml
new file mode 100755
index 000000000000..a11c93a3fa96
--- /dev/null
+++ b/.chloggen/ldflags.yaml
@@ -0,0 +1,16 @@
+# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
+change_type: enhancement
+
+# The name of the component, or a single word describing the area of concern, (e.g. otlpreceiver)
+component: builder
+
+# A brief description of the change.  Surround your text with quotes ("") if it needs to start with a backtick (`).
+note: added ldflags command option
+
+# One or more tracking issues or pull requests related to the change
+issues: [6940]
+
+# (Optional) One or more lines of additional information to render under the primary note.
+# These lines will be padded with 2 spaces and then inserted directly into the document.
+# Use pipe (|) for multiline entries.
+subtext:
diff --git a/.chloggen/pdata-deprecate-moveto.yaml b/.chloggen/pdata-deprecate-moveto.yaml
new file mode 100755
index 000000000000..2ad12c169fa6
--- /dev/null
+++ b/.chloggen/pdata-deprecate-moveto.yaml
@@ -0,0 +1,11 @@
+# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
+change_type: deprecation
+
+# The name of the component, or a single word describing the area of concern, (e.g. otlpreceiver)
+component: pdata
+
+# A brief description of the change.  Surround your text with quotes ("") if it needs to start with a backtick (`).
+note: Deprecate [Metrics|Logs|Traces].MoveTo methods.
+
+# One or more tracking issues or pull requests related to the change
+issues: [7091]
diff --git a/.chloggen/proctelemetry-processmetrics.yaml b/.chloggen/proctelemetry-processmetrics.yaml
new file mode 100644
index 000000000000..4ccab9f1cb05
--- /dev/null
+++ b/.chloggen/proctelemetry-processmetrics.yaml
@@ -0,0 +1,12 @@
+# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
+change_type: enhancement
+
+# The name of the component, or a single word describing the area of concern, (e.g. otlpreceiver)
+component: proctelemetry
+
+# A brief description of the change.  Surround your text with quotes ("") if it needs to start with a backtick (`).
+note: "Instrument `proctelemetry.ProcessMetrics` metrics with otel-go"
+
+# One or more tracking issues or pull requests related to the change
+issues: [6886]
+
diff --git a/.chloggen/rmsort.yaml b/.chloggen/rmsort.yaml
new file mode 100755
index 000000000000..cbb0b85d45d8
--- /dev/null
+++ b/.chloggen/rmsort.yaml
@@ -0,0 +1,11 @@
+# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
+change_type: breaking
+
+# The name of the component, or a single word describing the area of concern, (e.g. otlpreceiver)
+component: pcommon
+
+# A brief description of the change.  Surround your text with quotes ("") if it needs to start with a backtick (`).
+note: Remove deprecated Map.Sort
+
+# One or more tracking issues or pull requests related to the change
+issues: [6688]
diff --git a/cmd/builder/internal/builder/config.go b/cmd/builder/internal/builder/config.go
index 9cf92b82933c..1a25721ea724 100644
--- a/cmd/builder/internal/builder/config.go
+++ b/cmd/builder/internal/builder/config.go
@@ -34,8 +34,9 @@ var ErrInvalidGoMod = errors.New("invalid gomod specification for module")
 // Config holds the builder's configuration
 type Config struct {
 	Logger          *zap.Logger
-	SkipCompilation bool `mapstructure:"-"`
-	SkipGetModules  bool `mapstructure:"-"`
+	SkipCompilation bool   `mapstructure:"-"`
+	SkipGetModules  bool   `mapstructure:"-"`
+	LDFlags         string `mapstructure:"-"`
 
 	Distribution Distribution `mapstructure:"dist"`
 	Exporters    []Module     `mapstructure:"exporters"`
diff --git a/cmd/builder/internal/builder/main.go b/cmd/builder/internal/builder/main.go
index 30216270f2ca..3730efc4a251 100644
--- a/cmd/builder/internal/builder/main.go
+++ b/cmd/builder/internal/builder/main.go
@@ -91,8 +91,10 @@ func Compile(cfg Config) error {
 	args := []string{"build", "-trimpath", "-o", cfg.Distribution.Name}
 	if cfg.Distribution.DebugCompilation {
 		cfg.Logger.Info("Debug compilation is enabled, the debug symbols will be left on the resulting binary")
-		ldflags = ""
+		ldflags = cfg.LDFlags
 		args = append(args, "-gcflags=all=-N -l")
+	} else if len(cfg.LDFlags) > 0 {
+		ldflags += " " + cfg.LDFlags
 	}
 	args = append(args, "-ldflags="+ldflags)
 	if cfg.Distribution.BuildTags != "" {
diff --git a/cmd/builder/internal/command.go b/cmd/builder/internal/command.go
index 1933a793c84b..f4cdb73b83c8 100644
--- a/cmd/builder/internal/command.go
+++ b/cmd/builder/internal/command.go
@@ -33,6 +33,7 @@ import (
 const (
 	skipCompilationFlag            = "skip-compilation"
 	skipGetModulesFlag             = "skip-get-modules"
+	ldflagsFlag                    = "ldflags"
 	distributionNameFlag           = "name"
 	distributionDescriptionFlag    = "description"
 	distributionVersionFlag        = "version"
@@ -86,6 +87,7 @@ configuration is provided, ocb will generate a default Collector.
 	// the distribution parameters, which we accept as CLI flags as well
 	cmd.Flags().BoolVar(&cfg.SkipCompilation, skipCompilationFlag, false, "Whether builder should only generate go code with no compile of the collector (default false)")
 	cmd.Flags().BoolVar(&cfg.SkipGetModules, skipGetModulesFlag, false, "Whether builder should skip updating go.mod and retrieve Go module list (default false)")
+	cmd.Flags().StringVar(&cfg.LDFlags, ldflagsFlag, "", `ldflags to include in the "go build" command`)
 	cmd.Flags().StringVar(&cfg.Distribution.Name, distributionNameFlag, "otelcol-custom", "The executable name for the OpenTelemetry Collector distribution")
 	if err := cmd.Flags().MarkDeprecated(distributionNameFlag, "use config distribution::name"); err != nil {
 		return nil, err
diff --git a/connector/forwardconnector/forward.go b/connector/forwardconnector/forward.go
index ed6df51623c8..d8cdff367d03 100644
--- a/connector/forwardconnector/forward.go
+++ b/connector/forwardconnector/forward.go
@@ -20,30 +20,20 @@ import (
 	"go.opentelemetry.io/collector/component"
 	"go.opentelemetry.io/collector/connector"
 	"go.opentelemetry.io/collector/consumer"
-	"go.opentelemetry.io/collector/internal/sharedcomponent"
 )
 
 const (
 	typeStr = "forward"
 )
 
-type forwardFactory struct {
-	// This is the map of already created forward connectors for particular configurations.
-	// We maintain this map because the Factory is asked trace, metric, and log receivers
-	// separately but they must not create separate objects. When the connector is shutdown
-	// it should be removed from this map so the same configuration can be recreated successfully.
-	components *sharedcomponent.SharedComponents[component.ID, *forward]
-}
-
 // NewFactory returns a connector.Factory.
 func NewFactory() connector.Factory {
-	f := &forwardFactory{components: sharedcomponent.NewSharedComponents[component.ID, *forward]()}
 	return connector.NewFactory(
 		typeStr,
 		createDefaultConfig,
-		connector.WithTracesToTraces(f.createTracesToTraces, component.StabilityLevelDevelopment),
-		connector.WithMetricsToMetrics(f.createMetricsToMetrics, component.StabilityLevelDevelopment),
-		connector.WithLogsToLogs(f.createLogsToLogs, component.StabilityLevelDevelopment),
+		connector.WithTracesToTraces(createTracesToTraces, component.StabilityLevelDevelopment),
+		connector.WithMetricsToMetrics(createMetricsToMetrics, component.StabilityLevelDevelopment),
+		connector.WithLogsToLogs(createLogsToLogs, component.StabilityLevelDevelopment),
 	)
 }
 
@@ -53,51 +43,33 @@ func createDefaultConfig() component.Config {
 }
 
 // createTracesToTraces creates a trace receiver based on provided config.
-func (f *forwardFactory) createTracesToTraces(
+func createTracesToTraces(
 	_ context.Context,
 	set connector.CreateSettings,
 	cfg component.Config,
 	nextConsumer consumer.Traces,
 ) (connector.Traces, error) {
-	comp, _ := f.components.GetOrAdd(set.ID, func() (*forward, error) {
-		return &forward{}, nil
-	})
-
-	conn := comp.Unwrap()
-	conn.Traces = nextConsumer
-	return conn, nil
+	return &forward{Traces: nextConsumer}, nil
 }
 
 // createMetricsToMetrics creates a metrics receiver based on provided config.
-func (f *forwardFactory) createMetricsToMetrics(
+func createMetricsToMetrics(
 	_ context.Context,
 	set connector.CreateSettings,
 	cfg component.Config,
 	nextConsumer consumer.Metrics,
 ) (connector.Metrics, error) {
-	comp, _ := f.components.GetOrAdd(set.ID, func() (*forward, error) {
-		return &forward{}, nil
-	})
-
-	conn := comp.Unwrap()
-	conn.Metrics = nextConsumer
-	return conn, nil
+	return &forward{Metrics: nextConsumer}, nil
 }
 
 // createLogsToLogs creates a log receiver based on provided config.
-func (f *forwardFactory) createLogsToLogs(
+func createLogsToLogs(
 	_ context.Context,
 	set connector.CreateSettings,
 	cfg component.Config,
 	nextConsumer consumer.Logs,
 ) (connector.Logs, error) {
-	comp, _ := f.components.GetOrAdd(set.ID, func() (*forward, error) {
-		return &forward{}, nil
-	})
-
-	conn := comp.Unwrap()
-	conn.Logs = nextConsumer
-	return conn, nil
+	return &forward{Logs: nextConsumer}, nil
 }
 
 // forward is used to pass signals directly from one pipeline to another.
diff --git a/pdata/pcommon/map.go b/pdata/pcommon/map.go
index f0f27e080ca2..b9b4f48da3bf 100644
--- a/pdata/pcommon/map.go
+++ b/pdata/pcommon/map.go
@@ -15,8 +15,6 @@
 package pcommon // import "go.opentelemetry.io/collector/pdata/pcommon"
 
 import (
-	"sort"
-
 	"go.uber.org/multierr"
 
 	"go.opentelemetry.io/collector/pdata/internal"
@@ -194,25 +192,6 @@ func (m Map) PutEmptySlice(k string) Slice {
 	return Slice(internal.NewSlice(&vl.ArrayValue.Values))
 }
 
-// Sort sorts the entries in the Map so two instances can be compared.
-//
-// Deprecated: [1.0.0-rc4] This method will be removed as it leaks the underlying implementation.
-// Please use one of the following alternatives depending on your use case:
-//   - Map.AsRaw() if you need to compare two maps in tests.
-//   - github.com/open-telemetry/opentelemetry-collector-contrib/pkg/pdatatest module if you use Sort()
-//     to prepare other pdata objects for comparison.
-//   - github.com/open-telemetry/opentelemetry-collector-contrib/pkg/pdatautil module if you use Sort()
-//     to create Map identifiers.
-//
-// If your use case is not covered by the above alternatives, please comment on the issue
-// https://github.com/open-telemetry/opentelemetry-collector/issues/6688.
-func (m Map) Sort() {
-	// Intention is to move the nil values at the end.
-	sort.SliceStable(*m.getOrig(), func(i, j int) bool {
-		return (*m.getOrig())[i].Key < (*m.getOrig())[j].Key
-	})
-}
-
 // Len returns the length of this map.
 //
 // Because the Map is represented internally by a slice of pointers, and the data are comping from the wire,
diff --git a/pdata/plog/logs.go b/pdata/plog/logs.go
index 7557ddd729c5..1947ad225ae5 100644
--- a/pdata/plog/logs.go
+++ b/pdata/plog/logs.go
@@ -17,7 +17,6 @@ package plog // import "go.opentelemetry.io/collector/pdata/plog"
 import (
 	"go.opentelemetry.io/collector/pdata/internal"
 	otlpcollectorlog "go.opentelemetry.io/collector/pdata/internal/data/protogen/collector/logs/v1"
-	otlplogs "go.opentelemetry.io/collector/pdata/internal/data/protogen/logs/v1"
 )
 
 // Logs is the top-level struct that is propagated through the logs pipeline.
@@ -39,6 +38,7 @@ func NewLogs() Logs {
 
 // MoveTo moves the Logs instance overriding the destination and
 // resetting the current instance to its zero value.
+// Deprecated: [1.0.0-rc5] The method can be replaced with a plain assignment.
 func (ms Logs) MoveTo(dest Logs) {
 	*dest.getOrig() = *ms.getOrig()
 	*ms.getOrig() = otlpcollectorlog.ExportLogsServiceRequest{}
@@ -68,91 +68,3 @@ func (ms Logs) LogRecordCount() int {
 func (ms Logs) ResourceLogs() ResourceLogsSlice {
 	return newResourceLogsSlice(&ms.getOrig().ResourceLogs)
 }
-
-// SeverityNumber represents severity number of a log record.
-type SeverityNumber int32
-
-const (
-	SeverityNumberUnspecified = SeverityNumber(otlplogs.SeverityNumber_SEVERITY_NUMBER_UNSPECIFIED)
-	SeverityNumberTrace       = SeverityNumber(otlplogs.SeverityNumber_SEVERITY_NUMBER_TRACE)
-	SeverityNumberTrace2      = SeverityNumber(otlplogs.SeverityNumber_SEVERITY_NUMBER_TRACE2)
-	SeverityNumberTrace3      = SeverityNumber(otlplogs.SeverityNumber_SEVERITY_NUMBER_TRACE3)
-	SeverityNumberTrace4      = SeverityNumber(otlplogs.SeverityNumber_SEVERITY_NUMBER_TRACE4)
-	SeverityNumberDebug       = SeverityNumber(otlplogs.SeverityNumber_SEVERITY_NUMBER_DEBUG)
-	SeverityNumberDebug2      = SeverityNumber(otlplogs.SeverityNumber_SEVERITY_NUMBER_DEBUG2)
-	SeverityNumberDebug3      = SeverityNumber(otlplogs.SeverityNumber_SEVERITY_NUMBER_DEBUG3)
-	SeverityNumberDebug4      = SeverityNumber(otlplogs.SeverityNumber_SEVERITY_NUMBER_DEBUG4)
-	SeverityNumberInfo        = SeverityNumber(otlplogs.SeverityNumber_SEVERITY_NUMBER_INFO)
-	SeverityNumberInfo2       = SeverityNumber(otlplogs.SeverityNumber_SEVERITY_NUMBER_INFO2)
-	SeverityNumberInfo3       = SeverityNumber(otlplogs.SeverityNumber_SEVERITY_NUMBER_INFO3)
-	SeverityNumberInfo4       = SeverityNumber(otlplogs.SeverityNumber_SEVERITY_NUMBER_INFO4)
-	SeverityNumberWarn        = SeverityNumber(otlplogs.SeverityNumber_SEVERITY_NUMBER_WARN)
-	SeverityNumberWarn2       = SeverityNumber(otlplogs.SeverityNumber_SEVERITY_NUMBER_WARN2)
-	SeverityNumberWarn3       = SeverityNumber(otlplogs.SeverityNumber_SEVERITY_NUMBER_WARN3)
-	SeverityNumberWarn4       = SeverityNumber(otlplogs.SeverityNumber_SEVERITY_NUMBER_WARN4)
-	SeverityNumberError       = SeverityNumber(otlplogs.SeverityNumber_SEVERITY_NUMBER_ERROR)
-	SeverityNumberError2      = SeverityNumber(otlplogs.SeverityNumber_SEVERITY_NUMBER_ERROR2)
-	SeverityNumberError3      = SeverityNumber(otlplogs.SeverityNumber_SEVERITY_NUMBER_ERROR3)
-	SeverityNumberError4      = SeverityNumber(otlplogs.SeverityNumber_SEVERITY_NUMBER_ERROR4)
-	SeverityNumberFatal       = SeverityNumber(otlplogs.SeverityNumber_SEVERITY_NUMBER_FATAL)
-	SeverityNumberFatal2      = SeverityNumber(otlplogs.SeverityNumber_SEVERITY_NUMBER_FATAL2)
-	SeverityNumberFatal3      = SeverityNumber(otlplogs.SeverityNumber_SEVERITY_NUMBER_FATAL3)
-	SeverityNumberFatal4      = SeverityNumber(otlplogs.SeverityNumber_SEVERITY_NUMBER_FATAL4)
-)
-
-// String returns the string representation of the SeverityNumber.
-func (sn SeverityNumber) String() string {
-	switch sn {
-	case SeverityNumberUnspecified:
-		return "Unspecified"
-	case SeverityNumberTrace:
-		return "Trace"
-	case SeverityNumberTrace2:
-		return "Trace2"
-	case SeverityNumberTrace3:
-		return "Trace3"
-	case SeverityNumberTrace4:
-		return "Trace4"
-	case SeverityNumberDebug:
-		return "Debug"
-	case SeverityNumberDebug2:
-		return "Debug2"
-	case SeverityNumberDebug3:
-		return "Debug3"
-	case SeverityNumberDebug4:
-		return "Debug4"
-	case SeverityNumberInfo:
-		return "Info"
-	case SeverityNumberInfo2:
-		return "Info2"
-	case SeverityNumberInfo3:
-		return "Info3"
-	case SeverityNumberInfo4:
-		return "Info4"
-	case SeverityNumberWarn:
-		return "Warn"
-	case SeverityNumberWarn2:
-		return "Warn2"
-	case SeverityNumberWarn3:
-		return "Warn3"
-	case SeverityNumberWarn4:
-		return "Warn4"
-	case SeverityNumberError:
-		return "Error"
-	case SeverityNumberError2:
-		return "Error2"
-	case SeverityNumberError3:
-		return "Error3"
-	case SeverityNumberError4:
-		return "Error4"
-	case SeverityNumberFatal:
-		return "Fatal"
-	case SeverityNumberFatal2:
-		return "Fatal2"
-	case SeverityNumberFatal3:
-		return "Fatal3"
-	case SeverityNumberFatal4:
-		return "Fatal4"
-	}
-	return ""
-}
diff --git a/pdata/plog/severity_number.go b/pdata/plog/severity_number.go
new file mode 100644
index 000000000000..4e6b66fe8e36
--- /dev/null
+++ b/pdata/plog/severity_number.go
@@ -0,0 +1,107 @@
+// Copyright The OpenTelemetry Authors
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//       http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package plog // import "go.opentelemetry.io/collector/pdata/plog"
+
+import (
+	otlplogs "go.opentelemetry.io/collector/pdata/internal/data/protogen/logs/v1"
+)
+
+// SeverityNumber represents severity number of a log record.
+type SeverityNumber int32
+
+const (
+	SeverityNumberUnspecified = SeverityNumber(otlplogs.SeverityNumber_SEVERITY_NUMBER_UNSPECIFIED)
+	SeverityNumberTrace       = SeverityNumber(otlplogs.SeverityNumber_SEVERITY_NUMBER_TRACE)
+	SeverityNumberTrace2      = SeverityNumber(otlplogs.SeverityNumber_SEVERITY_NUMBER_TRACE2)
+	SeverityNumberTrace3      = SeverityNumber(otlplogs.SeverityNumber_SEVERITY_NUMBER_TRACE3)
+	SeverityNumberTrace4      = SeverityNumber(otlplogs.SeverityNumber_SEVERITY_NUMBER_TRACE4)
+	SeverityNumberDebug       = SeverityNumber(otlplogs.SeverityNumber_SEVERITY_NUMBER_DEBUG)
+	SeverityNumberDebug2      = SeverityNumber(otlplogs.SeverityNumber_SEVERITY_NUMBER_DEBUG2)
+	SeverityNumberDebug3      = SeverityNumber(otlplogs.SeverityNumber_SEVERITY_NUMBER_DEBUG3)
+	SeverityNumberDebug4      = SeverityNumber(otlplogs.SeverityNumber_SEVERITY_NUMBER_DEBUG4)
+	SeverityNumberInfo        = SeverityNumber(otlplogs.SeverityNumber_SEVERITY_NUMBER_INFO)
+	SeverityNumberInfo2       = SeverityNumber(otlplogs.SeverityNumber_SEVERITY_NUMBER_INFO2)
+	SeverityNumberInfo3       = SeverityNumber(otlplogs.SeverityNumber_SEVERITY_NUMBER_INFO3)
+	SeverityNumberInfo4       = SeverityNumber(otlplogs.SeverityNumber_SEVERITY_NUMBER_INFO4)
+	SeverityNumberWarn        = SeverityNumber(otlplogs.SeverityNumber_SEVERITY_NUMBER_WARN)
+	SeverityNumberWarn2       = SeverityNumber(otlplogs.SeverityNumber_SEVERITY_NUMBER_WARN2)
+	SeverityNumberWarn3       = SeverityNumber(otlplogs.SeverityNumber_SEVERITY_NUMBER_WARN3)
+	SeverityNumberWarn4       = SeverityNumber(otlplogs.SeverityNumber_SEVERITY_NUMBER_WARN4)
+	SeverityNumberError       = SeverityNumber(otlplogs.SeverityNumber_SEVERITY_NUMBER_ERROR)
+	SeverityNumberError2      = SeverityNumber(otlplogs.SeverityNumber_SEVERITY_NUMBER_ERROR2)
+	SeverityNumberError3      = SeverityNumber(otlplogs.SeverityNumber_SEVERITY_NUMBER_ERROR3)
+	SeverityNumberError4      = SeverityNumber(otlplogs.SeverityNumber_SEVERITY_NUMBER_ERROR4)
+	SeverityNumberFatal       = SeverityNumber(otlplogs.SeverityNumber_SEVERITY_NUMBER_FATAL)
+	SeverityNumberFatal2      = SeverityNumber(otlplogs.SeverityNumber_SEVERITY_NUMBER_FATAL2)
+	SeverityNumberFatal3      = SeverityNumber(otlplogs.SeverityNumber_SEVERITY_NUMBER_FATAL3)
+	SeverityNumberFatal4      = SeverityNumber(otlplogs.SeverityNumber_SEVERITY_NUMBER_FATAL4)
+)
+
+// String returns the string representation of the SeverityNumber.
+func (sn SeverityNumber) String() string {
+	switch sn {
+	case SeverityNumberUnspecified:
+		return "Unspecified"
+	case SeverityNumberTrace:
+		return "Trace"
+	case SeverityNumberTrace2:
+		return "Trace2"
+	case SeverityNumberTrace3:
+		return "Trace3"
+	case SeverityNumberTrace4:
+		return "Trace4"
+	case SeverityNumberDebug:
+		return "Debug"
+	case SeverityNumberDebug2:
+		return "Debug2"
+	case SeverityNumberDebug3:
+		return "Debug3"
+	case SeverityNumberDebug4:
+		return "Debug4"
+	case SeverityNumberInfo:
+		return "Info"
+	case SeverityNumberInfo2:
+		return "Info2"
+	case SeverityNumberInfo3:
+		return "Info3"
+	case SeverityNumberInfo4:
+		return "Info4"
+	case SeverityNumberWarn:
+		return "Warn"
+	case SeverityNumberWarn2:
+		return "Warn2"
+	case SeverityNumberWarn3:
+		return "Warn3"
+	case SeverityNumberWarn4:
+		return "Warn4"
+	case SeverityNumberError:
+		return "Error"
+	case SeverityNumberError2:
+		return "Error2"
+	case SeverityNumberError3:
+		return "Error3"
+	case SeverityNumberError4:
+		return "Error4"
+	case SeverityNumberFatal:
+		return "Fatal"
+	case SeverityNumberFatal2:
+		return "Fatal2"
+	case SeverityNumberFatal3:
+		return "Fatal3"
+	case SeverityNumberFatal4:
+		return "Fatal4"
+	}
+	return ""
+}
diff --git a/pdata/pmetric/aggregation_temporality.go b/pdata/pmetric/aggregation_temporality.go
new file mode 100644
index 000000000000..a2980d7262ea
--- /dev/null
+++ b/pdata/pmetric/aggregation_temporality.go
@@ -0,0 +1,45 @@
+// Copyright The OpenTelemetry Authors
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//       http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package pmetric // import "go.opentelemetry.io/collector/pdata/pmetric"
+
+import (
+	otlpmetrics "go.opentelemetry.io/collector/pdata/internal/data/protogen/metrics/v1"
+)
+
+// AggregationTemporality defines how a metric aggregator reports aggregated values.
+// It describes how those values relate to the time interval over which they are aggregated.
+type AggregationTemporality int32
+
+const (
+	// AggregationTemporalityUnspecified is the default AggregationTemporality, it MUST NOT be used.
+	AggregationTemporalityUnspecified = AggregationTemporality(otlpmetrics.AggregationTemporality_AGGREGATION_TEMPORALITY_UNSPECIFIED)
+	// AggregationTemporalityDelta is a AggregationTemporality for a metric aggregator which reports changes since last report time.
+	AggregationTemporalityDelta = AggregationTemporality(otlpmetrics.AggregationTemporality_AGGREGATION_TEMPORALITY_DELTA)
+	// AggregationTemporalityCumulative is a AggregationTemporality for a metric aggregator which reports changes since a fixed start time.
+	AggregationTemporalityCumulative = AggregationTemporality(otlpmetrics.AggregationTemporality_AGGREGATION_TEMPORALITY_CUMULATIVE)
+)
+
+// String returns the string representation of the AggregationTemporality.
+func (at AggregationTemporality) String() string {
+	switch at {
+	case AggregationTemporalityUnspecified:
+		return "Unspecified"
+	case AggregationTemporalityDelta:
+		return "Delta"
+	case AggregationTemporalityCumulative:
+		return "Cumulative"
+	}
+	return ""
+}
diff --git a/pdata/pmetric/exemplar_value_type.go b/pdata/pmetric/exemplar_value_type.go
new file mode 100644
index 000000000000..09e815d78999
--- /dev/null
+++ b/pdata/pmetric/exemplar_value_type.go
@@ -0,0 +1,38 @@
+// Copyright The OpenTelemetry Authors
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//       http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package pmetric // import "go.opentelemetry.io/collector/pdata/pmetric"
+
+// ExemplarValueType specifies the type of Exemplar measurement value.
+type ExemplarValueType int32
+
+const (
+	// ExemplarValueTypeEmpty means that exemplar value is unset.
+	ExemplarValueTypeEmpty ExemplarValueType = iota
+	ExemplarValueTypeInt
+	ExemplarValueTypeDouble
+)
+
+// String returns the string representation of the ExemplarValueType.
+func (nt ExemplarValueType) String() string {
+	switch nt {
+	case ExemplarValueTypeEmpty:
+		return "Empty"
+	case ExemplarValueTypeInt:
+		return "Int"
+	case ExemplarValueTypeDouble:
+		return "Double"
+	}
+	return ""
+}
diff --git a/pdata/pmetric/metric_type.go b/pdata/pmetric/metric_type.go
new file mode 100644
index 000000000000..c2f3373bd1df
--- /dev/null
+++ b/pdata/pmetric/metric_type.go
@@ -0,0 +1,47 @@
+// Copyright The OpenTelemetry Authors
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//       http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package pmetric // import "go.opentelemetry.io/collector/pdata/pmetric"
+
+// MetricType specifies the type of data in a Metric.
+type MetricType int32
+
+const (
+	// MetricTypeEmpty means that metric type is unset.
+	MetricTypeEmpty MetricType = iota
+	MetricTypeGauge
+	MetricTypeSum
+	MetricTypeHistogram
+	MetricTypeExponentialHistogram
+	MetricTypeSummary
+)
+
+// String returns the string representation of the MetricType.
+func (mdt MetricType) String() string {
+	switch mdt {
+	case MetricTypeEmpty:
+		return "Empty"
+	case MetricTypeGauge:
+		return "Gauge"
+	case MetricTypeSum:
+		return "Sum"
+	case MetricTypeHistogram:
+		return "Histogram"
+	case MetricTypeExponentialHistogram:
+		return "ExponentialHistogram"
+	case MetricTypeSummary:
+		return "Summary"
+	}
+	return ""
+}
diff --git a/pdata/pmetric/metrics.go b/pdata/pmetric/metrics.go
index f1739630f694..bae9c73e7d85 100644
--- a/pdata/pmetric/metrics.go
+++ b/pdata/pmetric/metrics.go
@@ -17,7 +17,6 @@ package pmetric // import "go.opentelemetry.io/collector/pdata/pmetric"
 import (
 	"go.opentelemetry.io/collector/pdata/internal"
 	otlpcollectormetrics "go.opentelemetry.io/collector/pdata/internal/data/protogen/collector/metrics/v1"
-	otlpmetrics "go.opentelemetry.io/collector/pdata/internal/data/protogen/metrics/v1"
 )
 
 // Metrics is the top-level struct that is propagated through the metrics pipeline.
@@ -44,6 +43,7 @@ func (ms Metrics) CopyTo(dest Metrics) {
 
 // MoveTo moves the Metrics instance overriding the destination and
 // resetting the current instance to its zero value.
+// Deprecated: [1.0.0-rc5] The method can be replaced with a plain assignment.
 func (ms Metrics) MoveTo(dest Metrics) {
 	*dest.getOrig() = *ms.getOrig()
 	*ms.getOrig() = otlpcollectormetrics.ExportMetricsServiceRequest{}
@@ -97,107 +97,3 @@ func (ms Metrics) DataPointCount() (dataPointCount int) {
 	}
 	return
 }
-
-// MetricType specifies the type of data in a Metric.
-type MetricType int32
-
-const (
-	// MetricTypeEmpty means that metric type is unset.
-	MetricTypeEmpty MetricType = iota
-	MetricTypeGauge
-	MetricTypeSum
-	MetricTypeHistogram
-	MetricTypeExponentialHistogram
-	MetricTypeSummary
-)
-
-// String returns the string representation of the MetricType.
-func (mdt MetricType) String() string {
-	switch mdt {
-	case MetricTypeEmpty:
-		return "Empty"
-	case MetricTypeGauge:
-		return "Gauge"
-	case MetricTypeSum:
-		return "Sum"
-	case MetricTypeHistogram:
-		return "Histogram"
-	case MetricTypeExponentialHistogram:
-		return "ExponentialHistogram"
-	case MetricTypeSummary:
-		return "Summary"
-	}
-	return ""
-}
-
-// AggregationTemporality defines how a metric aggregator reports aggregated values.
-// It describes how those values relate to the time interval over which they are aggregated.
-type AggregationTemporality int32
-
-const (
-	// AggregationTemporalityUnspecified is the default AggregationTemporality, it MUST NOT be used.
-	AggregationTemporalityUnspecified = AggregationTemporality(otlpmetrics.AggregationTemporality_AGGREGATION_TEMPORALITY_UNSPECIFIED)
-	// AggregationTemporalityDelta is a AggregationTemporality for a metric aggregator which reports changes since last report time.
-	AggregationTemporalityDelta = AggregationTemporality(otlpmetrics.AggregationTemporality_AGGREGATION_TEMPORALITY_DELTA)
-	// AggregationTemporalityCumulative is a AggregationTemporality for a metric aggregator which reports changes since a fixed start time.
-	AggregationTemporalityCumulative = AggregationTemporality(otlpmetrics.AggregationTemporality_AGGREGATION_TEMPORALITY_CUMULATIVE)
-)
-
-// String returns the string representation of the AggregationTemporality.
-func (at AggregationTemporality) String() string {
-	switch at {
-	case AggregationTemporalityUnspecified:
-		return "Unspecified"
-	case AggregationTemporalityDelta:
-		return "Delta"
-	case AggregationTemporalityCumulative:
-		return "Cumulative"
-	}
-	return ""
-}
-
-// NumberDataPointValueType specifies the type of NumberDataPoint value.
-type NumberDataPointValueType int32
-
-const (
-	// NumberDataPointValueTypeEmpty means that data point value is unset.
-	NumberDataPointValueTypeEmpty NumberDataPointValueType = iota
-	NumberDataPointValueTypeInt
-	NumberDataPointValueTypeDouble
-)
-
-// String returns the string representation of the NumberDataPointValueType.
-func (nt NumberDataPointValueType) String() string {
-	switch nt {
-	case NumberDataPointValueTypeEmpty:
-		return "Empty"
-	case NumberDataPointValueTypeInt:
-		return "Int"
-	case NumberDataPointValueTypeDouble:
-		return "Double"
-	}
-	return ""
-}
-
-// ExemplarValueType specifies the type of Exemplar measurement value.
-type ExemplarValueType int32
-
-const (
-	// ExemplarValueTypeEmpty means that exemplar value is unset.
-	ExemplarValueTypeEmpty ExemplarValueType = iota
-	ExemplarValueTypeInt
-	ExemplarValueTypeDouble
-)
-
-// String returns the string representation of the ExemplarValueType.
-func (nt ExemplarValueType) String() string {
-	switch nt {
-	case ExemplarValueTypeEmpty:
-		return "Empty"
-	case ExemplarValueTypeInt:
-		return "Int"
-	case ExemplarValueTypeDouble:
-		return "Double"
-	}
-	return ""
-}
diff --git a/pdata/pmetric/number_data_point_value_type.go b/pdata/pmetric/number_data_point_value_type.go
new file mode 100644
index 000000000000..17b17a6a4138
--- /dev/null
+++ b/pdata/pmetric/number_data_point_value_type.go
@@ -0,0 +1,38 @@
+// Copyright The OpenTelemetry Authors
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//       http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package pmetric // import "go.opentelemetry.io/collector/pdata/pmetric"
+
+// NumberDataPointValueType specifies the type of NumberDataPoint value.
+type NumberDataPointValueType int32
+
+const (
+	// NumberDataPointValueTypeEmpty means that data point value is unset.
+	NumberDataPointValueTypeEmpty NumberDataPointValueType = iota
+	NumberDataPointValueTypeInt
+	NumberDataPointValueTypeDouble
+)
+
+// String returns the string representation of the NumberDataPointValueType.
+func (nt NumberDataPointValueType) String() string {
+	switch nt {
+	case NumberDataPointValueTypeEmpty:
+		return "Empty"
+	case NumberDataPointValueTypeInt:
+		return "Int"
+	case NumberDataPointValueTypeDouble:
+		return "Double"
+	}
+	return ""
+}
diff --git a/pdata/ptrace/span_kind.go b/pdata/ptrace/span_kind.go
new file mode 100644
index 000000000000..58437dd1472b
--- /dev/null
+++ b/pdata/ptrace/span_kind.go
@@ -0,0 +1,65 @@
+// Copyright The OpenTelemetry Authors
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//       http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package ptrace // import "go.opentelemetry.io/collector/pdata/ptrace"
+
+import (
+	otlptrace "go.opentelemetry.io/collector/pdata/internal/data/protogen/trace/v1"
+)
+
+// SpanKind is the type of span. Can be used to specify additional relationships between spans
+// in addition to a parent/child relationship.
+type SpanKind int32
+
+const (
+	// SpanKindUnspecified represents that the SpanKind is unspecified, it MUST NOT be used.
+	SpanKindUnspecified = SpanKind(otlptrace.Span_SPAN_KIND_UNSPECIFIED)
+	// SpanKindInternal indicates that the span represents an internal operation within an application,
+	// as opposed to an operation happening at the boundaries. Default value.
+	SpanKindInternal = SpanKind(otlptrace.Span_SPAN_KIND_INTERNAL)
+	// SpanKindServer indicates that the span covers server-side handling of an RPC or other
+	// remote network request.
+	SpanKindServer = SpanKind(otlptrace.Span_SPAN_KIND_SERVER)
+	// SpanKindClient indicates that the span describes a request to some remote service.
+	SpanKindClient = SpanKind(otlptrace.Span_SPAN_KIND_CLIENT)
+	// SpanKindProducer indicates that the span describes a producer sending a message to a broker.
+	// Unlike CLIENT and SERVER, there is often no direct critical path latency relationship
+	// between producer and consumer spans.
+	// A PRODUCER span ends when the message was accepted by the broker while the logical processing of
+	// the message might span a much longer time.
+	SpanKindProducer = SpanKind(otlptrace.Span_SPAN_KIND_PRODUCER)
+	// SpanKindConsumer indicates that the span describes consumer receiving a message from a broker.
+	// Like the PRODUCER kind, there is often no direct critical path latency relationship between
+	// producer and consumer spans.
+	SpanKindConsumer = SpanKind(otlptrace.Span_SPAN_KIND_CONSUMER)
+)
+
+// String returns the string representation of the SpanKind.
+func (sk SpanKind) String() string {
+	switch sk {
+	case SpanKindUnspecified:
+		return "Unspecified"
+	case SpanKindInternal:
+		return "Internal"
+	case SpanKindServer:
+		return "Server"
+	case SpanKindClient:
+		return "Client"
+	case SpanKindProducer:
+		return "Producer"
+	case SpanKindConsumer:
+		return "Consumer"
+	}
+	return ""
+}
diff --git a/pdata/ptrace/status_code.go b/pdata/ptrace/status_code.go
new file mode 100644
index 000000000000..72186a7a9034
--- /dev/null
+++ b/pdata/ptrace/status_code.go
@@ -0,0 +1,42 @@
+// Copyright The OpenTelemetry Authors
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//       http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package ptrace // import "go.opentelemetry.io/collector/pdata/ptrace"
+
+import (
+	otlptrace "go.opentelemetry.io/collector/pdata/internal/data/protogen/trace/v1"
+)
+
+// StatusCode mirrors the codes defined at
+// https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/trace/api.md#set-status
+type StatusCode int32
+
+const (
+	StatusCodeUnset = StatusCode(otlptrace.Status_STATUS_CODE_UNSET)
+	StatusCodeOk    = StatusCode(otlptrace.Status_STATUS_CODE_OK)
+	StatusCodeError = StatusCode(otlptrace.Status_STATUS_CODE_ERROR)
+)
+
+// String returns the string representation of the StatusCode.
+func (sc StatusCode) String() string {
+	switch sc {
+	case StatusCodeUnset:
+		return "Unset"
+	case StatusCodeOk:
+		return "Ok"
+	case StatusCodeError:
+		return "Error"
+	}
+	return ""
+}
diff --git a/pdata/ptrace/traces.go b/pdata/ptrace/traces.go
index 0af4b9e478cb..757bd67f9036 100644
--- a/pdata/ptrace/traces.go
+++ b/pdata/ptrace/traces.go
@@ -17,7 +17,6 @@ package ptrace // import "go.opentelemetry.io/collector/pdata/ptrace"
 import (
 	"go.opentelemetry.io/collector/pdata/internal"
 	otlpcollectortrace "go.opentelemetry.io/collector/pdata/internal/data/protogen/collector/trace/v1"
-	otlptrace "go.opentelemetry.io/collector/pdata/internal/data/protogen/trace/v1"
 )
 
 // Traces is the top-level struct that is propagated through the traces pipeline.
@@ -39,6 +38,7 @@ func NewTraces() Traces {
 
 // MoveTo moves the Traces instance overriding the destination and
 // resetting the current instance to its zero value.
+// Deprecated: [1.0.0-rc5] The method can be replaced with a plain assignment.
 func (ms Traces) MoveTo(dest Traces) {
 	*dest.getOrig() = *ms.getOrig()
 	*ms.getOrig() = otlpcollectortrace.ExportTraceServiceRequest{}
@@ -67,72 +67,3 @@ func (ms Traces) SpanCount() int {
 func (ms Traces) ResourceSpans() ResourceSpansSlice {
 	return newResourceSpansSlice(&ms.getOrig().ResourceSpans)
 }
-
-// SpanKind is the type of span. Can be used to specify additional relationships between spans
-// in addition to a parent/child relationship.
-type SpanKind int32
-
-const (
-	// SpanKindUnspecified represents that the SpanKind is unspecified, it MUST NOT be used.
-	SpanKindUnspecified = SpanKind(otlptrace.Span_SPAN_KIND_UNSPECIFIED)
-	// SpanKindInternal indicates that the span represents an internal operation within an application,
-	// as opposed to an operation happening at the boundaries. Default value.
-	SpanKindInternal = SpanKind(otlptrace.Span_SPAN_KIND_INTERNAL)
-	// SpanKindServer indicates that the span covers server-side handling of an RPC or other
-	// remote network request.
-	SpanKindServer = SpanKind(otlptrace.Span_SPAN_KIND_SERVER)
-	// SpanKindClient indicates that the span describes a request to some remote service.
-	SpanKindClient = SpanKind(otlptrace.Span_SPAN_KIND_CLIENT)
-	// SpanKindProducer indicates that the span describes a producer sending a message to a broker.
-	// Unlike CLIENT and SERVER, there is often no direct critical path latency relationship
-	// between producer and consumer spans.
-	// A PRODUCER span ends when the message was accepted by the broker while the logical processing of
-	// the message might span a much longer time.
-	SpanKindProducer = SpanKind(otlptrace.Span_SPAN_KIND_PRODUCER)
-	// SpanKindConsumer indicates that the span describes consumer receiving a message from a broker.
-	// Like the PRODUCER kind, there is often no direct critical path latency relationship between
-	// producer and consumer spans.
-	SpanKindConsumer = SpanKind(otlptrace.Span_SPAN_KIND_CONSUMER)
-)
-
-// String returns the string representation of the SpanKind.
-func (sk SpanKind) String() string {
-	switch sk {
-	case SpanKindUnspecified:
-		return "Unspecified"
-	case SpanKindInternal:
-		return "Internal"
-	case SpanKindServer:
-		return "Server"
-	case SpanKindClient:
-		return "Client"
-	case SpanKindProducer:
-		return "Producer"
-	case SpanKindConsumer:
-		return "Consumer"
-	}
-	return ""
-}
-
-// StatusCode mirrors the codes defined at
-// https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/trace/api.md#set-status
-type StatusCode int32
-
-const (
-	StatusCodeUnset = StatusCode(otlptrace.Status_STATUS_CODE_UNSET)
-	StatusCodeOk    = StatusCode(otlptrace.Status_STATUS_CODE_OK)
-	StatusCodeError = StatusCode(otlptrace.Status_STATUS_CODE_ERROR)
-)
-
-// String returns the string representation of the StatusCode.
-func (sc StatusCode) String() string {
-	switch sc {
-	case StatusCodeUnset:
-		return "Unset"
-	case StatusCodeOk:
-		return "Ok"
-	case StatusCodeError:
-		return "Error"
-	}
-	return ""
-}
diff --git a/service/internal/proctelemetry/process_telemetry.go b/service/internal/proctelemetry/process_telemetry.go
index edb9a9d80ac6..94f4bf8e97ad 100644
--- a/service/internal/proctelemetry/process_telemetry.go
+++ b/service/internal/proctelemetry/process_telemetry.go
@@ -15,6 +15,7 @@
 package proctelemetry // import "go.opentelemetry.io/collector/service/internal/proctelemetry"
 
 import (
+	"context"
 	"os"
 	"runtime"
 	"sync"
@@ -23,6 +24,15 @@ import (
 	"github.com/shirou/gopsutil/v3/process"
 	"go.opencensus.io/metric"
 	"go.opencensus.io/stats"
+	otelmetric "go.opentelemetry.io/otel/metric"
+	"go.opentelemetry.io/otel/metric/instrument"
+	"go.opentelemetry.io/otel/metric/unit"
+	"go.uber.org/multierr"
+)
+
+const (
+	scopeName      = "go.opentelemetry.io/collector/service/process_telemetry"
+	processNameKey = "process_name"
 )
 
 // processMetrics is a struct that contains views related to process metrics (cpu, mem, etc)
@@ -38,6 +48,14 @@ type processMetrics struct {
 	cpuSeconds    *metric.Float64DerivedCumulative
 	rssMemory     *metric.Int64DerivedGauge
 
+	// otel metrics
+	otelProcessUptime instrument.Float64ObservableCounter
+	otelAllocMem      instrument.Int64ObservableGauge
+	otelTotalAllocMem instrument.Int64ObservableCounter
+	otelSysMem        instrument.Int64ObservableGauge
+	otelCPUSeconds    instrument.Float64ObservableCounter
+	otelRSSMemory     instrument.Int64ObservableGauge
+
 	// mu protects everything bellow.
 	mu         sync.Mutex
 	lastMsRead time.Time
@@ -46,19 +64,29 @@ type processMetrics struct {
 
 // RegisterProcessMetrics creates a new set of processMetrics (mem, cpu) that can be used to measure
 // basic information about this process.
-func RegisterProcessMetrics(registry *metric.Registry, ballastSizeBytes uint64) error {
+func RegisterProcessMetrics(ocRegistry *metric.Registry, mp otelmetric.MeterProvider, useOtel bool, ballastSizeBytes uint64) error {
+	var err error
 	pm := &processMetrics{
 		startTimeUnixNano: time.Now().UnixNano(),
 		ballastSizeBytes:  ballastSizeBytes,
 		ms:                &runtime.MemStats{},
 	}
-	var err error
+
 	pm.proc, err = process.NewProcess(int32(os.Getpid()))
 	if err != nil {
 		return err
 	}
 
-	pm.processUptime, err = registry.AddFloat64DerivedCumulative(
+	if useOtel {
+		return pm.recordWithOtel(mp.Meter(scopeName))
+	}
+	return pm.recordWithOC(ocRegistry)
+}
+
+func (pm *processMetrics) recordWithOC(ocRegistry *metric.Registry) error {
+	var err error
+
+	pm.processUptime, err = ocRegistry.AddFloat64DerivedCumulative(
 		"process/uptime",
 		metric.WithDescription("Uptime of the process"),
 		metric.WithUnit(stats.UnitSeconds))
@@ -69,7 +97,7 @@ func RegisterProcessMetrics(registry *metric.Registry, ballastSizeBytes uint64)
 		return err
 	}
 
-	pm.allocMem, err = registry.AddInt64DerivedGauge(
+	pm.allocMem, err = ocRegistry.AddInt64DerivedGauge(
 		"process/runtime/heap_alloc_bytes",
 		metric.WithDescription("Bytes of allocated heap objects (see 'go doc runtime.MemStats.HeapAlloc')"),
 		metric.WithUnit(stats.UnitBytes))
@@ -80,7 +108,7 @@ func RegisterProcessMetrics(registry *metric.Registry, ballastSizeBytes uint64)
 		return err
 	}
 
-	pm.totalAllocMem, err = registry.AddInt64DerivedCumulative(
+	pm.totalAllocMem, err = ocRegistry.AddInt64DerivedCumulative(
 		"process/runtime/total_alloc_bytes",
 		metric.WithDescription("Cumulative bytes allocated for heap objects (see 'go doc runtime.MemStats.TotalAlloc')"),
 		metric.WithUnit(stats.UnitBytes))
@@ -91,7 +119,7 @@ func RegisterProcessMetrics(registry *metric.Registry, ballastSizeBytes uint64)
 		return err
 	}
 
-	pm.sysMem, err = registry.AddInt64DerivedGauge(
+	pm.sysMem, err = ocRegistry.AddInt64DerivedGauge(
 		"process/runtime/total_sys_memory_bytes",
 		metric.WithDescription("Total bytes of memory obtained from the OS (see 'go doc runtime.MemStats.Sys')"),
 		metric.WithUnit(stats.UnitBytes))
@@ -102,7 +130,7 @@ func RegisterProcessMetrics(registry *metric.Registry, ballastSizeBytes uint64)
 		return err
 	}
 
-	pm.cpuSeconds, err = registry.AddFloat64DerivedCumulative(
+	pm.cpuSeconds, err = ocRegistry.AddFloat64DerivedCumulative(
 		"process/cpu_seconds",
 		metric.WithDescription("Total CPU user and system time in seconds"),
 		metric.WithUnit(stats.UnitSeconds))
@@ -113,7 +141,7 @@ func RegisterProcessMetrics(registry *metric.Registry, ballastSizeBytes uint64)
 		return err
 	}
 
-	pm.rssMemory, err = registry.AddInt64DerivedGauge(
+	pm.rssMemory, err = ocRegistry.AddInt64DerivedGauge(
 		"process/memory/rss",
 		metric.WithDescription("Total physical memory (resident set size)"),
 		metric.WithUnit(stats.UnitBytes))
@@ -127,6 +155,72 @@ func RegisterProcessMetrics(registry *metric.Registry, ballastSizeBytes uint64)
 	return nil
 }
 
+func (pm *processMetrics) recordWithOtel(meter otelmetric.Meter) error {
+	var errs, err error
+
+	pm.otelProcessUptime, err = meter.Float64ObservableCounter(
+		"process_uptime",
+		instrument.WithDescription("Uptime of the process"),
+		instrument.WithUnit(unit.Unit("s")),
+		instrument.WithFloat64Callback(func(_ context.Context, o instrument.Float64Observer) error {
+			o.Observe(pm.updateProcessUptime())
+			return nil
+		}))
+	errs = multierr.Append(errs, err)
+
+	pm.otelAllocMem, err = meter.Int64ObservableGauge(
+		"process_runtime_heap_alloc_bytes",
+		instrument.WithDescription("Bytes of allocated heap objects (see 'go doc runtime.MemStats.HeapAlloc')"),
+		instrument.WithUnit(unit.Bytes),
+		instrument.WithInt64Callback(func(_ context.Context, o instrument.Int64Observer) error {
+			o.Observe(pm.updateAllocMem())
+			return nil
+		}))
+	errs = multierr.Append(errs, err)
+
+	pm.otelTotalAllocMem, err = meter.Int64ObservableCounter(
+		"process_runtime_total_alloc_bytes",
+		instrument.WithDescription("Cumulative bytes allocated for heap objects (see 'go doc runtime.MemStats.TotalAlloc')"),
+		instrument.WithUnit(unit.Bytes),
+		instrument.WithInt64Callback(func(_ context.Context, o instrument.Int64Observer) error {
+			o.Observe(pm.updateTotalAllocMem())
+			return nil
+		}))
+	errs = multierr.Append(errs, err)
+
+	pm.otelSysMem, err = meter.Int64ObservableGauge(
+		"process_runtime_total_sys_memory_bytes",
+		instrument.WithDescription("Total bytes of memory obtained from the OS (see 'go doc runtime.MemStats.Sys')"),
+		instrument.WithUnit(unit.Bytes),
+		instrument.WithInt64Callback(func(_ context.Context, o instrument.Int64Observer) error {
+			o.Observe(pm.updateSysMem())
+			return nil
+		}))
+	errs = multierr.Append(errs, err)
+
+	pm.otelCPUSeconds, err = meter.Float64ObservableCounter(
+		"process_cpu_seconds",
+		instrument.WithDescription("Total CPU user and system time in seconds"),
+		instrument.WithUnit(unit.Unit("s")),
+		instrument.WithFloat64Callback(func(_ context.Context, o instrument.Float64Observer) error {
+			o.Observe(pm.updateCPUSeconds())
+			return nil
+		}))
+	errs = multierr.Append(errs, err)
+
+	pm.otelRSSMemory, err = meter.Int64ObservableGauge(
+		"process_memory_rss",
+		instrument.WithDescription("Total physical memory (resident set size)"),
+		instrument.WithUnit(unit.Bytes),
+		instrument.WithInt64Callback(func(_ context.Context, o instrument.Int64Observer) error {
+			o.Observe(pm.updateRSSMemory())
+			return nil
+		}))
+	errs = multierr.Append(errs, err)
+
+	return errs
+}
+
 func (pm *processMetrics) updateProcessUptime() float64 {
 	now := time.Now().UnixNano()
 	return float64(now-pm.startTimeUnixNano) / 1e9
diff --git a/service/pipelines.go b/service/pipelines.go
index 4659ad88a7a0..edfcbf2d5834 100644
--- a/service/pipelines.go
+++ b/service/pipelines.go
@@ -194,10 +194,10 @@ type pipelinesSettings struct {
 	Telemetry component.TelemetrySettings
 	BuildInfo component.BuildInfo
 
-	Receivers  *receiver.Builder
-	Processors *processor.Builder
-	Exporters  *exporter.Builder
-	Connectors *connector.Builder
+	ReceiverBuilder  *receiver.Builder
+	ProcessorBuilder *processor.Builder
+	ExporterBuilder  *exporter.Builder
+	ConnectorBuilder *connector.Builder
 
 	// PipelineConfigs is a map of component.ID to PipelineConfig.
 	PipelineConfigs map[component.ID]*PipelineConfig
@@ -245,7 +245,7 @@ func buildPipelines(ctx context.Context, set pipelinesSettings) (pipelines, erro
 				BuildInfo:         set.BuildInfo,
 			}
 			cSet.TelemetrySettings.Logger = components.ExporterLogger(set.Telemetry.Logger, expID, pipelineID.Type())
-			exp, err := buildExporter(ctx, cSet, set.Exporters, pipelineID)
+			exp, err := buildExporter(ctx, cSet, set.ExporterBuilder, pipelineID)
 			if err != nil {
 				return nil, err
 			}
@@ -279,7 +279,7 @@ func buildPipelines(ctx context.Context, set pipelinesSettings) (pipelines, erro
 				BuildInfo:         set.BuildInfo,
 			}
 			cSet.TelemetrySettings.Logger = components.ProcessorLogger(set.Telemetry.Logger, procID, pipelineID)
-			proc, err := buildProcessor(ctx, cSet, set.Processors, pipelineID, bp.lastConsumer)
+			proc, err := buildProcessor(ctx, cSet, set.ProcessorBuilder, pipelineID, bp.lastConsumer)
 			if err != nil {
 				return nil, err
 			}
@@ -336,7 +336,7 @@ func buildPipelines(ctx context.Context, set pipelinesSettings) (pipelines, erro
 				BuildInfo:         set.BuildInfo,
 			}
 			cSet.TelemetrySettings.Logger = components.ReceiverLogger(set.Telemetry.Logger, recvID, pipelineID.Type())
-			recv, err := buildReceiver(ctx, cSet, set.Receivers, pipelineID, receiversConsumers[pipelineID.Type()][recvID])
+			recv, err := buildReceiver(ctx, cSet, set.ReceiverBuilder, pipelineID, receiversConsumers[pipelineID.Type()][recvID])
 			if err != nil {
 				return nil, err
 			}
diff --git a/service/service.go b/service/service.go
index c63c8fff64a2..df4753efbf42 100644
--- a/service/service.go
+++ b/service/service.go
@@ -190,13 +190,13 @@ func (srv *Service) initExtensionsAndPipeline(ctx context.Context, set Settings,
 	}
 
 	pSet := pipelinesSettings{
-		Telemetry:       srv.telemetrySettings,
-		BuildInfo:       srv.buildInfo,
-		Receivers:       set.Receivers,
-		Processors:      set.Processors,
-		Exporters:       set.Exporters,
-		Connectors:      set.Connectors,
-		PipelineConfigs: cfg.Pipelines,
+		Telemetry:        srv.telemetrySettings,
+		BuildInfo:        srv.buildInfo,
+		ReceiverBuilder:  set.Receivers,
+		ProcessorBuilder: set.Processors,
+		ExporterBuilder:  set.Exporters,
+		ConnectorBuilder: set.Connectors,
+		PipelineConfigs:  cfg.Pipelines,
 	}
 
 	if sharedgate.ConnectorsFeatureGate.IsEnabled() {
@@ -211,7 +211,7 @@ func (srv *Service) initExtensionsAndPipeline(ctx context.Context, set Settings,
 
 	if cfg.Telemetry.Metrics.Level != configtelemetry.LevelNone && cfg.Telemetry.Metrics.Address != "" {
 		// The process telemetry initialization requires the ballast size, which is available after the extensions are initialized.
-		if err = proctelemetry.RegisterProcessMetrics(srv.telemetryInitializer.ocRegistry, getBallastSize(srv.host)); err != nil {
+		if err = proctelemetry.RegisterProcessMetrics(srv.telemetryInitializer.ocRegistry, srv.telemetryInitializer.mp, obsreportconfig.UseOtelForInternalMetricsfeatureGate.IsEnabled(), getBallastSize(srv.host)); err != nil {
 			return fmt.Errorf("failed to register process metrics: %w", err)
 		}
 	}



Test patch:
diff --git a/cmd/builder/internal/builder/main_test.go b/cmd/builder/internal/builder/main_test.go
index 3e26b1435c24..8420d8da75f4 100644
--- a/cmd/builder/internal/builder/main_test.go
+++ b/cmd/builder/internal/builder/main_test.go
@@ -82,6 +82,16 @@ func TestGenerateAndCompile(t *testing.T) {
 				return cfg
 			},
 		},
+		{
+			testCase: "LDFlags Compilation",
+			cfgBuilder: func(t *testing.T) Config {
+				cfg := NewDefaultConfig()
+				cfg.Distribution.OutputPath = t.TempDir()
+				cfg.Replaces = append(cfg.Replaces, replaces...)
+				cfg.LDFlags = `-X "test.gitVersion=0743dc6c6411272b98494a9b32a63378e84c34da" -X "test.gitTag=local-testing" -X "test.goVersion=go version go1.19.4 darwin/amd64"`
+				return cfg
+			},
+		},
 		{
 			testCase: "Debug Compilation",
 			cfgBuilder: func(t *testing.T) Config {
diff --git a/pdata/pcommon/map_test.go b/pdata/pcommon/map_test.go
index 93b85822fea0..f60d44980589 100644
--- a/pdata/pcommon/map_test.go
+++ b/pdata/pcommon/map_test.go
@@ -61,11 +61,6 @@ func TestMap(t *testing.T) {
 	removeMap := NewMap()
 	assert.False(t, removeMap.Remove("k"))
 	assert.EqualValues(t, NewMap(), removeMap)
-
-	// Test Sort
-	sortMap := NewMap()
-	sortMap.Sort()
-	assert.EqualValues(t, NewMap(), sortMap)
 }
 
 func TestMapPutEmpty(t *testing.T) {
@@ -262,10 +257,6 @@ func TestMapWithEmpty(t *testing.T) {
 
 	_, exist = sm.Get("test_key3")
 	assert.False(t, exist)
-
-	// Test Sort
-	sm.Sort()
-	assert.EqualValues(t, newMap(&origWithNil), sm)
 }
 
 func TestMapIterationNil(t *testing.T) {
diff --git a/pdata/plog/logs_test.go b/pdata/plog/logs_test.go
index ae740684e51d..64eba4d74d2f 100644
--- a/pdata/plog/logs_test.go
+++ b/pdata/plog/logs_test.go
@@ -132,32 +132,3 @@ func TestLogsCopyTo(t *testing.T) {
 	logs.CopyTo(logsCopy)
 	assert.EqualValues(t, logs, logsCopy)
 }
-
-func TestSeverityNumberString(t *testing.T) {
-	assert.EqualValues(t, "Unspecified", SeverityNumberUnspecified.String())
-	assert.EqualValues(t, "Trace", SeverityNumberTrace.String())
-	assert.EqualValues(t, "Trace2", SeverityNumberTrace2.String())
-	assert.EqualValues(t, "Trace3", SeverityNumberTrace3.String())
-	assert.EqualValues(t, "Trace4", SeverityNumberTrace4.String())
-	assert.EqualValues(t, "Debug", SeverityNumberDebug.String())
-	assert.EqualValues(t, "Debug2", SeverityNumberDebug2.String())
-	assert.EqualValues(t, "Debug3", SeverityNumberDebug3.String())
-	assert.EqualValues(t, "Debug4", SeverityNumberDebug4.String())
-	assert.EqualValues(t, "Info", SeverityNumberInfo.String())
-	assert.EqualValues(t, "Info2", SeverityNumberInfo2.String())
-	assert.EqualValues(t, "Info3", SeverityNumberInfo3.String())
-	assert.EqualValues(t, "Info4", SeverityNumberInfo4.String())
-	assert.EqualValues(t, "Warn", SeverityNumberWarn.String())
-	assert.EqualValues(t, "Warn2", SeverityNumberWarn2.String())
-	assert.EqualValues(t, "Warn3", SeverityNumberWarn3.String())
-	assert.EqualValues(t, "Warn4", SeverityNumberWarn4.String())
-	assert.EqualValues(t, "Error", SeverityNumberError.String())
-	assert.EqualValues(t, "Error2", SeverityNumberError2.String())
-	assert.EqualValues(t, "Error3", SeverityNumberError3.String())
-	assert.EqualValues(t, "Error4", SeverityNumberError4.String())
-	assert.EqualValues(t, "Fatal", SeverityNumberFatal.String())
-	assert.EqualValues(t, "Fatal2", SeverityNumberFatal2.String())
-	assert.EqualValues(t, "Fatal3", SeverityNumberFatal3.String())
-	assert.EqualValues(t, "Fatal4", SeverityNumberFatal4.String())
-	assert.EqualValues(t, "", SeverityNumber(100).String())
-}
diff --git a/pdata/plog/severity_number_test.go b/pdata/plog/severity_number_test.go
new file mode 100644
index 000000000000..1156e74b03c7
--- /dev/null
+++ b/pdata/plog/severity_number_test.go
@@ -0,0 +1,50 @@
+// Copyright The OpenTelemetry Authors
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//       http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package plog // import "go.opentelemetry.io/collector/pdata/plog"
+
+import (
+	"testing"
+
+	"github.com/stretchr/testify/assert"
+)
+
+func TestSeverityNumberString(t *testing.T) {
+	assert.EqualValues(t, "Unspecified", SeverityNumberUnspecified.String())
+	assert.EqualValues(t, "Trace", SeverityNumberTrace.String())
+	assert.EqualValues(t, "Trace2", SeverityNumberTrace2.String())
+	assert.EqualValues(t, "Trace3", SeverityNumberTrace3.String())
+	assert.EqualValues(t, "Trace4", SeverityNumberTrace4.String())
+	assert.EqualValues(t, "Debug", SeverityNumberDebug.String())
+	assert.EqualValues(t, "Debug2", SeverityNumberDebug2.String())
+	assert.EqualValues(t, "Debug3", SeverityNumberDebug3.String())
+	assert.EqualValues(t, "Debug4", SeverityNumberDebug4.String())
+	assert.EqualValues(t, "Info", SeverityNumberInfo.String())
+	assert.EqualValues(t, "Info2", SeverityNumberInfo2.String())
+	assert.EqualValues(t, "Info3", SeverityNumberInfo3.String())
+	assert.EqualValues(t, "Info4", SeverityNumberInfo4.String())
+	assert.EqualValues(t, "Warn", SeverityNumberWarn.String())
+	assert.EqualValues(t, "Warn2", SeverityNumberWarn2.String())
+	assert.EqualValues(t, "Warn3", SeverityNumberWarn3.String())
+	assert.EqualValues(t, "Warn4", SeverityNumberWarn4.String())
+	assert.EqualValues(t, "Error", SeverityNumberError.String())
+	assert.EqualValues(t, "Error2", SeverityNumberError2.String())
+	assert.EqualValues(t, "Error3", SeverityNumberError3.String())
+	assert.EqualValues(t, "Error4", SeverityNumberError4.String())
+	assert.EqualValues(t, "Fatal", SeverityNumberFatal.String())
+	assert.EqualValues(t, "Fatal2", SeverityNumberFatal2.String())
+	assert.EqualValues(t, "Fatal3", SeverityNumberFatal3.String())
+	assert.EqualValues(t, "Fatal4", SeverityNumberFatal4.String())
+	assert.EqualValues(t, "", SeverityNumber(100).String())
+}
diff --git a/pdata/pmetric/aggregation_temporality_test.go b/pdata/pmetric/aggregation_temporality_test.go
new file mode 100644
index 000000000000..22f102a01749
--- /dev/null
+++ b/pdata/pmetric/aggregation_temporality_test.go
@@ -0,0 +1,28 @@
+// Copyright The OpenTelemetry Authors
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//       http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package pmetric // import "go.opentelemetry.io/collector/pdata/pmetric"
+
+import (
+	"testing"
+
+	"github.com/stretchr/testify/assert"
+)
+
+func TestAggregationTemporalityString(t *testing.T) {
+	assert.Equal(t, "Unspecified", AggregationTemporalityUnspecified.String())
+	assert.Equal(t, "Delta", AggregationTemporalityDelta.String())
+	assert.Equal(t, "Cumulative", AggregationTemporalityCumulative.String())
+	assert.Equal(t, "", (AggregationTemporalityCumulative + 1).String())
+}
diff --git a/pdata/pmetric/exemplar_value_type_test.go b/pdata/pmetric/exemplar_value_type_test.go
new file mode 100644
index 000000000000..26f3e26cc28e
--- /dev/null
+++ b/pdata/pmetric/exemplar_value_type_test.go
@@ -0,0 +1,28 @@
+// Copyright The OpenTelemetry Authors
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//       http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package pmetric // import "go.opentelemetry.io/collector/pdata/pmetric"
+
+import (
+	"testing"
+
+	"github.com/stretchr/testify/assert"
+)
+
+func TestExemplarValueTypeString(t *testing.T) {
+	assert.Equal(t, "Empty", ExemplarValueTypeEmpty.String())
+	assert.Equal(t, "Int", ExemplarValueTypeInt.String())
+	assert.Equal(t, "Double", ExemplarValueTypeDouble.String())
+	assert.Equal(t, "", (ExemplarValueTypeDouble + 1).String())
+}
diff --git a/pdata/pmetric/metric_type_test.go b/pdata/pmetric/metric_type_test.go
new file mode 100644
index 000000000000..6e4fc87bb2f7
--- /dev/null
+++ b/pdata/pmetric/metric_type_test.go
@@ -0,0 +1,31 @@
+// Copyright The OpenTelemetry Authors
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//       http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package pmetric // import "go.opentelemetry.io/collector/pdata/pmetric"
+
+import (
+	"testing"
+
+	"github.com/stretchr/testify/assert"
+)
+
+func TestMetricTypeString(t *testing.T) {
+	assert.Equal(t, "Empty", MetricTypeEmpty.String())
+	assert.Equal(t, "Gauge", MetricTypeGauge.String())
+	assert.Equal(t, "Sum", MetricTypeSum.String())
+	assert.Equal(t, "Histogram", MetricTypeHistogram.String())
+	assert.Equal(t, "ExponentialHistogram", MetricTypeExponentialHistogram.String())
+	assert.Equal(t, "Summary", MetricTypeSummary.String())
+	assert.Equal(t, "", (MetricTypeSummary + 1).String())
+}
diff --git a/pdata/pmetric/metrics_test.go b/pdata/pmetric/metrics_test.go
index 7927744425d8..54d026d38882 100644
--- a/pdata/pmetric/metrics_test.go
+++ b/pdata/pmetric/metrics_test.go
@@ -34,37 +34,6 @@ const (
 	endTime   = uint64(12578940000000054321)
 )
 
-func TestMetricTypeString(t *testing.T) {
-	assert.Equal(t, "Empty", MetricTypeEmpty.String())
-	assert.Equal(t, "Gauge", MetricTypeGauge.String())
-	assert.Equal(t, "Sum", MetricTypeSum.String())
-	assert.Equal(t, "Histogram", MetricTypeHistogram.String())
-	assert.Equal(t, "ExponentialHistogram", MetricTypeExponentialHistogram.String())
-	assert.Equal(t, "Summary", MetricTypeSummary.String())
-	assert.Equal(t, "", (MetricTypeSummary + 1).String())
-}
-
-func TestAggregationTemporalityString(t *testing.T) {
-	assert.Equal(t, "Unspecified", AggregationTemporalityUnspecified.String())
-	assert.Equal(t, "Delta", AggregationTemporalityDelta.String())
-	assert.Equal(t, "Cumulative", AggregationTemporalityCumulative.String())
-	assert.Equal(t, "", (AggregationTemporalityCumulative + 1).String())
-}
-
-func TestNumberDataPointValueTypeString(t *testing.T) {
-	assert.Equal(t, "Empty", NumberDataPointValueTypeEmpty.String())
-	assert.Equal(t, "Int", NumberDataPointValueTypeInt.String())
-	assert.Equal(t, "Double", NumberDataPointValueTypeDouble.String())
-	assert.Equal(t, "", (NumberDataPointValueTypeDouble + 1).String())
-}
-
-func TestExemplarValueTypeString(t *testing.T) {
-	assert.Equal(t, "Empty", ExemplarValueTypeEmpty.String())
-	assert.Equal(t, "Int", ExemplarValueTypeInt.String())
-	assert.Equal(t, "Double", ExemplarValueTypeDouble.String())
-	assert.Equal(t, "", (ExemplarValueTypeDouble + 1).String())
-}
-
 func TestResourceMetricsWireCompatibility(t *testing.T) {
 	// This test verifies that OTLP ProtoBufs generated using goproto lib in
 	// opentelemetry-proto repository OTLP ProtoBufs generated using gogoproto lib in
diff --git a/pdata/pmetric/number_data_point_value_type_test.go b/pdata/pmetric/number_data_point_value_type_test.go
new file mode 100644
index 000000000000..8db55682c07c
--- /dev/null
+++ b/pdata/pmetric/number_data_point_value_type_test.go
@@ -0,0 +1,28 @@
+// Copyright The OpenTelemetry Authors
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//       http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package pmetric // import "go.opentelemetry.io/collector/pdata/pmetric"
+
+import (
+	"testing"
+
+	"github.com/stretchr/testify/assert"
+)
+
+func TestNumberDataPointValueTypeString(t *testing.T) {
+	assert.Equal(t, "Empty", NumberDataPointValueTypeEmpty.String())
+	assert.Equal(t, "Int", NumberDataPointValueTypeInt.String())
+	assert.Equal(t, "Double", NumberDataPointValueTypeDouble.String())
+	assert.Equal(t, "", (NumberDataPointValueTypeDouble + 1).String())
+}
diff --git a/pdata/ptrace/span_kind_test.go b/pdata/ptrace/span_kind_test.go
new file mode 100644
index 000000000000..1ce1a863463d
--- /dev/null
+++ b/pdata/ptrace/span_kind_test.go
@@ -0,0 +1,31 @@
+// Copyright The OpenTelemetry Authors
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//       http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package ptrace // import "go.opentelemetry.io/collector/pdata/ptrace"
+
+import (
+	"testing"
+
+	"github.com/stretchr/testify/assert"
+)
+
+func TestSpanKindString(t *testing.T) {
+	assert.EqualValues(t, "Unspecified", SpanKindUnspecified.String())
+	assert.EqualValues(t, "Internal", SpanKindInternal.String())
+	assert.EqualValues(t, "Server", SpanKindServer.String())
+	assert.EqualValues(t, "Client", SpanKindClient.String())
+	assert.EqualValues(t, "Producer", SpanKindProducer.String())
+	assert.EqualValues(t, "Consumer", SpanKindConsumer.String())
+	assert.EqualValues(t, "", SpanKind(100).String())
+}
diff --git a/pdata/ptrace/status_code_test.go b/pdata/ptrace/status_code_test.go
new file mode 100644
index 000000000000..a36e6c5a4b4e
--- /dev/null
+++ b/pdata/ptrace/status_code_test.go
@@ -0,0 +1,28 @@
+// Copyright The OpenTelemetry Authors
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//       http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package ptrace // import "go.opentelemetry.io/collector/pdata/ptrace"
+
+import (
+	"testing"
+
+	"github.com/stretchr/testify/assert"
+)
+
+func TestStatusCodeString(t *testing.T) {
+	assert.EqualValues(t, "Unset", StatusCodeUnset.String())
+	assert.EqualValues(t, "Ok", StatusCodeOk.String())
+	assert.EqualValues(t, "Error", StatusCodeError.String())
+	assert.EqualValues(t, "", StatusCode(100).String())
+}
diff --git a/pdata/ptrace/traces_test.go b/pdata/ptrace/traces_test.go
index 1b99aff0b81d..b2fc63529d69 100644
--- a/pdata/ptrace/traces_test.go
+++ b/pdata/ptrace/traces_test.go
@@ -133,20 +133,3 @@ func TestTracesCopyTo(t *testing.T) {
 	traces.CopyTo(tracesCopy)
 	assert.EqualValues(t, traces, tracesCopy)
 }
-
-func TestSpanKindString(t *testing.T) {
-	assert.EqualValues(t, "Unspecified", SpanKindUnspecified.String())
-	assert.EqualValues(t, "Internal", SpanKindInternal.String())
-	assert.EqualValues(t, "Server", SpanKindServer.String())
-	assert.EqualValues(t, "Client", SpanKindClient.String())
-	assert.EqualValues(t, "Producer", SpanKindProducer.String())
-	assert.EqualValues(t, "Consumer", SpanKindConsumer.String())
-	assert.EqualValues(t, "", SpanKind(100).String())
-}
-
-func TestStatusCodeString(t *testing.T) {
-	assert.EqualValues(t, "Unset", StatusCodeUnset.String())
-	assert.EqualValues(t, "Ok", StatusCodeOk.String())
-	assert.EqualValues(t, "Error", StatusCodeError.String())
-	assert.EqualValues(t, "", StatusCode(100).String())
-}
diff --git a/service/internal/proctelemetry/process_telemetry_test.go b/service/internal/proctelemetry/process_telemetry_test.go
index 26435a78a9be..c24b933c0d6c 100644
--- a/service/internal/proctelemetry/process_telemetry_test.go
+++ b/service/internal/proctelemetry/process_telemetry_test.go
@@ -15,15 +15,41 @@
 package proctelemetry
 
 import (
+	"context"
+	"net/http"
+	"net/http/httptest"
+	"strings"
 	"testing"
 	"time"
 
+	"github.com/prometheus/client_golang/prometheus"
+	"github.com/prometheus/client_golang/prometheus/promhttp"
+	io_prometheus_client "github.com/prometheus/client_model/go"
+	"github.com/prometheus/common/expfmt"
 	"github.com/stretchr/testify/assert"
 	"github.com/stretchr/testify/require"
 	"go.opencensus.io/metric"
 	"go.opencensus.io/metric/metricdata"
+	"go.opencensus.io/stats/view"
+	otelprom "go.opentelemetry.io/otel/exporters/prometheus"
+	otelmetric "go.opentelemetry.io/otel/metric"
+	sdkmetric "go.opentelemetry.io/otel/sdk/metric"
+	"go.opentelemetry.io/otel/sdk/resource"
+
+	"go.opentelemetry.io/collector/component"
+	"go.opentelemetry.io/collector/component/componenttest"
+	"go.opentelemetry.io/collector/config/configtelemetry"
+	"go.opentelemetry.io/collector/internal/obsreportconfig"
 )
 
+type testTelemetry struct {
+	component.TelemetrySettings
+	views           []*view.View
+	promHandler     http.Handler
+	meterProvider   *sdkmetric.MeterProvider
+	expectedMetrics []string
+}
+
 var expectedMetrics = []string{
 	// Changing a metric name is a breaking change.
 	// Adding new metrics is ok as long it follows the conventions described at
@@ -36,14 +62,98 @@ var expectedMetrics = []string{
 	"process/memory/rss",
 }
 
-func TestProcessTelemetry(t *testing.T) {
-	registry := metric.NewRegistry()
-	require.NoError(t, RegisterProcessMetrics(registry, 0))
+var otelExpectedMetrics = []string{
+	// OTel Go adds `_total` suffix
+	"process_uptime",
+	"process_runtime_heap_alloc_bytes",
+	"process_runtime_total_alloc_bytes",
+	"process_runtime_total_sys_memory_bytes",
+	"process_cpu_seconds",
+	"process_memory_rss",
+}
+
+func setupTelemetry(t *testing.T) testTelemetry {
+	settings := testTelemetry{
+		TelemetrySettings: componenttest.NewNopTelemetrySettings(),
+		expectedMetrics:   otelExpectedMetrics,
+	}
+	settings.TelemetrySettings.MetricsLevel = configtelemetry.LevelNormal
+
+	settings.views = obsreportconfig.AllViews(configtelemetry.LevelNormal)
+	err := view.Register(settings.views...)
+	require.NoError(t, err)
+
+	promReg := prometheus.NewRegistry()
+	exporter, err := otelprom.New(otelprom.WithRegisterer(promReg), otelprom.WithoutUnits())
+	require.NoError(t, err)
+
+	settings.meterProvider = sdkmetric.NewMeterProvider(
+		sdkmetric.WithResource(resource.Empty()),
+		sdkmetric.WithReader(exporter),
+	)
+	settings.TelemetrySettings.MeterProvider = settings.meterProvider
+
+	settings.promHandler = promhttp.HandlerFor(promReg, promhttp.HandlerOpts{})
+
+	t.Cleanup(func() { assert.NoError(t, settings.meterProvider.Shutdown(context.Background())) })
+
+	return settings
+}
+
+func fetchPrometheusMetrics(handler http.Handler) (map[string]*io_prometheus_client.MetricFamily, error) {
+	req, err := http.NewRequest("GET", "/metrics", nil)
+	if err != nil {
+		return nil, err
+	}
+
+	rr := httptest.NewRecorder()
+	handler.ServeHTTP(rr, req)
+
+	var parser expfmt.TextParser
+	return parser.TextToMetricFamilies(rr.Body)
+}
+
+func TestOtelProcessTelemetry(t *testing.T) {
+	tel := setupTelemetry(t)
+
+	require.NoError(t, RegisterProcessMetrics(nil, tel.MeterProvider, true, 0))
+
+	mp, err := fetchPrometheusMetrics(tel.promHandler)
+	require.NoError(t, err)
+
+	for _, metricName := range tel.expectedMetrics {
+		metric, ok := mp[metricName]
+		if !ok {
+			withSuffix := metricName + "_total"
+			metric, ok = mp[withSuffix]
+		}
+		require.True(t, ok)
+		require.True(t, len(metric.Metric) == 1)
+		var metricValue float64
+		if metric.GetType() == io_prometheus_client.MetricType_COUNTER {
+			metricValue = metric.Metric[0].GetCounter().GetValue()
+		} else {
+			metricValue = metric.Metric[0].GetGauge().GetValue()
+		}
+		if strings.HasPrefix(metricName, "process_uptime") || strings.HasPrefix(metricName, "process_cpu_seconds") {
+			// This likely will still be zero when running the test.
+			assert.GreaterOrEqual(t, metricValue, float64(0), metricName)
+			continue
+		}
+
+		assert.Greater(t, metricValue, float64(0), metricName)
+	}
+}
+
+func TestOCProcessTelemetry(t *testing.T) {
+	ocRegistry := metric.NewRegistry()
+
+	require.NoError(t, RegisterProcessMetrics(ocRegistry, otelmetric.NewNoopMeterProvider(), false, 0))
 
 	// Check that the metrics are actually filled.
 	<-time.After(200 * time.Millisecond)
 
-	metrics := registry.Read()
+	metrics := ocRegistry.Read()
 
 	for _, metricName := range expectedMetrics {
 		m := findMetric(metrics, metricName)
@@ -62,22 +172,21 @@ func TestProcessTelemetry(t *testing.T) {
 
 		if metricName == "process/uptime" || metricName == "process/cpu_seconds" {
 			// This likely will still be zero when running the test.
-			assert.True(t, value >= 0, metricName)
+			assert.GreaterOrEqual(t, value, float64(0), metricName)
 			continue
 		}
 
-		assert.True(t, value > 0, metricName)
+		assert.Greater(t, value, float64(0), metricName)
 	}
 }
 
 func TestProcessTelemetryFailToRegister(t *testing.T) {
-
 	for _, metricName := range expectedMetrics {
 		t.Run(metricName, func(t *testing.T) {
-			registry := metric.NewRegistry()
-			_, err := registry.AddFloat64Gauge(metricName)
+			ocRegistry := metric.NewRegistry()
+			_, err := ocRegistry.AddFloat64Gauge(metricName)
 			require.NoError(t, err)
-			assert.Error(t, RegisterProcessMetrics(registry, 0))
+			assert.Error(t, RegisterProcessMetrics(ocRegistry, otelmetric.NewNoopMeterProvider(), false, 0))
 		})
 	}
 }
diff --git a/service/pipelines_test.go b/service/pipelines_test.go
index 5d6704a8dcab..d1f47904e91d 100644
--- a/service/pipelines_test.go
+++ b/service/pipelines_test.go
@@ -184,7 +184,7 @@ func TestBuildPipelines(t *testing.T) {
 			pips, err := buildPipelines(context.Background(), pipelinesSettings{
 				Telemetry: componenttest.NewNopTelemetrySettings(),
 				BuildInfo: component.NewDefaultBuildInfo(),
-				Receivers: receiver.NewBuilder(
+				ReceiverBuilder: receiver.NewBuilder(
 					map[component.ID]component.Config{
 						component.NewID("examplereceiver"):              testcomponents.ExampleReceiverFactory.CreateDefaultConfig(),
 						component.NewIDWithName("examplereceiver", "1"): testcomponents.ExampleReceiverFactory.CreateDefaultConfig(),
@@ -192,7 +192,7 @@ func TestBuildPipelines(t *testing.T) {
 					map[component.Type]receiver.Factory{
 						testcomponents.ExampleReceiverFactory.Type(): testcomponents.ExampleReceiverFactory,
 					}),
-				Processors: processor.NewBuilder(
+				ProcessorBuilder: processor.NewBuilder(
 					map[component.ID]component.Config{
 						component.NewID("exampleprocessor"):              testcomponents.ExampleProcessorFactory.CreateDefaultConfig(),
 						component.NewIDWithName("exampleprocessor", "1"): testcomponents.ExampleProcessorFactory.CreateDefaultConfig(),
@@ -200,7 +200,7 @@ func TestBuildPipelines(t *testing.T) {
 					map[component.Type]processor.Factory{
 						testcomponents.ExampleProcessorFactory.Type(): testcomponents.ExampleProcessorFactory,
 					}),
-				Exporters: exporter.NewBuilder(
+				ExporterBuilder: exporter.NewBuilder(
 					map[component.ID]component.Config{
 						component.NewID("exampleexporter"):              testcomponents.ExampleExporterFactory.CreateDefaultConfig(),
 						component.NewIDWithName("exampleexporter", "1"): testcomponents.ExampleExporterFactory.CreateDefaultConfig(),
@@ -579,19 +579,19 @@ func TestBuildErrors(t *testing.T) {
 			set := pipelinesSettings{
 				Telemetry: componenttest.NewNopTelemetrySettings(),
 				BuildInfo: component.NewDefaultBuildInfo(),
-				Receivers: receiver.NewBuilder(
+				ReceiverBuilder: receiver.NewBuilder(
 					test.ReceiverConfigs,
 					map[component.Type]receiver.Factory{
 						nopReceiverFactory.Type(): nopReceiverFactory,
 						badReceiverFactory.Type(): badReceiverFactory,
 					}),
-				Processors: processor.NewBuilder(
+				ProcessorBuilder: processor.NewBuilder(
 					test.ProcessorConfigs,
 					map[component.Type]processor.Factory{
 						nopProcessorFactory.Type(): nopProcessorFactory,
 						badProcessorFactory.Type(): badProcessorFactory,
 					}),
-				Exporters: exporter.NewBuilder(
+				ExporterBuilder: exporter.NewBuilder(
 					test.ExporterConfigs,
 					map[component.Type]exporter.Factory{
 						nopExporterFactory.Type(): nopExporterFactory,
@@ -617,7 +617,7 @@ func TestFailToStartAndShutdown(t *testing.T) {
 	set := pipelinesSettings{
 		Telemetry: componenttest.NewNopTelemetrySettings(),
 		BuildInfo: component.NewDefaultBuildInfo(),
-		Receivers: receiver.NewBuilder(
+		ReceiverBuilder: receiver.NewBuilder(
 			map[component.ID]component.Config{
 				component.NewID(nopReceiverFactory.Type()): nopReceiverFactory.CreateDefaultConfig(),
 				component.NewID(errReceiverFactory.Type()): errReceiverFactory.CreateDefaultConfig(),
@@ -626,7 +626,7 @@ func TestFailToStartAndShutdown(t *testing.T) {
 				nopReceiverFactory.Type(): nopReceiverFactory,
 				errReceiverFactory.Type(): errReceiverFactory,
 			}),
-		Processors: processor.NewBuilder(
+		ProcessorBuilder: processor.NewBuilder(
 			map[component.ID]component.Config{
 				component.NewID(nopProcessorFactory.Type()): nopProcessorFactory.CreateDefaultConfig(),
 				component.NewID(errProcessorFactory.Type()): errProcessorFactory.CreateDefaultConfig(),
@@ -635,7 +635,7 @@ func TestFailToStartAndShutdown(t *testing.T) {
 				nopProcessorFactory.Type(): nopProcessorFactory,
 				errProcessorFactory.Type(): errProcessorFactory,
 			}),
-		Exporters: exporter.NewBuilder(
+		ExporterBuilder: exporter.NewBuilder(
 			map[component.ID]component.Config{
 				component.NewID(nopExporterFactory.Type()): nopExporterFactory.CreateDefaultConfig(),
 				component.NewID(errExporterFactory.Type()): errExporterFactory.CreateDefaultConfig(),
diff --git a/service/service_test.go b/service/service_test.go
index 7bfd1265ec5b..2a2a309663aa 100644
--- a/service/service_test.go
+++ b/service/service_test.go
@@ -269,7 +269,9 @@ func testCollectorStartHelper(t *testing.T, useOtel bool, tc ownMetricsTestCase)
 		// Sleep for 1 second to ensure the http server is started.
 		time.Sleep(1 * time.Second)
 		assert.True(t, loggingHookCalled)
-		assertMetrics(t, metricsAddr, tc.expectedLabels)
+		if !useOtel {
+			assertMetrics(t, metricsAddr, tc.expectedLabels)
+		}
 		assertZPages(t, zpagesAddr)
 		require.NoError(t, srv.Shutdown(context.Background()))
 	}