io.opentelemetry.api.incubator.events.EventLogger Maven / Gradle / Ivy
/*
* Copyright The OpenTelemetry Authors
* SPDX-License-Identifier: Apache-2.0
*/
package io.opentelemetry.api.incubator.events;
import javax.annotation.concurrent.ThreadSafe;
/**
* A {@link EventLogger} is the entry point into an event pipeline.
*
* Example usage emitting events:
*
*
{@code
* class MyClass {
* private final EventLogger eventLogger = eventLoggerProvider
* .eventLoggerBuilder("scope-name")
* .build();
*
* void doWork() {
* eventLogger.builder("my-namespace.my-event")
* .put("key1", "value1")
* .put("key2", "value2")
* .emit();
* // do work
* }
* }
* }
*/
@ThreadSafe
public interface EventLogger {
/**
* Return a {@link EventBuilder} to emit an event.
*
* @param eventName the event name, which identifies the class or type of event. Event with the
* same name are structurally similar to one another. Event names are subject to the same
* naming rules as attribute names. Notably, they are namespaced to avoid collisions. See event.name semantic
* conventions for more details.
*/
EventBuilder builder(String eventName);
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy