You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The SLOscribe CLI can be installed easily via the installation script.
46
+
47
+
```shell
48
+
curl -sfL https://raw.githubusercontent.com/slosive/sloscribe/main/install.sh | sh -
49
+
```
50
+
51
+
This will install the required binary for your machine (Linux/Mac only).
52
+
53
+
For other ways of installing the tool please check the [installation guide](https://slotalk.fadey.io/docs/category/installation).
54
+
43
55
## 📚 Basic example - Generate Prometheus alert groups from code annotations
44
56
45
57
This example shows how sloth's comments can be added next to the prometheus metrics defined in a `metrics.go` file.
@@ -54,7 +66,7 @@ This example shows how sloth's comments can be added next to the prometheus metr
54
66
// @sloth.slo description 95% of logins to the chat-gpt app should be successful.
55
67
// @sloth.alerting name ChatGPTAvailability
56
68
metricTenantLogins = prometheus.NewCounter(
57
-
prometheus.GaugeOpts{
69
+
prometheus.CounterOpts{
58
70
Namespace: "chatgpt",
59
71
Subsystem: "auth0",
60
72
Name: "tenant_login_operations_total",
@@ -303,18 +315,6 @@ groups:
303
315
304
316
</details>
305
317
306
-
## 🔽 Install
307
-
308
-
The SLOscribe CLI can be installed easily via the installation script.
309
-
310
-
```shell
311
-
curl -sfL https://raw.githubusercontent.com/slosive/sloscribe/main/install.sh | sh -
312
-
```
313
-
314
-
This will install the required binary for your machine (Linux/Mac only).
315
-
316
-
For other ways of installing the tool please check the [installation guide](https://slotalk.fadey.io/docs/category/installation).
317
-
318
318
## 🚀 Get Started
319
319
320
320
1. Add comments to your source code. See [Declarative Comments](https://slotalk.fadey.io/docs/category/sloth-annotations).
@@ -342,14 +342,14 @@ Usage:
342
342
sloscribe init [flags]
343
343
344
344
Flags:
345
-
--dirs strings Comma separated list of directories to be parses by the tool (default [...])
346
-
-f, --file string Target file to parse. example: ./metrics.go
347
-
--format strings Output format (yaml,json). (default [yaml])
348
-
-h, --help helpfor init
349
-
--lang string Language of the sourcefiles. (go) (default "go")
350
-
--services strings Comma separated list of service names. These will selectthe output service specifications returned by the tool.
351
-
--specification string The name of the specification the tool should parse the source file for, example: sloth or sloth-k8s. (default "sloth")
352
-
--to-file Print the generated specifications to file, under ./slo_definitions.
345
+
--dirs strings Comma separated list of directories to be recursively parsed by the tool (default [/home/jetstack-oluwole/go/src/github.com/slosive/sloscribe])
346
+
-f, --file string Source code file to parse for annotations. Example: ./metrics.go
347
+
--format strings Format of the output returned by the tool. Available: yaml,json. (default [yaml])
--service-selector strings Comma separated list of service specification names. These will select the output service specifications returned by the tool. Example: --service-selector app1,app3
351
+
--specification string The SLO specification the tool should parse the source file for. Available: sloth, sloth-k8s. (default "sloth")
352
+
--to-file Tells the tool to save the generated specifications to file, under ./slo_definitions.
353
353
354
354
Global Flags:
355
355
--log-level string Only log messages with the given severity or above. One of: [none, debug, info, warn], errors will always be printed (default "info")
multierr.Append(err, errors.Errorf("unsupported language %q was passed to --lang flag", o.SourceLanguage)),
69
-
"unsupported_language")
64
+
err=multierr.Append(err, errors.Errorf("unsupported language %q was passed to --lang flag", o.SourceLanguage))
70
65
}
71
66
returnerr
72
67
}
@@ -84,43 +79,43 @@ func (o *Options) addAppFlags(fs *pflag.FlagSet) {
84
79
&o.IncludedDirs,
85
80
"dirs",
86
81
[]string{getWorkingDirOrDie()},
87
-
"Comma separated list of directories to be parses by the tool",
82
+
"Comma separated list of directories to be recursively parsed by the tool",
88
83
)
89
84
fs.StringSliceVar(
90
85
&o.Formats,
91
86
"format",
92
87
[]string{"yaml"},
93
-
"Output format (yaml,json).",
88
+
"Format of the output returned by the tool. Available: yaml,json.",
94
89
)
95
90
fs.StringVar(
96
91
(*string)(&o.SourceLanguage),
97
92
"lang",
98
93
"go",
99
-
"Language of the source files. (go)",
94
+
"Target source code language. Available: go.",
100
95
)
101
96
fs.StringVarP(
102
97
&o.Source,
103
98
"file",
104
99
"f",
105
100
"",
106
-
"Target file to parse. example: ./metrics.go",
101
+
"Source code file to parse for annotations. Example: ./metrics.go",
107
102
)
108
103
fs.BoolVar(
109
104
&o.ToFile,
110
105
"to-file",
111
106
false,
112
-
"Print the generated specifications to file, under ./slo_definitions.",
107
+
"Tells the tool to save the generated specifications to file, under ./slo_definitions.",
113
108
)
114
109
fs.StringSliceVar(
115
110
&o.Services,
116
-
"services",
111
+
"service-selector",
117
112
[]string{},
118
-
"Comma separated list of service names. These will select the output service specifications returned by the tool.",
113
+
"Comma separated list of service specification names. These will select the output service specifications returned by the tool. Example: --service-selector app1,app3 ",
119
114
)
120
115
fs.StringVar(
121
116
&o.Target,
122
117
"specification",
123
118
"sloth",
124
-
"The name of the specification the tool should parse the source file for, example: sloth or sloth-k8s.",
119
+
"The SLO specification the tool should parse the source file for. Available: sloth, sloth-k8s.",
0 commit comments