Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add metrics opt-out section to metrics doc #34057

Merged
merged 6 commits into from
Nov 13, 2024
Merged

Conversation

JamesNK
Copy link
Member

@JamesNK JamesNK commented Nov 7, 2024

Opting out of metrics was in release notes. This PR adds that content to the ASP.NET Core metrics doc.


Internal previews

📄 File 🔗 Preview link
aspnetcore/log-mon/metrics/metrics.md ASP.NET Core metrics

aspnetcore/log-mon/metrics/metrics.md Outdated Show resolved Hide resolved
aspnetcore/log-mon/metrics/metrics.md Outdated Show resolved Hide resolved
aspnetcore/log-mon/metrics/metrics.md Outdated Show resolved Hide resolved
aspnetcore/log-mon/metrics/metrics.md Outdated Show resolved Hide resolved
aspnetcore/log-mon/metrics/metrics.md Outdated Show resolved Hide resolved
Co-authored-by: Rick Anderson <3605364+Rick-Anderson@users.noreply.github.com>
HTTP requests to an endpoint can be excluded from metrics by adding metadata, with either the [DisableHttpMetrics](xref:Microsoft.AspNetCore.Http.DisableHttpMetricsAttribute) attribute or the [DisableHttpMetrics()](xref:Microsoft.AspNetCore.Builder.HttpMetricsEndpointConventionBuilderExtensions.DisableHttpMetrics<TBuilder>(TBuilder)) method:

* Add the [DisableHttpMetrics](xref:Microsoft.AspNetCore.Http.DisableHttpMetricsAttribute) attribute to the Web API controller, SignalR hub or gRPC service.
* Call [DisableHttpMetrics()](xref:Microsoft.AspNetCore.Builder.HttpMetricsEndpointConventionBuilderExtensions.DisableHttpMetrics<TBuilder>(TBuilder)) when mapping endpoints in app startup:
Copy link
Contributor

@Rick-Anderson Rick-Anderson Nov 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tdykstra can you see why attribute works and method doesn't. I vote for replacing link with /dotnet/api/microsoft.aspnetcore.builder.httpmetricsendpointconventionbuilderextensions.disablehttpmetrics

from DisableHttpMetrics

Line 118: [Warning] Cross reference not found: Microsoft.AspNetCore.Builder.HttpMetricsEndpointConventionBuilderExtensions.DisableHttpMetrics<TBuilder>(TBuilder).Line 121: [Warning] Cross reference not found:

@tdykstra
Copy link
Contributor

David Pine's VSC extension provides the right xref link format -- the format for generic methods is complicated. It's using the xref link format now, with custom link text.

@JamesNK
Copy link
Member Author

JamesNK commented Nov 13, 2024

@guardrex FYI I got the broken xref link format from your online tool: https://xrefgen.azurewebsites.net/ If you're still maintaining it then it's something to fix.

@JamesNK JamesNK merged commit 0148064 into main Nov 13, 2024
3 checks passed
@JamesNK JamesNK deleted the jamesnk/metrics-opt-out branch November 13, 2024 04:38
@guardrex
Copy link
Collaborator

@JamesNK ... It's no longer being maintained. The learn-markdown extension's Link to XRef command is commonly used for that task these days ...

https://marketplace.visualstudio.com/items?itemName=docsmsft.docs-markdown

@tdykstra
Copy link
Contributor

Have you got that to work recently? I believe the docs authoring pack version isn't maintained either anymore because it relies on the same discontinued source for APIs. The tool that does work now is this VS Code extension created in the recent hackathon: https://github.com/IEvangelist/xref-helper/blob/main/README.md

@guardrex
Copy link
Collaborator

I haven't checked because I know the pattern (usually) for placing the links.

I'll see if I can dig the old PC out and recover the original source for my app. If so, I'll see if I can fix the xrefgen app.

I've opened #34107 to remind myself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants