Skip to content

Commit

Permalink
Merge branch 'main' into tlscheckreceiver
Browse files Browse the repository at this point in the history
  • Loading branch information
michael-burt authored Oct 22, 2024
2 parents 5a35f4f + e788e31 commit 01db98d
Show file tree
Hide file tree
Showing 14 changed files with 157 additions and 38 deletions.
27 changes: 27 additions & 0 deletions .chloggen/fix-kafka-recv-blocking-shutdown.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Use this changelog template to create an entry for release notes.

# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
change_type: bug_fix

# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver)
component: kafkareceiver

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: Fixes issue causing kafkareceiver to block during Shutdown().

# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists.
issues: [30789]

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

# If your change doesn't affect end users or the exported elements of any package,
# you should instead start your pull request title with [chore] or use the "Skip Changelog" label.
# 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: []
27 changes: 27 additions & 0 deletions .chloggen/move_chronyreceiver_to_beta.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# 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. filelogreceiver)
component: chronyreceiver

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: Move chronyreceiver to beta

# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists.
issues: [35913]

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

# If your change doesn't affect end users or the exported elements of any package,
# you should instead start your pull request title with [chore] or use the "Skip Changelog" label.
# 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: []
27 changes: 27 additions & 0 deletions .chloggen/opampextension-add-os-desc-semconv.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# 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. filelogreceiver)
component: opampextension

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: Report OS description semantic convention (`os.description`) as a part of non-identifying agent description.

# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists.
issues: [35555]

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

# If your change doesn't affect end users or the exported elements of any package,
# you should instead start your pull request title with [chore] or use the "Skip Changelog" label.
# 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: []
3 changes: 2 additions & 1 deletion cmd/opampsupervisor/e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -752,7 +752,8 @@ func TestSupervisorAgentDescriptionConfigApplies(t *testing.T) {
},
}

require.Equal(t, expectedDescription, ad.AgentDescription)
require.Subset(t, ad.AgentDescription.IdentifyingAttributes, expectedDescription.IdentifyingAttributes)
require.Subset(t, ad.AgentDescription.NonIdentifyingAttributes, expectedDescription.NonIdentifyingAttributes)

time.Sleep(250 * time.Millisecond)
}
Expand Down
2 changes: 1 addition & 1 deletion extension/opampextension/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ require (
go.uber.org/multierr v1.11.0 // indirect
golang.org/x/net v0.28.0 // indirect
golang.org/x/sys v0.25.0 // indirect
golang.org/x/text v0.17.0 // indirect
golang.org/x/text v0.17.0
google.golang.org/genproto/googleapis/rpc v0.0.0-20240814211410-ddb44dafa142 // indirect
google.golang.org/protobuf v1.35.1 // indirect
)
Expand Down
23 changes: 23 additions & 0 deletions extension/opampextension/opamp_agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
"github.com/open-telemetry/opamp-go/client"
"github.com/open-telemetry/opamp-go/client/types"
"github.com/open-telemetry/opamp-go/protobufs"
"github.com/shirou/gopsutil/v4/host"
"go.opentelemetry.io/collector/component"
"go.opentelemetry.io/collector/component/componentstatus"
"go.opentelemetry.io/collector/confmap"
Expand All @@ -27,6 +28,8 @@ import (
semconv "go.opentelemetry.io/collector/semconv/v1.27.0"
"go.uber.org/zap"
"golang.org/x/exp/maps"
"golang.org/x/text/cases"
"golang.org/x/text/language"
"gopkg.in/yaml.v3"

"github.com/open-telemetry/opentelemetry-collector-contrib/extension/opampcustommessages"
Expand Down Expand Up @@ -278,6 +281,7 @@ func (o *opampAgent) createAgentDescription() error {
if err != nil {
return err
}
description := getOSDescription(o.logger)

ident := []*protobufs.KeyValue{
stringKeyValue(semconv.AttributeServiceInstanceID, o.instanceID.String()),
Expand All @@ -291,6 +295,7 @@ func (o *opampAgent) createAgentDescription() error {
nonIdentifyingAttributeMap[semconv.AttributeOSType] = runtime.GOOS
nonIdentifyingAttributeMap[semconv.AttributeHostArch] = runtime.GOARCH
nonIdentifyingAttributeMap[semconv.AttributeHostName] = hostname
nonIdentifyingAttributeMap[semconv.AttributeOSDescription] = description

for k, v := range o.cfg.AgentDescription.NonIdentifyingAttributes {
nonIdentifyingAttributeMap[k] = v
Expand Down Expand Up @@ -367,3 +372,21 @@ func (o *opampAgent) setHealth(ch *protobufs.ComponentHealth) {
}
}
}

func getOSDescription(logger *zap.Logger) string {
info, err := host.Info()
if err != nil {
logger.Error("failed getting host info", zap.Error(err))
return runtime.GOOS
}
switch runtime.GOOS {
case "darwin":
return "macOS " + info.PlatformVersion
case "linux":
return cases.Title(language.English).String(info.Platform) + " " + info.PlatformVersion
case "windows":
return info.Platform + " " + info.PlatformVersion
default:
return runtime.GOOS
}
}
5 changes: 5 additions & 0 deletions extension/opampextension/opamp_agent_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
"go.opentelemetry.io/collector/confmap/confmaptest"
"go.opentelemetry.io/collector/extension/extensiontest"
semconv "go.opentelemetry.io/collector/semconv/v1.27.0"
"go.uber.org/zap"
)

func TestNewOpampAgent(t *testing.T) {
Expand Down Expand Up @@ -53,6 +54,7 @@ func TestNewOpampAgentAttributes(t *testing.T) {
func TestCreateAgentDescription(t *testing.T) {
hostname, err := os.Hostname()
require.NoError(t, err)
description := getOSDescription(zap.NewNop())

serviceName := "otelcol-distrot"
serviceVersion := "distro.0"
Expand All @@ -76,6 +78,7 @@ func TestCreateAgentDescription(t *testing.T) {
NonIdentifyingAttributes: []*protobufs.KeyValue{
stringKeyValue(semconv.AttributeHostArch, runtime.GOARCH),
stringKeyValue(semconv.AttributeHostName, hostname),
stringKeyValue(semconv.AttributeOSDescription, description),
stringKeyValue(semconv.AttributeOSType, runtime.GOOS),
},
},
Expand All @@ -99,6 +102,7 @@ func TestCreateAgentDescription(t *testing.T) {
stringKeyValue(semconv.AttributeHostArch, runtime.GOARCH),
stringKeyValue(semconv.AttributeHostName, hostname),
stringKeyValue(semconv.AttributeK8SPodName, "my-very-cool-pod"),
stringKeyValue(semconv.AttributeOSDescription, description),
stringKeyValue(semconv.AttributeOSType, runtime.GOOS),
},
},
Expand All @@ -119,6 +123,7 @@ func TestCreateAgentDescription(t *testing.T) {
NonIdentifyingAttributes: []*protobufs.KeyValue{
stringKeyValue(semconv.AttributeHostArch, runtime.GOARCH),
stringKeyValue(semconv.AttributeHostName, "override-host"),
stringKeyValue(semconv.AttributeOSDescription, description),
stringKeyValue(semconv.AttributeOSType, runtime.GOOS),
},
},
Expand Down
4 changes: 2 additions & 2 deletions receiver/chronyreceiver/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
<!-- status autogenerated section -->
| Status | |
| ------------- |-----------|
| Stability | [alpha]: metrics |
| Stability | [beta]: metrics |
| Distributions | [contrib] |
| Issues | [![Open issues](https://img.shields.io/github/issues-search/open-telemetry/opentelemetry-collector-contrib?query=is%3Aissue%20is%3Aopen%20label%3Areceiver%2Fchrony%20&label=open&color=orange&logo=opentelemetry)](https://github.com/open-telemetry/opentelemetry-collector-contrib/issues?q=is%3Aopen+is%3Aissue+label%3Areceiver%2Fchrony) [![Closed issues](https://img.shields.io/github/issues-search/open-telemetry/opentelemetry-collector-contrib?query=is%3Aissue%20is%3Aclosed%20label%3Areceiver%2Fchrony%20&label=closed&color=blue&logo=opentelemetry)](https://github.com/open-telemetry/opentelemetry-collector-contrib/issues?q=is%3Aclosed+is%3Aissue+label%3Areceiver%2Fchrony) |
| [Code Owners](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/CONTRIBUTING.md#becoming-a-code-owner) | [@MovieStoreGuy](https://www.github.com/MovieStoreGuy), [@jamesmoessis](https://www.github.com/jamesmoessis) |

[alpha]: https://github.com/open-telemetry/opentelemetry-collector#alpha
[beta]: https://github.com/open-telemetry/opentelemetry-collector#beta
[contrib]: https://github.com/open-telemetry/opentelemetry-collector-releases/tree/main/distributions/otelcol-contrib
<!-- end autogenerated section -->

Expand Down

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

2 changes: 1 addition & 1 deletion receiver/chronyreceiver/metadata.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ type: chrony
status:
class: receiver
stability:
alpha: [metrics]
beta: [metrics]
distributions: [contrib]
codeowners:
active: [MovieStoreGuy, jamesmoessis]
Expand Down
1 change: 0 additions & 1 deletion receiver/kafkareceiver/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ require (
github.com/openzipkin/zipkin-go v0.4.3
github.com/stretchr/testify v1.9.0
go.opentelemetry.io/collector/component v0.111.1-0.20241008154146-ea48c09c31ae
go.opentelemetry.io/collector/component/componentstatus v0.111.1-0.20241008154146-ea48c09c31ae
go.opentelemetry.io/collector/config/configtelemetry v0.111.1-0.20241008154146-ea48c09c31ae
go.opentelemetry.io/collector/config/configtls v1.17.1-0.20241008154146-ea48c09c31ae
go.opentelemetry.io/collector/confmap v1.17.1-0.20241008154146-ea48c09c31ae
Expand Down
2 changes: 0 additions & 2 deletions receiver/kafkareceiver/go.sum

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

Loading

0 comments on commit 01db98d

Please sign in to comment.