-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
[BUG] unable to filter log records exported to Azure Monitor #32276
Comments
Label prediction was below confidence level |
Thank you for your feedback. This has been routed to the support team for assistance. |
Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @cijothomas, @reyang, @rajkumar-rangaraj, @TimothyMothra, @vishweshbankwar. Issue DetailsLibrary name and versionAzure.Monitor.OpenTelemetry.Exporter 1.0.0-beta.4 Describe the bugI want to prevent logs from being sent to Azure.Monitor. Based on the filtering processor example, I created: open System.Diagnostics
open OpenTelemetry
open OpenTelemetry.Logs
/// Remove Heartbeat from Host.Results
type HeartbeatLogFilter() =
inherit BaseProcessor<LogRecord>()
override _.OnEnd log =
if log.CategoryName = "Host.Results" then
let fullName =
log.StateValues |> Seq.tryPick(fun kv ->
if kv.Key = "FullName" then
Some kv.Value
else
None
)
if fullName = Some "Heartbeat" then
log.TraceFlags <- log.TraceFlags &&& ~~~ ActivityTraceFlags.Recorded It removes Expected behaviorI was expecting the log records with Actual behaviorThe log records still end up in Azure Monitor. Reproduction StepsPlease see the Microsoft internal pull request. EnvironmentNo response
|
Adding Service team to look into this. |
https://github.com/open-telemetry/opentelemetry-dotnet/blob/main/docs/trace/extending-the-sdk/README.md#filtering-processor is only applicable for Traces, not logs. OpenTelemetry Logging is based on |
We can close this. This is not an issue/questions specific to AzureMonitor. |
Thank you @cijothomas 🥇 |
@cataggar There is no recommended way to filter out logs based on ActivityTraceFlags. Since this is not Azure Monitor specific question, Could you please open an issue here https://github.com/open-telemetry/opentelemetry-dotnet. |
Closing this as the issue is related to OTel Sdk. |
I opened open-telemetry/opentelemetry-dotnet#3918. |
Can class azure-sdk-for-net/sdk/monitor/Azure.Monitor.OpenTelemetry.Exporter/src/AzureMonitorLogExporter.cs Lines 15 to 24 in c3fc45c
|
Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @cijothomas, @reyang, @rajkumar-rangaraj, @TimothyMothra, @vishweshbankwar. Issue DetailsLibrary name and versionAzure.Monitor.OpenTelemetry.Exporter 1.0.0-beta.4 Describe the bugI want to prevent logs from being sent to Azure.Monitor. Based on the filtering processor example, I created: open System.Diagnostics
open OpenTelemetry
open OpenTelemetry.Logs
/// Remove Heartbeat from Host.Results
type HeartbeatLogFilter() =
inherit BaseProcessor<LogRecord>()
override _.OnEnd log =
if log.CategoryName = "Host.Results" then
let fullName =
log.StateValues |> Seq.tryPick(fun kv ->
if kv.Key = "FullName" then
Some kv.Value
else
None
)
if fullName = Some "Heartbeat" then
log.TraceFlags <- log.TraceFlags &&& ~~~ ActivityTraceFlags.Recorded It removes Expected behaviorI was expecting the log records with Actual behaviorThe log records still end up in Azure Monitor. Reproduction StepsPlease see the Microsoft internal pull request. EnvironmentNo response
|
Adding Service team to answer the above question: |
@rajkumar-rangaraj Did we discuss/decide about making the Exporter public? |
At least in beta 3 release this was still public, alternatively it would be good to provide some kind of filtering logic in AzureMonitorExporterOptions, something like |
It looks like |
#35568 will make it public. |
I am hesitant to close those this. I was able to find a workaround for the logs created in this case. Hopefully, better ILogger filtering support will be possible generically for .NET. dotnet/runtime#82465 |
Library name and version
Azure.Monitor.OpenTelemetry.Exporter 1.0.0-beta.4
Describe the bug
I want to prevent logs from being sent to Azure.Monitor. Based on the filtering processor example, I created:
It removes
ActivityTraceFlags.Recorded
from theLogRecord.TraceFlags
.Expected behavior
I was expecting the log records with
ActivityTraceFlags.Recorded
removed to not be exported to Azure Monitor.Actual behavior
The log records still end up in Azure Monitor.
Reproduction Steps
Please see the Microsoft internal pull request.
Environment
No response
The text was updated successfully, but these errors were encountered: