Skip to content

Commit f936f66

Browse files
criamicoeokoneyo
authored andcommitted
[Fleet] Report otelcol inputs with receiver id instead of type (elastic#244013)
Fixes elastic#243720 ## Summary Integration input health reports otelcol inputs with `receiver id` instead of input type `otelcol`. Currently the input health show input name "otelcol" for any receiver, making it difficult to diagnose which input has issues in case of multiple inputs. This PR addresses it, showing the receiver id instead of the generic type. Note that this change is done only for "otelcol" inputs and not for any other type of inputs, they'll keep showing the type instead; the link ref stays the same, it's just the text that has been changed. ### Before <img width="951" height="638" alt="Screenshot 2025-11-24 at 15 57 20" src="https://github.com/user-attachments/assets/9e67c70b-4e73-45c6-8bc4-ba0c5de70b91" /> ### After <img width="1771" height="996" alt="Screenshot 2025-11-24 at 15 51 36" src="https://github.com/user-attachments/assets/84a3ef3f-8895-405c-8417-dda772964d09" /> ### Testing - Locally build this package: elastic/integrations#15739 - Install it into Fleet with ``` curl -XPOST -H 'content-type: application/zip' -H 'kbn-xsrf: true' http://localhost:5601/<PATH>/api/fleet/epm/packages -u elastic:changeme --data-binary @docker_otel_input-0.2.0.zip ``` - Add it to an agent policy and enroll an agent into that policy - Verify the input health in agent view. The input name should correspond to the receiver id and the link should correctly navigate to the logs. ### Checklist - [ ] [Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html) was added for features that require explanation or tutorials - [ ] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios
1 parent fa4f6c7 commit f936f66

File tree

3 files changed

+36
-2
lines changed

3 files changed

+36
-2
lines changed

x-pack/platform/plugins/shared/fleet/public/applications/fleet/sections/agents/agent_details_page/components/agent_details/agent_details_integration_inputs.test.tsx

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,4 +132,32 @@ describe('AgentDetailsIntegrationInputs', () => {
132132
await userEvent.click(component.container.querySelector('#endpoint')!);
133133
expect(component.getByText('Endpoint')).toBeInTheDocument();
134134
});
135+
136+
it('should render input type using input id for otelcol inputs', async () => {
137+
packageMock.inputs.push({
138+
type: 'otelcol',
139+
enabled: true,
140+
streams: [],
141+
id: 'otelcol/my-otelcol-input',
142+
});
143+
144+
const component = renderComponent();
145+
await userEvent.click(component.container.querySelector('#agentIntegrationsInputs')!);
146+
await userEvent.click(component.container.querySelector('#otelcol')!);
147+
expect(component.getByText('otelcol/my-otelcol-input')).toBeInTheDocument();
148+
});
149+
150+
it('should render input type using input type for non-otelcol inputs', async () => {
151+
packageMock.inputs.push({
152+
type: 'logfile',
153+
enabled: true,
154+
streams: [],
155+
id: 'logfile/my-logfile-input',
156+
});
157+
158+
const component = renderComponent();
159+
await userEvent.click(component.container.querySelector('#agentIntegrationsInputs')!);
160+
await userEvent.click(component.container.querySelector('#logfile')!);
161+
expect(component.getByText('Logs')).toBeInTheDocument();
162+
});
135163
});

x-pack/platform/plugins/shared/fleet/public/applications/fleet/sections/agents/agent_details_page/components/agent_details/agent_details_integration_inputs.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ export const AgentDetailsIntegrationInputs: React.FunctionComponent<{
157157
}
158158
)}
159159
>
160-
{displayInputType(current.type)}
160+
{displayInputType(current.type, current?.id)}
161161
</StyledEuiLink>
162162
) : (
163163
<>{displayInputType(current.type)}</>

x-pack/platform/plugins/shared/fleet/public/applications/fleet/sections/agents/agent_details_page/components/agent_details/input_type_utils.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,9 @@ import {
1616
AGENT_DATASET_OSQUERYBEAT,
1717
AGENT_DATASET_HEARTBEAT,
1818
} from '../agent_logs/constants';
19+
import { OTEL_COLLECTOR_INPUT_TYPE } from '../../../../../../../../common/constants';
1920

20-
export function displayInputType(inputType: string): string {
21+
export function displayInputType(inputType: string, id?: string): string {
2122
if (inputType === 'logfile') {
2223
return i18n.translate('xpack.fleet.agentDetailsIntegrations.inputTypeLogText', {
2324
defaultMessage: 'Logs',
@@ -34,6 +35,11 @@ export function displayInputType(inputType: string): string {
3435
});
3536
}
3637

38+
// show the input id to differentiate multiple otelcol inputs, if present
39+
if (inputType === OTEL_COLLECTOR_INPUT_TYPE && id) {
40+
return id;
41+
}
42+
3743
return inputType;
3844
}
3945

0 commit comments

Comments
 (0)