Skip to content

Commit

Permalink
Add pprofile wrapper and testdata (open-telemetry#10401)
Browse files Browse the repository at this point in the history
<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->
#### Description

This adds pprofile wrapper (the non-generated bit of pprofile), as well
as test data.

cc @mx-psi

---------

Co-authored-by: Pablo Baeyens <[email protected]>
  • Loading branch information
dmathieu and mx-psi authored Jun 24, 2024
1 parent 1d1ff4a commit 227fb82
Show file tree
Hide file tree
Showing 40 changed files with 347 additions and 5 deletions.
25 changes: 25 additions & 0 deletions .chloggen/pprofile-wrapper.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Use this changelog template to create an entry for release notes.

# 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: pdata/pprofile

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: Add pprofile wrapper to convert proto into pprofile.

# One or more tracking issues or pull requests related to the change
issues: [10401]

# (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:

# Optional: The change log or logs in which this entry should be included.
# e.g. '[user]' or '[user, api]'
# Include 'user' if the change is relevant to end users.
# Include 'api' if there is a change to a library API.
# Default: '[user]'
change_logs: [api]
25 changes: 25 additions & 0 deletions .chloggen/profile-testdata.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Use this changelog template to create an entry for release notes.

# 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: pdata/testdata

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: Add pdata testdata for profiles.

# One or more tracking issues or pull requests related to the change
issues: [10401]

# (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:

# Optional: The change log or logs in which this entry should be included.
# e.g. '[user]' or '[user, api]'
# Include 'user' if the change is relevant to end users.
# Include 'api' if there is a change to a library API.
# Default: '[user]'
change_logs: [api]
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,7 @@ check-contrib:
-replace go.opentelemetry.io/collector/otelcol/otelcoltest=$(CURDIR)/otelcol/otelcoltest \
-replace go.opentelemetry.io/collector/pdata=$(CURDIR)/pdata \
-replace go.opentelemetry.io/collector/pdata/testdata=$(CURDIR)/pdata/testdata \
-replace go.opentelemetry.io/collector/pdata/pprofile=$(CURDIR)/pdata/pprofile \
-replace go.opentelemetry.io/collector/processor=$(CURDIR)/processor \
-replace go.opentelemetry.io/collector/processor/batchprocessor=$(CURDIR)/processor/batchprocessor \
-replace go.opentelemetry.io/collector/processor/memorylimiterprocessor=$(CURDIR)/processor/memorylimiterprocessor \
Expand Down Expand Up @@ -341,6 +342,7 @@ restore-contrib:
-dropreplace go.opentelemetry.io/collector/otelcol/otelcoltest \
-dropreplace go.opentelemetry.io/collector/pdata \
-dropreplace go.opentelemetry.io/collector/pdata/testdata \
-dropreplace go.opentelemetry.io/collector/pdata/pprofile \
-dropreplace go.opentelemetry.io/collector/processor \
-dropreplace go.opentelemetry.io/collector/processor/batchprocessor \
-dropreplace go.opentelemetry.io/collector/processor/memorylimiterprocessor \
Expand Down
1 change: 1 addition & 0 deletions cmd/builder/internal/builder/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ var (
"/otelcol",
"/pdata",
"/pdata/testdata",
"/pdata/pprofile",
"/semconv",
"/service",
}
Expand Down
2 changes: 2 additions & 0 deletions cmd/mdatagen/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -87,3 +87,5 @@ retract (
v0.76.1
v0.65.0
)

replace go.opentelemetry.io/collector/pdata/pprofile => ../../pdata/pprofile
5 changes: 3 additions & 2 deletions cmd/otelcorecol/builder-config.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# NOTE:
# This builder configuration is NOT used to build any official binary.
# To see the builder manifests used for official binaries,
# To see the builder manifests used for official binaries,
# check https://github.com/open-telemetry/opentelemetry-collector-releases
#
#
# For the OpenTelemetry Collector Core official distribution sources, check
# https://github.com/open-telemetry/opentelemetry-collector-releases/tree/main/distributions/otelcol

Expand Down Expand Up @@ -77,6 +77,7 @@ replaces:
- go.opentelemetry.io/collector/featuregate => ../../featuregate
- go.opentelemetry.io/collector/pdata => ../../pdata
- go.opentelemetry.io/collector/pdata/testdata => ../../pdata/testdata
- go.opentelemetry.io/collector/pdata/pprofile => ../../pdata/pprofile
- go.opentelemetry.io/collector/processor => ../../processor
- go.opentelemetry.io/collector/receiver => ../../receiver
- go.opentelemetry.io/collector/receiver/nopreceiver => ../../receiver/nopreceiver
Expand Down
2 changes: 2 additions & 0 deletions cmd/otelcorecol/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,8 @@ replace go.opentelemetry.io/collector/pdata => ../../pdata

replace go.opentelemetry.io/collector/pdata/testdata => ../../pdata/testdata

replace go.opentelemetry.io/collector/pdata/pprofile => ../../pdata/pprofile

replace go.opentelemetry.io/collector/processor => ../../processor

replace go.opentelemetry.io/collector/receiver => ../../receiver
Expand Down
3 changes: 3 additions & 0 deletions config/configgrpc/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ require (
go.opentelemetry.io/collector/confmap v0.103.0 // indirect
go.opentelemetry.io/collector/extension v0.103.0 // indirect
go.opentelemetry.io/collector/featuregate v1.10.0 // indirect
go.opentelemetry.io/collector/pdata/pprofile v0.103.0 // indirect
go.opentelemetry.io/otel/exporters/prometheus v0.49.0 // indirect
go.opentelemetry.io/otel/metric v1.27.0 // indirect
go.opentelemetry.io/otel/sdk v1.27.0 // indirect
Expand Down Expand Up @@ -94,6 +95,8 @@ replace go.opentelemetry.io/collector/pdata => ../../pdata

replace go.opentelemetry.io/collector/pdata/testdata => ../../pdata/testdata

replace go.opentelemetry.io/collector/pdata/pprofile => ../../pdata/pprofile

replace go.opentelemetry.io/collector/component => ../../component

replace go.opentelemetry.io/collector/consumer => ../../consumer
2 changes: 2 additions & 0 deletions config/confighttp/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -91,3 +91,5 @@ replace go.opentelemetry.io/collector/component => ../../component
replace go.opentelemetry.io/collector/consumer => ../../consumer

replace go.opentelemetry.io/collector/pdata/testdata => ../../pdata/testdata

replace go.opentelemetry.io/collector/pdata/pprofile => ../../pdata/pprofile
2 changes: 2 additions & 0 deletions config/internal/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,5 @@ replace go.opentelemetry.io/collector/consumer => ../../consumer
replace go.opentelemetry.io/collector/component => ../../component

replace go.opentelemetry.io/collector/pdata/testdata => ../../pdata/testdata

replace go.opentelemetry.io/collector/pdata/pprofile => ../../pdata/pprofile
2 changes: 2 additions & 0 deletions confmap/converter/expandconverter/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,5 @@ replace go.opentelemetry.io/collector/pdata => ../../../pdata
replace go.opentelemetry.io/collector/featuregate => ../../../featuregate

replace go.opentelemetry.io/collector/consumer => ../../../consumer

replace go.opentelemetry.io/collector/pdata/pprofile => ../../../pdata/pprofile
2 changes: 2 additions & 0 deletions connector/forwardconnector/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -77,3 +77,5 @@ retract (
)

replace go.opentelemetry.io/collector/config/configtelemetry => ../../config/configtelemetry

replace go.opentelemetry.io/collector/pdata/pprofile => ../../pdata/pprofile
3 changes: 3 additions & 0 deletions connector/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ require (
github.com/prometheus/common v0.54.0 // indirect
github.com/prometheus/procfs v0.15.0 // indirect
go.opentelemetry.io/collector/config/configtelemetry v0.103.0 // indirect
go.opentelemetry.io/collector/pdata/pprofile v0.103.0 // indirect
go.opentelemetry.io/otel v1.27.0 // indirect
go.opentelemetry.io/otel/exporters/prometheus v0.49.0 // indirect
go.opentelemetry.io/otel/metric v1.27.0 // indirect
Expand Down Expand Up @@ -61,3 +62,5 @@ replace go.opentelemetry.io/collector/featuregate => ../featuregate
replace go.opentelemetry.io/collector/pdata => ../pdata

replace go.opentelemetry.io/collector/pdata/testdata => ../pdata/testdata

replace go.opentelemetry.io/collector/pdata/pprofile => ../pdata/pprofile
4 changes: 3 additions & 1 deletion consumer/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ require (
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/kr/text v0.2.0 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
go.opentelemetry.io/collector/pdata/pprofile v0.103.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
golang.org/x/net v0.23.0 // indirect
golang.org/x/sys v0.18.0 // indirect
Expand All @@ -31,6 +31,8 @@ replace go.opentelemetry.io/collector/pdata => ../pdata

replace go.opentelemetry.io/collector/pdata/testdata => ../pdata/testdata

replace go.opentelemetry.io/collector/pdata/pprofile => ../pdata/pprofile

retract (
v0.76.0 // Depends on retracted pdata v1.0.0-rc10 module, use v0.76.1
v0.69.0 // Release failed, use v0.69.1
Expand Down
1 change: 0 additions & 1 deletion consumer/go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions exporter/debugexporter/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ require (
go.opentelemetry.io/collector/config/configretry v0.103.0 // indirect
go.opentelemetry.io/collector/extension v0.103.0 // indirect
go.opentelemetry.io/collector/featuregate v1.10.0 // indirect
go.opentelemetry.io/collector/pdata/pprofile v0.103.0 // indirect
go.opentelemetry.io/collector/receiver v0.103.0 // indirect
go.opentelemetry.io/otel v1.27.0 // indirect
go.opentelemetry.io/otel/exporters/prometheus v0.49.0 // indirect
Expand Down Expand Up @@ -76,6 +77,8 @@ replace go.opentelemetry.io/collector/pdata => ../../pdata

replace go.opentelemetry.io/collector/pdata/testdata => ../../pdata/testdata

replace go.opentelemetry.io/collector/pdata/pprofile => ../../pdata/pprofile

replace go.opentelemetry.io/collector/receiver => ../../receiver

replace go.opentelemetry.io/collector/extension => ../../extension
Expand Down
3 changes: 3 additions & 0 deletions exporter/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ require (
github.com/prometheus/procfs v0.15.0 // indirect
go.opentelemetry.io/collector/confmap v0.103.0 // indirect
go.opentelemetry.io/collector/featuregate v1.10.0 // indirect
go.opentelemetry.io/collector/pdata/pprofile v0.103.0 // indirect
go.opentelemetry.io/otel/exporters/prometheus v0.49.0 // indirect
golang.org/x/net v0.25.0 // indirect
golang.org/x/text v0.15.0 // indirect
Expand All @@ -75,6 +76,8 @@ replace go.opentelemetry.io/collector/pdata => ../pdata

replace go.opentelemetry.io/collector/pdata/testdata => ../pdata/testdata

replace go.opentelemetry.io/collector/pdata/pprofile => ../pdata/pprofile

replace go.opentelemetry.io/collector/receiver => ../receiver

retract v0.76.0 // Depends on retracted pdata v1.0.0-rc10 module
Expand Down
2 changes: 2 additions & 0 deletions exporter/loggingexporter/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -88,3 +88,5 @@ retract (
replace go.opentelemetry.io/collector/config/configtelemetry => ../../config/configtelemetry

replace go.opentelemetry.io/collector/config/configretry => ../../config/configretry

replace go.opentelemetry.io/collector/pdata/pprofile => ../../pdata/pprofile
2 changes: 2 additions & 0 deletions exporter/nopexporter/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -78,3 +78,5 @@ replace go.opentelemetry.io/collector/confmap => ../../confmap
replace go.opentelemetry.io/collector/config/configtelemetry => ../../config/configtelemetry

replace go.opentelemetry.io/collector/extension => ../../extension

replace go.opentelemetry.io/collector/pdata/pprofile => ../../pdata/pprofile
3 changes: 3 additions & 0 deletions exporter/otlpexporter/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ require (
go.opentelemetry.io/collector/extension v0.103.0 // indirect
go.opentelemetry.io/collector/extension/auth v0.103.0 // indirect
go.opentelemetry.io/collector/featuregate v1.10.0 // indirect
go.opentelemetry.io/collector/pdata/pprofile v0.103.0 // indirect
go.opentelemetry.io/collector/receiver v0.103.0 // indirect
go.opentelemetry.io/contrib/config v0.7.0 // indirect
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.52.0 // indirect
Expand Down Expand Up @@ -116,6 +117,8 @@ replace go.opentelemetry.io/collector/pdata => ../../pdata

replace go.opentelemetry.io/collector/pdata/testdata => ../../pdata/testdata

replace go.opentelemetry.io/collector/pdata/pprofile => ../../pdata/pprofile

replace go.opentelemetry.io/collector/receiver => ../../receiver

replace go.opentelemetry.io/collector/consumer => ../../consumer
Expand Down
2 changes: 2 additions & 0 deletions exporter/otlphttpexporter/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,8 @@ replace go.opentelemetry.io/collector/pdata => ../../pdata

replace go.opentelemetry.io/collector/pdata/testdata => ../../pdata/testdata

replace go.opentelemetry.io/collector/pdata/pprofile => ../../pdata/pprofile

replace go.opentelemetry.io/collector/receiver => ../../receiver

replace go.opentelemetry.io/collector/consumer => ../../consumer
Expand Down
2 changes: 2 additions & 0 deletions extension/ballastextension/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -81,3 +81,5 @@ retract (
replace go.opentelemetry.io/collector/config/configtelemetry => ../../config/configtelemetry

replace go.opentelemetry.io/collector/pdata/testdata => ../../pdata/testdata

replace go.opentelemetry.io/collector/pdata/pprofile => ../../pdata/pprofile
2 changes: 2 additions & 0 deletions extension/memorylimiterextension/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -75,3 +75,5 @@ replace go.opentelemetry.io/collector/consumer => ../../consumer
replace go.opentelemetry.io/collector/config/configtelemetry => ../../config/configtelemetry

replace go.opentelemetry.io/collector/pdata/testdata => ../../pdata/testdata

replace go.opentelemetry.io/collector/pdata/pprofile => ../../pdata/pprofile
2 changes: 2 additions & 0 deletions extension/zpagesextension/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -113,3 +113,5 @@ replace go.opentelemetry.io/collector/config/configauth => ../../config/configau
replace go.opentelemetry.io/collector/extension/auth => ../auth

replace go.opentelemetry.io/collector/config/confighttp => ../../config/confighttp

replace go.opentelemetry.io/collector/pdata/pprofile => ../../pdata/pprofile
3 changes: 3 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ require (
github.com/tklauser/numcpus v0.6.1 // indirect
github.com/yusufpapurcu/wmi v1.2.4 // indirect
go.opentelemetry.io/collector/config/configtelemetry v0.103.0 // indirect
go.opentelemetry.io/collector/pdata/pprofile v0.103.0 // indirect
go.opentelemetry.io/otel v1.27.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.27.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v1.27.0 // indirect
Expand Down Expand Up @@ -101,3 +102,5 @@ retract (
v0.57.0 // Release failed, use v0.57.2
v0.32.0 // Contains incomplete metrics transition to proto 0.9.0, random components are not working.
)

replace go.opentelemetry.io/collector/pdata/pprofile => ./pdata/pprofile
3 changes: 3 additions & 0 deletions internal/e2e/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ require (
go.opentelemetry.io/collector/extension v0.103.0 // indirect
go.opentelemetry.io/collector/extension/auth v0.103.0 // indirect
go.opentelemetry.io/collector/featuregate v1.10.0 // indirect
go.opentelemetry.io/collector/pdata/pprofile v0.103.0 // indirect
go.opentelemetry.io/contrib/config v0.7.0 // indirect
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.52.0 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.52.0 // indirect
Expand Down Expand Up @@ -121,6 +122,8 @@ replace go.opentelemetry.io/collector/pdata => ../../pdata

replace go.opentelemetry.io/collector/pdata/testdata => ../../pdata/testdata

replace go.opentelemetry.io/collector/pdata/pprofile => ../../pdata/pprofile

replace go.opentelemetry.io/collector/consumer => ../../consumer

replace go.opentelemetry.io/collector/receiver/otlpreceiver => ../../receiver/otlpreceiver
Expand Down
3 changes: 3 additions & 0 deletions otelcol/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ require (
go.opencensus.io v0.24.0 // indirect
go.opentelemetry.io/collector/consumer v0.103.0 // indirect
go.opentelemetry.io/collector/pdata v1.10.0 // indirect
go.opentelemetry.io/collector/pdata/pprofile v0.103.0 // indirect
go.opentelemetry.io/collector/pdata/testdata v0.103.0 // indirect
go.opentelemetry.io/collector/semconv v0.103.0 // indirect
go.opentelemetry.io/contrib/config v0.7.0 // indirect
Expand Down Expand Up @@ -109,6 +110,8 @@ replace go.opentelemetry.io/collector/pdata => ../pdata

replace go.opentelemetry.io/collector/pdata/testdata => ../pdata/testdata

replace go.opentelemetry.io/collector/pdata/pprofile => ../pdata/pprofile

replace go.opentelemetry.io/collector/extension/zpagesextension => ../extension/zpagesextension

replace go.opentelemetry.io/collector/extension => ../extension
Expand Down
3 changes: 3 additions & 0 deletions otelcol/otelcoltest/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ require (
go.opentelemetry.io/collector/consumer v0.103.0 // indirect
go.opentelemetry.io/collector/featuregate v1.10.0 // indirect
go.opentelemetry.io/collector/pdata v1.10.0 // indirect
go.opentelemetry.io/collector/pdata/pprofile v0.103.0 // indirect
go.opentelemetry.io/collector/pdata/testdata v0.103.0 // indirect
go.opentelemetry.io/collector/semconv v0.103.0 // indirect
go.opentelemetry.io/contrib/config v0.7.0 // indirect
Expand Down Expand Up @@ -136,6 +137,8 @@ replace go.opentelemetry.io/collector/pdata/testdata => ../../pdata/testdata

replace go.opentelemetry.io/collector/pdata => ../../pdata

replace go.opentelemetry.io/collector/pdata/pprofile => ../../pdata/pprofile

replace go.opentelemetry.io/collector/confmap/provider/httpsprovider => ../../confmap/provider/httpsprovider

replace go.opentelemetry.io/collector/connector => ../../connector
Expand Down
46 changes: 46 additions & 0 deletions pdata/internal/wrapper_profiles.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
// Copyright The OpenTelemetry Authors
// SPDX-License-Identifier: Apache-2.0

package internal // import "go.opentelemetry.io/collector/pdata/internal"

import (
otlpcollectorprofile "go.opentelemetry.io/collector/pdata/internal/data/protogen/collector/profiles/v1experimental"
otlpprofile "go.opentelemetry.io/collector/pdata/internal/data/protogen/profiles/v1experimental"
)

type Profiles struct {
orig *otlpcollectorprofile.ExportProfilesServiceRequest
state *State
}

func GetOrigProfiles(ms Profiles) *otlpcollectorprofile.ExportProfilesServiceRequest {
return ms.orig
}

func GetProfilesState(ms Profiles) *State {
return ms.state
}

func SetProfilesState(ms Profiles, state State) {
*ms.state = state
}

func NewProfiles(orig *otlpcollectorprofile.ExportProfilesServiceRequest, state *State) Profiles {
return Profiles{orig: orig, state: state}
}

// ProfilesToProto internal helper to convert Profiles to protobuf representation.
func ProfilesToProto(l Profiles) otlpprofile.ProfilesData {
return otlpprofile.ProfilesData{
ResourceProfiles: l.orig.ResourceProfiles,
}
}

// ProfilesFromProto internal helper to convert protobuf representation to Profiles.
// This function set exclusive state assuming that it's called only once per Profiles.
func ProfilesFromProto(orig otlpprofile.ProfilesData) Profiles {
state := StateMutable
return NewProfiles(&otlpcollectorprofile.ExportProfilesServiceRequest{
ResourceProfiles: orig.ResourceProfiles,
}, &state)
}
Loading

0 comments on commit 227fb82

Please sign in to comment.