Skip to content

Commit 09a4117

Browse files
feat/basic incidents handling
1 parent f3e2a2c commit 09a4117

17 files changed

Lines changed: 424 additions & 129 deletions

File tree

.idea/workspace.xml

Lines changed: 37 additions & 32 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
package com.traceo.sdk;
2+
3+
import com.traceo.sdk.http.HttpMethod;
4+
import com.traceo.sdk.http.IRequest;
5+
6+
import java.util.HashMap;
7+
import java.util.Map;
8+
9+
public class DefaultRequest<T> implements IRequest<T> {
10+
11+
private T content;
12+
13+
private Map<String, String> headers = new HashMap<>();
14+
15+
private HttpMethod httpMethod = HttpMethod.POST;
16+
17+
private String endpoint;
18+
19+
public DefaultRequest() {}
20+
21+
public DefaultRequest(String endpoint, T content) {
22+
this(endpoint, content, new HashMap<>());
23+
}
24+
25+
public DefaultRequest(String endpoint, T content, Map<String, String> headers) {
26+
this(HttpMethod.POST, endpoint, content, headers);
27+
}
28+
29+
public DefaultRequest(HttpMethod httpMethod, String endpoint, T content, Map<String, String> headers) {
30+
this.content = content;
31+
this.headers = headers;
32+
this.httpMethod = httpMethod;
33+
this.endpoint = endpoint;
34+
}
35+
36+
@Override
37+
public HttpMethod getHttpMethod() {
38+
return this.httpMethod;
39+
}
40+
41+
@Override
42+
public Map<String, String> getHeaders() {
43+
return this.headers;
44+
}
45+
46+
@Override
47+
public String getEndpoint() {
48+
return this.endpoint;
49+
}
50+
51+
@Override
52+
public void setEndpoint(String endpoint) {
53+
this.endpoint = endpoint;
54+
}
55+
56+
@Override
57+
public T getContent() {
58+
return this.content;
59+
}
60+
61+
@Override
62+
public void setContent(T content) {
63+
this.content = content;
64+
}
65+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
package com.traceo.sdk;
2+
3+
public interface EventCallback<T> {
4+
void run(T callback);
5+
}
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
package com.traceo.sdk;
2+
3+
import java.util.ArrayList;
4+
import java.util.List;
5+
6+
public class TraceoIncident {
7+
private String name;
8+
9+
private String message;
10+
11+
private String stack;
12+
13+
private TraceoRuntimePlatform platform = new TraceoRuntimePlatform();
14+
15+
private List<TraceoTrace> traces = new ArrayList<>();
16+
17+
public TraceoIncident() {}
18+
19+
public TraceoIncident(String name, String message, String stack, TraceoRuntimePlatform platform, List<TraceoTrace> traces) {
20+
this.name = name;
21+
this.message = message;
22+
this.stack = stack;
23+
this.platform = platform;
24+
this.traces = traces;
25+
}
26+
27+
public String getName() {
28+
return name;
29+
}
30+
31+
public void setName(String name) {
32+
this.name = name;
33+
}
34+
35+
public String getMessage() {
36+
return message;
37+
}
38+
39+
public void setMessage(String message) {
40+
this.message = message;
41+
}
42+
43+
public String getStack() {
44+
return stack;
45+
}
46+
47+
public void setStack(String stack) {
48+
this.stack = stack;
49+
}
50+
51+
public TraceoRuntimePlatform getPlatform() {
52+
return platform;
53+
}
54+
55+
public void setPlatform(TraceoRuntimePlatform platform) {
56+
this.platform = platform;
57+
}
58+
59+
public List<TraceoTrace> getTraces() {
60+
return traces;
61+
}
62+
63+
public void setTraces(List<TraceoTrace> traces) {
64+
this.traces = traces;
65+
}
66+
}
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
package com.traceo.sdk;
2+
3+
public class TraceoRuntimePlatform {
4+
private String arch;
5+
6+
private String platform;
7+
8+
private String release;
9+
10+
public TraceoRuntimePlatform() {
11+
this(System.getProperty("os.arch"), System.getProperty("os.name"), System.getProperty("os.release"));
12+
}
13+
14+
public TraceoRuntimePlatform(String arch, String name, String release) {
15+
this.arch = arch;
16+
this.platform = name;
17+
this.release = release;
18+
}
19+
20+
public String getArch() {
21+
return arch;
22+
}
23+
24+
public void setArch(String arch) {
25+
this.arch = arch;
26+
}
27+
28+
public String getPlatform() {
29+
return platform;
30+
}
31+
32+
public void setPlatform(String platform) {
33+
this.platform = platform;
34+
}
35+
36+
public String getRelease() {
37+
return release;
38+
}
39+
40+
public void setRelease(String release) {
41+
this.release = release;
42+
}
43+
}

0 commit comments

Comments
 (0)