Skip to content

Commit

Permalink
moves logs and metrics to require valid license key
Browse files Browse the repository at this point in the history
  • Loading branch information
nickzelei committed Dec 18, 2024
1 parent 077c612 commit f06fb74
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 6 deletions.
2 changes: 1 addition & 1 deletion backend/charts/api/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ A Helm chart for the Neosync Backend API
| resources.limits.memory | string | `"512Mi"` | Sets the max Memory amount |
| resources.requests.cpu | string | `"100m"` | Sets the CPU amount to be requested |
| resources.requests.memory | string | `"128Mi"` | Sets the Memory amount to be requested |
| runLogs.enabled | bool | `true` | Independently set so that configuration can exist but logs can still be independently disabled. Defaults to true with k8s-pods configuration for backwards compat and because this is a helm chart this is defacto kubernetes |
| runLogs.enabled | bool | `false` | Enable this if planning to surface logs within Neosync API and UI (requires a valid license). |
| runLogs.lokiConfig.baseUrl | string | `nil` | The base url to the loki instance |
| runLogs.lokiConfig.keepLabels | string | `nil` | List format. |
| runLogs.lokiConfig.labelsQuery | string | `nil` | LogQL labels query (without the {} as those are provided by the system) |
Expand Down
4 changes: 2 additions & 2 deletions backend/charts/api/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -204,8 +204,8 @@ kubernetes:

# If runLogs are disabled, will fallback on the kubernetes configuration above for backwards compat
runLogs:
# -- Independently set so that configuration can exist but logs can still be independently disabled. Defaults to true with k8s-pods configuration for backwards compat and because this is a helm chart this is defacto kubernetes
enabled: true
# -- Enable this if planning to surface logs within Neosync API and UI (requires a valid license).
enabled: false
# -- Possible values: k8s-pods, loki
type: k8s-pods

Expand Down
7 changes: 7 additions & 0 deletions backend/internal/cmds/mgmt/serve/connect/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,10 @@ func serve(ctx context.Context) error {
mgmtv1alpha1connect.AnonymizationServiceName,
}

if shouldEnableMetricsService() && !cascadelicense.IsValid() {
return errors.New("metrics service is enabled but no license is present")
}

if shouldEnableMetricsService() {
services = append(services, mgmtv1alpha1connect.MetricsServiceName)
}
Expand Down Expand Up @@ -548,6 +552,9 @@ func serve(ctx context.Context) error {
if err != nil {
return err
}
if runLogConfig != nil && !cascadelicense.IsValid() {
return errors.New("run logs are enabled but no license is present")
}

jobServiceConfig := &v1alpha1_jobservice.Config{
IsAuthEnabled: isAuthEnabled,
Expand Down
2 changes: 1 addition & 1 deletion charts/neosync/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ A Helm chart for Neosync that contains the api, app, and worker
| api.resources.limits.memory | string | `"512Mi"` | Sets the max Memory amount |
| api.resources.requests.cpu | string | `"100m"` | Sets the CPU amount to be requested |
| api.resources.requests.memory | string | `"128Mi"` | Sets the Memory amount to be requested |
| api.runLogs.enabled | bool | `true` | Independently set so that configuration can exist but logs can still be independently disabled. Defaults to true with k8s-pods configuration for backwards compat and because this is a helm chart this is defacto kubernetes |
| api.runLogs.enabled | bool | `false` | Enable this if planning to surface logs within Neosync API and UI (requires a valid license). |
| api.runLogs.lokiConfig.baseUrl | string | `nil` | The base url to the loki instance |
| api.runLogs.lokiConfig.keepLabels | string | `nil` | List format. |
| api.runLogs.lokiConfig.labelsQuery | string | `nil` | LogQL labels query (without the {} as those are provided by the system) |
Expand Down
6 changes: 4 additions & 2 deletions docs/docs/guides/viewing-job-run-logs.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ kubectl logs -n neosync deployment/neosync-worker -f`

#### Neosync UI

> **NB:** This requires a valid Neosync Enterprise license for OSS deployments. If you would like to try this out, please contact us.
Neosync can be configured to surface pod logs via the UI by configuring `neosync-api` to surface these.

If you've deployed Neosync via the helm chart, this should come pre-configured with kubernetes pod logs.
Expand All @@ -71,9 +73,9 @@ This are great for basic deployments, but will disappear on worker pod shutdown.

## Persistence with Loki

Neosync has native support for surfacing logs that come from a [Grafana Loki](https://grafana.com/oss/loki/) instance.
Neosync has native support for surfacing logs that come from a [Grafana Loki](https://grafana.com/oss/loki/) instance (with a valid Neosync Enterprise license).

Please note that Neosync does not natively handle shipping logs to Loki, but it can natively handle querying a Loki instance and surfacing logs natively into Neosync UI.
Please note that Neosync does not natively handle shipping logs to Loki, however it can natively handle querying a Loki instance to surface logs into Neosync UI.

This can be configured by setting the `RUN_LOGS_TYPE` environment variable to `loki`, along with configuring the `RUN_LOGS_LOKICONFIG_BASEURL`.
To see the full environment variables, view the [api env vars](../deploy/environment-variables.md#backend-api).

0 comments on commit f06fb74

Please sign in to comment.