From da9c8f8842209d1e0eaf77ff8af730aa58e3ed7a Mon Sep 17 00:00:00 2001 From: Cassie Coyle Date: Mon, 24 Feb 2025 11:13:34 -0600 Subject: [PATCH 1/6] Scheduler etcd flags & metrics (#4550) * tweaks Signed-off-by: Cassandra Coyle * tweaks Signed-off-by: Cassandra Coyle --------- Signed-off-by: Cassandra Coyle Co-authored-by: Hannah Hunter <94493363+hhunter-ms@users.noreply.github.com> --- .../en/concepts/dapr-services/scheduler.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/daprdocs/content/en/concepts/dapr-services/scheduler.md b/daprdocs/content/en/concepts/dapr-services/scheduler.md index c7364ecd6..a0d00aa19 100644 --- a/daprdocs/content/en/concepts/dapr-services/scheduler.md +++ b/daprdocs/content/en/concepts/dapr-services/scheduler.md @@ -81,6 +81,14 @@ In production environments, it's recommended to perform periodic backups of this To perform backup and restore operations, you'll need to access the embedded etcd instance. This requires port forwarding to expose the etcd ports (port 2379). +#### Kubernetes Example + +Here's how to port forward and connect to the etcd instance: + +```shell +kubectl port-forward svc/dapr-scheduler-server 2379:2379 -n dapr-system +``` + #### Docker Compose Example Here's how to expose the etcd ports in a Docker Compose configuration for standalone mode: @@ -111,6 +119,16 @@ When running in HA mode, you only need to expose the ports for one scheduler ins Once you have access to the etcd ports, you can follow the [official etcd backup and restore documentation](https://etcd.io/docs/v3.5/op-guide/recovery/) to perform backup and restore operations. The process involves using standard etcd commands to create snapshots and restore from them. +## Monitoring Scheduler's etcd Metrics + +Port forward the Scheduler instance and view etcd's metrics with the following: + +```shell +curl -s http://localhost:2379/metrics +``` + +Fine tune the embedded etcd to your needs by [reviewing and configuring the Scheduler's etcd flags as needed](https://github.com/dapr/dapr/blob/master/charts/dapr/README.md#dapr-scheduler-options). + ## Disabling the Scheduler service If you are not using any features that require the Scheduler service (Jobs API, Actor Reminders, or Workflows), you can disable it by setting `global.scheduler.enabled=false`. From 0b177eccd1a51a0d4b5e417605b0081de940097e Mon Sep 17 00:00:00 2001 From: Yaron Schneider Date: Mon, 24 Feb 2025 10:32:54 -0800 Subject: [PATCH 2/6] Update conversation api (#4546) * update conversation api Signed-off-by: yaron2 * Update daprdocs/content/en/developing-applications/building-blocks/conversation/howto-conversation-layer.md Co-authored-by: Hannah Hunter <94493363+hhunter-ms@users.noreply.github.com> Signed-off-by: Yaron Schneider * Update daprdocs/content/en/developing-applications/building-blocks/conversation/howto-conversation-layer.md Co-authored-by: Hannah Hunter <94493363+hhunter-ms@users.noreply.github.com> Signed-off-by: Yaron Schneider * Update daprdocs/content/en/developing-applications/building-blocks/conversation/howto-conversation-layer.md Co-authored-by: Hannah Hunter <94493363+hhunter-ms@users.noreply.github.com> Signed-off-by: Yaron Schneider --------- Signed-off-by: yaron2 Signed-off-by: Yaron Schneider Co-authored-by: Hannah Hunter <94493363+hhunter-ms@users.noreply.github.com> --- .../conversation/howto-conversation-layer.md | 22 ++++++--- .../en/reference/api/conversation_api.md | 48 ++++++++----------- 2 files changed, 36 insertions(+), 34 deletions(-) diff --git a/daprdocs/content/en/developing-applications/building-blocks/conversation/howto-conversation-layer.md b/daprdocs/content/en/developing-applications/building-blocks/conversation/howto-conversation-layer.md index 37cc5764c..7e7fd0fb4 100644 --- a/daprdocs/content/en/developing-applications/building-blocks/conversation/howto-conversation-layer.md +++ b/daprdocs/content/en/developing-applications/building-blocks/conversation/howto-conversation-layer.md @@ -52,8 +52,6 @@ spec: value: - name: model value: gpt-4-turbo - - name: cacheTTL - value: 10m ``` ## Connect the conversation client @@ -114,12 +112,12 @@ func main() { } input := dapr.ConversationInput{ - Message: "Please write a witty haiku about the Dapr distributed programming framework at dapr.io", - // Role: nil, // Optional - // ScrubPII: nil, // Optional + Content: "Please write a witty haiku about the Dapr distributed programming framework at dapr.io", + // Role: "", // Optional + // ScrubPII: false, // Optional } - fmt.Printf("conversation input: %s\n", input.Message) + fmt.Printf("conversation input: %s\n", input.Content) var conversationComponent = "echo" @@ -163,7 +161,7 @@ async fn main() -> Result<(), Box> { let request = ConversationRequestBuilder::new(conversation_component, vec![input.clone()]).build(); - println!("conversation input: {:?}", input.message); + println!("conversation input: {:?}", input.content); let response = client.converse_alpha1(request).await?; @@ -224,6 +222,16 @@ dapr run --app-id=conversation --resources-path ./config --dapr-grpc-port 3500 - {{< /tabs >}} +## Advanced features + +The conversation API supports the following features: + +1. **Prompt caching:** Allows developers to cache prompts in Dapr, leading to much faster response times and reducing costs on egress and on inserting the prompt into the LLM provider's cache. + +1. **PII scrubbing:** Allows for the obfuscation of data going in and out of the LLM. + +To learn how to enable these features, see the [conversation API reference guide]({{< ref conversation_api.md >}}). + ## Related links Try out the conversation API using the full examples provided in the supported SDK repos. diff --git a/daprdocs/content/en/reference/api/conversation_api.md b/daprdocs/content/en/reference/api/conversation_api.md index 7f022134f..44fa52d28 100644 --- a/daprdocs/content/en/reference/api/conversation_api.md +++ b/daprdocs/content/en/reference/api/conversation_api.md @@ -30,40 +30,34 @@ POST http://localhost:/v1.0-alpha1/conversation//converse | Field | Description | | --------- | ----------- | -| `conversationContext` | The ID of an existing chat room (like in ChatGPT). | -| `inputs` | Inputs for the conversation. Multiple inputs at one time are supported. | -| `metadata` | [Metadata](#metadata) passed to conversation components. | +| `inputs` | Inputs for the conversation. Multiple inputs at one time are supported. Required | +| `cacheTTL` | A time-to-live value for a prompt cache to expire. Uses Golang duration format. Optional | +| `scrubPII` | A boolean value to enable obfuscation of sensitive information returning from the LLM. Optional | +| `temperature` | A float value to control the temperature of the model. Used to optimize for consistency and creativity. Optional | +| `metadata` | [Metadata](#metadata) passed to conversation components. Optional | -#### Metadata +#### Input body -Metadata can be sent in the request’s URL. It must be prefixed with `metadata.`, as shown in the table below. - -| Parameter | Description | +| Field | Description | | --------- | ----------- | -| `metadata.key` | The API key for the component. `key` is not applicable to the [AWS Bedrock component]({{< ref "aws-bedrock.md#authenticating-aws" >}}). | -| `metadata.model` | The Large Language Model you're using. Value depends on which conversation component you're using. `model` is not applicable to the [DeepSeek component]({{< ref deepseek.md >}}). | -| `metadata.cacheTTL` | A time-to-live value for a prompt cache to expire. Uses Golang duration format. | +| `content` | The message content to send to the LLM. Required | +| `role` | The role for the LLM to assume. Possible values: 'user', 'tool', 'assistant' | +| `scrubPII` | A boolean value to enable obfuscation of sensitive information present in the content field. Optional | -For example, to call for [Anthropic]({{< ref anthropic.md >}}): - -```bash -curl POST http://localhost:3500/v1.0-alpha1/conversation/anthropic/converse?metadata.key=key1&metadata.model=claude-3-5-sonnet-20240620&metadata.cacheTTL=10m -``` - -{{% alert title="Note" color="primary" %}} -The metadata parameters available depend on the conversation component you use. [See all the supported components for the conversation API.]({{< ref supported-conversation >}}) -{{% /alert %}} - -### Request content +### Request content example ```json REQUEST = { - "inputs": ["what is Dapr", "Why use Dapr"], - "metadata": { - "model": "model-type-based-on-component-used", - "key": "authKey", - "cacheTTL": "10m", - } + "inputs": [ + { + "content": "What is Dapr?", + "role": "user", // Optional + "scrubPII": "true", // Optional. Will obfuscate any sensitive information found in the content field + }, + ], + "cacheTTL": "10m", // Optional + "scrubPII": "true", // Optional. Will obfuscate any sensitive information returning from the LLM + "temperature": 0.5 // Optional. Optimizes for consistency (0) or creativity (1) } ``` From 0a7a60fd0cf0ec35d56fa4ee7371f52da6786260 Mon Sep 17 00:00:00 2001 From: Marc Duiker Date: Tue, 25 Feb 2025 18:20:40 +0100 Subject: [PATCH 3/6] Fix short code format (#4554) Signed-off-by: Marc Duiker --- .../reference/components-reference/supported-bindings/sftp.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/daprdocs/content/en/reference/components-reference/supported-bindings/sftp.md b/daprdocs/content/en/reference/components-reference/supported-bindings/sftp.md index a0e356e54..2b70e456d 100644 --- a/daprdocs/content/en/reference/components-reference/supported-bindings/sftp.md +++ b/daprdocs/content/en/reference/components-reference/supported-bindings/sftp.md @@ -9,7 +9,7 @@ aliases: ## Component format -To set up the SFTP binding, create a component of type `bindings.sftp`. See [this guide]({{ ref bindings-overview.md }}) on how to create and apply a binding configuration. +To set up the SFTP binding, create a component of type `bindings.sftp`. See [this guide]({{< ref bindings-overview.md >}}) on how to create and apply a binding configuration. ```yaml apiVersion: dapr.io/v1alpha1 From 6010b1fc15ecdf9e548c17593472aa270f44dfba Mon Sep 17 00:00:00 2001 From: joshvanl Date: Tue, 25 Feb 2025 19:51:50 -0300 Subject: [PATCH 4/6] Reference: Metadata API Scheduler Adds reference docs for new `scheduler` metadata field. Added in https://github.com/dapr/dapr/pull/8518 Signed-off-by: joshvanl --- .../content/en/reference/api/metadata_api.md | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/daprdocs/content/en/reference/api/metadata_api.md b/daprdocs/content/en/reference/api/metadata_api.md index 29629705a..af0e8ebb1 100644 --- a/daprdocs/content/en/reference/api/metadata_api.md +++ b/daprdocs/content/en/reference/api/metadata_api.md @@ -37,6 +37,9 @@ A list of features enabled via Configuration spec (including build-time override ### App connection details The metadata API returns information related to Dapr's connection to the app. This includes the app port, protocol, host, max concurrency, along with health check details. +### Scheduler connection details +Information related to the connection to one or more scheduler hosts. + ### Attributes The metadata API allows you to store additional attribute information in the format of key-value pairs. These are ephemeral in-memory and are not persisted if a sidecar is reloaded. This information should be added at the time of a sidecar creation (for example, after the application has started). @@ -82,6 +85,7 @@ components | [Metadata API Response Component](#metadataapiresponsec httpEndpoints | [Metadata API Response HttpEndpoint](#metadataapiresponsehttpendpoint)[] | A json encoded array of loaded HttpEndpoints metadata. subscriptions | [Metadata API Response Subscription](#metadataapiresponsesubscription)[] | A json encoded array of pub/sub subscriptions metadata. appConnectionProperties| [Metadata API Response AppConnectionProperties](#metadataapiresponseappconnectionproperties) | A json encoded object of app connection properties. +scheduler | [Metadata API Response Scheduler](#metadataapiresponsescheduler) | A json encoded object of scheduler connection properties. **Metadata API Response Registered Actor** @@ -142,6 +146,12 @@ healthProbeInterval | string | Time between each health probe, in go duration fo healthProbeTimeout | string | Timeout for each health probe, in go duration format. healthThreshold | integer | Max number of failed health probes before the app is considered unhealthy. +**Metadata API Response Scheduler** + +Name | Type | Description +---- | ---- | ----------- +connected_addresses | string[] | List of strings representing the addresses of the conntected scheduler hosts. + ### Examples @@ -215,6 +225,13 @@ curl http://localhost:3500/v1.0/metadata "healthProbeTimeout": "500ms", "healthThreshold": 3 } + }, + "scheduler": { + "connected_addresses": [ + "10.244.0.47:50006", + "10.244.0.48:50006", + "10.244.0.49:50006" + ] } } ``` @@ -338,6 +355,13 @@ Get the metadata information to confirm your custom attribute was added: "healthProbeTimeout": "500ms", "healthThreshold": 3 } + }, + "scheduler": { + "connected_addresses": [ + "10.244.0.47:50006", + "10.244.0.48:50006", + "10.244.0.49:50006" + ] } } ``` From 61b82aa6e5a1da03a6404faffd0b007706a9125f Mon Sep 17 00:00:00 2001 From: Hannah Hunter <94493363+hhunter-ms@users.noreply.github.com> Date: Tue, 25 Feb 2025 22:33:42 -0500 Subject: [PATCH 5/6] Upmerge 02/25 (#4555) * update self-hosted-with-docker docs Increase tmpfs size to prevent "no space left on device" error Signed-off-by: fvanzee <5238563+fvanzee@users.noreply.github.com> * Update deprecated exporter (#4543) Co-authored-by: Uncensored * docs: also restart sidecar-injector Signed-off-by: Joey Freeland * Update daprdocs/content/en/operations/security/mtls.md Co-authored-by: Mark Fussell Signed-off-by: Joey Freeland <30938344+jfreeland@users.noreply.github.com> * Update mtls.md Updating the dapr init -k command Signed-off-by: Mark Fussell * update kafka bulk metadata options Signed-off-by: Gallardot * fix missing tabs end Signed-off-by: Gallardot --------- Signed-off-by: fvanzee <5238563+fvanzee@users.noreply.github.com> Signed-off-by: Joey Freeland Signed-off-by: Joey Freeland <30938344+jfreeland@users.noreply.github.com> Signed-off-by: Mark Fussell Signed-off-by: Gallardot Signed-off-by: Hannah Hunter Co-authored-by: fvanzee <> Co-authored-by: Vladimir Damov <37113660+vdamov@users.noreply.github.com> Co-authored-by: Uncensored Co-authored-by: Joey Freeland Co-authored-by: Joey Freeland <30938344+jfreeland@users.noreply.github.com> Co-authored-by: Mark Fussell Co-authored-by: Gallardot --- .../self-hosted/self-hosted-with-docker.md | 2 +- daprdocs/content/en/operations/security/mtls.md | 15 +++++++++------ .../supported-pubsub/setup-apache-kafka.md | 5 +++-- .../open-telemetry-collector-jaeger.yaml | 4 ++-- 4 files changed, 15 insertions(+), 11 deletions(-) diff --git a/daprdocs/content/en/operations/hosting/self-hosted/self-hosted-with-docker.md b/daprdocs/content/en/operations/hosting/self-hosted/self-hosted-with-docker.md index 78f0e2c75..700acc776 100644 --- a/daprdocs/content/en/operations/hosting/self-hosted/self-hosted-with-docker.md +++ b/daprdocs/content/en/operations/hosting/self-hosted/self-hosted-with-docker.md @@ -149,7 +149,7 @@ services: - type: tmpfs target: /data tmpfs: - size: "10000" + size: "64m" networks: hello-dapr: null diff --git a/daprdocs/content/en/operations/security/mtls.md b/daprdocs/content/en/operations/security/mtls.md index 0acdbcb51..b471783c0 100644 --- a/daprdocs/content/en/operations/security/mtls.md +++ b/daprdocs/content/en/operations/security/mtls.md @@ -231,6 +231,8 @@ kubectl rollout restart -n deployment/dapr-sentry ```bash kubectl rollout restart deploy/dapr-operator -n kubectl rollout restart statefulsets/dapr-placement-server -n +kubectl rollout restart deploy/dapr-sidecar-injector -n +kubectl rollout restart deploy/dapr-scheduler-server -n ``` 4. Restart your Dapr applications to pick up the latest trust bundle. @@ -332,12 +334,13 @@ Example: dapr status -k NAME NAMESPACE HEALTHY STATUS REPLICAS VERSION AGE CREATED - dapr-sentry dapr-system True Running 1 1.7.0 17d 2022-03-15 09:29.45 - dapr-dashboard dapr-system True Running 1 0.9.0 17d 2022-03-15 09:29.45 - dapr-sidecar-injector dapr-system True Running 1 1.7.0 17d 2022-03-15 09:29.45 - dapr-operator dapr-system True Running 1 1.7.0 17d 2022-03-15 09:29.45 - dapr-placement-server dapr-system True Running 1 1.7.0 17d 2022-03-15 09:29.45 -⚠ Dapr root certificate of your Kubernetes cluster expires in 2 days. Expiry date: Mon, 04 Apr 2022 15:01:03 UTC. + dapr-operator dapr-system True Running 1 1.15.0 4m 2025-02-19 17:36.26 + dapr-placement-server dapr-system True Running 1 1.15.0 4m 2025-02-19 17:36.27 + dapr-dashboard dapr-system True Running 1 0.15.0 4m 2025-02-19 17:36.27 + dapr-sentry dapr-system True Running 1 1.15.0 4m 2025-02-19 17:36.26 + dapr-scheduler-server dapr-system True Running 3 1.15.0 4m 2025-02-19 17:36.27 + dapr-sidecar-injector dapr-system True Running 1 1.15.0 4m 2025-02-19 17:36.26 +⚠ Dapr root certificate of your Kubernetes cluster expires in 2 days. Expiry date: Mon, 04 Apr 2025 15:01:03 UTC. Please see docs.dapr.io for certificate renewal instructions to avoid service interruptions. ``` diff --git a/daprdocs/content/en/reference/components-reference/supported-pubsub/setup-apache-kafka.md b/daprdocs/content/en/reference/components-reference/supported-pubsub/setup-apache-kafka.md index 503500ca8..203d81a76 100644 --- a/daprdocs/content/en/reference/components-reference/supported-pubsub/setup-apache-kafka.md +++ b/daprdocs/content/en/reference/components-reference/supported-pubsub/setup-apache-kafka.md @@ -459,8 +459,8 @@ Apache Kafka supports the following bulk metadata options: | Configuration | Default | |----------|---------| -| `maxBulkAwaitDurationMs` | `10000` (10s) | -| `maxBulkSubCount` | `80` | +| `maxAwaitDurationMs` | `10000` (10s) | +| `maxMessagesCount` | `80` | ## Per-call metadata fields @@ -540,6 +540,7 @@ app.include_router(router) ``` {{% /codetab %}} + {{< /tabs >}} ## Receiving message headers with special characters diff --git a/daprdocs/static/docs/open-telemetry-collector/open-telemetry-collector-jaeger.yaml b/daprdocs/static/docs/open-telemetry-collector/open-telemetry-collector-jaeger.yaml index d8c0fe293..dac909542 100644 --- a/daprdocs/static/docs/open-telemetry-collector/open-telemetry-collector-jaeger.yaml +++ b/daprdocs/static/docs/open-telemetry-collector/open-telemetry-collector-jaeger.yaml @@ -19,8 +19,8 @@ data: zpages: endpoint: :55679 exporters: - logging: - loglevel: debug + debug: + verbosity: detailed # Depending on where you want to export your trace, use the # correct OpenTelemetry trace exporter here. # From 9c849cd1e7b8ef014919f7f24d78e085890f66c8 Mon Sep 17 00:00:00 2001 From: Hannah Hunter <94493363+hhunter-ms@users.noreply.github.com> Date: Tue, 25 Feb 2025 23:06:00 -0500 Subject: [PATCH 6/6] bring in updated submodules (#4556) Signed-off-by: Hannah Hunter Co-authored-by: Mark Fussell --- sdkdocs/dotnet | 2 +- sdkdocs/java | 2 +- sdkdocs/js | 2 +- sdkdocs/python | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/sdkdocs/dotnet b/sdkdocs/dotnet index ab3ef305f..52f085178 160000 --- a/sdkdocs/dotnet +++ b/sdkdocs/dotnet @@ -1 +1 @@ -Subproject commit ab3ef305f2e841d044a0190a2351726c3c7ad5db +Subproject commit 52f0851780202f71ac4c7fbbcd5c5fb7d674db5a diff --git a/sdkdocs/java b/sdkdocs/java index 58d621886..22d9874ae 160000 --- a/sdkdocs/java +++ b/sdkdocs/java @@ -1 +1 @@ -Subproject commit 58d6218861e77a2588b0af360c978a25e5723091 +Subproject commit 22d9874ae05c2adaf1eea9fe45e1e6f40c30fb04 diff --git a/sdkdocs/js b/sdkdocs/js index fc52f993a..f1dba5558 160000 --- a/sdkdocs/js +++ b/sdkdocs/js @@ -1 +1 @@ -Subproject commit fc52f993afe5fd11b3c8ff5406b8904b280224f1 +Subproject commit f1dba55586bb734e55de98098284f9139d6e5304 diff --git a/sdkdocs/python b/sdkdocs/python index fe2ef4be3..fc4980daa 160000 --- a/sdkdocs/python +++ b/sdkdocs/python @@ -1 +1 @@ -Subproject commit fe2ef4be3bce327a9802d75515f478600a415cb0 +Subproject commit fc4980daaa4802bfb2590f133c332b934b196205