diff --git a/docs/core/diagnostics/metrics-instrumentation.md b/docs/core/diagnostics/metrics-instrumentation.md index 14bd9e90d5893..bfa0a13d69091 100644 --- a/docs/core/diagnostics/metrics-instrumentation.md +++ b/docs/core/diagnostics/metrics-instrumentation.md @@ -2,10 +2,10 @@ title: Creating Metrics description: How to add new metrics to a .NET library or application ms.topic: tutorial -ms.date: 11/04/2021 +ms.date: 10/11/2023 --- -# Creating Metrics +# Creating metrics **This article applies to: ✔️** .NET Core 6 and later versions **✔️** .NET Framework 4.6.1 and later versions @@ -534,8 +534,7 @@ Press p to pause, r to resume, q to quit. ## Test custom metrics -Its possible to test any custom metrics you add using . This type makes it easy to record the measurements -from specific instruments and assert the values were correct. +Its possible to test any custom metrics you add using . This type makes it easy to record the measurements from specific instruments and assert the values were correct. ### Test with dependency injection diff --git a/docs/core/whats-new/dotnet-8.md b/docs/core/whats-new/dotnet-8.md index 1476f37810bb5..a9fd47cb2a6c8 100644 --- a/docs/core/whats-new/dotnet-8.md +++ b/docs/core/whats-new/dotnet-8.md @@ -2,7 +2,7 @@ title: What's new in .NET 8 description: Learn about the new .NET features introduced in .NET 8. titleSuffix: "" -ms.date: 09/26/2023 +ms.date: 10/05/2023 ms.topic: overview ms.author: gewarren author: gewarren @@ -11,7 +11,7 @@ author: gewarren .NET 8 is the successor to [.NET 7](dotnet-7.md). It will be [supported for three years](https://dotnet.microsoft.com/platform/support/policy/dotnet-core) as a long-term support (LTS) release. You can [download .NET 8 here](https://dotnet.microsoft.com/download/dotnet). -This article has been updated for .NET 8 release candidate (RC) 1. +This article has been updated for .NET 8 release candidate (RC) 2. > [!IMPORTANT] > @@ -649,6 +649,7 @@ This section contains the following subtopics: - [Extensions metrics](#extensions-metrics) - [Hosted lifecycle services](#hosted-lifecycle-services) - [Keyed DI services](#keyed-di-services) +- [System.Numerics.Tensors.TensorPrimitives](#systemnumericstensorstensorprimitives) ### Keyed DI services @@ -837,7 +838,7 @@ Meter meter = meterFactory.Create(options); #### MetricCollector\ class -The new class lets you record metric measurements along with timestamps. Additionally, the class offers the flexibility to use a time provider of your choice for accurate timestamp generation. +The new class lets you record metric measurements along with timestamps. Additionally, the class offers the flexibility to use a time provider of your choice for accurate timestamp generation. ```csharp const string CounterName = "MyCounter"; @@ -865,6 +866,16 @@ Assert.Empty(collector.LastMeasurement.Tags); Assert.Equal(now, collector.LastMeasurement.Timestamp); ``` +### System.Numerics.Tensors.TensorPrimitives + +The updated [System.Numerics.Tensors](https://www.nuget.org/packages/System.Numerics.Tensors) NuGet package includes APIs in the new namespace that add support for tensor operations. The tensor primitives optimize data-intensive workloads like those of AI and machine learning. + +AI workloads like semantic search and retrieval-augmented generation (RAG) extend the natural language capabilities of large language models such as ChatGPT by augmenting prompts with relevant data. For these workloads, operations on vectors—like *cosine similarity* to find the most relevant data to answer a question—are crucial. The System.Numerics.Tensors.TensorPrimitives package provides APIs for vector operations, meaning you don't need to take an external dependency or write your own implementation. + +This package replaces the [System.Numerics.Tensors package](https://www.nuget.org/packages/System.Numerics.Tensors). + +For more information, see the [Announcing .NET 8 RC 2 blog post](https://devblogs.microsoft.com/dotnet/announcing-dotnet-8-rc2/). + ## Garbage collection .NET 8 adds a capability to adjust the memory limit on the fly. This is useful in cloud-service scenarios, where demand comes and goes. To be cost-effective, services should scale up and down on resource consumption as the demand fluctuates. When a service detects a decrease in demand, it can scale down resource consumption by reducing its memory limit. Previously, this would fail because the garbage collector (GC) was unaware of the change and might allocate more memory than the new limit. With this change, you can call the `_RefreshMemoryLimit` API to update the GC with the new memory limit. @@ -1107,6 +1118,7 @@ Physical promotion removes these limitations, which fixes a number of long-stand This section contains the following subtopics: +- [CLI-based project evaluation](#cli-based-project-evaluation) - [Terminal build output](#terminal-build-output) - [Simplified output paths](#simplified-output-paths) - ['dotnet workload clean' command](#dotnet-workload-clean-command) @@ -1115,6 +1127,46 @@ This section contains the following subtopics: - [Source Link](#source-link) - [Source-build SDK](#source-build-sdk) +### CLI-based project evaluation + +MSBuild includes a new feature that makes it easier to incorporate data from MSBuild into your scripts or tools. The following new flags are available for CLI commands such as [dotnet publish](../tools/dotnet-publish.md) to obtain data for use in CI pipelines and elsewhere. + +| Flag | Description | +|---------|---------| +| `--getProperty:` | Retrieves the MSBuild property with the specified name. | +| `--getItem:` | Retrieves MSBuild items of the specified type. | +| `--getTargetResults:` | Retrieves the outputs from running the specified target. | + +Values are written to the standard output. Multiple or complex values are output as JSON, as shown in the following examples. + +```dotnetcli +>dotnet publish --getProperty:OutputPath +bin\Release\net8.0\ +``` + +```dotnetcli +> dotnet publish -p PublishProfile=DefaultContainer --getProperty:GeneratedContainerDigest --getProperty:GeneratedContainerConfiguration +{ + "Properties": { + "GeneratedContainerDigest": "sha256:ef880a503bbabcb84bbb6a1aa9b41b36dc1ba08352e7cd91c0993646675174c4", + "GeneratedContainerConfiguration": "{\u0022config\u0022:{\u0022ExposedPorts\u0022:{\u00228080/tcp\u0022:{}},\u0022Labels\u0022...}}" + } +} +``` + +```dotnetcli +>dotnet publish -p PublishProfile=DefaultContainer --getItem:ContainerImageTags +{ + "Items": { + "ContainerImageTags": [ + { + "Identity": "latest", + ... + ] + } +} +``` + ### Terminal build output `dotnet build` has a new option to produce more modernized build output. This *terminal logger* output groups errors with the project they came from, better differentiates the different target frameworks for multi-targeted projects, and provides real-time information about what the build is doing. To opt into the new output, use the `--tl` option. For more information about this option, see [dotnet build options](../tools/dotnet-build.md#options). @@ -1317,6 +1369,7 @@ Composite images are available for the Alpine Linux, Jammy Chiseled, and Mariner - [Performance and compatibility](#performance-and-compatibility) - [Authentication](#authentication) +- [Publish to tar.gz archive](#publish-to-targz-archive) #### Performance and compatibility @@ -1335,6 +1388,20 @@ These improvements also mean that more registries are supported: Harbor, Artifac For more information containerizing .NET apps, see [Containerize a .NET app with dotnet publish](../docker/publish-as-container.md). +#### Publish to tar.gz archive + +Starting in .NET 8, you can create a container directly as a *tar.gz* archive. This feature is useful if your workflow isn't straightforward and requires that you, for example, run a scanning tool over your images before pushing them. Once the archive is created, you can move it, scan it, or load it into a local Docker toolchain. + +To publish to an archive, add the `ContainerArchiveOutputPath` property to your `dotnet publish` command, for example: + +```dotnetcli +dotnet publish \ + -p PublishProfile=DefaultContainer \ + -p ContainerArchiveOutputPath=./images/sdk-container-demo.tar.gz +``` + +You can specify either a folder name or a path with a specific file name. + ## Source-generated COM interop .NET 8 includes a new source generator that supports interoperating with COM interfaces. You can use the to mark an interface as a COM interface for the source generator. The source generator will then generate code to enable calling from C# code to unmanaged code. It also generates code to enable calling from unmanaged code into C#. This source generator integrates with , and you can use types with the as parameters and return types in `LibraryImport`-attributed methods. @@ -1478,6 +1545,7 @@ You can opt out of verification by setting the environment variable `DOTNET_NUGE ### .NET blog +- [Announcing .NET 8 RC 2](https://devblogs.microsoft.com/dotnet/announcing-dotnet-8-rc2/) - [Announcing .NET 8 RC 1](https://devblogs.microsoft.com/dotnet/announcing-dotnet-8-rc1/) - [Announcing .NET 8 Preview 7](https://devblogs.microsoft.com/dotnet/announcing-dotnet-8-preview-7/) - [Announcing .NET 8 Preview 6](https://devblogs.microsoft.com/dotnet/announcing-dotnet-8-preview-6/) @@ -1486,6 +1554,7 @@ You can opt out of verification by setting the environment variable `DOTNET_NUGE - [Announcing .NET 8 Preview 3](https://devblogs.microsoft.com/dotnet/announcing-dotnet-8-preview-3/) - [Announcing .NET 8 Preview 2](https://devblogs.microsoft.com/dotnet/announcing-dotnet-8-preview-2/) - [Announcing .NET 8 Preview 1](https://devblogs.microsoft.com/dotnet/announcing-dotnet-8-preview-1/) +- [ASP.NET Core updates in .NET 8 RC 2](https://devblogs.microsoft.com/dotnet/asp-net-core-updates-in-dotnet-8-rc-2/) - [ASP.NET Core updates in .NET 8 RC 1](https://devblogs.microsoft.com/dotnet/asp-net-core-updates-in-dotnet-8-rc-1/) - [ASP.NET Core updates in .NET 8 Preview 7](https://devblogs.microsoft.com/dotnet/asp-net-core-updates-in-dotnet-8-preview-7/) - [ASP.NET Core updates in .NET 8 Preview 6](https://devblogs.microsoft.com/dotnet/asp-net-core-updates-in-dotnet-8-preview-6/)