Datalens.Client 1.1.0

dotnet add package Datalens.Client --version 1.1.0
                    
NuGet\Install-Package Datalens.Client -Version 1.1.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Datalens.Client" Version="1.1.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Datalens.Client" Version="1.1.0" />
                    
Directory.Packages.props
<PackageReference Include="Datalens.Client" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Datalens.Client --version 1.1.0
                    
#r "nuget: Datalens.Client, 1.1.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Datalens.Client@1.1.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Datalens.Client&version=1.1.0
                    
Install as a Cake Addin
#tool nuget:?package=Datalens.Client&version=1.1.0
                    
Install as a Cake Tool

Datalens.Client

Client package for applications publishing logs and events to a Datalens Controller. Intended for external consumer apps; the Controller itself does not consume this package.

Installation

dotnet add package Datalens.Client

Targets net8.0 and net10.0.

Registration

Each subsystem is registered explicitly. Register only what you use.

using Microsoft.Extensions.DependencyInjection;

services.AddDatalensLogs(configuration);
services.AddDatalensEvents(configuration);
services.AddDatalensInvoke(configuration);

After AddDatalensLogs, the standard ILogger<T> continues to work unchanged. After AddDatalensEvents, inject IDatalensEvents to publish events. After AddDatalensInvoke, inject IDatalensInvoke to call flow endpoints.

Add* never throws at registration: a misconfigured subsystem logs a single line to stderr, so a typo in your appsettings.json will not crash your application at startup.

Logs and events are best-effort — a misconfigured subsystem stays silently disabled and dropped data is only counted. Invoke is different: it returns a result, so a misconfigured or disabled invoke subsystem registers a stub whose calls throw InvalidOperationException. A request/response call must never silently no-op.

All self-diagnostics from this package (overflow, flush failures, dropped publishes, shipper lifecycle) write to stderr with a [Datalens.Client.Logs] or [Datalens.Client.Events] prefix. They are deliberately routed through Console.Error rather than the host's ILoggerFactory to avoid recursion into the package's own log buffer and to remove a class of DI cycles between the package and the host's logger setup. Azure App Service log streams, Docker compose, systemd, and Kubernetes all capture stderr by default.

Configuration

{
  "DatalensClient": {
    "Endpoint": "https://your-datalens-host",
    "Logs": {
      "Enabled": true,
      "LogKey": "your-log-key",
      "LogLevel": {
        "Default": "Information",
        "Microsoft.EntityFrameworkCore": "Warning"
      },
      "Buffer": {
        "Capacity": 5000,
        "FlushIntervalMs": 5000
      }
    },
    "Events": {
      "Enabled": true,
      "FlowKey": "your-flow-key",
      "Buffer": {
        "Capacity": 50000,
        "FlushIntervalMs": 30000,
        "BatchSize": 100,
        "HttpTimeoutMs": 5000
      }
    },
    "Invoke": {
      "Enabled": true,
      "ClientId": "your-client-id",
      "ClientSecret": "your-client-secret",
      "CustomerSlug": "your-customer-slug",
      "TimeoutSeconds": 100
    }
  }
}

Endpoint and LogKey are supplied by your Datalens administrator. All buffer durations are integer milliseconds.

Invoke.ClientId / Invoke.ClientSecret are the client-credentials pair for your API client; CustomerSlug is your customer's public slug. The client exchanges the credentials for a one-hour bearer token, caches it, and refreshes once automatically on a 401.

FlowKey under Events is a config default. Each IDatalensEvents.PublishLegacyAsync overload accepts an optional per-call flowKey that overrides the config default when provided. If neither the per-call value nor the config default is set, the publish is dropped (with a counter increment and a self-diagnostic) — it does not throw.

Invoke

IDatalensInvoke calls a flow endpoint and returns its result. There are two request shapes.

Vanilla — post bare JSON, read it back typed or raw:

public sealed record Quote(string Symbol, decimal Price);

Quote? quote = await invoke.InvokeAsync<Quote>("price-lookup", new { symbol = "ACME" });

JsonNode? raw = await invoke.InvokeAsync("price-lookup", new { symbol = "ACME" });

Structured — send named collections (JSON, native-typed tabular, and documents) and read named collections back:

DatalensRequest request = DatalensRequest.Create()
    .AddJson("meta", new { source = "nightly" })
    .AddTabular("orders", orders)
    .AddDocument("invoice", pdfBytes, "invoice.pdf", "application/pdf");

DatalensResponse response = await invoke.InvokeAsync("ingest-orders", request);

int? executionId = response.ExecutionId;
IReadOnlyList<Order> back = response.Tabular<Order>("orders");
MyResult? result = response.Json<MyResult>("result");

DatalensDocument receipt = response.Document("receipt");
await using Stream bytes = await receipt.OpenAsync();

Calls throw on failure (unlike the best-effort logs/events sinks):

  • DatalensInvokeException — a wire failure: non-2xx response (after one automatic 401 refresh+retry), transport fault, timeout, or unparseable body. Carries StatusCode, the server's ServerError, and ExecutionId when present.
  • InvalidOperationException — the subsystem is disabled/misconfigured, or a DatalensResponse accessor was misused (unknown collection name or wrong kind).
  • ArgumentException — a bad call argument caught before the network (empty endpoint, empty/duplicate document key, total document upload over 30 MB).

License

Proprietary. See the bundled LICENSE file.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.1.0 97 6/1/2026
1.0.6 95 5/21/2026
1.0.5 92 5/20/2026
1.0.4 84 5/20/2026
1.0.3 97 5/20/2026
1.0.1 94 5/19/2026
1.0.0 112 4/26/2026