Skip to content

Commit

Permalink
Metrics tracing tags (#1626)
Browse files Browse the repository at this point in the history
* wip

* Refactor AgentHealth Mechanism, Fire AgentHealthEvent in Tagguard

* rebased to main

* Refactored TagGuard, Refactored HealthStateMonitoring, Write Tests, Fixed Bugs, improved UI for HeathState, Added Documentation

* writing int Test for TagValueGuard

* fix test

* fix MetricsRecorderTest

* fix LogHealthMonitorTest and disable MeasureTagValueGuardIntTest for now

* update workflow

* update build.gradle

* refactor TagValueGuard and AgentHealth tracking

* improve blocking of tags

* add tests for TagValueGuard

* filter unnecessary health incidents

* add tests for AgentHealth monitoring

* fix int test

* update documentation

* include metric tags in tracing

* extend configuration

* add tests

* update documentation

---------

Co-authored-by: Claudio Waldvogel <claudio.waldvogel@novatec-gmbh.de>
Co-authored-by: Marius Brill <marius.brill@novatec-gmbh.de>
Co-authored-by: Dimi-Ma <dimi.mÂ@gmx.de>
  • Loading branch information
4 people authored Dec 6, 2023
1 parent 7352128 commit 219f9ed
Show file tree
Hide file tree
Showing 68 changed files with 2,611 additions and 422 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ class ConfigurationView extends React.Component {
* If no version is specified, the latest version will be selected.
*/
openFile = (filename, versionId = null) => {
if (this.props.selectedVersion != versionId) {
if (this.props.selectedVersion !== versionId) {
this.props.selectVersion(versionId, false);
}
this.props.selectFile(filename);
Expand All @@ -191,15 +191,13 @@ class ConfigurationView extends React.Component {
canWrite,
} = this.props;
const showEditor = (selection || selectedDefaultConfigFile) && !isDirectory;

const { path, name } = this.parsePath(selection, selectedDefaultConfigFile);
const icon = 'pi-' + (isDirectory ? 'folder' : 'file');
const showHeader = !!name;

const readOnly = !canWrite || !!selectedDefaultConfigFile || !isLatestVersion;

const fileContentWithoutFirstLine = fileContent ? fileContent.split('\n').slice(1).join('\n') : '';

return (
<div className="this">
<style jsx>{`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,13 @@ const FileToolbar = ({
tooltipOptions={TOOLTIP_OPTIONS}
onClick={() => showUploadDialog(selection)}
/>
<Button
disabled={readOnly || loading}
tooltip="Upload File or Directory"
icon="pi pi-upload"
tooltipOptions={TOOLTIP_OPTIONS}
onClick={() => showUploadDialog(selection)}
/>
</div>
}
right={
Expand All @@ -113,6 +120,13 @@ const FileToolbar = ({
icon={showHiddenFiles ? 'pi pi-eye' : 'pi pi-eye-slash'}
tooltipOptions={TOOLTIP_OPTIONS}
/>
<Button
disabled={loading}
onClick={toggleShowHiddenFiles}
tooltip={showHiddenFiles ? 'Hide Files' : 'Show Hidden Files'}
icon={showHiddenFiles ? 'pi pi-eye' : 'pi pi-eye-slash'}
tooltipOptions={TOOLTIP_OPTIONS}
/>
<Button
disabled={loading}
onClick={showSearchDialog}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,17 @@ import { ContentTypeMapper } from '../mappings/ContentTypeMapper';
/**
* Dialog that shows the given content, applying syntax highlighting if available, and offering a download option
*/
const DownloadDialogue = ({ visible, onHide, error, loading, contentValue, contentType, contextName }) => {
const DownloadDialogue = ({
visible,
onHide,
error,
loading,
contentValue,
contentType,
contextName,
isDownloadDialogFooterHidden,
onCancel,
}) => {
const dialogueSettings = ContentTypeMapper(contentType, contextName);

const downloadFilename =
Expand All @@ -37,18 +47,23 @@ const DownloadDialogue = ({ visible, onHide, error, loading, contentValue, conte

return (
<>
<style jsx>{`
.downloadDialogFooter {
display: none;
}
`}</style>
<Dialog
style={{ width: '50vw', overflow: 'auto' }}
header={dialogueSettings.header}
modal={true}
visible={visible}
onHide={onHide}
footer={
<div>
<div className={isDownloadDialogFooterHidden ? 'downloadDialogFooter' : null}>
<a href={error || loading ? null : download()} download={downloadFilename}>
<Button icon="pi pi-download" label="Download" className="p-button-primary" disabled={loading || error} />
</a>
<Button label="Cancel" className="p-button-secondary" onClick={onHide} />
<Button label="Cancel" className="p-button-secondary" onClick={onCancel} />
</div>
}
>
Expand Down Expand Up @@ -86,6 +101,10 @@ DownloadDialogue.propTypes = {
contentType: PropTypes.string,
/** The name of the data's context. E.g. the agent whose logs are being shown.*/
contextName: PropTypes.string,
/** Whether the cancel Button is disabled */
disableDownloadCancelButton: PropTypes.bool,
/** Callback on dialog cancel */
onCancel: PropTypes.func,
};

DownloadDialogue.defaultProps = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,23 +53,19 @@ class AgentMappingCell extends React.Component {
display: flex;
align-items: stretch;
}
.mapping-name {
flex: 1;
margin-right: 0.5rem;
}
.no-mapping {
color: gray;
font-style: italic;
}
.show-attributes {
float: right;
cursor: pointer;
color: #007ad9;
}
.attributes {
margin-top: 0.5rem;
border-left: 0.25rem solid #ddd;
Expand Down Expand Up @@ -174,7 +170,6 @@ class StatusTable extends React.Component {
.this {
position: relative;
}
.this :global(.config-info-button) {
width: 1.2rem;
height: 1.2rem;
Expand All @@ -184,7 +179,6 @@ class StatusTable extends React.Component {
background: #ddd;
border-color: #ddd;
}
.this :global(.log-button) {
width: 1.2rem;
height: 1.2rem;
Expand All @@ -194,7 +188,6 @@ class StatusTable extends React.Component {
background: #ddd;
border-color: #ddd;
}
.this :global(.service-state-button) {
width: 1.2rem;
height: 1.2rem;
Expand All @@ -204,7 +197,6 @@ class StatusTable extends React.Component {
background: #ddd;
border-color: #ddd;
}
.this :global(.badge) {
width: 1.2rem;
height: 1.2rem;
Expand All @@ -217,7 +209,6 @@ class StatusTable extends React.Component {
justify-content: center;
color: white;
}
.this :global(.might-overflow) {
max-width: 17.8rem;
display: inline-block;
Expand Down Expand Up @@ -301,8 +292,11 @@ class StatusTable extends React.Component {
};

agentHealthTemplate = (rowData) => {
const { onShowHealthStateDialog } = this.props;
const { healthState, metaInformation } = rowData;
const { health } = healthState;
const { agentId } = metaInformation;
const { onShowDownloadDialog } = this.props;
const { health, metaInformation } = rowData;

let { agentCommandsEnabled, supportArchiveAvailable } = this.resolveServiceAvailability(metaInformation);

Expand All @@ -326,12 +320,14 @@ class StatusTable extends React.Component {
iconColor = '#e8c413';
break;
}

return (
<>
<style jsx>{`
.state {
align-items: center;
display: flex;
cursor: pointer;
position: relative;
}
Expand All @@ -347,8 +343,10 @@ class StatusTable extends React.Component {
`}</style>
{health ? (
<div className="state">
<i className={classNames('pi pi-fw', iconClass)} style={{ color: iconColor }}></i>
<span>{healthInfo}</span>
<div className="health-state" onClick={() => onShowHealthStateDialog(agentId, healthState)}>
<i className={classNames('pi pi-fw', iconClass)} style={{ color: iconColor }}></i>
<span>{healthInfo}</span>
</div>
<Button
className="archive-button"
icon="pi pi-cloud-download"
Expand Down Expand Up @@ -416,15 +414,12 @@ class StatusTable extends React.Component {
display: flex;
align-items: center;
}
.pi {
margin-right: 0.5rem;
}
.pi.live {
color: #ef5350;
}
.pi.workspace {
color: #616161;
}
Expand Down
Loading

0 comments on commit 219f9ed

Please sign in to comment.