Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: added support for instrumentation scope in logs #6378

Merged
merged 6 commits into from
Nov 7, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions frontend/src/container/LogDetailedView/utils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,11 @@ export const getFieldAttributes = (field: string): IFieldAttributes => {
const stringWithoutPrefix = field.slice('resources_'.length);
const parts = splitOnce(stringWithoutPrefix, '.');
[dataType, newField] = parts;
} else if (field.startsWith('scope_string')) {
logType = MetricsType.Scope;
const stringWithoutPrefix = field.slice('scope_'.length);
const parts = splitOnce(stringWithoutPrefix, '.');
[dataType, newField] = parts;
}

return { dataType, newField, logType };
Expand Down Expand Up @@ -187,6 +192,7 @@ export const aggregateAttributesResourcesToString = (logData: ILog): string => {
traceId: logData.traceId,
attributes: {},
resources: {},
scope: {},
severity_text: logData.severity_text,
severity_number: logData.severity_number,
};
Expand All @@ -198,6 +204,9 @@ export const aggregateAttributesResourcesToString = (logData: ILog): string => {
} else if (key.startsWith('resources_')) {
outputJson.resources = outputJson.resources || {};
Object.assign(outputJson.resources, logData[key as keyof ILog]);
} else if (key.startsWith('scope_string')) {
outputJson.scope = outputJson.scope || {};
Object.assign(outputJson.scope, logData[key as keyof ILog]);
} else {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
Expand Down
1 change: 1 addition & 0 deletions frontend/src/container/MetricsApplication/constant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ export enum KeyOperationTableHeader {
export enum MetricsType {
Tag = 'tag',
Resource = 'resource',
Scope = 'scope',
}

export enum WidgetKeys {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,20 @@
background: rgba(189, 153, 121, 0.1);
}
}

&.scope {
border: 1px solid rgba(113, 144, 249, 0.2);
vikrantgupta25 marked this conversation as resolved.
Show resolved Hide resolved

.ant-typography {
color: var(--bg-robin-400);
background: rgba(113, 144, 249, 0.1);
font-size: 14px;
}

.ant-tag-close-icon {
background: rgba(113, 144, 249, 0.1);
}
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,25 @@
letter-spacing: -0.06px;
}
}

&.scope {
border-radius: 50px;
background: rgba(113, 144, 249, 0.1) !important;
color: var(--bg-robin-400) !important;

.dot {
background-color: var(--bg-robin-400);
}
.text {
color: var(--bg-robin-400);
font-family: Inter;
font-size: 12px;
font-style: normal;
font-weight: 400;
line-height: 18px; /* 150% */
letter-spacing: -0.06px;
}
}
}
}
.option-meta-data-container {
Expand Down
3 changes: 3 additions & 0 deletions frontend/src/types/api/logs/log.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export interface ILog {
severityNumber: number;
body: string;
resources_string: Record<string, never>;
scope_string: Record<string, never>;
attributesString: Record<string, never>;
attributes_string: Record<string, never>;
attributesInt: Record<string, never>;
Expand All @@ -22,6 +23,7 @@ type OmitAttributesResources = Pick<
Exclude<
keyof ILog,
| 'resources_string'
| 'scope_string'
| 'attributesString'
| 'attributes_string'
| 'attributesInt'
Expand All @@ -32,4 +34,5 @@ type OmitAttributesResources = Pick<
export type ILogAggregateAttributesResources = OmitAttributesResources & {
attributes: Record<string, never>;
resources: Record<string, never>;
scope: Record<string, never>;
};
Loading