diff --git a/CHANGELOG.md b/CHANGELOG.md index 27bae0304..470d4d34a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -42,6 +42,7 @@ NOTE: As semantic versioning states all 0.y.z releases can contain breaking chan - [#194](https://github.com/kobsio/kobs/pull/194): [elasticsearch] Use pagination instead of infinite scrolling to display logs. - [#195](https://github.com/kobsio/kobs/pull/195): [istio] Display upstream cluster instead of authority in the React UI and ignore query string in path. - [#197](https://github.com/kobsio/kobs/pull/197): [clickhouse] Change break down filter for aggregation, to allow more complex filters. +- [#210](https://github.com/kobsio/kobs/pull/210): [klogs] :warning: _Breaking change:_ :warning: Rename `clickhouse` plugin to `klogs`. ## [v0.6.0](https://github.com/kobsio/kobs/releases/tag/v0.6.0) (2021-10-11) diff --git a/app/package.json b/app/package.json index a3da732b2..4e808690f 100644 --- a/app/package.json +++ b/app/package.json @@ -5,20 +5,23 @@ "proxy": "http://localhost:15220", "dependencies": { "@kobsio/plugin-applications": "*", - "@kobsio/plugin-clickhouse": "*", "@kobsio/plugin-core": "*", "@kobsio/plugin-dashboards": "*", "@kobsio/plugin-elasticsearch": "*", "@kobsio/plugin-flux": "*", + "@kobsio/plugin-grafana": "*", + "@kobsio/plugin-harbor": "*", "@kobsio/plugin-istio": "*", "@kobsio/plugin-jaeger": "*", "@kobsio/plugin-kiali": "*", + "@kobsio/plugin-klogs": "*", "@kobsio/plugin-markdown": "*", "@kobsio/plugin-opsgenie": "*", "@kobsio/plugin-prometheus": "*", "@kobsio/plugin-resources": "*", "@kobsio/plugin-rss": "*", "@kobsio/plugin-sonarqube": "*", + "@kobsio/plugin-sql": "*", "@kobsio/plugin-teams": "*", "@kobsio/plugin-users": "*", "@types/react": "^17.0.0", diff --git a/app/src/index.tsx b/app/src/index.tsx index 3a73e65c9..047f1399d 100644 --- a/app/src/index.tsx +++ b/app/src/index.tsx @@ -6,7 +6,6 @@ import './index.css'; // Import plugins. Here we import all plugins, which we want to add to the current kobs app. By default this are all // first party plugins from the /plugins folder. import { App } from '@kobsio/plugin-core'; -import clickhousePlugin from '@kobsio/plugin-clickhouse'; import applicationsPlugin from '@kobsio/plugin-applications'; import dashboardsPlugin from '@kobsio/plugin-dashboards'; import elasticsearchPlugin from '@kobsio/plugin-elasticsearch'; @@ -16,6 +15,7 @@ import harborPlugin from '@kobsio/plugin-harbor'; import istioPlugin from '@kobsio/plugin-istio'; import jaegerPlugin from '@kobsio/plugin-jaeger'; import kialiPlugin from '@kobsio/plugin-kiali'; +import klogsPlugin from '@kobsio/plugin-klogs'; import markdownPlugin from '@kobsio/plugin-markdown'; import opsgeniePlugin from '@kobsio/plugin-opsgenie'; import prometheusPlugin from '@kobsio/plugin-prometheus'; @@ -30,7 +30,6 @@ ReactDOM.render( .app.eu.opsgenie.com - clickhouse: - - name: clickhouse-logging - displayName: ClickHouse (Logging) - description: ClickHouse is a fast open-source OLAP database management system. + klogs: + - name: klogs + displayName: klogs + description: Fast, scalable and reliable logging using Fluent Bit, Kafka and ClickHouse. address: localhost:9000 database: logs username: ${CLICKHOUSE_USERNAME} diff --git a/docs/configuration/plugins.md b/docs/configuration/plugins.md index 4bfc27060..9f108b195 100644 --- a/docs/configuration/plugins.md +++ b/docs/configuration/plugins.md @@ -5,13 +5,13 @@ Plugins can be used to extend the functions of kobs. They can be configured usin | Field | Type | Description | Required | | ----- | ---- | ----------- | -------- | | applications | [Applications](#applications) | Configure the caching behaviour for the applications plugin. | No | -| clickhouse | [[]ClickHouse](#clickhouse) | Configure multiple ClickHouse instances, which can be used within kobs. | No | | elasticsearch | [[]Elasticsearch](#elasticsearch) | Configure multiple Elasticsearch instances, which can be used within kobs. | No | | grafana | [[]Grafana](#grafana) | Configure multiple Grafana instances, which can be used within kobs. | No | | harbor | [[]Harbor](#harbor) | Configure multiple Harbor instances, which can be used within kobs. | No | | istio | [[]Istio](#istio) | Configure multiple Istio instances, which can be used within kobs. | No | | jaeger | [[]Jaeger](#jaeger) | Configure multiple Jaeger instances, which can be used within kobs. | No | | kiali | [[]Kiali](#kiali) | Configure multiple Kiali instances, which can be used within kobs. | No | +| klogs | [[]klogs](#klogs) | Configure multiple klogs instances, which can be used within kobs. | No | | opsgenie | [[]Opsgenie](#opsgenie) | Configure the Opsgenie API, which can be used within kobs. | No | | prometheus | [[]Prometheus](#prometheus) | Configure multiple Prometheus instances, which can be used within kobs. | No | | resources | [Resources](#resources) | Configuration for the resources plugin. | No | @@ -34,33 +34,6 @@ plugins: | topologyCacheDuration | [duration](https://pkg.go.dev/time#ParseDuration) | The duration for how long the topology graph should be cached. The default value is `1h`. | No | | teamsCacheDuration | [duration](https://pkg.go.dev/time#ParseDuration) | The duration for how long the teams for an application should be cached. The default value is `1h`. | No | -## ClickHouse - -The ClickHouse plugin provides a user interface for the [kobsio/fluent-bit-clickhouse](https://github.com/kobsio/fluent-bit-clickhouse) Fluent Bit plugin. - -The following config can be used to grant kobs access to a ClickHouse instance running at `clickhouse-clickhouse.logging.svc.cluster.local:9000`, where the logs are save in a database named `logs`. To access ClickHouse the user `admin` with the password `admin` is used. - -```yaml -plugins: - clickhouse: - - name: ClickHouse - description: ClickHouse is a fast open-source OLAP database management system. - address: clickhouse-clickhouse.logging.svc.cluster.local:9000 - database: logs - username: admin - password: admin -``` - -| Field | Type | Description | Required | -| ----- | ---- | ----------- | -------- | -| name | string | Name of the ClickHouse instance. | Yes | -| displayName | string | Name of the ClickHouse as it is shown in the UI. | Yes | -| descriptions | string | Description of the ClickHouse instance. | No | -| address | string | Address of the ClickHouse instance. | Yes | -| username | string | Username to access a ClickHouse instance. | No | -| password | string | Password to access a ClickHouse instance. | No | -| materializedColumns | []string | A list of materialized columns. See [kobsio/fluent-bit-clickhouse](https://github.com/kobsio/fluent-bit-clickhouse#configuration) for more information. | No | - ## Elasticsearch The following config can be used to grant kobs access to a Elasticsearch instance running on `elasticsearch.kobs.io` and is protected with basic authentication. The credentials will be provided by the environment variables `ES_USERANME` and `ES_PASSWORD`. @@ -135,7 +108,7 @@ plugins: ## Istio -The following configuration can be used to access a Istio instances using a Prometheus plugin named `prometheus` and an Clickhouse plugin named `clickhouse`. +The following configuration can be used to access a Istio instances using a Prometheus plugin named `prometheus` and an klogs plugin named `klogs`. ```yaml plugins: @@ -146,9 +119,9 @@ plugins: prometheus: enabled: true name: prometheus - clickhouse: + klogs: enabled: true - name: clickhouse + name: klogs ``` | Field | Type | Description | Required | @@ -158,8 +131,8 @@ plugins: | descriptions | string | Description of the Istio instance. | No | | prometheus.enabled | boolean | Enabled the Prometheus integration for Istio. | No | | prometheus.name | string | The name of the Prometheus instance which should be used for the Istio instance. | No | -| clickhouse.enabled | boolean | Enabled the Clickhouse integration for Istio. | No | -| clickhouse.name | string | The name of the Clickhouse instance which should be used for the Istio instance. | No | +| klogs.enabled | boolean | Enabled the klogs integration for Istio. | No | +| klogs.name | string | The name of the klogs instance which should be used for the Istio instance. | No | ## Jaeger @@ -211,6 +184,33 @@ plugins: | traffic.failure | number | Threshold to mark edges with failures. This must be a number between `0` and `100`. The default value is `5`. | No | | traffic.degraded | number | Threshold to mark edges with degraded performance. This must be a number between `0` and `100`. The default value is `1`. | No | +## klogs + +The klogs plugin provides a user interface for the [kobsio/klogs](https://github.com/kobsio/klogs) Fluent Bit plugin, which allows you to collect logs via Fluent Bit and save them in ClickHouse. + +The following config can be used to grant kobs access to a ClickHouse instance running at `clickhouse-clickhouse.logging.svc.cluster.local:9000`, where the logs are save in a database named `logs`. To access ClickHouse the user `admin` with the password `admin` is used. + +```yaml +plugins: + klogs: + - name: klogs + description: Fast, scalable and reliable logging using Fluent Bit, Kafka and ClickHouse. + address: clickhouse-clickhouse.logging.svc.cluster.local:9000 + database: logs + username: admin + password: admin +``` + +| Field | Type | Description | Required | +| ----- | ---- | ----------- | -------- | +| name | string | Name of the ClickHouse instance. | Yes | +| displayName | string | Name of the ClickHouse as it is shown in the UI. | Yes | +| descriptions | string | Description of the ClickHouse instance. | No | +| address | string | Address of the ClickHouse instance. | Yes | +| username | string | Username to access a ClickHouse instance. | No | +| password | string | Password to access a ClickHouse instance. | No | +| materializedColumns | []string | A list of materialized columns. See [kobsio/klogs](https://github.com/kobsio/klogs#configuration) for more information. | No | + ## Opsgenie The following configuration can be used to access the Opsgenie API. diff --git a/docs/plugins/assets/clickhouse-aggregation.png b/docs/plugins/assets/klogs-aggregation.png similarity index 100% rename from docs/plugins/assets/clickhouse-aggregation.png rename to docs/plugins/assets/klogs-aggregation.png diff --git a/docs/plugins/assets/clickhouse-logs.png b/docs/plugins/assets/klogs-logs.png similarity index 100% rename from docs/plugins/assets/clickhouse-logs.png rename to docs/plugins/assets/klogs-logs.png diff --git a/docs/plugins/istio.md b/docs/plugins/istio.md index 61ea8e94a..e19d6a6b1 100644 --- a/docs/plugins/istio.md +++ b/docs/plugins/istio.md @@ -1,6 +1,6 @@ # Istio -The Istio plugin can be used to observe your service mesh within kobs. For that kobs uses an existing Prometheus and Clickhouse instance to get the metrics for your applications which are part of the service mesh and to build a simple topology graph for them. +The Istio plugin can be used to observe your service mesh within kobs. For that kobs uses an existing Prometheus and klogs instance to get the metrics for your applications which are part of the service mesh and to build a simple topology graph for them. ![Overview](assets/istio-page-overview.png) @@ -10,7 +10,7 @@ For each application you have a metrics, top and tap view. The metrics view show ![Metrics Details](assets/istio-page-metrics.png) -The top view can be used to get the aggregated metrics, based on the request direction, service, method and path. These metrics are generated based on the access logs via the Clickhouse plugin. The top view shows the number of requests, the best, worst, average, and last request duration and the success rate. You can also go to the tap view, for a specific request type. +The top view can be used to get the aggregated metrics, based on the request direction, service, method and path. These metrics are generated based on the access logs via the klogs plugin. The top view shows the number of requests, the best, worst, average, and last request duration and the success rate. You can also go to the tap view, for a specific request type. ![Top](assets/istio-page-top.png) diff --git a/docs/plugins/clickhouse.md b/docs/plugins/klogs.md similarity index 88% rename from docs/plugins/clickhouse.md rename to docs/plugins/klogs.md index e24df1522..ac8f625b9 100644 --- a/docs/plugins/clickhouse.md +++ b/docs/plugins/klogs.md @@ -1,15 +1,12 @@ -# ClickHouse +# klogs -!!! note - The ClickHouse plugin can only be used with the [kobsio/fluent-bit-clickhouse](https://github.com/kobsio/fluent-bit-clickhouse) Fluent Bit plugin. If you want to use kobs to run raw SQL commands against a ClickHouse instance you can use the [SQL plugin](sql.md). +The klogs plugin can be used together with the [kobsio/klogs](https://github.com/kobsio/klogs) output plugin for [Fluent Bit](https://fluentbit.io). You can then use the specified [Query Syntax](#query-syntax) to get the logs from ClickHouse. -The ClickHouse plugin can be used together with the [kobsio/fluent-bit-clickhouse](https://github.com/kobsio/fluent-bit-clickhouse) output plugin for [Fluent Bit](https://fluentbit.io). You can then use the specified [Query Syntax](#query-syntax) to get the logs from ClickHouse. - -![Logs](assets/clickhouse-logs.png) +![Logs](assets/klogs-logs.png) ## Options -The following options can be used for a panel with the ClickHouse plugin: +The following options can be used for a panel with the klogs plugin: | Field | Type | Description | Required | | ----- | ---- | ----------- | -------- | @@ -21,8 +18,8 @@ The following options can be used for a panel with the ClickHouse plugin: | Field | Type | Description | Required | | ----- | ---- | ----------- | -------- | -| name | string | A name for the ClickHouse query, which is displayed in the select box. | Yes | -| query | string | The query which should be run against ClickHouse. See [Query Syntax](#query-syntax) for more information on the syntax, when ClickHouse is used in the `logs` mode. | Yes | +| name | string | A name for the klogs query, which is displayed in the select box. | Yes | +| query | string | The query which should be run against ClickHouse. See [Query Syntax](#query-syntax) for more information on the syntax. | Yes | | fields | []string | A list of fields to display in the results table. If this field is omitted, the whole document is displayed in the results table. This field is only available for the `logs`. | No | | order | string | Order for the returned logs. Must be `ascending` or `descending`. The default value for this field is `descending`. | No | | orderBy | string | The name of the field, by which the results should be orderd. The default value for this field is `timestamp`. | No | @@ -38,7 +35,7 @@ spec: - title: Istio Logs colSpan: 12 plugin: - name: clickhouse + name: klogs options: type: logs queries: @@ -83,7 +80,7 @@ spec: - title: Number of Logs per App colSpan: 6 plugin: - name: clickhouse-logging + name: klogs options: type: aggregation aggregation: @@ -98,7 +95,7 @@ spec: - title: Log Levels for MyApplication colSpan: 6 plugin: - name: clickhouse-logging + name: klogs options: type: aggregation aggregation: @@ -112,7 +109,7 @@ spec: - title: Request Duration for MyApplication by Response Code colSpan: 12 plugin: - name: clickhouse-logging + name: klogs options: type: aggregation aggregation: @@ -126,7 +123,7 @@ spec: - content.response_code ``` -![Aggregation Example](assets/clickhouse-aggregation.png) +![Aggregation Example](assets/klogs-aggregation.png) ### Aggregation Options diff --git a/mkdocs.yml b/mkdocs.yml index 2e430e803..f14af3960 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -47,7 +47,6 @@ nav: - Plugins: - Getting Started: plugins/getting-started.md - Applications: plugins/applications.md - - ClickHouse: plugins/clickhouse.md - Dashboards: plugins/dashboards.md - Elasticsearch: plugins/elasticsearch.md - Flux: plugins/flux.md @@ -56,6 +55,7 @@ nav: - Istio: plugins/istio.md - Jaeger: plugins/jaeger.md - Kiali: plugins/kiali.md + - klogs: plugins/klogs.md - Markdown: plugins/markdown.md - Opsgenie: plugins/opsgenie.md - Prometheus: plugins/prometheus.md diff --git a/plugins/istio/istio.go b/plugins/istio/istio.go index 21f7223be..4c398a7bd 100644 --- a/plugins/istio/istio.go +++ b/plugins/istio/istio.go @@ -7,8 +7,8 @@ import ( "github.com/kobsio/kobs/pkg/api/clusters" "github.com/kobsio/kobs/pkg/api/middleware/errresponse" "github.com/kobsio/kobs/pkg/api/plugins/plugin" - clickhouseInstance "github.com/kobsio/kobs/plugins/clickhouse/pkg/instance" "github.com/kobsio/kobs/plugins/istio/pkg/instance" + klogsInstance "github.com/kobsio/kobs/plugins/klogs/pkg/instance" prometheusInstance "github.com/kobsio/kobs/plugins/prometheus/pkg/instance" "github.com/go-chi/chi/v5" @@ -370,11 +370,11 @@ func (router *Router) getTopDetails(w http.ResponseWriter, r *http.Request) { } // Register returns a new router which can be used in the router for the kobs rest api. -func Register(clusters *clusters.Clusters, plugins *plugin.Plugins, config Config, prometheusInstances []*prometheusInstance.Instance, clickhouseInstances []*clickhouseInstance.Instance) chi.Router { +func Register(clusters *clusters.Clusters, plugins *plugin.Plugins, config Config, prometheusInstances []*prometheusInstance.Instance, klogsInstances []*klogsInstance.Instance) chi.Router { var instances []*instance.Instance for _, cfg := range config { - instance, err := instance.New(cfg, prometheusInstances, clickhouseInstances) + instance, err := instance.New(cfg, prometheusInstances, klogsInstances) if err != nil { log.WithError(err).WithFields(logrus.Fields{"name": cfg.Name}).Fatalf("Could not create Istio instance") } @@ -384,7 +384,7 @@ func Register(clusters *clusters.Clusters, plugins *plugin.Plugins, config Confi var options map[string]interface{} options = make(map[string]interface{}) options["prometheus"] = cfg.Prometheus.Enabled - options["clickhouse"] = cfg.Clickhouse.Enabled + options["klogs"] = cfg.Klogs.Enabled plugins.Append(plugin.Plugin{ Name: cfg.Name, diff --git a/plugins/istio/pkg/instance/instance.go b/plugins/istio/pkg/instance/instance.go index cffa8b392..29c338e18 100644 --- a/plugins/istio/pkg/instance/instance.go +++ b/plugins/istio/pkg/instance/instance.go @@ -5,7 +5,7 @@ import ( "fmt" "strings" - clickhouseInstance "github.com/kobsio/kobs/plugins/clickhouse/pkg/instance" + klogsInstance "github.com/kobsio/kobs/plugins/klogs/pkg/instance" prometheusInstance "github.com/kobsio/kobs/plugins/prometheus/pkg/instance" "github.com/sirupsen/logrus" @@ -21,7 +21,7 @@ type Config struct { DisplayName string `json:"displayName"` Description string `json:"description"` Prometheus ConfigPrometheus `json:"prometheus"` - Clickhouse ConfigClickhouse `json:"clickhouse"` + Klogs ConfigKlogs `json:"klogs"` } // ConfigPrometheus is the structure of the configuration, which is required to enabled the Prometheus integration for @@ -31,9 +31,9 @@ type ConfigPrometheus struct { Name string `json:"name"` } -// ConfigClickhouse is the structure of the configuration, which is required to enabled the Clickhouse integration for -// the Istio plugin. -type ConfigClickhouse struct { +// ConfigKlogs is the structure of the configuration, which is required to enabled the klogs integration for the Istio +// plugin. +type ConfigKlogs struct { Enabled bool `json:"enabled"` Name string `json:"name"` } @@ -42,7 +42,7 @@ type ConfigClickhouse struct { type Instance struct { Name string prometheus *prometheusInstance.Instance - clickhouse *clickhouseInstance.Instance + klogs *klogsInstance.Instance } // GetNamespaces returns a list of namespaces, which can be selected to get the applications from. @@ -313,7 +313,7 @@ func (i *Instance) Tap(ctx context.Context, namespace, application, filterUpstre filters = filters + fmt.Sprintf(" _and_ content.path~'%s'", filterPath) } - logs, _, _, _, _, err := i.clickhouse.GetLogs(ctx, fmt.Sprintf("namespace='%s' _and_ app='%s' _and_ container_name='istio-proxy' %s", namespace, application, filters), "", "", 100, timeStart, timeEnd) + logs, _, _, _, _, err := i.klogs.GetLogs(ctx, fmt.Sprintf("namespace='%s' _and_ app='%s' _and_ container_name='istio-proxy' %s", namespace, application, filters), "", "", 100, timeStart, timeEnd) if err != nil { return nil, err } @@ -334,7 +334,7 @@ func (i *Instance) Top(ctx context.Context, namespace, application, filterUpstre filters = filters + fmt.Sprintf(" AND match(fields_string.value[indexOf(fields_string.key, 'content.path')], '%s')", filterPath) } - rows, _, err := i.clickhouse.GetRawQueryResults(ctx, fmt.Sprintf(`SELECT + rows, _, err := i.klogs.GetRawQueryResults(ctx, fmt.Sprintf(`SELECT fields_string.value[indexOf(fields_string.key, 'content.upstream_cluster')] as upstream, fields_string.value[indexOf(fields_string.key, 'content.method')] as method, path(fields_string.value[indexOf(fields_string.key, 'content.path')]) as path, @@ -375,7 +375,7 @@ func (i *Instance) TopDetails(ctx context.Context, namespace, application, upstr filters = filters + fmt.Sprintf(" AND path(fields_string.value[indexOf(fields_string.key, 'content.path')]) = '%s'", path) } - rows, _, err := i.clickhouse.GetRawQueryResults(ctx, fmt.Sprintf(`SELECT + rows, _, err := i.klogs.GetRawQueryResults(ctx, fmt.Sprintf(`SELECT toStartOfInterval(timestamp, INTERVAL %d second) AS interval_data, count(*) AS count_data, countIf(fields_number.value[indexOf(fields_number.key, 'content.response_code')] < 500) / count_data * 100 as sr_data, @@ -396,9 +396,9 @@ SETTINGS skip_unavailable_shards = 1`, interval, timeStart, timeEnd, filters, ti } // New returns a new Elasticsearch instance for the given configuration. -func New(config Config, prometheusInstances []*prometheusInstance.Instance, clickhouseInstances []*clickhouseInstance.Instance) (*Instance, error) { +func New(config Config, prometheusInstances []*prometheusInstance.Instance, klogsInstances []*klogsInstance.Instance) (*Instance, error) { var prometheusInstance *prometheusInstance.Instance - var clickhouseInstance *clickhouseInstance.Instance + var klogsInstance *klogsInstance.Instance if config.Prometheus.Enabled { for _, instance := range prometheusInstances { @@ -412,21 +412,21 @@ func New(config Config, prometheusInstances []*prometheusInstance.Instance, clic } } - if config.Clickhouse.Enabled { - for _, instance := range clickhouseInstances { - if instance.Name == config.Clickhouse.Name { - clickhouseInstance = instance + if config.Klogs.Enabled { + for _, instance := range klogsInstances { + if instance.Name == config.Klogs.Name { + klogsInstance = instance } } - if clickhouseInstance == nil { - return nil, fmt.Errorf("Clickhouse instance \"%s\" was not found", config.Clickhouse.Name) + if klogsInstance == nil { + return nil, fmt.Errorf("klogs instance \"%s\" was not found", config.Klogs.Name) } } return &Instance{ Name: config.Name, prometheus: prometheusInstance, - clickhouse: clickhouseInstance, + klogs: klogsInstance, }, nil } diff --git a/plugins/istio/src/components/page/ApplicationTap.tsx b/plugins/istio/src/components/page/ApplicationTap.tsx index 3509aadff..968fb26b8 100644 --- a/plugins/istio/src/components/page/ApplicationTap.tsx +++ b/plugins/istio/src/components/page/ApplicationTap.tsx @@ -39,20 +39,20 @@ const ApplicationTap: React.FunctionComponent = ({ const history = useHistory(); const [liveUpdate, setLiveUpdate] = useState(false); - if (!pluginOptions.clickhouse) { + if (!pluginOptions.klogs) { return ( history.push('/')}>Home } > -

You have to enable the Clickhouse integration in the Istio plugin configuration.

+

You have to enable the klogs integration in the Istio plugin configuration.

diff --git a/plugins/istio/src/components/page/ApplicationTop.tsx b/plugins/istio/src/components/page/ApplicationTop.tsx index b9c69d233..4a235e63d 100644 --- a/plugins/istio/src/components/page/ApplicationTop.tsx +++ b/plugins/istio/src/components/page/ApplicationTop.tsx @@ -39,20 +39,20 @@ const ApplicationTop: React.FunctionComponent = ({ const history = useHistory(); const [liveUpdate, setLiveUpdate] = useState(false); - if (!pluginOptions.clickhouse) { + if (!pluginOptions.klogs) { return ( history.push('/')}>Home } > -

You have to enable the Clickhouse integration in the Istio plugin configuration.

+

You have to enable the klogs integration in the Istio plugin configuration.

diff --git a/plugins/istio/src/components/page/Page.tsx b/plugins/istio/src/components/page/Page.tsx index 4406207af..bf43dc0b2 100644 --- a/plugins/istio/src/components/page/Page.tsx +++ b/plugins/istio/src/components/page/Page.tsx @@ -17,7 +17,7 @@ const Page: React.FunctionComponent = ({ } const pluginOptions: IPluginOptions = { - clickhouse: options['clickhouse'], + klogs: options['klogs'], prometheus: options['prometheus'], }; diff --git a/plugins/istio/src/utils/interfaces.ts b/plugins/istio/src/utils/interfaces.ts index f85d2d72b..50ba736c3 100644 --- a/plugins/istio/src/utils/interfaces.ts +++ b/plugins/istio/src/utils/interfaces.ts @@ -6,7 +6,7 @@ import { IRowValues } from '@kobsio/plugin-prometheus'; export interface IPluginOptions { prometheus: boolean; - clickhouse: boolean; + klogs: boolean; } // IApplicationsOptions is the interface for the Istio applications page. diff --git a/plugins/clickhouse/clickhouse.go b/plugins/klogs/klogs.go similarity index 92% rename from plugins/clickhouse/clickhouse.go rename to plugins/klogs/klogs.go index 55e3ef227..755f31cd5 100644 --- a/plugins/clickhouse/clickhouse.go +++ b/plugins/klogs/klogs.go @@ -1,4 +1,4 @@ -package clickhouse +package klogs import ( "encoding/json" @@ -9,7 +9,7 @@ import ( "github.com/kobsio/kobs/pkg/api/clusters" "github.com/kobsio/kobs/pkg/api/middleware/errresponse" "github.com/kobsio/kobs/pkg/api/plugins/plugin" - "github.com/kobsio/kobs/plugins/clickhouse/pkg/instance" + "github.com/kobsio/kobs/plugins/klogs/pkg/instance" "github.com/go-chi/chi/v5" "github.com/go-chi/render" @@ -17,13 +17,13 @@ import ( ) // Route is the route under which the plugin should be registered in our router for the rest api. -const Route = "/clickhouse" +const Route = "/klogs" var ( - log = logrus.WithFields(logrus.Fields{"package": "clickhouse"}) + log = logrus.WithFields(logrus.Fields{"package": "klogs"}) ) -// Config is the structure of the configuration for the clickhouse plugin. +// Config is the structure of the configuration for the klogs plugin. type Config []instance.Config // Router implements the router for the resources plugin, which can be registered in the router for our rest api. @@ -62,8 +62,8 @@ func (router *Router) getFields(w http.ResponseWriter, r *http.Request) { } // getLogs implements the special handling when the user selected the "logs" options for the "view" configuration. This -// options is intended to use together with the kobsio/fluent-bit-clickhouse Fluent Bit plugin and provides a custom -// query language to get the logs from ClickHouse. +// options is intended to use together with the kobsio/klogs Fluent Bit plugin and provides a custom query language to +// get the logs from ClickHouse ingested via kobsio/klogs. func (router *Router) getLogs(w http.ResponseWriter, r *http.Request) { name := chi.URLParam(r, "name") query := r.URL.Query().Get("query") @@ -112,7 +112,7 @@ func (router *Router) getLogs(w http.ResponseWriter, r *http.Request) { // necessary because Go doesn't allow to set a new status code once the header was written. // See: https://github.com/golang/go/issues/36734 // For that we also have to handle errors, when the status code is 200 in the React UI. - // See plugins/clickhouse/src/components/page/Logs.tsx#L64 + // See plugins/klogs/src/components/page/Logs.tsx#L64 // w.WriteHeader(http.StatusProcessing) w.Write([]byte("\n")) f.Flush() @@ -217,7 +217,7 @@ func Register(clusters *clusters.Clusters, plugins *plugin.Plugins, config Confi for _, cfg := range config { instance, err := instance.New(cfg) if err != nil { - log.WithError(err).WithFields(logrus.Fields{"name": cfg.Name}).Fatalf("Could not create ClickHouse instance") + log.WithError(err).WithFields(logrus.Fields{"name": cfg.Name}).Fatalf("Could not create klogs instance") } instances = append(instances, instance) @@ -226,7 +226,7 @@ func Register(clusters *clusters.Clusters, plugins *plugin.Plugins, config Confi Name: cfg.Name, DisplayName: cfg.DisplayName, Description: cfg.Description, - Type: "clickhouse", + Type: "klogs", }) } diff --git a/plugins/clickhouse/package.json b/plugins/klogs/package.json similarity index 95% rename from plugins/clickhouse/package.json rename to plugins/klogs/package.json index abb32fa1c..3cbf2a324 100644 --- a/plugins/clickhouse/package.json +++ b/plugins/klogs/package.json @@ -1,5 +1,5 @@ { - "name": "@kobsio/plugin-clickhouse", + "name": "@kobsio/plugin-klogs", "version": "0.0.0", "license": "MIT", "private": false, diff --git a/plugins/clickhouse/pkg/instance/aggregation.go b/plugins/klogs/pkg/instance/aggregation.go similarity index 100% rename from plugins/clickhouse/pkg/instance/aggregation.go rename to plugins/klogs/pkg/instance/aggregation.go diff --git a/plugins/clickhouse/pkg/instance/aggregation_test.go b/plugins/klogs/pkg/instance/aggregation_test.go similarity index 100% rename from plugins/clickhouse/pkg/instance/aggregation_test.go rename to plugins/klogs/pkg/instance/aggregation_test.go diff --git a/plugins/clickhouse/pkg/instance/helpers.go b/plugins/klogs/pkg/instance/helpers.go similarity index 100% rename from plugins/clickhouse/pkg/instance/helpers.go rename to plugins/klogs/pkg/instance/helpers.go diff --git a/plugins/clickhouse/pkg/instance/helpers_test.go b/plugins/klogs/pkg/instance/helpers_test.go similarity index 100% rename from plugins/clickhouse/pkg/instance/helpers_test.go rename to plugins/klogs/pkg/instance/helpers_test.go diff --git a/plugins/clickhouse/pkg/instance/instance.go b/plugins/klogs/pkg/instance/instance.go similarity index 94% rename from plugins/clickhouse/pkg/instance/instance.go rename to plugins/klogs/pkg/instance/instance.go index cb5a249c3..3159741d3 100644 --- a/plugins/clickhouse/pkg/instance/instance.go +++ b/plugins/klogs/pkg/instance/instance.go @@ -13,10 +13,10 @@ import ( ) var ( - log = logrus.WithFields(logrus.Fields{"package": "clickhouse"}) + log = logrus.WithFields(logrus.Fields{"package": "klogs"}) ) -// Config is the structure of the configuration for a single ClickHouse instance. +// Config is the structure of the configuration for a single klogs instance. type Config struct { Name string `json:"name"` DisplayName string `json:"displayName"` @@ -30,7 +30,7 @@ type Config struct { MaterializedColumns []string `json:"materializedColumns"` } -// Instance represents a single ClickHouse instance, which can be added via the configuration file. +// Instance represents a single klogs instance, which can be added via the configuration file. type Instance struct { Name string database string @@ -364,7 +364,7 @@ func (i *Instance) GetRawQueryResults(ctx context.Context, query string) ([][]in return result, columns, nil } -// New returns a new ClickHouse instance for the given configuration. +// New returns a new klogs instance for the given configuration. func New(config Config) (*Instance, error) { if config.WriteTimeout == "" { config.WriteTimeout = "30" @@ -382,18 +382,6 @@ func New(config Config) (*Instance, error) { return nil, err } - // We do not execute the Ping command anymore to increase the reliability of kobs. So that kobs also starts when - // the ClickHouse instance isn't available during the start of kobs. - // if err := client.Ping(); err != nil { - // if exception, ok := err.(*clickhouse.Exception); ok { - // log.WithError(err).WithFields(logrus.Fields{"code": exception.Code, "message": exception.Message, "stacktrace": exception.StackTrace}).Errorf("could not ping database") - // } else { - // log.WithError(err).Errorf("could not ping database") - // } - - // return nil, err - // } - instance := &Instance{ Name: config.Name, database: config.Database, diff --git a/plugins/clickhouse/pkg/instance/logs.go b/plugins/klogs/pkg/instance/logs.go similarity index 98% rename from plugins/clickhouse/pkg/instance/logs.go rename to plugins/klogs/pkg/instance/logs.go index c32f694ad..bf75b4d0e 100644 --- a/plugins/clickhouse/pkg/instance/logs.go +++ b/plugins/klogs/pkg/instance/logs.go @@ -14,7 +14,7 @@ var ( fieldsMetric = promauto.NewCounterVec(prometheus.CounterOpts{ Namespace: "kobs", - Name: "clickhouse_fields_total", + Name: "klogs_fields_total", Help: "Number how often a field was used in a query.", }, []string{"field"}) ) @@ -132,7 +132,7 @@ func handleConditionParts(key, value, operator string, materializedColumns []str key = strings.TrimSpace(key) value = strings.TrimSpace(value) - // The kobs_clickhouse_fields_total metric can be used to determine how often a field is used. This information can + // The kobs_klogs_fields_total metric can be used to determine how often a field is used. This information can // then be used to create an additional column for this field via the following SQL commands: // ALTER TABLE logs.logs ON CLUSTER '{cluster}' ADD COLUMN String DEFAULT fields_string.value[indexOf(fields_string.key, '')]; // ALTER TABLE logs.logs ON CLUSTER '{cluster}' ADD COLUMN String DEFAULT fields_number.value[indexOf(fields_number.key, '')]; diff --git a/plugins/clickhouse/pkg/instance/logs_test.go b/plugins/klogs/pkg/instance/logs_test.go similarity index 100% rename from plugins/clickhouse/pkg/instance/logs_test.go rename to plugins/klogs/pkg/instance/logs_test.go diff --git a/plugins/clickhouse/pkg/instance/structs.go b/plugins/klogs/pkg/instance/structs.go similarity index 100% rename from plugins/clickhouse/pkg/instance/structs.go rename to plugins/klogs/pkg/instance/structs.go diff --git a/plugins/clickhouse/src/assets/icon.png b/plugins/klogs/src/assets/icon.png similarity index 100% rename from plugins/clickhouse/src/assets/icon.png rename to plugins/klogs/src/assets/icon.png diff --git a/plugins/clickhouse/src/assets/clickhouse.css b/plugins/klogs/src/assets/klogs.css similarity index 81% rename from plugins/clickhouse/src/assets/clickhouse.css rename to plugins/klogs/src/assets/klogs.css index 508364432..14133e421 100644 --- a/plugins/clickhouse/src/assets/clickhouse.css +++ b/plugins/klogs/src/assets/klogs.css @@ -1,4 +1,4 @@ -.kobsio-clickhouse-logs-preview { +.kobsio-klogs-logs-preview { line-height: 30px; overflow: hidden; text-overflow: ellipsis; diff --git a/plugins/clickhouse/src/components/page/Aggregation.tsx b/plugins/klogs/src/components/page/Aggregation.tsx similarity index 95% rename from plugins/clickhouse/src/components/page/Aggregation.tsx rename to plugins/klogs/src/components/page/Aggregation.tsx index 893225383..92a97132f 100644 --- a/plugins/clickhouse/src/components/page/Aggregation.tsx +++ b/plugins/klogs/src/components/page/Aggregation.tsx @@ -16,10 +16,10 @@ const Aggregation: React.FunctionComponent = ({ name, options const history = useHistory(); const { isError, isFetching, isLoading, data, error, refetch } = useQuery( - ['clickhouse/aggregation', name, options], + ['klogs/aggregation', name, options], async () => { try { - const response = await fetch(`/api/plugins/clickhouse/aggregation/${name}`, { + const response = await fetch(`/api/plugins/klogs/aggregation/${name}`, { body: JSON.stringify(options), method: 'post', }); diff --git a/plugins/clickhouse/src/components/page/AggregationActions.tsx b/plugins/klogs/src/components/page/AggregationActions.tsx similarity index 100% rename from plugins/clickhouse/src/components/page/AggregationActions.tsx rename to plugins/klogs/src/components/page/AggregationActions.tsx diff --git a/plugins/clickhouse/src/components/page/AggregationOptions.tsx b/plugins/klogs/src/components/page/AggregationOptions.tsx similarity index 100% rename from plugins/clickhouse/src/components/page/AggregationOptions.tsx rename to plugins/klogs/src/components/page/AggregationOptions.tsx diff --git a/plugins/clickhouse/src/components/page/AggregationOptionsFields.tsx b/plugins/klogs/src/components/page/AggregationOptionsFields.tsx similarity index 100% rename from plugins/clickhouse/src/components/page/AggregationOptionsFields.tsx rename to plugins/klogs/src/components/page/AggregationOptionsFields.tsx diff --git a/plugins/clickhouse/src/components/page/AggregationOptionsFilters.tsx b/plugins/klogs/src/components/page/AggregationOptionsFilters.tsx similarity index 100% rename from plugins/clickhouse/src/components/page/AggregationOptionsFilters.tsx rename to plugins/klogs/src/components/page/AggregationOptionsFilters.tsx diff --git a/plugins/clickhouse/src/components/page/AggregationPage.tsx b/plugins/klogs/src/components/page/AggregationPage.tsx similarity index 93% rename from plugins/clickhouse/src/components/page/AggregationPage.tsx rename to plugins/klogs/src/components/page/AggregationPage.tsx index bef82bbc9..b76cc5429 100644 --- a/plugins/clickhouse/src/components/page/AggregationPage.tsx +++ b/plugins/klogs/src/components/page/AggregationPage.tsx @@ -36,8 +36,8 @@ const AggregationPage: React.FunctionComponent = ({ const [tmpOptions, setTmpOptions] = useState(getAggregationOptionsFromSearch(location.search)); const [options, setOptions] = useState(getAggregationOptionsFromSearch(location.search)); - // changeOptions is used to change the options for an ClickHouse query. Instead of directly modifying the options - // state we change the URL parameters. + // changeOptions is used to change the options for an klogs query. Instead of directly modifying the options state we + // change the URL parameters. const changeOptions = (): void => { history.push({ pathname: location.pathname, @@ -65,7 +65,7 @@ const AggregationPage: React.FunctionComponent = ({ - + Documentation diff --git a/plugins/clickhouse/src/components/page/AggregationToolbar.tsx b/plugins/klogs/src/components/page/AggregationToolbar.tsx similarity index 81% rename from plugins/clickhouse/src/components/page/AggregationToolbar.tsx rename to plugins/klogs/src/components/page/AggregationToolbar.tsx index 34b21fea7..b1b7c0a69 100644 --- a/plugins/clickhouse/src/components/page/AggregationToolbar.tsx +++ b/plugins/klogs/src/components/page/AggregationToolbar.tsx @@ -25,9 +25,9 @@ const AggregationToolbar: React.FunctionComponent = ({ setOptions({ ...options, query: value }); }; - // changeOptions changes the ClickHouse option. If the options are changed via the refresh button of the Options - // component we directly modify the options of the parent component, if not we only change the data of the toolbar - // component and the user can trigger an action via the search button. + // changeOptions changes the klogs option. If the options are changed via the refresh button of the Options component + // we directly modify the options of the parent component, if not we only change the data of the toolbar component and + // the user can trigger an action via the search button. const changeOptions = ( refresh: boolean, additionalFields: IOptionsAdditionalFields[] | undefined, @@ -38,7 +38,7 @@ const AggregationToolbar: React.FunctionComponent = ({ }; return ( - + } breakpoint="lg"> diff --git a/plugins/clickhouse/src/components/page/Logs.tsx b/plugins/klogs/src/components/page/Logs.tsx similarity index 97% rename from plugins/clickhouse/src/components/page/Logs.tsx rename to plugins/klogs/src/components/page/Logs.tsx index 0e500b745..6667ccafb 100644 --- a/plugins/clickhouse/src/components/page/Logs.tsx +++ b/plugins/klogs/src/components/page/Logs.tsx @@ -50,11 +50,11 @@ const Logs: React.FunctionComponent = ({ const history = useHistory(); const { isError, isFetching, isLoading, data, error, refetch } = useQuery( - ['clickhouse/logs', name, query, order, orderBy, times], + ['klogs/logs', name, query, order, orderBy, times], async () => { try { const response = await fetch( - `/api/plugins/clickhouse/logs/${name}?query=${encodeURIComponent( + `/api/plugins/klogs/logs/${name}?query=${encodeURIComponent( query, )}&order=${order}&orderBy=${encodeURIComponent(orderBy)}&timeStart=${times.timeStart}&timeEnd=${ times.timeEnd diff --git a/plugins/clickhouse/src/components/page/LogsActions.tsx b/plugins/klogs/src/components/page/LogsActions.tsx similarity index 100% rename from plugins/clickhouse/src/components/page/LogsActions.tsx rename to plugins/klogs/src/components/page/LogsActions.tsx diff --git a/plugins/clickhouse/src/components/page/LogsFields.tsx b/plugins/klogs/src/components/page/LogsFields.tsx similarity index 100% rename from plugins/clickhouse/src/components/page/LogsFields.tsx rename to plugins/klogs/src/components/page/LogsFields.tsx diff --git a/plugins/clickhouse/src/components/page/LogsPage.tsx b/plugins/klogs/src/components/page/LogsPage.tsx similarity index 94% rename from plugins/clickhouse/src/components/page/LogsPage.tsx rename to plugins/klogs/src/components/page/LogsPage.tsx index 1a42c3c53..b0c20c6fa 100644 --- a/plugins/clickhouse/src/components/page/LogsPage.tsx +++ b/plugins/klogs/src/components/page/LogsPage.tsx @@ -29,8 +29,8 @@ const LogsPage: React.FunctionComponent = ({ name, displayName, const history = useHistory(); const [options, setOptions] = useState(getOptionsFromSearch(location.search)); - // changeOptions is used to change the options for an ClickHouse query. Instead of directly modifying the options - // state we change the URL parameters. + // changeOptions is used to change the options for an klogs query. Instead of directly modifying the options state we + // change the URL parameters. const changeOptions = (opts: IOptions): void => { const fields = opts.fields ? opts.fields.map((field) => `&field=${field}`) : []; @@ -89,7 +89,7 @@ const LogsPage: React.FunctionComponent = ({ name, displayName, - + Documentation diff --git a/plugins/clickhouse/src/components/page/LogsToolbar.tsx b/plugins/klogs/src/components/page/LogsToolbar.tsx similarity index 97% rename from plugins/clickhouse/src/components/page/LogsToolbar.tsx rename to plugins/klogs/src/components/page/LogsToolbar.tsx index 5e2d90bf7..53475cb17 100644 --- a/plugins/clickhouse/src/components/page/LogsToolbar.tsx +++ b/plugins/klogs/src/components/page/LogsToolbar.tsx @@ -84,7 +84,7 @@ const LogsToolbar: React.FunctionComponent = ({ }, [order, orderBy, query, times]); return ( - + } breakpoint="lg"> diff --git a/plugins/clickhouse/src/components/page/Page.tsx b/plugins/klogs/src/components/page/Page.tsx similarity index 100% rename from plugins/clickhouse/src/components/page/Page.tsx rename to plugins/klogs/src/components/page/Page.tsx diff --git a/plugins/clickhouse/src/components/panel/Aggregation.tsx b/plugins/klogs/src/components/panel/Aggregation.tsx similarity index 94% rename from plugins/clickhouse/src/components/panel/Aggregation.tsx rename to plugins/klogs/src/components/panel/Aggregation.tsx index 9bbfd8036..258483a31 100644 --- a/plugins/clickhouse/src/components/panel/Aggregation.tsx +++ b/plugins/klogs/src/components/panel/Aggregation.tsx @@ -21,10 +21,10 @@ const Aggregation: React.FunctionComponent = ({ options, }: IAggregationProps) => { const { isError, isFetching, isLoading, data, error, refetch } = useQuery( - ['clickhouse/aggregation', name, options], + ['klogs/aggregation', name, options], async () => { try { - const response = await fetch(`/api/plugins/clickhouse/aggregation/${name}`, { + const response = await fetch(`/api/plugins/klogs/aggregation/${name}`, { body: JSON.stringify(options), method: 'post', }); diff --git a/plugins/clickhouse/src/components/panel/AggregationActions.tsx b/plugins/klogs/src/components/panel/AggregationActions.tsx similarity index 100% rename from plugins/clickhouse/src/components/panel/AggregationActions.tsx rename to plugins/klogs/src/components/panel/AggregationActions.tsx diff --git a/plugins/clickhouse/src/components/panel/AggregationChart.tsx b/plugins/klogs/src/components/panel/AggregationChart.tsx similarity index 100% rename from plugins/clickhouse/src/components/panel/AggregationChart.tsx rename to plugins/klogs/src/components/panel/AggregationChart.tsx diff --git a/plugins/clickhouse/src/components/panel/AggregationChartBarTime.tsx b/plugins/klogs/src/components/panel/AggregationChartBarTime.tsx similarity index 100% rename from plugins/clickhouse/src/components/panel/AggregationChartBarTime.tsx rename to plugins/klogs/src/components/panel/AggregationChartBarTime.tsx diff --git a/plugins/clickhouse/src/components/panel/AggregationChartBarTop.tsx b/plugins/klogs/src/components/panel/AggregationChartBarTop.tsx similarity index 100% rename from plugins/clickhouse/src/components/panel/AggregationChartBarTop.tsx rename to plugins/klogs/src/components/panel/AggregationChartBarTop.tsx diff --git a/plugins/clickhouse/src/components/panel/AggregationChartLine.tsx b/plugins/klogs/src/components/panel/AggregationChartLine.tsx similarity index 100% rename from plugins/clickhouse/src/components/panel/AggregationChartLine.tsx rename to plugins/klogs/src/components/panel/AggregationChartLine.tsx diff --git a/plugins/clickhouse/src/components/panel/AggregationChartPie.tsx b/plugins/klogs/src/components/panel/AggregationChartPie.tsx similarity index 100% rename from plugins/clickhouse/src/components/panel/AggregationChartPie.tsx rename to plugins/klogs/src/components/panel/AggregationChartPie.tsx diff --git a/plugins/clickhouse/src/components/panel/Logs.tsx b/plugins/klogs/src/components/panel/Logs.tsx similarity index 96% rename from plugins/clickhouse/src/components/panel/Logs.tsx rename to plugins/klogs/src/components/panel/Logs.tsx index cea0aaa9d..8428899ff 100644 --- a/plugins/clickhouse/src/components/panel/Logs.tsx +++ b/plugins/klogs/src/components/panel/Logs.tsx @@ -30,7 +30,7 @@ const Logs: React.FunctionComponent = ({ name, title, description, q const [selectedQuery, setSelectedQuery] = useState(queries[0]); const { isError, isFetching, isLoading, data, error, refetch } = useQuery( - ['clickhouse/logs', selectedQuery, times], + ['klogs/logs', selectedQuery, times], async () => { try { if (!selectedQuery.query) { @@ -38,7 +38,7 @@ const Logs: React.FunctionComponent = ({ name, title, description, q } const response = await fetch( - `/api/plugins/clickhouse/logs/${name}?query=${encodeURIComponent(selectedQuery.query)}&order=${ + `/api/plugins/klogs/logs/${name}?query=${encodeURIComponent(selectedQuery.query)}&order=${ selectedQuery.order || '' }&orderBy=${encodeURIComponent(selectedQuery.orderBy || '')}&timeStart=${times.timeStart}&timeEnd=${ times.timeEnd diff --git a/plugins/clickhouse/src/components/panel/LogsActions.tsx b/plugins/klogs/src/components/panel/LogsActions.tsx similarity index 100% rename from plugins/clickhouse/src/components/panel/LogsActions.tsx rename to plugins/klogs/src/components/panel/LogsActions.tsx diff --git a/plugins/clickhouse/src/components/panel/LogsChart.tsx b/plugins/klogs/src/components/panel/LogsChart.tsx similarity index 100% rename from plugins/clickhouse/src/components/panel/LogsChart.tsx rename to plugins/klogs/src/components/panel/LogsChart.tsx diff --git a/plugins/clickhouse/src/components/panel/LogsDocument.tsx b/plugins/klogs/src/components/panel/LogsDocument.tsx similarity index 98% rename from plugins/clickhouse/src/components/panel/LogsDocument.tsx rename to plugins/klogs/src/components/panel/LogsDocument.tsx index 81985085c..dd07fd6f9 100644 --- a/plugins/clickhouse/src/components/panel/LogsDocument.tsx +++ b/plugins/klogs/src/components/panel/LogsDocument.tsx @@ -53,7 +53,7 @@ const LogsDocument: React.FunctionComponent = ({ )) ) : ( -
+
cluster: {document['cluster']} diff --git a/plugins/clickhouse/src/components/panel/LogsDocumentDetails.tsx b/plugins/klogs/src/components/panel/LogsDocumentDetails.tsx similarity index 100% rename from plugins/clickhouse/src/components/panel/LogsDocumentDetails.tsx rename to plugins/klogs/src/components/panel/LogsDocumentDetails.tsx diff --git a/plugins/clickhouse/src/components/panel/LogsDocumentDetailsRow.tsx b/plugins/klogs/src/components/panel/LogsDocumentDetailsRow.tsx similarity index 100% rename from plugins/clickhouse/src/components/panel/LogsDocumentDetailsRow.tsx rename to plugins/klogs/src/components/panel/LogsDocumentDetailsRow.tsx diff --git a/plugins/clickhouse/src/components/panel/LogsDocuments.tsx b/plugins/klogs/src/components/panel/LogsDocuments.tsx similarity index 100% rename from plugins/clickhouse/src/components/panel/LogsDocuments.tsx rename to plugins/klogs/src/components/panel/LogsDocuments.tsx diff --git a/plugins/clickhouse/src/components/panel/Panel.tsx b/plugins/klogs/src/components/panel/Panel.tsx similarity index 86% rename from plugins/clickhouse/src/components/panel/Panel.tsx rename to plugins/klogs/src/components/panel/Panel.tsx index a621561fd..7753143c8 100644 --- a/plugins/clickhouse/src/components/panel/Panel.tsx +++ b/plugins/klogs/src/components/panel/Panel.tsx @@ -41,9 +41,9 @@ export const Panel: React.FunctionComponent = ({ return ( ); }; diff --git a/plugins/clickhouse/src/index.ts b/plugins/klogs/src/index.ts similarity index 65% rename from plugins/clickhouse/src/index.ts rename to plugins/klogs/src/index.ts index f8c7dd5e9..13768e41e 100644 --- a/plugins/clickhouse/src/index.ts +++ b/plugins/klogs/src/index.ts @@ -1,18 +1,18 @@ import { IPluginComponents } from '@kobsio/plugin-core'; -import './assets/clickhouse.css'; +import './assets/klogs.css'; import icon from './assets/icon.png'; import Page from './components/page/Page'; import Panel from './components/panel/Panel'; -const clickhousePlugin: IPluginComponents = { - clickhouse: { +const klogsPlugin: IPluginComponents = { + klogs: { icon: icon, page: Page, panel: Panel, }, }; -export default clickhousePlugin; +export default klogsPlugin; diff --git a/plugins/clickhouse/src/utils/aggregation.ts b/plugins/klogs/src/utils/aggregation.ts similarity index 100% rename from plugins/clickhouse/src/utils/aggregation.ts rename to plugins/klogs/src/utils/aggregation.ts diff --git a/plugins/clickhouse/src/utils/helpers.ts b/plugins/klogs/src/utils/helpers.ts similarity index 91% rename from plugins/clickhouse/src/utils/helpers.ts rename to plugins/klogs/src/utils/helpers.ts index e4c9a94fb..bd99d6916 100644 --- a/plugins/clickhouse/src/utils/helpers.ts +++ b/plugins/klogs/src/utils/helpers.ts @@ -1,7 +1,7 @@ import { IAggregationOptions, IAggregationOptionsAggregation, IOptions } from './interfaces'; import { getTimeParams } from '@kobsio/plugin-core'; -// getOptionsFromSearch is used to get the ClickHouse options from a given search location. +// getOptionsFromSearch is used to get the klogs options from a given search location. export const getOptionsFromSearch = (search: string): IOptions => { const params = new URLSearchParams(search); const fields = params.getAll('field'); @@ -18,8 +18,7 @@ export const getOptionsFromSearch = (search: string): IOptions => { }; }; -// getAggregationOptionsFromSearch is used to get the ClickHouse options for an aggregation from a given search -// location. +// getAggregationOptionsFromSearch is used to get the klogs options for an aggregation from a given search location. export const getAggregationOptionsFromSearch = (search: string): IAggregationOptions => { const params = new URLSearchParams(search); diff --git a/plugins/clickhouse/src/utils/interfaces.ts b/plugins/klogs/src/utils/interfaces.ts similarity index 97% rename from plugins/clickhouse/src/utils/interfaces.ts rename to plugins/klogs/src/utils/interfaces.ts index d2b85167d..7450197f0 100644 --- a/plugins/clickhouse/src/utils/interfaces.ts +++ b/plugins/klogs/src/utils/interfaces.ts @@ -1,6 +1,6 @@ import { IPluginTimes } from '@kobsio/plugin-core'; -// IOptions is the interface for all options, which can be set for an ClickHouse query. +// IOptions is the interface for all options, which can be set for an klogs query. export interface IOptions { fields?: string[]; order: string; @@ -9,7 +9,7 @@ export interface IOptions { times: IPluginTimes; } -// IPanelOptions are the options for the panel component of the ClickHouse plugin. +// IPanelOptions are the options for the panel component of the klogs plugin. export interface IPanelOptions { type: string; queries?: IQuery[]; @@ -24,7 +24,7 @@ export interface IQuery { orderBy?: string; } -// ILogsData is the interface of the data returned from our Go API for the logs view of the ClickHouse plugin. +// ILogsData is the interface of the data returned from our Go API for the logs view of the klogs plugin. export interface ILogsData { offset: number; timeStart: number; diff --git a/plugins/clickhouse/tsconfig.esm.json b/plugins/klogs/tsconfig.esm.json similarity index 100% rename from plugins/clickhouse/tsconfig.esm.json rename to plugins/klogs/tsconfig.esm.json diff --git a/plugins/clickhouse/tsconfig.json b/plugins/klogs/tsconfig.json similarity index 100% rename from plugins/clickhouse/tsconfig.json rename to plugins/klogs/tsconfig.json diff --git a/plugins/sql/src/components/page/Page.tsx b/plugins/sql/src/components/page/Page.tsx index e1faf7174..be422d290 100644 --- a/plugins/sql/src/components/page/Page.tsx +++ b/plugins/sql/src/components/page/Page.tsx @@ -19,8 +19,8 @@ const Page: React.FunctionComponent = ({ name, displayName, de const history = useHistory(); const [query, setQuery] = useState(getQueryFromSearch(location.search)); - // changeOptions is used to change the options for an ClickHouse query. Instead of directly modifying the options - // state we change the URL parameters. + // changeOptions is used to change the options for an SQL query. Instead of directly modifying the options state we + // change the URL parameters. const changeOptions = (q: string): void => { history.push({ pathname: location.pathname, diff --git a/plugins/sql/src/components/page/PageToolbar.tsx b/plugins/sql/src/components/page/PageToolbar.tsx index ae45b5779..ef4d037e5 100644 --- a/plugins/sql/src/components/page/PageToolbar.tsx +++ b/plugins/sql/src/components/page/PageToolbar.tsx @@ -35,7 +35,7 @@ const PageToolbar: React.FunctionComponent = ({ query, setQue }; return ( - + } breakpoint="lg"> diff --git a/plugins/sql/src/utils/interfaces.ts b/plugins/sql/src/utils/interfaces.ts index 505edc657..ac3449ed1 100644 --- a/plugins/sql/src/utils/interfaces.ts +++ b/plugins/sql/src/utils/interfaces.ts @@ -1,9 +1,9 @@ -// IOptions is the interface for all options, which can be set for an ClickHouse query. +// IOptions is the interface for all options, which can be set for an SQL query. export interface IOptions { query: string; } -// IPanelOptions are the options for the panel component of the ClickHouse plugin. +// IPanelOptions are the options for the panel component of the SQL plugin. export interface IPanelOptions { type?: string; queries?: IQuery[];