Microsoft.SqlServer.XEvent.XELite 2019.6.5.2

XELite is cross platform library to read XEvents from XEL files or live SQL streams.

There is a newer version of this package available.
See the version list below for details.
Install-Package Microsoft.SqlServer.XEvent.XELite -Version 2019.6.5.2
dotnet add package Microsoft.SqlServer.XEvent.XELite --version 2019.6.5.2
<PackageReference Include="Microsoft.SqlServer.XEvent.XELite" Version="2019.6.5.2" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Microsoft.SqlServer.XEvent.XELite --version 2019.6.5.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Microsoft.SqlServer.XEvent.XELite, 2019.6.5.2"
For F# scripts that support #r syntax, copy this into the source code to reference the package.

Introduction

XELite is cross platform library to read XEvents from XEL files or live SQL streams.

Getting Started

Using XELite to parse XEL files

static void OutputXELFile(string fileName)
{
	var xeStream = new XEFileEventStreamer(fileName);

	xeStream.ReadEventStream(
		() => {
			Console.WriteLine("Headers found");
			return Task.CompletedTask;
		},
		xevent => {
			Console.WriteLine(xevent);
			Console.WriteLine("");
			return Task.CompletedTask;
		},
		CancellationToken.None).Wait();
}

Using XELite to connect to live event session

Step 1: Create & start event session. For example:

CREATE EVENT SESSION [sample_session] ON SERVER 
ADD EVENT sqlserver.sql_statement_completed(
    ACTION(sqlserver.sql_text))
GO

ALTER EVENT SESSION [sample_session] ON SERVER 
	STATE = START
GO

Step 2: Implement the code to connect and read the events. Here is a sample:

static void OutputXELStream(string connectionString, string sessionName)
{
    var cancellationTokenSource = new CancellationTokenSource();

    var xeStream = new XELiveEventStreamer(connectionString, sessionName);

    Console.WriteLine("Press any key to stop listening...");
    Task waitTask = Task.Run(() =>
        {
            Console.ReadKey();
            cancellationTokenSource.Cancel();
        });

    Task readTask = xeStream.ReadEventStream(() =>
        {
            Console.WriteLine("Connected to session");
            return Task.CompletedTask;
        },
        xevent =>
        {
            Console.WriteLine(xevent);
            Console.WriteLine("");
            return Task.CompletedTask;
        },
        cancellationTokenSource.Token);


    try
    {
        Task.WaitAny(waitTask, readTask);
    }
    catch (TaskCanceledException)
    {
    }

    if (readTask.IsFaulted)
    {
        Console.Error.WriteLine("Failed with: {0}", readTask.Exception);
    }
}

Introduction

XELite is cross platform library to read XEvents from XEL files or live SQL streams.

Getting Started

Using XELite to parse XEL files

static void OutputXELFile(string fileName)
{
	var xeStream = new XEFileEventStreamer(fileName);

	xeStream.ReadEventStream(
		() => {
			Console.WriteLine("Headers found");
			return Task.CompletedTask;
		},
		xevent => {
			Console.WriteLine(xevent);
			Console.WriteLine("");
			return Task.CompletedTask;
		},
		CancellationToken.None).Wait();
}

Using XELite to connect to live event session

Step 1: Create & start event session. For example:

CREATE EVENT SESSION [sample_session] ON SERVER 
ADD EVENT sqlserver.sql_statement_completed(
    ACTION(sqlserver.sql_text))
GO

ALTER EVENT SESSION [sample_session] ON SERVER 
	STATE = START
GO

Step 2: Implement the code to connect and read the events. Here is a sample:

static void OutputXELStream(string connectionString, string sessionName)
{
    var cancellationTokenSource = new CancellationTokenSource();

    var xeStream = new XELiveEventStreamer(connectionString, sessionName);

    Console.WriteLine("Press any key to stop listening...");
    Task waitTask = Task.Run(() =>
        {
            Console.ReadKey();
            cancellationTokenSource.Cancel();
        });

    Task readTask = xeStream.ReadEventStream(() =>
        {
            Console.WriteLine("Connected to session");
            return Task.CompletedTask;
        },
        xevent =>
        {
            Console.WriteLine(xevent);
            Console.WriteLine("");
            return Task.CompletedTask;
        },
        cancellationTokenSource.Token);


    try
    {
        Task.WaitAny(waitTask, readTask);
    }
    catch (TaskCanceledException)
    {
    }

    if (readTask.IsFaulted)
    {
        Console.Error.WriteLine("Failed with: {0}", readTask.Exception);
    }
}

NuGet packages (3)

Showing the top 3 NuGet packages that depend on Microsoft.SqlServer.XEvent.XELite:

Package Downloads
SabinIO.SqlTest
Library for the undertaking of testing against SQL Server
SabinIO.xEvent.Lib
Library for the processing of xEvent files
YY.DBTools.SQLServer.XEvents
Library for reading Extended Events of SQL Server

GitHub repositories

This package is not used by any popular GitHub repositories.

Version History

Version Downloads Last updated
2021.1.14.8 423 1/14/2021
2020.11.19.1 377 11/19/2020
2020.7.27.1 1,316 7/27/2020
2020.7.8.1 204 7/8/2020
2019.11.20.2 2,505 11/25/2019
2019.7.2.9 687 7/2/2019
2019.6.5.2 374 6/5/2019
2019.5.24.2 463 5/24/2019
Show less