Skip to content

Commit

Permalink
[extension/opamp] Add Opampextension content type (#36327)
Browse files Browse the repository at this point in the history
- from
#36157

#### Description
- [extension/opampextension] Add "text/yaml"
toEffectiveConfig.ConfigMap.ConfigMap[*].ContentType:

ref. https://opentelemetry.io/docs/specs/opamp/#configuration
> content_type is an optional field. It is a MIME Content-Type that
describes what’s contained in the body field, for example “text/yaml”.
The content_type reported in the Effective Configuration in the Agent’s
status report may be used for example by the Server to visualize the
reported configuration nicely in a UI.

---------

Co-authored-by: Evan Bradley <11745660+evan-bradley@users.noreply.github.com>
  • Loading branch information
minuk-dev and evan-bradley authored Nov 13, 2024
1 parent b8437a0 commit 354f41a
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 1 deletion.
27 changes: 27 additions & 0 deletions .chloggen/opampextension-content-type.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: Add content type to opamp extension when reporting EffectiveConfig

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

# (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: Add EffectiveConfig.ConfigMap.ConfigMap[*].ContentType as "text/yaml" to the opamp extension when reporting EffectiveConfig.

# 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: []
5 changes: 4 additions & 1 deletion extension/opampextension/opamp_agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,10 @@ func (o *opampAgent) composeEffectiveConfig() *protobufs.EffectiveConfig {
return &protobufs.EffectiveConfig{
ConfigMap: &protobufs.AgentConfigMap{
ConfigMap: map[string]*protobufs.AgentConfigFile{
"": {Body: conf},
"": {
Body: conf,
ContentType: "text/yaml",
},
},
},
}
Expand Down
1 change: 1 addition & 0 deletions extension/opampextension/opamp_agent_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ func TestComposeEffectiveConfig(t *testing.T) {
ec = o.composeEffectiveConfig()
assert.NotNil(t, ec)
assert.YAMLEq(t, string(expected), string(ec.ConfigMap.ConfigMap[""].Body))
assert.Equal(t, "text/yaml", ec.ConfigMap.ConfigMap[""].ContentType)
}

func TestShutdown(t *testing.T) {
Expand Down

0 comments on commit 354f41a

Please sign in to comment.