go.temporal.io/server/common/wideevents/events.go

53 LOC · 19 covered · 34 uncovered · 5 ranges · 49 concepts · 5 introducers · 17 tests

File neighbourhood

The centred file is linked to every concept that introduces one of its ranges, every test that runs code from the file, and the gray connector concepts standing between those tests and the file's own introducer concepts. Undirected links join concepts to every file where they introduce source and concepts to the tests they introduce; arrows show specialization between the displayed concepts and bridge only concepts omitted from this view. Concept colors match the source ranges below; connector concepts have no source color and are shown in gray.

Focused file, its introducer and connector concepts, their introduced files, and tests that run code from the file

In the embedded map, ordinary wheel input scrolls the page; use the visible controls to zoom and drag to pan. Open the full-screen map for canvas navigation: wheel pans, Ctrl/Command plus wheel zooms, and arrow keys pan when this region is focused. On touch screens, open the full-screen map to pan or pinch. If JavaScript or WebGL is unavailable, use the related-file, concept, and source links on this page.

Focused file, its introducer and connector concepts, their introduced files, and tests that run code from the fileworkflow_handler.go ×11 · 117 introduced LOCworkflow_handler.go ×11common.go ×1 · 11 introduced LOCcommon.go ×1request_response.pb.go ×6 · 246 introduced LOCrequest_response.pb.go ×…visibility_store.go ×17 · 171 introduced LOCvisibility_store.go ×17telemetry.go ×2 · 15 introduced LOCtelemetry.go ×2fx.go ×1 · 4 introduced LOCfx.go ×1collector.go ×7 · 33 introduced LOCcollector.go ×7data_store_factory.go ×29 · 703 introduced LOCdata_store_factory.go ×2…TestNewServer · 0 introduced LOCTestNewServerpri_matcher.go ×1 · 2 introduced LOCpri_matcher.go ×1timer_queue_active_task_executor.go ×1 · 3 introduced LOCtimer_queue_active_task_…TestNewServer · 0 introduced LOCTestNewServermetric_client.go ×3 · 18 introduced LOCmetric_client.go ×3request_response.pb.go ×12 · 137 introduced LOCrequest_response.pb.go ×…workflow_task_completed_handler.go ×9 · 75 introduced LOCworkflow_task_completed_…pri_forwarder.go ×2 · 4 introduced LOCpri_forwarder.go ×2request_response.pb.go ×1 · 7 introduced LOCrequest_response.pb.go ×…logger.go ×1 · 5 introduced LOClogger.go ×1connections.go ×1 · 9 introduced LOCconnections.go ×1persistence_rate_limited_clients.go ×2 · 17 introduced LOCpersistence_rate_limited…logger.go ×1 · 2 introduced LOClogger.go ×1metric_client.go ×2 · 7 introduced LOCmetric_client.go ×2pri_matcher.go ×1 · 4 introduced LOCpri_matcher.go ×1task_queue_partition_manager.go ×2 · 10 introduced LOCtask_queue_partition_man…connections.go ×2 · 12 introduced LOCconnections.go ×2workflow_handler.go ×8 · 144 introduced LOCworkflow_handler.go ×8pri_matcher.go ×1 · 2 introduced LOCpri_matcher.go ×1handler.go ×1 · 20 introduced LOChandler.go ×1pri_matcher.go ×8 · 55 introduced LOCpri_matcher.go ×8matching_engine.go ×1 · 8 introduced LOCmatching_engine.go ×1server.go ×1 · 3 introduced LOCserver.go ×1logger.go ×2 · 21 introduced LOClogger.go ×2queue_scheduled.go ×1 · 2 introduced LOCqueue_scheduled.go ×1handler.go ×25 · 728 introduced LOChandler.go ×25onebox.go ×75 · 1256 introduced LOConebox.go ×75endpoint_registry.go ×2 · 26 introduced LOCendpoint_registry.go ×2server.go ×3 · 13 introduced LOCserver.go ×3scanner.go ×1 · 2 introduced LOCscanner.go ×1mask_internal_error.go ×1 · 2 introduced LOCmask_internal_error.go ×…matching_engine.go ×2 · 5 introduced LOCmatching_engine.go ×2service_resolver.go ×4 · 49 introduced LOCservice_resolver.go ×4lite_server.go ×25 · 303 introduced LOClite_server.go ×25fx.go ×44 · 705 introduced LOCfx.go ×44TestNoopLoggerDiscards · 0 introduced LOCTestNoopLoggerDiscardsevents.go ×1 · 2 introduced LOCevents.go ×1events.go ×1 · 6 introduced LOCevents.go ×1events.go ×1 · 6 introduced LOCevents.go ×1events.go ×1 · 2 introduced LOCevents.go ×1events.go ×1 · 3 introduced LOCevents.go ×1TestEmitNilLoggerIsNoop · introduced test · go.temporal.io/server/common/wideevents/TestEmitNilLoggerIsNoopTestEmitNilLoggerIsNoopTestEmitReplicationLifecycleNilSafe · introduced test · go.temporal.io/server/common/wideevents/TestEmitReplicationLifecycleNilSafeTestEmitReplicationLifec…TestEmitWritesEventWithAttributes · introduced test · go.temporal.io/server/common/wideevents/TestEmitWritesEventWithAttributesTestEmitWritesEventWithA…TestNewLoggerAttachesServiceNameAsScopeAttribute · introduced test · go.temporal.io/server/common/wideevents/TestNewLoggerAttachesServiceNameAsScopeAttributeTestNewLoggerAttachesSer…TestNoopLoggerDiscards · introduced test · go.temporal.io/server/common/wideevents/TestNoopLoggerDiscardsTestNoopLoggerDiscardsTestNewServer · introduced test · go.temporal.io/server/temporal/TestNewServerTestNewServerTestNewServerWithJSONEncoding · introduced test · go.temporal.io/server/temporal/TestNewServerWithJSONEncodingTestNewServerWithJSONEnc…with_OTEL_Collector_running · introduced test · go.temporal.io/server/temporal/TestNewServerWithOTEL/with_OTEL_Collector_runningwith_OTEL_Collector_runn…without_OTEL_Collector_running · introduced test · go.temporal.io/server/temporal/TestNewServerWithOTEL/without_OTEL_Collector_runningwithout_OTEL_Collector_r…ExampleNewServer · introduced test · go.temporal.io/server/temporaltest/ExampleNewServerExampleNewServerTestBaseServerOptions · introduced test · go.temporal.io/server/temporaltest/TestBaseServerOptionsTestBaseServerOptionsTestClientWithCustomInterceptor · introduced test · go.temporal.io/server/temporaltest/TestClientWithCustomInterceptorTestClientWithCustomInte…TestDefaultWorkerOptions · introduced test · go.temporal.io/server/temporaltest/TestDefaultWorkerOptionsTestDefaultWorkerOptionsTestNewServer · introduced test · go.temporal.io/server/temporaltest/TestNewServerTestNewServerTestNewWorkerWithOptions · introduced test · go.temporal.io/server/temporaltest/TestNewWorkerWithOptionsTestNewWorkerWithOptionsTestSearchAttributeRegistration · introduced test · go.temporal.io/server/temporaltest/TestSearchAttributeRegistrationTestSearchAttributeRegis…TestWorkerServiceHealthCheck · introduced test · go.temporal.io/server/tests/testcore/TestFunctionalTestBaseSuite/TestWorkerServiceHealthCheckTestWorkerServiceHealthC…Focused file · go.temporal.io/server/common/wideevents/events.go · 53 LOCwideevents/events.go

