-
-
Notifications
You must be signed in to change notification settings - Fork 347
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: improve emitting of events (#1314)
* feat: improve emitting of events * rename event constants * move events package * refactor event emitting
- Loading branch information
1 parent
de6c885
commit 5028c75
Showing
8 changed files
with
87 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
// Copyright © 2023 Ory Corp | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
package events | ||
|
||
import ( | ||
"context" | ||
|
||
"github.com/ory/x/otelx/semconv" | ||
"go.opentelemetry.io/otel/trace" | ||
) | ||
|
||
const ( | ||
RelationtuplesCreated semconv.Event = "RelationtuplesCreated" | ||
RelationtuplesDeleted semconv.Event = "RelationtuplesDeleted" | ||
RelationtuplesChanged semconv.Event = "RelationtuplesChanged" | ||
|
||
PermissionsExpanded semconv.Event = "PermissionsExpanded" | ||
PermissionsChecked semconv.Event = "PermissionsChecked" | ||
) | ||
|
||
func NewRelationtuplesCreated(ctx context.Context) (string, trace.EventOption) { | ||
return RelationtuplesCreated.String(), | ||
trace.WithAttributes( | ||
semconv.AttributesFromContext(ctx)..., | ||
) | ||
} | ||
|
||
func NewRelationtuplesDeleted(ctx context.Context) (string, trace.EventOption) { | ||
return RelationtuplesDeleted.String(), | ||
trace.WithAttributes( | ||
semconv.AttributesFromContext(ctx)..., | ||
) | ||
} | ||
|
||
func NewRelationtuplesChanged(ctx context.Context) (string, trace.EventOption) { | ||
return RelationtuplesChanged.String(), | ||
trace.WithAttributes( | ||
semconv.AttributesFromContext(ctx)..., | ||
) | ||
} | ||
|
||
func NewPermissionsExpanded(ctx context.Context) (string, trace.EventOption) { | ||
return PermissionsExpanded.String(), | ||
trace.WithAttributes( | ||
semconv.AttributesFromContext(ctx)..., | ||
) | ||
} | ||
|
||
func NewPermissionsChecked(ctx context.Context) (string, trace.EventOption) { | ||
return PermissionsChecked.String(), | ||
trace.WithAttributes( | ||
semconv.AttributesFromContext(ctx)..., | ||
) | ||
} |