Skip to content

Commit 187ff49

Browse files
authored
Merge pull request #130 from digma-ai/feature/add_environment_usage_support
Feature/add environment usage support
2 parents b7b545c + 444f7c7 commit 187ff49

27 files changed

+674
-309
lines changed

digma-0.5.25.tgz

2.54 MB
Binary file not shown.

images/no-data.png

1.49 KB
Loading

images/unused.png

780 Bytes
Loading

images/used.png

901 Bytes
Loading

src/services/analyticsProvider.ts

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,26 @@ export interface ExecutedCodeSummary{
182182
codeLineNumber: number;
183183
}
184184

185+
export interface UsageStatusResults {
186+
codeObjectStatuses: CodeObjectUsageStatus[];
187+
environmentStatuses: EnvironmentUsageStatus[];
188+
189+
}
190+
191+
export interface EnvironmentUsageStatus{
192+
name: string;
193+
environmentFirstRecordedTime:moment.Moment;
194+
environmentLastRecordedTime:moment.Moment;
195+
}
196+
197+
export interface CodeObjectUsageStatus{
198+
environment: string;
199+
type: string;
200+
name: string;
201+
codeObjectId: string;
202+
lastRecordedTime: moment.Moment;
203+
firstRecordedTime: moment.Moment;
204+
}
185205
export interface EndpointSummary{
186206
id: string;
187207
highUsage: boolean;
@@ -298,6 +318,18 @@ export class AnalyticsProvider
298318
}
299319

300320

321+
public async getUsageStatus(codeObjectIds: string []): Promise<UsageStatusResults>
322+
{
323+
324+
const response: UsageStatusResults = await this.send<any>(
325+
'POST',
326+
`/CodeAnalytics/codeObjects/status`,
327+
undefined,
328+
{
329+
codeObjectIds: codeObjectIds
330+
});
331+
return response;
332+
}
301333

302334
public async getInsights(codeObjectIds: string []): Promise<any []>
303335
{

src/views-ui/codeAnalytics/contracts.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,15 @@ export namespace UiMessage
99
export class TabChanged {
1010
constructor(public viewId?: string) {}
1111
}
12+
13+
export class TabRefreshRequested{
14+
15+
}
16+
17+
export class ChangeEnvironmentContext{
18+
constructor(public environment?: string) {}
19+
20+
}
1221
export class GoToLine{
1322
constructor(public line?: number){}
1423
}

src/views-ui/codeAnalytics/main.scss

Lines changed: 34 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,27 @@ vscode-panel-view {
6060
font-size: var(--type-ramp-minus1-font-size);
6161
}
6262

63+
.codeobj-environment-usage-group {
64+
display: flex;
65+
align-items: center;
66+
margin-top: 0px;
67+
margin-bottom: 6px;
68+
}
69+
70+
.codeobj-environment-usage {
71+
margin-right: 0.4em;
72+
.codeobj-environment-usage-label {
73+
font-size: var(--type-ramp-minus2-font-size);
74+
opacity: 0.7;
75+
cursor: pointer;
76+
}
77+
.codeobj-environment-usage-label-selected {
78+
border-bottom: 1px solid rgb(78, 103, 228);
79+
font-size: var(--type-ramp-minus2-font-size);
80+
padding-bottom: 2px;
81+
}
82+
}
83+
6384
.insight-main-value {
6485
font-size: var(--type-ramp-minus1-font-size);
6586
text-align: center;
@@ -190,7 +211,7 @@ vscode-panel-view {
190211
&.disabled {
191212
opacity: 0.4;
192213
}
193-
.frame-code-path{
214+
.frame-code-path {
194215
display: flex;
195216
}
196217
}
@@ -199,9 +220,7 @@ vscode-panel-view {
199220
border-top-color: var(--vscode-tree-tableColumnsBorder);
200221
border-top-style: dashed;
201222
}
202-
.path-label{
203-
204-
}
223+
.path-label {}
205224
}
206225
.no-frames-msg {
207226
padding: 1em;
@@ -356,7 +375,6 @@ vscode-panel-view {
356375
display: flex;
357376
align-items: center;
358377
margin-top: 10px;
359-
360378
.scope {
361379
margin-right: 5px;
362380
opacity: 0.6;
@@ -386,18 +404,16 @@ vscode-panel-view {
386404
padding-right: 10px;
387405
}
388406

389-
#view-insights{
390-
.span-usages-insight{
391-
.flow-row{
407+
#view-insights {
408+
.span-usages-insight {
409+
.flow-row {
392410
margin-bottom: 2px;
393-
394-
.flow-percent{
411+
.flow-percent {
395412
margin-right: 5px;
396413
}
397-
.flow-entry{
414+
.flow-entry {
398415
border-radius: 2px;
399416
margin-bottom: 4px;
400-
401417
.flow-service {
402418
opacity: 0.7;
403419
}
@@ -407,25 +423,24 @@ vscode-panel-view {
407423
}
408424
}
409425
}
410-
.span-durations-insight{
411-
.percentiles-grid{
426+
.span-durations-insight {
427+
.percentiles-grid {
412428
display: grid;
413429
justify-content: start;
414430
grid-template-columns: auto auto 1fr auto;
415431
column-gap: 10px;
416432
row-gap: 5px;
417433
}
418-
.change{
434+
.change {
419435
opacity: 0.7;
420436
}
421437
}
422-
.endpoint-bottleneck-insight{
438+
.endpoint-bottleneck-insight {
423439
margin-top: 5px;
424-
425-
.span-name{
440+
.span-name {
426441
margin-right: 5px;
427442
}
428-
.span-description{
443+
.span-description {
429444
opacity: 0.6;
430445
}
431446
}

src/views-ui/codeAnalytics/main.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,15 @@ window.addEventListener("load", () =>
9292
}
9393
});
9494

95+
$(document).on("click", ".codeobj-environment-usage-label", function () {
96+
97+
const env = $(this).data("env-name");
98+
publish(new UiMessage.Notify.ChangeEnvironmentContext(env));
99+
100+
101+
});
102+
103+
95104
$(document).on("click", ".error-name.link", function () {
96105
let errorSourceUID = $(this).data("error-source-uid");
97106
publish(new UiMessage.Get.ErrorDetails(errorSourceUID));
@@ -104,6 +113,7 @@ window.addEventListener("load", () =>
104113
publish(new UiMessage.Notify.GoToFileAndLine(codeUri,Number(line)));
105114
});
106115

116+
107117
$(document).on("click", ".error_frames_btn", function () {
108118
$(".error-raw").hide();
109119
$(".error-frames").show();
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import { Settings } from "../../settings";
2+
import { WebViewUris } from "../webViewUtils";
3+
import { IListViewItemBase } from "./IListViewItem"
4+
5+
export class EmptyGroupItemTemplate implements IListViewItemBase {
6+
7+
public constructor( private viewUris: WebViewUris){
8+
9+
}
10+
11+
sortIndex: number | undefined;
12+
getHtml(): string | undefined {
13+
return `<div class="list-item">
14+
<div class="list-item-content-area">
15+
<div class="list-item-header"><strong>No data received</strong></div>
16+
<div class="list-item-content-description">No data received yet about this code object from the selected environment: ${Settings.environment.value}</div>
17+
</div>
18+
<div class="list-item-right-area">
19+
<img style="align-self:center;" src="${this.viewUris.image("no-data.png")}" width="32" height="32">
20+
</div>
21+
</div>`;
22+
23+
}
24+
groupId: string | undefined;
25+
26+
27+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
export interface IListGroupItemBase
2+
{
3+
getHtml(): string | undefined;
4+
groupId: string;
5+
type: string;
6+
7+
}
8+
9+
export class GroupItem implements IListGroupItemBase{
10+
public constructor(groupId :string, type: string, private html: string){
11+
this.groupId=groupId;
12+
this.type=type;
13+
}
14+
getHtml(): string | undefined {
15+
return this.html;
16+
}
17+
groupId: string;
18+
type: string;
19+
20+
}

0 commit comments

Comments
 (0)