Graph controls are ready.

Interactive rendering requires JavaScript and WebGL. Use the related-file, concept, and source links on this page while the interactive map is unavailable.

1 package wideevents
2
3 import (
4 "context"
5
6 "go.opentelemetry.io/otel/attribute"
7 "go.opentelemetry.io/otel/log"
8 "go.opentelemetry.io/otel/log/noop"
9 )
10
11 // instrumentationName is the OTEL instrumentation scope for events emitted by this package.
12 const instrumentationName = "go.temporal.io/server/common/wideevents"
13
14 // Payload is the data of one wide event. Each event type implements it by supplying its stable
15 // event name and contributing its fields as OTEL log attributes.
16 type Payload interface {
17 // EventName is the stable name of the event type. It becomes the log record's event name so
18 // events are easy to trace/grep by type.
19 EventName() string
20 // Attributes returns the event's fields as OTEL log key-values.
21 Attributes() []log.KeyValue
22 }
23
24 // NewLogger returns the OTEL logger used to emit events for serviceName. serviceName is attached
25 // as an instrumentation-scope attribute (OTEL semconv service.name) so every emitted event carries
26 // it, replacing per-event common-tag plumbing.
27 > func NewLogger(lp log.LoggerProvider, serviceName string) log.Logger { events.go ×1
28 > return lp.Logger(
29 > instrumentationName,
30 > log.WithInstrumentationAttributes(attribute.String("service.name", serviceName)),
31 > )
32 > }
33
34 // NoopLogger returns a logger that discards all events. Safe default for tests and for
35 // deployments that have not opted in to a real LoggerProvider.
36 > func NoopLogger() log.Logger { events.go ×1
37 > return noop.NewLoggerProvider().Logger(instrumentationName)
38 > }
39
40 // Emit writes p as a single OTEL log record via logger. A nil logger is a safe no-op so call sites
41 // never need to guard. Batching, export, and serialization are handled by the LoggerProvider that
42 // produced logger.
43 > func Emit(logger log.Logger, p Payload) { events.go ×1
44 > if logger == nil {
45 > return events.go ×1
46 > }
47 > var rec log.Record events.go ×1
48 > rec.SetSeverity(log.SeverityInfo)
49 > // The event type is the record's event name so events are easy to trace/grep by type.
50 > rec.SetEventName(p.EventName())
51 > rec.AddAttributes(p.Attributes()...)
52 > logger.Emit(context.Background(), rec)
53 }