Service Fabric 事件Service Fabric events

Service Fabric 平台会为群集内发生的关键操作活动写入多个结构化的事件。The Service Fabric platform writes several structured events for key operational activities happening within your cluster. 从群集升级到副本放置决策都属于此类事件。These range from cluster upgrades to replica placement decisions. Service Fabric 公开的每个事件都映射到群集中的下列实体之一:Each event that Service Fabric exposes maps to one of the following entities in the cluster:

  • 群集Cluster
  • 应用程序Application
  • 服务Service
  • 分区Partition
  • 副本Replica
  • 容器Container

若要查看平台公开的事件的完整列表,请参阅 Service Fabric 事件列表To see a full list of events exposed by the platform - List of Service Fabric events.

下面是群集中你应会看到其事件的一些场景的示例。Here are some examples of scenarios that you should see events for in your cluster.

  • 节点生命周期事件:当节点启动、发生故障、横向缩减/扩展、重启、被激活/被停用时,这些事件将会公开以显示发生了什么情况,并帮助查明是计算机本身发生故障还是存在通过 SF 调用 API 来修改节点状态的 API。Node lifecycle events: as nodes come up, go down, scale in/out, restart, and are activated/deactivated, these events will be exposed showing you what happened, and help you identify if there's something wrong with the machine itself or if there was an API that was called through SF to modify the status of a node.
  • 群集升级:当群集升级时(SF 版本或配置更改),将会看到升级启动、滚动通过每个升级域以及完成(或回滚)。Cluster upgrade: as your cluster is upgraded (SF version or configuration change), you will see the upgrade initiate, roll through each of your Upgrade Domains, and complete (or rollback).
  • 应用程序升级:与群集升级类似,当升级滚动完成时会生成一套完整的事件。Application upgrades: just like cluster upgrades, there is a comprehensive set of events as the upgrade rolls through. 这些事件可用来了解升级是何时计划的、升级的当前状态以及整个事件序列。These events can be useful to understand when an upgrade was scheduled, the current state of an upgrade, and the overall sequence of events. 这有助于回看哪些升级已成功实施或是否触发了回滚。This is useful for looking back to see what upgrades have been rolled out successfully or whether a rollback was triggered.
  • 应用程序/服务部署/删除:针对创建或删除的每个应用程序、服务和容器都存在对应的事件,并且在缩小或扩大(例如,增加副本的数量)时非常有用Application/Service deployment / deletion: there are events for each application, service, and container, being created or deleted and useful when scaling in or out e.g. increasing the number of replicas
  • 分区移动(重新配置):每当有状态分区经历重新配置时(副本集发生更改),都会记录一个事件。Partition moves (reconfiguration): whenever a stateful partition goes through a reconfiguration (a change in the replica set), an event is logged. 如果尝试了解分区副本集更改或故障转移的频率,或者在任意时间点跟踪正在运行主副本的节点,则这非常有用。This is useful if you are trying to understand how often your partition replica set is changing or failing over, or track which node was running your primary replica at any point in time.
  • Chaos 事件:当使用 Service Fabric 的 Chaos 服务时,每次启动或停止该服务时或者当该服务在系统中导致错误时,都会看到事件。Chaos Events: when using Service Fabric's Chaos service, you will see events every time the service is started or stopped, or when it injects a fault in the system.
  • 运行状况事件:每次创建了“警告”或“错误”运行状况报告时,或者当实体恢复为“正常”运行状况状态时,或者当运行状况报告过期时,Service Fabric 都会公开运行状况事件。Health Events: Service Fabric exposes health events every time a Warning or an Error health report is created, or an entity goes back to an OK health state, or a health report expires. 这些事件对于跟踪实体的历史运行状况统计信息非常有帮助。These events are very helpful to track historical health statistics for an entity.

如何访问事件How to access events

可以通过以下几种不同的方式访问 Service Fabric 事件:There are a few different ways through which Service Fabric events can be accessed:

  • 事件通过标准通道(如 ETW/Windows 事件日志)进行记录,并且可由任何支持这些事件的监视工具(如 Azure Monitor 日志)进行可视化。The events are logged through standard channels such as ETW/Windows Event logs and can be visualized by any monitoring tool that supports these such as Azure Monitor logs. 默认情况下,在门户中创建的群集已启用诊断并让 Windows Azure 诊断代理将事件发送到 Azure 表存储,但你仍需要将此群集与 Log Analytics 资源集成。By default, clusters created in the portal have diagnostics turned on and have the Windows Azure diagnostics agent sending the events to Azure table storage, but you still need to integrate this with your log analytics resource. 详细了解如何配置 Azure 诊断代理,以便修改群集的诊断配置,从而获取更多日志或性能计数器Read more about configuring the Azure Diagnostics agent to modify the diagnostics configuration of your cluster to pick up more logs or performance counters

  • EventStore 服务的 Rest API 允许直接查询群集或通过 Service Fabric 客户端库进行查询。EventStore service's Rest APIs that allow you to query the cluster directly, or through the Service Fabric Client Library. 请参阅通过 EventStore API 查询群集事件See Query EventStore APIs for cluster events.

后续步骤Next steps