Skip to content

Commit d9f22fe

Browse files
authored
Merge pull request #152 from digma-ai/feature/histograms
Feature/histograms
2 parents 6bf0456 + e6b7bd9 commit d9f22fe

File tree

15 files changed

+331
-53
lines changed

15 files changed

+331
-53
lines changed

digma-0.5.25.tgz

-2.54 MB
Binary file not shown.

images/histogram.png

1.01 KB
Loading

images/no-data.png

3.44 KB
Loading

images/target.png

-37.1 KB
Loading

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 13 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,7 @@
2424
"Continuous Delivery",
2525
"DevOps"
2626
],
27-
"badges": [
28-
{
27+
"badges": [{
2928
"url": "https://img.shields.io/github/stars/digma-ai/digma?style=social",
3029
"description": "Star Digma on Github",
3130
"href": "bit.ly/36LyUcr"
@@ -72,27 +71,18 @@
7271
"main": "./out/extension.js",
7372
"contributes": {
7473
"views": {
75-
"digma": [
76-
{
77-
"type": "webview",
78-
"id": "context",
79-
"name": "Context"
80-
},
81-
{
82-
"type": "webview",
83-
"id": "codeAnalytics",
84-
"name": "CodeAnalytics"
85-
}
86-
]
74+
"digma": [{
75+
"type": "webview",
76+
"id": "codeAnalytics",
77+
"name": "CodeAnalytics"
78+
}]
8779
},
8880
"viewsContainers": {
89-
"activitybar": [
90-
{
91-
"id": "digma",
92-
"title": "Digma",
93-
"icon": "icon.png"
94-
}
95-
]
81+
"activitybar": [{
82+
"id": "digma",
83+
"title": "Digma",
84+
"icon": "icon.png"
85+
}]
9686
},
9787
"configuration": {
9888
"properties": {
@@ -130,7 +120,7 @@
130120
"@vscode/codicons": "0.0.20",
131121
"@vscode/webview-ui-toolkit": "^0.8.5",
132122
"https": "^1.0.0",
133-
"moment": "^2.29.1",
123+
"moment": "^2.29.3",
134124
"node-fetch": "^2.6.6",
135125
"vscode-languageclient": "^7.0.0"
136126
},
@@ -167,4 +157,4 @@
167157
"node-sass": "^7.0.1",
168158
"typescript": "^4.4.4"
169159
}
170-
}
160+
}

src/extension.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import { AnalyticsProvider} from './services/analyticsProvider';
44
import { SymbolProvider } from './services/languages/symbolProvider';
55
import { PythonLanguageExtractor } from "./services/languages/python/languageExtractor";
66
import { CSharpLanguageExtractor } from './services/languages/csharp/languageExtractor';
7-
import { ContextView } from './views/contextView';
87
import { Settings } from './settings';
98
import { SourceControl, Git } from './services/sourceControl';
109
import { DocumentInfoProvider } from './services/documentInfoProvider';
@@ -41,7 +40,7 @@ export async function activate(context: vscode.ExtensionContext)
4140
}
4241
}
4342
context.subscriptions.push(new AnaliticsCodeLens(documentInfoProvider));
44-
context.subscriptions.push(new ContextView(analyticsProvider, context.extensionUri));
43+
//context.subscriptions.push(new ContextView(analyticsProvider, context.extensionUri));
4544
context.subscriptions.push(new MethodCallErrorTooltip(documentInfoProvider, codeInspector));
4645
context.subscriptions.push(sourceControl);
4746
context.subscriptions.push(documentInfoProvider);

src/services/analyticsProvider.ts

Lines changed: 61 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,10 @@ import { Settings } from "../settings";
55
import { Logger } from "./logger";
66
import { Dictionary, momentJsDateParser } from "./utils";
77
import moment = require("moment");
8-
import { integer } from "vscode-languageclient";
8+
import { decimal, integer } from "vscode-languageclient";
99
import * as os from 'os';
1010
import { stringify } from "querystring";
11+
import { SpanInfo } from "../views/codeAnalytics/InsightListView/CommonInsightObjects";
1112

1213

1314
export enum Impact
@@ -189,6 +190,30 @@ export interface UsageStatusResults {
189190

190191
}
191192

193+
export interface DurationRecord{
194+
duration:decimal;
195+
time: moment.Moment;
196+
}
197+
export interface SpanDurationData{
198+
spanInfo: SpanInfo;
199+
p95Durations: DurationRecord[];
200+
p99Durations: DurationRecord[];
201+
p75Durations: DurationRecord[];
202+
p50Durations: DurationRecord[];
203+
204+
}
205+
206+
export interface PercentileDuration extends DurationRecord{
207+
percentile:decimal;
208+
isChange:boolean;
209+
direction:integer;
210+
isVerified:boolean;
211+
}
212+
export interface SpanHistogramData{
213+
spanInfo: SpanInfo;
214+
percentileDurations: PercentileDuration[];
215+
}
216+
192217
export interface EnvironmentUsageStatus{
193218
name: string;
194219
environmentFirstRecordedTime:moment.Moment;
@@ -351,6 +376,41 @@ export class AnalyticsProvider
351376
return response;
352377
}
353378

379+
public async getSpanDurations(spanName: string, instrumentationLib: string,
380+
codeObjectId: string, environment:string): Promise<SpanDurationData>
381+
{
382+
383+
const response: SpanDurationData = await this.send<any>(
384+
'POST',
385+
`/CodeAnalytics/codeObjects/stats/span_durations`,
386+
undefined,
387+
{
388+
environment: environment,
389+
spanName: spanName,
390+
instrumentationLibrary: instrumentationLib,
391+
codeObjectId: codeObjectId
392+
});
393+
return response;
394+
}
395+
396+
public async getSpanHistogramData(spanName: string, instrumentationLib: string,
397+
codeObjectId: string, environment:string): Promise<SpanHistogramData>
398+
{
399+
400+
const response: SpanHistogramData = await this.send<any>(
401+
'POST',
402+
`/CodeAnalytics/codeObjects/stats/span_histogram`,
403+
undefined,
404+
{
405+
environment: environment,
406+
spanName: spanName,
407+
instrumentationLibrary: instrumentationLib,
408+
codeObjectId: codeObjectId
409+
});
410+
return response;
411+
}
412+
413+
354414
public async getGlobalInsights(environment: string): Promise<any []>
355415
{
356416

src/services/utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ export function momentJsDateParser(key: string, value: any): any
144144
{
145145
if (typeof value === 'string' && reISO.test(value))
146146
{
147-
return moment(value);
147+
return moment.utc(value);
148148
}
149149
return value;
150150
};

src/views-ui/codeAnalytics/contracts.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { decimal } from "vscode-languageclient"
12

23
export namespace UiMessage
34
{
@@ -28,6 +29,10 @@ export namespace UiMessage
2829
export class GoToFileAndLine {
2930
constructor(public file?: string, public line?:number){}
3031
}
32+
33+
export class OpenHistogramPanel {
34+
constructor(public span?: string, public instrumentationLibrary?:string){}
35+
}
3136
export class OpenRawTrace {
3237
constructor(public content?: string) {}
3338
}
@@ -59,6 +64,11 @@ export namespace UiMessage
5964
constructor(public htmlContent?: string) {}
6065
}
6166

67+
export class HistogramPanel{
68+
constructor(public data?: decimal[]) {}
69+
70+
}
71+
6272
export class GlobalInsightsList {
6373
constructor(public htmlContent?: string) {}
6474
}

0 commit comments

Comments
 (0)